Ubuntu on Sharp Actius PC-MM20 Laptop
Posted by adam in Interesting
I’ve had an old Sharp Actius PC-MM20 I bought from EmperorLinux a while back. It’s a bit underpowered by today’s standards, but at less than two pounds it is still a handy coffee shop companion. EmperorLinux installed Fedora Core 2 at the factory and got the thing to boot, but sleep/hibernate, direct rendering (fast 3D) and wireless were always spotty at best. Lately the ethernet card stopped working.
I decided to try reinstalling the operating system it came packaged with (Windows XP, I think). But first I tried Ubuntu 7.04, just for fun. Most everything worked right out of the box! Sleep, hibernate, direct rendering, etc. For wireless I did have to use ndiswrapper, which took an extra half-hour to set up.
So there you go: this is hopefully the shortest “Linux-on-laptop” install guide ever. Insert CD, follow prompts, enjoy.
recursively grep only certain files
Posted by adam in Interesting
Here’s a grep hint. Say you want to recursively search a directory tree for C source code containing a particular header inclusion. One might do:
find . -type f -name '*.c' -print0 \\ | xargs -0 grep -P -H '^#include\\s+<rpc'
But with grep it is possible to limit the files searched, like so:
grep --include=*.c -P -r '^#include\\s+<rpc' .
Arguments to find, explained:
find .means to search the current dir and subdirs-type flimits search to files, not directories or other file types-name '*.c'limits search to files ending in.c. Notice the non-regex syntax here!-print0sends results to standard output delimited by null characters. This adds robustness when we pipe toxargs, since filenames cannot contain null characters.
And yes, xargs is neat. The only argument used is the -0 to accept null-delimited input. Now on to grep…
-Pspecifies that Perl-compatible regular expressions should be used. This didn’t work on Ubuntu last time I tried.-Hmeans to always print filenames, even if only one file is being grepped-rtells grep to descend into all subdirs- in the second
grepcommand line,--include='*.c'says to only look inside files ending with the name.c. Notice the alternate pattern syntax here. Ugh! - in the second
grepcommand line, the last (required!) argument is the names of the directories in which to recurse.
Try An Active Vacation
Posted by adam in Fun, Life
If this doesn’t make you wanna get outside, I don’t know what does! Going for a hike or bike ride is much like a mini-vacation. Here are some ways to have a “real” vacation with a focus on outdoor adventure:
Don’t Bother With LaTeX
Posted by adam in Odd
The biggest problem I see with elegant, declarative markup languages like LaTeX is that, in a nutshell, relatively few people know how to use them. Collaboration often requires the lowest common denominator, and that means a document editor like OpenOffice.org Writer.
But LaTeX is fun. It is always consistent. The final result is beautiful. Since you are editing source code (unless you use LyX), you have complete control over the final document. Ideally, you forget about trying to bold this, indent that and focus instead on the content of what you write.
I can’t help it, I find myself using LaTeX for more and more documents. What the heck is wrong with me?
It is possible when using Writer to keep your document clean and simple, use styles profusely, and focus mostly on content, only dipping into presentation at one time, and some people do in fact do this.
Python Gotcha: Class vs. Attribute data
Posted by adam in Interesting
class MyClass(object):
myVar = None
myArr = ['default']
m = MyClass()
m.myVar = 28
m.myArr.append('foo')
print 'CLASS\t\tmyVar: %s\tmyArr: %s' % (MyClass.myVar, MyClass.myArr)
print 'INSTANCE\tmyVar: %s\tmyArr: %s' % (m.myVar, m.myArr)
What is the output?
Mountain Climbing: Fun Facts
Posted by adam in Fun, Interesting, Life, Odd
Mount Rainier is the 5th highest mountain in the contiguous United States. Mount Whitney is the highest.
From this Forbes article on Everest deaths: one in ten mountain climbers die trying to summit, and those who successfully summit have a one in twenty chance of dying on the way down.
Humans living in higher altitudes acclimatize by increasing the number of red blood cells, thereby increasing the capacity for oxygen and carbon dioxide movement within the body.
Fun facts were inspired by a recent Mount Adams climb.