JasonHippy 739 Practically a Master Poster

If possible, can you give a short explanation on how does this linux command

sudo find . | xargs grep -i 'NameOfFunction'

work? Thanks.

It simply uses the pipe operator and xargs to pass output from the find command into the grep command:

1. sudo runs the command as root (after prompting you for a password) allowing the find command to list system files owned by root and files owned by other users

2. find . will cause the find command to list all files it finds starting from the current directory

3. The pipe operator "|" passes/redirects the output from the find command to grep via the xargs command.

4. grep -i 'matrixCal' will search the listed files and output any which contain the text 'matrixCal'.
The "-i" switch causes grep to ignore the case of the search string.

That's basically how Nonshatters suggested command works. But running that will soon fill your terminal with results and error messages from grep and will take a long time to run as it will search every file in the file-system.

One way of speeding up searches is to use a built-in update script to update the database that find uses. Running this from time to time can aid in speedier searches.
I tend to run this at least once a month, if not once a week.
I usually do it manually, but you could set up a cron job to run it automatically if …

JasonHippy 739 Practically a Master Poster

No probs, glad to be of assistance.
Might be an idea to mark the thread as solved though! :)

JasonHippy 739 Practically a Master Poster

If it's ODBC you're using, then it sounds like you need to set up a data source in Windows.

To do this you need to run the administrative tools. The location of this varies from version to version of Windows, but I think if you open up control panel, there should be a link to the administrative tools which should bring up an explorer window with shortcuts to various Windows administration programs.

From the admin tools window you need to run the ODBC Data source administrator tool which is listed as 'Data Sources (ODBC)'

From there you need to add a new data source and follow the steps in the wizard to set up the connection to the SQL server database.

Before you do that, going back to your code, in the string returned by your getDbConnString function, uid is the user ID (set to 'test') for the user of the database, pwd is the users password (also set to 'test') and dsn is the data-source name (set to 'dnsname').

Bearing that in mind, when you set up your ODBC connection in the ODBC Data source administrator, the first thing it asks you for is a name to use to refer to the data source. If you use 'dnsname' as the name for the connection then your program should work.

Basically, the name of the ODBC connection needs to match whatever you've put in the 'dsn=...' part of the connection string.
So if …

JasonHippy 739 Practically a Master Poster

I don't know too many of the internals of Linux (not as many as I'd like). But if you run the ls -a -l command in a directory, you see complete information on the listed files. In the file permissions part of the listing for each item, the first property indicates whether a listed item is a file or a directory. For files there is a dash - (flag not set). For directories it's d (flag set). The other flags rwxrwxrwx relate to the items read/write/execute privileges for the owner, members of the owners group and all other users. So there's at least a flag that gets set.
I don't know much more than that.

JasonHippy 739 Practically a Master Poster

Hmm, very unusual. Not sure what could be causing that, never seen any bugs like that before in the software centre.
Have you tried installing it from the command line instead?

If you open up a terminal in Ubuntu (You can do this by pressing Ctrl+Alt+T or by going to Applications->Accessories->Terminal) and enter the following command:

sudo apt-get update

After pressing enter, you'll be prompted for your password.
Enter your password and an up to date list of software will be downloaded.
Next enter the following:

sudo apt-get install scribus

Now Scribus and all of it's dependencies will be downloaded and installed on your machine.
Once that's done you can close the terminal by typing the exit command or by clicking on the X button to close the window.

JasonHippy 739 Practically a Master Poster

Not sure if it's any help, but I had a similar problem with my old tablet pc.

Turned out that the main speakers and the headphones were on different channels. I eventually realised when I took a look at the user options/settings for the mixer and found (and enabled) a couple of extra sliders. So now I've muted the channel for the main speakers, turned the headphones to full and I use the master volume slider to control the overall volume.

So you might want to look into the possibility that your headphones and speakers are on different channels!

JasonHippy 739 Practically a Master Poster

@OP...
What Moschops just said!

That's what I was on about when I said this:


Once you've made those changes, the only other thing that looks suspect to me is your implementation of isMumber in the cpp file for your linked list class.
You haven't included the return type of the function (bool according to the header) but also you appear to be returning a signed integer rather than a bool.

If the function is supposed to be returning a bool then it should be returning true or false. However, if you ARE supposed to be returning an int (which appears to be the case. It looks as if it returns the index of a node which has a value that matches the value passed into the function) then you should change the signature of the function in the header and in the cpp file to return an int rather than a bool.

And from looking at your code, it seems that the isMumber function should be returning an int. So it might be worth updating its return value to int in the header and the .cpp file!

JasonHippy 739 Practically a Master Poster

Alongside the inclusion guard problems mentioned by Mike, there are a few other problems in your header too!

There should be a semicolon ";" at the end of the declarations of the Add function and the isMumber function.
Also should that be isNumber or isMember rather than isMumber? heh heh!

And from the initial looks of the header, the return type of the isMumber function should be bool NOT boolean.

I think most of the error messages you're getting are because of the errors in the header. The reason that the compiler is mentioning the problems with listNode is because the linkedList class itself is failing to compile due to the afore mentioned problems.

Once you've made those changes, the only other thing that looks suspect to me is your implementation of isMumber in the cpp file for your linked list class.
You haven't included the return type of the function (bool according to the header) but also you appear to be returning a signed integer rather than a bool.

If the function is supposed to be returning a bool then it should be returning true or false. However, if you ARE supposed to be returning an int (which appears to be the case. It looks as if it returns the index of a node which has a value that matches the value passed into the function) then you should change the signature of the function in the header and in the cpp …

JasonHippy 739 Practically a Master Poster

Well, if you plan to write programs for Linux the choice is yours. You can use virtually any programming language, be it a popular modern language or a really old obscure one.

The real hard-core *nix programmers use a text editor like vi, scite or emacs to write their source-files and use the command-line to compile/build their programs. But there are IDE's available for most languages too, so you don't have to work with the command line if you don't want to!

If you're used to using an IDE like Visual studio. Then there are things like Monodevelop for C#, Code::Blocks for C/C++, Eclipse/Netbeans for Java, Idle for Python, Gambas for BASIC etc.

Most of the IDE's that I've seen in *nix are fully featured, generally well documented and pretty easy/intuitive to use. And there are plenty of learning resources posted all over the web for most languages too!

With regards to which languages are typically used for what in Linux:
Much of the underlying system is written in C and assembly (e.g. the Kernel and the core Linux OS components/tools). So if you plan to do low-level OS stuff (kernel modules, drivers etc) then C is a must and some knowledge of assembly may help too!
nasm is the main compiler used for assembly AFAIK.

The core of the Gnome desktop environment is C based.
The core of the KDE desktop environment is C++ based.

User-space/desktop applications can be programmed …

n_e commented: Good detailed answer +2
JasonHippy 739 Practically a Master Poster

@ OP: Mark as solved?? :)

JasonHippy 739 Practically a Master Poster

@OP:
The problem you're having is where you're trying to return a char array (buf) from your function; but the prototype/declaration of the function says that your function's supposed to be returning an int!

As you want to return a C-style string / char array, you should change the signature of the function to return a char* NOT an int!!

Although, one major problem I can see there is that you'll then be returning a pointer to an array of chars that is local to the dll function. So by the time the pointer has been passed back to the caller the char array will have dropped out of scope, leaving the pointer pointing to stray memory.
But to get around this, you could declare buf to be static!
e.g.

DLL_EXPORT char* codestamp(void)
{
    time_t now;
    struct tm *ts;
    static char buf[80];
    
    now = time(0);
    ts = localtime(&now);
    
    strftime(buf, sizeof(buf), "%d%m%Y%H%M%S", ts);
	return buf;
}

Alternatively, to avoid having static data in your dll, you could pass a pointer to a char array as a parameter to your dll function and change the return type to void. e.g:

DLL_EXPORT void codestamp(char *buf)
{
    time_t now;
    struct tm *ts;
    
    now = time(0);
    ts = localtime(&now);
    
    strftime(buf, sizeof(buf), "%d%m%Y%H%M%S", ts);
}

This would mean that callers of your dll function would have to set up a buffer to pass into the function. The dll function will then populate the passed-in buffer with the timestamp.

JasonHippy 739 Practically a Master Poster

The problem is not a linking error, it's a compilation error!

If you take a look at the definition of Playsound in mmsystem.h:

WINMMAPI BOOL WINAPI PlaySoundA( IN LPCSTR pszSound, IN HMODULE hmod, IN DWORD fdwSound);
WINMMAPI BOOL WINAPI PlaySoundW( IN LPCWSTR pszSound, IN HMODULE hmod, IN DWORD fdwSound);
#ifdef UNICODE
#define PlaySound  PlaySoundW
#else
#define PlaySound  PlaySoundA
#endif // !UNICODE

If your project is set up to use Unicode, PlaySound will use PlaySoundW. Otherwise it uses PlaySoundA.
The only differences in these functions are in the parameter lists. PlaySoundW takes a const WCHAR* (aka LPCWSTR) for the file-path parameter (pszSound), whereas PlaySoundA takes a const CHAR* (aka LPCSTR) for the file-path parameter.

From the error messages you've posted, PlaySound is using PlaySoundA, NOT PlaySoundW, which indicates that your project is NOT set up to use unicode.

The reason that you are getting an error message is because in your call to PlaySound you're converting the file path to a const WCHAR* (or LPCWSTR), which is only used by PlaySoundW. But the compiler is using PlaySoundA, which is expecting a const CHAR* (or LPCSTR) for the path, not a const WCHAR*. So the compiler is complaining that the parameters you're passing in your call to PlaySound do not match the parameters required for PlaySoundA.

Fortunately there are two simple ways of fixing this problem.
Either:
1. Set up your project to use Unicode, which will cause the compiler to use PlaySoundW when …

JasonHippy 739 Practically a Master Poster

From looking at the code, I think the infinite loop is happening because:
1. You call delete on an Animal, causing the flow of execution to enter the Animal class destructor.
2. Where the Animal destructor iterates through the static std::map it attempts to delete the first animal object in the map. So the flow of execution goes into the destructor for the first Animal object in the map.
3. The destructor for the 1st Animal object in the map then attempts to delete the first animal object in the static map (oops, that's itself!).
Now the destructor for the 1st Animal object in the std::map will recursively call itself until the program eventually runs out of memory and crashes.

I haven't looked at the rest of your code yet, or ran it through a debugger or anything, but I think that's what's going on!

Surely the cleanup for a static singleton object like this should really be done when your application ends, not each time an object of that class is deleted!

Otherwise, if there is a need to update the static when an Animal or Animal derived object is deleted, perhaps you need to find and remove that particular Animal instances entry from the static std::map rather than trying to remove all of them.

Anyway, hope this is of some help!
Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

@OP:
In answer to your question about vectors, a vector of std::strings can hold any number of valid std::string objects. Whether or not they contain whitespace is completely irrelevant. As long as a string object is valid, the vector should be able to contain it!

Obviously it seems me that you think your vector is causing your problem, somehow only storing only the first word of each string your user enters. But in actual fact, you're almost certainly using an inappropriate method/function to get your string input from the user in the first place.

How strings are retrieved from the input stream and stored will depend on which function you use to get them from the user.

From what I've seen I'm assuming you're probably using std::cin or something similar which copies everything up to the first whitespace character, or the first return character (whichever is first) into the string object.
e.g.

std::string str;
std::cout << "enter a string: ";
std::cin >> str;
std::cout << "You entered: " << str << std::endl;

Using the above code snippet, if you entered 'super mario bros', because cin only gets everything up to the first whitespace character, the string will only contain 'super'. So when you subsequently push your string into the vector, the only thing that goes into the vector is the string 'super'.

In other words, if you are using std::cin to get strings in your program, then you are getting exactly what you …

Saith commented: Very nice explanation! It does some nice critical thinking of what you could possibly assume what the OP was requesting and revealing the steps to fix the entire logical problem instead of a simple code snippet. +2 if possible. +1
jonsca commented: Agreed. Good to see you posting again Jas! +7
JasonHippy 739 Practically a Master Poster

If there's no graphic interface, you may have to manually mount your usb drive (unless your OS happens to auto-mount drives).

NOTES: Before we start, This is completely off the top of my head, I've not got a *nix box in front of me to test any of this atm, but it should work. Apologies if there are any errors though! Also you should be aware that I tend to use debian based distros, so I've included use of sudo to get root access in the following guide. You'll need to substitute sudo for su, or whatever your distro uses to get root access.

Anyway, moving onward!
To manually mount, you'll need to do the following:

1. After plugging a USB drive into your machine, you need to use the lsusb command to see what devices are connected via USB and search the output for anything that refers to your USB stick.

If you can see something which refers to your USB stick (manufacturer, capacity etc.), you'll know for certain that your system has recognised the device and you can continue on to mount it.
But if you don't see anything, there's no point attempting to mount the device, as the OS has not detected/recognised it!


2. Assuming you found your device, next you'll need to get a list of connected drives using:

dmesg | grep -i "SCSI device"

Again take a look in the output for something that refers to …

alaa sam commented: thanks alot for your help +0
JasonHippy 739 Practically a Master Poster

If it's not available in the Software Centre, or via Synaptic package manager; a stable version of Chrome is available directly from google as a .deb package. You can simply download the package and install it yourself!

Here's the link:
https://encrypted.google.com/chrome?platform=linux&hl=en&lr=all

Personally I'd check the software centre or synaptic first, I think the Ubuntu version of Chrome is called Chromium, so you might want to try searching for that first. If it's not there, then use the link above and you can download and install it yourself!

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

Well, here's a link to the Adobe documentation for the FLVPlayback component:
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/fl/video/FLVPlayback.html

I can't test this because I haven't got any of the AS3 components (I use the flex SDK rather than the Flash IDE nowadays), but according to the documentation there is a member of the FLVPlayback component class called seekBar. So you could try setting the 'enabled' property of seekBar to false.
e.g.

myFLVComponent.seekBar.enabled=false;

Do the same for the forwardButton and the backButton members to disable the ffwd and rewind buttons.

Like I said, I can't test it, but it might work!

Otherwise if that doesn't work, the Pro editions of Flash ship with the source .fla's for all of the FLVPlayback component skins. So you could grab a copy of the .fla for the skin you're using and edit it to remove the hitstate for the seekBar (it'll probably be a long, thin, purple, pink or blue overlay over the top of the seekBar, or perhaps a small square or rectangle over the slider).
Again, you can do the same for the forwardButton and the backButton. Then all you do is re-publish the skin and use it.

To help you to find the source .fla's there's a post towards the bottom of this page that might help:
http://www.kirupa.com/forum/showthread.php?t=287148

Otherwise, simply use a skin that doesn't include the forward/back buttons or the bar, or use the 'no skin' option and perhaps create some controls of …

JasonHippy 739 Practically a Master Poster

Any chance you could clarify this a bit further? I don't really understand what you're trying to achieve here!

Do you mean as soon as the swf has loaded, you want it to take a screenshot of the entire web-page??

If so, it sounds a bit unlikely to me as the swf will not be able to see anything external to itself. So it wouldn't be possible to take a screenshot of the entire web-page directly from Flash/AS3 (at least as far as I'm aware!)

You MAY be able to connect your swf to an external server-side script (javascript/php) which could retrieve the HTML for the page and generate an image of it. But again, I'm really not sure!

If it is possible, it would probably require quite a lot of work and resources to set up. What do you intend to do with the screenshot after you've got it?

theighost commented: Clear response, good suggestion +0
JasonHippy 739 Practically a Master Poster

What do you mean by 'scrub through'?
If you mean that you want to remove the fast forward/rewind controls, or the bar which shows the current progress through the movie, you can simply use an alternative skin for your FLVPlayback component.

Assuming you're creating your instance of the FLVPlayback component on the stage from within the Flash IDE, the easiest way to do this would be to select the instance of the component on the stage and open up the component inspector window by selecting 'Window->Component Inspector' in the main menu or by pressing Alt + F7.

In the 'Parameters' tab of the component inspector window, click on the 'skin' property and then select the magnifying glass, this will bring up a dialog which will allow you to select a different skin for your component, so you could choose one of the more basic skins which has only the play/pause button and the mute button (with no progress bar, volume control or FF/RW buttons).

Alternatively, you could select 'none', so your FLVPlayback component will have no controls on it. If you set the autoplay property to true, your movie will play from start to finish as soon as it has loaded, but the user would have no way to control the playback, so you'd have to control/monitor playback via actionscript if you wanted to allow the video to be played again.

Otherwise, if you really want to you could have a go at creating your …

JasonHippy 739 Practically a Master Poster

I'm not sure you've posted in the correct forum, I think you want the shell scripting forum!

Anyway, I think what you're after is this:

%USERPROFILE%\Desktop

So if you wanted to navigate into the current users Desktop folder in your .bat file, then you would use:

cd %USERPROFILE%\Desktop

Likewise, if you want to pass the path to the Desktop folder as a parameter to the executable you're calling, then in your batch file you could use:

program.exe %USERPROFILE%\Desktop

Or if the program you're calling requires a switch to be specified before the path, then you'll need to do something like this:

program.exe -X %USERPROFILE%\Desktop

where -X is whatever switch you might need to specify before passing the path.

Ancient Dragon commented: So I used the correct environment variable afterall :) +35
MasterGberry commented: Perfect explanation :) +0
JasonHippy 739 Practically a Master Poster

You can create your elearning content in virtually whatever format you want, be it Flash, Director, Java applets or even plain old HTML and Javascript.

I haven't used director before, but I have used Flash to create elearning packages at a previous job. However, I think with director you may need to export your files as .swf's or some other projector file format. I suspect the .dir files are source files like .fla's in Flash..but I could be wrong!

Once you've got all of your course material together, you just need to use something like Reload Editor or eXe to package your courseware up into an IMS or SCORM package.
(I used to use Reload, never tried eXe!)

Also, if memory serves with SCORM and AICC, you may also need to use some javascript alongside your courseware to allow data to be passed back and forth between the VLE and the courseware (passing user name, test scores etc).. At least we did with the courseware at my previous job...I haven't worked in the elearning sector for a few years now and I'm more than a bit rusty, so please excuse me if I'm a bit vague on the details!

Anyway, I hope this is of some help to you!
Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

For starters, that is a C source file you are editing, NOT a C++ source file (so you've posted in the wrong sub-forum!).

As this is a C project you are editing, it is reasonable to assume that any project files or makefiles for the project will have the strict C mode flag set for any C++ compilers, so the code is parsed and compiled as C rather than C++. In strict C mode (as per standard C syntax) your compiler expects all variable declarations/definitions to be at the top of a block.
So the problem is due to where you are declaring and using 'r' in the middle of a block of code. What you need to do is declare r at the top of the block (the top of the function) and then use it later on in the function!

Try this:

// XorLib 1.0.0.0
// Copyright [c] 2009-2010 Shadowscape Studios. All Rights Reserved.

#define export __declspec (dllexport)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

long filesize(FILE *f)
{
	long fs;
	fseek(f,0L,SEEK_END);
	fs = ftell(f);
	fseek(f,0L,SEEK_SET);
	return fs;
}

export double crypt(char *rn, char *wn, char *sb, double ss)
{
	FILE *rf, *wf;
	unsigned char fb[BUFSIZ];
	unsigned int bp, sp = 0;
	size_t bs;
	if ((rf = fopen(rn,"rb")) == NULL) { return 0; }
	if ((wf = fopen(wn,"wb")) == NULL) { return 0; }
	while ((bs = fread(fb, 1, BUFSIZ, rf)) != 0)
	{
		for ( bp = 0; bp < bs; ++bp )
		{ …
shadowscape commented: thanks alot for all your help, i can tell you how much that means to me +1
JasonHippy 739 Practically a Master Poster

Or you could use a 'Date' object... Date is a globally defined intrinsic class/type in AS3 so you don't need to import anything to be able to use it.

var today:Date = new Date(); // constructor sets a new Date object to the current system date/time by default
var current_time:number = today.valueOf(); // valueOf returns the number of milliseconds since midnight on january 1st 1970 (universal time!)

The Date class has loads of different options to return the date in various formats.
I think valueOf() is most likely the one you're after. Otherwise take a look at the documentation for the Date class. I'm sure you'll find a function in there that will suit your needs!

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

OK, well arkoenig hit the nail on the head with his description of the problem.
This thread is becoming a little painful to read now, so I think I'll put you out of your misery. But I'll explain things as I go, that way I'm not just spoon-feeding code. Also, that way, you'll at least be able to understand what's going on!

Before we go into that, here's a quick note on the AND (&&) and OR (||) operators:
With the boolean logical comparisons, expressions are evaluated from left to right.
With an AND, if the left-hand expression evaluates to false, the AND returns false without bothering to evaluate the right-hand expression.
However, OR's will only return after evaluating the expressions on both sides.

Bearing that in mind, let's get onto your problem:
First up, the first 'if' statement in your add function:

if(num<=r->data||r==NULL)

Simply moving the 'r==NULL' comparison to the left does not solve the problem:

if(r==NULL || num<=r->data)

This is because the OR evaluates both sides of the expression before returning a value. So in cases where r is NULL, the left hand side of the expression will evaluate to true, but due to the nature of the OR it will also attempt to evaluate the right hand expression.
But because r is NULL, the attempt to read r->data in the right hand expression will cause a crash. So you need to include an additional test in the …

JasonHippy 739 Practically a Master Poster

If it worked once, why shouldn't it work again??

Did you refresh the folder view on the server after it claimed to have written the file the second time? (you probably did, but I mention it on the off-chance that you didn't!)

I also notice that you are not checking whether OpenFile or WriteFileText succeeded...Would it not be an idea to test the success or failure of either of those?

If the file wouldn't open in the first place, that would be the first potential point of failure. Attempting to write to a file that wasn't actually open would be a segfault in the making if you ask me! CRASH!! heh heh!

Other than that the code looks more or less OK.

JasonHippy 739 Practically a Master Poster

I understand that sounds wonderful. I have to ask about one detail though of how to set up this parameter. Do I need to first connect and then check this in the if statment or will I just write the if statement.

For example do I need the first line here ?

sftp->Connect(hostname, port);

if (sftp->Connect(hostname, port)) {
  //perform your transfer if true/non-zero
} else {
  //error handling if false or zero
}

{facepalm}

No, you don't need to call it twice! You just call it once inside the if statement as recommended by myself and Fbody!

Basically the Connect function is called inside the if statement. The if statement then evaluates the return value from the Connect call.
So if the Connect function returns true (or non zero), then the code under the if statement is executed. Otherwise if Connect returns false (or 0) then the code under the else is used!

I hope that clears things up for you!

JasonHippy 739 Practically a Master Poster

Have you tried this??

if(sftp->Connect(hostname, port))
{
	// do something
}
else
{
	// Whoops sftp->Connect() failed!!
}

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

IMHO the swfobject script is the simplest and best way of embedding flash content in HTML pages.

Using swfObject will guarantee that all users of your website will be able to see something, even if it's the alternate content. The script runs when the page is viewed and can determine which type of browser is in use allowing the script to generate appropriate HTML embed tags for the users browser.

It also checks to see if flashplayer is installed and the version of flashplayer. If no flashplayer is detected, or the users installed version is too old, the script can display alternative content, or can be set up to redirect the user to a page where they can download a newer version of flashplayer.

Without swfobject, I think you can do it like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
	<head>
		<title>page title</title>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
	</head>
	<body>
		<div>
			<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="800" height="600" id="myFlashContent">
				<param name="movie" value="my_swf.swf" />
				<!--[if !IE]>-->
				<object type="application/x-shockwave-flash" data="my_swf.swf" width="800" height="600">
				<!--<![endif]-->
					Alternative content to go here, if no flashplayer is present
				<!--[if !IE]>-->
				</object>
				<!--<![endif]-->
			</object>
		</div>
	</body>
</html>

It's been a while since I've embedded any .swfs manually though, so for the code above, I just used the swfobject generator tool to create a statically published page and removed any reference to the swfobject script from the generated HTML. The remaining code should be more or less what …

JasonHippy 739 Practically a Master Poster

your proposal pretty much depends on whether there's access to definition of the CDataExchange class or not.

Ah good point, I haven't done any MFC in a looooong time so I'm rusty as hell!
I wasn't sure what pDX was pointing to, but now that you mention it, pDX... Yes that's probably a pointer to a CDataExchange object...Of course! {facepalm} Doh!

Well, after looking at the definition of CDataExchange, m_bSaveAndValidate is a public member variable, so using:

pDX->m_bSaveAndValidate = FALSE;

Should solve the OP's problem as suggested in my previous post!

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

From the looks of this line:

pDX->m_bSaveAndValidate(FALSE);

It seems to me that you're trying to use a boolean member variable as a function, which is why you're getting that particular error.

I'm pretty certain if you search for the definition of m_bSaveAndValidate it will be declared as a boolean variable NOT as a function which takes a boolean as a parameter.
i.e.

bool m_bSaveAndValidate;

So the reason you are getting that error is because you are trying to use a variable as a function.

If the boolean flag is a public member/property of the class pointed to by pDX, then you should be able to set it directly like this:

pDX->m_bSaveAndValidate = false;

Otherwise, if m_bSaveAndValidate is a private or protected member of whatever class is pointed to by pDX, you will have to use a public function to get or set the value of the flag. If there are currently no public functions in the class which get or set the value of the flag, then you will have to add them to the class yourself.
e.g. in your header:

class YourClass : public WhateverItsDerivedFrom
{
	private: // or it might be under protected!
		bool m_bSaveAndValidate;
		// Other private member variables/functions here

	public:
		// constructor, destructor and other public member variables and functions here
		
		// Accessor functions to get and set the flag
		void SetSaveAndValidate(bool bState){m_bSaveAndValidate = bState;}
		bool GetSaveAndValidate(){return m_bSaveAndValidate;}
};

That way you can call your 'set' function for …

JasonHippy 739 Practically a Master Poster

You could try a free open-source javascript script called 'swfObject.js', which is a cross-platform, cross-browser compatible javascript file which can detect the type of browser being used and attempts to detect the version of flashplayer installed before generating appropriate, browser specific HTML to embed the .swf at runtime.

If no flashplayer is present, you can simply specify alternate content to use.

Check out the swfobject project page here:
http://code.google.com/p/swfobject/

With swfobject.js, you can:

  • specify the .swf file to embed in the page
  • specify alternative content if no flashplayer is installed (i.e. the image you want to display!)
  • specify the minimum version of flashplayer required
  • pass flashvars, params, attributes to the target .swf.

It's a pretty robust script, it's used widely and it's got quite a large community of users and contributors/maintainers, so if you do get stuck you can always post a question on their forums.

There is also a downloadable tool which will help you to create the appropriate HTML/javascript code for your page (available as a dynamic HTML page or an Adobe AIR application). You just fill in the path/name of the swf to embed, set any of the other myriad of options and then click the 'generate' button to create some code which you can cut/paste into your HTML page.

If you download the latest version of the script and put a copy of it into the js folder of your website, then …

JasonHippy 739 Practically a Master Poster

Most of this code looks just plain wrong, so it is unsurprising that you're getting errors! I think you need to read up a bit on the correct use of iterators.

For example, the statement starting:

if(answer_->at(individual) .....

is incorrect. You can't pass an iterator to at().
Besides, the iterator 'individual' already points to an instance of whatever variables are contained inside answer_. (That is, assuming you've correctly declared individual as an iterator...That portion of code hasn't been posted!)

Anyway, 'answer_->at(individual)' is completely wrong!

At the start of your for loop, the iterator points to the first item in the container (answer_->begin()) and it loops until the iterator reaches the end of the container.

There are several other fundamental problems with your code.

Initially it looks to me as if you have two containers that you are trying to traverse and you want to compare the contents of one against the other. But without knowing exactly what you're trying to do or what kind of variables are stored in your containers, it's kinda difficult to help you at this stage.

If you could post a little more code, or describe in more detail what you are storing in the std::library containers and what you are trying to achieve...That would allow us to understand what you're trying to do and will help us to help you.

From what I've seen so far, if my assumptions are correct; you need to perhaps try …

JasonHippy 739 Practically a Master Poster

Typically in *nix, when you open up a console it opens in your home directory. Bearing this in mind, when you're using the chmod command, are you actually in the directory that you saved hello.py in? The error message appears to say that the file cannot be found, so it sounds to me like you're not in the correct directory!

If you are in the wrong directory, try using:

chmod a+x /path/toscript/hello.py

Obviously substituting '/path/toscript/hello.py' with the actual path to the file.
e.g.

chmod a+x /home/username/Documents/pyscripts/hello.py

Otherwise use cd to move into the appropriate directory before trying the chmod command.
e.g.
Open up a terminal and type:

cd /path/toscript 
chmod a+x hello.py

Again, substitute /path/toscript/ with the actual path to your python script.

The only other thing I can suggest is perhaps you need to explicitly qualify that the file is in the current directory by using './' at the start of the filename in the call to chmod:
e.g.

cd /path/toscript
chmod a+x ./hello.py

Also note: After doing the 'cd' and before doing the 'chmod' in the two examples above, you might also want to consider using the 'ls' command to make sure that your .py file is definitely there!
e.g.

ls -l hello.py

If the file is there, then it will be listed by the 'ls' command, but if it says that the file cannot be found, then you must've saved it …

JasonHippy 739 Practically a Master Poster

I think most of the Gnome stuff is still on your PC. Synaptic is probably just downloading and installing a few packages that you got rid of (like the python 2.6 related packages) and re-installing the Gnome desktop.

As I mentioned in your other thread. Once the re-install is complete, you should be able to reboot your computer and then change your default session to Gnome from the login screen.
Fingers crossed that should have fixed it.

If not, then you'll need to back-up whatever personal stuff you've got on your PC and any other files for customisations you might have made before doing a full re-install.

JasonHippy 739 Practically a Master Poster

What Salem meant was, have you added mystack.cpp to the project tree in your solution? I'm with Salem here, I strongly suspect you have not!

In Visual Studio, take a look at the solution explorer window and see what files are listed in there. You should have myStack.h listed under "Header Files" and main.cpp and myStack.cpp listed under "Source Files".

If you don't see mystack.cpp listed, right-click the "Source Files" folder in the solution explorer and select "add->existing item", then navigate to the location of mystack.cpp, select the file and hit ok. That will add mystack.cpp to your solution.

Also if you haven't added myStack.h to the list of header files in the project tree of the solution explorer either, you should add that too by right clicking on the "Header Files" folder, select "add->existing item", navigate to the location of the header, select the header file and click OK and that file will also be added to your solution.

Once you've correctly added all of the files to the solution, try re-compiling your project and it should compile without any further linker errors.

Basically the problem was the compiler found the myStack header file, but it didn't know where to look for the actual implementation, i.e. the myStack.cpp file. And it was this that caused the linker errors you were getting.

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

Won't it corrupt anything on my system? Can you be more precise? I am not very confident about "trying deleting files"; If you understand me.

What Manuhar has suggested is actually quite sensible and safe! If you open your home-directory with Nautilus and then press ctrl-h to show hidden files and folders you should see lots of directories with names that start with a full-stop.
Typically they just contain user-specific initialisation files and settings for individual programs.

By deleting the .mozilla directory from your home directory, it will simply erase any of your .ini settings for Firefox. It will also erase any add-ins that you've added to firefox (e.g. adblock plus, personas etc.), but that's no biggie, you can always re-install them. You might also lose any bookmarks you have and perhaps a few other firefox related odds 'n ends, but certainly nothing critical!

Anyway, if you delete the .mozilla folder and then re-start firefox, firefox should re-create the directory and set up a new ini file for you and hopefully that should allow Firefox to start up!

I've had similar problems with other programs in *nix, most noteably in Code::Blocks (a C++ IDE). There have been a few times where Code::Blocks has refused to start for me. But by removing the .codeblocks directory from my home folder (thus deleting the .ini files and other settings). The next time I try running Codeblocks, the program sets itself up from scratch, creating new ini files for itself …

JasonHippy 739 Practically a Master Poster

OK, forgive me for being a little slow on the uptake here, but I'm a bit confused by the 'snow effect' you refer to. You don't really give much detail about the effect or how you've added it, other than you've added it to the timeline at a particular frame. But what exactly is it?

Is it a built in effect? or something you've scripted? or a flash movieclip/sprite that you're superimposing and playing on top of the video??

The reason I'm asking is, if we know how you've implemented the actual snow effect and how you're starting it, it might give us some clue on how to stop it. If you catch my drift?

Also, which versions of the Flash IDE and Actionscript are you using? This information will help others here to help you. If others here use the same version of the IDE as you they'll usually be more willing/able to give you some pointers.)

Incidentally I'm running a *nix OS, so I don't actually use the Flash IDE for flash dev anymore. I use Inkscape or the flash drawing API to create GFX and then use the Flex SDKs command line tools to compile my AS3 classes into .swfs. So I'm a bit rusty on certain aspects of using the Flash IDE. But if I know which version you're running I might be able to help point you in the right direction!
Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

I would use

Calculate = sum

instead of the above code ;)

Heh heh, good point Gribouillis, that's far better! I completely forgot about sum {slaps forehead!}. That completely eliminates the need for the calculate function and brings the OPs main function down to just 2 lines of code! Well spotted, my hat's off to you sir!

def main():
    myArray=(0,5,10,15,20)
    print "The answer is", sum(myArray)

main()
JasonHippy 739 Practically a Master Poster

BTW: Isharas suggestion of using a 'for ... in range(...)' loop is also a good one.

It will allow the python version of the calculate function to keep exactly the same signature as the C++ version, so you could consider using that if you were worried that your teacher/professor/lecturer might mark you down for not keeping the function signatures the same.

But at the same time, they may allow for the fact that you've recognised that in the context of the python port, the size parameter is redundant and really only applicable to the C++ version. So there are two ways of looking at it!

Both solutions will work, the code will do exactly the same thing, but I guess at the end of the day it depends on what whoever is marking your work is looking for.

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

You're quite close.
You have a few errors in there.

First off in main you're calling calculate, but you've defined the function as intCalculate. There's one straight off the bat.

Also your for loop should be:

for i in intValues
    intAnswer += i

NOT

for i in intAnswer
    intAnswer+= values[i]

The other error in the above is you've called the 2nd parameter to the calculate function 'intValues' and then you're referencing a non-existent object ('values') in your for loop.

Also, because we're using python, the calculate function does not need to know the size of the tuple/array, that's more of a C++ thing. A simple for i in intValues will suffice, so intSize is completely unneeded.

So your port from C++ to python should look something like this:

def main():
    myArray = (0, 2, 4, 8, 16)
    print "The answer is ", Calculate(myArray)

def Calculate(values):
    answer = 0
    for i in values:
        answer += i
    return answer

main()

Which is the python equivalent to the C++ code you posted (or at least it would be if the C++ was correct, I'll show you where you went wrong with that later in the post, mainly typos from the look of it!).
When porting code from one language to another, you need to fully understand the differences and similarities between the languages you are using.

Sometimes things do not require a literal translation.
As you've seen with my python port of …

JasonHippy 739 Practically a Master Poster

You could try using SoundMixer.stopAll();

So when the user navigates to a new page, ensure that SoundMixer.stopAll() is called before the new sound is started. That should stop any sounds that are currently playing; regardless of whether they're external or in the library.

To use SoundMixer, you'll need to use the following import:

import flash.media.SoundMixer;

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

If you're using the built-in media-player component that ships with flash-pro IDE's, there is a property which you can set to false to stop the video from auto-playing.

I can't remember exactly what it is called, but from the flash IDE, if you select your instance of the media player component on the stage and then open the component inspector window (or was it the properties window?? Been a while since I used the flash IDE now!) Either way, somewhere in the properties or the component inspector, you should see the auto-play property. I think it's set to true by default.
Set this to false and that should be all you need to do to stop the video from auto-playing.

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

This should be pretty self-explanatory. Here's your code again, I've commented out a line of code which should stop your sound from auto-playing:

var mySound:Sound = new Sound();
var myChannel:SoundChannel = new SoundChannel();
var lastPosition:Number = 0; 
var soundIsPlaying:Boolean = true;
mySound.load(new URLRequest("Intro1.mp3"));

//Line below not needed:
//myChannel = mySound.play();
// after removing this, the sound will not play until the 
// play button has been clicked.
offBtn.addEventListener(MouseEvent.CLICK, onClickStop);
function onClickStop(e:MouseEvent):void{
myChannel.stop();
soundIsPlaying = false;
} 
offBtn.addEventListener(MouseEvent.CLICK, onClickPause);
function onClickPause(e:MouseEvent):void{
lastPosition = myChannel.position;
myChannel.stop();
soundIsPlaying = false;
}
onBtn.addEventListener(MouseEvent.CLICK, onClickPlay);
function onClickPlay(e:MouseEvent):void{
if(!soundIsPlaying){
myChannel = mySound.play(lastPosition);
soundIsPlaying = true;
}
}

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

Hmm, I'd have to echo what Nick and Clutchkiller said.
The express version of Visual C++ 2008 or Code::Blocks with mingw are the best free C++ IDE's/compilers for windows.

But I'd steer clear of Dev-C++ as it is no longer being developed or maintained. Better to stick with something more up to date IMHO!

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

{Slaps forehead} Doh! Just thought of another thing...
There's no need for the copy of the string if we're using iterators.
We can do this instead:

bool Pstring::isPalindrome()
{
    string::iterator front, back;
    for(front = this->begin(), back = this->end()-1; front<=back; front++, back--)
    {
        if(*front != *back)
            return false;
    }
    return true;
}

J.

JasonHippy 739 Practically a Master Poster

From what I can see the function in question takes a pointer to a cNPC object, not a pointer to an array of cNPC objects.

Would it make more sense to store your cNPC objects in something like a std::vector instead of an array?
e.g. std::vector<cNPC>

That way you can alter your functions signature to pass the vector into your functions as a reference or a const reference instead of using a pointer to an array. It's just as efficient as using a pointer. It's probably also safer and less prone to bugs/errors than using a pointer to an array too!

Saying that, if you don't want to use the std::library, there's nothing stopping you from passing your array into your function as a reference or a const reference either.

Offhand, those are two options that I can see! But I'm sure there are many other ways around this problem!

Cheers for now,
Jas.

{edit: BTW, if I am way off the mark here I apologise. It is past 3am here, so tiredness is kicking in with a vengeance, I may have misread something..Think I'm gonna have to crash soon though. I've got work in a few hours...Doh! }

JasonHippy 739 Practically a Master Poster

Alternatively, you could use two std::string::iterators to iterate through the string comparing values like so:

bool Pstring::isPalindrome()
{
    // create a local string (using the std::string.c_str() function to retrieve the word stored in the base class)
    string testWord(this->c_str());

    string::iterator front, back;
    for(front = testWord.begin(), back = testWord.end()-1; front<=back; front++, back--)
    {
        if(*front != *back)
            return false;
    }
    return true;
}

Again, we're initialising back to testWord.end()-1 to avoid the null at the end of the string.

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

You need to be doing something like this in the constructor:

Pstring::Pstring(string word): string(word)
{
	if (isPalindrome() ) 
		cout << "the word is a palindrome";
	 else
		cout << "the word is not a palindrome";
}

The ": string(word)" I added to the constructor will initialise the std::string part of Pstring with the passed in std::string (aka word).
Also you only need to call isPalindrome() once, not twice! And you don't need the static std::string in your constructor either.

Next up, in your isPalindrome function, you can retrieve the string from the base class (the std::string part) of your Pstring by using the c_str() function, which returns a c style string. If you use the c style string to create a tempory local std::string in your function, you can then use your two indexes (i and j) to index the string. No need to use two strings here! Simply set i to index the start of the string and j to index the end and compare the two values before incrementing i, decrementing j and reiterating through the loop.

Like so:

bool Pstring::isPalindrome()
{
	int i,j;
    
    // create a local string (using the std::string.c_str() function to retrieve the word stored in the base class part of Pstring) 
	string testWord(this->c_str());
	for (i = 0, j = testWord.size()-1; i <= j; i++, j--) {
		if (testWord[i] != testWord[j]) {
			return false;
		}
	}
	return true;
}

Note, the index j is initialised to testWord.size()-1 to take the \0 …

JasonHippy 739 Practically a Master Poster

I have an old RM Tablet PC (which uses a Wacom tablet/screen) at home which is currently running Ubuntu 9.04 on it with no problems.
The stylus works fine for the usual mouse-like activities (e.g. navigating the file-system and for drawing in gimp, blender and Inkscape etc.)

Regarding handwriting to text:
I know there are a few on-screen keyboards that work with the tablet/stylus in linux, but I don't know offhand if any of them support converting handwriting to text. I use a mini-usb keyboard with my tablet for text input, so I've not used any of the on-screen keyboards yet. But it might be worth trying a few of them and having a play just in case they do have input panels for converting handwriting to text. I've got a sneaky suspicion that at least one of them does.

If you can find an on-screen keyboard that supports handwriting to text, that would probably solve your problem! Try taking a look in the repositories or perhaps do a quick google to see if there are any other open source on-screen keyboards for linux that perhaps aren't in any of the major distros repositories.

There's quite a lot of open source linux software out there that doesn't get into the main repositories of the major distros. The only minor downside to this of course is that you'd probably have to build the software from source (which could prove to be a pain if it has …

JasonHippy 739 Practically a Master Poster

You have a missing semicolon ; at the end of line 2.

Cheers for now,
Jas.