Archive for the ‘Dev’ Category

bit-tech gets it’s own blog   no comments

Posted at 3:23 pm in Dev

Just a quick note to say that we have launched the bit-tech blog.

It’s been custom written for the site and is quite neatly tied into the CMS and overall site.

Written by Jamie on January 30th, 2009

Tagged with ,

Thanks Ruby – Array zip fail   no comments

Posted at 5:33 pm in Ruby

After updating rails from 2.0.2 to 2.2.2 on the bit-tech CMS this week I discovered a bug that had cropped up in one of my controllers where I was calling zip to join a a has_many collection with a couple of arrays and iterate through them. The code that was working fine now did something like the following.

>> g.groups.zip([1,2], [3,4]) {|a,b,c| p a.inspect + ‘, ‘ + b.inspect + ‘, ‘ + c.inspect }
“[#<Group id: 1>, 1, 3], nil, nil”
“[#<Group id: 2>, 2, 4], nil, nil”

This is strange, I can no longer access the three elements of the array directly in the block. So I tried the following

>> g.groups.to_a.zip([1,2], [3,4]) {|a,b,c| p a.inspect + ‘, ‘ + b.inspect + ‘, ‘ + c.inspect }
“#<Group id: 1>, 1, 3″
“#<Group id: 2>, 2, 4″

As you can see this solved the problem, but I was confused why there was a difference so I executed…

>> g.groups.class
=> Array

Why when I cast it to an Array, from an Array, is it acting differently? Rails must have done something to the Array class that is returned by the has_many relationship.

Written by Jamie on December 12th, 2008

Tagged with ,

… game development   1 comment

Posted at 2:42 pm in Dev

Well that didn’t even get off the ground.

I’m now busy trying get more airtime on my mountain bike.

Written by Jamie on October 1st, 2008

Tagged with

Game Development   2 comments

Posted at 9:31 am in Dev

For a long time I’ve wanted to sit down and code a game but until now I’ve never really taken the time to learn anything about it and I’ve never had a good idea for a game. Joe has recently put together a concept for a game called Pacifist and since I’m quite keen to learn the process of creating games I’ve volunteered myself to help with the programming. A team of forum members have decided to use Microsoft’s XNA Framework to build the game which suites me since I’m much more fluent with C# than C++.

I just hope it’ll get off the ground!

Written by Jamie on May 22nd, 2008

Tagged with , , ,

Diverging paths   no comments

Posted at 9:18 pm in Dev

The path of optimised code can lead in the opposite direction to that of reusable code.

Written by Jamie on April 18th, 2008

Tagged with ,

Google geographic location update   no comments

Posted at 11:24 am in Dev

Google has now updated and bit is now being indexed on google.co.uk (pages from the UK) despite being hosted in the United States. It remains to see whether this increases the percentage of UK readers on the website, but logic dictates that it should.

Written by Jamie on February 25th, 2008

Tagged with

Google geographic targeting   no comments

Posted at 7:23 pm in Dev

For a while now we’ve been banging about the office the problem of getting our website listed on google.co.uk with the ‘pages from the uk’ option ticked. The rough aim is to increase the UK traffic to www.bit-tech.net. So we bit the bullet last friday and switched the geographic target to United Kingdom in Google webmaster tools. Results will follow…  

Written by Jamie on February 14th, 2008

Tagged with

bit-tech shopping goes live   no comments

Posted at 7:10 pm in PHP

I previously posted that I was working on bit’s new price comparison website and I can now report that it’s ready for you to use to track down the best prices.

Bit-tech Shopping

 

Written by Jamie on February 14th, 2008

Tagged with ,

Price Comparison   no comments

Posted at 9:23 am in PHP

Price comparison seems to be a popular web exercise these days. There are so many people doing it that you almost can’t google a product name without seeing at least 5 different comparison sites.

At bit-tech.net we are no different, we have our own price comparison site built from the PriceGrabber API.

I am currently overhauling the code and look and feel of the site since it looks like ass. Stay tuned for the news when it’s released later this month.

Written by Jamie on February 6th, 2008

Tagged with , , , ,

Memcache++   no comments

Posted at 9:16 am in Dev

Memcache has been a core part of my web programming lately and it’s one of the most flexible and useful systems ever come across.

Think for a second about the process when two people request the same dynamic page on a website. The code rendering one request has no idea that there is another request for the same page so effectively you do the whole process twice. Let’s also imagine that this request pulls a huge list of data out of a massive table that takes a while to query. In an ideal world the dbms should cache the query and the second request should be faster. In reality, and with a simple dbms both sets of data are returned in the same time. Now say one hundred other people also request that same page over the next few minutes, are we going to keep calling that data out of the database from the hard disk or is there a better way?

This is where memcache comes into it’s own. If, after pulling the data out of the database, it is placed in memory and not destroyed after the page is rendered it can be retrieved next time we want the same data. Hey presto, we can now serve thousands more requests per second as we are no longer asking for data from the database, we have exactly what we want waiting in memory.

Memcache isn’t without it’s problems, what if we change what’s in the database. Our version in memcache is now out of date. Thankfully we have set an expiry time on things that we give to memcache, so it falls out of memory after a period of time. What if your data is time sensitive? As with many things I am working on it is important that things happen at certain times rather than just waiting for things to fall out of memory. This is one problem I am currently working on and something I will cover in future.

Written by Jamie on June 21st, 2007

Tagged with , ,