That configparser looks useful, I have been useing configuration files, but I was just wondering what to do with the clutter. Thanks for the link.

Hi all,

I am fairly confident with Python, and am now turning my focus from learning how to program the language to learning to program it well. I am wondering what the best way to approch classes which have too many variables in them.

I an writing a platformer game, and, though it works fine, I am trying to clean up the code. My Player class is especially messy.

Here is an example:

class Player(obj.PhySprite):

    warp = None #this stores the function to change levels. It should take the
                #same arguments as the Level class 
    #counters:
    shards = 0 #shards collected
    points = 0
    lives = 5

    #charictaristics:
    IS_PLAYER = True
    FALLS = True
    MOVES = True
    IS_ITEM = True

    entrance_coords = None #the normal coords when the player entered the
                           #portal to the level. When he dies/wins he is
                           #returned to this location.

    #constants:
    CLIMB_VEL = 1.25 #how fast he climbs up/down/left/right
    WALK_ACCEL = .1 #how fast he normally accelerates
    RUN_ACCEL = .02 #how fast he accelerates when running or dashing

    DECREST_ACCEL = .4 #when the jump key is releaced this is added to
                       #gravity until he stops going up and starts
                       #falling

    DEACCEL = .4 #when slowing down or turning this is additional accel

    MAX_WALK = 1  #max walking speed
    MAX_RUN = 2.95 #max running speed
    MAX_DASH = 3  #max dashing speed
    MAX_VEL = 5   #max overall speed
    MAX_CAPED_FALL = .5
    MAX_DRIFTING_CAPE_FALL = 1
    ASCENDING_TIME = 30
    ASCENDING_VEL = 8
    MAX_FALL = MAX_VEL #max falling speed
    MAX_TWIRL = ...

The passwords are all encripted in /etc/shadow, but due to the encription you cannot decipher them. If you install the distro on your hard drive then you will be able to reset the password manually by editing the file while booting from another live cd. This post describes how to do that.

I have a slackware 13.1 tower computer and an Ubuntu 10.04 netbook. The netbook has an Atheros AR9285 wireless adapter, and I just recently got a Netgear WG111v3 USB wireless for the tower. I got the ndiswrapper driver working for the Netgear, and I have been previously been using the Ubuntu wifi without problem.

My goal is to get an ad-hoc lan set up between the two computers, and it seems that I have almost succeed. The laptop says it is connected, but neither computer can ping the other.

Here is what I did.
On the tower:
[CODE]# ifconfig wlan0 down

iwconfig wlan0 channel 1 mode ad-hoc essid 'lan' key off

ifconfig 192.168.1.1[/CODE]

On the laptop I did the same thing with the ip 192.168.1.2, but when that didn't work I typed iwconfig to see if everything was correct and the essid key was scrambled. I then tried using Ubuntu's network manager to connect. I connected to 'lan' and, after I manually set the ip and netmask, it said I had a very strong connection.

Here is the problem. I can't ping either computer. Ping always returns "Destination Host Unreachable." when I try to ping the other computer.

I am currently fairly new to setting up ad-hoc networks and was wondering what I could do to troubleshoot.

Thanks in advance

Hi all,

I have a Pentium 4 with hyper-threading on my Slackware machine. Currently I am running the non-SMP 2.6.24.5 kernel, but I want the option to be able to boot with the 2.6.33.4 SMP kernel as well. I already have Lilo installed on my computer and have a large variety of kernels installed. What I want to know is how I should edit my /etc/lilo.conf file and what kernel I should use: huge/generic?

currently my lilo.conf file looks like this:
[CODE]# LILO configuration file

generated by 'liloconfig'

#

Start LILO global section

boot = /dev/hda

compact # faster, but won't work on all systems.

Append any additional kernel parameters:

append=" root=/dev/hdb1 vt.default_utf8=0"
prompt
timeout = 50

Normal VGA console

vga = normal

ramdisk = 0 # paranoia setting

End LILO global section

Linux bootable partition config begins

image = /boot/vmlinuz
label = TheLinuxMachine
read-only # Partitions should be mounted read-only for checking

Linux bootable partition config ends

Windows bootable partition config begins

other = /dev/hda1
label = WindowsXP
table = /dev/hda

Windows bootable partition config ends[/CODE]

My theory is that I should change the end of this file to:
[CODE]image = /boot/vmlinuz-huge-smp-2.6.33.4-smp
label = Slack-2.6.33.4-SMP
read-only # Partitions should be mounted read-only for checking
other = /boot/vmlinuz-huge-smp-2.6.24.5-smp #does this line need to start with other = or with image =?
label = Slack-2.6.24.5-nonSMP
read-only # Partitions should be mounted read-only for checking
other = /dev/hda1
label = WindowsXP
table ...

Personally I would read the file one line at a time to a string and convert that string to a c-string ( char array ). A char array would be ideal for this.

It worked. Thank you.

Hi all,

I am trying to create a class to serve as a customized cout class. Right now I have made some test code to see if I can do it. Right now I am trying to make it function just like cout, but later I will have it do more than just print text to the screen.

Currently my class works when I try and print one item, but not multiple ones.

The code:

[CODE=c++, operator.cpp]#include "operator.h"

using namespace std;

void printclass::operator<<( const string & mesg )
{
cout << mesg;
}

int main()
{
printclass print;

print << "hi"; print << "\n"; //this complies

print << "hi" << "\n"; //but this doesn't

return 0;

}[/CODE][CODE=c++, operator.h]#include <iostream>

include <sstream>

include <string>

using namespace std;

class printclass
{
public:
void operator<<( const string & mesg );
};[/CODE]

The problem is that print << "hi" << "\n"; will not compile. This does not surprise me, but I do not know how to modify my class to make it work. Anyone have any suggestions?

Thanks in advance.

That worked well.

My problem was with grep. When I removed grep from that line everything worked as planed.

Thanks!

Hi,

I was wanting to write a (ba)sh script to allow me to wait for the detection of a new USB device, and when that device is detected, execute some commands. The scripts are intending to be working on the principle that whenever I plug in a usb device a message containing the words "new" and "USB" is appended to /var/log/messages. I want this program to be running in the background of my computer at all times, so I want one that will take as little cpu power as it can when there is nothing for it to do. I have tried to do this two ways: with read and with tail ./fifo_pipe.

My first attempt looked something like this:
[CODE=sh]

!/bin/sh

foo.sh

tail -f /var/log/messages | grep "new.*USB" | ./bar.sh &
disown %
[/CODE]
[CODE=sh]

!/bin/sh

bar.sh

while true
do
read
echo "detected new usb"
done
[/CODE]

This did absolutely nothing.

Then I tried this:
[CODE=sh]

!/bin/sh

foo2.sh

mkfifo pipe
tail -f /var/log/messages | grep "new.*USB" > pipe &
disown %
while true
do
tail pipe
echo "found new USB device"
done
[/CODE]
Just as before it did not output anything.
Any suggestions? I do not want to use udev or automount, but use tail -f /var/log/messages

-thanks

Is gettimeofday() portable to windows as well? I am using Linux right now, but I will want this game to be portable. It looks like SDL can measure time in milliseconds, so I may end up using that. If gettimeofday() is portable it looks like it may work better.

Is there any way to get the time() function to have greater precision? I need more precision than one second as explained in my question. I have heard that this is implemented in the boost libraries, but I want to stay away from that as much as possible.
Thanks for your help so far.

I am writing a game in which I need to know whether or not a user preforms an action in one second or less. I can not use time() because it measures time in seconds. If the user starts the action half-way through a second it would mess with accuracy.

I am experimenting with clock(). I have got clock to work with some programs to make a delay, but not in this way to measure time:

[CODE]

include <iostream>

include <ctime>

using namespace std;

int main()
{
clock_t start = clock();
cout << "press enter...";
cin.ignore();
clock_t finish = clock();
double time = (finish-start)/CLOCKS_PER_SEC;
cout << "you took " << time << " seconds\n";
return 0;
}
[/CODE]

This program returns 0 for time seemingly no matter how long I wait. I have tried several things including eliminating the need for the double time variable and testing the time variable to make sure it is exactly zero. Does anyone see what mistake I am making, or is there something I do not know about clock()?

Thanks,

I use Linux a lot, but I have never actually installed it myself. Thanks for your help.

I am adding a secondary hard drive to my dell tower. I am wanting to duel boot Windows XP and Slackware Linux. I currently have only Windows XP on my computer, but I am not sure what formating it has on it.

My question is: what format should I use on the secondary drive for Linux? Does it need to be the same as the format on the primary drive?

Thanks in advance :)

Finish my SDL Game of Life program.

Install Slackware on my tower PC.

Ditch Ubuntu and get Slackware on my Netbook.

Learn to use blender.

Set up a LAN between two @%#& Windows computers. (This is [I]much[/I] harder than it should be! )

You should try searching online for something like "algorithm for pascal's triangle". I did and I found [URL="

These are true but I have not witnessed them:

A lady had just bought a new computer back in the day of the 8 inch floppies. She had a 3 1/2 inch floppy drive and some software on a 8 inch floppy. Well it [I]didn't fit[/I] so with wonderful ingenuity ... she trimmed it down to size!

In the early days of the CD-ROM a man dialed up custamer support for his new computer and complained that his coffee cup holder kept disappearing!

A lady just bought a computer and floppy drive in addition to her typewriter. She had just written to a of floppies and was wanting to label them, which she did ... with her [B]impact[/B] typewriter! Customer support then had to deal with a very mad lady with a bunch of ruined floppies.

;)

External hard drives and flash drives are much slower than the internal hard drive(s). Unless you have USB 3.0 ports then I would go with the internal hard drive but, bear in mind, writing and re-writing things on your hard drive will wear it out. I can't wait until solid state hard drives become common because they are so much more reliable.

[QUOTE]Most of your new games (proper games) is between 2 and 6 GB in size[/QUOTE]
As a retro gamer I think the best games are between 32 and 125k in size. ;)

As above: Nothing. I still think Pentium 4 computers are fast enough ... and expensive enough.

Although I have no love for the OS my favorite games are DOS freeware and shareware games especially Dune 2, Bio Menace, Xargon, Tryplane Turmoil, Flashback, PoP 4D, Sky roads and ... OK, I'll stop. :) Try them with DosBox if you find the time.

For modern platforms I [B]love[/B] Ascii Sector. It is the best Ascii game I have ever seen. You very quickly overlook the lack of fancy graphics because of how polished the game is.

For completely non-retro games I like the 3-D Star Wraith Games.

...

I could go on but, I'll stop. :)

If/when you learn c++ try using SDL if you want to make a 2-D graphical game. It has some excellent tutorials at [URL="

I would try using SDL. I use it and, it has many functions including detecting mouse and keyboard activity, multithreading, alpha blending, .ttf text, and audio.

For simple but excellent tutorials on how to get it, use it and, make games with it check [url]http://www.lazyfoo.net/SDL_tutorials/[/url].

These tutorials show you all of the important parts of SDL and many cool tricks you can do with it. With simple lessons and example programs.

Have fun! :)

I would try using SDL. I use it and, it has many functions including detecting mouse and keyboard activity, multithreading, alpha blending, .ttf text, and audio.

For simple but excellent tutorials on how to get it, use it and, make games with it check [URL="

I would try using SDL. I use it and, it has many functions including detecting mouse and keyboard activity, multithreading, alpha blending, .ttf text, and audio. For simple but excellent tutorials on how to get it, use it and, make games with it check [URL="

I would try using SDL. I use it and, it has many functions including detecting mouse and keyboard activity. For simple but excellent tutorials on how to get it, use it and, make games with it check [URL="

And here is Oregon's weather pattern:

Spring: a [B]lot[/B] of rain

Summer: warm rain

Fall: more rain

Winter: cold rain

I registered today and got that message as well. Doesn't seem to have any effect.

Thanks for all of your help!

You may also want to consider using a struct if it fits your needs. They are simple to put into a class.