Building a new Intel i7 PC from parts
My current desktop computer just had a power supply failure due to having a too powerful graphics card in the machine. Due to it being a non-standard Dell, replacing the power supply doesn’t solve my problem, and I can’t put a bigger one in that machine.
Time to build a new PC!
Recently, Intel introduced their new i7 processor. Quad core, 2.66 – 3.2 Ghz, tri-channel memory, built in memory controller and a new X58 chipset. Off to Google and NewEgg to get some parts together.
CPU
Intel i7 2.66 Ghz for $299 for the retail version
I got the slowest and cheapest version – at some future time I can upgrade to the 3.2 Ghz and keep everything else if I need to
Motherboard
ASUS P6T Deluxe – $299 from NewEgg
I got the Deluxe version to get the built in SAS controller, I did not get the version with the external module to aid the overclocking enthusiast.
Memory
Corsair 6GB DDR3 1600 memory in 3 sticks – $209 from NewEgg
The cool thing with this new chip is the DDR3 – the CPU memory controller supports this directly and allows faster access than DDR2 for the same amount of memory. The downside is that you need to install 3 sticks at a time to get the best performance. The ASUS Motherboard supports 6 sticks and 12GB currently.
Power Supply
CORSAIR CMPSU-750TX 750W supply – $119 from NewEgg
Need power for the graphics card that killed the old machine!
Hard Drives
2 X Fujitsu 147GB 15K RPM SAS drives – $250 each at NewEgg
I’ll mirror these drives with the built in RAID configuration to get reliability and put the OS and application installations here. I’ll be moving the 500GB drive from the old computer into this machine for storing data.
These 15K RPM drives are screaming fast compared to standard SATA drives.
Graphics Card
I recently bought a new Nvidia GTX 280 video card. This will transfer over easily. The ASUS motherboard supports running 3 of these in SLI mode. I’ll stick with a single card for now.
Operating System
Vista Ultimate Edition – The Microsoft Company Store will help me out with this for a good price. We need to be able to run all sorts of PC games on this machine, so Windows is the only way for our desktops.
Optical Drives
I’ll just transfer these from the old computer.
Construction
The parts have been ordered and should be here early this week. Hopefully I’ll have this running before the new year.
Using SSH tunnelling to run a Facebook application on your laptop
Why on earth would I want to run a Facebook application on my laptop? Surely these apps are meant to be used by lots of users and they shouldn’t stop running when I turn my computer off!
The only reason you’ll need to do this is during development. I run my apps on my laptop, behind a firewall, either at home, or on the road – so my IP address isn’t static. This allows me to make changes locally and immediately test them out without needing to copy to a server.
For this technique, you do need to have access to a unix server of some sort that does have a static IP address (or a fixed DNS name) that allows you to create SSH tunnels. With SSH client access, this should be possible with the low end hosting providers. Dreamhost costs less than $10 per month.
Facebook Application Setup
- Create a new application with the callback url http://ip-address:15000/ and a name of my-app-name-development
- Set your application configuration to use the app key and secret from step 1 when running on your laptop
- Run your application locally on port 5000
SSH Tunnel setup
Now we setup to get the remote server machine to listen on port 15000 and forward requests to this machine on port 5000.
ssh -p 22 -NT -g -R *:15000:127.0.0.1:5000 <user>@<server> -vI add the -v parameter so I can see a verbose output. Sometimes it takes Facebook a few seconds to connect to the tunnel, and the verbose option will allow you to see that when it works.
I add this command to a tunnel script I have and anytime I want to test out my app, I fire up the tunnel, then my application code, then access it on Facebook to try it out. If I have internet access, I can work on my Facebook applications.
I don’t use Rails, how does this help me?
If you can run a web server on your laptop, you can use this technique. This is not a Rails specific solution. I’ve seen information on the web for forwarding SMTP ports for email servers.
Windows?
I run this on Windows using a copy of SSH that comes with cwRsync
Rails named_scope and fragment caching
The typical way I’d write code that used fragment caching looked like this.
Contoller
def foo
unless read_fragment('key') do
@data = Model.get_some_data
end
endView
<% cache('key') do %>
<%= do_something_with @data %>
<% end %>The fragment caching adds extra work to the controller code to avoid doing the work that didn’t need to be done due to the data being cached. This is kind of messy.
I’ve also written code like this to avoid the above cruftiness
<% cache('key') do %>
<% @data = Model.get_some_data %>
<%= do_something_with @data %>
<% end %>From my previous post about when the named_scope queries actually run it occurred to me that the following code now works correctly.
Contoller
def foo
# No query gets executed here!
@data = Model.some_data.since(24.hours.ago).limited(10)
endView
<% cache('key') do %>
<%= do_something_with @data %>
<% end %>The Named Scope code allows my controllers to once again not care about how the View code works.
YouTube Developer APIs: New vs Old
Some time ago, I wrote an application that used the old YouTube API to extract information for specific videos. Recently, I wrote a similar application, and based on the warnings about the old API being deprecated, I used the new API.
The new YouTube API is based on some Google technologies, which is great for making it scale, but may not be the best thing for some applications. It certainly isn’t the best for my application.
How soon can I get video data?
I want users of my application to see a video on YouTube and then add that video to my app, and for the video to show up. This sounds reasonable, except the New API for YouTube can be 2, 3, 4+ hours behind the website. This delay is Ok for Google search, but for my application, not being able to get info about a video that the user can clearly see is available kills the experience.
The Old API reports a video if the user can see it on the site.
The Overview for the new API documentation does list out the expected latency for getting new data through the API.
How often does this data update?
My application uses the views of a video to calculate a ‘value’ for the video. If the API can’t keep up with the views the user sees on the web site, then my valuation system breaks down. The New API can be 2, 3, 4+ hours behind in reporting the views of a video.
The Old API provides reasonably recent data
Speed of getting data for videos
The New API seems to provide data at about half the rate of the Old API. I can get data for twice as many videos with the Old API in the same amount of time.
Batching up API calls?
The Old API can’t do this at all.
The New API allows your to ‘search’ using the unique ID of a video to get data! This is the winner!
Oh, except that the results seem to be kind of random. If I look for 20 videos at a time, supplying the unique ID for each, I may get 12 of them returned. If I reduce my search to 8 videos, I seem to get most of the videos available, but who knows.
Getting data for several videos at once seems to be fairly non-deterministic, and for my application ends up being worse than broken (it looks like it works, but it actually doesn’t)
Future access to the API?
YouTube has documented that the Old API is in danger after August 30, 2008. Currently it still works. Since the New API is essentially broken for my application, this will never be an option for me.
My fallback has to be screen scraping to get the data I need. I just need to monitor this to be prepared when they disable the Old API, and after that, whenever the UI changes enough to break my code.
Summary
Sometimes, newer isn’t always better. The Old YouTube API provides all I need for my app, where the New API just doesn’t.

