Thursday, March 28, 2013

Benchmarking USB drives

So I have several USB drives lying around and I realized that I am not really sure which one performs the best.  So I decided to benchmark them.

Patriot "Razzo" 8 GB:


OCZ Rally 2 4GB:

SD Cruzer 16 GB:

And for the heck of it, here is a 500 GB Western Digital USB hard drive (not solid state):


Some observations:

It would seem that 32.77 MB/s read speed result may be limited by the USB2 bus speed, and not by the memory stick itself.  I base this off of the fact that two USB sticks are getting similar read results which I do not think is a coincidence.

Also, the 16 GB version is quite a bit slower.  I've noticed that solid state memory in greater capacities (such as on SD cards) tends to perform slower so this backs up my findings.

Guess I will be using that Patriot stick for the time being!

Wrote myself a calorie tracker/counter

So after vetting the popular calorie counters on the market today such as myfitnesspal.com and fatsecret.com I decided that they just did not meet my goals so I spent part of a day whipping up my own calorie counter.
The two main things I need it to do that I was not getting from the pre-existing offerings I researched is:

  1. let me enter in weight of food I am about to eat (instead of forcing me to figure out how many "servings" I am about to eat which is a complete joke in my opinion)
  2. show me my total protein consumed for the day next to the total calories

I own a food scale and it is super handy to just throw the food I am about to eat on the scale and see how much it weighs.  I don't want to waste time trying to figure out how many "servings" I am about to eat.  What a pain.  Apparently, I am one of the few people who actually finds using a food scale to be a convenience.

Also, since I tend to be skinny and am a male, losing weight really isn't a goal of mine; losing fat is my goal.  So I need to make sure I am eating a lot of protein in my diet to make sure I am not losing muscle instead of fat, especially if I am exercising.  This is another area where the pre-existing tools out there fail miserably (by assuming that calories are the only thing I care about).

Anyway, it took me less than a day and my calorie tracker is done.  Here are the two pages it has:

Main daily summary page

 Simple page to add/edit food consumed

Thursday, March 14, 2013

Replacing my ancient linux router with a Raspberry Pi

So I like to make use of hardware as long as possible and for literally a decade, I have been using an old Pentium 166 MHz (yes, you read correctly!) as my primary home router (running ubuntu linux).  This should be some indication how amazing linux is that it can make use of such old hardware.

Here is what the back looks like:


As you can see, this behemoth has four Network Interface Cards (NICs)  in it.  One of them (the bottom one) is so old that I don't even use it anymore but I kept it in the machine just for sentimental reasons.  It most certainly is an ISA NIC.

Lately I've had performance problems on the upload side of things (when traffic shaping is enabled) so I've decided that the P166 finally needs to go.  I was gonna replace it with one of the other old PC's I have lying around (such as an Athlon 800) but Warren pointed out that using a PC to act as a router wastes a lot of power so he suggested using a Raspberry Pi instead!  I thought this was a great idea.

My network at home has two subnets, one for my LAN (more permissive) and one for my wifi (more restrictive).  And I use DSL.  This means that I actually need my router to have three NICs.  The Raspberry Pi only has one NIC built in which means I needed to order a couple of USB NICs.

After doing some research, I read from the community that the ASIX chipset works well on the Pi, so I found some USB NICs with this chipset (plugable brand).  I also ordered a USB hub to help power the NICs and the Pi itself.  More on this later.  Finally, I ordered a case for the Pi since it is going to be my new router and I don't want my kids destroying it.  Here is how my setup now looks:



Now regarding power, this is where I am a little nervous.  Powering the Pi via the USB hub and then attempting to power both USB NICs at the same time proved too much for the Pi (I got flaky behavior).  So I currently am powering both of the USB NICs from the USB hub itself and then plugging the hub into the Pi.  This _seems_ to be working fine for now but I still am a little nervous about the system having enough power.

Stability

I've seen some problems including a kernel crash.  I am not ready to declare this setup stable.

Performance

Performance is really important to me so I wasn't sure whether the Pi was really up to the task considering its USB support isn't exactly stellar.  But so far, it seems to be doing a great job.

As far as internet is concerned, my max speeds over my "12 megabit" DSL currently are about 1300kB/s down and 91kB/s up (yes the upload speed sucks in comparison).  I am getting full speed from my LAN (through the Pi) so that is fine.  And over wireless, I am getting near full speed (just got 1200kB/s on my android phone next to the wifi access point).  Sending from LAN to wifi (through the Pi) gets about 3 megabytes/second.  On a subsequent test, I am getting 1.69 MiB/s which can be affected by a number of factors (my neighbors for example).  Sending from wifi to LAN (through the Pi) is about 2.75 MiB/s.

I also have quite a few iptables rules setup on the Pi (for firewall stuff) as well as traffic shaping.  It is handling both like a champ.

Here is the final parts list of what I am using (successfully) :

USB power cable
USB hub
USB NIC (x2)
Raspberry Pi case
and of course...
Raspberry Pi

Friday, March 8, 2013

Which image is the original?

After being stuck for a week puzzling over some GLES2 issues (which I did not chronicle on this blog due to it being too depressing), I finally made some fantastic progress.  I now have LDP-1450 text rendering on the Raspberry Pi!  And it looks great!

One of these images is captured from my LDP-1450 and the other is captured from my Raspberry Pi.  Both are outputting NTSC.

Which one is the real image?



Mouse over the file name to see the answer.

Friday, March 1, 2013

OpenGL seems to use left-handed convention

Ok, so for many years I was under the impression that OpenGL uses the right-handed rule to define how its Z axis works, meaning that the more the Z coordinate increases, the closer it gets to the viewer.

However, having just recently experimented with writing a bare vertex shader (without any view or projection matrices), I have found that OpenGL actually uses the left-handed rule (the more the Z coordinate increases, the further away from the viewer the object becomes).

Conclusion: if you want to use the right-handed rule, you simply need to setup your projection matrix accordingly (which I won't discuss here since I have not verified what the matrix should be exactly so I don't want to speculate).