Category: languages
SuperGenPass patched for Google Chrome
2460905893_0c3fc213c5

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 [...]

By Chris with 0 comments
Magic: Ruby 1.8.5 + 1.9.1/Rails/Sinatra and Lighttpd
3169705160_9db19161f0

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! [...]

By Chris with 3 comments
S2ajax v1.0 connects simply PHP and JavaScript
S2ajax2

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, [...]

By Chris with 2 comments
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: [...]

By Chris with 0 comments
Determining if an IP is within a specific range: redux

I was reading Paul Gregg’s very clear explanation of “classless” ranges comparison when I realized that his code was not as “bare metal” as could be. So, here is the code I’ve been using in nextBBS. It only accepts ranges in the form “x.x.x.x/b” but it’s short and all I needed, really. ?View Code PHPfunction isSubnet($subnet, $ip) { // Classless [...]

By Chris with 0 comments
One-line variables swap in PHP, Ruby, Perl, Python and C
12944421_8795d22d42

Today’s fun and games: let’s swap a few variables without using more variables than necessary. Let me know if you disagree with any of this… ?View Code PHP$a = 1; $b = 2; list($a, $b) = array($b, $a); print "a=$a, b=$b\n"; ?View Code RUBYa = 1 b = 2 a, b = b, a puts "a=#{a}, b=#{b}\n" ?View Code PERLmy [...]

By Chris with 9 comments
Bespin in Titanium: From The Jaws Of Victory…

bespin is really an intriguing project. Since I’ve grown frustrated with the inconsistencies between the various code editors that I have been using — I work on Leopard at home and Ubuntu at work — I thought that creating my own editor would be the answer to that. Nothing fancy, mind you. Just something consistent. My first impulse was to [...]

By Chris with 0 comments
PHP classes and Javascript: S2ajax says “hi()”

Sajax is a ‘managed’ AJAX framework that was created by the fine folks at Modern Method a few years ago. What’s so great about it is the seamless communication between your back-end and the web page itself: you write your PHP code, tell Sajax which functions to export and they are now accessible from Javascript. For instance — from the [...]

By Chris with 7 comments
Naive Mouse Gestures Implementation in ActionScript (Twitterified)

In the Twitterified Client, users can quickly perform some operations using mouse gestures. When I implemented this, I googled for ActionScript mouse gesture classes but only found one and it was a commercial package. I am sure that there are many ways to implement gestures, using rule engines, neural networks, etc. But, curious and optimistic as usual, I decided to [...]

By Chris with 0 comments
ExtPHP now on Github

About 10 months ago, I released this tool, allowing developers to handle ExtJS like “managed” code in PHP: ExtPHP. Shortly thereafter, Jack Slocum changed ExtJS’ licensing model and it all became very muddy but my main question was: “As a commercial user, what would the status of the extensions be?” It seems that it’s OK to create an extension and [...]

By Chris with 2 comments
data recovery