My Project Blog


Setting up Ruby on Rails with WAMP
November 24, 2008, 6:22 pm
Filed under: Uncategorized | Tags: , ,

Alright.  Let’s get back to business.  There are some AS3 frameworks out there for MVC (PureMVC, Cairngorm…).  Looked into them but i rather have something more flexible, more transparent and not AS3.  So, RoR backend and Flash front end seems to be a good mix.

To set up RoR on the WAMP server.

Check out the following forum thread,

http://forum.stylegala.com/viewtopic.php?t=3964

The thread was posted on eons ago, so here is the updated stuff.  The new stuff is in red.

……

Things you will need:

1. Wampserver (Prepackaged Apache 2, PHP, phpMyAdmin, MySQL) – http://www.wampserver.com/en/index.php <the version i used was 2.2.8>
2. Ruby “One-Click” Installer for Windows – http://rubyforge.org/frs/?group_id=167 <latest version>
3. Ruby Gems for Windows (Similar to PEAR) – http://rubyforge.org/frs/?group_id=126 <latest version>
4. Ruby For Apache – http://rubyforge.org/projects/rubyforapache/ <the discontinued version>

<There is project called Instant Rails, google it, it has everything mentioned above packaged into one bundle of goodies.   But, i only learn thru the hard way and transparency. >

Step By Step Process:

First and foremost, I have used many servers for my development environment, but none have compared to WAMP. It allows you to easily flip Apache modules / PHP extensions on and off, not to mention switch between PHP 4 and PHP 5, all with an unintrusive GUI. There are quite a few plug-ins such as Zend Optimizer, Webalizer, Perl, etc. The best part is that WAMP is FREE. (although donations are welcome, which I myself have been rallying my organization to contribute to the project).

Keep in mind that for my entire example, wamp is setup on my D:\wamp drive / path. As you are following these instructions, substitute your drive / path. I will remind you periodically to substitute your drive / path. It is imparitive you pay attention, and follow these instructions verbatim. Do not skip ahead! (unless told to do so)

Step 1 – Install Wampserver (#1 of “Things you will need”)

– If you already have WAMP installed, continue to Step 2

Step 2 – Install Ruby (#2 of “Things you will need”)

– When the application starts, it will ask you if you want to install SciTE and FreeRIDE; These are not required
– I installed ruby alongside my php directories under D:\wamp, so the end path will be D:\wamp\ruby
– Click “Install”

Step 3 – Install Ruby Gems (#3 of “Things you will need”)

– Extract the contents of your Ruby Gems to D:\wamp\ruby\rubygems
– Open a DOS prompt window, and enter the following commands:


> D:
> cd D:\wamp\ruby\rubygems
> setup

– Note: keep in mind your wamp drive / path
– If all went well, you should see the following (or similar):


Successfully built RubyGem
Name: sources
Version: 0.0.1
File: sources-0.0.1.gem

Step 4 – Install Rails

– Open a DOS prompt window, and enter the following commands:


> D:
> cd D:\wamp\ruby\rubygems
> gem install rails --include-dependencies

– Be patient… gems is downloading rails from rubyforge.org
– Again, if all went well, you should have seen commands executing, with a final note indicating


Installing RDoc documentation for activerecord-1.14.4...
Installing RDoc documentation for actionpack-1.12.5...
Installing RDoc documentation for actionmailer-1.2.5...
Installing RDoc documentation for actionwebservice-1.1.6...

– Keep in mind that there will be more statements than what I included above.

Step 5 – Install Ruby For Apache (#4 of “Things you will need”)

– I installed Ruby for Apache in my D:\wamp\ruby\RubyForApache subdirectory
– Locate your Apache server directory, in my case, its D:\wamp\Apache2 (keep in mind that the application for whatever reason tries to append “RubyForApache” to the path. Simply make the path “D:\wamp\Apache2” (or where your root Apache directory is located))

< for my version of WAMP, the apache folder is under c:\wamp\bin\apache\…>

– Next, locate your root ruby directory, which is D:\wamp\ruby for me. Again, remove the “RubyForApache” from the “D:wamp\ruby” path (see above).
– Finally, for the Installation Options, uncheck all options but “mod_fastcgi”
– Note: The application may alert you that it cannot open c:\xppro\system32\msvcp71.dll. Just rename it and retry. As I’m writing this documentation, I didn’t have an issue, but had noticed it on a previous install.

<had the same issue with msvcp71.dll, rename it and installer should run fine>

Step 6 – Setup Apache

– After the Ruby For Apache is installed, you will notice ‘mod_fastcgi.so’ in your D:\wamp\Apache2\modules folder
– Next, move to D:\wamp\Apache2\config directory and open ‘httpd.conf’
– After the LoadModules section, append the following code:


LoadModule fastcgi_module modules/mod_fastcgi.so
<this did not work with my version of Apache, someone on the thread found a new DLL to use.  Google FCGI and download mod_fastcgi-2.4.6-AP22.dll and put it in a <DIR>>
<IfModule>
FastCgiConfig -maxClassProcesses 10 -maxProcesses 10 -minProcesses 1 -processSlack 1 \
-initial-env PATH="d:/wamp/ruby/bin;c:/windows/system32;c:/windows;d:/wamp/mysql/bin/"  \
-initial-env RUBYOPT=rubygems
AddHandler fastcgi-script .fcgi .fpl
</IfModule>

<here is my code in my httpd.conf

LoadModule fastcgi_module “c:/wamp/bin/apache/apache2.2.8/fastcgi/mod_fastcgi-2.4.6-AP22.dll”

<IfModule fastcgi_module>
FastCgiConfig -maxClassProcesses 10 -maxProcesses 10 -minProcesses 1 -processSlack 1 \
-initial-env PATH=”c:/wamp/ruby/bin;c:/windows/system32;c:/windows;c:/wamp/bin/mysql/mysql5.0.51b/bin/”  \
-initial-env RUBYOPT=rubygems
AddHandler fastcgi-script .fcgi .fpl
</IfModule>

>

Step 7 – Install your first Rails App

– If you have a “work” directory for Ruby projects, change to that directory. Open a DOS prompt window, and enter the following commands:


> D:
> cd D:\wamp\www\projects\RUBY
> rails test

– This creates your first rails application in D:/wamp/www/projects/RUBY/test
– Note: your “projects\RUBY\” directory may differ. Simply substitute your path as needed.

Step 8 – Modify your “test” install’s “public/.htaccess” file

– Navigate to your D:\wamp\www\projects\test\public\ folder and open the .htaccess file
– Look for:

<if you don't have a .htaccess, i stole one from the README file in the apache dir and made the necessary hacks

# General Apache options
#AddHandler fastcgi-script .fcgi
#AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI

# If you don’t want Rails to look in certain directories,
# use the following rewrite rules so that Apache won’t rewrite certain requests
#
# Example:
#   RewriteCond %{REQUEST_URI} ^/notrails.*
#   RewriteRule .* – [L]

# Redirect all requests not available on the filesystem to Rails
# By default the cgi dispatcher is used which is very slow
#
# For better performance replace the dispatcher with the fastcgi one
#
# Example:
#   RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
RewriteEngine On

# If your Rails application is accessed via an Alias directive,
# then you MUST also set the RewriteBase in this htaccess file.
#
# Example:
#   Alias /myrailsapp /path/to/myrailsapp/public
#   RewriteBase /myrailsapp

RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

# In case Rails experiences terminal errors
# Instead of displaying this message you can supply a file here which will be rendered instead
#
# Example:
#   ErrorDocument 500 /500.html

ErrorDocument 500 “<h2>Application error</h2>Rails application failed to start properly”

>

<REMEMBER, you need to allow override in your httpd.conf file!!!  The default setting for AllowOverride.  Default is “AllowOverride None”, i set it to “AllowOverride All”.  I am still playing around with Apache, so i need to look into what is the best parameter to set, but “All” works.>

# General Apache options
AddHandler fastcgi-script .fcgi
AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI

– And change to:


# General Apache options
# AddHandler fastcgi-script .fcgi
# AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI

– We do this because we’ve already defined the handlers in step 6.
– Next, look for:


RewriteRule ^(.*)$ dispatch.cgi [QSA,L]

– And change to (change .cgi extension to .fcgi):


RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

– Save and close the file

Step 9 – You are almost done. One last change to the “public/dispatch.fcgi” file

– Navigate to your D:\wamp\www\projects\test\public\ folder and open the dispatch.fcgi file
– Change the #! (shebang – line #1) at the top of the file to reflect the path to the Ruby interpreter (where its located on your system). I had to change mine to:


#!D:/wamp/ruby/bin/ruby

– Note: Your path may differ. If you don’t remember the ruby intepreter’s path, refer to Step 2.
– Save and close the file

….

Enjoy!!!



Papervision3D
October 2, 2008, 9:08 am
Filed under: Uncategorized | Tags: ,

After messing around with away3D, i am second guessing how suitable it is.  It appears to me that away3D is really meant for 3D flash games.  So, I have decided to try out Papervision3D.  There are many existing websites that use this technology.

Here is the blog for developers : Link

I have seen some amazing sites with pv3d. I’m excited.



What I Like and Dislike about Adapt.tv
September 24, 2008, 11:23 pm
Filed under: Uncategorized | Tags: , , ,

Adapt.tv is an ad-network that focuses primarily on online videoes.  It made news a few days ago by securing additional funding.  The addition of interactive advertisement over flash videos is interesting and is something i’m looking into myself.

Here is what i think is good with the concept
– interactive ads.. a slight improvement over the old ads on the side or pop up while the video is playing
– advertisers can pick the ad type (pre-roll, mid-roll, panels, text..)
– established relationships with video publishers such as metacafe
– has an algo that automatically chooses which ads to insert. The algo looks at speech, facial and text recognition.
– “The core behind it is a learning system which is fed data from contextual matching as well as inputs from user interaction with ads. Over time, this produces an optimized ad campaign for video-content providers, addressing a validated market need.” So, ads that are more ‘effective’ will be shown more for that particular video and ads with little response will be removed. Hence the name, adapt tv.
– video ads over viral content is good branding
– works with other ad serving platforms like DART (double click), Atlas (microsoft) and OAS

Here is what I think is going to be problematic
– the ads are still display like. Just moving text/reg. ads from the outside the video to in video.
– why limit their ad platform to just videos, are videos THAT special
– low click rate? Why would people click while watching a video? Missing incentives? With low click rate, the revenue is probably going to come from charging for impression, with no clear ROI
– direct advertisement vs. advertisement over an ad network, the CPM is low with ads over a network. Is there such a thing as direct advertisement for mass on line video content? Hulu is a publisher that works with advertisers/marketers directly.
– how hard is it for existing ad networks to move into video or work with video publishers?
– Is it as good as a search ad, where the users actually are set to find what they want? Would people want what they see on video? Need to focus on verticals that are successful, like video games/travel.



Starting to see the problem with Flex Widgets….
September 18, 2008, 5:58 pm
Filed under: Uncategorized | Tags: , , , , , ,

I have been looking into flash and flex for a few months now.  I am really impressed with how fast i can assemble application or a widget with the framework and CS3.  It is super fast and easy.  But there are no free lunches, so what’s the cost?

Aside from the cost of the software, there are more detrimental set backs.  The one i’m referring to is the size.  For lucky broadband users, they might not notice the increase in sizes of webpages.  But with, so many dial up users (close to 50%), developers should really take size into consideration.

Flex is a Fatty.  There is no nice way of putting it.  There are a few tricks to eliminate some of the excess baggage though.  Using modules and caching are the key ones that I will look into.

Modules
Modules, modules, modules. Load them only when needed, instead of having one gigantic file. Use the module loader tools available. Link here

Caching
Caching uses cached and signed libraries (RSL, runtime shared library) in the client’s flash player to greatly reduce the size of the app. The main library to note is the flex framework. An empty flex application is 140kB of data. The average flash ads you see is around 30kB. By using the flash player’s cache, you can really save plenty. This is a great move by Adobe. It sure did a solid for developers. There are a few problems with this solution
1) only later flash players will support this, v 9.0.115 or later.
2) http connections are needed to access the files.

Link Here. Here is a tutorial

I don’t want to be serving flash ads that are 350kB in size. Publishers don’t want to have a loading window and waste valuable ad viewing time. Users with dial up won’t wait 7+ secs to view an ad. Trouble. I guess the only solution (where i’m in control) is to test for clients’ connection speed to determine what to load and to test for flash player version. Or maybe migrating parts of the flex framework to flash? That would really kill the simplicity value of flex.

Aside, here is a great site that analyzes your website, break it down, and tells you how much dial up users suffer. Link.



Away3D Rocks!
September 17, 2008, 9:44 pm
Filed under: Uncategorized | Tags: , , ,

Found a terrific Flash 3D engine.  Tried a few of their demos and check out bits of code.  Very nice.  Now I need to find a way to hack this into Flex.  Fun!

Away3D’s Link



Enterprising Web 2.0
September 11, 2008, 9:33 pm
Filed under: Uncategorized | Tags: , , , , ,

Adapting a successful idea to a new market is a no brainer business plan.  It happens everywhere.  International franchises,  tv shows, car designs, movies… but more interestingly, there seem to be a trend to migrate successful Web 2.0 ideas into the office.

The winner of TC50 (52 now?  Or more like 51.5 (Kutcher’s counts as half a start up. I shouldn’t get myself started!)) Yammer, is one of those ‘Enterprise Web 2.0 Startups’ that seem to have a great business model.  It is basically Twitter-E, so this article from Techcrunch claims Link. Other major Web 2.0 ideas that got displaced into the corporate world is social networking (Igloo), fancy emails, fancy calendars/expense systems, and blogs.

Enterprise Web 2.0 startups bones investors because it fits the “move a successful business into a new market” outfit. A part of this excitement stems from the stigma that enterprises are cash cows. But i think Web 2.0 maybe too much for enterprises to accept.

Web 2.0 is not just about connection, it is also about expression. The 100 million or so people on Facebook do want to connect with friends and classmates, but i think more importantly, they want to express themselves and be the extroverts they aren’t in real life. Same goes for Twitter users. But in the corporate world, connectivity is key, expression is almost discouraged. Minus personal rants, I guarantee Twitter won’t have the server problem it has today. Guaranteed. I wouldn’t disagree that Twitter-E will increase office connectivity, but without expression, it won’t be a smash hit as Twitter.



Apple’s Steve Jobs = Mr. Garrison + Mr. Burns
September 11, 2008, 7:09 am
Filed under: Uncategorized | Tags: , , , , , , ,

I am distracted right now.  Looking through some Adobe Flex documentation.  Flex 3 Builder on Linux is great but it doesn’t have a data wizard.  I wonder if it is possible to do without it?  Back to the important stuff.

Mr. Jobs, factually, does not look too healthy.  I know everyone (investors alike) is taking a shot at him and his health is his business.  But as a kid growing up in the 90s, The Simpsons and South Park warped my mind.

Steve Jobs

Mr. Garrison

Mr. Burns

Come on.  It can’t be just me.  To further prove my point, I wasted more time and photoshopped.

Mr. Garrison-Burns, a.k.a Mr. Jobs

Wow, i wasted an hour :(.  Steve, if you stumbled upon this picture somewhere, i apologize for my warpness.  The crazy pop culture your company feeds on is solely responsible.   On a more serious note, get healthier so the future iPhones won’t suck.  🙂



Google’s Scary Vision
September 10, 2008, 10:46 pm
Filed under: Uncategorized | Tags: , , , ,

Here is a bit from an article on TechCrunch Link

So what’s our straightforward definition of the ideal search engine? Your best friend with instant access to all the world’s facts and a photographic memory of everything you’ve seen and know. That search engine could tailor answers to you based on your preferences, your existing knowledge and the best available information; it could ask for clarification and present the answers in whatever setting or media worked best. That ideal search engine could have easily and elegantly quenched my withdrawal and fueled my addiction on Saturday. I’m very proud that Google in its first 10 years has changed expectations around information and how quickly and easily it should be able to be retrieved. But I’m even more excited about what Google search can achieve in the future.

A quote from Marissa Mayer. “The photographic memory of everything i’ve seen and know” is very disturbing. With
1 ) g-mail – they know what i’m doing, what i did, who my friends are.
2 ) chrome – they know what i do on the internet
3 ) Jaiku – they know where i will be, where i’m going, where i went.
4 ) picasa – they know where I went and where I’m interested in going for travel
5 ) google docs – they know when and how i work
6 ) search – they know what I want
7 ) android -they know where i will be at all times
8 ) gears…. – they have access to my computer.

the picture gets even scarier. Doesn’t Google claim anonymity when it collects data? Doesn’t this vision contradict that? One of Google’s philosophy is “You can make money without doing evil”. A loop hole in that claim is who gets to decide what is evil?



Setting up Heritrix (ver. 1.14.1) src with Maven (ver. 1.0.2) on Ubuntu Hardy Heron
September 10, 2008, 5:40 am
Filed under: Uncategorized | Tags: , , , , , , , ,

I’m going to keep a log of how I set up Heritrix on Linux… in case I need to do it again.

Ingredients:
1) Heritrix (ver. 1.14.1)
2) Maven (ver. 1.0.2) from Link to Maven Archives
3) JDK (version 1.5, Maven 1.0.2 requirement) from synaptic, search for sun-java5-jdk.
4) subversion (ver. 1.4.6 was used but i think any would work, pretty stable stuff)

Instructions:
Getting Maven Ready
1) Get the correct version of Maven. Don’t get the latest because this version of Heritrix is a Maven 1.x project (Again, latest is not the greatest here :))
2) tar zxvf .. ... ... tar.gz
to unzip and install Maven.
3)Set up JAVA_HOME environment variable, by
export JAVA_HOME=/usr/lib/jvm/java, blah blah (your directory may differ)
4)Set up MAVEN_HOME environment variable, by
export MAVEN_HOME=/your/maven/home
5)Set up PATH to point to grab maven binary
export PATH=$PATH:$MAVEN_HOME/bin

6)Check to see if you have maven set by
maven -v

This is what I get…
__ __
| \/ |__ _Apache__ ___
| |\/| / _` \ V / -_) ‘ \ ~ intelligent projects ~
|_| |_\__,_|\_/\___|_||_| v. 1.0.2

(Sry Maven folks, WordPress murdered your ascii picture :(!).

Getting Heritrix and First Build!
1) Need to use subversion to checkout the latest code.
svn co https://archive-crawler.svn.sourceforge.net/svnroot/archive-crawler/branches/heritrix_1_4_0/heritrix/
2) If you try to build Heritrix now, you will get errors. This is because it won’t be able to fetch important files from maven. Need to update the project.properties file to reflect this change. Add the following lines…
maven.repo.remote=http://repository.atlassian.com,http://mirrors.ibiblio.org/pub/mirrors/maven,http://www.ibiblio.org/maven
3) If you try to build Heritrix now, it will go a bit further, but it will fail some tests involving a maven plugin, sdocbook. According to the manual, it is optional because it is only used if you want to write documentation. However, for some reason, some tests required it. For completions sake, i got the plug-in.
Grab it from the following link: Version 1.4.1 and then tar zxvf it. Then move the jar file to the $MAVEN_HOME/plugins directory. Now, of course, there is some OTHER dependencies. You need to grab a jimi.jar file for the plugin to work.
Grab it here. Unzip it then move a file from it (called JimiProClasses.zip) into the repository directory for maven in your root folder and rename the file jimi-1.0.jar. The repository directory that contains this jar file should be /.maven/repository/jimi/jars.
4) Now build and test Heritrix by doing a
maven dist.

Da Da! Never a walk in the park with open-source SW.

Useful References:
1)Heritrix’s (well written) Developers’ Manual
2)Maven 1 repository move



Heritrix – Web Crawler
September 9, 2008, 9:54 pm
Filed under: Uncategorized | Tags: ,

Looking into Heritrix. Judging by its documentation, it seems like a well thought out open source web crawler. Going to need some time to write processors and filters. :(.

Link