Tuesday, September 29, 2009

SCP over SSH

I was asked by a special someone to convert a DV tape into digital format at the ETC. So I did.

The resulting file was a 9.35 GB Quicktime movie. Of course, I didn't at all think about how I was going to transfer such a large file off of the ETC computer.
  1. I captured it in Premiere Pro, which apparently cannot save to anything other than Quicktime format, nor does the ETC have any compression programs on their computers.
  2. I did not have my flash drive with me (which wouldn't have mattered since it's way too small.
  3. I did not have my laptop on me to transfer the file to.
  4. The only external hard drive the ETC has was checked out and overdue.
  5. I couldn't scp the file from the Mac to my computer, because for some unknown reason, I could not establish an ssh connection with it.


So what was I to do? I had exhausted all the file transfer possibilities I could think of. I decided to experiment a bit more and found out that, lo and behold, I could ssh into Matthew! Now, why I could ssh into my CSE account on Matthew but not into my personal computer is beyond me. I know I didn't leave my computer in Windows, and sshd should be running...so I checked. I ssh'ed from Matthew to my computer just fine! In fact, I even ended up SSHing to Matthew with X-forwarding and then setting up a VNC connection to my desktop. It worked.

This went to prove that I was in fact able to transfer information from the ETC computer to my desktop, via Matthew. But how to transfer a 9+ GB file? I did some testing and then tried this experiment:

First, I created the most simple Perl script oProxy-Connection: keep-alive
Cache-Control: max-age=0

20my desktop:
#!/usr/bin/perl
print while (<>);

It just spits out everything that is fed to it. Then I invoked this script by SSHing to Matthew, passing it a command to SSH to my desktop and execute the script, redirecting the standard output to a file on my desktop. I typed in a few lines of text and then sent ^D. I checked the file on my desktop, and it worked! This means I can utilize this system to transfer arbitrarily large files over SSH. I first had to enable passwordless logins from the ETC computer, and then I set it to work...

$ ls -lh Movie.mov
-rw-r--r--@ 1 etcmedia staff 9.4G Sep 29 16:04 MovieProxy-Connection: keep-alive
Cache-Control: max-age=0

ov
$ cat Movie.mov | ssh -C jdenardo@matthew.cse.taylor.edu \
"ssh jdenardo@10.103.200.29 \"/home/jdenardo/transfer.pl > \
/mnt/storage/Movie.mov\""

A few minutes later, the command finished, and I checked the MD5 checksums of the input and output files:

MD5 (Movie.mov) = ed889ff1879832e46c9d6e68fd56657a
ed889ff1879832e46c9d6e68fd56657a Movie.mov

...they match! Despite not being able to directly SSH to my desktop, I was able to set up a route through another computer on the LAN and copy files! As a bonus, it was all done securely! This is certain

Wednesday, September 9, 2009

clips Gentoo ebuild

I needed the CLIPS platform for one of my AI classes, and of course it doesn't appear to exist in Portage. (Even trying to find the correct Linux source code is a nightmare with the way they have it organized on Sourceforge.)

So I found someone else's ebuild, made a small modification, and voila! It's now in my local repository:

> su
> mkdir -p /usr/local/portage/sci-misc/clips
> cd /usr/local/portage/sci-misc/clips
> wget http://cse.taylor.edu/~jdenardo/clips-2.64.ebuild
> ebuild clips-2.64.ebuild manifest
> emerge -a clips

This will build two executables, clips and xclips. And, it even builds on ~amd64 with no problem!

Tuesday, September 8, 2009

Poetry

I don't feel inspired to write poetry anymore. In everything there is a silver lining...

Wednesday, August 26, 2009

Awake

So, it's about time I reviewed Skillet's latest album, Awake. I pre-ordered it a long time ago, and it arrived last Monday. I listened to it once Monday, about 7-8 times on Tuesday, and then another 3-4 times today. (By contrast, I have listened to Comatose hundreds of times in the last three years.)

First, a few notable songs that stand out to me, good or bad:


Hero - Skillet's first single from this album. I was able to download it when I pre-ordered, and I fell in love with it instantly. The lyrics and the music are very powerful. This is exactly what I expect to hear when I listen to Skillet. Hero features Jen's vocals, which I was very pleased to hear. John is a really good (albeit a bit scratchy) vocalist, but a touch of female vocals always goes a long way.

Monster - The second released single. At first, I thought it sounded an awful like like something TFK would do, and I didn't particularly like it so much. The "growl" midway through the song salvaged the whole thing, and it only took a few listens before I grew very accustomed to it, and I now like the whole thing (growl and all).

Awake and Alive - Now this is what I love to hear. I was just as amazed listening to this song as I was when I first heard Comatose. The strings are absolutely incredible, and it's a for sure hit at their live concert. Great to sing along to, and it occasionally gives me shivers. Again, Jen sings in this song, and it adds a lot.

Should've When You Could've - I wasn't so sure of this song when I first heard it. The lyrics are very high-school-breakup-ish, and the music and words are quite repetitive. I found that it easily got stuck in my head, and I didn't want it stuck in my head (unlike every song on Comatose, which I thoroughly enjoy when they get stuck in my head).

Believe - Also a relationship-breakup-ish kind of song (-5 points), but the chord/key progression saves it (+15 points). Not that this is a bad thing, the opening guitar strumming is uncannily similar to Three Days Grace (particularly Never Too Late from One-X).

Forgiven - Musically, not as unique as some of their other songs, but lyrically, very powerful. It has the power to speak for every person on the planet, and is basically worship to God. I love songs like this.

Sometimes - Much harder song, though not in the same vein as previous hard-rock songs like Savior or Better Than Drugs. It sounds much darker, and the lyrics follow the same style. They are actually kind of depressing, so I'll be interested to learn more about it and hopefully gain a new appreciation for the lyrics in the future.

Dead Inside - The first of two "bonus" tracks on the deluxe version, I am surprised they left it off the regular album. Both of them are excellent songs, this one in particular featuring powerful lyrics, excellent supporting string usage, and more prominent guitar riffs.

Would It Matter - Another excellent bonus song! Frankly, I think John's vocals are best on this song over every other. It's a typical bridge between rock and soft/melodic sounding, but it really gives his voice a chance to shine.



So far, I can't say I'm as impressed with Awake as I was with Comatose. With Comatose, I literally liked every single song and could stand listening to every songs a few hundred times, not to mention that most of the album was spent in worship. My overall impression of Awake is that it's less focused on worshiping God but more focused on emo/relationships. I count roughly 4, maybe 5 songs on Awake that can be attributed as some form of worship (Hero, One Day Too Late, Forgiven, Dead Inside, and maybe Never Surrender)--less than half, whereas on Comatose, I count 6 or 7. I feel like Skillet has strayed a little from this focus, especially when I hear songs like Should've When You Could've and It's Not Me It's You.

I also feel like this album is less personal than I would like, but I could be very wrong. I wish that Skillet would do an interview for someone and explain the motivation behind all of their songs...that would definitely help me to appreciate some of the lyrics more.

Musically, it's also somewhat less satisfying than I would have hoped, but I did listen to it a dozen times in two days and am very very pleased with it. I am not at all disappointed...maybe I just set my hopes impossibly high. I was hoping they would do more with strings, but I will settle for Awake and Alive as my goosebump-inducing song. I was also hoping for more harder rock, but not quite as dark sounding as Monster and Sometimes.

At any rate, I am very pleased with Awake, and I would highly recommend it to every single soul who can take a little rock in their diet! I'm super excited for the concert...I still set my hopes high for that...September 24! I can only imagine what some of these will sound like live.


Collide: 8 / 10
Comatose: 10 / 10
Awake: 8.5 / 10

Monday, August 24, 2009

TF2

I must have played a dozen games and have lost every single freaking one, sometimes leading my team. I was also told today that I can't move into the dorm until next Sunday, after I was promised to be able to move in tomorrow. Exceptions can be made for other people who DON'T have a job and who DO have another place to stay, but not for me. My hall director shafted me the same way last year when I had an on-campus job and nowhere to live. You'd think that a Christian university would be all about providing shelter to the "homeless" and extending grace and kindness to those who need it, but no, we don't believe in such nonsense.

What an awful way to start the week.

Wednesday, August 19, 2009

Ruby's Complement Operator

So I was doing stuff with bits today and needed to do a bitwise complement. As it seems, Ruby's Fixnum complement operator (~) doesn't actually do bitwise complement. Working with Ruby 1.8.7 on a 32-bit machine, I get the following things:

irb(main):002:0> a=5
=> 5
irb(main):003:0> a.to_s(2)
=> "101"
irb(main):004:0> a.size
=> 4

This tells us that the binary representation of 5 is 101, and that Fixnums are 4 bytes long. Suppose we want to take the bitwise complement of 5. We would expect, for a 32-bit signed integer, that
~5 = ~101
= ~00000000 00000000 00000000 00000101
= 11111111 11111111 11111111 11111010
= -6

Indeed, we see that ~5 = -6, as Ruby shows:

irb(main):005:0> ~a
=> -6

However, when we look at the binary, we see a completely different binary representation:

irb(main):006:0> (~a).to_s(2)
=> "-110"
irb(main):007:0> (-6).to_s(2)
=> "-110"

Indeed, what we see here is not at all a 32-bit two's complement representation of -6, but we see the number 6 (110) with a negative sign in front of it! Apparently, Ruby stores signed integers up to 31 bits, but does not use that last bit for the sign! Instead, it stores the sign separate from the magnitude. So Ruby says, "take the number 6, make a binary representation of it, and then stick a minus sign in front of it to make it negative"...not the universal binary representation you would expect from any other (good) language.

Thus, the ~ operator in Ruby means {-x - 1} instead of {~x}. If a programmer wanted {-x - 1}, he would just write that! It's so rarely needed (in my experience) that it does not make sense to have an operator for it! But if a programmer needs to work with bits in Ruby (which is much more common), he is left without a suitable bitwise complement operator. You could implement something like this:

class Fixnum
def ~
self ^ ((1 << 32) - 1)
end
end

...and you would get (~5).to_s(2) => 11111111 11111111 11111111 11111010, but this is no longer equal to -6. Since it has overflowed 31 bits, it was automatically converted into a Bignum and now represents 4294967290.

Once again, Ruby has taken something that every other language has and removed it by design. For bit manipulation, use C. For string processing, use Perl. For websites and/or database access, use PHP. For passing around arbitrary blocks of code and not knowing what type your variables are, use Ruby.
</RANT>

Tuesday, August 18, 2009

More Things To Put On My List


  1. Been in New Jersey
  2. Visited a high security facility
  3. Seen the Liberty Bell
  4. Ate a $50+ meal (French Thai Cuisine)
  5. Ate raw fish (and other sushi)