Rudimentary Art of Programming & Development

Promoting Open Source, Always…

Archive for May 2007

CakePHP: Sanitization…

without comments

is a very long word and difficult to pronounce. But hella useful. Waay useful.

It’s recommended to use sanitization in all of your controllers that serve web form.

Summary:

Sanitization helps trimming out undesired tags coming in from your view pages. Thus, bad <script> tag will never make it to the database.

It’s a good handy helper function.

References:

Written by didip

May 30, 2007 at 9:52 am

Posted in cakephp, php

The dot com dream…

with one comment

is hella difficult to pursue.

When dreaming the web 2.0 dream, I cannot help but to felt discouraged. A lot…

The discouragement came when real problems arose. Whether it’s the database mapping that’s overly complicated (making searching difficult), or “way-over-the-top” JavaScript UI that I couldn’t create…

But such is life, ain’t nothin’ is easy. If success is easy, then everyone is successful already. Pursuing such humongous dream, of course I do the usual routes:

  • Bank in skills like mad because cool stuff are made by utilizing various skills.
  • Learn and apply time management. Even at home, or at work, or at plain old day-job, or while working at that cool open source framework. There’s only 24 hours a day. I cannot possibly lose too many minutes a day dreaming.
  • Being Frugal. Because Frugal is the new Cool in Web 2.0

But those are seemingly not enough. It’s really though to COMPLETE a dream.

Therefore, when I’m at my low points. I like reading stories about how other entrepreneurs do things. I never read self-help books, but experiences told by real entrepreneurs are believable and more importantly, REAL.

Below are compilations of good reads that I’ve read. Stay tuned because I will have more:

Written by didip

May 25, 2007 at 3:56 pm

Python for N00bies Resources

without comments

When coding with new language, unfamiliar syntax & API might frustrates you a lot.

That’s what I felt with Python, thus to familiarize myself, I’ve compiled list of online resources that I (or readers) can download or read online.

Online Books:

Online Tutorials:

Written by didip

May 23, 2007 at 11:23 am

One Laptop Per Child (OLPC) review…

without comments

is here!

There’s no way I can get my hand on these. But, their User Interface (called Sugar) look simple and intuitive.

Further research shows that the GUI is written in Python.

Sugar UI Demo:

Other References:

Wikipedia article on Sugar GUI.

Another blog, with far more detail description and opinion.

Written by didip

May 21, 2007 at 1:31 pm

Posted in olpc, python

Sakaiproject: Out of Memory…

without comments

seems to be a well known issue.

For those who encountered strange Tomcat behavior,

or OutOfMem during deployment,

I compiled list of articles that might help you:

Sidenote:

Dr. Chuck seems to be very involved with sakaiproject. Thus, I’d recommend readers, who care about CMS for higher education, to check back on his blog frequently.

Written by didip

May 18, 2007 at 9:27 am

Posted in java, sakai

Battle against RoR: gem install mysql…

with 11 comments

is simply broken. Broken as hell.

This is my development environment:

  • Mac OS X 10.4.9
  • MySQL 5.0 under /usr/local/mysql
  • gcc 4.0.1 or gcc 3.3
  • readline 5.2
  • ruby 1.8.5
  • rubygems 0.9.3
  • fcgi 2.4.0

Everything was installed properly except mysql binding.

1. This is the command I called to install that module:

sudo gem install mysql — –with-mysql-dir=/usr/local/mysql

2. Didn’t work. Next:

sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
Chose MySQL 2.7 (ruby)

3. Works. But “rake migrate” didn’t work. Next:

4. Changed gcc from 4.0 to 3.3:

sudo gcc_select 3.3

5. Then ran:

sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
Chose MySQL 2.7 (ruby)

6. Didn’t even compile. Tried MySQL 2.6 (ruby):

sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
Chose MySQL 2.6 (ruby)

7. Didn’t even compile. Damn!

Google search revealed this. Damn! Why some configurations work for some people? What The Hell???

8. So, I changed gcc back 4.0:

sudo gcc_select 4.0

9. Uninstall gem mysql:

sudo gem uninstall mysql

Now, obviously, “rake migrate” works.

Conclusion: RoR 1, me? Big Fat 0.
————————————————————————————————-

References:

Written by didip

May 17, 2007 at 12:37 pm

References on how to install Ruby on Rails on Mac OS X

without comments

  1. http://hivelogic.com/narrative/articles/ruby_rails_lighttpd_mysql_tiger
  2. http://developer.apple.com/tools/rubyonrails.html
  3. http://locomotive.raaum.org/

Number 3 is interesting because it provide project containers to all of your Ruby on Rails application, but the 75 MB download is a bit too much though.

I cannot really add more insight to the installation process because RoR seems to be born inside Mac OS X. Installation is dead simple, documentations are plenty as well.

Written by didip

May 17, 2007 at 11:18 am

Apache & CherryPy Tutorial

without comments

I cannot write it better than his.

So, I’ll just include the original article here.

———————————————————————————————–

Other References:

Written by didip

May 16, 2007 at 3:47 pm

SQLAlchemy: InvalidRequestError: Cant get DBAPI module for dialect…

without comments

What does it mean:

During connect process SQLAlchemy is trying to grab database module specific to the dialect (e.g. MySQL or MySQLite)

How to resolve it:

Make sure you installed python module for your specific database. For mine, it’s MySQL thus I installed mysql-python.

Stay tuned for more Python setups or installations…

Written by didip

May 16, 2007 at 1:17 pm

Posted in mysql, python, sqlalchemy

Checklist when using Python for Web Development

without comments

  1. Download latest stable of Python (as of today version 2.5).
  2. Visit cheesecake for some module shopping.
  3. Before installing anything else, easy_install module is a must-have!
  4. If you are planning to use MySQL database, install module mysql-python.
  5. On top of MySQL,if you need ORM (Object Relational Mapper), download SqlAlchemy.
  6. If you are planning to do unit testing, install nose.
  7. If you need MVC Web framework you can either:
  8. If you are thinking of rolling your own architecture:
    • For getting up to speed in Web Server development, download CherryPy.
    • As you get large number of hits, you might be considering Lighttpd. To communicate CherryPy & Lighttpd, install scgi via: easy_install scgi.
    • If you need templating language for generating dynamic html, there are gazillion of them, I don’t know which one is good: Cheetah(PHP-alike), Kid(XML-ish), Genshi (XML + embedded Python), Mako (not XML), etc.