Randomizing A Table In MySQL

All Posts, Computers No Comments »

I’m working on a project right now where I want to collect a Network ID (for prize-drawing purposes) from a survey participant but I don’t want it to be able to be tied to their response.  Even if there’s no relational connection through keys or anything, just the fact that the order of the network IDs in the table matches the order of survey responses is enough for correlation.

I tried alter table netIDs order by rand(); but that gave me an error. I used the Google and found a decent solution which I modified for my purposes:

set autocommit=0;
begin work;
insert into netIDs values ('$netID');
create table netIDs_temp like netIDs;
insert into netIDs_temp (select * from netIDs order by rand());
truncate netIDs;
insert into netIDs (select * from netIDs_temp);
drop table netIDs_temp;
commit;

I wanted to wrap the whole operation in a transaction for atomicity - losing network IDs while keeping responses would be a nightmare, not to mention a violation of research ethics.

Popularity: 5% [?]

Bed Time Check List

All Posts No Comments »

(a.k.a. what tabs do I keep permanently open in my browser?)

Before I go to sleep (and many other times during the day), I check:

Tomorrow’s forecast (noaa.gov)
Tomorrow’s schedule (Google Calendar)
Any unread items in Google Reader?
Anything new on Forum.case.edu?
Any new updates on Facebook?
Any new posts on Twitter?
Any new e-mail?

Sleep.

Popularity: 5% [?]

Now on FriendFeed

All Posts No Comments »

I’ve been hearing about FriendFeed on and off for the last few months and I decided to give it a try.  Friendfeed is a service that lets you aggregate your friends’ online presences.  I’m able to track what my friends upload to Flickr, post on Twitter, share in Google Reader, upmod on Reddit, and so on.

So why not just grab RSS feeds for these things and follow it all from Google Reader?  Well, for one, FriendFeed will automatically start showing me updates from services that my friends have just added. So, there’s no need for them to announce they’ve just joined X service.  And it will also let me comment on their updates as well.

I’ll be experimenting with the service for the next few weeks and see what I can do with it.  I’ve already replaced the Twitter Updates widget in my side bar with my FriendFeed widget.  I’m planning on changing my blog theme soon, so the widget won’t clash so much with the current theme (although you can customize it with CSS, but I don’t have the time to do that right now.)

And if you want to check out my page, here it is: http://friendfeed.com/alexhutnik.

P.S. I just found out/remembered that fellow Case student Ben Golub works for FriendFeed.  Nice work, Ben!

Popularity: 5% [?]

iTunes Music Library Visualization

All Posts, Computers 2 Comments »

Inspired by this post I decided to put my iTunes library through wordle:

Unfortunately they don’t have larger thumbnails.

Popularity: 9% [?]

How fast is the iPhone 3G?

All Posts No Comments »

I decided to test my iPhone 3G on EDGE, 3G, Wifi, and Wifi + VPN using testmyiphone.com.

Here are my results.

EDGE:

EDGE

3G:

 

3G

WiFi:

WiFi

WiFi + VPN:

WiFi + VPN

I don’t really know why using the VPN is slower, but it could have just been a fluke.  I only ran the test once and the first time it said I was getting 80kbps downstream.  Definitely an error there.  Also the site caused my phone to lock up.

Popularity: 14% [?]

How I Manage My Own Data Storage

All Posts, Computers, Linux No Comments »

I’ve been (seriously) playing with computers since I was about 12 years old.  So in the last 10 years or so, one of the things I’ve always tried to remain conscious of is how reliable (or unreliable) my computer is.  No one likes it when their computer breaks (not even someone who is talented at fixing them).  For me, this concern has been brought on by the stress of losing data that, in hindsight, may not have been all that important.  But, it was a data loss nonetheless and no one likes it when it happens.

So when I was in high school, my first strategy was to put my OS on a different drive than my user data.  I figured that the system drive would experience many more read/writes than the data drive, because of paging and other things.  So, it would be more prone to stress than a data drive that gets used less vigorously.  I kept this strategy for several years.  I was lucky enough to replace drives before they failed (as all drives do).

But, when I got to Case, I was exposed to a ridiculously fast fiber optic network that made it even easier to fill my hard drive with junk I probably don’t need.  I needed a storage solution that met a few objectives:

  • It had to be a relatively large amount available storage.
  • It had to provide some level of fault-tolerance
  • It had to run on Linux, since I was tired of switching between Linux and Windows Server 2003.  I chose Linux and I was sticking with it.

So I built a 1.2TB software RAID5 array. There’s a pic missing on that page, I’ll see if I can locate it or take another.  I also have some other items to add to that page, including benchmarks and other info.  The RAID array is terrific.  It’s survived one and a half drive failures (one legitimate drive failure and half a drive failure that I simulated by yanking a disc while it was on).  Rebuilding the array takes several hours, but that’s to be expected.  More on that when I update that post.

So of course, even with local data fault-tolerance, I want to have an off-site backup service.  At first I was using Dreamhost, but they tried to extort a bunch of money out of me to use my storage space for backups.  It was really shady.  But it did force me to look elsewhere, and I’m glad I did.  I wanted a cross-platform solution (given the heterogenous nature of my current computer collection).  So I selected JungleDisk, which uses Amazon’s S3 web service for data storage.  I pay a pitance (maybe a couple of dollars per month, if that) to store about 20GB of data.  Backups happen nightly (or however often you select).

I use JungleDisk to backup all of the documents I’ve written in college, all of the code I’ve written, all of my digital photos, my encrypted password database, and a dump of my MySQL databases.  Everything is encrypted before it even leaves my computer.  The client runs right on my file server and just works.  It’s an absolutely terrific product.  My only complaint (a feature request, really) is that I wish it would e-mail me a copy of its log file every time a backup occurs.  That way I know if it was successful and what was transferred.

I foresee keeping this setup for quite a while.

Updates: I added an extra drive to the RAID array.  A few quick terminal commands later and I’m up to 1.5TB.  Also, JungleDisk added a reporting option.  You can get an e-mail when a backup job completes but if you want details you have to pay for their monthly service.

Popularity: 18% [?]

How fast is the Case Network, really?

All Posts 2 Comments »

This is a question Colin and I thought about a few months ago.  Well there’s a two-part answer to that.  Our network is entirely gigabit fiber end-to-end.  So, theoretically I should be able to get 1000mbits/sec between two machines.  However, with network IO overhead and other hardware limitations, it seems the best I can do is:

alex@tardis:~$ iperf -s -w 100K
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size:   200 KByte (WARNING: requested   100 KByte)
------------------------------------------------------------
[  4] local 129.22.56.170 port 5001 connected with 129.22.57.154 port 53101
[  4]  0.0-10.0 sec  1.08 GBytes    928 Mbits/sec

So about 930 Mbits/sec between two machines on the same network switch.  I had to tune the TCP window a little bit to get that, but that’s still not bad.  Of course real-world transfers are much slower because of a number of reasons: protocol limitations (like HTTP, FTP, Samba, etc), IO speeds on hard drives, etc.  For example, even though I can achieve nearly 930 mbits/sec between my two Linux machines using raw socket connections (where the source of the data on both machines is in memory), Samba transfers seem to top out around 250 mbits/sec, due to Samba limitations and probably a bit of hardware limitations as well, I’m sure.

Measuring internet bandwidth is a little trickier.  Case is connected to a few ‘internets’.  Obviously, we are connected to the same internet that everyone else in the world uses (the ‘commodity’ internet).  Our ISP for that is OneCommunity and our SLA calls gives us 450Mbits/sec (upstream and downstream).  Since our internal LAN behaves, essentially, as one giant network switch (and since we also don’t do any significant packet shaping), every end user can consume as much of that bandwidth as possible.  In this case, data transfer speeds are more dependent on the source you’re downloading from (or the destination you’re uploading to).  We’re also connected to internet2 (i2), which is a private fiber optic network for Higher Education institutions and research labs (like Los Alamos National Laboratory).

So, measuring i2 bandwidth can be accomplished by downloading a file hosted on an i2 server:

alex@tardis:/sata-raid5/downloads$ wget http://ftp.ussg.iu.edu/linux/ubuntu-releases/hardy/ubuntu-8.04.1-desktop-i386.iso
--17:40:46--  http://ftp.ussg.iu.edu/linux/ubuntu-releases/hardy/ubuntu-8.04.1-desktop-i386.iso
           => `ubuntu-8.04.1-desktop-i386.iso'
Resolving ftp.ussg.iu.edu... 156.56.247.193
Connecting to ftp.ussg.iu.edu|156.56.247.193|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 728,221,696 (694M) [application/octet-stream]

100%[=================================================================================>] 728,221,696    5.24M/s    ETA 00:00

17:42:44 (5.91 MB/s) - `ubuntu-8.04.1-desktop-i386.iso' saved [728221696/728221696]

So 6MB/s is roughly 48mbits/sec.

Let’s download something over a known fast commodity internet source (One of Apple’s servers that serves movie trailers):

alex@tardis:/sata-raid5/downloads$ wget http://movies.apple.com/movies/sony_pictures/quantum_of_solace/quantum_of_solace-tlr1_h1080p.mov
--17:55:22--  http://movies.apple.com/movies/sony_pictures/quantum_of_solace/quantum_of_solace-tlr1_h1080p.mov
           => `quantum_of_solace-tlr1_h1080p.mov'
Resolving movies.apple.com... 192.5.110.40, 192.5.110.39
Connecting to movies.apple.com|192.5.110.40|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 141,490,583 (135M) [video/quicktime]

100%[=================================================================================>] 141,490,583    6.74M/s    ETA 00:00

17:55:39 (8.05 MB/s) - `quantum_of_solace-tlr1_h1080p.mov' saved [141490583/141490583]

So that’s pretty fast, even faster than i2. But then I forgot to look up the host (movies.apple.com) in the first place

alex@tardis:/sata-raid5/downloads$ tracepath movies.apple.com
 1:  tardis.STUDENT.CWRU.Edu (129.22.56.170)                0.118ms pmtu 1500
 1:  129.22.56.2 (129.22.56.2)                              0.415ms
 2:  10.2.0.50 (10.2.0.50)                                  0.446ms
 3:  cwru2-fa4-0-0.cwru.edu (192.5.109.1)                   0.681ms
 4:  a192-5-110-40.deploy.akamaitechnologies.com (192.5.110.40)   0.915ms reached
     Resume: pmtu 1500 hops 4 back 4

and was reminded we have our own private Akamai cache, so that explains why the 135MB trailer download in 17 seconds–that Akamai cache is on our internal network, but outside our firewall, so that’s why it’s not even faster. Let’s try another server (Diggnation podcast distribution server):

alex@tardis:/sata-raid5/downloads$ wget http://www.podtrac.com/pts/redirect.mov/bitcast-a.bitgravity.com/revision3/web/diggnation/0160/diggnation--0160--2008-07-24joshv--hd.h264.mov
--17:59:27--  http://www.podtrac.com/pts/redirect.mov/bitcast-a.bitgravity.com/revision3/web/diggnation/0160/diggnation--0160--2008-07-24joshv--hd.h264.mov
           => `diggnation--0160--2008-07-24joshv--hd.h264.mov'
Resolving www.podtrac.com... 69.16.233.67
Connecting to www.podtrac.com|69.16.233.67|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://bitcast-a.bitgravity.com/revision3/web/diggnation/0160/diggnation--0160--2008-07-24joshv--hd.h264.mov [following]
--17:59:27--  http://bitcast-a.bitgravity.com/revision3/web/diggnation/0160/diggnation--0160--2008-07-24joshv--hd.h264.mov
           => `diggnation--0160--2008-07-24joshv--hd.h264.mov'
Resolving bitcast-a.bitgravity.com... 208.67.237.237
Connecting to bitcast-a.bitgravity.com|208.67.237.237|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 716,434,724 (683M) [video/quicktime]

100%[=================================================================================>] 716,434,724    4.38M/s    ETA 00:00

18:02:21 (3.92 MB/s) - `diggnation--0160--2008-07-24joshv--hd.h264.mov' saved [716434724/716434724]

About 4MB/sec equals 32mbits/sec.

Of course there are a few problems with these tests. For one, it suffers from a pretty obvious selection bias: I purposely picked hosts that I knew ahead of time were fast enough to show off the network speed. But I think the question is not “How fast is the Case network on average” but “How fast can you make the Case network go?” The external hosts I tested are among the fastest I know of.

More information: Network traffic stats, contains near real-time information on network traffic as well as IP routing info, topology maps, etc.  Some links on that page may require a Case Network ID

Leave comments below

Popularity: 15% [?]

Google: Do you know how to do push? Do you know what an enterprise is?

All Posts No Comments »

You’d figure with all the Ph.D’s they have working at Google, they’d figure out a way to do push e-mail, calendaring, and contacts to the iPhone.  What was the last new big feature Google rolled out in Gmail?  IMAP?  A standard that’s been around for ages?

I can’t believe they’ve let Yahoo! take all the iPhone push e-mail glory for so long.  Where’s Google’s commitment to take the ‘world’s information and make it universally accessible and useful’ ?  There are over a million new iPhone 3Gs out there.  There are at least 6+ million first generation iPhones.  How close to Blackberry’s market penetration is Apple going to have to get before Google takes them seriously as a mobile platform?

I think it’s great that they’ve reformatted some of their pages to be iPhone compatible.  But, seriously, I think Gmail is so long overdue for new features, it’s almost a joke.  And don’t even get me started on Google Calendar and Google Apps.  How powerful of a service would it be to be able to say:

“OK, we, Google, are offering Google Apps for your domain, just as we always have.  But, we are now adding enterprise-level calendaring, e-mail, and contact management.  And, as a member of different Apps domains, you can have all your e-mail in one account.  You can see all your calendar events on one (or several) calendar layers.  You can push all your contacts, calendars, and e-mail to your Blackberry (maybe) or iPhone.  You can two-way sync with Outlook, Thunderbird, Mail.App, iCal, Address Book, Evolution, etc.”

That’s a Google world I hope to one day live in.

Popularity: 20% [?]

Now blogging from my iPhone

All Posts 4 Comments »

I’m testing out the new Wordpress app for the iPhone and it seems to work well for short posts. Unfortunately while setting it up it made a fake post that was distributed to email subscribers and then deleted.

Popularity: 17% [?]

iPhone day: The Full Story

All Posts, iPhone 2 Comments »

Release Day

Tommy and I were interviewed and photographed by the Plain Dealer. The PD also put us on the front page of the Business section. And, all of that caused us to be mentioned in the Case Daily (since we loudly mentioned our affiliation with Case to any reporter who talked to us).  We are also supposedly on WEWS, but I can’t find the video. I called my parents to TiVo it for me, so I’ll probably see it the next time I visit. Tommy and I are still shocked at the attention we got from this. We had such a great time sneaking around and getting our phones. The media attention is certainly the icing on the cake.

We were probably the first two people in Legacy to buy iPhone 3Gs. The three guys in front of us all had problems buying them (account issues, missed payments, etc). If you want to split hairs, I was the first person in Legacy to actually buy an iPhone 3G since my credit card processed faster than Tommy’s. But, he walked out of the store first, and that is why he got way more media attention than I did. So, I think he wins that one.

Here are some pictures and video of the whole event:

(I really encourage you to go to the Flickr set, where I have added comments, notes, and tags.)

iPhone Release DayiPhone Release DayiPhone Release DayOn the newsMVI_0024IMG_0010IMG_0011IMG_0012IMG_0015IMG_0016IMG_0019IMG_0020IMG_0021IMG_0029IMG_0030

Afterwards, we went back to our apartment where we slept the rest of the day and recovered from the festivities.

Uh-oh: how come my GPS isn’t working?

The next day I noticed I was no longer able to use any location-aware application.  Tommy joked it was from overuse and that the phone was just tired.  But it became clear that there was something wrong with it.  So, of course we went back to the Apple Store where, after trying some things and applying a software update that took forever, they replaced my phone free of charge.

Uh-oh: how come I don’t have any service?

So when they replaced my phone, they accidentally de-registered my SIM card, so we had to go to the nearby AT&T store to get it reactivated.  When that was done, my phone worked like a charm.

Thank You

I’d like to thank everyone that sent me messages about my appearances online and in print: Margaret, Lev, Neil, Krystin, and Sonia (I think that’s everyone).

I’d also like to thank everyone at the Apple Store who helped me out:
Francis, Jeremy, Gerry, Vince, and the guy who unboxed the phone for me: sorry buddy, I forget your name.  I was too busy playing with my phone.

Popularity: 20% [?]

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in