Archive for November, 2009
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!








