Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

Wednesday, October 31, 2007

e3 Editor and MTX

In my CPT S 560 course, the students are currently working with KC to port the e3 text editor to MTX. Right now, I'm working on writing a version of ioctl that can be used with the MTX kernel. To view my progress, you can check out my e3 Editor Google Notebook.

This and more at Dupyshon.com

Friday, September 28, 2007

Software for My Finances

I really want to become better at budgeting my money and tracking expenditures, and I'm looking for some software that will help me do that. It needs to support multiple accounts, give me reports about my spending, and be simple use. There are lots of products out there that fit this description, but here's a catch - I also want it to be a cross-platform application since I am always switching among my Mac, Windows, and Linux OS's. Also, (and this is just the computer guy in me talking) I want it to be free and open source. Does anyone know of a piece of software that fits this description? After some searching, I think I might need to develop my own program that fits this description. It could be a big project, though. One idea is to create a server application that I could access remotely via a secure web connection. That way, I could balance my checkbook from anywhere in the world.

Thursday, September 20, 2007

rsync

I've just discovered the power of rsync, a Linux utility that allows you to synchronize files on different computers via SSH. This is exactly what I've been looking for because I need a safe and secure yet easily accessible way to store my files for my CPT S 560 class. Here's a quick summary of the command:


To download changes from a remote location -
rsync -ave ssh --delete user@server:folder path

To upload changes to a remote location -
rsync -ave ssh --delete folder user@server:path

The --delete option takes care of files that have been deleted from the source by also deleting them from the destination.

The folder argument specifies the source folder to be transferred. If this argument ends in a trailing slash (/), only the contents of the folder are copied. If there is no trailing slash, the folder is copied along with its contents.

The path argument is the destination to which the files are to be copied.

Tuesday, September 18, 2007

fdisk

I'm writing an fdisk program for my CPT S 560 class right now. An interesting thing I've found is that it only works correctly if I have superuser privileges. At first I thought this was just a mistake in my program, but a non-root shell doesn't even recognize the fdisk command in KDE.

Tuesday, August 7, 2007

getopt Keeps Internal State

Here's the solution to a problem that's been bothering me at work for two days now:

If you want to use getopt more than once within a program, across different inputs, you'll need to reset its internal state counters before each use:

printf("%d %d %d\n",optind,opterr,optopt);
... do getopt stuff ...
printf("%d %d %d\n",optind,opterr,optopt);

This outputs the following:

1 1 63
3 1 63

the '3' in my case is because I only had one option + parameter (+ program name == 3).

So, if you reset optind, opterr and optopt to 1, 1 and 63, before each new use of getopt, you should be fine.

-- Courtesy of DanielLawson and the Waikato Linux Users Group

Friday, August 3, 2007

Unit Testing

I started unit testing for my project at work today. A unit test is a program that goes through your program line-by-line, following every branch and conditional. Unit tests aren't simple to write, especially when you're trying to cover unusual conditions or large functions. I was dreading these tests, but they've actually been really fun so far. I think it's because I'm no longer just reading code or translating it. I'm actually writing it from scratch. I have much more freedom, plus it's kind of like a game to try to get 100% coverage of the code. Maybe I'll get sick of it in a while, but for now I'm enjoying it a lot. For my next project, I'd like to try writing the unit tests as I develop the code. That's more of an extreme programming approach.