Sunday, May 6, 2012

Power Tools

Sticking to a theme with my first post, today's notes will continue to improve the Windows operating system, with power tools.  Code Complete, a highly recommended book in the field of computer science and software development compares software development (software engineering) to construction. The analogy work extremely well because it is a concept that any one can relate to. Expanding on this analogy is where I have constructed the name for this blog.

Through out my child hood my grandfather taught me the importance of having 'good tools', in particular how useful a pocket knife is. He focused on teaching me about a pocket knifes not because it is useful for cutting thing but it is also doubles as others tools, like a lever, or a wedge. In his teaching I learned many thing about the care and maintenance of my tools but most importantly I learned to spot the versatility and potential that my tools posses.

While the pocket knife it is a versatile tool, what makes it a 'power tool' is that it is portable. Portability in the software development world is a trait that makes you agile. Agile is something that I am a strong proponent of because I have not only seen its successes but I have lived them in both the software development world but in my personal life as well.

Tools that have the ability to be versatile or agile as well as portable are by my definition 'power tools'.
This means that if you get comfortable with using them you can easily switch to a different system with the same tools and feel at home.

The best part about power tools are that they are simple. The usefulness of a pocket Knife is that is preforms one basic function and preforms it well, which allows it to be used in a variety of scenarios. Like the pocket knife each of these power tools exhibits this same principle.
Do one thing and do it well. 

The Python Interpreter

Python Interpreter is the text processor for the Python interpreted programming language. This tool is a programming language. The highlight to this tool is that it can let you write whole applications or scripts that will complete tasks for you with minimal effort. This is a clean and elegant language that is written to operate very close to the operating system, because of this you can script you tasks so that you never have to repeat them as well as port them over to different operating systems, with minimal to no effort.

While I speak of pythons systems level programming highlights, python is not just for systems operations. It is after all a general purpose programming language with the capability of writing full scale applications. As a clean and elegant language it makes the code easy to read, write and use as documentation for all of your complex processes.

To me having an easy to read language make all the difference when documenting complex processes. In stead of having to have complex or verbose documentation one can use the script or application as documentation for the task it completes.

The interactive interpreter also allows for novice or expert programmers to work in a trial environment as they write there script or application, letting them line (task) by line (task) instead of function by function. This is the beauty of a fully interpretable language.

IPython the Improved Python Interpreter

The improved python interpreter. While the stock python interpreter is powerful and a great tool on its own the improved interpreter helps a developer working in the interpreter see the full scope of python operations.

This interpreter also operates as a text based shell, allowing you to use failure operating system commands like dir, ls, cd, cp, etc in line with python operations. The input and output designators also help document your path as your complete a task. This improved editor is my personal preferred operating environment when dealing with the python interpreter. 

The GNU Tools for Windows

If python is the hammer in your software tool belt, then the GNU tools are a work bench full of ratchets, sockets, screw drivers, and wrenches. This is not one tool but a whole tool chest, full of powerful and potentially dangerous tools.  These will tools will add to your shell customizations to improve the way your work.

Notes:
Be sure to follow all install instructions with this tool, read the README.txt. it has extra instructions on how to install the full tool suite. 

Be sure to add the proper bin directory to your path allow you to use all of these tools.

The Text Editor, Vim

The power tool of power tools, is 'The' Vim text editor.  This is the power sander, jack hammer, and power drill all wrapped up into one super tool. While one might think that a text editor is just something to edit your files, to a developer your text editor is your super tool.

This text editor is a line operated, regular expression editor. This means that you can quickly edit a whole line with a regular expression or a whole group of lines.  This makes this editor perfect for not only developing software but for refactoring it to work how ever you see fit.

For your first tutorial on how vim work, I recommend running the vimtutor.  Vimtutor is an vim text file that is opened with vim that as you read it it walks you through how to use the Vim editor, to its full potential.

Notes:
Be sure to check out the plugins for vim. These improve the improved text editor to be truly amazing.
With these power tools in your tool box your effectiveness can be greatly improved to be truly limitless. 

Thursday, May 3, 2012

Enviornment - (My own little world)

As I progress through my personal and professional development career I have begun to notice the importance of 'good notes' and how helpful it is to share them as well as to receive feedback on your experiments and projects. That is the purpose of this blog. This is my place to share my thoughts and notes on my personal software development projects.

Today's notes are on my Windows Workstation. As any good professional knows, having a familiar work space, good tools, and solid organization makes work exceptional easy. While windows is not my favorite operating system it is the most commonly used operating system on the planet, therefore it naturally feels like a good place to start, as this would cover the widest audience.

In the wold of computers a stable development environment is a constantly moving target in which the good tools are powerful (often dangerous) and staying organized is a matter of keeping up with the latest convention or configuration. Depending on the model and mode of operations you may have to change how your computer works.

As I have learned over the years, software development, means that you have to be able to not only re-construct your projects or experiments quickly but re-construct your platforms as well.  In my early development years (college) I had not yet learned how important this actually is nor how important it is to make this environment my own.

The Shell (Home sweet Home, turtle... turtle...):

Notes: http://technet.microsoft.com/library/cc750982.aspx

Windows Shell is a strange world to operate in because unlike the Linux or Unix worlds your Windows shell is purely graphical and not text based. This means that when thinking about a problem a Windows developer often is so focused on the User Interface and how to make user operations simple.  This is is not necessarily a bad thing, however when it comes to automation the Windows developer has to resort to the Text interface, the Command Prompt.

Making this place  truly your home is important because once you learn the power of making Windows operate from the command line, you will never repeat a single task again. Trust me on this one.

The PROMPT variable, and yes it's all capitalized is an interesting way for you to make your shell a special place to live and work. Try this, type PROMPT=$_$T$S$P$_CMD$G$G.

Your prompt will be changed to separate one command execution from the start of the next command execution. It will also show you the time and your current full path as well as give you your own working space to type commands.
19:48:39.86 C:\
CMD-->
You can set this permanently by typing %windir%\system32\SystemPropertiesAdvanced.exe 
Not only can you start this Control Panel menu from the command prompt but you can start others...
I recommend  you keep this as a personal environment variable as opposed to making it a systems environment variable.

But this is not the only Command Prompt modification that I want to discuss, there is also the DOS key. To be brief, this allows you to create an alias, similar to those available in *nix environments. 

You can try it by typing doskey ls=dir $*, this will allow you to create short cuts for your shell session, but you can save the by typing doskey /MACROS:ALL > {storage_file}

This can then be loaded in two different ways, by typing doskey /MACROFILE={storage_file}, or by starting the command prompt with by this this command. There are two options when implementing this: set up a short cut to start the command prompt with the /k option or an alternative method as I'll discuss later. I recommend creating shortcut to start the command prompt this command. This will keep you from having to load your macros every time you start a new command prompt. 

For a more advanced or permanent solution, that works where you need it, you can alter three registry keys to call a global macros file.  I recommend putting the macros file somewhere global like 'Program Files' or 'Users\Share'.
[HKEY_CLASSES_ROOT\Drive\shell\cmd\command]@="cmd.exe /s /k pushd \"%V\" && doskey /macrofile=\"C:\\Program Files\\macros\""
[HKEY_CLASSES_ROOT\Directory\shell\cmd\command]

@="cmd.exe /s /k pushd \"%V\" && doskey /macrofile=\"C:\\Program Files\\macros\""

[HKEY_CLASSES_ROOT\Directory\Background\shell\cmd\command]

@="cmd.exe /s /k pushd \"%V\" && doskey /macrofile=\"C:\\Program Files\\macros\""
;This is the most important key the other two cover specific scenarios.
If you place this into a registry file, text file with a '.reg' extension, you can execute that file by clicking on it. This will enable you to press 'Shift' + 'Right Click' to 'Open Command Prompt Here' and load your macros, any where on you wish to have a command prompt.

I would like to tell you how to make this macro file user specific with the %HOMEPATH% environment variable but the default key is of REG_SZ type and not of REG_EXPAND_SZ. It is because of this that you can't have each user define there own macro file and use this variable to load that macro file.  Major flaw to my implementation.


With these two simple modifications you can easily customize your command prompt to be your own and  allow yourself to fine tune your operations and become more effective. Remember to check out setting defaults in the command prompt, so that all your prompts will look the same. 

Its the little things (like opening a web browser)

Sometimes as your developing a solution/script for a problem your faced with interesting challenges where the dumbest workaround (opening a ...