Comatose 290 Taboo Programmer Team Colleague

A universal distro might as well be as monolithic as the proprietary alternatives. When you start trying to tame a lion, you get bit in the ass...

Comatose 290 Taboo Programmer Team Colleague

> 3. Focus on the positive side of Linux--people are tired of Microsoft bashing.

I disagree Reginald. If people continue to use garbage, it should be thrown in their face that they use trash instead of something worth using. My two cents.

Comatose 290 Taboo Programmer Team Colleague

I've read a lot of good ones since you've been writing, but I really like this one.

Comatose 290 Taboo Programmer Team Colleague

Not sure how this helps.... it would be difficult to determine what is in folder 1 or 10.

Comatose 290 Taboo Programmer Team Colleague

Swaps Two Elements Of An Array (So that say, indice1's value would become indice2's value, and vice versa). Simple Code Piece Really...

Comatose 290 Taboo Programmer Team Colleague

Another Small And Simple Function To Take Each Character of a string, and put it into an Array, This helps significantly when you need to sift through a string. This Function Uses The spush (String Push) Function, Also In Code Snippits.

Comatose 290 Taboo Programmer Team Colleague

The Relative of push is pop. Pop removes the last item in an Array, and returns the value into a single (scalar) variable. Again, due To VB Limitations, this one works on strings.

Comatose 290 Taboo Programmer Team Colleague

Simple Function To Simulate The Push Command, due to VB's limitations, This one is Specific To Strings. (Simple enough to modify for integers or variants, etc)

Comatose 290 Taboo Programmer Team Colleague

A Simple Function To Generate A Random Password Of A Given Set Of Characters

Comatose 290 Taboo Programmer Team Colleague

Heavens Yes! Watch this thread get deleted... just like my tutorials.

Comatose 290 Taboo Programmer Team Colleague

Ah, ok... so in the new text file, you want it Tab delimited... so the upper case words <tab> definition. K.

Comatose 290 Taboo Programmer Team Colleague

What Platform?

Comatose 290 Taboo Programmer Team Colleague

I'm not sure what you mean by in a column... in a text file?

Comatose 290 Taboo Programmer Team Colleague

You could tokenize (strtok) by "<" and stick each piece into a vector or so... then get it's size().

Comatose 290 Taboo Programmer Team Colleague

Because you never increment "n" anywhere. In your do while, you need to stick an n++ some place.

Comatose 290 Taboo Programmer Team Colleague

You need to remove the 'mysql' parameter from connect. Should look something like this:

use DBI;

$dsn="DBI:mysql:database=mysql";
$dbh=DBI->connect($dsn, 'root', 'root', {RaiseError => 1});
Comatose 290 Taboo Programmer Team Colleague

FTP uses two ports (typically 20 and 21). One of those ports is meant to handle all of your commands. The other one, is meant to return data to you. If you receive an EOF on the command channel, it likely means that the command channel (port 21) is indicated that the file transfer has completed successfully, and it's telling you that it's done sending the file (EOF). I've never used the ftp module, so I can't tell you where to fix it... doing it with just sockets, I'd make the code simply discard the EOF, and use it to inform me to close the file handle....you'll want to look at the ftp module's properties, or see if you can error trap the error and discard it.

Comatose 290 Taboo Programmer Team Colleague

You could look into using find: find / -name $1 or you could try doing it by piping it to grep: find / | grep "$1" , but in order for you to make it go from shallowest to deepest, you might have to do something with sort, such as piping the data to it: find / | grep "$1" | sort -g . As for only going 5 levels deep, and printing errors if not found, you are probably bound to rely on awk and/or sed.

Comatose 290 Taboo Programmer Team Colleague

In Samba, the dollar sign has special meaning (something to do with netbios and/or hidden shares). Try sharing the name on the 'doz box without a $, and try to connect to it. You MIGHT be able to escape the $ or replace it with \044 or something crazy, but you might as well just make a share without the $, and use it.

Comatose 290 Taboo Programmer Team Colleague

ah, you are missing a slash of some kind it seems... you are escaping the first backslash with the second. You probably need to add something like this:

$map_drive = '/cygdrive/c/windows/system32/net use x: \\\\share1\\share2';

I dunno if there is a cleaner way to say "hey, don't escape this stuff", but this should work.

Comatose 290 Taboo Programmer Team Colleague

Wait What?

You're running a script on *nix, and want that script to map a drive on a windows machine?????

Comatose 290 Taboo Programmer Team Colleague

Nah, in the overridden virtual wage() method, simply put something like cout << "Manager" in the Manager's method, and cout << "Casual" in the Casual's method.

Or make a virtual overridden method for each class that is like "GetType()", and have wage() call GetType(). The proper way to do what you want to do, is to use polymorphism... regardless of how you choose to get the type.

Comatose 290 Taboo Programmer Team Colleague

Here Here!

Comatose 290 Taboo Programmer Team Colleague

To give yourself a pat on the back? Another Interesting Fact: you can also post your own arbitrary snippets... but can't post tutorials.

Comatose 290 Taboo Programmer Team Colleague

mkay. Have you done a msgbox on rs.RecordCount, to ensure it has the right number of elements? Like, just before the first if?

Comatose 290 Taboo Programmer Team Colleague

How 'Bout using code tags, and reading the office tutorial?
http://www.daniweb.com/tutorials/tutorial51307.html

Comatose 290 Taboo Programmer Team Colleague

How 'Bout Reading The Sticky Post: http://www.daniweb.com/forums/thread41057.html ?

Comatose 290 Taboo Programmer Team Colleague

Moderators are not supposed to strip posts out

Sir, I beg to differ. When a question is posted to a thread that is old or solved or heck, when they are not the OP.... a moderator is supposed to "split" that into a new thread. I mean, I did when I was a moderator.

Comatose 290 Taboo Programmer Team Colleague

I hate suggesting things like this but you can use system:

system("word.exe");
Comatose 290 Taboo Programmer Team Colleague

what does your xorg.conf look like? (can be found I think in /etc/X11/xorg.conf, not 100% sure about where it is in BSD)

Comatose 290 Taboo Programmer Team Colleague

Yes. I'm not sure about if it exists through a web page... but you could connect to it with a program like Mirc, IceChat, or Chatzilla the firefox add-on. Then you just connect to server: irc.daniweb.com (port 6667), and join channel #Daniweb. There is probably still a web client for it somewhere, but I'm not sure.

Comatose 290 Taboo Programmer Team Colleague

Hmmmm isn't TotalSold supposed to be static?

Comatose 290 Taboo Programmer Team Colleague

One of the biggest problems here, is getting the shell to handle floating point numbers. I'm not using / have access to a solaris machine, so I'm going strictly of bash in slackware.... but the shell doesn't handle floating point numbers. In a Perl script, I could knock this out, or in a C++ program, it would be a breeze... but doing this as a shell script, is an entirely different beast. Parsing the data with awk or sed would be alright, but converting the numbers is an entirely different challenge. In perl, it is pretty easy:

#!/usr/bin/perl

push @lines, "d15 509MB c1t0d0s5";
push @lines, "d13 7.0GB c1t0d0s3";
push @lines, "d11 1.5GB c1t0d0s1";
push @lines, "d10 10GB c1t0d0s0";
push @lines, "d25 509MB c1t1d0s5";
push @lines, "d23 7.0GB c1t1d0s3";
push @lines, "d21 1.5GB c1t1d0s1";
push @lines, "d20 10GB c1t1d0s0";

foreach $line (@lines) {
	($dcode, $unit, $drive) = split(/\s/, $line);

	if (substr($unit, (length($unit) -2), 2) eq "GB") {
		$unit = substr($unit, 0, length($unit) -2);
		$unit = ($unit * 1024); 		# // Convert To MB
	} else {
		$unit = substr($unit, 0, (length($unit) -2));
	}

	print "$dcode\t$unit\t$drive\n";
}
Comatose 290 Taboo Programmer Team Colleague

You could probably get away with using expect. Basically, you could have your script call the expect script in a loop (or figure out how to make expect do a loop) which will be for each machine you want to test. So, make your shell script do a loop, where the variable gets concatenated to a string that is the IP address:

#!/bin/bash

base_ip="10.0.0."
for (( i=1; i<=100; i++ ))
do
     newip="${base_ip}$i";
     ./monkey_bars.exp $newip
done

Then, you have to create the expect script, which I named monkey_bars.exp. If you change the name of the expect script, you'll need to change it in the above bash script as well...anyway, you can expect the expect script to look like this, though, you may want to modify it to behave differently, and catch other outputs that this one neglects:

#!/usr/bin/expect
set timeout 20

set Machine [lindex $argv 0]

spawn -noecho -console telnet $Machine

set log [open monkey.bars a]

expect {
	login	{puts $log "$Machine UP!";}
	-re "Connection refused" {puts $log "$Machine DOWN";}
}

Honestly, the only reason I put this as a possibility, is because you posted this in the shell scripts forum, so you were probably looking for a scripting solution.... however, this is a hack job. The proper way to do this, is with a C++ program, or even perl script, that can be used to create its own sockets. Then, you would do a loop, and iterate over a list of new sockets, and cleanly retrieve the responses …

Comatose 290 Taboo Programmer Team Colleague

Well, the moderators who are supposed to strip those posts out would need to keep saging off..... posting new questions in old threads isn't supposed to happen (or receive any kind of answer other than "how 'bout you post a new thread") anyway.

verruckt24 commented: Exactly +3
Comatose 290 Taboo Programmer Team Colleague

Pssst. It got fixed.

Comatose 290 Taboo Programmer Team Colleague

I usually just do it at the command line when I want it. Not that you could tell with *nix, but it might help to conserve resources... it's fairly easy:

X :1 &
export DISPLAY=:1
startkde &     # or gnome-session or something

another pretty easy way is to do it with startx, but you can't really mix and match gnome/kde/someother with this method: startx -- :1 &

Comatose 290 Taboo Programmer Team Colleague

I'm a huge fan of Code::Blocks.

Comatose 290 Taboo Programmer Team Colleague

Exactly...... but you could still have chronological view. Basically it would be the viewer's choice if they see "bumped" threads or not...

Comatose 290 Taboo Programmer Team Colleague

I second the motion.

Comatose 290 Taboo Programmer Team Colleague

You need to setup and configure "samba"

Comatose 290 Taboo Programmer Team Colleague

Good luck. I had a tutorial up once that was taken down, and then administration refused to put it back up when I inquired about it.... Furthermore, all tutorials now go through a rigorous examination from the administration before being put up in the forums.... can't tell I'm still bitter about it? Anyway, you could always send it via PM to happygeek or dani, and see if they want it posted.

Comatose 290 Taboo Programmer Team Colleague

I do it in Gvim and paste it in.... I think you'll find that it's a web-browser issue much more than the page/site. Firefox natively makes Tab move from field to field. You could consider pressing tab in gedit, and highlighting the indentation depth, and copy it to the clipboard. Then ctrl-v or whatever any time you want to tab.... a little tacky, but will do the job.

Comatose 290 Taboo Programmer Team Colleague

Yeah, it's .c_str()

Comatose 290 Taboo Programmer Team Colleague

Sounds like it was saved in a different format.... is this the same machine you made the file on?

Comatose 290 Taboo Programmer Team Colleague

Personally, I like the approach of having things as self-contained and self-aware as possible. This gives you greater flexibility because you are then essentially dealing with plug and play objects, instead of a monolithic overseer. I guess though, that the real question that should drive your decision.... is which design will require less system resources? I mean, you are building a game, that uses Entity's so the rendering engine (ogre3d maybe?) probably could use as much CPU time as possible. If you are not as concerned about resources (ie: the game will be run on pretty decent hardware), then certainly a cleaner design choice is the way to go, and having each Entity know about itself seems like the more OOP way to do things.

Comatose 290 Taboo Programmer Team Colleague

Don't confuse the difference between a machine initiating a connection, and having one initiated with it. If 192.168.1.3 tries to make a connection to a server on the internet, it will do so no problem, because the router remembers who start the conversation. You are trying to make a client outside of the network connect to a server inside the network (backwards of what MSN does), and that requires you to forward a port in the router to the client... period. No exceptions. The only way to do what you want is to MAYBE make the chat happen by sending a broadcast packet, so that 192.168.1.1, 192.168.1.2, AND 192.168.1.3 all receive the message, but 192.168.1.1 and 192.168.1.2 will simply discard it (since it isn't meant for them). You also need to pray that the router isn't advanced enough to know to block what is essentially a smurf attack, used to try to be legitimate traffic.... this would also devour network resources on the internal LAN..... but that's about the only options you have....

1) Let 192.168.1.3 initiate the conversation, and have the server be outside
2) Pray you can send broadcast packets from outside the network
--This will require packet spoofing, so forget about winsock
3) Forward The Port to 192.168.1.3... The proper way to do things.

Comatose 290 Taboo Programmer Team Colleague

you can't put variables inside double quotes. That means it's a literal string then. You want the value of the variable, so you must take it out of the quotes..... You can't just take it out of quotes either, you must concatenate it.

system("AdjustSeaLevel.exe " + tosend);
Comatose 290 Taboo Programmer Team Colleague

Why not just pass it to the object as a parameter?

Comatose 290 Taboo Programmer Team Colleague

you can't concatenate it?

float Pi = 3.14;
system("AdjustSeaLevel.exe " + Pi + " 5.4 11.2 c f g");

or make a variable that contains the string to pass in, and then issue that?

#include <iostream>
#include <cstdio>
#include <cstring>
#include <sstream>

using namespace std;

int main(int argc, char **argv)
{
	float Pi = 3.14;
	std::string tosend; 
	std::ostringstream buff;
	buff << Pi;

	tosend = buff.str() + " 5.4 11.2 c f g";
	cout << "something " + tosend;
	return 0;
}