Archive for May 2007
CakePHP: Sanitization…
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:
The dot com dream…
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:
- http://www.littlehart.net/atthekeyboard/2007/01/02/just-build-it-damnit/ (funny, and straight to the point. Why is it on the top of the list? CakePHP, nuff said…)
- http://mingle2.com/blog/view/how-i-built-mingle2 (I gave comments on this one earlier)
- http://makeitbigingames.com/blog/?p=29 (This is more like for game developers. But if it works for games, it should work for web 2.0 as well)
- http://www.techcrunch.com/2006/01/09/dont-blow-your-beta/ (Interesting advice about Beta version)
- http://bnoopy.typepad.com/ (This guy created Excite.com and JotSpot. Beware: Most of these are old posts, but still fun nonetheless)
- http://www.paulgraham.com (Ahh… Paul Graham, the LISP guy. Entrepreneurship is nothing without his essays)
- Signal vs Noise (37Signals, the RoR champion. It’s always worthed to read their essays)
Python for N00bies Resources
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:
- Data Structures and Algorithms with Object-Oriented Design Patterns in Python
- A Byte of Python
- Dive Into Python
- wiki.python.org
Online Tutorials:
One Laptop Per Child (OLPC) review…
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:
Sakaiproject: Out of Memory…
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:
- http://bugs.sakaiproject.org/confluence/display/DOC/Install+Guide+-+Build+(2.4)
- http://bugs.sakaiproject.org/confluence/display/DOC/Install+Guide+-+Config+(2.4)
- http://bugs.sakaiproject.org/confluence/display/DOC/JVM+Tuning
- http://www.dr-chuck.com/csev-blog/000222.html
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.
Battle against RoR: gem install mysql…
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:
References on how to install Ruby on Rails on Mac OS X
- http://hivelogic.com/narrative/articles/ruby_rails_lighttpd_mysql_tiger
- http://developer.apple.com/tools/rubyonrails.html
- 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.
Apache & CherryPy Tutorial
I cannot write it better than his.
So, I’ll just include the original article here.
———————————————————————————————–
Other References:
SQLAlchemy: InvalidRequestError: Cant get DBAPI module for dialect…
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…
Checklist when using Python for Web Development
- Download latest stable of Python (as of today version 2.5).
- Visit cheesecake for some module shopping.
- Before installing anything else, easy_install module is a must-have!
- If you are planning to use MySQL database, install module mysql-python.
- On top of MySQL,if you need ORM (Object Relational Mapper), download SqlAlchemy.
- If you are planning to do unit testing, install nose.
- If you need MVC Web framework you can either:
- install Django
- install TurboGears
- 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.