Monday 28 November 2011

House Keeping Update

Hope everyone is doing good. Sorry guys but I do keep getting a couple of Anonymous comments which keep on going into the spam folder of my comments in the dashboard so as off now only "Registered Users" can comment. I am a bit unsure about exactly who registered users are but according to the information in the setting section its only people with an OpenID which according to me should be anyone with an email address but I ain't entirely sure.

Thanks and hope you still keep reading this blog.

Sunday 27 November 2011

Environment Variables... So Thats How Its Gonna Be

OK. So I tired a couple of things that I thought might work and came across this way that I thought might actually work. You see anyone who has used Linux knows that there is such a thing as an ALIAS command. An Alias in computing is more or less the same as in normal language but if your interested this is what it means in English. So any way the theory behind it is that you take a huge command such as in my case.

> "C:\Program Files (x86)\Android\android-sdk\platform-tools\adb"

And assign a smaller easier to remember command to it like just calling

> adb

As it is I used to use ALIASes all the time when I just started off using Linux cause I couldn't remember ls and instead just kept of typing dir. Anyway I figured why not try and implement that on Windows so a quick Google search later I found this http://www.unix.com/windows-dos-issues-discussions/74664-what-dos-equivalent-alias-command.html.

So I quickly fired up the command prompt and tired the one with the "doskey" command cause frankly I don't have to patience or time to figure out how the registry editor in Windows works. I have used it a couple of times before and I would just stick to what I was told in the tutorials. So anyway this is what I type in on the command prompt.

> doskey adb="C:\Program Files (x86)\Android\android-sdk\platform-tools\adb" %1

Now this is what I undertand by this I have assigned the string "adb" the value of a program with the absolute path (which I aint repeating) after which one more argument that should be supplied to the program I just called. So after setting this up I try the "adb" command on its own which should produce the help screen for the command explaining all the various commands that should be followed. I cross my fingers and press the enter key and thats it, it worked... I can honestly say that at this point in time I slap myself on my forehead with excitement. I spent almost 2 days trying all sorts of clever ways to link up the commands to the command prompt and this worked!!!

OK now time to get some work done...

OK so if you got here you probably knew there was something wrong. Yeah so when I typed in "adb devices" which is to check which devices are connected to the computer in debug mode I still get the help screen. So, I think to myself huh maybe I have forgotten the command and it should be "adb device" but no its not that either so I try one that I am 100% sure works cause it is the one that visible on the help screen "adb version" and guess what, that don't work either. So after reasonable amount of testing I figured out that although the alias has worked but it doesn't seem to be sending any arguments to "adb" therefore, my search carries on :(. Sorry guys still now solution but if you guys have any suggestions please do share :).

--UPDATE--

Holly crap sorry guys I was being dump but after having a look at the help file for "DOSKEY" again I figured that it needs $1 instead of %1 so the command

> doskey adb="C:\Program Files (x86)\Android\android-sdk\platform-tools\adb" $1

works fine. Yes after enough testing it can be concluded that I have found my solution :D... Now time to make aliases for some other commands

--/UPDATE

Friday 25 November 2011

Environmental Variables... We meet again!!!

So for those of you who don't know what Environmental Variables are here is a quick and dirty explaination. When you open the command prompt/terminal in your Windows, Mac, Unix or Linux computer and type a command the operating system looks for that command in a bunch of folders/directories in your file system. These bunch of folders is called the "Path" variable which is basically just a string that gives the absolute path to the folder that contains different commands. So on the Windows side of things some of the places that the system looks into include.
C:\Windows;
C:\Windows\system32;
And loads of other places. In the Linux/Unix/Mac side of things one of the directories include.
\usr\bin;
\usr\local\bin;
And loads some other places that usually depends on your flavor of the operating system.

If you are interest in finding out your path variable in the command prompt/terminal type this for Windows users:

echo %PATH% (Windows will accept everything in small letters)

On the Linux/Unix/Mac side of things type in:

echo $PATH (Depending on the shell and the Linux variant you are running it may accept things in small letters but to be safe use caps).

Now since I have been using Ubuntu 11.10 for about a month or so exclusively I have become used to how you can add software packages and commands to the list of commands that are built into Linux. This process can probably also be called softlinking applications. This therefore, allows me to stay in the terminal and when I want I can open the program that I want with a simple command. If you are interested in seeing how to soft link applications in Linux please refer to this article not written by me.

On the Windows side of things it is a bit different instead of creating a link to the application you want to be available in the command line you simply add the path to the folder to the Environmental variable by following the following simple steps.

  • Right-click on the "My Computer" icon on the desktop or press Windows + Pause/Break (another shortcut that I need to add to the previous post).
  • Click on "Advanced system settings".
  • Then click on "Environment Variables...".
  •  Look for a variable called "PATH" and double-click it or select it and click on "Edit".
  • In the "Variable value:" textbox at the end of the string that already exists add a semi-colon if its not already there and paste the path to the folder that your interested in. Note the path has to be the absolute path.
And thats it. At this point some of you might be asking why I would bother with such an easy pocedure? Well here is where things get slightly complicated and interesting. You see Windows has a character limit for the length of the variable which is 1027 (which if you ask me is a weird number) which is OK for normal users but with me having installed Perl, Python, GNU gcc and a bunch of other command line utilities this variable has been maxed out and can not take any more values. So I am determined to find another way around it.

The goal for this exercise is to have the adb tool available to me in the command line so I don't have to be in the Android-SDK folder and in the Platform-Tools folder to be able to access it. For those who don't know adb is a command line utility that is part of the Android SDK for developing applications and connecting to your device through the terminal and accessing things that even Eclipse with ADT installed will not let you.

Attempt 1
So, since I am so used to the Linux way of doing things I thought making a shortcut of the executable file and placing that in the C:\Windows directory would do the trick. So after I made a shortcut to the adb executable and placed it in the Windows folder and tired to run in the command line this was the result.





OK so maybe I should have renamed the shortcut so the name is just "adb.exe". So I did the renaming and still same result :(. Needless to say I was just a bit annoyed at this point in time. Although guess what, even though I have extensions turned on and I had explicitly named the file how I wanted it to be named when I did a "dir" command guess what I notice.
Yup... Windows will add the lnk extension even though I had renamed it. OK no problem so the lnk extension is still there I decided to rename the file in the command prompt itself so that it doesn't have the lnk extension.
So I have reached a deadend. I know that the program can be executed on the command prompt but thats only if I am in the folder that contains the file or if the path variable has been set.

So I leave you guys at a bit of a sad ending. I am continuing my pursuit or finding a way to solve this problem. Unfortunately making a symbollic link to the application doesn't solve the problem either. If anyone has any ideas please let me know as well.

Monday 31 October 2011

Windows Shortcuts

I have been using Windows for a considerably long time and although I don't consider myself an expert in Windows support I think I can help people out when they are stuck in something relatively easy. This is not a guide on troubleshooting Windows but I am hoping to make it an evolving list of commands and keyboard shortcuts that most Windows users and all power-users should know.
Please do feel free to leave a comment and add any of your favourite commands/tips/tricks. I must point out that I am using Windows 7 on this machine but I hope to point out which commands will work on older versions of Windows.
A couple of things to note at this point before we start. When I say the "Windows key" I mean key. And when I say "Run" I usually mean pressing the Windows key + R or go to the start button and on Windows 7 and Vista just type in the command in the search bar and hit "Enter" or in older Windows Click on "Start" and look for "run".
When I say Windows (capital W) I mean the operating system while when I say window (lowercase w) I mean an application that is open or just anything that is open in general.
Now with the formalities out of the way here are some of the most used commands by me.

General Purpose Commands

These are commands that can usually be done from within any program and window and sometimes that commands actually work on the window that is in focus.

  • Windows key + E: This porbably one of the most used shortcuts for me. It opens up a new Windows Explorer window. The location that the explorer is usually pointing towards is usually the "My Computer" one.
  • Windows key + Num: This command is probably one that sold Windows 7 to me. The idea is that you pin applications to your start bar and then hitting the Window key along with the position of the application you want to be opened will open the application. In my case I have the following configuration. So in my case Windows key + 1 would open up Firefox, Windows key + 2 would open up Internet Explorer and so on. The maximum number of application  you can pin to the start bar does depend on your personal perferance but Windows + 11  will not work to open the 11th application on your start bar, am just saying.
  • Windows key + Directional Arrows: Another one of those features that sold Windows 7 to me. When a window is in focus you can make it take up half of the screen by using Windows + Left direction arrow to make it take up the left half of the screen and Windows + Right direction arrow to make it take up the right side of the screen. In addition Windows + Up direction arrow will make the current window maximised and Windows + Down direction arrow will either minimise your window or restore it to its original size.
  • Windows key + R: Opens up the Run dialogue box. This one might not be very important for a normal user but I tend to use this quit a bit even though its just to open up the command prompt. Some of the commands you can type into the Run dialogue are given later on in this post.
  • Windows key + D: Not used as much by myself but I see the usefulness. This will show and hide your desktop. If there are windows open and covering the desktop then this shortcut will show you the desktop and if you press it again it will get the windows back up hiding the desktop. A funny thing though this command does not work if you manually minimise all the windows yourself and want to bring them back up.
  • Windows key + M: This will simply just minimise all the windows showing you the desktop.
  • Windows key + U: Opens up the utilities window. In Windows 7 this is the settings for the screen reader, mangifier and some other usability stuff, but in Windows XP this would open up the Control Panel so I would use it as a fast way of getting into the Control Panel.
  • Windows key + P: Another one of the shortcuts I can no longer live without. On any Windows 7 and I think Vista machine hitting this key combo will bring up a dialogue for selecting the output of the monitor.
     
  • Windows key + F: This is probably one of the most well known commands. This key combo opens up the search window to look for a file or folder on the computer.
  • Windows key + L: This will lock the computer.
  • Windows key + N: Focuses on the notifications. Probably most useful when the annoying bubble pops up instead of clicking on it just press this combo and voila.
  • Windows key + X: This is one very useful command available in both Windows 7 and Vista. It opens up the "Mobility Center" although it works on desktops as well. It will let you do many things like change brightness, volume and set your battery profile.  
The most classic of Windows commands is probably Ctrl + Alt + Delete. I have not included that in this list because I could not think of anyone who doesn't know that one. Along with its younger brother Ctrl + Shift + Escape  both deserve an honorable mention in the post though so here it is.

--Update--


Since the time that I wrote this blog post I discovered one more shortcut. If you hold down the Windows key + the spacebar it will temporarily display your desktop. I personally dont have much use for it because I have absolutely no icon displaying on my desktop but there you go one more shortcut for you to show off with.

Hope this has been helpful and watchout for the followon of the shortcuts that are still to come and a bunch of useful Run commands that might actually let you do things slightly faster.

--/Update--

Thursday 27 October 2011

A Fresh Start

After a long time away from blogging and not being serious about it this is going to be a fresh start of this blog. I am hoping to be posting much more regularly and learning new things on the way