Category: Web dev

As you might have noticed I’ve replaced the code formatting plugin that I use on the blog. I had trouble with the Geshi-based plugin I used before, so I replaced it with Alex Gorbatchev’s SyntaxHighlighter. This produces lovely formatting and works well - mostly.

SyntaxHighlighter hiccups when encountering the < character unless there is a blank space directly following it, most likely due to it being interpreted as the start of a HTML tag. Also, the "copy to clipboard function produces incorrect code because the text copied has < and > characters converted into the HTML entities &lt; and &gt;. However, I’m not sure if this is a problem with SyntaxHighlighter or with WordPress, since WordPress sometimes messes with formatting by automagically trying to provide good HTML substitutes for certain character combinations.

Most frustrating of all, WordPress has started replacing the ’s in “it’s” with a triple ellipsis character, as well as some other strangeness. Any tips for fool-proof plugins for posting properly formatted code would be most appreciated!

No Comments »

Flickr stats

Flickr now has statistics. See original size for a detailed view.

Flickr has introduced statistics as part of the feature set for Pro account holders. Like many bloggers, I suffer from obsessive-compulsive tendencies regarding stats, so this is probably the feature I missed the most on Flickr. Well, no longer will I pine for a detailed breakdown of my Flickr views.

Interestingly Flickr Stats looks and feels a bit like Google Analytics. The good side of that is that the analysis goes deep, as in breakdowns of referrers etc. which is probably more information than most people want to know. Still, it helps to explain why some of your pictures suddenly get a gazillion hits because they got Dugg or Stumbled.

Along with stats, Flickr has also released Uploadr 3.0, which adds some welcome new features such as being able to add new batches while you’re already uploading. Unfortunately, the new Uploadr seems to have quite a few bugs, so unless you’re desperate you might find it wiser to stick with the old 2.5 version until they’ve ironed out the kinks.

2 Comments »

I just added a Flickr badge to Generator.x using the excellent phpFlickr library. The code to retrieve the images from the Generator.x Flickr group is less than 20 lines. I turned it into a function and put inside a basic WP plugin shell, giving me a new API call for inserting into the sidebar.php template.

Code - gxflickr.php
/*
Plugin Name: Generator.x Flickr utilities
Plugin URI: http://www.generatorx.no/
Description: Support utilities for Generator.x web
Version: 1.0
Author: Marius Watz
Author URI: http://www.generatorx.no/
*/

require_once("phpFlickr/phpFlickr.php");

function gxFlickrSidebar() {
  $f = new phpFlickr("API_KEY");
  $f->enableCache(
    "dbname",
    "mysql://username:password@host/dbname"
  );

  echo("<div class=\"gxflickrSidebar\">");
  echo("<div class=\"gxFlickrTitle\"><a href=
      \"http://flickr.com/groups/generatorx/\">".
      "» GX on Flickr:</a> Recent images</div>");

  // get photos using the Generator.x group's ID
  $photos = $f->groups_pools_getPhotos('59096658@N00', NULL, NULL, NULL, 12);

  foreach ((array)$photos['photo'] as $photo) {
    echo “<a href=http://www.flickr.com/photos/” . $photo['owner'] .
      “/” . $photo['id'] .”/in/pool-generatorx>”;
    echo “<img border=’0′ alt=’$photo[ownername]: $photo[title]‘ src=” .
      $f->buildPhotoURL($photo, “Square”) . “>”;
    echo “</a>”;
  }
  echo(”</div>”);
}

Once that’s done, all you need to do is insert the function call in your Wordpress template:

[..html..]
  if (is_home() || is_page()) {
    gxFlickrSidebar();
  }
[..html..]

No Comments »

JDIC embedded browser engine

Screenshot of IE running integrated with Processing and other AWT components.

For a while I’ve been wondering if it couldn’t be useful to be able to render proper HTML from inside Processing. While Processing is excellent for realtime graphics, the typographic support is a little basic when faced with the task of designing a more complex layout. Rather than write a new library, why not just use a fast HTML engine?

While there are quite a few HTML rendering engines out there, not all are very complete or indeed very fast. This might be one of the cases where using native code makes sense. Both Internet Explorer and Mozilla offer ways of embedding their rendering engines through native bindings, and after a little googling I was able to find JDIC - the JDesktop Integration Components project.

JDIC aims to bring Java applications closer to feeling like “real” desktop apps. I’m not sure if that’s a battle I would have taken on myself, but in any case they have exactly what I needed: A simplified web browser ready for embedding, able to use either IE or Mozilla as engines. A little coding later and I had a hybrid Processing / AWT application running a web browser. It will even support Flash and Java content, provided that you’ve installed the proper plugins.

The WebBrowser.setContent() function is perfect for loading your own machine-generated content, and events can be captured and processed appropriately. It would even be possible to have a hybrid application, with part of the interface being straight Processing and the rest AWT. I’m keen to try using this to create more complex on-screen layouts. HTML and CSS will always look much better than anything one could create using Swing.

See Flickr for some screenshots.

Code - JDICsample.pde

Read the rest of this entry »

2 Comments »

I’ve recently been playing with the excellent Meta-Markets.com site set up by the talented Burak Arikan. Essentially Meta-Markets is a virtual stock market for trading socially networked capital. If you have a hot blog, a popular Flickr stream or were the first poster of an essential del.icio.us bookmark you can offer it for trade through an IPO, just as if it were a company.

Each user starts out with a capital of 25 “buraks”, which can be used to buy shares in traded commodities in any of the 6 given “markets”: Flickr, Facebook, del.icio.us, Feedburner, Digg and YouTube. By offer an IPO of your own social capital you accumulate value that can be used for further trade. Ultimately the system will also include auctions and payment of dividends to stock holders.

You can make an IPO of any del.icio.us bookmarks of which you were the first poster. Finding out exactly which these are can be a drag, since del.icio.us does not provide an overview of this info. Even using the del.icio.us API won’t give you the needed information, the only way is to use the del.icio.us URL history feature. Needless to say, this can get tedious when done manually.

To address the issue I’ve hacked up a tool I call deliciousChecker. It downloads your bookmarks and then proceeds to check their posting history using HTTP calls to the history page. del.icio.us will block offensive applications that make repeated API calls, so deliciousChecker only downloads the bookmarks when there’s been an update. There is also a 15 second default delay between HTTP calls, it’s not recommended to go lower than this since Yahoo will think you’re a denial-of-service attack.

The code is written in Processing using the delicious-java and Apache Commons HttpClient libraries. The source is included, but for non-Processing users I’ve also provided precompiled applications for Mac, Windows and Linux. You must edit the “delicious.conf” config file to add your username and password.

The application can be exited safely by pressing the escape key. It also auto-saves the database with regular intervals. Upon exit (whether from interruption or upon completion) the application writes a HTML file with your bookmarks, indicating which ones were first posted by you as well as how many other users have saved them.

Downloads

7 Comments »

Following up on my post a few days ago about online storage: I just rechecked the Box.net web site only to discover that they have increased their prices rather than drop them. 5 GB is now $7.95/month or $79.95/year. 15 GB is $19.95/month or $199.95 per year. I might be willing to pay that - if we were talking about 100 GB of storage.

I’ve looked around at other solutions, but haven’t found any that seem really appealing. I’d be happy to hear suggestions or any feedback about your own experiences.

6 Comments »

I generally try to avoid tinkering too much with the insides of Wordpress, but if I did I would read Devlounges How to Write a Wordpress Plugin first. It’s even available as a nicely downloadable PDF.

Yesterday I needed to delve into Arne Brachhold’s Del.icio.us plugin to figure out how to add proper titles for links from main or archive pages. It was a dirty hack, but I got it working somehow. If you need to know, it involved hacking his Javascript and I’d be happy to share if you ask.

No Comments »

The idea of storing data online is sexy. It means easy sharing of files, pseudo-backup and access-everywhere all rolled into one. I’ve been using Box.net for a year now, with mostly good experiences. It’s got a well-designed dynamic interface, it makes sharing extremely easy and the service is very stable. I do have a few complaints though:

  • The space you get is small. 5 GB for $5/month is not a lot. They have a bigger plan at 15 GB at $15/month (== $180/year), which hardly seems like a bargain.
  • The interface looks great, but is sometimes a little tricky for complex file operations such as moving lots of files around. It’s got a great search function though.
  • Most importantly: Uploading can sometimes be painful, requiring the use of either a popup applet or a built-in Flash tool. Navigating the file structure from these tools seems like it’s harder than it should be, with slow GUI response times.

Essentially, I’ve been wanting a file browser-like interface for uploading, with immediate folder navigation. Box.net has promised for a long time that they would release an uploading app that works outside the web browser, but has not delivered so far. I like their service and I’m not looking to switch, but I just wish it’d be easier to use…

To the rescue: Fire Uploader, a Firefox extension that supports FTP-style uploading to Box.net, Flickr, Picasa and YouTube. Browsing my Box.net account, creating a new folder and uploading a bunch of images was a snap. It supports downloading as well, but unfortunately not moving files.

It remains to be seen how stable Fire Uploader is in dealing with huge files and broken uploads, but so far it’s looking really good. Upcoming versions might add site-specific functions such as setting permissions, as well as new services to upload to. If it supported moving files it could almost be a complete Box.net GUI replacement.

For Flickr uploading, Fireflix is useful, but a little clunky. For FTP transfers, I like FireFTP, another great Firefox extension. It allowed me to finally do away with clunky FTP software, and do it all inside the browser. I love that that the browser becomes an environment for getting things done.

No Comments »

DIGG announced the launch of the public DIGG API yesterday. I’m not a DIGG fan myself, but it is a major service so the launch is significant.

The API should enable more visualizations along the lines of the popular Swarm and Bigspy visualizations. This is clearly part of the interest on DIGG’s part, as they have also announced a DIGG API Visualization contest. Entries must use the Flash toolkit provided by DIGG.

You can read more about the launch on the DIGG blog. Basic API concepts are fleshed out here.

3 Comments »

…what you like and don’t like about them. If you want to share, go answer their survey. As a loyal long-time user I just did it, it only takes about 2 minutes.

It seems like del.icio.us is at a crucial juncture right now. They have a loyal user base and a ton of data, but the web site feels clunkier by the day. Not because it’s actually getting worse, but because it’s not getting any better. A better design for presentation and navigation is desperately needed. del.icio.us director makes the site a bit more usable, but I can’t help but wonder why the core team hasn’t tried to do even better than that.

As it stands, I use del.icio.us every day through the excellent Firefox extension, but I barely ever visit the site. It simply doesn’t help me very much to do so. Yahoo or no Yahoo, I’d love to see del.icio.us regain their cutting edge. I mean, they almost single-handedly made tags the killer app of Web 2.0.

Read more about the thoughts of the del.icio.us team on overdue New Year's resolutions.

No Comments »