Monday, April 20, 2009

How to Setup MySQL and Toad

  • Download MySQL latest version

  • Install MySQL, if you are using windows run the .msi installer. You can select a typical installation or a complete one (depends on your disk space).
    Server Setup:

    1. Developer machine (you are going to use it to develop)

    2. Multifunctional Database (unless you know exactly what you are going to use it for)

    3. For a developer machine you can select the OLAP option

    4. Port Number – it suggests 3306. Make sure to add a firewall exception to this port.

    5. I installed MySQL as a windows service. You can choose not to do so if you don’t want MySQL to start on startup.

    6. Leave default root password empty and enter you new password (don’t forget it)


  • Now that you have MySQL database installed, create a new DB to work on.
    Go to Start --> Programs --> MySQL --> MySQL command line client.
    In the cmd that it opens, type the password you used in the installation, and enter the following command:

    Create database [MyDB];

    An example can be seen bellow:

  • Download and install Toad for MySQL (freeware)
  • Open Toad and create new connection. You can use either root (the default user) or create a new user. If you want to use a user that is not the root, use the CREATE command as explained in MySQL site.


Now your DB is ready and Toad is setup.

How to Use Twitter API for Java

About Twitter API

Go to - Twitter API Documentation
It is recommended to follow the twitter API group - @twitterapi as well as subscribing to twitter REST API Changelog RSS (at the bottom of the page)

You can use twitter API directly or use it via open sources on top of twitter API. There open sources for many languages. The one I’m going to use is for Java, Twitter4J.

Using Twitter4J
  1. Download Twitter4J zip file.
  2. Extract the downloaded file
  3. Try to run the examples – go to the bin folder and run the [example].cmd or [example].sh (according to your system environment).
    You might want to update the setEnv first to use your JAVA_HOME.

    For example:
    I’m using Windows XP. I changed the JAVA_HOME in the setEnv.cmd to be JAVA_HOME=”C:\Program Files\Java\jre1.6.0_06” (with the quotation marks!) opened the cmd and run the following command from the bin folder –
    update.cmd “I’m updating my status”
    This resulted in an updated message in my profile.

To setup the Java environment please view the previous post
Setting Up a Java Work Environment.

Sunday, April 12, 2009

Setting Up a Java Work Environment

I decided to develop a web application using Java for the simple reason that I’m already very experienced with Java and therefore there is no learning curve here for me.

The first thing I need to do is to setup a working Java environment. I’m going to do that using Java 6 and Eclipse.
Eclipse is a great tool for Java development. I also recommend JetBrains IntelliJ IDEA, which is very good, but unlike Eclipse, this tool is not free.

The steps for setting up you java environment are (in Windows):

  • Download and install Java 6 from Sun download page (you need the JDK which includes the JRE as well)

  • Set JAVA_HOME and PATH environment variables. This is done the following way (in windows):
    right click on “My computer” --> select properties --> select the “Advanced” tab --> click on “Environment Variables” and set up JAVA_HOME to the jdk directory, e.g. C:\Program Files\Java\jdk1.6.0_06. If you don’t have JAVA_HOME just create a new system variable with this name.



    Now setup the “Path” variable – add (do not remove the other variables you have there) the bin directory to the Path variable, e.g. add to the beginning of the Path variable C:\Program Files\Java\jdk1.6.0_06\bin;



    Test: open the cmd (command line) and type – “java –version”

    also check that the command “javac” is recognized by the command line. If not – check the way you updated the environment variables again.



Setup the eclipse environment:

  • Download Eclipse from Eclipse downloads page, I recommend downloading the Eclipse IDE for Java EE Developers.

  • Unzip eclipse to the directory where you want it, and open eclipse



Now you have a ready environment and you can start working.

Saturday, April 11, 2009

Ruby-on-Rails or Java?

For a long time now I wanted to build a web application for a specific purpose. I didn't have time to do that because I was working all the time. Now, I finally decided to dedicate some time and build a web application from scratch.
In this blog I’m going to write a step-by-step explanation on how to do that, including the problems, issues etc. I have on the way, and hope that others would benefit from this as well.

So now, I want to build a flexible web application that might be complicated in terms of functionality. Performance is a very important issue but also the time is takes to develop the application and maintain it.
I heard many good things about Ruby-on-Rails lately, but never actually used it. I heard that it can save one a lot of time developing an application. On the other hand, I’m very experienced with Java web applications and therefore not sure if to use RoR or not.
I found a good article regarding the benefits of each language, and I definitely need to consider using each - Ruby on Rails vs. Java

I think I will probably stick with the Java option, but I will check on RoR just in case.