Week 10 in review

Week 10 in reviewWell, it’s time to sum up the week. Since this is my first sum-o-the-week, I really have no point of reference as to what to write here. I know, I know, today’s Monday and shouldn’t the week be summed up late Sunday? Well. Yes. But hear me out anyway. Please. I need my ego stroked and caressed.

My basis for analysis is my very own Twitter feed, so, yes, it’s biased as hell. Deal with it.


March 8

- PHPillow – OO wrapper for CouchDB http://bit.ly/cy5pix
The week started off quite slowly, to be honest, with PHPPillow. First a small introduction to CouchDB. What is CouchDB? In short, it’s a document database server built on Erlang which is accessible through a RESTful JSON API. Free form schema with a flat address space. The sweet part is that features a table oriented reporting engine that uses, get this, JavaScript as a query language. Did I mention it’s indexable? Please note, though, that it’s really not a replacement for a RDMS. Now, CouchDB employs what they call documents. A CouchDB document is an object that is basically constituted of named fields, which can be strings, numbers, dates or even associative maps or lists. If you’ve dabbled with anything that recebles JSON, you’ll feel right at home. A simple document may look like

"Subject": "I like Plankton"
"Author": "Rusty"
"PostedDate": "5/23/2006"
"Tags": ["plankton", "baseball", "decisions"]
"Body": "I decided today that I don't like baseball. I like plankton."


Example borrowed from here . This means that a CouchDB database is just a flat collection of documents where each document has a unique ID. How do you access these results, you may ask. As it turns out, CouchDB uses views in order to bring some sort of structure to the pseudo-structured data. Views are the way in which documents are aggregated and reported. THey are served ad hoc and don’t affect the underlying document. You may also have several views that represent the same data.

CouchDB is also a peer distributed database system, meaning that any number of hosts, i.e. servers and offline clients, can hade independent “replica copies” of the same database, where applications have full database interactivity. Any changes in the database are replicated in a bi-directional manner when the user is back online.

PHPillow proveds an object oriented wrapper for CouchDB. To connect, all you need is to instanciate it with something like

phpillowConnection::createInstance('localhost', 5984, 'user', 'password');

As soon as the connection has been established, the connection will be used in your document and view classes automagically. All documents extend the abstract base class phpillowDocument and a complete model that, say, defines a blog entry may look like the following

class myBlogDocument extends phpillowDocument
{
    protected static $type = 'blog_entry';

    protected $requiredProperties = array(
        'title',
        'text',
    );

    public function __construct()
    {
        $this->properties = array(
            'title'     => new phpillowStringValidator(),
            'text'      => new phpillowTextValidator(),
            'comments'  => new phpillowDocumentArrayValidator(
                'myBlogComments'
            ),
        );

        parent::__construct();
    }

    protected function generateId()
    {
        return $this->stringToId( $this->storage->title );
    }

    protected function getType()
    {
        return self::$type;
    }
}

Exampled borrowed from this place. This means that you can use the document in your code like so;

$doc = new myBlogDocument();
$doc->title = 'New blog post';
$doc->text  = 'Hello world.';
$doc->save();

Pretty nice, huh? Now, this is maybe not for your next Facebook scoped project, but I’m sure you’ll find a good use for it for something where a full fledged RDMS is a bit overkill. Go ahead and play with it. I dare ya.


March 9

- jQuery alternative documentation for 1.4.2. Downloadable http://bit.ly/c9AuA3

Everybody’s (well, maybe not everybody’s) favorite JavaScript library jQuery quite recently hit version 1.4.2. As with every new release of jQuery, it promises massive speed enhancements (here compared to other libraries), which makes you wonder just how awfully slow it must have been earlier. Moving on. There are already a number of decent-to-really-sweet jQuery documentations, but they mostly suffer form lack of updates. This one is brand spanking new, targetting version 1.4.2. Not only is it updated, it has a search function that actually doesn’t suck – fast and more accurate than its competition. It’s even available for download for those offline moments. Yeah, I know, you don’t have any offline moments, but bear with me here, it’s a nice feature.

- Get Twitter status via PHP and some jQuery http://bit.ly/b8zUyG

This is just a small tip that show you how to fetch a given user’s Twitter status via PHP and jQuery. Note that is uses a WordPress function called parse_feed so it isn’t al that useful if you’re not using WordPress. Weel, thankfully, there’s an example in the comments that uses file_get_contents instead. Happy days.

- How to crack RSA 1024 bit encryption by clusterf*ck http://bit.ly/c869tf

Well, this is more of a shameless self-promotion sort of link, so I’ll just link to my own article. Go on and play, now, y’hear?



March 10

I apparently decided to practice my coma skills as I did’t tweet for a whole day. I’m half the man I used to be. Which I guess would make me a quarter of a man, since, let’s face it, it was an up hill battle to begin with.


March 11

- PHP Security, some hands-on tips http://bit.ly/ddqJdj

Again a self-promotion piece of crap. There are some nice pointers there, so, yeah, check it out! It deals with validation, filtering and CSRF/XSS.

- 18 high quality fonts for your next design http://bit.ly/adGLeY

Fonts, fonts, fonts. Love ‘em or hate ‘em, you need ‘em. This is a pretty decent list of 18 quality fonts, several of which are free. It sports previews as well.

- HTML5 Web Sockets – quantum leap in scalability http://bit.ly/bwWa4c

This article actually had me quite excited. IT start off by explaining how transfer of information over the HTTP protocol works and just how much overhead there is in each transaction. Or as the men themselves put it

Simply put, HTTP wasn’t designed for real-time, full-duplex communication [with, for example, a] web application that displays real-time data from a back-end data source using a publish/subscribe model over half-duplex HTTP.

If you look at the Communications section, that’s section 9, for you lazy asses out there, of the HTML5 specification (PDF), you’ll get a comprehensive definition of Web Sockets. I’m guessing you won’t read it, so I’ll just continue by quoting the authors again;

Once established, WebSocket data frames can be sent back and forth between the client and the server in full-duplex mode. Both text and binary frames can be sent full-duplex, in either direction at the same time. The data is minimally framed with just two bytes. In the case of text frames, each frame starts with a 0×00 byte, ends with a 0xFF byte, and contains UTF-8 data in between. WebSocket text frames use a terminator, while binary frames use a length prefix.

For you Java heads, the article compares Comet with HTML5 Web Sockets. A good read, even if you’re not into Java. The results speak for themselves. The authors claim a 500:1 or even 1000:1 reduction in unnecessary HTPP traffic and a 3:! reduction in latency. You can read more on Web Sockets over at w3.org.

- Flash vs HTML5 comparison – who’s the worst CPU hog http://bit.ly/b4Bg2a

For some perverse reason, I kinda like articles that compare Flash with HTMl5 *cough* like this one – sort of *cough*. Jan Ozer did a really good job comparing watching video with Flash (10.0.45.2 first adn then 10.1.51.95) and HTML5 on both Windows and Macintosh computers with a range of browsers – Apple Safari (4.0.4), Mozilla Firefox (3.6), Google Chrome (4.0.239.89 on Windows, 5.0.307.9 on Mac) and Internet Explorer 8.0. A good read for both young and old. He concludes by stating that

[w]hen it comes to efficient video playback, the ability to access hardware acceleration is the single most important factor in the overall CPU load. On Windows, where Flash can access hardware acceleration, the CPU requirements drop to negligible levels. It seems reasonable to assume that if the Flash Player could access GPU-based hardware acceleration on the Mac (or iPod/iPhone/iPad), the difference between the CPU required for HTML5 playback and Flash playback would be very much narrowed, if not eliminated. … We also learned that not all HTML5 browsers/H.264 decoders are created equal. Significantly, with Flash 10.1 deployed, Google’s HTML5 implementation required the most CPU horsepower of all playback scenarios — by far — on the Windows platform. On the Mac, Firefox and Safari with Flash required less CPU horsepower than Chrome’s HTML5 implementation. At least from a CPU utilization perspective, Flash isn’t BAD and HTML5 isn’t GOOD. It all depends upon the platform and implementation.

Words of wisdom, right there.


March 12

- How-to: monitor your Facebook Page traffic http://bit.ly/9hpAeO

Given the massive amount of referring traffic that Faceboook can produce, it might be a good idea to measure the amount of traffic your Facebook presence generates. Nick O’Neill gives tips on using Webtrends Tool, Facebook Insights, Core Metrics and the grand daddy of analytics, Google Analytics with the help of a London based web development company.

- A day in the life of a programmer http://bit.ly/9CBvwa

A graph that is simply too true to be funny. But it’s funny, so check it out, laugh and slowly come to realize that it’s about you. Feel better? Me neither.

- Best yo-moma joke evar! http://bit.ly/cdYCl7

Don’t know why, but I giggled like a school girl, high on a hallucinogenic frog. I’m retadred like that. Spelling intentional.


March 13

- Detect Flash Blockers with JavaScript http://bit.ly/cNuny6
This piqued my interest. It claism to be able to detect FlashBlock 1 and for Chrome, FlashBlock for Firefox and ClickToFlash 1.5.x. I’m guessing this is of importance if your site has a lot of banners. What it does is inserting some dummy flash objects into the page and basicallywait to see if they get blocked. It requires a callback function which gets called almost instantaneously if a blocker is detected and a wee bit later if it times out. I should point out that it removes any dummy flash objects it creates. I hope.

- CodeIgniter 2 in the works, drops PHP4 http://bit.ly/bPzlKF

CodeIgniter 2 is in the works and, bug whoop, they’re dropping support for PHP4. Finally. Anybody still running on PHP4? I thought not. EllisLab is also moving away from Subversion in favor of Mercurial (http://mercurial.selenic.com/) and Assembla (http://assembla.com/). Also, Plugins are gone. What you have now are instead Helpers – one or more functions – and Libraries – lots of functions that share properties (i.e. classes). Good times.

- Top ten Linux distros compared http://bit.ly/dzZjyV

Distrowatch compiled a list of ten popular distributions. Pretty self explanatory stuff. The add pros and cons to their review of each distro as well as alternatives and available editions. That’s nice of them. If you visit this link, chances are that you’re already using one of the listed distros, in which case you are not likely to swap distro. So, really, the links is to no use to you. Unless you have no prior knowledge or preference of these sort of things. So the both of you visiting, you’ll like this link.

- 10 sweet free WordPress frameworks for designers http://bit.ly/97rtq4

I’m not really sure what I think about using WordPress frameworks, but I guess it’s truly awesome if you have limited scripting experience. Many of these also employ child themes, which efficiently turns your WordPress installation into a five to two hundred tier system. Yay redundancy! We like layers upon layers.



March 14

– Sweet SED one-liners http://bit.ly/bdczjZ

Good stuff for the CLI nerd in you. You know what I’m talking about, you hacker, you.

- Sony opens Apple St… er, Sony Store in Nagoya, Japan. http://bit.ly/daeofJ

I kinda feel like I’ve seen this sort of store somewhere before. I just… can’t… think of where…

- New Digg revealed http://bit.ly/9JW2OW – interview with CEO http://bit.ly/axo9Rt

New functions and layout, bla bla bla. Also the ability to submit stories anonymously. Yes. Gone are the days of 1000 diggs on a cracked.com link. Enter the era if three million diggs on a cracked.com link and more spam. Goody!

- Sweet PHP+jQuery Buzz stream reader http://bit.ly/b2mz4O
This was a really nice write up by Brian Wisti (http://coolnamehere.com/brian/index.html) on how to incorporate Google Buzz in your PHP project. It even caches the results for you. Good stuff.

There you have it. The week in hindsight was full of crap, as per usual. I’ll do better next time. I promise (kinda).

Related posts:

  1. Flash, King of the Impossible If you have been using a web browser to surf...
  2. CSS3 pseudo-class selector emulation for IE 5.5 – 8 and html5 with video While gathering information as a part of my ongoing plan...
  3. A Popurls Clone with PHP, jQuery, Awesomeness Good people of the Internets, I know a good deal...
  4. Hands-on tips for PHP security I got asked to review a fairly large piece of...
Page 1 of 11
  • What is this?

    My name is William and I'm a 30 year old developer/designer from Stockholm, Sweden. I have a love/hate relationship with PHP, I'm slightly aroused by jQuery and if I had the Adobe Flash IDE as a friend on Facebook, I'd label it as "it's complicated". This is my twelfth year as a freelance monkey. I prefer the term mercenary, but someone said it had a negative ring to it. Whatever. Oh, and I'm a Mac guy who loves his BacBook Pro in a somewhat unhealthy way.


    The font used for headings is Geometry Soft Pro as found on dafont.com.