Python Program Idea

So I was thinking about what project might be fun to do with Python as a test. I was thinking maybe a Trivia Game. Something where when you first start it, you pick the default topic that questions are randomly asked from. When someone answers a question correctly, they get given an option to change the topic. If everyone leaves, it stays with the same topic. If you get a high enough score, you get to submit questions to the database, that then have to be oked by the admin.

We could have ads for Amazon and Google type targeted ad stuff linked to different topics and questions. The admin would do that as they were oking submitted questions. The answer area would be seperate from the chat area so that every “guess” someone makes at a question helps to rate it’s difficulty. The more difficult a question is rated, the more points it is worth when it is gotten right. We could also make different difficulty levels that change the time you have to answer. The more difficult questions get put in the appropriate difficulty area.

We would start out with a “General” difficulty level area that people could go into and play, as the questions get rated on difficulty, we could then switch to “Easy”, “Medium”, “Hard” difficulties. Where the time is shorter, and the proper difficulty rating questions always get asked. We could still provide the “General” area where new questions could get added in to pick up a rating. We could also make it so the “General” area is worth 1X times the difficulty rating of the question, “Easy” is 2X, “Medium” 3X, “Hard” 4X. The questions get a rating based on how many guesses each person makes at the answer.

Python!

So I got my Python book on Friday, and decided to start trying to work my way through it, yesterday I wrote my first program.. Well, ok, it was my second. My first program was a bit to easy to bother with covering here.. It was print “Hello World!” and that was it. Just like starting to learn any new language. 🙂 I also learned that the Python Programming Language is named after Monty Python. Which I guess I sort of knew, but it was interesting to discover that was the case for sure. Anyways. Here is my first script even close to a real program!

#!/usr/bin/python2.4
# Make a variable called name, and have the user input what it is equal to
name = raw_input(“What is your name?”)
# Greet the person by name using the variable we collected
print “Hello, ” + name + “!”
# Make the screen pause and wait for input so it does not close the minute it is finished.
raw_input(“Press <enter> “)

Duke 3D in Linux

So I really wanted to get Duke3D going in Linux. I tried the Eduke32, and the JonoFs Build, but had no luck. I decided to go to old faithful for Linux, Icculus. I got an error right off as I tried to build the buildengine with a make. 🙁 Bummer.

a.c: In function ‘prevlineasm1’:
a.c:189: error: invalid lvalue in assignment
make: *** [a.o] Error 1

Luckily, my better half is a coder geek, so we went to line 189 where it was puking, and she suggested taking out (unsigned long). Parenthesis and all, make sure you leave the rest of the line.

((unsigned long)i4) >>= mach3_al;

make it:

(i4) >>= mach3_al;

We saved the file, tried make again, it worked, I then proceeded to follow the rest of their instructions. Make sure to copy over their .con files otherwise it won’t work! I also downloaded the Hi Res pack. But was unable to get it going with the Icculus version. If anyone knows how, be sure to leave me a comment? Thanks!

Making the Linux version of Simcity 3000 Unlimited work

Ok, so I have been kinda annoyed that I could not make Simcity 3000 Unlimited from LokiGames work in linux in the last few years. Everytime I try, something does not work. I have followed directions from different places for years to get this working in Linux, and never had much success. Until today.

I discovered if you install the Loki Simcity 3000 Unlimited, then download the patch from one of the places here, (This one worked for me.)then install the patch with the command:

./sc3u-2.0a-x86.run –keep

If you run the patch without the –keep it will give you an error like this:

Verifying archive integrity…OK
Uncompressing SimCity 3000 Unlimited 2.0a Updatetrap: usage: trap [-lp] [arg signal_spec …]
If all goes well it will install and ask you a few questions. Answer all those right, then run the program using the command:

LD_ASSUME_KERNEL=2.2.5 /usr/local/games/SC3U/sc3u

If you run the game without the LD_ASSIME_KERNEL command it will probably just segment fault on you like it did me. I give credit to this thread on the Ubuntu forms for this info, as well as Google for allowing me to find the info I needed! Hope this helps someone else!

SimCity 3000 Unlimited

Library Books

So everytime I get a chance, I go and comb the local library for Python and Linux books. Why? Well, because I would like to know more about Linux, and because I have had a long standing interest in learning Python. Ever since I discovered you could create applications like Lsongs in Python. Lsongs may not be the best music player ever, but it is pretty feature rich, and reasonably pretty. So it got me interested in Python. I will be trying to learn more about Python soon as I just bought a decent book from Amazon on Python.

What I did get recently at the library was Linux For Dummies and Linux Power Tools. Seems silly right? Getting a Dummies book, and a Powertools book? However, the dummies book is about Fedora Core, which I have not used. The last time I tried an RPM distro was Red Hat 6.2 and Mandrake 8.2? Mandrake is now Mandriva, Red Hat now has a seperate free version (Fedora Core) and their Red Hat Products are aimed at Servers and such. So it has been a while. So the Dummy book on Fedora could be interesting. Although, the more I read about RPM stuff, the more I am happy with Debians apt-get and synaptic and dpkg package management for stuff. 🙂

The Power Tools book is all about improving performance and tweaking your system. In the book they talk about compiling your own kernel, different package management for different distros (they talk about Suse, Red Hat, Debian, Mandrake and Slackware throughout the book.) If you ever wanted a bit more in depth knowledge of the differences in distros, this is not a bad book. It has just enough info to be useful, but not enough to make you an expert at anything. 😛

As I read more, I will post more thoughts about it. Just felt like I should post some idea of what I am learning today.

Update

Ok, so Emmy read my entry for the other day, and said,”You really should put a step by step instruction on your blog.” So, I thought about it, and thought she was right. After all, I did link to a lot of places with a lot of good info, but what if those places go away? So, here is a step by step of what I did to recover my dying drive.

  1. Put old drive back in as slave. Make sure you have enough room on your master drive for the entire old drive, freespace and all.
  2. Boot up your main drive. The failing one probably will not mount, that is why you are trying to rescue it, right? However, you will need to know what device it is. If it is actually the slave off the master, it will probably be /dev/hdb something. So goto a konsole and type mount, that will give you a list of all partitions, mounted or not that are available on your system. Find the one you are looking to recover.
  3. Type : dd_rescue /dev/hdb3 /home/mine/Backups/olddrive.img
    The Command, The device, This is the directory you want it backed up to.
  4. Make sure the directory you are backing up to has plenty of space on that partition. If you run out of space, you may not recover what you wanted.
  5. Watch it run… watch it run for a very long time… watch it stop on errors for a long time. Find something else to do.. Watch a movie or 10.
  6. When it finishes, you should be able to do an su or sudo depending what distro you are running. You need access to write to system areas and do admin tasks.
  7. losetup /dev/loop1 /home/travis/Backups/olddrive.img
  8. That will set the image you just created as a loop device.
  9. You will then want to mkdir /media/olddrive or whatever or where ever else you want to reference it.
  10. mount -t reiserfs /dev/loop1 /media/olddrive
  11. You will need to know something of the mount command, and what file system type you have. With Linspire, it was Reiserfs. Also, you can exit the console at this point if everything was successful.
  12. I was then able to open /media/olddrive in konq and see everything from my old drive and copy it off. I love Linux and ddrescue!

I hope this helps someone as much as all those other references helped me. At the very least it gives everyone one more place to possibly find what they need to know to save some important data! For good measure, here is another picture I recovered!

Me on a rope swing!

Hard Drive Recovery.

So normally I am pretty good about backing things up. You know, burning a CD here and there of important stuff can be all the difference between having what you need and losing something important. Well, about two years ago, I slipped. For about one month, I did not backup. I paid for it dearly. My kids were here visiting for that month, and I had all the digital pictures for that month on my Linspire hard drive. I got distracted, and did not do my backups, or even copy files between me and Emmy which we often do.

One day, as my computer was booting, it told me Smart had detected my hard drive was failing, please replace it as soon as possible. I thought,”Oh crap!” I then proceeded to see if it would boot. It didn’t. It could not mount the partition that had all my data. I was running a Linux distro called Linspire. They use what is called Reiserfs for a file system. At the time, I had No clue on how to go about rescuing anything on the hard drive. So I stuck it away, and every once in awhile look at it and think,”I wish I could rescue my stuff off that drive.” 🙁 I even thought about tossing the drive at one point figuring it was shot.

Recently, I have started playing with other versions of Linux again. Nothing against Linspire, in fact, I really think Linspire is a nice easy version of Linux.. In fact, to easy. I got lazy, and was not learning how to do a lot of the stuff I was once learning so quickly.. In fact, I found myself forgetting a lot of what I had known about linux at one point. You see, I have been using Linux to one extent or another since 94 or 95. My father and I setup a Slackware server that we used at our office, and one that we used at home so Emmy and I could both play our favorite MUD through one dialup internet connection. Anyways, as you can imagine, over the years, I have played with Linux a lot.. but never completely figured it out. So I am learning new and interesting things about it all the time.

Well, recently, I finally stumbled across something mentioning how to go about recovering stuff from a partition that has become corrupted. I thought,”Ah ha! I bet I can use this to save those photos and stuff I lost a couple of years ago!” So I went searching for more info. If you read that other article, you might think,”What else ya need to know? That seems to cover it pretty good!” Well, I have always been the type who would rather be overly informed. With the photos and stuff on that drive, I have always kinda thought, when I try to recover that stuff, I need to get it right the first time, cause that drive will die about the time I plug it back into my computer.

So anyways, I decided to go research a bit, and went looking for more information. I found such articles as this and this. Finally, I stumbled across this blog. At this point, I started feeling like I had a chance of actually rescuing my precious pictures. So I started reading about dd_rescue. I am now running Mepis 6 Linux. Which is based on Ubuntu. So the directions that I found seemed fairly useful and complete.

So I dug out that old drive. It is an old Western Digital 40 Gig drive. Nothing special, and at this time, almost worthless, except for the data on it. The data, like I said before, is priceless to me. Anyways, when it first started failing and I could not get it to boot, I just took it out of the computer and stuck it away in my desk. It has not been fired up since. So I took it out, hooked it up as a slave in line with my main 120gig Mepis Drive. I then ran dd_rescue on it using the command:

dd_rescue /dev/hdb3 /home/mine/Backups/linspire.img

At first, it barely seemed to be doing anything.. Some numbers come up on the screen, but it kept stopping for long periods of time.. At first I thought the drive was so far gone that it was dying in process, after all, that is basically what kept happening when I tried to mount it. So I actually stopped it after about 10 minutes because I was convinced it was not working. Then I checked the linspire.img file, and what do you know, it was over 2 mb big. That does not seem like a big deal, but was 2mb of that stuff I did not have before. It let me know it was doing something! So I reran the same command again, and let it go. I soon came to realize that it was going through sector by sector and writing all the data it could get to the linspire.img file. Everytime it got to an error, it would pause a while and try to read it. As it got further in, it started to speed up a bit. By the time it was done, I think it took like 14-16 hours to recover the 37 gig partition. I had over 4000 errors, and the 37 gig partition was only 36 something now. However, I followed the instructions on the Ubuntu Blog, the only difference being, since I am in Mepis, and not Ubuntu, I was able to just su over to the root account and just run all those commands nice and easy instead of of sudoing them. Not a big deal, but my preference. By the time it was done, I actually recovered the pictures! In fact, the ones I was most worried about was our Canoe Trip down the Weeki Wachee River.

Here is a picture of 3 of my favorite people in the world from that trip!

Picnic Picture.
I am so thrilled I have finally managed to recover the stuff off this drive, and at this point, I have a backup of the entire thing! So even though the drive has now pretty much completely failed, I can pull whatever I want whenever I want from my backup img. I love Linux! I dunno how many times I lost small amounts of data because of MS Windows! Remember, always backup your data regularly, and if you can, use Linux and other MS alternatives. Firefox is a great place to start!