I'm glad that you asked. Ogg Vorbis is a format for music files like MP3. In many ways, I think that Ogg Vorbis is better. It produces higher quality output at a lower bit rate than MP3's. This means Ogg Vorbis files sound better and are smaller than MP3 files. In addition, Ogg Vobis is an open format and it uses open source software. This means that if you wanted to create an Ogg Vorbis player, or write a program that uses Ogg Vorbis, you don't need to pay any licensing fees on the technology. The MP3 format is patented by a German company (Fraunhofer Society) and they charge licensing fees to use it.
So, why isn't it more popular you may ask? I think it all comes down to timing. Ogg Vorbis was introduced much later than MP3, and several MP3 codecs have been released as free software for individual use. I'm hoping that Ogg Vorbis will gain momentum and eventually win out.
If you are interested in free and open audio compression you might also want to check out the Free Lossless Audio Codec (FLAC). The is no degradation to the quality of the sound and it is free and open like Ogg Vorbis.
Tuesday, January 23, 2007
Wednesday, January 10, 2007
Simulating classes in C
I have to admit, I like to program in C. In some ways, it is simpler than some of the newer, high level languages, and I really enjoy being closer to the machine code. Perhaps I'm a bit obsessive about efficiency. Still, I sometimes long for classes and objects in my C programs, (This is where you tell me that I should use C++ or Objective-C.) so I decided to figure out how I could simulate classes in plain old ANSI C.
It turned out to be quite easy. After I read up on function pointers, I created a struct which contains references to functions (kind of like class methods). Here's a simple example of what I'm talking about:
When I run the above, the program prints "thefunction says 7".
From there, I decided to create a family of structures which would simulate classes, objects, and allow polymorphic function calls.
One way to divide up data and methods in an OO way is to say that the class dictates the methods which can be used with the data in an object instance. So we could say that a class contains a list of functions. Using function pointers, the method called can be changed at runtime, as long as all of the functions have the same stack profile. Have I lost you yet? So what I needed to do was create a generic function prototype which abstracts the parameter list into a common format. While I was at it, I decided to lose the restriction that methods return only one value, so the results of a method call will be stored in a structure which is passed in as a parameter. (The method should probably be called a procedure instead of a function.) Perhaps it would be simpler to show you the code.
I was going to discuss the functions I created to streamline "class" method invocation, but this post is getting a bit long. So I've decided to try something fun. I'm going to ask you, gentle reader, to suggest a design for a function which simplifies invocation of an object method. I will mail $1 (USD) to the person who posts the "best" working solution in the comments below. (I'll be compiling using gcc -ansi. Oh, and US residents only, I don't want to run into any strange rules.). In addition to a dollar, you'll have won bragging rights for the first of my blog challenges. After a week or two, I'll post my solution and we can all compare notes. Happy coding!
It turned out to be quite easy. After I read up on function pointers, I created a struct which contains references to functions (kind of like class methods). Here's a simple example of what I'm talking about:
#include<stdio.h>
typedef struct {
int (*test)(int); /* This is the function pointer */
} functionholder;
/* At runtime, I will point to this function */
int thefunction(int x) {
printf("thefunction says %i\n", x);
return 0;
}
int main() {
functionholder fholder;
fholder.test = &thefunction;
(*fholder.test)(7);
return 0;
}
When I run the above, the program prints "thefunction says 7".
From there, I decided to create a family of structures which would simulate classes, objects, and allow polymorphic function calls.
One way to divide up data and methods in an OO way is to say that the class dictates the methods which can be used with the data in an object instance. So we could say that a class contains a list of functions. Using function pointers, the method called can be changed at runtime, as long as all of the functions have the same stack profile. Have I lost you yet? So what I needed to do was create a generic function prototype which abstracts the parameter list into a common format. While I was at it, I decided to lose the restriction that methods return only one value, so the results of a method call will be stored in a structure which is passed in as a parameter. (The method should probably be called a procedure instead of a function.) Perhaps it would be simpler to show you the code.
typedef struct {
void* type; /* This will point to a JSClass. */
void* data;
} JSObject;
typedef struct {
int object_count; /* number of objects in the array */
JSObject** objects; /* An array of pointers to JSObjects */
} JSListOfObjects;
typedef struct {
char* name;
/* Each JSClass contains a list of pointers to the methods which belong
* to that class. */
int method_count;
/* strings naming the functions (allow method lookup by string) */
char **method_names;
/* An array of pointers to functions */
void (**methods)(JSObject* x, JSListOfObjects* y, JSListOfObjects* z);
} JSClass;
I was going to discuss the functions I created to streamline "class" method invocation, but this post is getting a bit long. So I've decided to try something fun. I'm going to ask you, gentle reader, to suggest a design for a function which simplifies invocation of an object method. I will mail $1 (USD) to the person who posts the "best" working solution in the comments below. (I'll be compiling using gcc -ansi. Oh, and US residents only, I don't want to run into any strange rules.). In addition to a dollar, you'll have won bragging rights for the first of my blog challenges. After a week or two, I'll post my solution and we can all compare notes. Happy coding!
Labels:
c,
code,
object oriented,
programming
Saturday, January 06, 2007
A Clockwork Orange
I just finished reading A Clockwork Orange by Anthony Burgess and I would recommend it. If you decide to read it, be prepared for a rip roaring ride of emotions and strange slovos (words). At times, it can be difficult to stomach and after the second chapter, I was ready for the main character to be killed off. (I'd have tolchoked his merzky litso all on my oddy knocky, oh my brothers, 'til the krovvy flowed real horrorshow and his zoobies come all out.) There are some comic moments, (it can be a malankey bit silly) but at it's core, this book explores the deep topics of morality and free will (and all that cal). I've never viddied the movie, but I tend to think that it wouldn't come off so well. Some things just work better in print.
Labels:
books,
liturature,
nadsat,
scifi
Monday, December 04, 2006
Wii have a Wii

This weekend my wife and I joined some friends to wait in line to buy a Nintendo Wii. My friend m3tus had a hot tip that the local Circuit City had exactly 27 units which they were going to sell on Sunday morning. Vanessa and I arrived at 2:30 AM for place number 18 in line. (Two friends of ours had arrived earlier.) It was quite cold, but we came prepared with a tent, sleeping bags, camp chairs, and quite a few layers of clothes. We even managed to catch some zzz's in the wee (wii?) hours of the morning. I think line member number 27 arrived at 4:30. He almost left, but Vanessa told him that the two of us were only getting one, so he would be the last to get one.A couple of trips to a 24 hour Safeway and a nap later, some of the Circuit city employees arrived to hand out vouchers. I think it was around 8:00 AM (the store opens at 10:00). We packed up our gear and hit Denny's! Ah sweet food.
We returned to the store to find a long line of customers all waiting to get a Wii and Wii accessories. Some employees announced that they had already given out vouchers, and that all ticket holders should move to the front and form their own line. They called out tickets in order and we paid for our Wiis. My friend m3tus wanted to make sure that no one tried to take his. So he claimed it the old fashioned way and licked it! This would have made a great picture, I wish I had known he was going to do it. The whole line had a good laugh. Then it was time to head home and get some proper sleep. Are we getting too old for this?
Wednesday, November 29, 2006
Pomegranates!

A couple of weeks ago I had a pomegranate for the first time. Eating it was quite an intricate task, made all the more so by the challenge in keeping pomegranate juice off of my clean white shirt. (It's a new favorite of mine and states proudly "Debugging Sucks. Testing Rocks.", but I digress.) If you have the chance to try one, do it! I've never eaten anything quite like it. I think I would describe the inside as if someone shrank red (seeded) grapes and made the grow on the inner wall of a squash. Check out the pictures.
Wednesday, November 01, 2006
A Steganography Scheme - Part 2
My text based steganography program is here! I completed the program yesterday, and Vanessa came up with a great name: Steganosaurus. Get in touch with me if you would like me to send you the program and the source code. I'm still considering publishing it on an open source hosting site.
You may recall my previous post about this steganography scheme, and I said I would tell you how it all works. So here goes:
My steganography program needs 4 pieces of information to embed or extract a secret message, it needs a file which will be converted, the base, the shift value, and a filename to which the converted message will be stored. The base and shift need a bit of explanation.
Base: All data on a computer is a number, and a number can be expressed multiple ways. I wrote about this in "A Steganography Scheme - Part 1". So the base tells Steganosaurus how to express the data. Should each number in the source file be converted into a series of values between 0-10, 0-50, 0-200? The choice is yours.
Shift: My program outputs a range of values from the source file, and each of them is between 0 and Base. How does this become readable text? That is the purpose of the shift, it is a value added to each piece of the converted file to make it into a character. So the result of the whole process is the contents of the original file expressed as numbers in the range Shift to Base + Shift. These numbers are converted into Unicode characters (UTF-8) so the end result is a readable file. You can see an example in my wiki entry about Steganosaurus. (It's probably easiest to see an example.) By using different shift values, you can hide the data from your original file in text from any language in the world.
So check it out, give it a shot, and ask me to send Steganosaurus to you.
You may recall my previous post about this steganography scheme, and I said I would tell you how it all works. So here goes:
My steganography program needs 4 pieces of information to embed or extract a secret message, it needs a file which will be converted, the base, the shift value, and a filename to which the converted message will be stored. The base and shift need a bit of explanation.
Base: All data on a computer is a number, and a number can be expressed multiple ways. I wrote about this in "A Steganography Scheme - Part 1". So the base tells Steganosaurus how to express the data. Should each number in the source file be converted into a series of values between 0-10, 0-50, 0-200? The choice is yours.
Shift: My program outputs a range of values from the source file, and each of them is between 0 and Base. How does this become readable text? That is the purpose of the shift, it is a value added to each piece of the converted file to make it into a character. So the result of the whole process is the contents of the original file expressed as numbers in the range Shift to Base + Shift. These numbers are converted into Unicode characters (UTF-8) so the end result is a readable file. You can see an example in my wiki entry about Steganosaurus. (It's probably easiest to see an example.) By using different shift values, you can hide the data from your original file in text from any language in the world.
So check it out, give it a shot, and ask me to send Steganosaurus to you.
Labels:
c,
code,
cryptography,
programming,
steganography
Thursday, October 19, 2006
Some random items
Usually, my blog posts center on one theme or one idea which I try to explore in depth. Tonight I'm not feeling so focused, so here is a scatterbrained snapshot, developed from my tired mind. It has been a long week.
What am I up to?
I wanted to write a quick update, because it has been a while. I'm still working on my steganography project. I decided to build UTF-8 support into it, and this has complicated things slightly, but it's good because I'm learning new things. I spend an hour or two on it a couple of days a week and it is coming along quite well.
I'm reading a book. Neverwhere by Neil Gaiman and I'm really enjoying it. Many thanks to m3tus for letting me borrow it. I will probably finish it on the flight tomorrow.
And where is this flight taking me you might ask. Well, homecoming of course (this is for my University, just to clarify). I'm looking forward to meeting old friends and hanging out in the old haunts, so to speak.
And now I will close with a random link: http://206.220.43.61/primespeaks/votePrime/. I don't know if you have heard about the upcoming Transformers movie. I'm mildly interested because this was one of my favorite shows when I was very young. Apparently, they are having a contest to choose a line which will be said by Optimus Prime during the movie. The whole thing seems like a giant publicity stunt (and a way to collect email addresses), but it is kind of fun to watch people try to hijack the election to choose the line. One individual was campaigning to get the line "I Guess I'll Transformer Into A Truck Now." entered into the contest. Unfortunately his line didn't make it. Personally, I'm pulling for "These pretzels are making me thirsty!"
Random.
What am I up to?
I wanted to write a quick update, because it has been a while. I'm still working on my steganography project. I decided to build UTF-8 support into it, and this has complicated things slightly, but it's good because I'm learning new things. I spend an hour or two on it a couple of days a week and it is coming along quite well.
I'm reading a book. Neverwhere by Neil Gaiman and I'm really enjoying it. Many thanks to m3tus for letting me borrow it. I will probably finish it on the flight tomorrow.
And where is this flight taking me you might ask. Well, homecoming of course (this is for my University, just to clarify). I'm looking forward to meeting old friends and hanging out in the old haunts, so to speak.
And now I will close with a random link: http://206.220.43.61/primespeaks/votePrime/. I don't know if you have heard about the upcoming Transformers movie. I'm mildly interested because this was one of my favorite shows when I was very young. Apparently, they are having a contest to choose a line which will be said by Optimus Prime during the movie. The whole thing seems like a giant publicity stunt (and a way to collect email addresses), but it is kind of fun to watch people try to hijack the election to choose the line. One individual was campaigning to get the line "I Guess I'll Transformer Into A Truck Now." entered into the contest. Unfortunately his line didn't make it. Personally, I'm pulling for "These pretzels are making me thirsty!"
Random.
Friday, October 13, 2006
Seeking Simplicity
Simplicity. Life can so easily get too complicated. I often feel that it is so already, and there is still so much ahead of me. So I've been thinking about how to simplify my life, I've even been reading about it. If you are looking for a good book to read, check out Celebration of Discipline by Richard Foster. I read through it a couple of years ago and found it to be extremely refreshing. The perspective offered by Richard Foster is quite different from that we usually find in our affluent, consumer culture.
Speaking of simplicity, I've been complicating my web presence by creating a new webpage and signing up for del.icio.us. I wrote more about it a couple of days ago on my wiki page.
Speaking of simplicity, I've been complicating my web presence by creating a new webpage and signing up for del.icio.us. I wrote more about it a couple of days ago on my wiki page.
Saturday, September 30, 2006
A Steganography Scheme - Part 1
I've been thinking lately about steganography. Previous tools have hidden information in images, videos, sound files, and other large chunks of information. But I have not seen many examples of steganography with text (here is one). I decided to put together a simple and flexible text steganography tool just for fun.
The secrecy in a stegonography scheme rests in a shared algorithm between the sender and receiver which is not known by those trying to intercept the message and the fact that a hidden message is not apparent in the message being sent between the individuals. Anyone trying to find the hidden message faces two challenges:
Because I am explaining my stegenography idea to the world at large, item number two is no problem. I hope that the first question will not be so easily answered. In any case, you should not rely on this, or any other steganographic method to keep a secret. For that, you need encryption.
Now, on with the scheme!
I wanted users of my system to be able to send any kind of data by hiding it in a plaintext message. In order for the information to be hidden in text, it may have to be converted from one form to another. The same information can be expressed in multiple ways. For example, the number 14 can also be expressed as 1110 (binary), 16 (octal), and E (hexadecimal), depending on the encoding or base of the information. When information is converted into another form, someone who is decoding or reconstructing the information needs to know what form it is stored in. In many steganography schemes, the form of the data is constant and is a secret shared only by those who are supposed to be able to read the hidden message. I wanted to allow flexibility in the encoding, or alphabet, which is used to express the hidden message, so a message from my system will include a definition of the alphabet used to hide the secret message. Here are the steps for using my scheme:
Now I've shared with you what it is that my steganography scheme will do. In my next post, I'll talk about how.
The secrecy in a stegonography scheme rests in a shared algorithm between the sender and receiver which is not known by those trying to intercept the message and the fact that a hidden message is not apparent in the message being sent between the individuals. Anyone trying to find the hidden message faces two challenges:
- How do I know when a hidden message is present?
- How do I extract the hidden message?
Because I am explaining my stegenography idea to the world at large, item number two is no problem. I hope that the first question will not be so easily answered. In any case, you should not rely on this, or any other steganographic method to keep a secret. For that, you need encryption.
Now, on with the scheme!
I wanted users of my system to be able to send any kind of data by hiding it in a plaintext message. In order for the information to be hidden in text, it may have to be converted from one form to another. The same information can be expressed in multiple ways. For example, the number 14 can also be expressed as 1110 (binary), 16 (octal), and E (hexadecimal), depending on the encoding or base of the information. When information is converted into another form, someone who is decoding or reconstructing the information needs to know what form it is stored in. In many steganography schemes, the form of the data is constant and is a secret shared only by those who are supposed to be able to read the hidden message. I wanted to allow flexibility in the encoding, or alphabet, which is used to express the hidden message, so a message from my system will include a definition of the alphabet used to hide the secret message. Here are the steps for using my scheme:
- Write the secret message
- Choose an alphabet to encode with
- Convert the secret message to the desired alphabet
- Embed the converted secret message into an innocuous public message.
Now I've shared with you what it is that my steganography scheme will do. In my next post, I'll talk about how.
Labels:
cryptography,
programming,
steganography
Tuesday, September 19, 2006
Back on the Internet
It's good to be back on the Internet. My wonderful wife and I relocated a couple of weeks ago to our new domicile and our connection was set up today. A lot had happened while I was out. The facebook newsfeed situation was addressed, new Strong Bad emails were released, and, best of all, my uncle Doug signed up on myspace and has written a mighty fine blog (rss feed). It seems that my return to cyberspace was none too soon:
So, I've been on myspace for a couple of days now. My profile echos when it loads, a soft lonely sound. Tom's still smiling away like a leprechaun (I should be having so much fun), lovin' you Tom, you haven't removed yourself from my page, yet. Off in the distance I hear crickets or is that my knees? Anyway, I'm waiting in breathless anticipation for at least my wack-job nephew and his lovely, vivacious bride to answer my request to be their friend. Maybe someone in an induced stupor of some sort will accidently stumble upon my page and be touched by my incessant whining and think to themselves "that poor bastidge, I'm gonna be that fargin' Snuncle_Fudge's friend!!"*
Good show Uncle!
* Quoted directly from Doug's blog, a Doug's blog production, copyright Doug 2006, all rights reserved, available for a limited time only, while supplies last, act now and get two for the price of one, a $50 value for only $19.99.
Sunday, September 03, 2006
Reviving my laptop
I have an old laptop which I would hate to see go to waste, an Intel 796 megahertz processor with 128 megabytes of ram and the weight of Windows XP has become too much for it to bear. I want a system that will run quickly and smoothly. I need a web browser and programming tools (gcc, make, python, perl, svn, etc.) and an mp3 player might be nice too. I had been running OpenSUSE, but the performance was still a bit sluggish. Then I tried Damn Small Linux (DSL) and it had almost everything I need. Fluxbox is a great windowing system and it ran extremely well. Things started to break down when I tried to install make, a series of dependencies and library downgrades prevented me from being able to get everything I needed. The problems continued the more I tried to modify the system. So I've tried others, five distributions so far, but none seem to work just right. This is turning into quite the weekend project.
Saturday, August 26, 2006
Facebook badge
I stumbled across Facebook's badge feature today. It's pretty nice I must say. Simple, easy to use, and in keeping with Facebook's clean style. I'm on both Facebook and Myspace and I must say I have preferred Facebook thus far. Who knows, maybe Myspace will change for the better. I could do without audio and video clips embedded on Myspace pages. I want to control the noise that comes out of my computer and I make a point to disable all sound effects, warning bells, audible chat alerts, etc. Nothing should get in the way of my music while I'm surfing the web.
Wednesday, August 23, 2006
My TiddlyWiki
I recently tried out TiddlyWiki (http://www.tiddlywiki.com) and I've used it to created a simple page which I plan to update periodically (http://jeffrey.scudder.googlepages.com/PublicWiki.html). It has some information about the projects I'm working on in my spare time, other web real estate on which my face is pasted, and it serves as a collection of blogs and posts in other domains. I've become almost addicted to TiddlyWiki while using it for brainstorming and organizing my thoughts. As I'm writing, I can easily mark a topic for further explanation by writing a WikiWord. It turns my browser into a rich text editor. Quite a nifty little doodad. I'm curious to see what happens when the HTML file grows to a massive size.
Subscribe to:
Posts (Atom)