Wednesday, May 23, 2012

Google celebrates Egyptian Elections with a doodle

Google has posted a doodle on their Egyptian homepage to commemorate the first Egyptian elections, since the revolution that toppled previous president Hosni Mubarak, being held today!
The doodle is view-able on Google.com.eg, the Egyptian domain for Google's homepage. Clicking the doodle will show you the latest search results for the Egyptian Elections. For those who haven't voted yet and would like to check the official voting page for their voting information please go to www.elections.eg

Wednesday, February 15, 2012

Setting up Notepad ++ for Java development

There are many editors out there that can be used for writing Java programs. Notepad ++ is a free and simple Notepad like application that also supports programming languages like C++, HTML, Java and others. Unlike Textpad or JCreator it does take some setting up before its ready for use.

  1. Grab Notepad ++ (download.com link)
  2. Install the program
  3. Once its all set up you will need to download a special plugin called NppExec for it that will allow it to compile and run code. It might be also worthwhile to have a look at the rest of the plugins and see if anything catches your interest ( http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Plugin_Central)
  4. Now the easy way to get NppExec is through Notepad++'s plugin manager, it will download and install it for you automatically. Installing it yourself can get a bit tricky. Open Notepad++ and go to Plugins -> Plugin Manager -> Show Plugin Manager
  5. Once open, scroll down and find NppExec and check the box next to it and click 'Install'
  6. Now you have the ability to execute Java programs! But we're still not done yet, we want the program to be able to run the currently active code that we are writing. Press F6 on your keyboard, that will open a command window. Type in:
    cd $(CURRENT_DIRECTORY)
    javac $(FILE_NAME)
    Save that command as Compile so you don't have to write it in every time. This will allow you to compile your code.
  7. Now click on the drop down menu and select to get a new blank box and type in:
    cd $(CURRENT_DIRECTORY)
    java $(NAME_PART)
    Save that as Run and this will be the command that will allow you to run your code.
  8. Now all you need to do it type in your code, press F6 and choose either Compile or Run. Your console will appear at the bottom.
     
That's all. Please comment bellow if you need any more help.
Thanks to these guys here for the Run and Compile commands.

Monday, February 13, 2012

Downloading Java (JDK) and installation + API

If you're interested in trying Java programming then this tutorial will help you get started with the installation. To start off, if you're going to be doing programming with Java then you'll need the Java Development Kit (JDK) NOT to be confused with Java Runtime Environment (JRE) which is used to run Java applets and programs on your web browser/computer. 

While starting out with Java myself I found downloading and installing JDK could be confusing at certain points (you have Oracle to thank for that). It took me a few tries before I managed to get the version I needed along with its documentation (we'll talk about that later).

So, first thing we need is to download and install JDK:
 You'll see something that looks like this: 

 

  • Don't click on anything yet, scroll down until you see Java SE 6 Update 30. At the time of writing this Blog Java 7 is the latest version of Java, but Java 6 is the standard one. Click on Download under JDK.
  • You'll be taken to the next page where you have to accept the license agreement and download the Java version suitable for your operating system. Choose the one you need, pick a download location and start the download.
  • After the download is done, simply navigate to the download location and double click the file to start installation.
  • The installation is simple, I recommend keeping the default install settings and change the install location (if you wish) to a different directory. Wait for it to install and That's it. It will prompt you to register, you can do that or leave it for later.
Now to download the documentation. The documentation or API is a specification document that contains all the packages, classes, methods ..etc that you need to use when you are programming in Java. Now you can simply type 'Java API' in Google and it will take you to the web version of the API, but I find it convenient to have a copy on your hard disk that you can check any time.

You can go back to the first page and do a few loops before you can find where to download it (have fun with that) or jump straight here and get it painlessly. Select a download location and start the download. Once its done un-zip the file, I highly recommend creating a shortcut to the location you extracted it to so you have quick access to it in the future and don't go searching for it if you forget its location.



Extract it to a folder like 'Documents' for example and create a desktop shortcut to the API. Inside the folder go to docs -> api -> index.html. Right-click index and then 'create shortcut', cut and paste the shortcut on the desktop.

All done!