jump to navigation

Launch your program from within Notepad++ February 22, 2009

Posted by razasayed in programming.
Tags: , ,
15 comments

Notepad++ is a good editor for programmers, that supports multiple languages, and also has some other cool features like syntax highlighting, some basic intellisense etc.. . It is free and open source , but the downside is that its available only for Windows . However, it does work on Linux too, by using Wine. Notepad++ is a good alternative for people (especially those using Windows,on Linux  vi or  emacs  are the commonly used editors) who for whatever reason are not using full fledged IDE’s , and want a simple editor with some of the bells and whistles required for their programming work.

Recently, i discovered a cool feature supported by Notepad++, which i thought id blog about . How many times have we encountered situations where we write code in an editor and then switch back to the command line to execute it , especially if we are dealing with interpreted languages like perl, python , ruby etc..

Wouldnt it be nice if we could execute the program within the editor itself  ?. Now that would come in really handy . Would definitely save us some time and overhead involved in the context switch 😉 .

Guess what, Notepad++ being plugin based , has a plugin called NppExec , which allows us to do just that .  All you have to do is download it (assuming this plugin is not already installed)  , then after extracting the archive, place the dll in <Notepad++ Installation directory>/plugins .

Heres how to use it (assuming you are using python , and have the python interpreter installed on your system , however it could be any other language for which you have the corresponding interpreter installed)

Step 1) First type in your program and save the file

Step 2) Go to Plugins->NppExec->Execute (or press F6), and in command section type


python "$(FULL_CURRENT_PATH)"

$(FULL_CURRENT_PATH) , is a Notepad++ internal variable ,that contains the full path of the file currently open in the editor . There is a list of 10 such global variables here

Step 3) Now click on Save, and type a name for this script, so that we can use it again later on.

Step 4) Press OK

Voila, you can now see the output of your program in a console window in the editor itself ! .

Then again when you make some changes to your code, you dont have to go through all the above steps again, simply press Ctrl+F6, which is the shortcut for repeating the previous command.  To switch to a different language you can press F6 and select any other language for which you have saved a script.

Tip : If you dont want those extra messages that you see along with the output, just select Plugins->NppExec->No Internal Messages

Hope someone finds this useful,

Have fun 🙂

Advertisements

Master Foo and Unix December 25, 2008

Posted by razasayed in programming.
Tags: , ,
add a comment

The Unix operating system has been greatly influenced by the Zen philosophy . A “Koan” is a puzzling, often paradoxical statement or story, used in Zen Buddhism as an aid to meditation and a means of gaining spiritual awakening.The  Rootless Root has some wonderful unix koans which is a must read . These koans would help you find the way. And, if  you mock at them you’ll lose merit and be reborn as beasts or MCSE/MCSD/MCTS etc 😉 . Here are a couple of samples .

1. Master Foo and the Graphical User Interface

One evening, Master Foo and Nubi attended a gathering of programmers who had met to learn from each other. One of the programmers asked Nubi to what school he and his master belonged. Upon being told they were followers of the Great Way of Unix, the programmer grew scornful.
“The command-line tools of Unix are crude and backward”, he scoffed. “Modern, properly designed operating systems do everything through a graphical user interface”.
Master Foo said nothing, but pointed at the moon. A nearby dog began to bark at the master’s hand.
“I don’t understand you!” said the programmer.
Master Foo remained silent, and pointed at an image of the Buddha. Then he pointed at a window.
“What are you trying to tell me?” asked the programmer.
Master Foo pointed at the programmer’s head. Then he pointed at a rock.
“Why can’t you make yourself clear?” demanded the programmer.
Master Foo frowned thoughtfully, tapped the the programmer twice on the nose, and dropped him in a nearby trashcan.
As the programmer was attempting to extricate himself from the garbage, the dog wandered over and piddled on him.
At that moment, the programmer achieved enlightenment

Heres one more 🙂 . Master Foo and the Script Kiddie

A stranger from the land of Woot came to Master Foo as he was eating the morning meal with his students.
“I hear y00 are very l33t”, he said. “Pl33z teach m3 all y00 know”.
Master Foo’s students looked at each other, confused by the stranger’s barbarous language. Master Foo just smiled and replied: “You wish to learn the Way of Unix?”
“I want to b3 a wizard hax0r”, the stranger replied, “and 0wn ever3one’s b0xen”.
“I do not teach that Way”, replied Master Foo.
The stranger grew agitated. “D00d, y00 r nothing but a p0ser”, he said. “If y00 n00 anything, y00 wud t33ch m3”.
“There is a path”, said Master Foo, “that might bring you to wisdom”. The master scribbled an IP address on a piece of paper. “Cracking this box should pose you little difficulty, as its guardians are incompetent. Return and tell me what you find”.
The stranger bowed and left. Master Foo finished his meal.
Days passed, then months. The stranger was forgotten.
Years later, the stranger from the land of Woot returned.
“Damn you!” he said, “I cracked that box, and it was easy like you said. But I got busted by the FBI and thrown in jail”.
“Good”, said Master Foo. “You are ready for the next lesson”. He scribbled an IP address on another piece of paper and handed it to the stranger.
“Are you crazy?” the stranger yelled. “After what I’ve been through, I’m never going to break into a computer again!”
Master Foo smiled. “Here”, he said, “is the beginning of wisdom”.
On hearing this, the stranger was enlightened.

And finally for all the programmers out there, The Tao Of Programming is a must read !

Thus spake the master programmer:

“It is time for you to leave.”

Programming Quote November 8, 2007

Posted by razasayed in programming.
Tags:
add a comment

“If you’re doing top-down design, you produce a specification that stops at some level of granularity. And you always risk discovering, come implementation time, that the module or class that was the lowest level of your specification hides untold worlds of complexity that will take as much development effort as you’d budgeted for the rest of the project combined. The only way to avoid that is to have your design go all the way down to specifying individual lines of code, in which case you aren’t designing at all, you’re just programming.”

Wanna play a small prank ? ;) November 7, 2007

Posted by razasayed in programming.
Tags:
add a comment

Heres a nice April Fool prank that you can play on your friends running M$ Windows XP . I coded this program which simulates the formatting of your harddisk . OK, to state in simple terms it just fakes a formatting screen without anything actually getting formatted 🙂 . Just run it on your friends comp and watch his/her face turn white with horror..hehe 😉

And heres an evil genius tip for you….just place the exe of this program in the startup folder , now whenever the computer boots..u know what..muhahahaha .

And having said that you are responsible for the consequences , so please dont flame me if you happen to get bashed up..lol .

To download the source : Click me

To download the exe : Click me

OK, till the next post Adios Amigo 🙂