Yesterday was Sri Narasimhadev's appearance day. A lot of obstacles got cleared!!
1. gimp - multiple layer editing. When a layer is pasted, it's in floating state; right click and say new layer.
2. Java - new BufferedReader(new FileReader("hari.txt")) - efficient read operation
3. when interviewing, check for behavioral aspects first. Behavioral aspects include things like team work, hunger to learn and resourcefulness. (we need people who can stay with us and not just run after money.)
4. jQuery - a good JavaScript library - decreases coding for all kinds of JavaScript tasks.
5. jQuery UI - another JavaScript library built on top of jQuery. Good for animations and interactive GUI
Monday, May 16, 2011
Saturday, April 16, 2011
Display UUID of disks in Debian
Jaya Srila Prabhupada.
The command is: blkid
Jaya Sri Sathguru Bhagawan Sridhara Swamy Maharaja
The command is: blkid
Jaya Sri Sathguru Bhagawan Sridhara Swamy Maharaja
Wednesday, April 13, 2011
What I learned the last week
Jaya Srila Prabhupada (most merciful savior)
TCP/IP programming in Windows.
Started with my own classes ServerSocketFactory and ClientSocketFactory which encapsulated the TCP/IP api of .NET. One more class NetworkSocket encapsulated the Socket api of .NET
Learned by mistakes.
First mistake was that I bound the listening socket to the localhost (SockAddress.Local) instead of binding to SocketAddress.Any
I learnt that one can chain readers like this:
new StreamReader(new NetworkStream(new Socket(adr_family, sock_type, proto_type)));
Now writing or reading from a reader object writes to the underlying stream!
The client used to ask for something by sending a string of characters with a newline trailing and I was trying to receive it without expecting a newline. Sometimes it was the other way round. Both should settle on one scheme. When we call the 'ReadLine' method on a StreamReader, it doesn't return until it sees a newline. The ReadLine method always returns a string that was read from the stream (here socket).
What happens when you are trying to read from a connected socket but the remote socket is closed, the Receive method (analogous to 'recv' in unix socket programming) returns immediately with zero bytes. Analogously if we are using the 'ReadLine' method on a StreamReader of a socket, the ReadLine method returns immediately with a null value (and NOT a null string).
Jaya Sathguru Bhagawan Sri Sridhara Swamy maharaja.
TCP/IP programming in Windows.
Started with my own classes ServerSocketFactory and ClientSocketFactory which encapsulated the TCP/IP api of .NET. One more class NetworkSocket encapsulated the Socket api of .NET
Learned by mistakes.
First mistake was that I bound the listening socket to the localhost (SockAddress.Local) instead of binding to SocketAddress.Any
I learnt that one can chain readers like this:
new StreamReader(new NetworkStream(new Socket(adr_family, sock_type, proto_type)));
Now writing or reading from a reader object writes to the underlying stream!
The client used to ask for something by sending a string of characters with a newline trailing and I was trying to receive it without expecting a newline. Sometimes it was the other way round. Both should settle on one scheme. When we call the 'ReadLine' method on a StreamReader, it doesn't return until it sees a newline. The ReadLine method always returns a string that was read from the stream (here socket).
What happens when you are trying to read from a connected socket but the remote socket is closed, the Receive method (analogous to 'recv' in unix socket programming) returns immediately with zero bytes. Analogously if we are using the 'ReadLine' method on a StreamReader of a socket, the ReadLine method returns immediately with a null value (and NOT a null string).
Jaya Sathguru Bhagawan Sri Sridhara Swamy maharaja.
Monday, March 28, 2011
Using 'du' command to leave out other filesystems
Jaya Srila Prabhupada.
du -hsx /home
this command leaves out other filesystems that may have been mounted in the filesystem heirarchy starting at /home.
Jaya Sathguru Bhagwan Sridhara Swamy Maharaja.
du -hsx /home
this command leaves out other filesystems that may have been mounted in the filesystem heirarchy starting at /home.
Jaya Sathguru Bhagwan Sridhara Swamy Maharaja.
Backing up home folder
Jaya Srila Prabhupada
cp -vrx /home /home/ghd/mnt-backup
Because we use the -x option, this command doesn't copy contents from other filesystems that may have been mounted in the filesystem heirarchy starting from /home.
Jaya Sathguru Bhagwan Sridhara Swamy Maharaja.
cp -vrx /home /home/ghd/mnt-backup
Because we use the -x option, this command doesn't copy contents from other filesystems that may have been mounted in the filesystem heirarchy starting from /home.
Jaya Sathguru Bhagwan Sridhara Swamy Maharaja.
Thursday, March 17, 2011
Conditional Expression in C
Jaya Srila Prabhupada
A conditional expression is of the form:
expression ? expression_true : expression_false
Yes, the conditional expression involves the ternary operator!
Jaya Sri Sathguru Sridhara Swamy Maharaj.
A conditional expression is of the form:
expression ? expression_true : expression_false
Yes, the conditional expression involves the ternary operator!
Jaya Sri Sathguru Sridhara Swamy Maharaj.
Wednesday, March 16, 2011
Sorting the output from 'ls' command when filenames have numbers
Jai Srila Prabhupada.
Many times filenames contain numbers of arbitrary length - file1, file2, ..., file9, file10, file11, ..., file19, file20, file21, ... so on. When we run the 'ls' command, the output is sorted based on dictionary order and not in the way shown above.
Use the following command:
ls | sort -V
Note that we are calling 'ls' without any arguments, otherwise it won't work.
Jaya Sathguru Bhagawan Sri Sridhara Swamy Maharaja.
Many times filenames contain numbers of arbitrary length - file1, file2, ..., file9, file10, file11, ..., file19, file20, file21, ... so on. When we run the 'ls' command, the output is sorted based on dictionary order and not in the way shown above.
Use the following command:
ls | sort -V
Note that we are calling 'ls' without any arguments, otherwise it won't work.
Jaya Sathguru Bhagawan Sri Sridhara Swamy Maharaja.
Subscribe to:
Posts (Atom)