JasonHippy 739 Practically a Master Poster

Your indentation goes a bit off from line 26 onwards (but that is more of an aesthetic thing which affects the readability of your code, it doesn't affect the code in any other way..The compiler doesn't care about whitespace or readability of code..As long as the syntax is correct the compiler is happy!)

Also your switch statement is incorrect. You need to move your cout and cin statements outside the switch statement. As it stands they'll only get called if the user enters something other than S or R.

Once you've moved those out of the switch, you'll also need to add an opening brace under your 2nd 'for' loop (don't forget to add a closing brace further down!). You should declare your 2nd for loop as Ancient Dragon has suggested.

In other words, your 2nd for loop should look like this:

for (int j = 0; j < nrAttend; ++j)
    {
    	switch (vote)
    	{
        	case 'S':
        		votesForS++; 
			break;
        	case 'R':
        		votesForR++; 
			break;
        	default:
        		votesForO++;
     	}   
     	cout << "Next: For whom do you vote? ";
     	cin >> vote;
    }

TECHNICAL NOTE: In Ancient Dragons code (and in my code above), we've used the prefix increment operator (++j) instead of the postfix operator (j++) in the increment section of the for loop. This is an old C/C++ optimisation trick.

All you need to know is that the prefix operator is a teeny tiny bit quicker than the postfix operator (I could explain further, but I can't …

JasonHippy 739 Practically a Master Poster

You can't hide the background.
When you published your .swf it sounds like you published it with a white background.
Unfortunately .swfs don't support having a transparent background, so you have to set the background colour you want. You can either do this at publish time or dynamically at runtime.

I'm assuming you're diplaying this on a web page and you want the background to be the same colour as the web-page. To do this you have two options:
Option 1
Reopen your .fla, set the background colour of the .swf to the colour you're using on your HTML page and re-publish your .swf.
OR
Option 2
In your HTML, where you are embedding your swf, you can pass a parameter to set the background colour of the .swf at runtime.
So in your embed tags, you can set the background colour like this:

<object>
    <embed src="myflashfile.swf" quality="high" bgcolor="#000000" width="800" height="600" name="myflashfile" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"/>
</object>

The above would set the background to black and set the width and height of the swf to be 800x600.
Changing the value of bgcolor to "#ff0000" would set the background to red.
If your HTML page is a light orange, perhaps "#ffb642", then simply set the bgcolor parameter to "#ffb642" and the background of the .swf will appear light orange.

If you're using a .js script (like swfobj.js) to embed your .swf in your HTML page then take …

JasonHippy 739 Practically a Master Poster

Ooops! Thinking about it I'm not sure if you can specify command line arguments with py2exe generated exe's...So option 2 is probably out of the question anyway...But option 1 still stands and is probably the best option if you want the user to be able to alter values of variables in your script!

I was going to remove option 2 from my previous post but the 30 minute edit window for the post has expired...Doh!
Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

I'm not sure exactly what kind of tweaks you're thinking your users might be likely to make to your script, but if your users aren't likely to be needing to make any structural/logical changes to the script. Or in other words, if they're only likely to be changing the values of certain variables in the script I can think of two options:

Option 1:
You could alter your script to use an optional text based ini file...So in your documentation for your script you tell users if they want to customise anything, then they should create an ini file called {InsertYourScriptNameHere}.ini and list any options that they can use in the ini.

You then alter your script so it does this:

  • Initialise all variables to your default settings
  • Look for an ini file....
    - If an ini is found; read and parse its contents and overwrite the values of any related variables with the users settings.
    - If no ini is found; no problem, the defaults are already set so you're ready to go!
  • The rest of your script runs as per usual.

Once you've made the necessary changes to your script, you can rebuild your distributable with py2exe. But ensure that you include some kind of documentation to inform users of the options that they can include/change in the ini file.

OR

Option 2.
You could alter your script to take command line arguments. So just like the …

JasonHippy 739 Practically a Master Poster

Here are a few of my favourites:

Life, loathe it or ignore it, you can't like it. - Marvin the paranoid android (Hitch Hikers Guide To the Galaxy).

I'm not afraid to die, I just don't want to be there when it happens. - Woody Allen

Either he's dead or my watch has stopped. - Groucho Marx

I don't mind dying, the trouble is you feel so bloody stiff the next day. - George Axlerod

It isn’t necessary to imagine the world ending in fire or ice – there are two other possibilities: one is paperwork, and the other is nostalgia. - Frank Zappa

To succeed in the world it is not enough to be stupid, you must also be well-mannered. - Voltaire

Only in Britain could it be thought a defect to be 'too clever by half.' The probability is that too many people are too stupid by three-quarters. - John Major

I sort of felt sorry for the damn flies. They never hurt anybody. Even though they were supposed to carry disease, I never heard anybody say he caught anything from a fly. My cousin gave two guys the clap, and nobody ever whacked her with a newspaper. - Lenny Bruce

Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. - Albert Einstein

I wouldn't recommend sex, drugs or insanity for everyone, but they've always worked for me. - Hunter …

vmanes commented: Great collection of quotes! +10
JasonHippy 739 Practically a Master Poster

OK D.JOHN,
Take a look at the .cpp file attached at the bottom of this post (Array2DExample.cpp).

In this example, I've created a two dimensional array and created several functions which deal with populating the array, processing the array and displaying the contents of the array.

So the main part of the program does this:
1. create the array
2. pass the array to a function which prompts the user to enter some values.
3. pass the array to a function to output the entire array contents
4. pass the array to a function to manipulate each array item
5. pass the array to a function to output the array contents (the same function as step 3!)
6. pass the array to a function which outputs results for odd students odd courses.

You will notice that I am passing the array as a parameter to the functions by value.

Bearing that in mind, here are a few notes on passing by value:
Normally, passing something to a function by value will result in the original variable not being changed in the calling function.
e.g. this listing is an example of passing by value..

// example 1 - passing by value
#include<iostream>
using namespace std
void somefunction(int index)
{
    index = 25;
}

int main
{
    int index=3;
    somefunction(index);

    // what is the value of index??
    cout << index;
    return 0;
}

The cout statement at the …

JasonHippy 739 Practically a Master Poster

Questions:

From Understanding (Q3)

"passing a double into a function when you needed to be passing a pointer to a double."

I do not understand this part because I do not know what is a pointer. Hence, please explain it to me in a simpler form thanks(still learning structured programming).

You said that you were getting the following error:

(Q3)The error I had it before. They keep saying that double variable cannot be converted to double * variable(something like that)

From what you've said it sounds like you were passing something incorrectly to a function. If you post the code that gave you this error I can give you more details, but none of the code you posted contains any double or double* variables. Without seeing the code in question I can't be of any help!

From Q(3)

"1. Yes, but the functions in question are not functions called student() or subject(), as I've already explained it is in fact the copy constructor for the int datatype being used."

If I am not mistaken, you are trying to say that this copy constuctor is something like the int main() function which is already been done for you and you just need to put in the values and make use of the const to declare the int student and subject to be constant that is all. The declaration and the implementation part is already been created inside the codeblocks.

Yes, when you eventually learn about classes, you will learn about …

JasonHippy 739 Practically a Master Poster

Currently reliving my youth, listening to some classic UK Thrash (Slammer, Toranaga and Acid Reign) and some old UK Anarcho/Punk stuff (Crass, Conflict, Discharge, Disorder, Chaos UK, Exploited, MTA and Toy Dolls) :P
Aaah nostalgia!

JasonHippy 739 Practically a Master Poster

A 'long' variable in this context is still an integer, not a float, so changing px to long will make no difference.
The most likely explanation, as you suggested, is that px has also been declared locally and the OP is examining the global variable.

Of course...Sorry, another window-licker moment of mine. I think I was confusing long for double, I saw long and my brain was thinking double....What a dumbass! heh heh!

I think some extra coffee is in order!

Jas.

JasonHippy 739 Practically a Master Poster

The output from the program is:

The value at array position 1 is 16
The value at array position 2 is 64
The value at array position 3 is 144
The value at array position 5 is 256
The value at array position 7 is 400

Oops.. Sorry that's not the output at all!

The correct output is:

The value at array position 1 is 16
The value at array position 3 is 64
The value at array position 5 is 144
The value at array position 7 is 256
The value at array position 9 is 400

Jas.

JasonHippy 739 Practically a Master Poster

I have this piece of code

// some function
int px;
void SomeFunction( void *dummy )
{
	...

	RECT rect;
	GetWindowRect(hWnd, &rect);
	px = ((rect.right - rect.left) / 2) - 60;

	...

	// Terminate thread
	_endthread();
}

And my problem is px doesn't get assigned.. it stays 0.. although in the debugger I can see all the values inside rect..
please help me

What about if you change px from int to long? Does that give you any differemt results?
The thing to take note of here is that px is currently declared as an int. Whereas rect.right and rect.left are both LONG/long variables.

Therefore if the result of your calculation is less than 1.0 (e.g. something like 0.43455664), then because px is an int, the calculated value will be truncated to 0.
Whereas if you alter px to be long, you'll get the actual calculated value (in my example 0.4345564).

I could be wrong, but that looks like the most obvious explanation to me!

oh, hang on.....Looking at that code, another thing strikes me as odd....
px is declared outside of the function, but used inside it..
That's probably your problem right there!
The px used in the function and the px outside of the function might not be the same variable, they might have different scope.
If you could post some more code, we might be able to determine whether or not this is the case!

Cheers for …

Salem commented: Two px's in scope could easily explain it +36
JasonHippy 739 Practically a Master Poster

(4)Additional Question:

If I want to multipy an array by itself and then after getting the answer, I wanted the program to only display odd subsripts, ho do I do it?

eg. I use functions and get this array:
//Implementation for the array * array
double SqPrOdd(double values[])
{
int i;
for(i=0;i<6;i++)//6 elements inside the array but only display the odd subsripts
{
count=values;
}
return
}

I already is able to display the output of values, ask the user to key in the values 5 times. But the part that I am unclear is how do I calculate an array * the answer of the same array and then display only the odd subscripts.

I'm not sure exactly what you're looking for here, but here's a simple example which creates and populates an array of 10 integer values, it then loops through the array and multiplies each item by itself. If the subscript is odd, the value of the current array item is output via the console:

#include <iostream>

using namespace std;

int main()
{
	// declare the maximum size of our array
	const int MAX_ARRAY_SIZE = 10;
	
	// set up our array and give it some values
	int array[MAX_ARRAY_SIZE] = {2,4,6,8,10,12,14,16,18,20};

	// now we'll loop through the array 
	for(int loop=0; loop<MAX_ARRAY_SIZE; ++loop)
	{
		// multiply each value in the array by itself
		array[loop] = array[loop]*array[loop];

		// if the subscript is odd, output the value of the current …
JasonHippy 739 Practically a Master Poster

Understanding(correct me if I am wrong):
(Q1)"the copy constructor takes an int as a parameter and returns a new int with the same value as the value passed in. So for the declaration of 'student' the copy constructor for int is called and passed the integer value 5. So for 'student' a new int is created and given the value 5.
Likewise, for 'subject', the int copy constructor is passed 3, so it returns a new int with the value 3 ."

This means that the system will take the value 5 and place it inside the marks[subject] and the value 3 and place it inside the [subject]. Because we use int subject=3;

(Q1) Not quite, the 'student(5)' and 'subject(3)' parts of that line of code are invoking the copy constructor for the int data-type. So in a very round-about way it's basically saying "set the value of student to be a copy of the number 5" and "set the value of subject to be a copy of the number 3". In other words it's more or less equivalent to using 'student=5' and 'subject=3'.
Then in the line where you have:

int marks[student][subject];

The arrays dimensions will be set to marks[5][3].

(Q2)If we used a const int subject=3,student=5; This means that we declared that all variables that is named subject will be equal to 3 and hence since the array is marks[student][subject], it will be marks[5][3]

(Q2) Yes!

(Q3)The error I had it before. They keep …

JasonHippy 739 Practically a Master Poster

I don't know about your compiler, but mines dosen't allow
declaration of of const object without being initialized. So the
above code would be an error.

Just for the sake of it, take a look at the errors, and see why
one wrong thing can lead to many errors.

error C2734: 'student' : const object must be initialized if not extern
error C2734: 'subject' : const object must be initialized if not extern
error C3892: 'student' : you cannot assign to a variable that is const
error C3892: 'subject' : you cannot assign to a variable that is const
error C2057: expected constant expression
error C2466:cannot allocate an array of constant size 0
error C2466: cannot allocate an array of constant size 0
error C2087: 'marks' : missing subscript
error C2133: 'marks' : unknown size

Oops, you're right!
I forgot about that little rule with consts..
Personally I always initialise constants (and most other variables) at declaration in my own code (like in methods 1 and 2 of my original response). I'd never initialise anything using the third method I posted (be they const or not!). I just unthinkingly slapped the const keyword into the OP's code....
I didn't compile any of the code I posted either....Guess that's something I aught to take the time to do in future! Doh!

Consider myself corrected....heh heh, I really am a window-licker sometimes! ;)

JasonHippy 739 Practically a Master Poster

Hi,

I have flash video in FLV. I have kept the video in html but my problem is that when clicks the video on browser it's goes to full screen.

Anybody help me?

Check out ContextClouds post in the thread below, I think it has the answer you're looking for!
http://www.daniweb.com/forums/thread190049.html

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

In my opinion, I think that it is not possible because we need to indicate the specific array like for example student[5] and subject[3] so that the system would not mixed up the arrays. Am I right? Please respond to me thanks:)

Ah, after seeing Sinkulas post (which he wrote while I was composing my previous response, so I didn't see it until I'd posted mine!), I understand what your comment was about now...I see!

Yes you're right. The array needs to be of fixed size.
As I explained in the first part of my post, declaring 'students' and 'subject' as 'int' makes the compiler think that the values could change and will cause the compiler to flag an error at the line declaring the marks array because the arrays size will not considered constant by the compiler.
Declaring 'students' and 'subject' as 'const int' will fix the issue!

Apologies for the long winded explanation of the copy constructor. I understand now that this was not where you were getting confused!
Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

I have this question,

Is it possible to use


int student,subject;
student=5;
subject=3;
int marks[student][subject]

instead of

const int student(5),subject(3);

int marks[student][subject];

?
If the it is not possible, can your please mind tell me the reason?

You could use either, both are more or less correct (Note: the first one isn't quite right, but I'll explain shortly!) and achieve exactly the same thing.
The 2nd example you listed is a more terse and therefore makes the code more succinct and to the point. In other words, you're using less code to achieve the same thing.

One thing to note in the first block of code you posted, 'student' and 'subject' should be declared as 'const int', not 'int'.
Arrays must be of fixed size. Declaring 'student' and 'subject' as int indicates to the compiler that the values of 'student' and 'subject' could change, therefore you'll get a compiler error in the line declaring the marks array. The compiler probably won't support the use of variable length arrays. However, changing the types of 'student' and 'subject' to 'const int' will fix the issue!

These lines of code:

const int student(5), subject(3);
int marks[student][subject];

Are creating two constant integer variables. 'student' is initialised to 5 and 'subject' is initialised to 3. Using the const keyword tells the compiler that once set, these values cannot be changed.
Then a two dimensional integer array called marks is then created using the …

JasonHippy 739 Practically a Master Poster

ok, sorry about that last message, i hadn't read yours before...
I'm still re reading what you wrote cause i don't really follow; but from what I get this is going to be SOOOO much harder than I thought! =)
I checked the intro.swf and it's just black... the intro.fla does appear to be the original intro... but the menu doesn't appear there... the file "botonera" both fla and swf are black too (with nothing in it)

Hey Paz.
Because of the way the site is separated into smaller .swfs, playing any of the other .swfs individually will almost certainly result in a blank black screen. But don't panic, it doesn't mean there is anything wrong!

After making your changes to any of the other files, like your change to intro.swf, where you're replacing the Mary graphic; To test your changes you'll need to run the preloader swf (base00.swf). Which will then load all of the other site components and you'll be able to see whether or not your changes have worked.

In other words, after you've worked on one of the smaller swf's, run base00.swf and wait until the bit you've edited comes along, so if it's in the intro, sit through the intro and check your change is as you wanted it. If it's in one of the other many .swfs, you can skip the intro and navigate to the page you edited, and check it that way.

Hope that simplifies things …

JasonHippy 739 Practically a Master Poster

Just found this little AS3 snippet:

[Embed(source='assets/ttf/gothic.ttf', fontName='CenturyGothic', mimeType='application/x-font', unicodeRange="English")]

at the following URL....
http://ricozuniga.com/2007/07/13/unicode-range-references/

Might be worth a try, if you're embedding the font in code, then setting the unicode range as above might help. (you'd just need to find out what the Danish unicode range is! ;) )

Also take a look at the following:
http://livedocs.adobe.com/flex/3/html/help.html?content=fonts_07.html

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

I remember having similar problems using flash 8 several years ago.. Certain extended ascii characters wouldn't show up in dynamically loaded text.

The solution was to select the dynamic textbox that the text was loaded into, open the properties panel and click on the 'Embed..' button. This allows you to select which characters from the font are embedded into your movie. I think by default it only includes the 'Basic Latin' character set (95 characters) in the English version of flash...not sure about flash in other languages!

I assume that you'll be needing to use either 'Latin I' or one of the 'Latin Extended' character sets.

Anyway, as long as your font contains all of the relevant characters and the character embedding settings are set appropriately your text should appear correctly.

Obviously, that was in the Flash 8 IDE. I'm not sure if this still applies to the CS3/CS4 IDE's, but it couldn't hurt to check.
There should also be a way of setting this via actionscript, but if there is, offhand I can't think of it!

The reason for the Character Embedding setting is to keep your .swfs filesize down.

For example:
Imagine you have a font which contains all possible 39,477 glyphs (which would be one massive .ttf file!) and you're using it in a text box to display some text.

If you export your movie with the default settings (Basic Latin - 95 chars - A..Z,a..z, 0..9 and …

JasonHippy 739 Practically a Master Poster

Ah Paz, from what I can see of the site, I think you may have misunderstood the architecture and layout of this flash site.

I don't know, but I'm assuming that you correctly spotted that base00.swf was the swf used on the page and so you opened base00.fla and finding that the intro sequence was missing you've attempted to recreate the original intro sequence replacing the image of Mary along the way?
Otherwise, perhaps you were using a really old .fla from when the original developer was starting to develop the site.

Either way, the file you needed to alter for your change is intro.fla/intro.swf.

The site is organised in this way:

base00.swf is a preloader which has an image of Christs face on it. This .swf loads the main interface movieclip (aka base02.swf)

base02.swf contains the wooden frame and the lamp graphics and loads jesus.swf, musica_intro.swf, botonera.swf, home.swf and finally intro.swf.

Once all of the assets have loaded into base02.swf, the intro.swf is played. At the end of the intro, the home page (home.swf) and the buttons (botonera.swf) are displayed.

So I think what you need to do is:
1. Make sure that base00.fla is restored to it's original state (Assuming you have backups of the original files!)
2. Open intro.fla/intro.swf and replace the graphic of Mary in there!
i.e. Find the .fla for the file at http://www.caminaeemaus.or.ar/intro.swf and replace the graphic of Mary in there.

JasonHippy 739 Practically a Master Poster

Then how could you identify the problem he is telling, Jason?

The file that the preloader loads is the one with the problem.
As Paz is offline, one way to find out the path to the file is to decompile the preloader.
That done, it should be pretty easy to download and decompile the target .swf. Then things should be pretty simple.
We'll have a .fla of the current .swf on the site, which we can compare against Paz's .fla. We can then solve the current problem.

In fact it would be easier to just open both .fla's and then insert the new picture that paz wants to use into the .fla ripped from the original .swf on the site..

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

Do u show the original swf how it looks in the output? Always when I am looking into your swf which is given by you as a link, showing a human face, nothing out of that.

Where can I find the original swf, which was the real output?

Hmm, I think that base00.swf is actually a preloader which loads the main .swf.
I tried going to the web-page and did a quick view source and made a note of the http:// path to the swf. I then made a quick html page which contained an 'a href' link to the swf and right-clicked to download it and the file is only 29k and is just the image of Christ...In other words it's the file that mistakenly Paz thought was the original main .swf.

So the file we need to take a look at is whatever .swf file the preloader is loading. I'm not sure, but perhaps decompiling base00.swf might tell us which .swf file the preloader is loading and the path to it.

I might try installing swfdec or some other decompiler later and see what I can come up with.
Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

hmmm, I'll take a look tomorrow when I can get onto a Windows PC with Flash 8....I'm out and about, so I'm on my Linux PC at the mo. So no flash! :(

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

I have no idea how to that

What you'll need to do is create something like a struct to hold your character data...
e.g.

// create a struct to hold your data
struct CharacterData
{
	string m_Name;
	int m_CID;
	int m_Age;
	int m_Char_Strength;
	int m_Char_Speed;
	int m_Char_Endurance;
	int m_Char_Aim;
	int m_Char_RunningEndurance;
	int m_Blackmarket;
	int m_Electionics;
	int m_Food;
	int m_misc;
	int m_Money;
	int m_Inventory_room;
	string m_Model;
	string m_Title;
	
};

Then somewhere else in your code (before you try to build your query) you'll need to create an instance of the structure and populate it with some data....

// Create an instance of your struct and populate it
CharacterData cdata;
cdata.m_Name="MyName";
cdata.m_CID=23432;
cdata.m_Age=42;
cdata.m_Char_Strength=100;
cdata.m_Char_Speed=25;
cdata.m_CharEndurance=50;
cdata.m_CharAim=38;
cdata.m_CharRunningEndurance=30;
cdata.m_Blackmarket=1;
cdata.m_Electronics=1;
cdata.m_Food=1;
cdata.m_Misc=1;
cdata.m_Money=599;
cdata.m_Inventory_Room=500;
cdata.m_Model="rofl";
cdata.m_Title="lol";

NOTE: For the above step, you might want to set up a loop and get the user to enter the character details into the structure using cin and cout or something. But for the sake of brevity, I've just gone with the simplest option of creating an instance of the structure and populating it with some hard coded data!

Next you'll need to create a function to build your query string:

string BuildCharacterQueryString_Insert(const CharacterData &data)
{
	// This will be our buffer to hold the query string
	ostringstream oss; // <--- you'll need to include sstream.h for this one!
	
	// Build first part of query
	oss << "INSERT INTO characters(Name, CID, Age, Char_Strength, Char_Speed, ";
	oss << "Char_Endurance, Char_Aim, Char_RunningEndurance, Blackmarket, …
JasonHippy 739 Practically a Master Poster

OK, well the error messages say it all...
For starters you need to uncomment the definition of RAND_MAX which is the cause of your error.

Secondly, as Salem has pointed out, you need to include stdlib.h, which will get rid of the warnings about rand and srand.

Finally line 116:

i = (randomperc() * (high - low + 1)) + low;

The variable 'i' has been declared as a long, as have the variables 'high' and 'low'. The randomperc function returns a double, which is the cause of the final warning, basically it's telling you that the double will automatically be converted to long and that it could result in a loss of precision (due to the inherent floating point issues.)
Being a warning, you could just ignore it, but it could be worth explicitly casting the value returned by randomperc to long.
i.e.

i = ( ((long)randomperc()) * (high - low + 1)) + low;

Which will stop the warning from occurring.

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

This concept seems really strange to me...
You've created a class called Mp3 and a class derived from Mp3 called Frame, but the Mp3 class has members which are instances of Frames???

I could be wrong, but I don't think it's possible to do that in C++. In all my years, I've certainly never seen or heard of it being done before!

This sounds like a paradox kinda like the chicken and egg scenario... Which came first, Mp3 or Frame? Mp3 is a class which uses Frame, and Frame is derived from Mp3 (where Mp3 is a class which uses Frame, which is derived from Mp3, which uses Frame.....etc ad nauseum.). It all seems a little incestuous and ultimately unnecessary!

You could declare two classes Mp3 and Frame and you could get Mp3 to use instances of Frame in it. But I don't think that there's any need to derive Frame from Mp3.

Personally, I think you need to rethink your design!
Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

You can use execv also.

#include <iostream>
#include <unistd.h>
using namespace std;

int main()
{
  char *args[3];
  args[0]="sample.txt" ;
  args[1]=NULL;
  printf("This is before execv \n");
  execv("c:\\windows\\notepad.exe", args);
  return 0;
}

Read more about -
exec

One minor thing....isn't unistd.h a Unix/Linux header file??
I don't think any of the windows compilers ship with unistd.h do they?? (except perhaps Cygwin!).
If memory serves correctly, on windows, you need process.h for the execv() function.
I haven't tested it, but I think swapping unistd.h for process.h should work for anybody trying to build adataposts listing on the windows platform!

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

Also see some of my recommendations in this old post:
http://www.daniweb.com/forums/thread191401.html

Jas.

JasonHippy 739 Practically a Master Poster

No, Its working fine, even you clicked that button, the reason is "Its not jump to 103 as you said, it jumps to intro in 117" so its fine. But I am not analysed the whole frames, I was try to do the request of pazoconnor, thats it, anything more, please help out him.

No, in Paz's original .fla the 'intro' keyframe was at frame 103, and the stop was at frame 117. The button code was gotoAndPlay("intro").

But it turns out that the button is not even supposed to be there. The swf is supposed to be the same as the one on the website in Paz's original post (the one about the scroll not working). The only thing Paz wanted to change was the image of mary in the intro. But the .fla Paz has is not the .fla that was originally used to publish the .swf on the original web page. It is an earlier unfinished version of the .fla.

Paz managed to replace the image ok, but there is all of the other detritus in the file (the stop, the button etc.). The stop was the main thing causing the problem with playback, but there were other problems in there, which I've highlighted and fixed!

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

I'm not sure which compiler you're using, but usually you'd register any 3rd party libraries with your compiler.

e.g. In Visual Studio 2003 you'd:
In the Solution Explorer, right click on your project and select 'properties'.
In the property pages, select the 'C/C++->General' item in the tree.
Now select the 'Additional Include Directories' in the form and click on the '...' button. This will bring up a dialog which will allow you to add the path to the include folder of your library.
To do this, click on a blank line in the list (or add one using the folder icon and then select it). Next select the '...' button and use the popup dialog to navigate your way to the libraries include folder.

So that's the first part, the headers for your library are registered with the IDE. Next you need to ensure that the linker knows where to find the precompiled library files (usually found in the lib folder).

To do this, select 'Linker->General' in the tree and select the 'Additional Library Directories' item in the form and click on the '...' button that appears to bring up the 'additional library directories' dialog. As with the 'additional header directories' dialog, select a blank line (or add one using the folder icon and then select it) and use the '...' button to navigate to the lib directory for your library.
That done, click OK on all of the open dialogs and …

JasonHippy 739 Practically a Master Poster

Please open the .fla given by pazoconnor, and do like in the attachment and ctrl+enter to publish as .swf. Thats it done.

Hey Raja.
Doing that would've stopped the .swf from stopping (and fix the issue), but there was a little more to it than just that to get it to look like the original version on the website. There are a few other things that needed tidying up beside removing the stop(). (like removing the redundant button and its code, moving the 'saltear intro' button etc.).

For example, if you only remove the call to stop() from the original .fla; If a user clicks the button at any point before the removed stop, the movie would keep jumping back to frame 103 and playing from there. See my previous posts!

When I fix things, I like to fix 'em good! :) heh heh!
Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

Ah, I see Paz...Sorry, slight misunderstanding on my part there too!
When I looked at the versions of base00_1.swf that you uploaded, it only shows the image of jesus and nothing else, so as there was nothing to refer to, I made my deductions based on what I saw in the .fla. (Hence my thinking that the button had to be clicked before the animation continued!)

But I've just looked at the website you posted a link to in your first flash related post (the one with the scroll problem) and seen the original intro .swf in action, which I suppose I should've done in the first place....Doh!

Yes, it looks like the .fla you were given by the designer was not the final one used to publish the .swf that's on the site..Either the designer gave you a slightly earlier version, or they went on to mess around with the .fla after they'd published the final .swf for your site.

Ok, to make the .swf look more like the version on your site, we just need to remove the button (not the signpost, just the blue button overlay), and get rid of the stop in the actionscript at frame 117. and that should just about be it!

The only other things I can see that need to be done are:
1. Adding a few frames after mary fades in (she fades in/out rather quickly in your .fla)
2. Moving the 'saltear intro' …

JasonHippy 739 Practically a Master Poster

Quick background: I'm working on Project Euler and made a palindrome checker. I needed to convert integers to strings. itoa() kept giving random values (9 gave 9 or 90, etc...), so I decided to make my own, and ran into a problem. I have fixed it, but could somebody explain what caused the problem and why the fix works?

Broken Code: The below code creates a stringstream inputs the number then puts that into a string and then into a char. The problem is it would chop the last number off when returning the char. (The buffer holds the 99800 value but the receiving variable numaschar = strItoA(num); becomes 9980.)

char* strItoA(int number)
{
   std::ostringstream sin;
   sin << number;
   std::string val = sin.str();

  size_t length;
  char buffer[val.size()+1]; //add one for the zero terminator
  length=val.copy(buffer,val.length(),0); //do the transfer and grab the last position
  buffer[length]='\0'; //zero terminate!!
  return buffer;
}

The Fix:

char* buffer; //moved outside of function and given reference

char* strItoA(int number)
{
//Same...

  buffer = new char [val.size()+1]; //added to keep buffer dynamic
//char buffer[val.size()+1]; //removed
//Same...
}

Thanks. :)

Looking briefly at the first block of code, I think it's because the char buffer is declared inside your function and only has scope inside your function. So as soon as your function returns, the object referenced by the returned value has been invalidated as it is out of scope. In which case you're lucky to have anything sensible at all in the return value. That or perhaps you were overwriting …

JasonHippy 739 Practically a Master Poster

What have you got so far?

JasonHippy 739 Practically a Master Poster

.ttf files are basically just fonts.

In order to be able to use them, what you need to do is install the font on your system and then you should be able to use the font in any application that uses system fonts to display text, be they office/openoffice applications or desktop publishing/graphics applications (word, photoshop, flash..whatever!)

To install the font on windows XP (and probably almost any other version of windows), you can do either it via the control panel...by selecting the fonts link and then follow the instructions for installing your .ttf file.

Alternatively, via windows explorer, open two instances of windows explorer, in the first window, navigate to wherever your new .ttf file is. In the other explorer window, navigate into the system fonts directory, (typically C:\WINDOWS\Fonts\).

Now you have two options, you can either:
Copy the .ttf file in the first window and paste it into the 2nd window.
OR:
drag the .ttf file from the first window to the 2nd window.

Whatever of these actions you choose, the outcome will be more or less the same. The .ttf file will be moved/copied into the system fonts directory and windows will automatically register it as a system font.

Next fire up an application and you can select the font from the list of fonts.
i.e. open a word processor like word and click on the font drop-down list and you should be able to see the …

JasonHippy 739 Practically a Master Poster

hmmm.....Sounds interesting....This sounds like it will be quite a complex effect.....

Usually I'd imagine that blood dripping into water would gradually dissolve, so i guess you want the blood dripping into the water, perhaps causing a splash as it hits (which could be a separate particle system in itself) and then as the blood sinks into the water, it gradually dissolves and diffuses into the water. As more drips of blood dissolve in the water, I guess you'd want the colour of the water to gradually change.

Given a few days, (as long as my schedule permits) I can probably knock up some kind of very basic AS3 flash particle system tutorial and can then leave you to take that on board and work out the finer points of the exact effect you're after...Producing that effect could take a good deal of work though. But from the sounds of it, if you can pull it off, it should be worth it!

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

OK, I'd not noticed that.

Well first off, the movie isn't playing from frame 80. It is actually playing from frame 1.
Looking at your original .fla, the layer containing jesus' face at the start of the animation has been turned into a guide layer, which is why it isn't appearing....
I've applied my original fix (moving the 'intro' keyframe in the 'acciones' layer)
I've also turned the guide layer back into an ordinary layer.

So now when the movie is played it appears exactly as you've described it should.

I've uploaded a zip of my solution to rapidshare. I tried to attach it here, but it kept failing. I guess it must've been a bit too large!
Anyway, the link is below...
http://rapidshare.com/files/264873439/edits.zip.html

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

In standard C++, to make a function overridable, you'd make it virtual in your base class.

So perhaps you need to change the signature of your isKnownWord function to:

public:
        virtual bool isKnownWord(){};

Then in any derived classes you can override the function, all you'd do is declare it as a virtual function in the header for your derived class and then define the overridden function in the .cpp implementation.

e.g.
header for base class

class Base
{
    public:
        virtual bool isKnownWord(){};
};

header for derived class:

#include "Base.h"
class Derived:public Base
{
    public:
        virtual bool isKnownWord();
};

Derived.cpp:

#include "Derived.h"

bool Derived::isKnownWord()
{
     // your overridden code here
}

If you're targeting the CLR then I think you should use the override keyword in the header file for your derived class.
i.e.

virtual bool isKnownWord() override;

I don't think that the override keyword is a part of standard C++....But I could be wrong, I'm still using VS2003!

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

Alternatively, if the musicback1 script is complete and working, what you could do (especially if musicback1 is used elsewhere in your app) is define another function which calls musicback1 and then does any other bits that you want.

Here's a little pseudo-code to demonstrate what I mean:

def musicback1():
    #musicback1 code here....

def othercommand():
    #call the musicback1 function...
    musicback1()
    # now do whatever else you wanted to do....
    # call any other functions, or write more script below.

# updated button code calls othercommand instead of musicbu1.
musicbu = Button(root, text='Backup Music', width=17, command=othercommand)

Is that any help to you?

JasonHippy 739 Practically a Master Poster

One other thing has sprung to mind....

If your program is actually running for a while before it bombs out, it's almost certainly a bug in your code.

If it works on your machine and not any others, is it possible that you have hard coded something into your program which is specific to your machine?....Like perhaps a file-path or something??

Taking the filepath as an example:
Say your program needs to use a file like...
C:\somefolder\somefile.txt

Your machine has a folder on the root of c: called somefolder and contains the appropriate file, but your other windows machines do not.

OK so, you run your program on your XP machine, it finds the file and does whatever it needs to do...ok, fine!
Now you run it on another XP machine....One that does not have the appropriate folder/file...
Perhaps as well as hard coding the path, perhaps when opening the file, you've not put a check in your code to ensure that the file opened ok before attempting to do something with it....
Your program then tries to access the non existent/non opened file and the program crashes..

OK, This is merely a possible scenario. Conjecture if you will, but it's an example of something that could cause problems!

Take another look at your code and see if there is anything which is specific to your machine hard coded in there and then try to make it more …

JasonHippy 739 Practically a Master Poster

As Necrolin has stated, a program built on Windows will not run in Linux (without something like Wine! ;) ), likewise a program built on Linux will not run on windows (without something like Cygwin!)

But if you compiled it on Windows, the resultant .exe should work on other windows machines regardless of the version (well more or less! There are some cases where it wouldn't!)

As you compiled your program on XP it should at least run on another machine with XP.

I'm not sure of the dependencies of .exe's built with DevC++, but if you create an .exe with Visual Studio, especially if you've used the MFC, the .exe will require the msvcrxx.dll in order to run.

xx relates to the version of VS used to compile the program. So an .exe created with VS2003 could require the msvcr70.dll, VS2005 .exe's need msvcr80.dll, VS2008 .exe's need msvcr90.dll.

If another windows machine doesn't have the appropriate .dll installed and the .dll isn't packaged alongside the .exe (or in your installer) then your program will not run on that machine.

Now as I've said, I don't know if .exe's built with DevC++ have any particular .dll dependencies like VS, but if they do and your other windows machines do not have those .dll's installed then that could possibly explain the problems you're having....

Similarly, if you are using any other third party libraries or .dll's in your code; if your target machine does …

JasonHippy 739 Practically a Master Poster

What the hell happened to my code tags in that last post? Doh!
Apologies for that!!

JasonHippy 739 Practically a Master Poster

A water scene with drips that drip into each other and splash eh?

Can you describe the scene in any more detail? it's a little vague at the moment!
Where are the drips coming from? Are they just dripping down off of something? Are they splashing into a pool of water? or are they rolling down something? (like raindrops rolling down a window)

Using AS3 you could easily create a simple particle system to deal with creating and animating the drips, but without knowing a bit more about how you want the scene to look and how you want the drips to interact with each other and the rest of the scene, I don't think anybody can be of much help!

Have you tried anything yet? Have you got anything that you can show us? What have you got so far? Need input! Heh heh.

Note: If you're looking for a full 3D fluid simulation in flash, it would require a maths, physics and flash genuis...i.e. not me! heh heh :P

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

OK, this should take about 30 seconds to fix.....

1. Open up your fla.
2. Take a look at the two layers called 'acciones' at around frames 100-120.
In the top 'acciones' layer at frame 103 there's a keyframe with the framelabel 'intro'. Now take a look at frame 117 of the other 'acciones' layer..Here you'll see a keyframe with some actionscript on it...What we've got here is a call to stop(); .

From what I can deduce, the movie is stopping at frame 117 to wait for the user to click on the 'ACCESSO A Fundacioe animo de Emaus' button. So next step:
3. Take a look at the actionscript on the button.
Looking at that we see the following...

on (press) {
	gotoAndPlay("intro");
}

This is telling the movie to go to the frame labelled 'intro' and start playing. Now if you look at the timeline, the button is visible from frame 6 to frame 117 (which is where the call to stop is).
Bearing in mind that the pressing the button causes the playhead to go to the frame labelled 'intro', what frame is the 'intro' keyframe on??

Looking at the top 'acciones' layer we can see that the 'intro' label is at frame 103.

So effectively, what is happening is whenever you press the button, the playhead is moving to frame 103 and playing to frame 117 (where the call to stop() is). So you're effectively …

JasonHippy 739 Practically a Master Poster

What about Bugzilla? I believe it's open source, it's certainly free and it can be used with various CVS systems SVN/GIT/VSS/Perforce etc...

Every company I've worked for has used it for tracking bugs, my previous employer used it with SVN(nice!) and VSS(blech!).
My current employers use it with Perforce(nice!).

From what I've heard (and judging by some of the rather explicit outbursts from our network administrators office), Bugzilla can be a bit fiddly to set up properly. But once it's up and running it's pretty solid!

MantisBT and Trac (as endorsed by ShawnCplus) are a couple of other popular bugtrackers. I believe Trac integrates quite easily (and rather well) with SVN.....Never used it, but heard good things about it!

Hope that's of some use to you.
Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

OK,
After this line:

label = Tkinter.Label(pg4_group.interior(), image=photo)

try adding the following:

label.photo = photo

This will create an instance of your image in the label, preventing it from being garbage collected (Which is what I suspect is going on!).


Next, after your call to label.place, add the following:

label.pack()

Your final file should look something like this:

from tkFileDialog import *
import Image, ImageTk,Pmw, Tkinter

class Demo:
    def __init__(self, parent):
        notebook = Pmw.NoteBook(parent)
        notebook.pack(fill = 'both', expand = 1, padx = 10, pady = 10)
        page_4 = notebook.add('About')
        pg4_group = Pmw.Group(page_4, tag_text = 'Picture')
        pg4_group.pack(fill = 'both', expand = 1, padx = 10, pady = 10)
        image = Image.open("pic.JPG")
        photo = ImageTk.PhotoImage(image)
        label = Tkinter.Label(pg4_group.interior(),image=photo)
        label.photo = photo #prevent photo from being garbage collected
        label.place(x=0,y=0,width=image.size[0],height=image.size[1])
        label.pack() # display the image
        
if __name__ == '__main__':
    root = Tkinter.Tk()
    Pmw.initialise(root)
    widget = Demo(root)
    root.mainloop()

Now your image should appear and your problems should be solved!

Cheers for now,
Jas.

P.S. See the following link for more details on the Tkinter.Label widget:
http://effbot.org/tkinterbook/label.htm

bumsfeld commented: nice help! +7
JasonHippy 739 Practically a Master Poster

THANK YOU SO MUCH !!!!! I cannot express how much u helped as it is I am not a "computer person " so I was really freaking out and bumbed cause I thought great now I have to get another laptop...:-/ but I did what you said and MAGIC it worked !!!! Thanks alot!!!!

No probs....Can you mark this as solved please? It may help others who are in a similar situation!

Jas.

JasonHippy 739 Practically a Master Poster

Jas,

Thanks for the reply. I'm only using as3 for the flash rotator banner. The menu is and rest of site is in HTML. I know I had this problem in the past with flash files. Adding so.addParam("vmode", "transparent"); would fix that problem but I don't know how to do something similar this time.

Hope this makes sense.

Regards,

Eduardo

Ah, so you mean it's the z-order on the html page that is the issue, not the z-order of the items in the .swf?

JasonHippy 739 Practically a Master Poster

If you've used actionscript to put everything onto the stage, then you should be aware that the display items on the stage are added on top of one another, so the first thing to be added to the stage will be at the bottom and each subsequent item added to the display list (via addChild) will appear above the previous item. So if you added the menu before the image rotator, then the menu will appear behind the rotator.

So if you're using actionscript to create the instances of the menu and the rotator you could do your initialisation of your components something like this:
(Note: this is kinda pseudo code, seeing as I don't know exactly what you're doing!)

// create an instance of the menu, but don't call addChild() yet!
menu:MenuComponent = new MenuComponent(//constructor arguments here);
// perform any additional initialisation. x,y pos etc...

// now create an instance of your rotator
rotator:RotatorComponent = new RotatorComponent(// constructor args);
// do any  additional initialisation, x,y pos etc...

// now add the rotator to the display list followed by the menu
addChild(rotator);
addChild(menu);

So although we created an instance of the menu before the instance of the rotator, we called addChild on the rotator before the menu, so the menu will appear above the rotator, not behind it.... Not sure if that's what you're after?
Adding the instances to the stage in this way should negate the need to do any kind of depth sorting.