Horner Hash Algorithm In C

Filed Under Programming

Posted: 29 April 2008
Updated: 1 May 2008

The last programming assignment in my operating system’s class was to write a simulated file system for linux via system calls.  Basically we had to implement a read and write call for storing data via a file name. Persistence was optional.  Since my time was short, I left out persistence.  Basically all I wrote was a hash.  Write accepts a file name and string of contents or another words a key and value and stores it in a hash table.  Read accepts a file name/key and returns the string of contents/value.  Its fairly simply and provides a good example of utilizing a hash in C.  As for being a true simulated file system….far from it.

I used Horner’s algorithm to hash.  Collisions are handled by chaining.  Each table element is a struct consisting of a pointer character array and a pointer to the next collision struct.  I did not implement any rehashing or resizing of the table.  This is a very basic hash example.  Keep in mind this is not the code for implementing the hash with syscalls in linux.

Download Horner Hash.




This post currently has No Comments

Tags: , , , ,

Open Letter To Circuit City

Filed Under Circuit City

Posted: 27 April 2008
Updated: 28 April 2008

I decided to take Ash’s advice and email the customer support email address she supplied.  It ended up being a fairly nice summarization of all the problems from day 1.  I went ahead and added links to the posts that reference what I’m talking about.  I left them out in the original letter since I feared it may get caught in the spam filter if too many links were in it.  I also blanked out sensitive info such as my incident numbers, name, phone, etc.

 

Dear Circuit City, 

In January of 2008, my tablet PC broke and I sent it in for service.  By that time, I had exceeded Gateway’s warranty and so utilized your City Assure Advantage Protection Plan I purchased.  This started a series of downhill events that continues to this present time.  I also concurrently blogged these on goings.  It was during my last post about your “repair” that a Circuit City employee gave me this address to email about the problems I’ve incurred with your service.  It is my hope that this email will help you rectify problems in your customer support & repair department and perhaps provide me a better resolution then simply cutting me a check for a “broken” stylus.  The following events are in reference to these incident numbers: ########, ########, ########, ########, ########.

January

1. Amunting hardware issues with my Tablet PC eventually led me to send it in for service.  The DC jack, one USB port, and the stylus were all broken.

2. Tablet was returned broken.  It only ran once.  During that first run, I managed to try out the stylus and learned that it still failed to write correctly.  On a restart, the computer failed to boot due to a system fan error.  Upon further inspection I noticed the bottom side fans weren’t functioning.

Critical Thinking:

  • The repair was done via soldering.  This type of repair on a motherboard is only good for do-it-yourself home repairs since you increase the risk of damaging other components.  Case in point, the system fan was damaged and/or forgot to be plugged back in.  An entire motherboard replacement would have been more advisable.
  • What happened to a post functions check?  There is no excuse for returning my tablet PC with one still broken component, the stylus, and one entirely new problem, the system fan.

February

1. Tablet PC sent back in for service.  The system fan and stylus were broken.

2. Laptop returns still broken!  The fan works, but the stylus still fails to write correctly.  The work sheet neglects to mention any fix attempted on stylus.

Critical Thinking:

  • Since the work sheet failed to mention the stylus, I’m left thinking the technician simply ignored the problem.  I assure you, I wrote an even more detailed explanation on how the stylus didn’t work when I initially sent it in for this second time.
  • Review of work done by technician? There is no excuse for forgetting to fix a problem.

February into March

1. Tablet PC sent back in for service for a third time.  The stylus was still broken.

2. Receive phone call stating power supply is broken and will require replacing.

3. Laptop returns with the note: No problems found.  It never mentioned the power supply either.

4. After a lengthy phone call, its decided a new stylus will be shipped to me.

Critical Thinking:

  • The power supply is fine though this latest technician claims otherwise.  It was the same one sent the previous two times.  I never followed through with getting the replacement since it still works.
  • Complete failure of communication.  Though the work sheet stated no problems found, upon calling customer service I learned the tech was able to replicated the issue but determined the battery needed replacing and that was considered a customer fix.  Why did I not receive this information?  Why was I originally told “No problem found.”
  • Laziness on determining proper action.  Had I not asked how to replace the battery would it not have been discovered that customers are not authorized to do it.  The rep spent 10 minutes trying to figure that one out.  How does that type of information go unnoticed?  Someone should have seen that the battery replacement was not a customer fix before it was returned to me.
  • Inconsistency in repairs.  When I first sent the stylus in…it gets replaced.  I send it in this time…a different (but wrong) conclusion is drawn.  Eventually the error is rectified and you decide to mail me a replacement stylus.

April

1.  A couple weeks go by, I call to update my mailing address.  I will be moving soon.  Reassured stylus is on its way.

2.  A couple more weeks go by, I get a suspicious email stating my laptop will be replaced.

3.  I called to verify email, instead am informed I’ll receive a check for $69 to buy a new stylus.

Critical Thinking:

  • Careless emailing.  Nichole G. Victor who sent the email did two things wrong.  One, she did not BCC the recipients.  All the customers’ email addresses were in plain sight.  AKA you just released my email address to other Circuit City customers.  Two, per the rep I talked to, Nichole must have forgotten to replace the word laptop with stylus for the standard mass email.
  • Delay in action.  It took one month before it was determined to send me a check.  There is no excuse for taking that long especially considering you originally told me a stylus was being shipped.  You basically lied to me twice.  Once initially in March, then with my subsequent call in April.
  • The absurdity of in cutting me a check.  When asked why, the rep told me its easier for Circuit City to cut me a check then to find a replacement stylus.  Easier for Circuit City…harder for me?  Bad logic if you ask me.  How did you originally replace the stylus back in January?  When asked how the value was decided, the rep explained the $69 was determined based off the average price found on eBay.  Basing the price off an auction web site seems hardly the best way to do it.  If you already took the time to find the range of prices for my particular stylus, why not just click to buy and ship it my way?  Nothing about this “cutting me a check” seems very professional.
That brings me to present day.  I asked every rep and every time I get the same response.  What happens when this stylus replacement doesn’t work?  You may try again or you may replace my tablet.  Every time I mention I already had to replace the stylus a few times under Gateway’s warranty.  I’m pretty sure its not the pen thats the problem.

Its absurd that I’ve now spent 4 months trying to get my laptop repaired properly.  Its absurd to see all the failures and mistakes you have made during this entire dilemma that not only worsened my opinion of Circuit City but also caused you to waste more and more money.  I hope this email may aid in bettering yourself for future customers.  I also hope this email will aid in you providing me a better solution then cutting me a check since I’m pretty sure this soon to be purchased stylus will not work either.

John Doe
(555) 555 – 5555

 




This post currently has 3 Comments

Tags: , , ,

Farewell Pittsburgh

Filed Under School Misc

Posted: 26 April 2008
Updated: 10 June 2008

To Pittsburgh, my home for the last 3.5 years of my life and home for a total of 4.5 years of my life.  It is with great regret that I have left but not because of you Pittsburgh, but the friends I have there.  Honestly I dislike PA and can’t wait until I can permanently live somewhere out west.  If all goes according to plan (i.e. I don’t get killed overseas) I will return in 2010 to finish out my last year of school.  Unfortunately everyone I know will have graduated.  Save for the few who will continue on with grad school or work in the surrounding area, I probably won’t see many of you ever again.  No worries though, since we’re in the cyber age and I know I’ll always see yous online.  All my friends in Pitt have come from two sources, the Cycling and Geek club.  Two distinctly different clubs to compliment two distinctly different sides of me.




My first shout out will go to the Panther Cycling Team, my first friends in Pittsburgh. I was part of the original crew who participated in the club’s birth way back during the fall of 2005. It was during this time frame we also developed a great friendship with CMU’s cycling team.  I still remember the morning of one of our races, Nick had gone dumpster diving and found a huge trash bag full of donuts for us to eat. LoL. Or the time Penn State snuck their jersey on to Abbey.  To look back and see all the changes the club has gone through still amazes me.  The old crew has all but disappeared and has been replaced with newer members.



Unfortunately this past year I seemed to be non-existent with the club, a consequence of the my heavily increased army duties.  I only raced once (which was a disaster) and hardly participated in any cycling events.  Kinda odd considering I lived in the cycling house.  I still got to meet and befriend many of the fresh new faces.  I wish all my fellow cyclists well and hope to see a thriving club upon my return.

Being one of the “old men” in the club I’ll leave yous with one bit of advice.  To re-establish good relations with CMU.  The Pittsburgh Steel City Showdown race was a heavy drain and probably too much for our two small clubs to handle.  I won’t point fingers and I didn’t get involved (perhaps I should have), however it was upsetting to see our two clubs get bitter with one another.  I hope amends can be made and mistakes forgiven.




My second shout out will go to Pitt Geeks Club.  (Note to self, should have gotten large group shot of club.) Though I was found in the L2L during my first year with Pitt, I didn’t meet most of you until my second year.  I never imagined I’d meet so many people who were as geeky and in most cases geekier than I.  How many people would say “Awesome!” when you boast about spending your Friday night cranking out a game in 24 hours for a coding competition?  Where else could you find people wearing comical shirts that say “There’s no place like 127.0.0.1″?  Or have intellectual debates from superman vs batman to the evolutionary purpose of boobs.  Then of course there’s that whole 1 = 0 talk.



I learned a lot about myself from being around yous and have come to embrace the geek in me even more.  There were no other geeks like yourselves in my high school and I never found such a group of friends with whom I related so well.  I will surely miss all the unique conversations and fun times we had in the L2L.

Thankfully I’m not the “old man” in this club.  That privilege goes to Pete, however I will leave you with this one bit of advice:

010101000110100001101111011100110110010
100100000011101110110100001101111001000
000110011101100101011101000010000001000
001011100110010000001110100011001010110
000101100011011010000010110000100000011
101110110100001101001011011000110010100
100000011101000110100001101111011100110
110010100100000011101110110100001101111
001000000110011101100101011101000010000
001000010011100110010000001110111011011
110111001001101011001000000110011001101
111011100100010000001110100011010000110
111101110011011001010010000001110111011
010000110111100100000011001110110010101
11010000100000010000110111001100101110




This post currently has 3 Comments

Tags: , , , , ,

Blog Updated to Wordpress 2.5.1

Filed Under Updates

Posted: 25 April 2008
Updated: 20 July 2008

Wordpress released a new update and I was quick to update my blog.  There has been one nagging bug in which images are automatically reset to left alignment when switching between Visual and HTML editor.  In fact, I can only center align images via the HTML editor.  If I switch back to to Visual, it actually deletes my center tags.  This update claims to have fixed over 70 bugs.  Unfortunately, it did not fix the only bug I could seem to find.  I’ll just have to continue adding images in HTML editor after writing the post in the Visual editor.




This post currently has 1 Comment

Tags: , ,

SRP At The GAP

Filed Under SRP

Posted: 23 April 2008
Updated: 10 June 2008

This past extended weekend, Delta company found ourselves joining other units at the GAP for SRP.  Unfortunately there’s no wikipedia entry for SRP or Soldier Readiness Program.  Basically its the process all deploying soldiers go through in order to determine eligibility for deployment.  Its a 5 day process involving three stages: admin, health, equipment.  We had to report the morning of the 17th and were released on the 21st.

Since I’ve been deployed before, I was already well aware of all the waiting around that goes on.  This equates to a lot of free time.  As such I left school work to complete during (a first in months).  My gamble payed off, as I successfully completed my assignments.  With all the free time and the nature of what happens during SRP, there’s not a whole lot to talk about.  Nor was there much to take pics of and absolutely nothing worth video taping.



Day one started off with us packing and loading up all our gear.  I was surprised to see they sent a coach bus to take us.  The GAP is only a 45 minute drive away.  Upon arriving, we moved into a barracks, received instructions for SRP and was dismissed.  That night we got a rather large group together and went for run.  Others played a game of football both in the barracks and outside in a nearby field.


Day two, the admin process.  We all bussed over to some building and received a few speeches.  I totally interrupted the one speech with my camera.  I took a picture thinking the flash would not go off.  Oops.  The rest of the day involved everyone going from station to station reviewing our records.  There were 10 different stations (tables) such as security, FRG, finance, DEERs, etc.  Poor Johnny B got the shaft.  He had to redo his security packet which took 4 hours.  Johnny B was quite frustrated and ready to bash up some computers. LoL.  Later that day, we started pre-filling out our medical forms.  This took most the night.


Day three, the medical process.  Lots of examinations such as hearing, dental, vision, etc.  A significant portion of soldiers had to get dental work done.  Mostly fillings, however there were some teeth pullings.  Three civilian doctors in a nearby truck would immediately perform the required dental work.  Though I passed my hearing requirements I learned that my left ear has taken significant damage.  I’ve lost most my higher toned hearing and some of my lower toned as well.  My right ear is still in perfect shape.  Later that night, we put another group run together.


Day four, the equipment process.  Basically we were issued any missing gear.  I was looking forward to receiving the new sleeping bags, however they ran out just before I got it.  My current sleeping bag is from the vietnam era…literally.  Unfortunately, the GAP was running short with other gear as well.  No worries though, we’ll go through this all over again.  This SRP just clears soldiers from PA to be deployable.  We’ll need to do SRP again at the fort that will actually deploy us.  So anything I didn’t get now, I will get then.  Later that day, we did some map reading training to help fill the time.


Day five, the pack and return home.  We cleaned up the barracks and waited several hours for the bus to come.  In that wait, we got a good game of football going.  And ummmm…thats about it.
 
Like I said, nothing really happened.  Check out all the SRP pics here.


Wanna receive email updates to new Army postings? Register with my site.


All Army Pics | Army High Qual Videos
This post currently has No Comments

Tags: , , , , ,

Circuit City Will Replace Tablet PC…NOT

Filed Under Circuit City

Posted: 23 April 2008
Updated: 23 April 2008

Its been very quiet on the Table PC front.  So quiet, I actually began to worry. Hell its only been 1 month since they said a stylus pen will shipped to me.  Had they forgotten about me?  This morning, I got the following email from Circuit City:

Hello
We have determined that your Laptop needs to be replaced. Please contact 1-800-555-4615 to view the Replacement Offer Available.
Please refer to the terms and conditions of your warranty. The replacement can be new or refurbished, regardless of manufacturer. The replacement has to meet or exceed the specifications of the original unit.
Please contact us via phone or chat with your decision.

Your satisfaction is important to us.  Please respond to this message through our Support Portal within five (5) days if needed. Do not reply directly to this email message. You can access the Support Portal via the internet at http://www.cityassure.com/cityassure/emailCustomerService.do.  If we can assist you with any product additions or upgrade components for your computer, please contact us at 1-800-555-4615 or simply e-mail a time that we may contact you.

Be Encouraged!
Nichole G. Victor
Assurant Solutions-Atlanta
Warranty Replacement Agent
Email:Nichole. Victor@Assurant.com
Internal Ext. 12265
Direct #: 770-763-2265
Fax: 770-459-8030″

Upon first reading this, I was very ecstatic however some odd things started to pop out.  First one was who the email was addressed to.  I was one of twelve other seemingly random email addresses (Commonly seen in spam).  Even if this was intended for more then one person, why not BCC?  You are exposing all the customers’ email addresses.

What’s up with the .do web extension?  I never heard of that.  A quick google search shows that its normally associated with Java pages.  The web address is a valid subdirectory of their main website, CityAssure.  Since I’m using a Mac, I knew I could safely clink the link.  It took me to a CAPTCHA which then yielded a page to fill out a form with personal info as well as info from some ticket receipt that I’ve never seen before.

What further bothered me was that my Tablet is with me.  I never had to send it back out.  The last we talked, they decided to mail me a new stylus pen even though the previous pen replacement didn’t work.  Why the sudden change of plan?  Also, why an email?  Last surprise change they did via phone.  Calling seems a lot more legit in this circumstance.

The 1-800 stated in the email was the correct number I’ve been calling for help, though I never realized the “555″ until now.  I went ahead and gave a call.  Apparently the whole email was, in fact, legit.  The representative (I missed his name) explained it was a standard mass email.  Though Nichole had made a mistake.  She forget to replace the word “laptop” with “stylus”.  Damn!

I informed the rep about exposing the customer email addresses in the TO section as well as my dislike that now my email has been freely given to other random people.  The rep recorded my comments and judging by his inquiries on the matter, I don’t think he ever heard of BCC (Blind Carbon Copying).  That’s bad.  Btw, I sent out an email to all the customer’s informing them of the mistake and urging them to call in to complain.

I was also informed that I will not be receiving a replacement stylus.  Instead they will cut me a check for $69.  It took 1 month to come to this decision?!?!? The price was an average determined by searching Ebay.  Wtf?  Last I remember, you could directly purchase such items from Gateway’s supplier.  Then to use Ebay as the basis for how much the stylus is worth?  Weird.  The rep also said, instead of them going through the trouble of tracking down a stylus, it would be easier (for them) to simply cut me a check and have me buy the stylus.  Sssooooo, how did they replace my stylus previously?  Oh right, that was WAAAYYYY back in January.  They probably ran out by now.




This post currently has 4 Comments

Tags: , ,

24 Hr Game Coding Competition

Filed Under Pitt Geeks

Posted: 21 April 2008
Updated: 10 June 2008

Last weekend the Pitt Geeks Club held our annual 24 hour coding competition.  Participants were allowed to form teams of up to three people.  They could choose any language, platform, and type of game they wished.  Six teams signed up but only four of us completed something.




I held on posting this in the hope of tracking down all the teams code and games however, due to finals that was a total failure.  My choice of language was QBasic.  I had written and released a QB sprite editor for specific use in this competition.  Other language choices were C++ and D.  I’m not entirely sure what all the teams used.



The winner was Team OMGWTFBBQ with the theme of Penguins and Gangsta Rap.  They devised an awesome game which combined Tetris with Breakout.  Basically at certain points of the game, the whole Tetris board would flip over and your next Tetris piece turned into the paddle which the ball would bounce off of.  They also included network play where you could battle the other person.  Throw in a hip Penguin commentator and some catchy pirate rap and you got yourself one hell of a game.  I managed to get this source code and will post everything as soon as I get time to compile it.

My game was pretty much a flop.  I attempted a RPG and discovered that it takes too long to do such a game in QBasic.  In the end, I didn’t really have a game.  Its more of a display of graphics.  Granted the graphics I did far exceeded anything I managed to do in the past, however I never got to include any frame animation.  The “world view” map supports connecting multiple maps (like old school NES Zelda) and uses a 2nd overlay map for collision detection.  The battle screen is very similar to FF2’s battle view screen.  Supporting 2 player characters and 4 enemy sprites.  That’s about it.

I also realized that QBasic is a bitch when getting into this complex of programming.  The next annual programming competition, I’ll switch to another language.  I’ve included a zip of the source code and executable.

More Photos From Event
Download QB RPG