Search Results

Search found 9 results on 1 pages for 'fahdshariff'.

Page 1/1 | 1 

  • disown a process in ksh

    - by fahdshariff
    The "disown" command works in bash, but not in ksh. If I have started a process in ksh, how can I "disown" it, so I can exit my shell. (I know about nohup, but the process has already started!)

    Read the article

  • Identifying and removing null characters in UNIX

    - by fahdshariff
    I have a text file containing unwanted null characters. When I try to view it in I see ^@ symbols, interleaved in normal text. How can I: a) Identify which lines in the file contains null characters? I have tried grepping for \0 and \x0, but this did not work. b) Remove the null characters? Running strings on the file cleaned it up, but I'm just wondering if this is the best way? Thanks

    Read the article

  • Get Time in London

    - by fahdshariff
    How can I get the current local wall clock time (in number of millis since 1 Jan 1970) in London? Since my application can run on a server in any location, I think I need to use a TimeZone of "Europe/London". I also need to take Daylight Savings into account i.e. the application should add an hour during the "summer". I would prefer to use the standard java.util libraries. Is this correct? TimeZone tz = TimeZone.getTimeZone("Europe/London") ; Calendar cal = Calendar.getInstance(tz); return cal.getTime().getTime() + tz.getDSTSavings(); Thanks

    Read the article

  • Find all words containing characters in UNIX

    - by fahdshariff
    Given a word W, I want to find all words containing the letters in W from /usr/dict/words. For example, "bat" should return "bat" and "tab" (but not "table"). Here is one solution which involves sorting the input word and matching: word=$1 sortedWord=`echo $word | grep -o . | sort | tr -d '\n'` while read line do sortedLine=`echo $line | grep -o . | sort | tr -d '\n'` if [ "$sortedWord" == "$sortedLine" ] then echo $line fi done < /usr/dict/words Is there a better way? I'd prefer using basic commands (instead of perl/awk etc), but all solutions are welcome! To clarify, I want to find all permutations of the original word. Addition or deletion of characters is not allowed.

    Read the article

  • Identifying and removing null characters in UNIX

    - by fahdshariff
    I have a text file containing unwanted null characters. When I try to view it in I see ^@ symbols, interleaved in normal text. How can I: a) Identify which lines in the file contains null characters? I have tried grepping for \0 and \x0, but this did not work. b) Remove the null characters? Running strings on the file cleaned it up, but I'm just wondering if this is the best way? Thanks

    Read the article

  • Switch to BigInteger if necessary

    - by fahdshariff
    I am reading a text file which contains numbers in the range [1, 10^100]. I am then performing a sequence of arithmetic operations on each number. I would like to use a BigInteger only if the number is out of the int/long range. One approach would be to count how many digits there are in the string and switch to BigInteger if there are too many. Otherwise I'd just use primitive arithmetic as it is faster. Is there a better way? Is there any reason why Java could not do this automatically i.e. switch to BigInteger if an int was too small? This way we would not have to worry about overflows.

    Read the article

  • How to Initialise a static Map in Java

    - by fahdshariff
    How would you initialise a static Map in Java? Method one: Static initialiser Method two: instance initialiser (anonymous subclass) or some other method? What are the pros and cons of each? Here is an example illustrating two methods: import java.util.HashMap; import java.util.Map; public class Test { private static final Map<Integer, String> myMap = new HashMap<Integer, String>(); static { myMap.put(1, "one"); myMap.put(2, "two"); } private static final Map<Integer, String> myMap2 = new HashMap<Integer, String>(){ { put(1, "one"); put(2, "two"); } }; }

    Read the article

1