11:35:52 pm on 12/4/08
Menu
» Home
» About Scott
» Old Stuff
» Archive
» Contact

Writings
» MD Labels
» Streamrip
» AIM Thoughts
» WindowsXP?
» Partitioning
» CD/DVD Repair
» Monitor Info
» CRT Deflection
» Venomcrack
» Flash Thing
» Heart/Brain
» Triops

Friends


Archives
» November 2008
» October 2008
» September 2008
» September 2007
» December 2006
» August 2006
» January 2006
» December 2005
» August 2005
» July 2005
» June 2005
» May 2005
» April 2005
» March 2005
» February 2005
» January 2005
» December 2004
» November 2004
» October 2004
» September 2004
» August 2004
» July 2004
» June 2004
» May 2004
» April 2004
» March 2004
» February 2004
» January 2004
» December 2003
» November 2003
» October 2003
» September 2003
» August 2003
» July 2003
» June 2003
» May 2003
» April 2003
» March 2003
» February 2003
» January 2003
» December 2002
» November 2002
» October 2002
» September 2002
» June 2001

Enamored by a Past Life
Posted by
Scott on November 29th, 2008 at 10:44:30 AM | 908 words | No Comments »

I realize and accept the fact that I’ve been talking about the same thing the last several posts. I’ll mention it one more time, then let it go. I don’t know why I’m enamored by my past life - I guess I’m not realizing that I was “cool” in a way I never realized before. The irony of course is that this realization comes years after any coolness left. Now instead of fun times, computer jokes, and savvy programming projects, I’m stuck behind a laboratory bench performing monotonous research, studying for classes and exams I have absolutely zero interest in, and trying to stretch my imagination as far as I can to somehow pull my school and work to a level where I “need” to write software to accomplish it. It’s this constant tugging both toward, and away from, who I was several years ago. As I mentioned in the previous entry, I’m rebuilding both of my main PCs at my house (software-wise, at least). I rely on the no-ip DNS assistance client to give a domain name to my dynamic home IP address. (swharden.sytes.net always points to my home IP address, which right now happens to be 97.104.81.110) Although I don’t use my home system for serious web server purposes, I do connect to my home network from all over using SSH to access the linux terminal. I also run a small web server and torrent server to help share things now and then. Anyway, this is why I posted…

Whenever I download the No-IP DNS client utility, I stop and check out my little contribution to the project. There, on the support page, under client configuration, you can find The Newbie’s Guide to the No-IP™ Linux Client which is a guide I volunteered to contribute to the company several years ago. It won some award for the best entry and I received 2 years of a free domain name of my choice. Since I had nothing to lose (heck, it was free) I registered ScottIsHot.com (the former home of this very blog). When was that? [searches posts] Well, my Wonderful Days blog entry from OCT 2003 mentions the blog as 4 months old, so I’d guess ScottIsHot.com started around July of 03. I think it took half a year from my tutorial submission to my prize, so let’s assume I wrote it in late 2002. That’s 6 years ago? I was about 17 I guess. It was probably a short time after I wrote the entry I described in the previous post. Hey, going back to something I mentioned earlier…

Why isn’t the SSH server installed and activated by default in new Ubuntu installations? Maybe it’s some kind of security thing, who knows. The point I’m trying to get at is that, if I hadn’t been told about ssh years ago when I first began my venture into open source operating systems while running a FreeBSD webserver, would I have known about it now? Is SSH common knowledge? I use it multiple times daily - it’s critical to my needs! Since essentially everything in linux can be accomplished by the console, the ability to connect to my home linux PC’s console remotely from any other PC is incredibly valuable! I guess this is a message to anyone just starting out with linux. Learn to use SSH. Oh, and screen. Very nice =o)

As a closing note I thought I’d post a screenshot found on the Gentoo Linux website demonstrating what the desktop of a gentoo developer looks like. I noticed the wallpaper and, although it wasn’t not too surprising, I still got a chuckle from it. I still love the feel of a desktop with totally transparent borderless terminal windows, and the speed and responsiveness you get from a cut-the-crap window manager like FluxBox. Hey, a random thought popped in my head just now. I wonder if it reveals my psyche more than I can describe? My thought (unedited for logic or embarrassment and as pure as I can reconstruct it) was this (and I’ll use the fancy quotes):

“I wonder what it would feel like knowing that one day I would be lucky enough to be an active member of the development team for such an important project as FluxBox - wait, I have teeth cleanings to look forward to instead…”

Yeah, I know there are some logical arguments. Dentistry isn’t necessarily all or nothing. Just because I would be working as a dentist (not necessarily only cleaning teeth though) doesn’t mean I’d have to forgo my desire to be a part of something important. I guess it just means that any significant contributions are unlikely. After investing time in my family and my career, I doubt I’d have enough free time to be actively involved in any kind of meaningful open source project. Ever. [keels over; dies promptly]

» Be the first to comment!



Fixing Slow Internet in Ubuntu
Posted by
Scott on November 27th, 2008 at 12:22:18 AM | 468 words | No Comments »

I recently swapped my two main PCs in my house. The “headless” (no monitor) media PC (whose job consists of downloading, storing, and playing movies) connected directly to my TV, and our standard desktop PC which my wife uses most of the time. I decided to do the swap because the media PC was way nicer than our desktop PC, and since the media PC is just playing movies and downloading torrents, I figured the extra processing power / ram / video acceleration could be put to better use. Anyhow, I decided (in both cases) to completely start fresh by wiping hard drives clean and reinstalling Ubuntu linux (I’m using 8.10 currently). However, after the installation I noticed a peculiar problem. I’ll quote it to emphasize it…

Browsing the internet was very slow. When I’d click a link on a website, it would take several seconds before it seemed to even try to go to the next page. The same thing would happen if I manually typed-in a new website. I tried disabling IPv6 in firefox’s about:config and in the /etc/init.d/aliases file, but it didn’t help!

The solution for me was simple, and since I spent a lot of time searching forums I know I’m not the only one with this problem. Disabling IPv6 was suggested in 99% of similar posts. My solution took a while to uncover, so I figured I’d write it here. The basic problem is that my DHCP (auto-configured IP address) settings were screwed up, and my manually setting them I fixed the problem. Here’s what I did…

Start by right-clicking your network icon (wireless in my case) and selecting connection information

Check out your current configuration. Is a local address (192.168..*) set for the primary DNS server?* If so, that’s your problem! Note your secondary server. We’ll set it as your primary…

Continue by right-clicking your network icon (wireless in my case) and selecting edit connections. Open the tab corresponding to your internet connection (wired or wireless - wireless in my case), select your connection, and click Edit

Use this screen to manually enter the information from the information screen you saw earlier, but making sure not to list any local IP addresses as the DNS servers. Save your settings, close the windows, and the problem should be immediately corrected. Leave “search domains” blank, that’s important too. Good luck!!!

» Be the first to comment!



Is Descriptive Eloquence Inherited?
Posted by
Scott on November 24th, 2008 at 8:09:04 PM | 333 words | No Comments »

I’m quite proud of the general diction used through my blog. Although my brain can only recall exact phrases and ideas from recent entries, I think about my writing style (casual, yet indistinctly formal - a recipe for “intelligent” text?) and smile. I know I will always be imperfect, and surely there are numerous grammatical, spelling, and logic errors in my posts. Nonetheless, I’m proud of my work, and I’m very thankful that I have a quasi-organized, chronological, semi-continuous (and continuously backed-up) account of my thoughts going back to 2001, over 7 years ago! Although many of my current philosophies and views about life, love, and open source software remain the same, I’m evermore surprised at the stark contrast between my current ideology and the concepts expressed in some of my older writings (use Google to find my entry on “the corporation”, obviously written when I was irritated about someone - it’s about as anti-capitalistic as one could imagine!). I must digress; the only reason I wrote this entry tonight was to quote myself from October, 2002 (over 6 years ago - I just turned 17, and was a Jr. in high school). I was describing [in my mind what was a] catastrophic event: the accidental deletion of my file storage computer / web server’s entire hard drive. I’ll let the words speak for themselves.

“I am now in the process of trying to rebuild what I have lost. The many hours I have put into my websites has now deminished to nothing but some heat to be cast into the atmosphere by my heat sink.”

–Scott Harden (me) at age 17

How creative was I? Okay, so I was no Homer. Maybe I’m just being sentimental, but I still think that’s a beautiful over-literal description of how my life was deleted - “cast into the atmosphere by my heat sink” - it’s so cool! For those of you less computer savvy, a heat sink is what cools the main microchip in your computer.

» Be the first to comment!



Compress Strings and Store to Files in Python
Posted by
Scott on November 24th, 2008 at 5:48:16 PM | 223 words | No Comments »

While writing code for my graduate research thesis I came across the need to lightly compress a huge and complex variable (a massive 3D data array) and store it in a text file for later retrieval. I decided to use the zlib compression library because it’s open source and works pretty much on every platform. I ran into a snag for a while though, because whenever I loaded data from a text file it wouldn’t properly decompress. I fixed this problem by adding the “rb” to the open line, forcing python to read the text file as binary data rather than ascii data. Below is my code, written in two functions to save/load compressed string data to/from files in Python.

import zlib

def saveIt(data,fname):
    data=str(data)
    data=zlib.compress(data)
    f=open(fname,'wb')
    f.write(data)
    f.close()
    return

def openIt(fname,evaluate=True):
    f=open(fname,'rb')
    data=f.read()
    f.close()
    data=zlib.decompress(data)
    if evaluate: data=eval(data)
    return data

Oh yeah, don’t forget the evaluate option in the openIt function. If set to True (default), the returned variable will be an evaluated object. For example, “[[1,2],[3,4]]” will be returned as an actual 2D list, not just a string. How convenient is that?

» Be the first to comment!



Run Ubuntu Live CD From a USB Drive
Posted by
Scott on November 22nd, 2008 at 3:36:16 PM | 181 words | No Comments »

I accidentally nuked my laptop’s 80G hard drive this morning (D’OH!) while shuffling around partitions. Supposedly there’s a valid windows (XP) installation on there still that’s about 20G. I’d love to repair it so I can use it today while I’m in the confocal room, but I don’t have an Ubuntu CD, Windows CD, or any CD for that matter! I looked around, but I guess blank CD-Rs aren’t something that’s standard in molecular biology laboratories. Anyhow, I wanted to install the new Ubuntu 8.10 Linux distribution, and I’ve downloaded the ISO, but since I can’t find a CD to burn it to I decided to try booting from a USB drive (something I’ve never done before). I found an AWESOME program which specialized in putting ISO files onto bootable USB drives. It’s called UNetBootin and it’s free (of course), runs on Linux or Windows, and has some built-in options for various linux distributions. I can repair my PC now! Yay!

» Be the first to comment!



Linear Data Smoothing in Python
Posted by
Scott on November 17th, 2008 at 2:50:10 PM | 789 words | No Comments »

Here’s a scrumptious morsel of juicy python code for even the most stoic of scientists to get excited about. Granted, it’s a very simple concept and has surely been done countless times before, but there aren’t any good resources for this code on the internet. Since I had to write my own code to perform a variety of different linear 1-dimensional array data smoothing in python, I decided it would be nice to share it. At the bottom of this post you can see a PNG image which is the file output by the code listen even further below. If you copy/paste the code into an empty text file and run it in Python, it will generate the exact same PNG file (assuming you have pylab and numpy libraries configured).

### This is the Gaussian data smoothing function I wrote ###
def smoothListGaussian(list,degree=5):
    window=degree*2-1
    weight=numpy.array([1.0]*window)
    weightGauss=[]
    for i in range(window):
        i=i-degree+1
        frac=i/float(window)
        gauss=1/(numpy.exp((4*(frac))**2))
        weightGauss.append(gauss)
    weight=numpy.array(weightGauss)*weight
    smoothed=[0.0]*(len(list)-window)
    for i in range(len(smoothed)):
        smoothed[i]=sum(numpy.array(list[i:i+window])*weight)/sum(weight)
    return smoothed

Basically, you feed it a list (it doesn’t matter how long it is) and it will return a smoother version of the data. The Gaussian smoothing function I wrote is leagues better than a moving window average method, for reasons that are obvious when viewing the chart below. Surprisingly, the moving triangle method appears to be very similar to the Gaussian function at low degrees of spread. However, for huge numbers of data points, the Gaussian function should perform better.

### This is the code to produce the image displayed above ###
import pylab,numpy
  
def smoothList(list,strippedXs=False,degree=10):
    if strippedXs==True: return Xs[0:-(len(list)-(len(list)-degree+1))]
    smoothed=[0]*(len(list)-degree+1)
    for i in range(len(smoothed)):
        smoothed[i]=sum(list[i:i+degree])/float(degree)
    return smoothed

def smoothListTriangle(list,strippedXs=False,degree=5):
    weight=[]
    window=degree*2-1
    smoothed=[0.0]*(len(list)-window)
    for x in range(1,2*degree):weight.append(degree-abs(degree-x))
    w=numpy.array(weight)
    for i in range(len(smoothed)):
        smoothed[i]=sum(numpy.array(list[i:i+window])*w)/float(sum(w))
    return smoothed

def smoothListGaussian(list,strippedXs=False,degree=5):
    window=degree*2-1
    weight=numpy.array([1.0]*window)
    weightGauss=[]
    for i in range(window):
        i=i-degree+1
        frac=i/float(window)
        gauss=1/(numpy.exp((4*(frac))**2))
        weightGauss.append(gauss)
    weight=numpy.array(weightGauss)*weight
    smoothed=[0.0]*(len(list)-window)
    for i in range(len(smoothed)):
        smoothed[i]=sum(numpy.array(list[i:i+window])*weight)/sum(weight)
    return smoothed

### DUMMY DATA ###
data = [0]*30 #30 "0"s in a row
data[15]=1    #the middle one is "1"

### PLOT DIFFERENT SMOOTHING FUNCTIONS ###

pylab.figure(figsize=(550/80,700/80))
pylab.suptitle('1D Data Smoothing', fontsize=16)

pylab.subplot(4,1,1)
p1=pylab.plot(data,".k")
p1=pylab.plot(data,"-k")
a=pylab.axis()
pylab.axis([a[0],a[1],-.1,1.1])
pylab.text(2,.8,"raw data",fontsize=14)

pylab.subplot(4,1,2)
p1=pylab.plot(smoothList(data),".k")
p1=pylab.plot(smoothList(data),"-k")
a=pylab.axis()
pylab.axis([a[0],a[1],-.1,.4])
pylab.text(2,.3,"moving window average",fontsize=14)

pylab.subplot(4,1,3)
p1=pylab.plot(smoothListTriangle(data),".k")
p1=pylab.plot(smoothListTriangle(data),"-k")
pylab.axis([a[0],a[1],-.1,.4])
pylab.text(2,.3,"moving triangle",fontsize=14)

pylab.subplot(4,1,4)
p1=pylab.plot(smoothListGaussian(data),".k")
p1=pylab.plot(smoothListGaussian(data),"-k")
pylab.axis([a[0],a[1],-.1,.4])
pylab.text(2,.3,"moving gaussian",fontsize=14)

#pylab.show()
pylab.savefig("smooth.png",dpi=80)

Hey, I had a great idea, why don’t I test it on some of my own data? Due to the fact that I don’t want the details of my thesis work getting out onto the internet too early, I can’t reveal exactly what this data is from. It will suffice to say that it’s fractional density of neurite coverage in thick muscle tissue. Anyhow, this data is wild and in desperate need of some smoothing. Below is a visual representation of the differences in the methods of smoothing. Yayness! I like the gaussian function the best.

I should note that the degree of window coverage for the moving window average, moving triangle, and gaussian functions are 10, 5, and 5 respectively. Also note that (due to the handling of the “degree” variable between the different functions) the actual number of data points assessed in these three functions are 10, 9, and 9 respectively. The degree for the last two functions represents “spread” from each point, whereas the first one represents the total number of points to be averaged for the moving average. Enjoy.

» Be the first to comment!



Free Damask Seamless Tiling Backgrounds
Posted by
Scott on November 16th, 2008 at 11:47:43 PM | 289 words | No Comments »

If you’re in the mood for some 18′th century textile patterns you’ve stumbled upon the right place! Surprisingly, it’s incredibly difficult to find functional (seamless, tiling, free) damask-style patterns on the internet. If you don’t believe me, just Google / image search for it! It took me over an hour to find a functional pattern that tiled properly. Actually, to correct myself there, the image I downloaded didn’t even tile correctly!!! I had to manually modify it to make it seamless. So, free for all website makers, webmasters, wallpaper collectors, and Louis XVI enthusiasts: I give you a plethora of different colors of damask-style tiling backgrounds for whatever you want to do with it!

» Be the first to comment!



« Previous Entries |
copyright © 2006 swharden@gmail.com