Archive for August, 2006

Ruby on Rails: Pagination with joins overwriting fields 0

I have three tables; stores, products and stocks. A stock has a product_id and a store_id (which reference a single row in the appropriate table). I found that using the scaffolded code however these connections are not automatically made. I needed to change the stock pagination code to include inner joins to the product and store tables. However, all three tables share some similar column names, like "name" for example. This meant that I was getting one value for name returned, instead of three. This makes sense, but isn't what I wanted.

I was initially going to use paginate_by_sql to solve this, but further reading let me to include two more parameters to my paginate call. I now have :select and :conditions set.

So, before you start including other code you might be able to solve your problem with existing methods.

The uncanny thing is that the other sites are also using stock and product tables in their examples!

Time to relocate 9

Adam and I have been looking for some new office space recently to facilitate the expansions we're going through with the company. Today we verbally (and over e-mail, but not via contract) agreed to lease a ground-level office at 1010 Wellington Street in West Perth. If everything goes to plan we'll be moving in during the last week of October and it'll be our place of business come November 1.

Our current space is 22m² and we have two desks, a sofa and whiteboard which take up most of the space. We could ditch the sofa and have another desk but we don't want to be working in a cramped environment. It's not the right environment for our company to grow in.

The new space is 49m² (about two and half times bigger) and we'd be having three or four people working out of it. One entire wall is glass and has lots of natural light, which is important if you're looking at a computer screen all day. It faces Wellington Street but is sunken down from street level and is surprisingly quiet. The room is pretty well square, and has a sink and cupboard in the back right corner, as you look in the windows. We'll section that off with a partition of some sort no doubt.

I've re-read some office-design articles that are specific to programmers and IT people. We're starting with a blank slate here and have the opportunity to build a kick-ass office environment from the beginning that will foster the kind of growth we're hoping for.

The only problem is we're still stuck with the one car bay, but that's not a big problem. We also have access to the BBQ on the roof, so come Summer it'll be BBQ lunches every day.

Lastly, the office is next door to Cre8tif, a print and web design group that we've been working with since before our company's inception. Being close to them, phyisically, will no doubt have an influence on work life. Maybe we'll even share BBQs :)

Personally, I'm really excited about the opportunities that will be available to us now. I think that part of the reason the TFG has been two people for so long is the size of our office. We've begun the proceedings that will let us have full time staff on board and are moving in that direction. I saw first hand how important a wicked office is when I was lucky enough to visit Google. We'll have bean bags for sure!

Mixed mode slow downs 2

I have a WRT54G that I've been to provide wireless internet access at my place forever. We've done a bit of work with them too, outfitting a local hotel with a wireless mesh about 18 months ago. They're a great little box, especially with the modified firmwares that are available for them.

Today I noticed I was getting about 300KB/sec transferring a file from my Mac to our home server. I then changed the WRT54G from accepting B and G connections to only accepting G, and now it's dishing up 1.8MB/sec speeds. Much nicer!

High productivity != high productivity 1

This week has been an interesting one. It feels like I've written in one week more than I did in English Lit. all those years ago, and while it's great to have all of these proposals out there in the ether, I still feel somewhat "empty" with this week.

I mean, I know I've been doing positive things for the company, but because it's hard to tack a value to what I'm doing it's left me feeling shallow. In reality, the future holds more of this so I need to overcome this feeling because there's plenty more where it came from.

On the flip side, I know that when all the proposals are accepted it'll feel great.

“I’ll never use maths in the real world” 7

I always used to laugh at the dumb kids at school who used this arguement to justify them not paying attention. Today I used some maths from primary school.

7x + y = 4720
5x + y = 3620
.:  2x = 1100
.:   x = 550

7(550) + y = 4720
.:       y = 4720 - 7(550)
.:       y = 870

Here x is the charge per page, and y is the base rate that Webfirm have quoted a client of ours for a new web site. Yes, $550 per page and $870 just to start a project.

AuroraCMS has no limitations on the number of pages you can have within a site, and we sell it for about half what they're selling a static 8-page site for. Webfirm, thanks for making this so easy.

Next Page »