Really cool remote file copying trick

So I was trying to copy a really huge (about 4 gigs) file from my laptop up to my web server, using a simple and standard command:

scp local_file_name username@remoteserver.com:remote_file_name

When I got about 10% through, I began to worry what would happen if the transfer failed somewhere way down the line. (It claimed it would take 4 and a half hours.) So I googled “scp resume” to see if there was anything to be done. Sure enough, I found several blog posts suggesting this command:

rsync --partial --progress --rsh=ssh local_file_name username@remosthost.com:remote_file_name

So, worried to potentially waste a bunch of time if the scp failed at 95% or something, I just canceled it and expected to have to re-do the 10% that was already done.

The coolest part? The canceled scp left the portion of the file already transfered, and the new rsync command was happy to resume that transfer.

So it’s not only a resume-friendly alternative to scp, it’s actually a rescue method for failed scp transfers. Cool!



CodeIgniter View Hack

I ran into what seems like it might a bug in CodeIgniter’s view loading. (Specifically in the extraction of a data array into the local scope for that view.) I had pulled out a piece of HTML that was repeated a lot into a separate view file in order to call it more easily in the main view file. The data array I was passing in had certain keys that were sometimes present, sometimes not present. I discovered that if I called the view once when the keys were present, and then a second time when the keys were not present, rather than seeing no value for the keys (the expected result), the view saw the values from the previous call. My eventual soultion was to replace my view loading line $this->load->view('view_name', $data); with $this->load->view('view_name',Array('d'=>$data)); Loading the view in this second method meant CodeIgniter was only extracting one symbol ($d) into the global sope of the view I was loading. Since this symbol got replaced on every call, my problem went away. The kinda-lame part, however, is that the view now needs to reference pieces of data as $d['piece_of_data'] instead of simply $piece_of_data



MAMP default MySQL password

I decided to try using MAMP for a development project I’m working on, instead of fooling around with remotely editing files on a web server, and instead of manually configuring Apache, MySQL and PHP on OSX. It’s super easy to set up and the workflow is much more smooth than trying to do some kind of networked drive setup, which is how I’ve usually done development in the past.

The one issue I had was figuring out the default MySQL password.

Here they are:
username: root
password: root

Pretty easy!



ssh on OSX

I’ve had trouble for ages now with ssh freezing or locking up after being idle for a few minutes. This became especially problematic in the past few days because I’ve needed to use it as a tunnel to access some remote resources on a server I’m working with.

Well, thankfully I found a quick solution:

I just opened up the file ~/.ssh/config in an editor and added this line:

ServerAliveInterval=15

I say added, but in fact this is the only line in the file. This tells ssh to ping the server if it hasn’t heard anything for 15 seconds, and it has completely solved my problem. There’s a pretty good, more in-depth explanation at http://tr.im/rPq8



Hi World

Just a quick jot to get this blog started in the middle of the night. (Of course.) I’m thinking I’ll turn it into a video-centric blog about my job hunting experience. Interviews with the people I meet, etc…

Yesh?

Looking into cameras, and more importantly into whether I think I can keep up an interviewing schedule that would be at all interesting to people…



Me on a beautiful early spring day in Napa, in a field of mustard.

Steven Lybeck


  • ph: 415.830.3274

  • View Steven Lybeck's profile on LinkedIn
  • My status