Well, I decided to finally switch to a more powerful cms for this site. Have some needs currently and coming up that require a little more granularity than eggblog could provide, though I do miss it’s simplicity and quickness.
I am pretty impressed so far with wordpress however and think I will be sticking with it for a while.
You may notice the dates are all changed on the posts so they show as being posted today, this is because I just quickly dumped all the older ones in.
Thursday, August 17th, 2006
Thu 17 Aug 2006
Thu 17 Aug 2006
Things to help productivity in rails (or any web development)
Posted by joeldg under coding , railsNo Comments
Just a quicky:
Every developer I have sent the link to gotapi to has come back and told me that it is now their home page or one of the tabs that opens when they start firefox. It has become and indispensable tool for me and those I work with. On one fast page you have the docs and fast lookups for every web development language (with the notable exception of python). My gotapi I keep with the following “HTML, CSS, Javascript, Prototype, MySQL, PHP, Rails Ruby and Ruby stdlib.
If you are a developer, go there, all the JAVA api`s are listed, C and C++, XML, actionscript etc.. It is the one stop shop for documentation.
To the guys who wrote it .. “Thank you”
Secondly, Protolize the ultimate web2.0/ajax/rails/cool list of links that is always just what you need.
Some other notables:
programming cheatsheets sort of like the “key cards” they supply in video games, but for programming languages.. Handy to print out and staple to some vertical surface at eye-level
Learning ruby links a collection of links that other people have found that I thought were worthwhile.
CSS event selectors sort of like behavior, but a little easier to use.
nice protype-based image cropper script that I can think of many uses for. One being to crop an image so that a section can be used as an avatar/icon for a website.
Open web design and Open source web design both great resources for that fast template you might need to mock something up or just get a framework for a site setup.
Just a few links I wanted to organize.
Thu 17 Aug 2006
Not my normal topic, but this is a new show on television called Heroes. Basically the idea is that ordinary people discover they have extraordiary abilities and what they do with those..
The full one hour first episode can be downloaded here and a four minute “super trailer” can be downloaded here the first episode is promising, though we are just being introduced to the main characters.
I think my favorite character was Hiro (yes, the name) who is a Japanese salary worker bored with his ordinary life and who has read too many comics.
The show has some leanings to LOST style of storyline where everyone is connected and there are a lot of hidden little gems in the show that I caught, and I am sure as the series progresses it will be more pronounced.
Not too many shows aside from anime that I go out of my way to check out, this one was worth it..
Tomorrow I am going to post about my findings with YM4R (googlemaps and geocoding) in rails and also do a walk through perhaps on some of the AJAX rails calls that I find handy.. (I am learning here as well, sometimes it helps for me to try and explain to others)
Thu 17 Aug 2006
there is no cpaddon module for rails, so you gotta get your hands dirty. This is the fast way I got it to run, I will makes notes where needed. This is current as of August 2006 with the latest “stable” cpanel WHM.
As the root user, install ruby, gems, rails, fcgi, mod_fastcgi and add a configuration line to http.conf and restart as follows ( condensed from: here):
$ cd /usr/local/src $ wget ftp.ruby-lang.org/pub/ruby/ruby-1.8.4.tar.gz $ tar -xvzf ruby-1.8.4.tar.gz $ cd ruby-1.8.4 $ ./configure && make && make install $ cd /usr/local/src $ wget rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz $ tar -xvzf rubygems-0.8.11.tgz $ cd rubygems-0.8.11 $ ruby setup.rb $ gem install rails $ cd /usr/local/src $ wget fastcgi.com/dist/fcgi-2.4.0.tar.gz $ tar -xvzf fcgi-2.4.0.tar.gz $ cd fcgi-2.4.0 $ ./configure && make && make install $ cd /usr/local/src $ wget fastcgi.com/dist/mod_fastcgi-2.4.2.tar.gz $ tar -xvzf mod_fastcgi-2.4.2.tar.gz $ cd mod_fastcgi-2.4.2 $ /usr/local/apache/bin/apxs -o mod_fastcgi.so -c *.c $ /usr/local/apache/bin/apxs -i -a -n fastcgi mod_fastcgi.so $ gem install fcgi $ mkdir -p /tmp/fcgi_ipc $ chown nobody.nobody /tmp/fcgi_ipc -R $ chmod 755 /tmp/fcgi_ipc -R
Then in /etc/httpd/conf/httpd.conf add
LoadModule fastcgi_module libexec/mod_fastcgi.so <IfModule mod_fastcgi.c>
FastCgiIpcDir /tmp/fcgi_ipc/
AddHandler fastcgi-script .fcgi
< /IfModule>
install any other gems you want like rmagick and gettext and then restart apache however you like.. Remember if you install a gem you must restart apache to be able to use it.
Now to actually get rails running, follow what I have done with this domain use your own user
$ su people $ cd ~ $ rails test $ cd public_html $ ln -s ../test/public/ rails $ cd ../test/ $ chmod -R 777 tmp/ $ cd public $ chmod 755 dispatch.fcgi $ vim .htaccess
chmod -R a+rwx tmp is probably better than 777, but it is an afterthought to just getting this done
Change “dispatch.cgi” to “dispatch.fcgi”
Load up http://peoplesdns.com/rails/
One of the main issues I have seen from people is that they get it running but if the tmp directory is not writable then rails pukes and gives a bunch of errors, this seems to fix the issue.
An easy way to make rails standards would be to wrap /usr/bin/rails in a shell script by renaming rails to “runrails” and then having the rails script handle this, along with setting a “_RAILS” dir in the users folder and creating all projects inside that.
if you want to use mysql (duh)
gem install mysql
if you don`t do the above, rails doesn`t panic it starts spitting out “Lost connection to MySQL server during query” errors all over which really tells you nothing.. so make sure and install the mysql gem and save yourself some headaches.
install whatever other gems you want
Then if you actually want to use your gems, you must
/etc/init.d/httpd restart
it is sort of like installing anything on windows, you gotta reboot the whole thing.
Anyway, though that might come in handy for someone.
Thu 17 Aug 2006
I have been working professionally as a PHP programmer for a long while, I recently began working for a new company and we are working all in rails.. I will be doing some recording of my progress.
Having worked previously in ASP (many moons ago) and then working in PHP for six years I first have to say that rails is “different”.
I have basically avoided frameworks as the ones in php try to turn php into something else that it is not. My general development was speedy though maintenance was not always the best on “fast” sites. For me, I have a base library of functions that I have found or written that I know I use and in general use to build up an application quickly.. I think part of my general avoidance of frameworks was that I didn`t want to use a different templating system, I have an extremely flexible one I made (and since have seen horrid templating systems in other corps, I think most people don`t understand the basics of templating at all. If you are going to create a templating system don`t even give the templates themselves the php extension, use .tpl or .tplt or whatever just to keep you from being seduced into that and running loops in them instead of reusing fragments.
Anyway, Rails provides a templating system, it provides a nice set of classes and it starts you off with excellent organization and does a lot of the work for you.
I have actually found it is easy to switch to rails for the simple fact that it is NOT using php, because I would be too tempted to start just changing things and hacking it up. I really am more of a backend programmer than anything, I prefer JSON+JS for frontend work.
There are many many things I really like in rails so far, the AJAX support is astounding, in a few lines I can do what used to be a full days work. I am in love with database migrations, and the database model system, in one fell swoop it fixes 75% of the issues you run into with php apps and data validation.
It is not all roses though:
One of the main gripes I have is that the rails docs does not have a comment system like php.net … this is a total travesty and it needs to be done, most people get more from the comments than from the documentation. I myself have contributed several hundred comments to the PHP site over the years (which comprises of the majority of all the php-ncurses docs + undocumented php-ncurses functions) comgin from PHP this totally BLOWS not being able to have this kind of resource. Sure, fxri is a nice way to find stuff, but it would really be handy to not have to search all over to find rails docs with a little programmer commentary.
Rails has some tight control over globals and it is never easy for a programmer to know the “scope” of a variable or a function. Take “request” for instance, I had to dig around for a while to finally figure out this is where the rails equivalent of the PHP $GLOBALS was, and then I found out that it was not actually “global” because I could not call it within functions in a helper. Also it was not entirely clear what the @ and : variable signifiers were from the start, this was frustrating until I sort of figured it out.
The only other issue is not really rails specific, but due to the fact that working with rails you need to have so many files open that trying to use my editor “gvim” is difficult at best, even with buffers keeping on window for each directory I end up with thirty gvims open and have to hunt for things so I switched to jedit which kind of bothers me a bit becuase over the years I have collected some useful vim scripts that I love.. one is a code columnizer (nice groupings of code all line up) and others are for comments and timestamping as well as in-file only completion (which is handy when you are working with strange files to have completion for some of the strange stuff)
Not a lot of gripes really, rails is nice and I will be writing a lot more about here saying that I am diving really deep into it and soon will be working on server-side issues a lot.
I will try to keep this up to date a bit more.
Thu 17 Aug 2006
Google sketchup (free) and the pro Sketchup are fast and easy for anyone to learn, they are excellent resources to have under your belt for quickly creating some creative works.
Sketchup is an amazing program. If you don`t know what it is check out the tutorials and WATCH that first segement when you “launch the tutorial” it will go over some of the ease of use and “wow” factor involved in this program that google bought and is giving away.
One of the example images is here:

and here is one I made myself (for a game I am creating) and it took me all of about 15 minutes
![]()
A person who has never used this program can quickly model their house/apartment in probably thirty minutes (from install to finished picture, though some of the details would not be perfect, but …)
one of the things that google added was the 3d warehouse in which users can share their sketches and easily import other sketches into sketchup..
For a programmer trying to do some base graphics or even finished graphics and who does not really know a lot about computer graphics it comes HIGHLY recommended..
I will post more on the game I am developing jointly with some other people as I get some beta work done on it, but I am just so happy with sketchup I wanted to post here about it.
Thu 17 Aug 2006
My no-signup, super-quick mouse movement and click-tracker has been released on the new umbrella site http://dreamvendors.com so stop by and check it out. It takes a minute to set up and get started tracking how people visit your site.
I set it up so that there is no signup necessary, each individual page that it is called from will be stored and logged.
I will post more about it later and perhaps set up the pages more, they are quick templates for that pages I set up.
Thu 17 Aug 2006
36,000 mouse and click points in I discovered my initial experiment in mouse position tracking had a slight flaw in it, as I didn`t expect the script to bail so early.. So much of the tracking I would have gotten was lost, but never fear, there has been a fix thanks to the PHP function ignore_user_abort(TRUE) in the update script which under situations of a click would bail rapidly while the browser moved to a new page or loaded different content.
FIRST THING: TO VIEW THE STATS, CLICK THE LITTLE ICON IN THE LOWER LEFT. (BLUE IS CLICKS, GREEN/ish IS MOUSE)
I got the mouse track logging back on track… The script was bailing out and I fear I may have some some stats. Otherwise is working well and seems to be attracting some attention from people looking into ways to see what people are doing with their mouse on your page.
I am considering using a technique to identify the location of certain elements of a page and try to attach the div`s to them when displaying stats.. This will cure some of the ills of text-size changes, and from the vastness of screen resolutions.. Though, there is something to learn about resolutions as well and it IS kind of easy to see.. SO… I may just make multiple display modes in the overlay.
I am also looking into the mozilla canvas for the items on the overlay display which could programatically handle them very well.
I have made some changes to statsbox size on the overlay as well as colors to view what is what..
I am mostly swamped by work and life though, so it is difficult to spend too much time.. Perhaps I can steal some time at some point this weekend to get this packaged into a hosted app.
Thu 17 Aug 2006
I was looking at a good mouse/click tracking solution that does visualization of where people are clicking on a site and what people mouse-over the most.. I looked at crazyegg.com and tested out their beta but didn`t like the fact their javascript overwrote every link on my page. I also didn`t like that they limited my click tracking and plan to charge for it..
(EDIT: this probably won`t look very nice or even work in IE, but IE is five years old people.. so `maybe` you should upgrade? If you are using IE your browser is probably older than your computer, think about that….)
for those that cannot see what it is supposed to look like:
Now.. it is not that I plain don`t trust so many people as I would rather control what is going on with my own stats, being a programmer, I like to keep tabs on these things. So, I did my own which is now running on this page. You can click on the little thermometer in the lower left (if you are in firefox, otherwise IE may put it in the uppper left) and the page overlay will pop up which shows you in green (progressive by mouseover) where people move their mouse around the site then, in blue where they are clicking.. This is a running `live` total and obviously limits the queries and the entries to the most relevant possible data and limits the display to 500 mouse areas and 500 click areas (progressive color by most for each spot) anything more than a thousand extra divs on a page and your browser is going to start choking, so let s keep it simple from the start and work up.
HOW IT WORKS:
- Register mouse moves
- Mark all mouse moves for the first fifteen seconds on the page via a timer (in case they don`t click)
- Register all clicks with prior mouse moves on the page, this is reset with each click
- A mouse move is regarded as a ten pixel change in the X or Y value of the mouse. All clicks are marked regardless
- Stats are displayed sorted by clicks DESC and then divs are created based on a normalization of the hits
TODO:
- Fix the issue with browser size… great for fixed upper-left sites, bad for centered sites..
- Maybe brighten up the colors some, they are a bit washed now, though, I am interested to see it after a week, so will wait..
- cleanup the js… there is some dangles going on..
- cache the results script, it will get out of hand with more than 100 sites otherwise
- actually release it
Obviously this has a lot of cleanup and might turn into a hosted app for people who have PHP and such but don`t really feel like managing their own stats and just want to plop a php script and a some js in a dir and have immediate results.. We will see..
But for now, I am collecting stats so I can better tweak things..
Not bad for two afternoons work ![]()
Thu 17 Aug 2006
I tried an experiment to see just how good the panoramic software was and trotted down to Grand Central mid-day and took a series of photo`s from the stairs.
I took a series of six photos from the stairs in grand central, I was curious if having people walking around in a photo would really mangle up the algorithms.. Guess what, it did. However, manually going in a fine-tuning the control points and adding some at key points and whalla, no problem getting the images to line up and spit out a nice panorama.
If you look at the image in the lower right, there is an interesting bit with two guys who seem joined and are walking in different directions, and there is one guy with his head cut off and another guy taking his place, but otherwise I am still amazed by the stichwork these programs do on photos.
