theChrisWalker.net

“Web Developer for hire ”

says Chris

Archive for the ‘Code’ Category

QR Code for Permalink
Mongo — and the coolness of Document-Oriented Databases

with one comment

I have been following a PHP Rapid Application Development Framework called Lithium with much interest (for other reasons which I fully intend to blog about later) and they are the ones I owe for turning me on to document oriented database systems.

So what are they and why are they so cool, and what/who the hell is “Mongo”?

Let’s deal with the what first. “Traditional” database systems are Relational, they are characterised by strictly defined tables, strong relations between tables and their ACID compliance. It simple terms that means you say:

“I want a table of users and each one will have a first name, a last name and an email address, and each of those will be a ‘text’ entry of a maximum of 255 characters”.

If at a later date you want to add more info, then you have to go back and alter your table definition, give the old rows default values and fix any coding bugs that relied on the previous structure (not that you’d ever develop such a dependant application). Now the approach in a document oriented database is that you say:

“I want a table of users”

Then you can give each one whatever data you want. you may have one user with a name and address, another with a name and phone number only, a third might have a phone number and address but no first name. All these records can co-exist! That’s pretty different and I really didn’t know whether it was a good idea. So I played with MongoDB.

Read the rest of this entry »

Written by Chris

March 9th, 2010 at 9:44 pm

QR Code for Permalink
Xbox Live Gamercard API

with 2 comments

So, got decided to join most of my friends and I got an Xbox 360. Me being me though, I got interested in the way that all the information about your “Gamertag” is stored an accessible on the xbox.com website. Wouldn’t it be fun to do something with this data!

As it turns out, I was beaten to the post by Duncan MacKensie (http://duncanmackenzie.net/Blog/put-up-a-rest-api-for-xbox-gamertag-data) who hosts a webservice to retrieve gamer data from Microsoft. I could find no details about how this service works, where the data comes from or anything! Either he has a relationship with Microsoft, or he scrapes xbox.com but either way, the data seems pretty consistent and reliable. Actually it turns out this information was right there on his website… http://www.duncanmackenzie.net/Blog/if-you-are-wondering-where-i-get-my-xbox-live-info So he gets it as part of his membership to the Xbox Community Developer Program.

However, the webservice is great, and returns XML which is fine, but I thought it would be more useful to me to have a PHP API for this data. So I wrote one which retrieves data from Duncans webservice.

Read the rest of this entry »

Written by Chris

December 31st, 2009 at 11:34 am

Posted in Code

Tagged with , , , ,

QR Code for Permalink
More WebKit Goodies – CSS Transforms and Transitions – the OSX Dock example

with 2 comments

As promised last time, I here we will discuss the transforms in WebKit, and how they can be used to create interactive applications without Javascript (for animation that is – we still need it for AJAX, etc.)

Tranforms have been implemented on a few browser using proprietary syntax, and the same is true of WebKit. As we shall see further down the article though, the WebKit transitions make them so much more powerful.

But what are they? They modify an element, without displacing it’s original setting within the document, which means we can move it about and the spacing doesn’t change.

Remember these will only work in WebKit based browsers, for example Safari for Mac, Chrome for Windows or Midori for Linux

An example: how about rotation.

element:hover {
  -webkit-transform:rotate(180deg);
}

Not very exciting, but combine this with a transition! (Try putting you mouse in the middle of the box for best effect)

element:hover {
  -webkit-transform:rotate(180deg);
}
element {
  -webkit-transition:-webkit-transform 1s linear
}

Read the rest of this entry »

Written by Chris

March 12th, 2009 at 7:44 pm

Posted in Code

Tagged with ,

QR Code for Permalink
Webkit CSS Transitions – pretty cool stuff

with 3 comments

I recently read somewhere about developing web applications for the iPhone / Android browsers that you shouldn’t use Javascript Frameworks (e.g. jQuery) for animation in your web apps but instead use CSS3 transitions. I had no idea what these where, so had to look it up. Turns out it’s pretty much a WebKit only thing, but that’s fine for iPhone (Safari) and Android (Chrome) Browsers.

But what is it? Simply put, it’s a way to create a transition between to CSS states (hope that cleared everything up for you!)

Better, an example: You have two CSS rules for an element, say a link, and for it’s :hover state. like this:

a {
    background:#eee;
    color:#333;
    text-decoration:none;
    padding:5px 10px;
    border:2px solid #333;
    border-radius: 5px;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
}
a:hover {
    background:#333;
    color:#eee;
}

Now usually, the browser would switch instantly between these two states, but with transitions we can slow it down into a smooth animation.

We can specify which propertys to transition and which to allow to change instantly. Here we can transition in the background and color properties.

a {
    background:#eee;
    color:#333;
    text-decoration:none;
    padding:5px 10px;
    border:2px solid #333;
    border-radius: 5px;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
     
    /* Add the transition properties! */
    -webkit-transition-property: background-color, color;
    -webkit-transition-duration: 600ms;
    /* you can control the acceleration curve here */
    -webkit-transition-timing-function: ease-in-out;
}
a:hover {
    background:#333;
    color:#eee;
}

Here’s two links, the they are identical except that the second has the transisions applied and if you’re using a WebKit based browser then it will fade nicely between states.

I will flick between states. Do I fade or do I flick?

Next time I’ll go into a bit more detail and show how using CSS Transforms as well we can make an OSX Dock style menu using CSS alone!

Written by Chris

March 10th, 2009 at 10:11 pm

Posted in Code

Tagged with ,

QR Code for Permalink
Multiple Drag and Drop between two lists with jQuery

with 98 comments

I wanted this functionality for a project a while ago. I google’d and found that lots of others did too, but no one had done it. Or at least not in a way that I could understand. In fact, I’m not sure I completely understand it anymore. It works very well, but also it could have some improvement. I would like to be able to drag the mouse to create a selection, but this in itself poses the difficultly of how to distinguish a “drag-to-move” from a “drag-to-select”.

Still I found it an interesting proof-of-concept and maybe you will too. The test can be found here: Select and Drag Demo.

Written by Chris

February 10th, 2009 at 12:26 pm

Posted in Code

Tagged with ,