utilities

Creating a Utilities Class?

☆樱花仙子☆ 提交于 2019-12-03 09:51:18
I'm very new to OOP and am trying my hardest to keep things strictly class based, while using good coding principles. I'm a fair ways into my project now and I have a lot of general use methods I want to put into an utilities class. Is there a best way to create a utilities class? public class Utilities { int test; public Utilities() { } public int sum(int number1, int number2) { test = number1 + number2; } return test; } After creating this Utilities class, do I just create an Utilities object, and run the methods of my choosing? Do I have this Utilities class idea correct? You should make it

line-end agnostic diff?

时光毁灭记忆、已成空白 提交于 2019-12-03 09:49:31
I'm working on a mac, with some fairly old files. Different files were created by different programs, so some of them end with \r (mac) and some with \n (unix). I want to be able to run commands like diff, grep, etc on these files, but the ones that have \r are treated as one giant line. does anyone know of a version of diff, grep, etc that will work correctly with all new-lines? ETA: I'd also like them to be unix utilities so I can use them in scripts, emacs, etc... As Jay said, Diff'nPatch seems what you are looking for. Alternatively you can convert all your '\r' line endings in '\n' in a

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

对着背影说爱祢 提交于 2019-12-03 05:05:34
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 $grep abc.pl * | cut -d'abc\.pl' -f2 its giving me cut: invalid delimiter When I read man for cut it

Sending an arbitrary Signal in Windows?

爱⌒轻易说出口 提交于 2019-12-03 04:49:59
问题 Linux supports sending an arbitrary Posix-Signal such as SIGINT or SIGTERM to a process using the kill -Command. While SIGINT and SIGTERM are just boring old ways to end a process in a friendly or not-so-friendly kind of way, SIGQUIT is meant to trigger a core dump. This can be used to trigger a running Java VM to print out a thread dump, including the stacktraces of all running threads -- neat! After printing the debugging info, the Java VM will continue doing whatever it was doing before;

Free utility which runs in Linux to create a UML class diagram from Java source files

白昼怎懂夜的黑 提交于 2019-12-03 04:15:13
问题 I prefer to jot down UML-diagrams on paper and then implement them using Java. It would be nice to have a utility which could create UML-diagrams for me which I may share on-line and include in the digital documentation. In other words: I want to create UML diagrams from Java source code. The utility must be able to: Run in Linux. Handle Generics, i.e show List<Foo> correctly in parameters and return type. Show class inheritance and interface implementations. It's nice if the utility is able

RTMP: Is there such a linux command line tool?

此生再无相见时 提交于 2019-12-03 02:46:30
问题 I have looked everywhere to find a linux utility that will allow me to download rtmp streams. Not flv video but MP3 streams. The location of the streams I want to download are in this format. rtmp://live.site.com/loc/45/std_fc74a6b7f79c70a5f60.mp3 Anyone know of such a command line tool? Or even anything close to what I am asking for? I do not want full software applications and it would be great if it worked on Linux via Shell or something. Thanks all 回答1: One of the following should do, if

Stable Sorting, ie, Minimally-Disruptive Sorting

百般思念 提交于 2019-12-02 23:04:03
Suppose I have a list of things (numbers, to keep things simple here) and I have a function I want to use to sort them by, using SortBy. For example, the following sorts a list of numbers by last digit: SortBy[{301, 201}, Mod[#,10]&] And notice how two of (ie, all of) those numbers have the same last digit. So it doesn't matter which order we return them in. In this case Mathematica returns them in the opposite order. How can I ensure that all ties are broken in favor of how the items were ordered in the original list? (I know it's kind of trivial but I feel like this comes up from time to

*FREE* Screencasting Apps & Utilities [closed]

北城余情 提交于 2019-12-02 18:17:35
I know there has been previous talk on here about screencasting tools/apps, however I thought I would be more specific in what I am after in the hope that it can help me and others :) I am looking at trialling some screencasts on my blog . There are numerous reasons for this (hopefully being more helpful to readers, improving my elocution etc.) So, do you know of any good FREE screencasting tools & utilities to get started? I am not interested in apps that cost at this time because I do not want to shell out until I am more comfortable with the medium! Also, if you have posted screencasts

Sending an arbitrary Signal in Windows?

烂漫一生 提交于 2019-12-02 18:01:37
Linux supports sending an arbitrary Posix-Signal such as SIGINT or SIGTERM to a process using the kill -Command. While SIGINT and SIGTERM are just boring old ways to end a process in a friendly or not-so-friendly kind of way, SIGQUIT is meant to trigger a core dump. This can be used to trigger a running Java VM to print out a thread dump, including the stacktraces of all running threads -- neat! After printing the debugging info, the Java VM will continue doing whatever it was doing before; in fact the thread dump just happens in another spawned thread of maximum priority. (You can try this

Free utility which runs in Linux to create a UML class diagram from Java source files

廉价感情. 提交于 2019-12-02 16:42:07
I prefer to jot down UML-diagrams on paper and then implement them using Java. It would be nice to have a utility which could create UML-diagrams for me which I may share on-line and include in the digital documentation. In other words: I want to create UML diagrams from Java source code. The utility must be able to: Run in Linux. Handle Generics, i.e show List<Foo> correctly in parameters and return type. Show class inheritance and interface implementations. It's nice if the utility is able to: Run in Windows and Mac OS X. Display enums in some nice manner. Generate output in a diagram format