utilities

Mac OS X shell utility that shows individual cpu usage in multi-core systems

﹥>﹥吖頭↗ 提交于 2019-12-09 02:39:54
问题 I've been looking for a osx utility that shows cpu usage for each cpu. For example CPU 0 - 10% CPU 1 - 2% ... I know of many ways of getting this information in other Unix-like system (/proc, mpstat, etc) but none work in osx. The most useful one for Mac is top but it only shows total cpu usage. I need the application to be run from the shell so that I can log the usage over time. I also tried cpuwalk.d but it only shows you if the application is running in one or more cores. If you take a

posmax: like argmax but gives the position(s) of the element x for which f[x] is maximal

假装没事ソ 提交于 2019-12-07 23:23:58
问题 Mathematica has a built-in function ArgMax for functions over infinite domains, based on the standard mathematical definition. The analog for finite domains is a handy utility function. Given a function and a list (call it the domain of the function), return the element(s) of the list that maximize the function. Here's an example of finite argmax in action: Canonicalize NFL team names And here's my implementation of it (along with argmin for good measure): (* argmax[f, domain] returns the

Symfonian way to store custom utilities and helpers in symfony 2

旧巷老猫 提交于 2019-12-07 03:55:03
问题 Sometimes there are some functions or procedures that I write as helpers and utilities to use all across my apps... Now I'm starting to use Symfony 2, and I don't know what is the best way according to symfony 2 philosophy of Bundles... I wouldn't like to have to create a whole Bundle just to store maybe a couple of functions, but if it is the best way I'll do it. Thanks! 回答1: If your utilities and helpers are not Symfony specific, create a library in a separate repo and install it to vendors

posmax: like argmax but gives the position(s) of the element x for which f[x] is maximal

旧时模样 提交于 2019-12-06 12:43:40
Mathematica has a built-in function ArgMax for functions over infinite domains, based on the standard mathematical definition . The analog for finite domains is a handy utility function. Given a function and a list (call it the domain of the function), return the element(s) of the list that maximize the function. Here's an example of finite argmax in action: Canonicalize NFL team names And here's my implementation of it (along with argmin for good measure): (* argmax[f, domain] returns the element of domain for which f of that element is maximal -- breaks ties in favor of first occurrence. *)

What to include in a Utility Library [closed]

爷,独闯天下 提交于 2019-12-06 04:36:28
Closed . This question is opinion-based . It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post . Closed 3 months ago . With more and more projects under my belt I find that I am often repeating many common tasks from project to project, client to client. So I have started to assemble a "utility" library, a collection of these common elements that are often repeated from project to project. So far I have utilities to resize images, export data grids to excel, send e-mails, and replace

Symfonian way to store custom utilities and helpers in symfony 2

丶灬走出姿态 提交于 2019-12-05 07:48:25
Sometimes there are some functions or procedures that I write as helpers and utilities to use all across my apps... Now I'm starting to use Symfony 2, and I don't know what is the best way according to symfony 2 philosophy of Bundles... I wouldn't like to have to create a whole Bundle just to store maybe a couple of functions, but if it is the best way I'll do it. Thanks! Elnur Abdurrakhimov If your utilities and helpers are not Symfony specific, create a library in a separate repo and install it to vendors using the deps with the bin/vendors install command or via Composer , which will become

Java: Synchronization Utility

淺唱寂寞╮ 提交于 2019-12-05 02:53:14
问题 I am asking this purely to determine the worthwhile-ness of implementing the class in Question ... Do you know of a Java utility class that takes an un-synchronized instance, uses reflection to investigate that instance, and returns the input instance "wrapped" within synchronized calls ? ( ie: A factory which creates a synchronized delegate class for any instance ) 回答1: I like Jon Skeet's answer; it's seeing the forest instead of the trees. But to answer the question: Assuming that the

MySQL Workbench > Plugins > Utilities > Reformat SQL Query

你离开我真会死。 提交于 2019-12-04 16:46:53
问题 At some point I installed MySQL Workbench 5.2.47 Revision 10398. This version has the feature to reformat an SQL query located at: Plugins > Utilities > Reformat SQL Query I like this feature and I use it almost every day. Now every newer version I downloaded from http://dev.mysql.com/downloads/workbench/ misses this feature. How do I get it back? 回答1: Just answering my own question. I found the feature by accident. It was moved and renamed to and is now located here: Edit > Format > Beautify

Decrement a date in Java

白昼怎懂夜的黑 提交于 2019-12-04 01:25:23
I want to get the previous day (24 hours) from the current time. e.g if current time is Date currentTime = new Date(); 2011-04-25 12:15:31:562 GMT How to determine time i.e 2011-04-24 12:15:31:562 GMT You can do that using Calendar class : Calendar cal = Calendar.getInstance(); cal.setTime ( date ); // convert your date to Calendar object int daysToDecrement = -1; cal.add(Calendar.DATE, daysToDecrement); date = cal.getTime(); // again get back your date object I would suggest you use Joda Time to start with, which is a much nicer API. Then you can use: DateTime yesterday = new DateTime()

Is it possible to use a string as a delimiter in unix cut command?

…衆ロ難τιáo~ 提交于 2019-12-03 15:33:11
问题 If I want to cut a list of text using a string as a delimiter, is that possible? For example I have a directory where a list of shell scripts call same perl script say abc.pl So when I do $grep abc.pl * in that directory, it gives me following results xyz.sh: abc.pl 1 2 xyz2.sh: abc.pl 2 mno.sh: abc.pl 3 pqr.sh: abc.pl 4 5 I basically want all the output after "abc.pl" (to check what range arguments are being passed to the perl right now) When I tried $grep abc.pl * | cut -d'abc.pl' -f2 OR