Archive for the ‘Programming’ Category

Programming up a storm

Saturday, December 3rd, 2005

Note: I just erased the whole thing I typed out, so I have to start this over again. It was much better the first time :(

I’ve spent a lot of time coding lately. It’s probably because I want to procrastinate on my sociology assignment (read a book by final exam) and my philosophy assignment (write a 5-7 page paper on an “outside topic” in philosophy, and use a book as the source). Both of those are due in 2 weeks, so you might understand my want to procrastinate.

On Monday, I slept through my stats class (ya I know.. shame on me..) and decided to work on Fortress Forever. One thing lead to another, and I ended up working on it for about 10 hours writing code in c++ and using the tools and helping another team member get models into the game. One positive thing is I got a lot of stuff done. I guess I should hope so if I spent so much time on it :). The capture the flag rule set is completed and I got the sentry gun code to rotate 360 degrees, which is always a plus.

On Tuesday, I went to all of my classes and got home and chose to work on an addon for WoW for my guild to help distribute the items from bosses that we defeat in a more timely manner. This was my first decent-sized addon I made, so I decided to use the Ace framework to make it a bit simpler. The addon code is written in lua, so it’s nice to learn all the intracicies of another programming language. Lua is pretty nice because it treats functions as a base level object so it makes some stuff a little clearer than when doing the same type of things in other languages.

On Wednesday, my alarm woke me up so I made it to my stats class on time and went to my job and mainly worked on a PHP script that imports the phone numbers from a daily report we get emailed to us. I wrote it a long time ago, and apparently it stopped working. In the past, this usually meant that the server that ran it every day forgot to do it, or something like that. In which case, I can just restart the service or turn the scheduled program back on which is simple to do. However, the mail server got upgraded or something (that’s my best guess at least) and the format of the emails had changed. My strategy to get the data from the emails in the past had been to just blindly read the entire mail and grab the information I needed. However, the upgrade caused attachments to be encoded, so I actually needed to strip out the attachments from the email and read them properly. It was a pain to do, but I eventually figured out how to do that propery and I ended up making something pretty robust, so I was pretty proud of myself. Later that night when I got home, I did a bit of work on a side job in PHP which I had done some parsing stuff for as well. Tonight I worked on the user interface stuff for it and got a bit done.

Thursday, I actually decided to play some WoW with guild. We had some attendence problems early on, but we filled up a little bit towards the end. We had some good attempts at defeating the boss we were stuck on this week, but eventually we ran out of an item needed to beat him so we called it a night. Afterwards I remembered I had an assignment due for my computer science 139 class (operating systems), so I started that up. I had a lot of it already thought out in my head, so it was a simple matter of writing it out and getting it done… and remembering exactly how to compile shared objects in linux. I won’t bore you with the details, but it took me longer to realize I was trying to fix something that wasn’t broken, than to do the entire rest of the assignment. With that done, I submitted it via email and read some web pages and went to sleep.

Today was the exception though. I opened the fortress forever code up when I got home and poked around at it a little but didn’t really do anything. I also opened up Eclipse and looked at the java code for the game programming class I’m in, but didn’t get anything done there either. Afterwards, I signed onto wow and played a while. We were really having membership problems and after a few hours finally defeated a boss that we usually beat on the first or second try. We did it with 30 people, and we usually try to get 40. We were a bit demoralized (and the second boss is really difficult), so we decided to call it a night. I spent the rest of the night looking at web pages and such. I opened up the side job PHP stuff again and did a little bit of work, but not very much. I guess I was burnt out from doing so much coding during the rest of the week. If I had’ve worked on my game programming assignment, I could say I did significant work on projects in 5 different languages on 5 different days. Alas, I didn’t, so I can’t. I still did a lot of productive stuff, so I’m happy for that.

In other news, I found out that the next antweight robot event is in January at Andy’s place in Marin. I’m looking forward to finishing the new version of my robot and eating the incredibly good food they have at the event. Hopefully I’ll even do good in the tournament and not get my robot tore up like at the last event.

Pokersaver Alpha 01 released

Saturday, July 3rd, 2004

I’ve decided to release version alpha 01 of poker saver. Right now all it can do is import the complete game information about Party Poker games only and display the game information back, with filters for game types, money type, and limits. Not much yet, but I can see it coming together. If anyone wants to, then you can download Poker Saver alpha 01. Simply extract the zip file to a new directory and run pokersaver.exe. It should be self-explanitory. Post any obvious bugs in the comments if you want to. I know about parsing bugs with Omaha and Real money no-limit games, so don’t bother with those :)

For those of you coming to my page about FryDrumBot 1.0, I haven’t started building it yet. I’ve got some plastic for the endcaps and the stabalizer (that’s not in the picture), and all of the electronics for it, but not the drum yet. I plan to get that on Tuesday or so and finish building the entire thing by next Friday. I’ll take pictures this time.

php coding contest

Wednesday, August 27th, 2003

I participated in a PHP coding contest a week or so ago and the results have been released. I got 6th place, so I’m happy :). In other news I’m developing code for the Spades Contest on codewalkers.com. If anyone wants to write one and test their scripts against mine, feel free to post a comment and I’ll look at it.

sparky util mirc plugin

Wednesday, April 23rd, 2003

I’ve finally released the sparky <--> mirc thing
I announced a couple weeks ago.
I’ve decided to implement it using the new addon/plugin feature in sparky’s 1.43. Anyways,
you can download it here if you want. Read the readme
and don’t bug me if it doesn’t work. You probably need mIRC 6.0+ to get it working too.

Pretty Eventful Weekend

Sunday, March 16th, 2003

This past Friday I entered the ACM
Programming Contest at Sac State that started at 5. I initially was hesitant about
going because the email I got said that it would be in teams of up to 3 and I don’t
really know anyone at college that would be interested in it. I first thought it
would be a simple optimization problem like “write this program, and the team that
submits the most efficient solution wins.” However when I showed up, they said it
was programming multiple problems and the winner was the team that submitted the
most correct problems in the shortest amount of time. So I partenered up with someone
else that showed up stag like I did (who happens to be in my CS 28 class as well) and
we headed over to the programming lab to start. Unfortunately he knew java while I
don’t know the technical aspects of it that well, like how to do anything in it.
Neither one of us had used the IDE that was installed on the linux boxes there, so
I convinced him that we should just use c instead since he knew c as much as I knew
Java. Anyways I busted out vi(m) and started coding away along with a bunch of help
from my partner. We started on the easiest one first since the tiebreaker was based
on the time taken to submit each problem and incorrect solutions, and managed to
finish it within 10 or so minutes. And so we got the first balloon awarded that night
(probably because there were only 3 lower division teams, and the other 8 or so open
teams couldn’t do that easy one). The second problem we did (involving making change)
was in the category for both upper and lower division teams, and it was a bit more
difficult, but still fairly straightforward. After triple checking sets
of data we were assured that it was correct, and catching a couple mistakes, we sent
this one off as well. The third problem we attempted was in the lower category and
it took us a lot more thinking. It involved taking the difference between two times.
So we work on this one and decide that converting the times to military time and then
subtracting directly and then making sure it was still within 24 hours would be the
most efficicient. After shortly debating whether 12am was midnight or noon and then
reading the problem description we solved this one. We submitted it and started on
the next problem before we got our response. After a few minutes of it, we got an
incorrect solution response. “How could that be?” we wondered and continued to work
on the next problem. The last problem was really tricky indeed. It was to calculate
the mean, median and mode of a list of N numbers between 1 and 25 inclusive. Or so I
thought, and we wrote a clever program for that problem. However after submitting it
and getting a “run time error” response it was immediately evident that there was
some bounds problems since I relied on only numbers between 1 and 25 being sent in.
After re-reading the problem, my partner noticed it was N numbers, where N is between
1 and 25 inclusive. This made matters much worse so we decided to figure out what
was wrong with the time problem. After a short while of rereading the description
I stumbled upon the fact that the second time was *always* after the
first, and that triggered in my mind what about when the times are the same. So I
got the input data where the times were the same and it reported that there was 0 hours
and 0 minutes difference. Thinking. Wait! That should be 24 hours not 0 hours, so we
patched it up and submitted it. Yes! It worked, so back to the stats problem. So we
decided to store an array of the (up to) 25 numbers and sort them and then compute
the mean, median and mode. So we submitted it. No! Whoops, forgot to change the bounds
on a loop from 1-25 to 0-n instead of 0-25 as it was before. That must be our problem.
No! Lets try printing out this sorted array. Whoops, it’s not sorting it at all! In
fact it was sorting it reverse order by the array position. Quick referencing of the
pointers in the compare function required by qsort() fixed that problem, so we
submitted it again. No! This can’t be happening. More test data indicated that when
the true mode was the last number in the list was the culprit for the problem. Whoops,
we forgot to have a case outside the loop to check for mode. After fixing this we
submitted it again… and got a yes response! Yay. So we check the leader board and
notice that we are in the lead with 4 problems solved and the other teams would have
to complete 3 of the problems in the remaining 15 or so minutes so we decide to just
sit the remaining time out instead of attempting the other 2 hard problems, since
we wouldn’t finish them. Anyways we go downstairs and after a few announcements we
claim our first place award which was a nice plaque and choice off the table of prizes.
Anyways they announced that competetors should join the ACM if they aren’t in it
already, but after checking out the schedule on their web page I notice that I have
classes for at least 75% of the times that their meetings are at, so I can’t really
join this semester at least. They *are* making a battlebot though which I have wanted
to do for a long time since first seeing the show air on comedy central although I
haven’t watched in a long time. I probably will start watching them again when they
run a marathon of them or I get a tivo so I can fast forward past the WWF-isms that
they keep putting in to appeal to a younger audience. Oh well.

So I get home around 11:30 and decide to watch the Stargate episode my mom so graciously
recorded for me. It was really good and makes you wonder about the ramifications of
precognitive abilities in the universe. Likely not possible, but it *is* just science-fiction.
I don’t want to spoil too much for those that haven’t seen it, and for those who don’t
even know what I’m talking about, you should watch stargate. It’s on Sci-Fi Channel
on fridays at 6:00 and 8:00 pst. Or maybe 6:00 and 8:30. Check your tv listings :). I
then go to bed since I’ve got to take a stupid writing test tomorrow that I need before
graduating from college. I awaken Saturday morning at 7:00 since I have to be to the
place by 8:45 in the morning. On a Saturday no less. Who schedules these things? Obviously not college
students like me who like to stay up late. I get to the test and after trying not to
fall asleep proceed to follow the instructions and fill in the bubble sheet so they
can accurately demograph how stupid white people are. Of course I fill in “prefer
not to state” in the race/ethnicity form, so I’ve foiled their attempts! Mwahaha!
IMO race/ethnicity shouldn’t matter on anything. The fact that English isn’t your
first language should matter, but not what colour your skin is or whether you put a
u in color. So I read the essay prompt and realize that it should be simple for me.
I have to write about whether community provided by the internet is beneficial and
useful. I immediately disassemble all my thoughts that fly through my head and establish
what I really believe on the subject. I remember things posted
on one of my [ex?]-coworker’s site, as well as
a
book I read in High School
, and had to do a book report on. Personally I think
that the Internet is a good resource and is very useful, but I know how bad it can
be to your personal life. I realize how bad of an essay it would be to sit on the
fence so I decide to write a mostly negative essay. So I start the outline I usually
do and write out “introduction,” “everquest,” “intentions,” “the net,” “brainstorm,”
and “conclusion.” I notice I have 6 points and that one of them can be used as a
nice hook for an opening paragraph so I start off by mentioning Sandra Bullock and
the cheesy movie she was in claiming it could happen to anyone. My second paragraph
cites “evercrack” and people whose vain girlfriends leave them. For the third I cite
that IRC sucks for emotion and people that lie claiming they are girls when they are
in fact not. Fourthly I acknowledge that the internet can be good for brainstorming,
and then conclude with a conclusion. I know it’s recipe-like, but it works and is
[hopefully] all you need to pass these tests. Some of my paragraphs were a bit
jumbled together, much like the flow of this paragraph here, but this is just my silly
blog, so who cares! So I proof-read my paper and decided it was good enough so I
put my jacket on and handed my stuff to the proctor and left. Fun stuff indeed.

Then today (sunday) I was driving to my grandmothers house on I-80 and on the way I
noticed this sign with blinking lights saying “High winds.” Hmm I think to myself,
and then I notice what looks like a hay bail spining around up in the distance off
the side of the road. I guess the sign was right, but what an odd place for a tumbling
bail of hay. Upon closer inspection of my thoughts, I realized what I was looking at.
It was not in fact a bail of hay, but a smoking tan car rolling off the side of the
road and into the ditch. Uh oh. My mom in the passenger tells me to slow down because
she realizes what is happening before I do, so I do and slam on my brakes and make
the tires squeal because of this, although I really don’t have to because the car
ahead of me is at least 50 feet ahead of me and he wasn’t slowing down that fast, but
I just paniced. So I pull off to the side of the road since I saw it and notice that
the car is smoking really bad like the engine is out. My mom tells me to call 911.
Right I think, now how to I turn on my phone. In my paniced state it took me a while
to remember, so I did, and the hold-9 for 911 thing didn’t work. About this time
I see a guy run from the car a couple ahead of us down to the smoking car in the
ditch. So I dial the actual numbers and hit send. But all the lines are busy so I
have to wait. I notice that there are no people inside the car, and my mom mentions
the people got out and are walking around. How is that possible I think to myself.
So finally the 911 person picks up about a minute later and she seems a bit rude to
me and I tell her that a car flew off the side of the road and is smoking and she
says “on I-80 and reed?” and I say “no, before reed on the other side of the river.”
and she responds that help is en route. I say thanks and hang up. So anyways just
shortly after that I see the highway patrol/chp pull up behind me and the group of
people gathered behind my car looking at the smoking car in the ditch. Somewhere in
here a guy walks up to my window and of all things asks me to back up so he can get
his toy that his kid dropped underneath it. After this we realize that there are
more than enough witnesses that saw more than I did since we were at least a quarter
mile back and just saw it falling off the road, and if the CHP needs my witnessing
they have my cell-phone number since I called 911 with it, and my license plate #
since they have cameras in the dash and he was directly behind me. One thing I want
to know is if the 911 people get the location of the cell-phone tower that is being
used to accurately pinpoint where people are calling from so that they can have
people on response faster. So anyways, I turn off my emergency flashers and turn on
my blinker and I pull out onto the freeway again after a minute of waiting for the
outside lane to clear enough for me to get enough speed up the hill. Anyways,
dinner was great as it usually is, even though we quite literally had to go over
the river and through the woods to get there.

Wow this was a long post. Hopefully I will make more frequent shorter ones in the
future so I don’t take this long to do them. Anyways I need to get to bed, so thanks
for reading!