Tuesday, November 30, 2010

application contemplation

It's getting to be time for me to apply what I've learned. I am confident in my grasp of flow control (loops, etc) and I'm at a reasonable level of understanding of how variables of all types work in and out of functions (with the exception of the more esoteric aspects of floating point numbers).

So what to do?

First I'm going to complete what I started with the .plx file loader. I have our sample implementation to guide me so it's really like re-writing an essay in my own works.

I had wanted to write a Lunar Lander clone, but I'm worried about getting bogged down in the graphics aspect. I will at least spend a weekend of free time exploring OpenGL but I'm not sure how "straight C" friendly it is. I found this, however: http://www.opengl.org/resources/code/samples/glut_examples/examples/examples.html

Beyond that, I'm looking for a challenge that will force me to learn some of the more advanced data structures like stacks and linked lists and trees that I keep coming across. I can understand (at least superficially) what they are, but not when they are meant to be used.

Obviously I want to step into GUI-land at some point, but I won't feel like I've earned it until I do a good solid "final exam" problem in console-land.

And no, writing a blackjack clone doesn't count.

Sunday, November 28, 2010

wasn't too hard

I got my "most advanced program ever" to work on the Linux box. It was trivial since it's very straightforward - I didn't have to change anything.

This is the program that reads the file format that the company I work for uses. I wish I could have found a different data set to work with since I use this as a bit of an escape from work, but it's helped me a fair bit in my job to know how to do it so I'll roll with it.

The file format holds data collected from a machine that is digitizing an analog signal coming from a filter/amp box, data in the form of single timestamps (events) and chopped up segments of the previously mentioned analog data (waveforms).

I think my next task will be to read in one of those data types into an array or some other data structure. It's tricky because this file format isn't "in order" so I have to parse through the entire thing to pick out what I want. Not very efficient after the fact but it makes things faster at the time of recording since the recording program can just dump whatever data it has as it gets it.

Saturday, November 27, 2010

moving and shaking

I've had it up to here (I'm pointing to my neck) with getting stuff to work in Windows. I can do my usual C learning in Windows, but all the more advanced stuff I'm dabbling in is taking too much time to get functional.

For example: I'm playing around with GTK+ and Glade (a GUI building tool) just to get familiar with it so that one day when I'm more comfortable it won't be such a shock. Getting those to work in Windows has been a chore - at least four or five hours of free time, which is about as much free time I have during a normal week. On my Linux netbook the package manager handled everything and it all worked the first time. This is partially due to the Windows installer for Glade was an afterthought and has many known problems.

Months ago I tried hooking the VGA output of my netbook to my monitor and got disappointing results. I realized that I had not tried it recently (with the new OS version install) and gave it a shot yesterday. My tiny little netbook can now push a full 1920x1080 monitor and is reasonably fast.

Conclusion: I'm going to do the rest of my learning on the netbook attached to my big monitor (and keyboard and mouse). The compile times are a bit slower - that is to say they are on the order of 1-2 seconds instead of nearly instantly, but that's ok.

I'm not adept enough to make a blanket statement that learning programming in a Windows environment is a hindrance, but I'd rather be struggling with data structures and flow control - not .dll files and shoddy ports (not Windows' fault).

Fortunately the netbook is decent enough to do web based stuff like email through my browser and even remote desktop into my work machine. That should help not need to be constantly switching back and forth - I don't have a KVM so it's a chore to keep swapping USB cables around. My only concern is heat. The netbook gets super hot.

Wednesday, November 24, 2010

first steps

I'm hoping to soon make a console-based version of the timestamp program by early 2011 (January). I have the knowledge to do the logic behind it, but I'm stuck on how to store the information.

I'll write out a complete spec on what the program has to do and then compartmentalize it and describe how I'll tackle each section. How to store things will be last since I'm still working it out. I'm leaning towards plain text storage which indicates a big parse-able text file or maybe XML.

Sunday, November 21, 2010

matlab

I've been having to do a lot of Matlab noodling the past few weeks for work. I only enjoy it because everything I can think to do has been done before and everything is a quick Google search away. So, I don't mind it too much. It's still a time sink.

Friday, November 5, 2010

quick note on function pointers

I think I just figured something out.

Ok.

int *my_function(int x, float y)

This is a function that returns a pointer to an integer.

int (*my_function)(int x, float y)

This is a pointer to a function that returns an integer. I got tripped up by the part (int x, float y) that makes it look like you're making the function prototype - but really this is just C wanting you to be really precise about what you want to be done. I wonder if this is 100% necessary - further experimentation is needed.

Another important note: remember that pointers need to be initialized.

I need to say at some time:

my_function = &some_function

where some_function is:

some_function(int x, float y)

Thursday, November 4, 2010

light reading

I've been reading a little bit about C++. It has some neat capabilities. Classes seem a lot like structures, but they can have functions built into them and variables that can be local to the class only (private) or viewable/modifiable by anything (public). I really like the idea of housing functions inside of a class. I've ran into a few things in my meager coding attempts where I had wished I could make things more organized.

One annoyance in the C++ literature (online at least) is that there are so many names for things. See here:

http://www.learncpp.com/cpp-tutorial/84-access-functions-and-encapsulation/

I guess "access function" is a dandy name for a function in a class that will return a private variable in the class, but that's only one example that at least makes sense in context. It's just such a generic name. Constructors, destructors,encapsulation, I dunno, rambling. C has lingo, too, but it seems more sensible to me.

C++ seems to be all about keeping the bones out of sight and just letting you toss things at classes and letting them do the work. I can't imagine ever writing a program so complex that I'd need to go out of my way to do that. I totally understand now why most GUI libraries are c++ oriented.