A good command prompt has always been a weakness point in MS Windows. Compared with bash scripting in Linux/Solaris/UNIX, the command prompt simply lacks a command prompt.
Microsoft aggressively striked back this time with Microsoft's new Power Shell. You can download it from the following link or read more about it here. Expect better automation tasks and large bash scripts to be so common on Windows.
Showing posts with label languages. Show all posts
Showing posts with label languages. Show all posts
Monday, March 05, 2007
Saturday, February 17, 2007
Writing .bat files / Part 1 / Hello World
You create a batch file by writing it in a text file then saving the file with the ".bat" extension at the end, this will tell windows that this is an executable batch file.
Here I will create a text file containing the following and save it as "test.bat":
echo "Hello World, this is my first batch file!"
The word 'echo' is a DOS command that simply tells the command shell to display the text message following it.
You can test your first batch file by opening a command line window. To open a command prompt window there are two ways:
First, you can go to Start > All Programs > Accessories > Command Prompt
Or, you can go to Start > Run then type in 'cmd' and click OK.
Once the command prompt is open, you can run your batch file by typing its name followed by enter:
c:\> test.bat
Make sure to change the directory to the location where the test.bat file was saved, in the above example it assumes it was saved in the C:\ top folder. If it was saved in a different location, e.g. F:\my_folder then you can change directories by typing:
c:\> cd /D F:\my_folder
f:\my_folder> test.bat
The output:
f:\my_folder> echo "Hello World, this is my first batch file!"
"Hello World, this is my first batch file!"
Notice that the string got displayed, but also the command 'echo' got displayed too. To hide the commands being executed you can add "@echo off" at the top of the test.bat file.
@echo off
echo "Hello World, this is my first batch file!"
Now executing test.bat would result in:
F:\my_folder>test.bat
"Hello World, this is my first batch file!"
Congratulations, your first batch file is ready. Unfortunately, till now it does nothing interesting other than print a message.
Here I will create a text file containing the following and save it as "test.bat":
echo "Hello World, this is my first batch file!"
The word 'echo' is a DOS command that simply tells the command shell to display the text message following it.
You can test your first batch file by opening a command line window. To open a command prompt window there are two ways:
First, you can go to Start > All Programs > Accessories > Command Prompt
Or, you can go to Start > Run then type in 'cmd' and click OK.
Once the command prompt is open, you can run your batch file by typing its name followed by enter:
c:\> test.bat
Make sure to change the directory to the location where the test.bat file was saved, in the above example it assumes it was saved in the C:\ top folder. If it was saved in a different location, e.g. F:\my_folder then you can change directories by typing:
c:\> cd /D F:\my_folder
f:\my_folder> test.bat
The output:
f:\my_folder> echo "Hello World, this is my first batch file!"
"Hello World, this is my first batch file!"
Notice that the string got displayed, but also the command 'echo' got displayed too. To hide the commands being executed you can add "@echo off" at the top of the test.bat file.
@echo off
echo "Hello World, this is my first batch file!"
Now executing test.bat would result in:
F:\my_folder>test.bat
"Hello World, this is my first batch file!"
Congratulations, your first batch file is ready. Unfortunately, till now it does nothing interesting other than print a message.
Thursday, February 15, 2007
PHP 6, a revolution or just another evolution?
PHP 6 is on the way. One major feature of this release will be full unicode support with complete backward compatibility (what a mess the php.ini configuration file will turn out to be!).
But, will the core engine differ, will there be something different this time? is it worth a most significant version number jump? PHP 5 has been critisized by many as being a minor evolution to PHP 4 and didn't deserve a version jump, rather than what was initially expected.
See, its not only in PHP, its in all software products, when you jump from Version (X) to Version (X+1) then you'd better be having what justifies this jump, and in my opinion... the only justification is a REVOLUTION (background theme music maestro, plz).
But, will the core engine differ, will there be something different this time? is it worth a most significant version number jump? PHP 5 has been critisized by many as being a minor evolution to PHP 4 and didn't deserve a version jump, rather than what was initially expected.
See, its not only in PHP, its in all software products, when you jump from Version (X) to Version (X+1) then you'd better be having what justifies this jump, and in my opinion... the only justification is a REVOLUTION (background theme music maestro, plz).
Wednesday, February 14, 2007
I Smell Rotten Code.
Here's my best self-awareness test for detecting areas of self-written rotten-code in my source code. The question you have to ask yourself after finishing a code module is the following:
Are you afraid of looking into the code you wrote for this module?
Are you having any discomfort when it comes to adding extra functionalities to your code?
If the answer to any of the above two questions is yes, then I believe you have a problem and your code needs 'refactoring' (another cool word for 'restructuring').
Are you afraid of looking into the code you wrote for this module?
Are you having any discomfort when it comes to adding extra functionalities to your code?
If the answer to any of the above two questions is yes, then I believe you have a problem and your code needs 'refactoring' (another cool word for 'restructuring').
Tuesday, February 13, 2007
The Problem With The PeePee's
With all the paparazzi surrounding PHP, Perl, Python and Ruby, in my opinion, I see them as lacking a 'major' attribute that I cannot live without. This attribute is extensibility; using existing codebases and libraries written in C and/or Java.
The largest code bases and libraries in the world are either written in C or Java. What use do I get if I cant utilize those libraries? Some might argue that it is possible to call C API from PHP or the others, but have you ever tried writing a PHP extension that wraps a C library? have you tried that in Python? Perl? Ruby?
The amount of learning curve, buggy constructs, and lanuguage intracies you have to deal with make your life suck when it comes to extensibility from those PeePee's (most of them start with the letter P).
Every piece of new hardware, every new database, every robot, each and every mobile device, is guaranteed to provide you a C and/or Java API to communicate with. None have ever provided you with a PHP/Python/Ruby/Perl API. All those API's come as wrapped up contributions of the C or Java version.
This problem does not exist in either C or Java. Java uses the JNI (java native interface) to talk with the C language APIs which could add a learning curve; however, unlike other learning curves, this learning curve aint wasted simply because those two languages are guaranteed to survive for at least the upcoming decade with continuous SDKs sourced out from new technologies.
The PeePee's are useful tools, useful languages, but dont base heavy code bases on them. One day you'll discover that you'll need to start porting your code, let this day be early enough with limited losses.
The largest code bases and libraries in the world are either written in C or Java. What use do I get if I cant utilize those libraries? Some might argue that it is possible to call C API from PHP or the others, but have you ever tried writing a PHP extension that wraps a C library? have you tried that in Python? Perl? Ruby?
The amount of learning curve, buggy constructs, and lanuguage intracies you have to deal with make your life suck when it comes to extensibility from those PeePee's (most of them start with the letter P).
Every piece of new hardware, every new database, every robot, each and every mobile device, is guaranteed to provide you a C and/or Java API to communicate with. None have ever provided you with a PHP/Python/Ruby/Perl API. All those API's come as wrapped up contributions of the C or Java version.
This problem does not exist in either C or Java. Java uses the JNI (java native interface) to talk with the C language APIs which could add a learning curve; however, unlike other learning curves, this learning curve aint wasted simply because those two languages are guaranteed to survive for at least the upcoming decade with continuous SDKs sourced out from new technologies.
The PeePee's are useful tools, useful languages, but dont base heavy code bases on them. One day you'll discover that you'll need to start porting your code, let this day be early enough with limited losses.
Tuesday, January 23, 2007
Goodbye PHP. With Love, Basil.
I dropped PHP, in favor of wonderful JSP. Yes, yes and yes. After too many thoughts, and too many oooofss, its time my friend to start from the end.
Frankly speaking, I have about a thousand reasons why I dropped PHP. Half of them arise from the -ve's (negatives) of the PHP language, and the rest comes from the +ve's of the Java language and the wonderful Java programming mindset.
I wont name them here, you can call me on skype to discuss this if you like. But, I dont even have the time to complain about PHP in this blog. We had good times together, but at the end, leaving this language (from my perspective) is a mindful correct decision. The decision is not a religious one, I might still 'have' to use it in several occasions eg. quick small web-apps, hosting code, scripts, and current codebases.
Frankly speaking, I have about a thousand reasons why I dropped PHP. Half of them arise from the -ve's (negatives) of the PHP language, and the rest comes from the +ve's of the Java language and the wonderful Java programming mindset.
I wont name them here, you can call me on skype to discuss this if you like. But, I dont even have the time to complain about PHP in this blog. We had good times together, but at the end, leaving this language (from my perspective) is a mindful correct decision. The decision is not a religious one, I might still 'have' to use it in several occasions eg. quick small web-apps, hosting code, scripts, and current codebases.
Subscribe to:
Posts (Atom)