March 28, 2012

Techbits #12: AutoHotKey - Create and not just configure hotkeys!

You might have heard about hotkeys or used some application to configure/setup hotkeys for invoking your favourite applications.

AutoHotKey helps you achieve not just that but also much much more including automating almost anything by sending keystrokes and mouse clicks. Anytime you find yourselves repeating something again and again, it should trigger you to automate it and it is exactly where AutoHotKey comes handy. It appears a little bit daunting at first but I strongly urge you to overcome that initial inertia and start using the tool - it increases your productivity greatly and you'll really appreciate it.

Go to http://www.autohotkey.com/ and try the installer!

Provided below are few examples to get you quickly started. These code snippets have to be kept in the configuration (.ahk) file of AutoHotKey. Note that the lines starting with semicolon are comments.

Let's start with the simplest hotkey configurations.

Hotkey #1

; when you press Win+n (Windows key + n), run an application called "Notepad"
#n::Run Notepad

Hotkey #2

; when you press Win+m (Windows key + m), run an application called "Notepad++"
#m::Run Notepad++

Now, let's move on to a little bit more complex ones.

Hotkey #3

#g::
Run
http://www.google.com/search?q=%clipboard%
return

What does that do? When you press Win+g (Windows key + g), it constructs a URL with the clipboard contents and opens it - in this case, it googles for what's there in your clipboard.

Hotkey #4

#h::
Run
http://www.hindu.com/%A_YYYY%/%A_MM%/%A_DD%/10hdline.htm
return

When you press Win+h (Windows key + h), a URL is constructed using current year, month & date and opened using your default browser - hope it's Firefox by now ;)

Even more complex ones - note that this complexity representation is just on a relative scale and there are much more complex ones!

Hotkey #5

#p::
Run D:\Projects\Customer
WinWait
D:\Projects\Customer
WinActivate
Send ! x
Send !veo
return

When you press Win+p (Windows key + p), opens the specified folder in Windows Explorer, maximizes it (Alt + space + x) and opens the folder view (Alt+v+e+o).

Hotkey#6

#a::
InputBox, varInput, Please enter some random text...
Run, notepad.exe
WinWaitActive, Untitled - Notepad
SendInput, %varInput%
SendInput, !f{Up}{Enter}{Enter}
WinWaitActive, Save
SendInput, SomeRandomFile{Enter}
MsgBox, Your text`, %varInput% has been saved using notepad!

When you press Win+a (Windows key + a), well, instead of me trying to explain what's there, just go through it and you'll get an idea.

To summarize, this blog post just goes on to show how AutoHotKey acts like a Swiss Army knife and how much powerful it can be.

March 25, 2012

Techbits #11: Avoiding "Useless use of" commands in Unix

Let's check out another interesting Unix-related Techbit related to avoiding the usage of commands when they're not necessary.

Such usages are also fondly referred in "Useless use of ..." category awards :-) There're many varieties under this class like "Useless use of cat", "Useless use of grep & awk", "Useless use of wc -l" etc. Provided below are few.

Useless use of "cat"

cat file.txt | grep pattern can very well be expressed as grep pattern file.txt

Useless use of "grep"

ps -ef | grep java | grep -v grep can be ps -ef | grep '[j]ava'

ps -ef | grep java | awk '{print $2}' can just become ps -ef | awk '/java/ {print $2}'

Useless use of "wc"

ls -1 | grep pattern | wc -l can be written as ls -1 | grep -c pattern

March 17, 2012

Techbits #10: PuTTY Connection Manager

Ever wanted a "tabbed" version of the favourite Telnet/SSH terminal emulator PuTTY? Then this is for you.

"PuTTY Connection Manager" is built on top of PuTTY and has additional features like tabs, credential storage (encrypted) for auto-login etc. which help increase your productivity by a great deal, especially if/when you do not need the X GUI and CLI is more than sufficient to perform your tasks.

What's more?  It's completely free - not just for personal use but for commercial usage as well. And, it's a very good free alternative to a licensed product like SecureCRT.

You can download this utility from http://puttycm.free.fr/.

March 11, 2012

Techbits #9: Use "exec"

If you are working on Unix-based systems like Solaris and Linux, then this Techbit is for you.

When you are no longer interested in the current process and want to work on some other process, use exec to replace the existing process with new the one.

Where is it helpful? I often see people logging on to servers where they find that the shell is Bourne and type bash immediately. Nothing is done with the previous shell process plus there's an overhead to exit twice while disconnecting from the server. In such cases, use exec bash - not only are you going to be more graceful and respectful to using system resources but also increasing productivity by saving yourself from typing exit twice each and every time!

An addendum to the provided example is that if you find yourself repeatedly changing the shell every time you log in to a server, then you should change the default login shell once for all. Of course, this should be done only if the specific login is not being used by any process or application - changing the login shell in such cases would result in the application experiencing unexpected behaviour because it could possibly miss the shell and its start-up parameters thereby. This is a corner case scenario but it needs to be taken into consideration nonetheless.

March 3, 2012

Techbits #8: Audacity: Record & Edit Audio

Audacity is required for being honest. Audacity is required for being righteous. Audacity is required to stand by what is truthful. Audacity, as a tool, is also required for recording/editing audio too!

Interested in recording audio through your microphone - for example, to record audio books that can be used by the blind? Or how about editing it out to correct and strip out unwanted bits? How about creating your own audio clip by piecing together various snippets from your favourite mp3 audio/songs?

If you have answered "yes" to any of the questions in the previous paragraph, all that you would need is Audacity - I meant, the Open Source Software which can be used to record and edit audio.

It takes a little bit of your time to get accustomed to the functionality provided by Audacity and its usage - as is the case with getting introduced to any new tool. Once you make that initial investment of your effort, you would be glad you found this tool.

Go ahead and give Audacity a try at http://audacity.sourceforge.net/.

March 1, 2012

Scribe Requirement & Tips

This is a follow-up to the previous post titled "My first experience as a Scribe".

There is a requirement for scribes to write exams tomorrow and day after i.e. on March 2nd and 3rd. Further details on whom to contact and the address of the examination center can be found at http://helpinghandsorg.blogspot.in/2012/02/blind-people-need-scribes-for.html.

It was not so easy to find the required information on that website. Provided below are snippets taken from the same for easy and quick reference:

Finals:
2nd march >> 24 students for Sanskrit, 22 students for Telugu
3rd march >> 38 students for Sanskrit, 37 students for Telugu

Timings: 7:30 to 11:30 am
Place: Kasturba Gandhi College for Women,
Indira Gandhi college,
Govt Junior college,
Marredpally,
Secunderabad - 500026.

More details about this project:
Ajay Veesam : 8801975135
Karthik Reddy : 9494884929
Kiran : 8099523135
Buchi Reddy : 9885113404

Few quick tips that can be helpful if you are planning to be a scribe:
  1. Practice writing beforehand for an hour or two if you've lost the habit of writing.
  2. Do not hesitate to write an exam with apprehensions about your handwriting not being very good.
  3. Do not hesitate to write an exam with apprehensions your writing speed being very less.
  4. You can easily confirm the above (2nd and 3rd) fears by showing your sample writing to few friends!
  5. Plan to reach the examination center at least half-an-hour before the start time.
  6. If possible, take the standard set of pen, pencil, eraser & ruler along with you.
  7. Always keep a watch on time and your progress & pace to complete.
  8. Go and write the exam with as much (or more) sincerity as if you were to write your own exam.
Last but not least, enjoy the joy of giving!