Tuesday, January 5, 2010

Smart Gmail

Did You Know That…
when you create, or you had created already, your Gmail mailbox (it's sounds a little bit strange - G-mailbox :)), you will get one more alias?

Example:
Let my first name is Joe and last name Doe.

Let us create new account at Gmail (if you have one already, do not create new one ;) )
So I will put my first and last names into textboxes. After I have to choose desired login name.
I will choose JoeDoe cause I would like to have pretty email address JoeDoe@gmail.com.

After account setup is complete, I try to login to my mailbox with login name 'Joe.Doe' (with dot between the names).
Voila!
I am in the mailbox I created few minutes ago.

This is nice feature.

Now I can use
JoeDoe@gmail.com or
Joe.Doe@gmail.com,
it does not matter. All emails will deliver to my mailbox.

P.S. I am not sure it works when you compose your login name not from your first and last names. No matter the order of the names in alias

EnjoY.

Friday, December 25, 2009

Play! with IntelliJ IDEA

Hi Everybody!
Few days ago I had found great looking Java web framework called Play!
Going through the documentation I did not found any step by step tutorial (or atleast tutorial) to put Play! together with the best Java IDE - IntelliJ IDEA. I like Idea and I would like to show you how to set up your IntelliJ with Play! framework.

I will use yabe (yet another blog engine) application discribed in Play! documentation in this demo.

Let's the show begin...

Prerequisites
Java JDK 1.5 or newer (download here...)
IntelliJ 8.x or 9.x (9.x just released, dowload here...)
Play! framework (download here...)

This tutorial describe
Play! framework 1.0RC2

I am running on
Windows 7
IntelliJ Idea 8.1.4 (Build 9952)
Java JDK 1.6u17

Install Play! framework
The easiest way to install is just download .zip file and extract it somewhere.
I will extract it to:

C:\dev\play


Important! Add this dir at the end of System PATH variable. It is important to be able to use just 'play' at the command line.

Application structure creation with Play!

Open cmd.exe (WinKey+R -> 'cmd') and go to project directory.

Note: My project directory is C:\pro\web


Type play new yabe and hit Enter. Play! will ask you about the application name, hit Enter again.


pic. 1

The structure of application has been created. You can see it by explore C:\pro\web\yabe directory.


pic. 2


Time to set up IntelliJ Idea.

Open your IntelliJ Idea and create new project.

File -> New Project


It will open 'New Project' wizard.


pic. 3

Select 'Create Java project from existing sources' and click 'Next'.



pic. 4


Name the project. Fullfill the project path. We create it earlier in CommanLine by typing play new yabe . Click 'Next'.



pic. 5

Let Idea resolve source directories. Let them as is and click 'Next'.


pic. 6

There is no Libraries so we can click 'Next'.


pic. 7

Idea offer us to create module, let it checked and click 'Next'.


pic. 8

At Facelets page just click the 'Finish' button.

We just 'import' Play! project into IntelliJ Idea.
As you can find in Play! documentation (Section 'Project creation'), each Play! project has predefined structure.

I open Application.java file from yabe.app.controllers package.


pic. 9

Now we have Play! project successfully loaded into our prefered IDE, but something is still wrong. Yeah! Erorrs.
You can see Idea underlined unknown imports, modules and functions.
So let us go to correct it.


pic. 10

Right click at project name 'Yabe' in Project column and select 'Module Settings'.


pic. 11

At the left column select 'Libraries'


pic. 12

And click on '+' (plus), small button above the second column.


pic. 13

Idea will ask you to name the Library. Name it and click 'Ok'.


pic. 14

Now Idea ask to which module you would like to add this library. We have only one Module, 'Yube', so we will select it and click 'Ok'.


pic. 15

Library has been created. Now we have to assign sources to it.
Click on 'Attach Jar Directories' button and select 'framework' directory which lies under Play! framework instalation directory.

Note: I have Play! instalation in C:\dev\play so I have to select C:\dev\play\framework directory.


pic. 16

Click 'Ok'

Repeat the last step and add lib directory also (i.e. C:\dev\play\framework\lib)


pic. 17

You can see new item appears in 'play' library. Click 'Ok'.


pic. 18

Errors disappeared! Yuppiiiii!!!

Press and hold 'Ctrl' key and click on Controller which extends Application class. Idea take you at Controller.class.

Hmmm. It is nice to see /* compiled code */ comments, but  we want more. Still we are not able to go through not compiled Java source code.
Let us check it ;)

Open window shown on pic. 15 and click 'Attach Sources' button. Select C:\dev\play\framework\src directory. Click 'Ok' button. And click 'Ok' again.

Now we are able to see uncompiled Play! sources code of Play! framework.
Go through and learn it.

EnjoY

Dmitrij Strelnikov