Archive for February, 2007

Django tutorial finished

Thursday, February 15th, 2007

Yep it’s finished.
In my opinion django is worth knowing. It’s easy as RoR, but you always have control about what’s going on.

You must watch out about python syntax it’s sometimes not obvious that you have one space extra and code doesn’t work.

Last part of tutorial was about forms it normal, I think.

I’m going sleep now. Today I challenge with performance.

I think I won, becouse I really do so many improvements, but Lucene index is about 1Gb and performance still don’t satisfied me.

Tomorrow I’m going to won this battle.

Django 3rd day

Wednesday, February 14th, 2007

Now Django has no chance. After admin panel my expectation are very high.

But once again I was wrong.

Today tutorial 4, I didn’t achieve tutorial 4 because i play basketball and I’ve got appointment tomorrow about 7 a.m.

OK, URL managing, in my opinion it’s better than RoR because you have full control about it. For example

(r’^polls/(?P<poll_id>\d+)/$’, ‘mysite.polls.views.detail’),

Means that django all URL that matches regular expression

r’^polls/(?P<poll_id>\d+)/$’

Sends to module mysite.polls.views and call detail() function like

detail(request=<httprequest>, poll_id=’23′)

Next, tutorial shows how to write views, template. Finally it shows us a shortcuts. Yeah the functions from django.shortcuts boosts developing speed.

The last part of tutorial before me, and I’m thinking about topic of application to write, yet another blog is too easy for django and it’s admin module. So please suggest me something.

Regards
Pedro

Technorati Tags: ,

Django admin rulez

Tuesday, February 13th, 2007

Holly dolly

After I generate django project there was so little files. All Ruby on Rails
script directory is in manege.py, setting in settings.py quit simple.
Four files, it amazing.

Today I’ve got some time to look at tutorial2. And I don’t believe it, just can believe, the django admin application is marvelous. I don’t know what to say, it’s perfect. Even RoR ajax_scaffold is nothing special compared to django admin.
I Can’t even write here what I saw. Definitely everyone should see this. Great Job.

And to be honest this confusion was before I read about templates and css possibilities.

What is certain, I follow tutorial3, and definitely I wrote some application in django. Tomorrow I will fighting with bottlenecks, so I’m going to rest to be prepared.

Technorati Tags: ,

Django first meeting ;)

Sunday, February 11th, 2007

Ok I finished bootstrap meeting. It’s time to look at django framework. Some years ago I try python, and I think it’s worth knowing. Let’s see django.

Django requires python 2.3+ so I check my machine.

pedro@pedrowaty: ~ -V
Python 2.4.4

Bingo. Let’s follow installation instruction, get django tarball.

pedro@pedrowaty: ~ wget http://www.djangoproject.com/download/0.95.1/tarball/
tar xzvf Django-0.95.1.tar.gz
cd Django-0.95.1
sudo python setup.py install

Also I read that this don’t work with python 2.5, luckily I’ve got 2.4.4 ;)

Next I followed this instruction

I follow this tutorial 1 and what can I say? It’s easy as RoR. So the trip just begin, I couldn’t do my test app with this framework because of my home-life. But I’m sure the next meeting is coming as quick as possible.

Mavenization Idea

Friday, February 9th, 2007

Finally, we did it. Our project was gained maven nature. The process of conversation is NOT so simple, as I thought when I started. I share my experiences during this migration.

Mavenize your project structure

It is possible to make maven work with your actual project structure, but as I know now, the first maven rule is “Don’t fight with maven”.

When structure is mavenized your entire project looks the same way, and of course you find resources there where you suppose too.

Move your webapp part to src/main/webapp. In this directory you should have all the stuff going to web archive.

The hardest is how to separate java files which should be in src/main/java and java resources such properties, validations, and other stuff which should be in src/main/resources. In our company we have a tool which makes this for us. You can write yours, or use shell utils such as find, awk, and grep.

Next move all your ant stuff (properties, libraries) exclude build.xml to src/test/deprecated. Finally you should have clear maven Standard Directory Layout. For further information visit maven SDL site.

Useful tools

Without tools you are naked ;) . When you want make maven SDL you must use tools. Of course when you don’t want keep your versions control history you can do it just by deleting all files, moving them to SDL structure.

find – your first friend with -exec parameter.
sed & awk – sometimes we must rename path (for example sed ‘s/main/test/’ in.file >out.file)
grep - it’s always useful

When you work on windows, my suggestion is : if you don’t have cygwin, install it. Build generate.sh file with UNIX tools, which generate for you bat files. Run it in windows command shell and go for coffee brake.

Keep your build.xml alive

The most important task is modifying build.xml file to work with new file structure. When you do this, you can switch to maven structure when all your team is on the lunch. Second maybe more important, if you want have time to make another step, prepare good how to switch work from previous structure to maven way. IT’S THE MOST IMPORTANT. And remember it must be easy and complete. Test it, and at least one another person should test it.

Write your pom

Its easy part, write task from beginning to end, and don’t forget to tell someone to test it, because you may have special setting, which won’t work in another environment. Once you finish and check that pom.xml makes everything as build.xml. You should once again write proper documentation how to replace old task the new one. Makes profiles with filters.

Watch out, maven doesn’t recognize that you filtering filter. In this case he hangs on resource:resource phase depends on configuration.
And it is not obvious to catch this. So be careful.

Finally kill deprecated

At least after all this steps, you can kill deprecated directory. First libs I think, next the rest. Ok one thing if you run in trouble I suggest use -X option. Than you should live long and peacefully.

Pedro

about me

My name is Sebastian Pietrowski. I've finished Warsaw University as Master degree. I started my journey with Java 1.1 with Thread and JDBC programing in 1998 as I worked for merlin.pl. In 1999 I've passed Java Programer Certificate for Java 1.2, and was solution architect of merlin.pl infrastructure when we was moving from pl/sql to J2EE. It was great performance optimization with 10 times more req/sec than in requirements and 85 times faster as original solution.

Currently I work as Expert Software Development Java at F.Hoffmann-La Roche. The company was founded in 1896 and today, Roche employs over 80.000 people. After work I'm involved in activities related to Scala/Lift, Ruby/Rails/Merb, Python/Django. This is because I try to be pragmatic also I'm focused on application performance and tuning with success in my daily work.

My Yoda's motto: Do, or do not. There is no try.