July 16, 2010

Another adventures and experiments with Play on my Linux !!

July 16, 2010 0
Hey everyone,
Along with my recent adventures and experiments with Play, I decided to force myself to become more proficient with Play. For all those who don't know what “Play” is , I will give u all a just of it..

The Play framework is a clean alternative to bloated Enterprise Java stacks.

I think its very nice framework to make web-based application by using any editor like Komodo or Emacs,and it provides libraries for database access,error handling,templating framework and session management,security,an automated test suite, a shiny web interface and an administration area and it also provides the codes for reuse.


so, if u still feel like I need to be set straight,any suggestion or any question,Send me an email.

Anyway,
I have been using Linux since about 2007.
I had JAVA self extracting file which was given to me by Mr. Jitendra Vishwakarma.
So,I tried to run play in my Linux with the help of documentation.
I had java ,but "i don't know how to install it?"

Ever since I first started using Linux, I have been using Terminal for installing most of software's and applications...even today I do so.. ,
really I don't know many commands of Linux.


So, once again I started searching on Google about "how to install java in Linux ". I found solution for it and I dabbled with a tutorial here and there...and finally I get the java on my Path.

My recent experiment with JAVA Installation has proved to be very fruitful, I say so to myself.

If anyone is much interested to know "how to install the java in Linux?",then follow the instruction and commands.

~~~~~~~~~~~~~~~~~~~~~~~~
Download and copy jdk-6-linux-i586.bin to $HOME/src (or a location of your choice).
type>>
% su -

(some linux use "su" command and some don’t. So in such a case, use the "sudo" command and it will prompt you for a enter admin password. once u have entered the password it will not ask u again and again during the editing, deleting, moving the files .)

"I don't know much about the RedHat and the Solaries,but as I have worked on ubuntu based linux, it accept the "sudo" command...."

~~~~~~~~~~~~~~~~~~~~~~~~

#su (or sudo)
# mkdir /usr/java (if it doesn't exist or start the line with "sudo")
# mv $HOME/src/jdk-6-linux-i586.bin /usr/java (if it doesn' start line with "sudo")
# cd /usr/java (if it doesn' start line with "sudo")
# chmod +x jdk-6-linux-i586.bin (if it doesn' start line with "sudo")
# ./jdk-6-linux-i586.bin

~~~~~~~~~~~~~~~~~~~~~~~~
It will extract all the files of java and install it in your system.
~~~~~~~~~~~~~~~~~~~~~~~~
Set the PATH and JAVA_HOME environment variables: (/etc/profile, $HOME/.bashrc or $HOME/.bash_profile).

PATH=$PATH:/usr/java/jdk1.6.0/bin
JAVA_HOME=/usr/java/jdk1.6.0
export PATH

~~~~~~~~~~~~~~~~~~~~~~~~
for more information about Java Installation try this "Enterprise Java for Linux HOWTO".

After installing the java,I started developing the Simple Web-Application in Play.
Here are the steps of creating application.

Installation of play is very simple.
Just download the latest binary package from the Play download page and unzip it to any path. Play uses command line a lot for creating,running and testing the application,it’s better to use a Linux or MacOS ,if you are using windows,its also fine.

Play is correctly installed,now start Creating a Play application is pretty easy and fully managed by the Play command line utility.That allows for standard project layouts between all Play applications.

Open a new command line and type:

$python play new helloworld

It will creates a new helloworld application.
now we need to test it if its working or not?

For run the application>Open a new command line and type:

$python play run helloworld/

Play will now load the application and start a Web server on port 9000.
You can see the new application by opening a browser to
http://localhost:9000


Here is the snap of the simple " hello-world "application and "how to set the JAVA_HOME path in snap"

And follow the Documentation for making "helloworld" application.

Click On the Image
To See The Tested "Hellowrld" Application.

Read more...

July 14, 2010

PlayFramework on my linux !!

July 14, 2010 0
Hey everyone,
Along with my recent adventures with play,I decided to force my self to become more proficient with Play.For those who don't know about the play ,

"The Play framework is a clean alternative to bloated Enterprise Java stacks. It focuses on developer productivity and targets RESTful architectures." I think its nice framework to make web-based application with the help of using any editor like Komodo or Emacs...rather than using "DotNet technology or NetBeans with JAVA" for making the Web-Based application.

There are often religious-grade battles those who believe in .net framework and NetBeans,another surviving application development technology, editor and framework for making web-based application using JAVA environment or etc.

I'm not trying to get into any debates about which is better and I'm not interested to know why I should not be using the .Net Technology or NetBeans for my project.
so,if u still feel like I need to be set straight,Send me an email

Anyway,
I have been using Linux since about 2007.
I had JAVA self extracting file which was gave me Jitendra Vishwakarma.
So,I tried to run play in my Linux with the help of documentation.
I had java ,but "i don't know how to install it?"

Ever since I first started using Linux, I have been using Terminal for installing most of software's and applications...at this time also ,really I don't know many commands of Linux.

So, once again I started searching on Google about "how to install java on Linux ". I found the solution for it and I dabbled with a tutorial here and there...and finally I get the java on my Path.

My recent experimentation with JAVA Installation has proved to be very fruitful, if I do say so myself.


If any one much interested to know "how to install the java on Linux?",then follow the instruction and commands.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Download and copy jdk-6-linux-i586.bin to $HOME/src (or a location of your choice).

type>>

% su -

(some linux are accept the "su" command and some are not,So in case of this problem use the "sudo" command.And it will prompt you for a enter admin password,once u have entered the password it will not ask u again and again during the editing,deleting,moving the files .)

"I don't know much about the RedHat and the Solaries,but ubuntu based linux accept the "sudo" command...."

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


#su (or sudo)
# mkdir /usr/java (if it doesn't exist or start the line with "sudo")
# mv $HOME/src/jdk-6-linux-i586.bin /usr/java (if it doesn' start line with "sudo")
# cd /usr/java (if it doesn' start line with "sudo")
# chmod +x jdk-6-linux-i586.bin (if it doesn' start line with "sudo")
# ./jdk-6-linux-i586.bin


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It will extract all the files of java and install it in your system.

Set the PATH and JAVA_HOME environment variables: (/etc/profile, $HOME/.bashrc or $HOME/.bash_profile).


PATH=$PATH:/usr/java/jdk1.6.0/bin
JAVA_HOME=/usr/java/jdk1.6.0
export PATH



for more information about Java Installation try this Enterprise Java for Linux HOWTO.


After installing the java,I started developing the Simple Web-Application in Play.
Here are the steps of creating application.

Installation of play is very simple.
Just download the latest binary package from the download page and unzip it to any path.Play use the command line a lot, it’s better to use a Unix-like OS.

Play is correctly installed, it’s time to create the hello world application. Creating a Play application is pretty easy and fully managed by the Play command line utility. That allows for standard project layouts between all Play applications.

Open a new command line and type:


$python play new helloworld


It will creates a new helloworld application.
now we need to test it,either its working or not?

For run the application>

Open a new command line and type:

$python play run helloworld/



Play will now load the application and start a Web server on port 9000.
You can see the new application by opening a browser to http://localhost:9000

Here is the snap of the simple " hello-world "application and "how to set the JAVA_HOME path in snap"
And follow the Documentation for making "helloworld" application.

Click On the Image
To See The Tested "Hellowrld" Application.

Read more...

My first Encounter with PlayFramework !!!!

July 14, 2010 2
Its a story very funnny and yet close to my heart...
I just thought to share this with you.

One month prior,everything in my life was going fine and very smooth. I was very happy with my python,my Django and was very engrossed in making different different application as a testing. I was so much happy and content with my work.. It seems that i got everything I'm my life. Don't want anything else now..

Now as I'm in Final year of my Computer Science course i decided to make a very dynamic application which i haven't made yet,something big and challenging which will be my best work uptil now and i should reach my satisfaction level.....

The day wen i went to college and i was still very happy with my plannings.. But the moment wen i got syllabus from my class teacher "Mr. Aishwarya Garg" and wen i just glanced on it..all my excitement was shattered....... projects have to be made either in "JAVA" or in ".NET"...

That day was the worst day...I was very sad and totally discontent.... I wanted to pursue something big in Python...It's my passion....i just wanted to work in it only.... whole day i was thinking about python,syllabus,.Net and JAVA....My head was spinning between all of them....

Finally at night when i came out of trauma that i was going through during the whole day... i started thinking now what should i go with.... I m not interested to learn "Dot Net" because most of my friends are going to make "Windows Application" using ".NET "...
so i was not willing to think about it...I just ignored it.....

The only option left was to select "JAVA"...
"JAVA" was something that i am not interested to learn it for project, i also don't love it as the way i love "PYTHON"...but anyhow i made my mind and selected "JAVA" in utter pain....

I decided to make a "web application in java...." but i don't know much about it excepts for the basic concepts.... but that was not a prob...."

I told myself "MERE PASS GOOGLE HAI"...
This word came from my Guru "PAVAN" who taught me to "how to use Google ?" and always he told me "Google Se pooch ! " . So thanks to him.
" GOOGLE gives me all my answers.... "

I started my rigorous searching on Google about "WEB-FRAMEWORK IN JAVA ".
I'm searching...searching......but nothing excited me as my Python and Django
I just love them....
My search was going on and on and on...
Then it was around 3am morning wen i started getting tired and sleepy....but i dont want to give up....i don't wanted to sleep....all that i wanted was to search something that excites me....

I started getting hungry, i went in kitchen to search something so that i will not get sleep....
I got my favorite "PARLE 20-20 (Short may niptao)"
My mom anyhow came to know that I'm still awake and she started shouting at me...
"kitna pareshan karta hai...din may bhi nai sota and raat may bhi jaagta rehta hai...kab soega...soja"
but I hate wen somebody disturbs me in my work....
I told her "Mom tum so jao...main thode der me sounga..."

Now I sat in front of My Computer and started eating cookiee biscuit ...and again continued hunting for web framework........
I found many "java web-frameworks".when I came across Cocoon.....But my mind said NAaaaa its not interesting.......Then "Cricket"...."hmm sounds good" but i was excited to know more about other java web-framework...
I just opened my notebook and wrote the name "Cricket" and continued searching.....
heehehehe.... then i came across "Spring,Struts,Tapestry " etc....
but they were heavy ..
it dint excited me.......
I got irritated but still kept my search on......
Then as i was surfing... and i wrote on Google "light-weight web-framework for java".....then I selected one hyperlink....
Then something flashed in front my eye.....something that had a very excited name....... and I suddenly stop and read it.......

It was "PLAY"............what...play...What is it? i started scratching my head....the moment i clicked on it,all my prob came to an end....It has got a exciting name....then even i thought to play with it....I stared reading its documentation over and over an over....
I just cant stop reading it....plus its features and concept excited me.....It had a flavor like "Django" and "Ruby on Rails" that was the thing that increased my excitement and expectation a lot.... It was light,scalable,fast and robust and many more...more ...and more......wow...i was so happy with it...... I saw the demo video and thought that it is very easy to work with and something that i can do along with my TY studies and my python..plus it has got a beautiful look and feel and Admin facility just as my Django gives me....I quickly downloaded the software..and start testing in Windows XP.

I started discovering it more and more and more.......It was around 5am in morning...i got tense that whether i should go to college or not...but i didn't care much about it...i started installing it following all the steps written in Documentation....

But then i started getting error.... i was trying and getting seriously confused that I'm installing the way it should be....But man y it is not happening....y.....whats the prob yaar....
Then it showed a error.....

"sh:./play: /usr/bin/python: bad interpreter: no such file or directory"



It means it requires "Python".......what python.....I got excited but was also confused.....Then i started intense investigation....Out of all my Curiosity,I came to know that PLAY Framework which is a java web framework is using python...

Why Python ?? it was my first question..so i got the answer..
""
We need a lot of scripts to manage Play applications, like creating a new application, running it, launching a browser, etc… Of course we could write these in Java directly. But running a Java VM for simple tasks like project creation is very slow. And Java itself is very limited when it comes to OS interaction.

Python allowed us to write these scripts in a completely portable way. It’s fast to run, easy to write and available out of the box on most systems. It’s not on Windows, that’s why play comes with the bundle of a "Windows Python binary" with the framework.
""

.....wow.........i was so happy that time.....somewhere I'm using python too in my project........really it made me smile and all my search was not in vain.....
I finally selected it for my project...... I was so so so happy.......

I told this to all my friends.....They heard this for the first time....They gave me a very bad expression and suggestion....But huh...who cares for them...I told this to my mam, she gave me a very blank look ......but I have decided to go with it, so no body can change my mind....I have not selected it for the purpose of job or anything....It was something new that i came across, wanted to try it,
Play with it and give my best in it....... then i made a small "Hello World" application. It boosted my confidence......
I started working on it more and more and more.......This was my feelings before and after selecting the project..... Though it was sad in the beginning....excited and surprising in he middle but it was totally best at the end..........
Now wen i remember that day,,it brings smile on my face... I laugh for the way i searched and selected language.......
hehehe.....

see more about Play Web framework
Read more...

July 13, 2010

How to Improve your Skills as a Programmer.....

July 13, 2010 0
Gather complete requirements.

Take the time to write down what the end product needs to achieve. Clarity of thought at this stage will save a lot of time down the line.

Write an implementation plan (or model).

For something small and self-contained, this might just be a basic flowchart or an equation.
For larger projects, it helps to break it into modules and consider what job each module must do, how data gets passed between modules, and within each module how it will function.
Although it is fun to dive straight into code, it is equally tedious to spend hours debugging. By taking the time to design the structure on paper, you will drastically reduce your debugging time (and you may also spot more efficient ways of doing things even before you write the first line of code).

Add Comments to your code.

Whenever you feel your code needs some explanation, drop some comments in. Each function should be preceded by 1-2 lines describing the arguments and what it returns. (Comments should tell you why more often than what. Remember to update the comments when you update your code!)

Use naming conventions for variables.

It will help you keep track of what type the variable is and also what it's purpose is. Although this means more typing than x = a + b * c, it will make your code easier to debug and maintain. One popular convention is Hungarian notation where the variable name is prefixed with its type. e.g. for integer variables, intRowCounter; strings: strUserName. It doesn't matter what your naming convention is, but be sure that it is consistent and that your variable names are descriptive.
(See Warnings below)

Organize your code.

Use visual structure to indicate code struture. i.e. indent a code block that sits within a conditional (if,else,...) or a loop (for,while,...) Also try putting spaces between a variable name and an operator such as addition, subtraction, multiplication, division, and even the equal sign (myVariable = 2 + 2). As well as making the code more visually elegant, it makes it much easier to see the program flow at a glance.
(See tips on indentation below)

Test.

Start by testing it with inputs that you would typically expect. Then try inputs that are possible but less common. This will flush out any hidden bugs. There is an art to testing and you will gradually build up your skills with practice.
Write your tests to always include the following:

Extremes: zero and max for positive values, empty string, null for every parameter.
Meaningless values, Jibberish. Even if you don't think someone with half a brain might input that, test your software against it.
Wrong values. Zero in a parameter that will be used in a division, negative when positive is expected or a square root will be calculated. Something that is not a number when the input type is a string, and it will be parsed for numeric value.

Practice. Practice. Practice.
Be prepared for change.

In a realistic working environment, requirements change. However, the clearer you are at the start about the requirements and the clearer your implementation plan, the less likely those changes will be down to misunderstanding or "Ah, I hadn't thought of that" scenarios.

You can take an active role in improving clarity of thinking by presenting your requirements document or your implementation plans before coding to ensure that what you are planning to create is actually what's been asked for.
Structure the project as a series of milestones with a demo for each block. Approach the programming one milestone at a time - the less you need to think about at any moment, the more likely you will think clearly.

Start simple and work towards complexity.

When programming something complex, it helps to get the simpler building blocks in place and working properly first.
For example, let's say you want to create an evolving shape on screen that follows the mouse and where the degree of shape change depends on mouse speed.

Start by displaying a square and get it to follow the mouse, i.e. solve movement tracking on its own.

Then make the size of the square relate to mouse speed, i.e. solve speed-to-evolution tracking on its own.

Finally create the actual shapes you want to work with and put the three components together.

This approach naturally lends itself to modular code writing, where each component is in its own self-contained block. This is very useful for code reuse
(e.g. you want to just use the mouse tracking in a new project), and makes for easier debugging and maintenance.
Read more...

If programming languages were cars...

July 13, 2010 0
The list

* Ada

Ada is a tank. A butt-ugly tank that never breaks down. People laugh uncontrollably if you tell them you drive Ada, but really, do you want to be driving a sports car in a war zone? [from Amit Dubey]

* Assembly Language
is a bare engine; you have to build the car yourself and manually supply it with gas while it's running, but if you're careful it can go like a bat out of hell.

[From "Subterfug" off digg.com:]

Assembly Language: you are the car.

* Basic

Basic is a simple car useful for short drives to the local shops. Once popular with learner drivers, it has recently been stripped down to a shell and rebuilt by a major manufacturer, The new version has been refurbished for longer journeys, leaving only cosmetic similarities to the original model. [from Przemyslaw Wrzos]

* C

C is a racing car that goes incredibly fast but breaks down every fifty miles.

* Cobol

Cobol is reputed to be a car, but no self-respecting driver will ever admit having driven one.

* C#

C# is a competing model of family station wagons. Once you use this, you're never allowed to use the competitors' products again.

* C++

C++ is a souped-up version of the C racing car with dozens of extra features that only breaks down every 250 miles, but when it does, nobody can figure out what went wrong.

* Eiffel

Eiffel is a car that includes a built-in driving instructor with a French accent. He will help you quickly identify and learn from your mistakes, but don't you dare argue with him or he'll insult you and throw you out of the car. [From Daniel Prager with some embellishments]

* Erlang

Erlang is a fleet of cars that all cooperate to get you where you want to go. It takes practice to be able to drive with one foot in each of several cars, but once you learn how you can drive over terrain that would be very hard to navigate any other way. In addition, because you're using so many cars, it doesn't matter if a few of them break down.

* Forth

Forth is a car you build yourself from a kit. Your car doesn't have to look or behave like anyone else's car. However, a Forth car will only go backwards.

[By "256byteram", on a comment on Digg.com (I couldn't resist):]

FORTH LOVE IF HONK THEN !

* Fortran

Fortran is a pretty primitive car; it'll go very quickly as long as you are only going along roads that are perfectly straight. It is believed that learning to drive a Fortran car makes it impossible to learn to drive any other model.

* Java

Java is a family station wagon. It's easy to drive, it's not too fast, and you can't hurt yourself.

* Haskell

Haskell is an incredibly elegantly-designed and beautiful car, which is rumored to be able to drive over extremely strange terrain. The one time you tried to drive it, it didn't actually drive along the road; instead, it made copies of itself and the road, with each successive copy of the road having the car a little further along. It's supposed to be possible to drive it in a more conventional way, but you don't know enough math to figure out how.
[Monadic version:]

Haskell is not really a car; it's an abstract machine in which you give a detailed description of what the process of driving would be like if you were to do it. You have to put the abstract machine inside another (concrete) machine in order to actually do any driving. You're not supposed to ask how the concrete machine works. There is also a way to take multiple abstract machines and make a single abstract machine, which you can then give to the concrete machine to make multiple trips one after another.

* Lisp

Lisp looks like a car, but with enough tweaking you can turn it into a pretty effective airplane or submarine.

[from Paul Tanimoto:]

Lisp: At first it doesn't seem to be a car at all, but now and then you spot a few people driving it around. After a point you decide to learn more about it and you realize it's actually a car that can make more cars. You tell your friends, but they all laugh and say these cars look way too weird. You still keep one in your garage, hoping one day they will take over the streets.

* Mathematica

Mathematica is a well-designed car that borrowed a lot from the Lisp car without giving it nearly the credit it deserved. It can solve equations to determine the most efficient way to get to the destination, but it costs a fortune

* Matlab

Matlab is a car designed for novice drivers going on short trips over terrain similar to the terrain the Mathematica car is usually driven over. It is very comfortable when driving over this terrain, but if you go off the trail even a little the car becomes so hard to drive that more snobby drivers refuse to even acknowledge that it's a car.

* Ocaml

Ocaml is a very sexy European car. It's not quite as fast as C, but it never breaks down, so you end up going further in less time. However, because it's French, none of the controls are in the usual places.

* Perl

Perl is supposed to be a pretty cool car, but the driver's manual is incomprehensible. Also, even if you can figure out how to drive a Perl car, you won't be able to drive anyone else's.

* PHP

PHP is the Oscar Mayer Wienermobile, it's bizarre and hard to handle but everybody still wants to drive it. [from "CosmicJustice" off of digg.com]

* Prolog is fully automatic: you tell it what your destination looks like, and it does all the driving for you. [Addendum from Paul Graham:] However, the effort required to specify most destinations is equivalent to the effort of driving there.

[I forget who suggested this one:]

Prolog is a car with a unique trial-and-error GPS system. It will go down the road looking for your destination, and if it gets to the end of the street without finding it, it will back up and try the next street over and continue until you get where you need to go.

* Python

Python is a great beginner's car; you can drive it without a license. Unless you want to drive really fast or on really treacherous terrain, you may never need another car.

* Ruby

Ruby is a car that was formed when the Perl, Python and Smalltalk cars were involved in a three-way collision. A Japanese mechanic found the pieces and put together a car which many drivers think is better than the sum of the parts. Other drivers, however, grumble that a lot of the controls of the Ruby car have been duplicated or triplicated, with some of the duplicate controls doing slightly different things in odd circumstances, making the car harder to drive than it ought to be. A redesign is rumored to be in the works.

* Smalltalk

Smalltalk is a small car originally designed for people who were just learning to drive, but it was designed so well that even experienced drivers enjoy riding in it. It doesn't drive very fast, but you can take apart any part of it and change it to make it more like what you wanted it to be. One oddity is that you don't actually drive it; you send it a message asking it to go somewhere and it either does or tells you that it didn't understand what you were asking.

* Visual Basic

Visual Basic is a car that drives you. [from "yivkX360" on digg.com, no doubt channeling Yakov Smirnov
Read more...

July 10, 2010

I got a speedy Linux "# !" for my desktop.

July 10, 2010 0
CrunchBang Linux is an Ubuntu based distribution offering a great blend of speed, style and substance. Using the nimble Openbox window manager, it is highly customisable and provides a modern, full-featured GNU/Linux system without sacrificing performance.
CrunchBang Linux comes with the ability to play most popular media formats, including but not limited to MP3, DVD playback & Adobe Flash. CrunchBang Linux also comes with many popular applications installed by default, including but not limited to Firefox 3 web browser, VLC media player, Skype and Transmission BitTorrent Client.

Thanks to my friend Harsh Shah,who give me the #! Linux.


Read more...

Follow Us @soratemplates