Categories
Adventure Development

Open Hack Day NYC

IMG_0259

So far Open Hack Day has more than lived up to the hype. Met some really cool people so far. It’s fun to talk about all the different web technologies with them and hearing what languages and tools they work with on a daily basis.

The keynote by Clay Shirky was really good. He mostly went over how the web has changed how information is now being shared.

I went to the YAP session. Which was a pretty solid into to writing YAP applications.

Next session was YQL. Which was so packed that people had to sit on the floor! The guy sitting next to me was a pretty strange breather, which is always annoying. Plus he coughed while drinking a soda, which meant that I was kindly sprayed with some soda on the left side of my body. Very gross.

Lunch was awesome. I made a new friend all the way from Japan. A very interesting guy. The carrot cake stole the show in my opinion. Extremely good stuff.

Now I’m off to some more sessions, while trying to form a solid hack team for later tonight.

Categories
Development

Project Hosting on Google Code

I finally got around to hosting a project on Google Code. I’ve used countless projects that have been hosted on the service over the past few years, but strangely, never went through the process to host one of my own.

Setup was a breeze, just navigate to Project Hosting on Google Code, then login with your Google account. If you’re one of the 5 people online without a Google account, sign up is free and takes a few seconds to do.

I’ve found it to be a great spot to host an open source project. It’s simple and free. I downloaded ZigVersion to manage my Subversion on OS X. After a few minutes I had that all setup and synced with my hosting.

I’d also like to play around with GitHub more as well, to compare the 2 services.

Categories
Development

Incorporating Lightbox 2 effect with WordPress gallery

I wanted my client to be able to add pictures to a gallery using the build in WordPress gallery, but was hoping to customize the display of the gallery thumbs a bit. I was hoping to get it to display as the following:

      use the Lightbox 2 script
      able to override the CSS that is being written to the page

Since the default CSS that the gallery generates is written in the page, overriding the styles was kinda a pain to do in the site’s stylesheet I was using. However I did find that I could edit the default CSS that is being written to the page by the gallery by editing the following file:

/wp-includes/media.php

Locate the following code and edit as necessary:

	$output = apply_filters('gallery_style', "
		<style type='text/css'>
			#{$selector} {
 
			}
			#{$selector} .gallery-item {
				float: left;
 
				text-align: center;
							}
			#{$selector} img {
 
			}
			#{$selector} .gallery-caption {
				margin-left: 0;
			}
		</style>
		<!-- see gallery_shortcode() in wp-includes/media.php -->
		<div id='$selector' class='gallery galleryid-{$id}'>");

You can see I’ve removed some styles in this case.

Further edits can be made to the gallery from this file as well. I chose to use a little bit of javascript to attach the rel attribute to my anchors instead of editing the php file. Personally, I’d rather do that so in case a future version of WordPress altered the media.php file it’d be one less thing for me to worry about.

Very basic javascript to add the rel attribute that Lightbox 2 requires to the image anchors:

var galleryDivs = YAHOO.util.Dom.getElementsByClassName('gallery', 'div', 'bd');
for (var i = 0; i < galleryDivs.length; i++) {
    var imageAnchor = galleryDivs[i].getElementsByTagName('a');
    for (j = 0; j < imageAnchor.length; j++) {
        imageAnchor[j].setAttribute('rel', 'lightbox[gallery]');
    }
}

I use the YUI Dom collection to help me gather nodes.

Then it’s just a matter of calling the relevant dependancy scripts and styles into your page and it should work for you.

Categories
Development

Google App Engine

I’ve finally gotten around to messing around with the Google App Engine over the weekend. It allows you to run web applications on Google’s infrastructure for free as long as you don’t go over roughly 5 million page views in a month. If your app has the good problem of going over that traffic then you’re billed by usage.

Currently only Python and Java are the supported languages. I’ve been interested in dabbling with Python a bit more than I have, and building an app on this platform has given the excuse I need to try it out.

Getting started is fairly easy. Sign up for an account at the Google App Engine site. Then download the SDK for your OS. Leopard already has Python 2.5 installed, so I didn’t have to install or upgrade that.

There’s an amazing getting started guide available for building a simple Python app. It’s one of the better tutorials I’ve done in a while, even if you’re not proficient with Python it’s easy to follow along.

Using the datastore to work with data vs. a relational database seemed strange at first, but it’s very easy to work with. The GQL can be very similar to working with SQL.

I’ve got a couple of ideas I’ll like to try building, and this seems like a great platform to build on.

Categories
Development

YQL is my new BFF

YQL

YQL, Yahoo’s SQL-like language that provides straightforward ways to mash up different APIs into one data source for use in applications has been around for a few months now. In that time I’ve found it to be extremely useful and easy to work with in numerous projects. However,  the service got 10 ninjas better last week they added the ability to insert, update and delete to the service as well.

In just a few minutes I was able to take an existing news app that I had created in the past and using the YQL service had it sending out tweets to Twitter as well as including a shortened URL courtesy of the bit.ly API.

Just feed the following Twitter status update to the YQL Console and it’ll create the REST query that you can use in your script:

use 'http://www.yqlblog.net/samples/twitter.status.xml';
insert into twitter.status (status,username,password)
values ("Playing with INSERT UPDATE and DELETE in YQL", "twitterusername","twitterpassword")
Categories
Development

bit.ly API

With the 140 character limit that comes with developing a Twitter app, I needing a URL shortening service with a simple, easy to use API. Conveniently the bit.ly API works great if you are looking for s simple URL shortener for dynamic use.

Just had to sign up a free account, then spent a few minutes reading over the bit.ly API documentation. Just send a simple REST request and you get a simple JSON response. Doesn’t really get much simpler than that. An XML response is also available as well.

Very cool API and one that worked perfectly for the task at hand.