DSwain- The New Day

Monday, April 24, 2006

Today!

Was pretty much just like every other day. Something was a little odd about it, though honestly. Even at this point, for some reason I feel really drained and uninspired and not motivated to do anything at all. It's somewhat frustrating, but I guess that's what happens on gloomy days.

The SAT scores came in today, just in time to make everyone feel a little worse about themselves. Personally, I feel like these tests are absolutely asinine at judging anyones ability in regards to performance based off of anything. Even people who are very good at studying and focusing for long (yet shortly fragmented pieces of that duration) of time tend to not be the best at this. And honestly, and institution or business who expects somebody to perform like this is out of their minds. Nobody can think or produce satisfactory results from a test like this, and really only tests ones ability to try to remain calm and focused in an extremely annoying and meaningless situation. I, obviously, failed at this. I guess I'll have to give it another shot and see if I can do better, but I will still hold strong on my opinion; this test does not prove anything important.

Maybe that's just my spite for not doing so well? Maybe somewhat, but when you consider what you choose to do with your life and how you want to live it, I don't see how you could justify or make sense of this test.

Anyway, now that my rant is over, I have not much else to say. It's been a bit of a dragging and annoying day, I would say. It is coming to a much needed end though, which is nice. Hopefully things will be a little smoother sailing tomorrow. That's about all for myself today. Peace.

Thursday, April 20, 2006

These Days

These days, just come and go by so fast. So many things going on, so many things to come. It's all really amazing to experience in all honestly. I kind of get the feeling that I really want to stop and just let time flow for a bit. I wouldn't mind a good sit by the stream of life to take a good look back on what's happening. It's nice to do that sometimes, but it doesn't look like this will be happening for some time.

I learned a good lesson today; I have to be careful with my mouth. People can do dangerous things with it sometimes, if you're not careful. Just bare in mind: Aim, then shoot | Think, then speak. Same idea applied in two very different things. A good thing to learn I suppose, though. It can be helpful to try and keep those things in mind. I think I should remember to keep my mouth shut a little more also haha, but thinking helps also.

At any rate, not much else to talk about. I'm way overweight, and I'm starting to lose focus on school. I kind of really need to get both of these things on target again, especially for the coming up year (from pretty much now until the same time next year) so I might as well start now. Other than that, I've downloaded a ton of music today. Very fun, but a lot more than I'm used to. Oh well, though. There's too much good music to listen to, and not enough capacity to do it I'd say.

That's about all for me. Peace folks.

Sunday, April 16, 2006

if (Spring Break==NULL) {

Yes, spring break has sadly come to an end. Tomorrow is the starting of school. Not so fun, really, but I guess I don't get much choice in the end. Oh well, though. At any rate, I can't wait for summer to come around now to do riding and such. It should be fun I'd say. This summer coming up, though, will be by far much different than usual. Having a girlfriend for one thing will be a unique part of the whole experience. I have to work on my physique I suppose to be impressive ;) haha. Also, I'll be taking more CCM classes for a good portion of the summer. They won't be so intrusive really, as they'll be at night or in the morning, which leaves the rest of the day, but they will still be neat to have around. It'll be odd to have school almost never ending. Hopefully, though, it will at least be more enjoyable than high school has been haha. I may need to break down and finally get a job. Apparently a job looks good on a resume when you don't do anything like me, so I may really want to consider this. I wouldn't mind just doing small tasks for my parents all summer, though. We'll see what happens. I'll just do whatever feels right and makes me happy I guess. Finally, college will be coming quickly up ahead of me and will be sure to be hanging around all summer. I really will be in it then, if I'm not already. I look around what seems to be almost constantly at different schools and things. Kind of annoying, but yet also kind of exciting to do also. We'll see, I suppose. Oh, and marching band of course.

Beyond summer, the next school year I'm guessing will be more entertaining because of the classes I should be having. They'll be much harder for sure, but they should at least be something more interesting to spend time doing instead of just annoying and in the way almost.

Well, whatever works. I'll cross these bridges when I get to them, I suppose. It's about time I get to sleep now, so enjoy your day or night. I'll be sure to enjoy tomorrow when I'm feeling violently excited.

Peace folks.

Thursday, April 13, 2006

Here Comes Sunshine!

The above is by far, one of my favorite songs ever. There's something to it that just really makes you loosen up and feel much more free. Listening to it through different time periods is amazing too, because it really tends to really project and emphasize the way the Grateful Dead performed. You can tell through each version from the early 70's to the last time in the mid 90's that things change drastically. Quite a piece, I would say. It's nice to have around these times too, cause you can feel that spring thaw really kicking in, and the sun has been out for almost the entire week it seems like. So, all and all, the song works out well for me.

Anyway, so I'm enjoying having this week off. Been enjoying some nice bike rides. They're nice, but considering the condition in which my body is in from winter and doing nothing and eating way too much is kind of bad. It'll take some time before I'm in real good condition again. Other than that, I've been teaching myself C++ as I've said a few times before, and I'm moving along pretty well in using it. I'm just kind of writing whatever ideas I can think of and seeing if I can make them work. Obviously, I'm not a professional by any means haha, but I can write some real simple stuff.

Finally, I've looked at a few colleges also as I said in an entry or two before. In particular, WPI and Northeastern. Tomorrow I'll be going up to Troy, NY to look at RPI, which will hopefully be sort of interesting. We'll see though, we'll see. We were going to head up to Canada for one more time, but plans changed and that won't be happening now. I don't mind really though cause I kind of wanted to appreciate the rest of my time off at home. So, that's that for the most part.

Haha wow, when you take having a girlfriend out of the picture for even a moment, you can see how boring your life really is, or was beforehand. Yay me! Anyways, I'm off for now.

Tuesday, April 11, 2006

Learning C++: Function Jumping Method Using Only iostream

Over the past week or so, I've been teaching myself the programming language C++. For the most part, this is a language which almost everyone seems to know about to some degree (though, I have heard that Java has more projects on Sourceforge than they do C projects, but that's another story) and it's been a language which I've wanted to learn for some time. Sadly, though, C/C++ aren't exactly too nice for a first language, in my perspective. After running through with bash scripting, a little bit of Java, and a few others, I pretty much get the idea now. I decided to take the liberty of forcing myself to learn some C++.

One problem I've had with C++ though is getting used to Object Oriented Programming. I haven't even really done much of any, but I already have an issue of it. When you're building functions among a C++ program, it's not exactly easy to have those loops end and return to the original function. I decided to apply a little method I've also used a little bit in Bash to help me out on this one.

In this instance, I was working on a program which actually did something as opposed to just simply amuse and teach me. The program is pretty simple in theory; Write an application which can move a number starting in a base SI unit (grams, say) and have it calculate what it is as different SI units (kilograms, hektagram, etc.) Initially, I made it work simply by writing the entire code within main() but obviously, this was terribly sloppy looking and made the code just pile up real fast. My solution in the end was to break up each calculation into different functions and use main() just to make the calls to the functions. Once again though, my problem was it never making the jump back into main() like one would assume the code would do. So, my idea looked something like this.

(I'm not going to post all the code because it's almost 160 lines of it. I will when I get my webserver back online someday...)
void openapp () {
int unit;
system("clear");
cout << "Conversion Program\n\n";
cout << "Units of conversion\n\n";
unit=0;
while (unit<=5) {
cout << unit << ". " << si_unit[unit] << "\n";
++unit;
}
cout << "\nEnter a number (0-5) respectivly\n";
cout << "Press 6 to list the units again\n";
cout << "Press 7 to exit\n";
}

This was the function which essentially listed your options when you first open the program. I did this because as each function ends, it calls this function and lists your choices nice and clearly.
void kilo () {
float a,b;
cout << "Enter your base unit\n";
cout << "Press 0 to exit\n";
cin >> a;
while (a!=0) {
b=a*1000;
cout << "Base: " << a << "\n";
cout << "Kilo: " << b << "\n";
cout << "\nEnter your base unit\n";
cout << "Press 0 to exit\n";
cin >> a;
}
}

This is an example of one of the calculation functions. They all look pretty much the same with the exception of the actual formula changing. As you can see, I have the variable a handling whether the function should end or not. It continues until you enter zero simply because you shouldn't have an instance when you're calculating zero conversions. Bare in mind, though, that you can deal with very small amounts of material though because all the variables are floats so the decimals will not be truncated.
string si_unit[]={"kilo","hekto","deka","deci","centi","milli"};
This is just the string list of your conversion options.
int main () {
int unit;
system("clear");
openapp();
cin >> unit;
while (unit!=7) {
if (unit==6) {
openapp();
cin >> unit;
}
else if (unit==0) {
kilo();
openapp();
cin >> unit;

}
...

This is an excerpt of the main() function. It just gives you more options (numerically) as to what you want to convert to. Hitting six lists out what your possible choices are, and 7 exits the application entirely. As you can see, each function has to take input of the variable unit via the command cin >> unit;. This seems a bit tedious in general, but it does work.

Overall, this whole learning experience has been quite a rapidly paced one, and an interesting one to say the least. I'm glad I seemed to figure it out on my own, though. Kind of a nice accomplishment, though I'm sure many of you have even better methods of condensing and slicing down my code to be even tighter. There didn't seem to be a lot written on the issue either as far as I could tell. Maybe it was more obvious than I thought, but it seemed like everyone used different type of header files to do certain code jumps like this, so I decided this method was the best way to go.

By the way, for those of you who want to know, this actually did help chop my code down quite a bit. With this editing, not only does the code look more clearly written, but it also displays a little more clearly in a terminal window, keeps the same functionability as before, and reduced the amount of code from over 180 lines to just under 160. It was well worth the effort.

Saturday, April 08, 2006

Eventful Things

So the past two days have been pretty filled. Yesterday I woke up at 5 am to head up to Massachussets. Made it up their at around 10:30 or so. In particular, I made it to WPI (Worcester Polytechnical Institute) and then toured around there. The school was enjoyable I'd say. It has ~3000 undergrads attending at the moment, which is sort of small in some perspectives. First was a campus tour, which was cool to see. A few neat things scattered around and such. I enjoyed the fact that it was kind of small, but in a fairly sized town also. It was a good blend and balance. Even though it was small, it seemed like there was plenty of people to talk to and around doing things, but I guess that's pretty normal. I never saw so many kids sitting around on laptops in one place, ever. I think it's the type of place I could fit into well, if I get a laptop at least. Anyway, so it was an enjoyable tour. Talked to some students around and stuff which was neat. I thought it was a nice blend of smart and kind of social. There were plenty of more quiet people which I'm down with also, but I like a little bit of both things.

Today was looking around at Northeastern in Boston. This is a pretty neat place also, but radically different from WPI, to say the least. It has some 15,000 undergrads going at once, it's the middle of the city basically, so on and so forth. The campus itself was nice though, even considering that it is an urban campus. It's still rather condensed and managable to some degree at least, and not so urban. There sure didn't feel like the place had 15,000 kids in it though, but maybe because it was the weekend so less was going on or people were just out and about the city. At any rate, this also seemed like a pretty nice place. The Co-op deal was pretty neat too. It's basically a plan which you go to classes for a period of time, and then go and work for another period, and alternate back and forth. It sounds like a fairly unique experience, and you can do the co-op two or three times during your time working for your degree.

So, overall, both were neat, but drastically different. If I learned much of anything, it's that this choice is going to be hard. I guess if I don't get accepted anywhere that makes the choice a lot easier, but we're gonna hope for the best. I still have other places to look at, but for now two is good. Man, they can get tiring really fast.

Anyway, I've been teaching myself C++ which has been a great deal of fun. It's a nice language to write in. The syntax can get a bit sketchy for somebody like me who isn't used to compiling languages and closing lines all the time and stuff. I'm getting used to it, though. I've pretty much worked my way through most of the basics in a couple of programs. Probably took me a total of about two hours so far, which isn't bad I suppose. I think next up is to read up on some things like arrays and such. Hm... it'll be neat to see what I end up making. Hopefully something useful out of all of this.

Alright, that's enough for today. I will end this, for now.

Tuesday, April 04, 2006

Memory Usage: Hm...

Now, I know that each monitor is going to look at memory usage a little differently and end up with a slightly different result from another, but this one is just downright messed up:



Both top and gnome-system-monitor were running side-by-side as they are in this screen shot. Notice that top displays some ~90MB's free whereas gnome-system-monitor has only ~170MB's used. I was confused too and I'm not sure if I'm just reading this wrong or what, but they are quite different. I also realize that top looks at a few extra things that gnome-system-monitor may not pick up on, so that would make for difference also, but I figured they'd be within striking distance of one another. Very odd, to say the least. I'm going to have to see if I can get another monitor to give me some clarification. Interesting... at any rate, in a practical sense, my machine is running nicely with XGL, Firefox, Gaim, and Jamboree so I'm led to believe that gnome-system-monitor is a little closer to being more correct than top, but that seems odd to me still.

...Hey, it beats studying.

Monday, April 03, 2006

The Run Down

Tuesday- Midterms round one. Statistics and French II. Interesting... shouldn't be too awful though I hope.
Wednesday- Midterms round two. USII and Band/Gym. Hard and then nothing?
Thursday- Carolyn, John, and Chris leave to go vaction it up. One more day of school for me which should be simple enough. Just a normal day, but it should be relativly easy.
Friday-Sunday(?)- I leave to head up north to check out Norheastern University and WPI. I believe that'll be most of the weekend, or a good portion of it at least.
Monday-Sunday- Spring break! Hope I get a lot of biking in...

Today- Eh Midterm review day. Finished a placement test thing and made up a test. So, whatever I suppose.

That's what my week looks like. I'm sure I'll find time to write about other things maybe. We'll see what happens. Peace out, folks.

Sunday, April 02, 2006

Gnome is pwning my face

Seriously, I'm just having more and more fun with this thing all the time. It never seems to just let me go and live on peacefully, and I can't get enough of it.

Anyway, for anyone who uses a newer version of Gnome (<=2.0) you may or may not know that dealing with menus can be quite an annoyance, to say it in a polite way. The idea behind why it is hard to use, though, is good and somewhat justified.

As this website explains, Gnome makes good use of the gnome-vfs system. This is a special filesystem (vfs=Virtual File System) which is, to generalize and simplify it, a filesystem layer which sits on top of your actual filesystem of the actual hard disk. Gnome-vfs makes it easy to keep track of files across a computer and helps for developers to create applications with a little less tedious work. This is exactly the case as to why menu entries are a tough battle. What gnome-vfs does is reads these files (.desktop files) which are xml files specifying the information of the menu entries. It's designed like this to provide a standardize system of creating menu entries and a central location to access them from so you don't end up with as scattered of a filesystem. In other words, when a developer creates a program, they don't need to be able to handle the addition of a menu entry manually or in a very complex manner, but rather write a quick xml file with the information required and add it to this (/usr/share/applications/) directory. So, in other words, to answer the question of why it's so hard to work with; It's because in theory it makes it easier for developers and users to handle.

The problem is, what happens when that entry doesn't make it into its correct location? You've got yourself a nice situation, and I finally managed to figure out all of the above to figure out how to add these entries and they're not too complex at all.

My issue was with Gaim. Currently, I'm using a beta version of Gaim which was installed from source. If I had used pacman and stuck with the current stable, I would have had an entry. I may have needed to specify more information during compiling the source or something, so I'm not really sure why this failed me. At any rate, I needed to fix it, as it was becoming a real annoyance.

The first thing to do is get a good feel for the files and how they're set up. In all honesty, they're really not that complex of files. Here's the one I wrote for my Gaim entry:

[Desktop Entry]
Encoding=UTF-8
Categories=Application;Network;
Exec=gaim
Icon=gaim.png
StartupNotify=true
Terminal=false
Type=Application

Name=Gaim IM
GenericName=Internet Messenger
Comment=Send instant messages over multiple protocols

Really, not a complex file at all. First we specify that we're dealing with a desktop entry, and then provide the other information (executable file, the icon to use, etc.). Granted, if you don't know or understand what it's asking for, it could be somewhat confusing. Also another confusing problem you may deal with is if you started with what I did: an example straight out of the folder.

Name=Mozilla Firefox
Name[bn]=ফায়ারফক্স
Name[eo]=Mozilo Fajrovulpo
Name[fi]=Mozilla Firefox
Name[pa]=ਫਾਇਰਫੋਕਸ
Name[tg]=Рӯбоҳи оташин
GenericName=Web Browser
GenericName[af]=Web Blaaier
GenericName[ar]=متصفح ويب
GenericName[az]=Veb Səyyahı
GenericName[bg]=Браузър
GenericName[bn]=ওয়েব ব্রাউজার
GenericName[br]=Furcher ar Gwiad
GenericName[bs]=WWW Preglednik
GenericName[ca]=Fullejador web
GenericName[cs]=WWW prohlížeč

And so on with it... just to make it simple, you shouldn't need to worry about the additional GenericName(s) that are in another language. If you follow with what I wrote for an entry, you should be able to really just enter the language of your preference. Once you do that, simply save the file as the application with a .desktop extension. Something like this:

gaim.desktop

Save or move that into /usr/share/applications/ and then restart Gnome (or the panel) and your entry should appear. Or, at least, it worked for me.

Good luck!