jump to navigation

What I’m working on January 15, 2008

Posted by gnukathryn in Scripting, Software, Terminal.
add a comment

I have two ongoing projects. I can only work on them in small chunks of time because of real life commitments. Both involve scripting.

My first project that seems to have been going on forever is writing a script that will let me listen to an entire genre of music in mplayer. I run mplayer from the command line. I can make a play list that will play an entire directory. But my music is arranged genre – artist – album – track. I create the playlist by doing a simple ls > playlist. Easy peasy. But if I try that in the top directory, it doesn’t work so well. Actually, it doesn’t work at all even if you recurse down the directory structure. mplayer wants full path names, not relative ones. So I was going to write a script that created the playlist file for me. But no, I get the bright idea to make this a lot harder than it has to be. I’m now trying to get the playlist built on the fly with options to choose which genre of music I want to listen to. My current (very broken) script can be found here. There is quite a bit of stuff commented out because it just doesn’t work.

My other project was inspired by a post on the wordpress.com forums. The basic question is how to figure out who are the most frequent commenters on your blog. You can get an xml dump of a wordpress.com blog. It shouldn’t (in theory) be too difficult to write something in perl or python that parses the xml and gives that information. I’ve never coded a line of perl or python in my life. So on some advice, I’ve decided on perl for this little project. I’m just trying to get the basics into my brain at the moment. That and I’ve been looking a bit a libraries for parsing xml in perl, but they’re just a bit out of reach right now.

Kernel Source as Your Screen Saver January 10, 2008

Posted by gnukathryn in Installing, Nifty!, Software, Terminal.
add a comment

I came across this blog post in one of the feeds I read daily. I thought it was cool and I wanted to share. It’s a way to use the Phosphor screen saver that comes with xscreensaver to display a random bit of the Linux kernel source.

I have to admit, I don’t use a screen saver. They drive me nuts. My screen powers down after 1 minute. And I like it that way. But this is cool enough and novel enough that I might try it, at least for a few days.

The directions are written for a Debian based system, so I’ll have to play around a bit and see if I can get it to work with Fedora. But everything seems bog standard. It uses a small program the author wrote to display the contents of a random file in a directory (this will also help me out in some scripting I’m doing for mplayer).

It of course assumes that you do have the xscreensaver package and said package contains the Phosphor screensaver.  It also assumes that you have the kernel source on your system as well.  It’s also necessary to compile the author’s program (which should only be `make` and `make install`).

If  I get this to work, I’ll definitely report back.  I’ll also report back on Argument Shuffle.

Making Predictions January 3, 2008

Posted by gnukathryn in BOINC, Scripting, Software, Terminal.
add a comment

Yeah, I’m a BOINC junky. I’ll admit it. I’m finding that scripting is exceedingly useful for stuff I used to pull out pencil and paper for. I’m not programmer. Heck, I’m not much of a scripter. I’ve written exactly five scripts and only three of them actually work the way I want them to. But hey, a gal has to start somewhere.

One of the questions I frequently ask myself is how long will it take me to reach X number of credits in a certain project given my current RAC (recent average credit). There are variations on the question, but they all boil down to the same basic formula. You take your goal and subtract the number of credits you currently have and then divide by your RAC. Or to put it another way, (goal-credits)/rac. Easy.

Now it may seem sort of dumb to write a script to figure this out. I mean, it’s just as quick to pull out my calculator or do it in my head. OK, maybe it’s faster than doing it in my head. But it does give me practice in scripting. And that’s the important thing.

So here you go. If you have suggestions for improvements please leave them in the comments. Enjoy!

Oh yes, and sorry about all the extra comment marks. My HTML is even worse than my scripting. Not having any blank lines was the only way I could get everything to show up in one code block and using pre tags cut off the far right side of the text.

#
#!/bin/bash
#
# Use to predict the number of days until
# a certain number of BOINC credits will be reached.
#
# See http://boinc.berkeley.edu/ for more information on BOINC.
#
# This script makes use of the calculator feature in Bash.
# Because Bash is only able to do integer math,
# all values must be rounded to the nearest whole number.
#
# Kathryn Marks
# <kathryn.boinc@gmail.com>
#
# Created: January 3, 2008
# Last Modified: January 3, 2008
#
#
# Define our variables
# CREDITS is the current number of credits for a project
# RAC is the recent average credit for a project
# GOAL is the number of credits you want
# DAYS is the number of days until $GOAL is reached
#
# Start by initializing the variables
#
CREDITS=0
RAC=0
GOAL=0
DAYS=0
#
# Remind the user to use only integer values for CREDITS, RAC and GOAL
#
echo " "
echo "It's very important that you only put in whole numbers."
echo " "
#
# Have the user input values for CREDIT, RAC and GOAL
#
echo -n "Enter the number of credits you currently have > "
read CREDITS
#
echo -n "Enter your RAC > "
read RAC
#
echo -n "Enter your credit goal > "
read GOAL
#
# Now calculate the value of DAYS
#
DAYS=$(((GOAL - CREDITS) / RAC))
#
# Display the value of DAYS in user friendly way
#
echo "It will be approximately $DAYS day(s) until you reach your goal of $GOAL credits."
#
# EOF

Notes to Self December 19, 2007

Posted by gnukathryn in BOINC, Fedora, Installing, RPM, Software, Terminal.
1 comment so far

I’m in the process of testing out a rpm for BOINC. Woo hoo!

Some notes to self:

  • After creating a tarball of one’s working install. One needs to move it somewhere for safe keeping. One’s data partition is a great place for said safe keeping. When one needs to move something to said partition, it helps if one mounts said partition before trying to move it. Somehow I think I now have a /Data directory hanging out somewhere. I’ll have to remove it once I find it.
  • rmdir only works on empty directories. If there are files in there, you have to use rm -r.
  • Using rm -r on a directory that has a metric ton of files takes a very long time because it runs in interactive mode. If one is really sure one wants to get rid of the whole thing, use rm -rf.
  • Once you remove a directory containing a file, the soft links pointing to said file break. And programs that need said link to file to function correctly will also break.
  • It is impossible to echo something > broken_soft_link_name. You must rm broken_soft_link_name first.
  • Wiping out a users home directory is a Bad Thing ®. Not having all the hidden config files causes Very Bad Things ® to happen, including not being able to access the account from the shell. Having a backup is a Good Thing ®. Knowing how to restore said backup is an Even Better Thing ®. And finding out that said restored backup works is an Extremely Good Thing ®.

.

Watch this space for further updates…

Edubuntu December 14, 2007

Posted by gnukathryn in Live CDs, Software, Ubuntu.
add a comment

I was looking through the search terms that brought folks to my ESL teaching blog. One really caught my eye. The person had searched for “linux esl game”. I thought that was really interesting. He/She didn’t find what he/she was looking for here. But it did inspire me to write this entry. And maybe the next person searching for something similar will give Edubuntu a whirl.

I had seen Edubuntu a while back. It’s a spin-off of Ubuntu. It’s aimed at teachers and students, but it would also work well in a home environment. It comes pre-packaged with educational games, the entire Open Office suite and a variety of other things. Because it’s built off of Ubuntu, it’s part of a well established community. I’ve found the Ubuntu forums to be very friendly to those just getting started and a treasure trove of information. The distro also has the advantage of frequent updates. Ubuntu and it’s derivatives work on a 6 month release cycle. The current version is 7.10, code named “Gutsy Gibbon”. Don’t you just love the code names???

The other advantage many Linux distros, including the *buntu family, have is the ability to run it off a “Live CD“. You basically just pop the CD in and reboot your computer. As long as you can boot from a CD, it will load up. It will run slower than if you actually installed it to your hard drive, but it does give you a feeling for what running a Linux distro is like.

I cut my Linux teeth on Ubuntu. I highly recommend it to anyone who’s interested in learning more about Linux. It has excellent hardware support. I started on 7.04 (Feisty Fawn). Aside from it not supporting my weird wide screen monitor’s resolution and a WPA encrypted wireless out of the box, it ‘Just Worked’. Although I’ve upgraded my install to 7.10, I haven’t played around with it much, so I’m not even sure if those minor issues have been resolved. I’m quite happy with Fedora 7 and I only keep Ubuntu around for fun or when I want to see the differences between a Debian based distro (which Ubuntu is) and a Red Hat based distro (which Fedora is). In all honesty, it might be perfectly realistic not to ever touch the command line (aka “the shell”) using a member of the *buntu family. I won’t lie, the shell can be more than a little intimidating. But for some things, it’s much quicker than pointing and clicking through a zillion menus. And let’s face it, kids are flexible. Using the shell is very much like speaking another language. Kids are wired to learn. They absorb new stuff like little sponges. That’s not to say an adult can’t do it. I’m certainly making headway.

I’ll leave you with a few screen shots of Edubuntu. Click the pictures for a full size version.

The Desktop

The Desktop

Nautilus File Browser

Nautilus File Browser

Kalzium

Kalzium

GCompris Math

GCompris Math