SuperGenPass patched for Google Chrome
I am a huge fan of SuperGenPass. There are so many obvious reasons why it’s a great concept that I won’t bore you with a rehash of all of them.
Unfortunately, in Google Chrome, SuperGenPass chokes on some pages. I do not blame Chrome for that: it’s for security reasons.
I’ve patched the basic version of SuperGenPass so that it can now work on those pages. I am not sure that it fixes everything for everybody but I hope it makes your life easier, like it does mine.
Just go to this page and get the patched bookmark.
If you are using a customized bookmark, I am afraid that you will have to patch it yourself. Here is what the patch looks like:
Look for
var%20FrameTest=window.frames[i].src; |
Replace with
var%20FrameTest=window.frames[i].src;var%20FrameTest=window.frames[i].src;FrameTest=window.frames[i].document.forms; |
Done!
If you enjoyed this post, make sure you subscribe to my RSS feed!
Magic: Ruby 1.8.5 + 1.9.1/Rails/Sinatra and Lighttpd
Ladies and gentlemen, gather ’round! The Great Panini is going to perform an incredible illusion before your very eyes! You will tell your grandchildren of this day and they will not believe you! Take pictures!
The Great Panini will start with a pre-steam machines era CentOS 4 server. He will install two versions of Ruby and they will coexist peacefully! He will then use the blazing fast Lighttpd server to proxy queries to various Ruby frameworks and he will even make it look easy!
Hrm…Sorry.
I am going to tell you how I quickly updated a couple servers with Ruby 1.9.1 and Lighttpd. And it will look easy because it is, in fact, easy.
This article’s aim is to be practical but I will explain as we go along.
The first thing I did was update CentOS to a more recent version. This could take a while but it’s always a good idea to keep a server software up-to-date so I’m sure that your already are almost there:
yum update |
In my case, after a couple hours (oops), the update was complete and I rebooted the servers.
Ruby 1.8.5
That’s the easy part because it’s the version of Ruby that currently comes with CentOS. Therefore you can install it using yum:
yum install ruby ruby-devel ruby-irb ruby-rdoc ruby-ri |
Ruby 1.9.1
Download the package from ruby-lang.org:
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p0.tar.bz2 tar zxvf ruby-1.9.1-p0.tar.bz2 cd ruby-1.9.1-p0 |
The trick, here, is to give all 1.9.1 binaries a different name. Fortunately, configure offers an option for that:
./configure --program-suffix=19 |
Build and install:
make && make install |
Rubygems
Get rubygems from Rubyforge:
wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz tar zxvf rubygems-1.3.5.tgz cd rubygems-1.3.5 |
Note that we are now using our brand new 1.9.1 binaries:
ruby19 setup.rb |
Now, make sure your gems are up to date:
gem19 update |
Let’s see. We want to use two frameworks: Rails and Sinatra. Installing them could not be simpler:
gem19 install rails gem19 install sinatra |
We will use thin to run our programs:
gem19 install thin |
Let’s make sure that thin is run when the server boots up:
thin install |
This will create /etc/init.d/thin which we can then link to the appropriate runlevels using chkconfig
We will, when creating Ruby applications, tell thin about the instances it needs to run. This will be done by adding yml files to /etc/thin/
I am going, in this article, to create these applications in /home/yourdirectory/. Of course, use your own directory.
Rails
Let’s create a Rails application:
rails myrailsapp |
In the application’s config/ directory, let’s create our thin yml file (thin_myrailsapp.yml)
chdir: /home/yourdirectory/myrailsapp address: 127.0.0.1 port: 3000 servers: 4 max_conns: 1024 timeout: 30 max_persistent_conns: 512 user: www group: www environment: development pid: tmp/pids/thin.pid log: log/thin.log daemonize: true |
chdir tells thin where our document root is located. Rails serves documents from document root/public/
address is localhost because that’s what will be used when proxying through Lighttpd
servers is ‘4′ which means that four servers will be instantiated, starting at
User and group: I am using the same user and group that Lighttpd runs as for simplicity sake.
Let’s tell Lighttpd about this new application. Edit /etc/lighttpd/lighttpd.conf, or wherever your configuration file is:
$HTTP["host"] =~ "myrailsapp\.yourdomain\.com$" {
$HTTP["url"] =~ "^/((images|javascripts|stylesheets)/(.*)$)" {
server.document-root = /home/yourdirectory/myrailsapp/public"
}
proxy.balance = "fair"
proxy.server = ("" =>
(
( "host" => "127.0.0.1", "port" => 3000 )
)
)
} |
I am using the “fair” load balancer because, as the default option, it tries to be…fair, obviously, and isn’t too greedy: it does not compute a hash for each url.
Let’s now tell thin about this application by simply creating a symbolic link in /etc/thin/:
ln -s /home/yourdirectory/myrailsapp/config/thin_myrailsapp.yml /etc/thin/ |
Restart Lighttpd and start thin:
/etc/init.d/lighttpd restart && /etc/init.d/thin start |
I know…supposedly I should be able to simply type ‘lighttpd reload’ and it will reload its configuration files but that does not always seem to work.
Now, the fun stuff:
Go to http://myrailsapp.yourdomain.com:3000 and you should be greeted by Rail’s welcome page.
Now, go to http://myrailsapp.yourdomain.com and you should see the same page, except this time it was proxyied by Lighttpd.
Sinatra
Create your application; e.g. the ubiquitous “hi” application. Again in /home/yourdirectory/mysinatraapp, create hi.rb:
require 'rubygems' require 'sinatra' get '/' do 'Hello world! I love kittens.' end |
Create a config/ subdirectory:
mkdir config && cd config |
In the config/ directory, let’s create our thin yml file (thin_mysinatraapp.yml)
rackup: /home/yourdirectory/mysinatraapp/config/mysinatraapp.ru chdir: /home/yourdirectory/mysinatraapp address: 127.0.0.1 port: 4567 servers: 4 max_conns: 1024 timeout: 30 max_persistent_conns: 512 user: www group: www environment: development pid: /home/yourdirectory/mysinatraapp/thin.pid log: /home/yourdirectory/mysinatraapp/thin.log daemonize: true |
Starting at port 4567 because, by convention, it’s Sinatra’s default port when started standalone.
Notice the main difference? Sinatra will rely on rack for its setup, hence the ‘rackup‘ keyword.
Let’s create that rack file (mysinatraapp.ru)
require 'sinatra' Sinatra::Application.default_options.merge!( :run => false, :env => :development ) require 'hi.rb' run Sinatra.application |
Do not forget Lighttpd:
$HTTP["host"] =~ "mysinatraapp\.yourdomain\.com$" {
proxy.balance = "fair"
proxy.server = ("" =>
(
( "host" => "127.0.0.1", "port" => 4567 )
# room for more instances
)
)
} |
Of course, if you know that some directories will be dedicated to static content you can also check for these directory names and have Lighttpd serve them statically, as shown in myrailsapp’s example.
Restart Lighttpd and thin:
/etc/init.d/lighttpd restart && killall -HUP thin |
Test it:
Go to http://mysinatraapp.yourdomain.com:4567 and you should see the message returned by hi.rb.
Now, go to http://mysinatraapp.yourdomain.com and you should see the same page, except, again. it was proxyied by Lighttpd.
Conclusion
As I wrote earlier, this is easy and actually fairly straightforward. It some of this is not working for you, it is likely because I glossed over something I really shoudln’t have. Post a comment and describe your issue and I will gladly help.
If you enjoyed this post, make sure you subscribe to my RSS feed!
Zii’s “stemcell computing”: misleading name, good tech?
It is interesting that on the heels of IBM’s announcement that the Cell family is a dead-end, I get to learn of Zii’s offering — based on their allegedly violating the GPL.
It’s all the more interesting that it seems that the trend, lately, has been to focus more on GPUs:
since GPUs have evolved to provide such built-in power, why not reuse them for more than just graphics?
Zii, on the other hand, claim that their “stemcell computing” platform, unlike Cell or GPUs, is wholly general-purpose.
Wait. What GPL thing?
Well, Zii is currently marketing to developers a solution called the “Zii Egg”. It’s an iPhone-like device, based on their processors, that can run either Android or their own, Linux-based, Plaszma platform.
Turns out, they are currently withholding root information, thus not allowing developers to patch the OS, thus, it is claimed, violating the GPL.
With this out of the way…
Is Stemcell Computing(™) a revolution?
I will boldly say “NO”. But I’m not saying it’s not an interesting technical challenge either.
For starters, their platform doesn’t have much to do with stem cells. Sure, the name got my attention. But there is nothing biological about it. In fact, it’s quite the marketing stretch: take a non-specialized set of chips. Can we program them to do something? If so, then it’s just like stem cells! Er…right.
So, what is it?
If only their intro video wasn’t so “Ha-ha big computers are for nerds. They are BIG. Look! Shiny object!” I’m sure their nerd karma would explode.
But, no. Instead it’s marketing talk all the way. That could be fine, except they are marketing their product to developers, not the general public.
Also, from the specs I was able to gather, what we are talking about here is a couple ARM cores and processing elements on a die.
You know what immediately comes to mind? FPGAs.
It really sounds like a coarse-grained (node-based) FPGA.
Nowadays, you can buy FPGAs that come with their own processors, either built into the fabric on the side, or even meshed within the FPGA itself.
The only thing that still confuses me is how they can be, as they claim, “configured thousands of times a second”: typically, when reconfiguring an FPGA, you need to download the new code to SRAM. Of course, here we are likely talking about SOC (System On a Chip) reconfiguration: there is no external interface.
And this is where is gets hairy:
- Do you always reconfigure through a JTAG port? Or did Zii come up with a faster alternative?
- Do you reconfigure the whole FPGA or only regions?
- If so, do you place the FPGA in configuration mode then switch back to user mode? Or does the chip have only one mode?
- And if so, are write operations synchronous and reads asynchronous? How do you manage the software and electrical issues?
I hope that, in time, we will learn more about the technology behind “Stemcell computing”.
I may be way off base but it seems to me that, even though we are not talking about a revolution, it sure sounds like a very intriguing evolution.
If you enjoyed this post, make sure you subscribe to my RSS feed!
MacHeist 4!
It’s coming, with its usual mix of junk-no-one-cares-about and awesome applications you had no idea you needed and at-this-price-it’s-a-steal!
Not to mention the join of scoring the mission-related apps, regardless of how — usually — good they are.
Avid MacHeist fans alonzo and imfrog2002 have even created two countdown widgets to the official launch:
Note: Do not forget to backup your MacHeist 3 Loot! Soon, it should disappear from the website.
Edit: Hmmm I just did so myself and it took me quite a while. Turns out, the balance mediocre apps vs awesome apps is largely in favour of the latter!
If you enjoyed this post, make sure you subscribe to my RSS feed!
Help Blog Editors Reliably Discover Your API
It seems that tons of people have the same complaint: the Wordpress application for iPhone does not discover their blog and, therefore, is of no use to them.
The same goes for many desktop-based applications.
I, too, spent quite a lot of time trying to figure that one out but now that I have succeeded, here is how I would recommend working on this issue if your blog is affected:
- Go to your blog home page and select “View source”
- Look for <link ref=”EditURI”… you will see that this line contains a URL ending with xmlrpc.php?rsd. Point your browser to that URL. A rather empty page should be displayed. Check its source; if it is XML, it’s all good.
- If the previous step fails, go to the same URL but without ?rsd. If this fails too, you need to check that you have a file called xmlrpc.php and that: a. No rewrite rule messes up your URL; b. No plugin renders it invisible — e.g. “private”
- If both steps work well, it is VERY likely that the blog editor you are using — or trying to use, more accurately — is choking on malformed XHTML code. It is what seems to mystify most of us.
To convince your blog editor to “discover” your blog, we are going to give it a nicely formed XHTML page:
First, make a copy of index.php: cp index.php index.o.php
Now, create a new index.php page with this code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head profile="http://gmpg.org/xfn/11"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="generator" content="WordPress abc" /> <!-- leave this for stats --> <link rel="pingback" href="http://nexus.zteo.com/xmlrpc.php" /> <link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://nexus.zteo.com/xmlrpc.php?rsd" /> <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://nexus.zteo.com/wp-includes/wlwmanifest.xml" /> <link rel='index' href='http://nexus.zteo.com' /> <head> <body> </body> </html> |
Of course, you need to replace all instances of nexus.zteo.com with your own blog’s information; for instance myblog.mydomain.com
Discover your blog using your favourite blog editor.
Restore your index.php: cp index.o.php index.php
Done!
If you enjoyed this post, make sure you subscribe to my RSS feed!
ClicDev: display last 24 hours visitors
A quick note about Clic!Dev: it is now possible, in the admin control panel, to select Setup Hacks > enable 24 hour users to add an extra information dialog to the footer of your hosted board’s main page. This will end up looking like so (but obviously adapted to whatever skins you are using):

If you enjoyed this post, make sure you subscribe to my RSS feed!
S2ajax v1.0 connects simply PHP and JavaScript
Here comes S2ajax v1.0!
And it was long overdue. Six months already since I posted S2ajax says “hi()” I can hardly believe it.
What I think of as v1.0’s main feature is that it is now possible to simply export classes in PHP and these classes can be instantiated in JavaScript. Whenever these instances are modified through asynchronous method calls, these modifications are transparently persisted server-side.
The concept
Is it a PHP class? Is it a JavaScript class? Why, it’s both! The class is defined in PHP on the server. Instances of the class are created on demand using JavaScript on the client. Whatever modifications are made to an instance are serialized on the server.
You can create a complex application using as many classes and instances as you need.

Under the hood
The PHP class is exported; the proxy JavaScript code is generated.
Whenever the client needs to access one of the class’ properties/methods, the proxy transparently talks to the class; the class lives server-side.

The Client’s point of view
An arbitrary number of instances of the class can be created in JavaScript.
The only hint that you are using a client-server architecture is the fact that when invoking a method, its return value is obtained through a callback. This mechanism allows your client interface to remain responsive while the server is preparing a response.

The server’s point of view
S2ajax automatically persists your instances’ state and data between consecutive asynchronous calls. You still get the benefits of the “shared nothing” approach of PHP but complex objects can be manipulated through an unlimited number of clients requests.

A code sample
Server-side
Let’s create a class that will increment an instance variable every time a method is invoked. Let’s keep it as simple as possible:
class CounterTester { private $counter; function __construct() { $this->counter = 0; } public function increment_counter() { $this->counter++; return $this->counter; } } |
Clearly, every time increment_counter() is invoked, $counter will be incremented and its new value returned.
Client-Side
First, an instance of our class is created. Then, when a user click on the button labeled ‘Increment counter’, the instance’s increment_counter() method will be invoked and the new $counter value returned to our callback and displayed.
<script> function display_result(val) { alert(val); // Display new counter value } var counter = new CounterTester(); </script> <button onclick="counter.increment_counter(display_result);">Increment counter</button> |
Note that we could create as many instances of our class as we wish and provided we display the matching buttons, we could independently increment multiple counters.
Get it now!
Click our valiant friend “Octocat”, artistically represented below, to go to S2ajax’s Github page. If you just wish to use the library, look for the [Download] button:
If you enjoyed this post, make sure you subscribe to my RSS feed!
PHP PDO class and XAMPP/”exotic” MySQL configurations
Last night I was trying to setup a @mail server but the installer kept choking when attempting to connect to my local database.
I am posting here my quick workaround in case you too, dear reader, get a dreaded “PDO” error message complaining about your attempt to “connect to unix://”
Here is I how I solved the issue for @mail: I opened library/Zend/Db/Adapter/Pdo/Abstract.php, found the line that creates the PDO object (”new PDO(…“) and, in this example, the first argument passed to the constructor was $dsn.
The problem is that PDO sees that this variables references “localhost” and decides that, since the database is local, it is going to use mysql.sock (hence the unix:// scheme)
This works as long as the file is found in its default location. If it is elsewhere, you are out of luck. This happens, for instance, if you use XAMPP.
Here is my quick fix, inserted right before the creation of the PDO object:
$dsn = str_replace(’host=localhost’, ‘unix_socket=/opt/lampp/var/mysql/mysql.sock’, $dsn);
All done.
Note: I have not investigated enough to know whether this is something missing in the Zend Framework or in @mail itself.
If you enjoyed this post, make sure you subscribe to my RSS feed!
Add your Google App account to Thunderbird 3 beta 4

Beta 4 is out and it is *very* sweet. It even offers Gmail integration like never before.
Well, if you have a @gmail.com account, that is.
But don’t worry! If you have a Google App account, it can be made to work with little extra work. Here is how:
1. You need a standard @gmail.com account. Create a bogus one if necessary.
2. You will not want to do anything with this account. Not really. Thus, in Thunderbird, go offline: File > Offline > Work Offline.
3. Select File > New > Mail Account…
4. Enter the information for your @gmail.com account. Thunderbird will recognize the address and automatically fill out the following box with the correct GMail information: imap.googlemail.com, etc. Green dots all around! Just click [Create Account]
5. Now, in the left-hand tree, right-click on your account name and select ‘Settings…‘
6. Change your account name to something meaningful, then click [OK] — If you do not do this and exit the dialog, the other screens will not be updated correctly.
7. Re-open the dialog, select ‘Server Settings‘ and enter your Google App email account where your @gmail.com account is currently displayed.
8. Select ‘Outgoing Server (SMTP)‘, then ‘Google Mail – smtp.googlemail.com‘ and click [Set Default]
9. Click [OK], leave offline mode, restart Thunderbird to be on the safe side.
10. All set! Thunderbird will start synchronizing with your Google App account using these optimum settings.
If you enjoyed this post, make sure you subscribe to my RSS feed!
Job opportunities v competencies: focus on these?
oDesk, the freelancer haven, did — yet another — good thing and published this awesome table. It’s a “fill ratio” table that show the imbalance between job offers and how much success the companies are having filling them in.
It is very interesting because it is, in my opinion, an indicator of where one should focus their training effort in the current rather depressed market.
| Skill | Average # Jobs Per Month | Fill Ratio |
| iPhone | 93 | 23.96% |
| AJAX | 315 | 27.07% |
| Java | 75 | 27.65% |
| Graphics | 106 | 29.13% |
| XHTML | 163 | 29.31% |
| SQL | 112 | 29.89% |
| XML | 111 | 30.28% |
| PHP/IIS/MS SQL | 114 | 30.31% |
| JavaScript | 339 | 30.90% |
| SEO | 201 | 30.97% |
| MySQL | 658 | 31.65% |
| PHP | 731 | 33.84% |
| English | 109 | 34.99% |
| Flash | 257 | 35.86% |
| Writer | 101 | 36.36% |
| Joomla | 236 | 37.11% |
| Drupal | 117 | 37.75% |
| Data Entry | 120 | 37.95% |
| html | 237 | 38.16% |
| WordPress | 197 | 39.36% |
| Photoshop | 285 | 39.61% |
| CSS | 150 | 42.71% |
| Excel | 106 | 48.31% |
If you enjoyed this post, make sure you subscribe to my RSS feed!










