Installing Pylons, Sqlalchemy and Pysqlite

January 8, 2008 at 1:58 am | In pylons | 1 Comment
Tags: , , ,

This post is about installing Pylons, Sqlalchemy and Pysqlite on Win XP
To get started, you should have installed Python (currently version 2.5 at the time of writing) if not install it first. Make sure you have the python installation path (ex: C:\Python25) in the “Path ” environment variable.

The next step is to download “ez_setup.py” (http://peak.telecommunity.com/DevCenter/EasyInstall) .

Note – download “ez_setup.py” to some other location other than python installation area.

Open a command prompt, navigate to the dir where you have the downloaded script and execute

python ez_setup.py

This will install “easy_install” utility which will be used heavily by you in future. As part of this step “Scripts” folder (C:\Python25\Scripts) will be created under you python installation folders. You will have to add “Scripts” folder (C:\Python25\Scripts) to the “Path” environment variable. Once this done, open a new command prompt and type

easy_install --help

This will list out the command line options.

So you are now set to download and install Pylons.

Open a new command prompt and execute the command

easy_install Pylons==0.9.6.1

This will download and install Pylons. Once its done, check the “C:\Python25\Lib\site-packages” folder, it should have “pylons” module within it. Alternatively, on the command prompt, type “python” to get into python shell and

import pylons“, then enter “pylons.__version__

which should display the version number of pylons. Alright, Pylons installation is done.

To install Sqlalchemy, open a command prompt and type

easy_install sqlalchemy

This will download and install Sqlalchemy. To check if the installation worked ok, the first thing is to check for the sqlalchemy folder within “C:\Python25\Lib\site-packages” of python installation. Alternatively, open a command prompt, type python to get into python shell,

import sqlalchemy” and enter “sqlalchemy.__version__

this should print the version number of installed sqlalchemy.

To the final part now, installing Pysqlite. As similar to other previous installation, on the command prompt, type

easy_install pysqlite

Once the download and install is over, get into the python shell and

import pysqlite2

from pysqlite2 import test

test.test()“.

This will run some tests and display the number of tests that was run.

So thats it, its time to start working on some web application.

Planning projects

December 22, 2007 at 1:46 am | In Personal | Leave a Comment
Tags: , , , , ,

I spent quite amount of time trying to figure out how to plan/execute a project (project can be a blog, a website etc) and here is what i finally thought that would solve the issue using the experience that i gained -

  • Decide what do you want to build and set a realistic deadline.
  • know what is the minimum requirement(functional) that is needed in order to setup something (for ex, going online with a website)
  • know what are the risks involved and try to come up with a solution before you dive deep. (for ex, try to come up with some prototypes if you think you are technically challenged)
  • Finish the project. (i am pretty sure, you must have left something out or there may be a gap, so all it needs is to walkthrough what you have so far multiple times until you are satisfied)
  • And most important that applies in any of the above stages is to know when to dump your project or quit. (i have done it couple of times, i try to do something and halfway through i quit because i feel its not going to work)

All i am saying is you need to have passion towards what you are doing, thats the one that will drive you till the end. You may come up with many different plans to start & finish a project, but to me what i have mentioned above is what most of the people(atleast) do it.

Are you a successful blogger

December 17, 2007 at 5:23 am | In Personal | Leave a Comment
Tags: , ,

Well, there are many people who are really talented in writing content, but there are people who have lot of content in their brain but don’t know how to put it out, its really hard to be a successful blogger. There was an article that i came across which talks about blogging and how hard it is to be successful. I don’t know what successful in blogging means. I thought blogs were a way to write what you like which people may or may not like.

Creating reusable elements in cakephp

December 10, 2007 at 12:58 am | In cakephp | 4 Comments
Tags: , , , , ,

If you ever wanted to create a reusable element in cakephp, use Elements and RequestAction.

To explain a bit, use $this->renderElement('element_name') in your view. This will actually call the element ‘element_name’ which in turn calls your action code using $this->requestAction('controller/action') call which you would have defined in your element. Thats it, this saves a lot of time.
A neat and simple example is given here.

Wake up call through computer

December 9, 2007 at 4:17 am | In Personal | Leave a Comment
Tags: , , ,

Somehow i came across this article “the computer called, it said to get off the couch”. This is about having automated wake up call using our computers which has increased the number of minutes that a human spends for his excersie in the morning. This holds good for a research study, but practically speaking if alarm clocks didn’t work, i am not sure how will this idea of having a computer to wake you up will work.

First thought about Kindle

December 2, 2007 at 9:35 pm | In Personal | Leave a Comment
Tags: ,

When i first saw it couple of weeks back, the first thing that hit my mind was that it looked like a hospital gadget to me, they definitely lack Apple’s touch in their design. But with Amazon’s huge book database, it might pick up.

DS Fun

December 2, 2007 at 9:21 pm | In Personal | 2 Comments
Tags: , , ,

I recently bought a new DS game “Legend of zelda : The phantom hour glass” as the reviews were pretty good. Once i started playing, i couldn’t come out of it. It’s really interesting. The fun part is, all the game functions works on Stylus and you don’t have to use the keys which is really good as it doesn’t hurt the fingers when played for a long time.

The game plot has lots of interesting levels and at times you definitely need a game guide (gamespot has a good one) to proceed further.

How to – password hashing in cakephp

November 25, 2007 at 6:44 am | In cakephp | 3 Comments
Tags: , ,

How do you do password hashing in cakephp ?

The answer is really simple, use the Security class provided by cakephp.

Example usage -

In your controller, do the following
$this->data['User']['password'] = Security::hash($this->data['User']['password']);

where ‘User’ is the model and ‘password’ is the attribute that is used to capture the password entered by the user.

By default, Security::hash takes the type sha1.

And if you want to validate or check the password entered by the user against the hashed password stored in db, use the hash method and perform the check.

CakePHP

November 22, 2007 at 11:11 pm | In Personal | Leave a Comment

After browsing around many php frameworks , finally i found the one that i really liked – CakePHP. Setting up was pretty easy and writing a small application was really fun. This has got me into developing a small web site. Well, its almost complete with few fixes/enhancements going on. Hopefully this will be over pretty soon. I just can’t wait to see my first web site live.

Changing defaults – cakePHP

November 22, 2007 at 6:29 am | In cakephp | Leave a Comment
Tags: , ,

There are times when you want to change the defaults provided by cakephp for example – layout etc.

To change the default layout, do the following -
Cakephp normally uses the default.thtml from cake\libs\view\templates\layouts\default.thtml. Copy default.thtml to your app\views\layouts\ and change accordingly. You can also change the cake’s default.thtml within the libs folder but thats not advisable.

Next Page »

Blog at WordPress.com. | Theme: Pool by Borja Fernandez.
Entries and comments feeds.