JasonHippy 739 Practically a Master Poster

I'm not sure what you're after here, your post isn't worded particularly clearly. But if I understand correctly, and from looking at your code, I think you may have got things a little mixed up here.

The OnButtonStart() function is definitely a C++ function. So no real problems there (other than the use of printf!). But the JNIEXPORT line defines a C++ function which can only be called from Java using JNI (at least as far as I can tell! I could be wrong!).

So are you saying you want to be able to call the C++/JNI function from OnButtonStart(), rather than calling it from Java? If so you might want to consider moving/refactoring the C++ code in the JNI function into a new function and then calling that in the JNI function AND in OnButtonStart.
e.g.

// make this a public static member of 
// whatever class m_DeviceID is a member of
void yourclass::SetDeviceID()
{
    m_DeviceID = StartUp( GetConsoleHwnd2(), WM_VX);
}

Then in your dialog code:

void CVentanasDlg::OnButtonStart(){
std::cout << "OnButtonStart");
yourclass::SetDeviceID(); // call your new function here!
}

And likewise in the JNI function:

JNIEXPORT void JNICALL Java_JniComm_openDevice(JNIEnv *env, jobject obj){
yourclass::SetDeviceID(); // Call the new function here...
}

This would allow the functionality inside the SetDeviceID() function to be called from Java via the JNI function and directly from OnButtonStart.

BTW: The above snippets assume that the new function is a public static function in an external class called yourclass. …

JasonHippy 739 Practically a Master Poster

Mixing C and C++ is not really recommended. Typically when using C libraries in a C++ program, it is best to create or use some kind of wrapper API. Whether this is a third party wrapper or one you create yourself is entirely up to you. I'd recommend at least trying the official one for now.

gtkmm, is the official C++ wrapper for gtk:
http://www.gtkmm.org/en/index.html
http://en.wikipedia.org/wiki/Gtkmm

If you're a Windows user, you can download an installer from the gtkmm website above. If you're on Linux, your distro should have relevant packages in it's repositories, so check there first. Otherwise download some packages from the gtkmm site.

Regarding the 2nd part of your question:

Second of all, if I just use a simple texteditor to write my code I want an easy
access to API both for std C++ and for Gtk.
Where is a good place to find good API:s for both?

I'm not sure what you mean!

If you mean you want syntax highlighting, most modern text editors have built-in syntax highlighting for C++ nowadays, with the exception of things like MS Notepad. But most text editors don't offer anything beyond mere syntax highlighting.

If you want an editor with intellisense / code-hinting / code-completion functionality, then you might want to look into using an editor which is based on Scintilla. Like Scite, or perhaps something like the Code::Blocks IDE which uses Scintilla to provide code completion. (or …

JasonHippy 739 Practically a Master Poster

There is no 'magic eraser' in gimp. But there are several different ways to remove the background from an image.

If the image background is simple and only uses a few colours you can use the 'fuzzy select tool' to achieve a similar effect (press U or select the magic wand in the toolbox to select this tool.)

Here's a tutorial from the gimp website:
http://www.gimp.org/tutorials/Changing_Background_Color_2/

NOTE: The above tutorial talks about using the 'select regions by colour' tool, which is the old name for the 'fuzzy select' tool. Same tool, different name!

OR if the foreground object is antialiased and the background is a single colour, you could use the colour to alpha filter.
Tutorial here:
http://www.gimp.org/tutorials/Changing_Background_Color_1/
There are a few minor caveats to this method, but the tutorial lists several workarounds.

Finally, there is another method which involves using the lasso select tool to select a general area and then creating and editing a layer mask to precisely define the selection before copying the selected area from the background image.
See tutorial here:
http://photo-info.co.nz/articles/removing-image-backgrounds-gimp

The lasso+layer mask method is handy if you're trying to isolate an object from a photo, or if the background has a lot of colours, complex patterns or uses gradients.

Depending on your needs, one of these methods should work.
Good luck!

JasonHippy 739 Practically a Master Poster

The first thing I'd say is that the static_cast is inappropriate. dynamic_cast would be more type-safe. But because CVSystemDLL derives from IVSystemDLL, you should be able to point your IVSystemDLL pointer directly at a new instance of a CVSystemDLL object with no need to cast.
I haven't had my first coffee of the day yet and i'm slightly hung over, so I'm not exactly 100% awake atm, but as long as the pointer allows you to access the derived classes implementation of the main function and not the base classes pure virtual one you should be OK. Otherwise you'd have to cast the base-pointer back to it's correct derived type using a dynamic_cast before calling main. As I said I'm not quite alive yet, so I could be wrong, but that's my two pence!

JasonHippy 739 Practically a Master Poster

I'm not familiar with pywinauto, but pexpect is the closest thing on Linux that I can think of offhand!

JasonHippy 739 Practically a Master Poster

Generally speaking, when you download and use 3rd party libraries you just need to set the compiler up to look for additional headers in the library's 'include' directory, and you point the linker to it's 'lib' directory to allow it to link your program using the provided .lib's/.dll's or .so's.

Some libraries contain pre-compiled binaries in their 'lib' directory. Others may require you to build them from source before you can use them. Typically the owners/creators of any given library will provide instructions on this.

In VS, you can set up the search-paths for directories containing additional header and library files on a per-project basis in the project settings.
e.g.
Select 'Project->Properties' in the main menu to bring up the project properties page.
Under 'configuration properties' select the 'C/C++->General' tab and select the 'Additional include directories' field. Then click on the '...' icon to open another window which will allow you to add the paths to the 'include' directory of your 3rd party library to a list. You can also alter the include order by moving entries up or down the list.

Then under the 'Linker->General' tab you can do a similar thing with the 'Additional Library Directories' item and add paths to the 'lib' directories of any 3rd party libraries you want to use.

Alternatively, you can set up the search paths as global paths in 'Tools->Options' under the 'Projects and solutions->VC++ Directories' item:
Select the 'show directories for' drop down …

sergent commented: .. +4
kvprajapati commented: Good post. +15
JasonHippy 739 Practically a Master Poster

I had exactly the same problem on my old RM Tablet PC.
I found a solution by sheer luck while I was messing about one day. I opened up the sound mixer application (Can't remember the name offhand, but it's the one with all of the volume sliders... Is it ALSA Mixer??) Anyway, whatever it's called, I opened it up and had a look at it's options/settings. Somewhere in the options was a list of all of the sliders which you could choose to show or hide in the application. Turns out there were separate sliders for the headphones and the internal speakers.

As I only tend to use the headphones and not the internal speakers, I muted the channel for the internal speakers and then hid the slider. I set the headphone slider to max and hid that slider too. And to control the volume I just used the main master volume control.

I couldn't find any way of setting it up so the internal speaker would only be used when the headphones were unplugged, but I rarely used it without headphones anyway, so setting the individual sliders was an acceptable solution for me!

BTW: That was a few versions of Ubuntu ago though, so things might have changed since then.
Also since upgrading the tablet to 10.10 I noticed that everything (including the speaker/headphone thing) works out of the box in 10.10.

JasonHippy 739 Practically a Master Poster

Graph doesn't have a value because it is a function.
You seem to be getting confused between variables and functions.
You need to call the function, passing any parameters it requires and use the value it returns.

If you're saying you want to keep the call to the graph function inside the slope function and then have the slope function return both values, then you'd need to return a struct containing both values from the slope function.
e.g.

struct retval{
float m;
float c;
};

retval slope(float y2, float y1, float x1, float x2)
{
    retval ret;
    ret.m = (y2-y1)/(x2-x1);
    ret.c = graph(ret.m, x2, y2);
    return ret;
}

So then in main you could do this:

retval values = slope(y2,y1,x2,x1);
cout << "y=" << values.m << "x+" << values.c << "\n";
JasonHippy 739 Practically a Master Poster

The thing you need to bear in mind is that 'graph' and 'slope' are functions which take parameters and return values, so cout << graph; does not do what you are expecting. I think in this case cout will output the memory location of the function, if it will even compile at all!

Try creating a float variable to store the value returned by the 'slope' function and then cout that.
e.g.

float value = slope(y2,y1,x2,x1);
cout << value;

Or more directly you could do this:

cout << slope(y2,y1,x2,x1) << "\n";

edit: Also you don't seem to be doing anything with the value returned by the call to your 'graph' function, so you'll need to do something similar with that too!

In fact you might want to consider removing the call to 'graph' inside the slope function and call it from main instead.
e.g.

float m = slope(y2,y1,x2,x1);
float c = graph(m,x2,y2);
cout << "y=" << m << "x+" << c << "\n";
JasonHippy 739 Practically a Master Poster

I installed the system from a CD if that is what you're saying there. How/where do I get a stable ubuntu for actual use?

cheers

The Live CD IS a stable release....Well, supposedly! heh heh!
As Ubuntu is a bleeding edge distribution their releases can be a bit buggy sometimes, but their live CDs are generally stable enough for day to day use.

If you want assured stability you might want to consider using Ubuntu 10.04 which is the current LTS version (long time support). Otherwise 10.10 is a pretty good bet.

After installing from any live CD (regardless of the distro), getting the latest updates will also aid stability.

Linux live CD's are stable and provide a good basic system for a typical users day to day needs, which you can install and then customise to your hearts content. But when it comes to customising your system, you need to exercise a little caution. Especially if you aren't sure what you are doing. You need to be very careful about which things you install and uninstall. If you go carelessly uninstalling a critical system component, then you will undoubtedly have problems.

And unlike Windows, Linux will do whatever you tell it to even if that damages/breaks the system. And most of the time it won't even warn you that you are about to break something!

JasonHippy 739 Practically a Master Poster

With both issues, I see what you've copies seems to mention and E: drive and a W: drive.

E: and W: are not referring to drives at all, this is Linux NOT Windows!
The lines of text with 'E:' at the start are error messages. The ones with 'W:' at the start are warnings! Although personally I fail to see any difference, the warnings are still error messages aren't they?! heh heh!

I believe you might be running Ubuntu from a Live CD. Live CDs are generally for short trials and not actual use.

What do you mean 'not actual use'? Of course live CDs can be used!
For example:
I have a really old desktop PC at home with no hard-drive, which does not support booting from USB. Rather than throw it away, I boot it with live CDs (Tiny core, lUbuntu, Puppy etc. Basically anything that comes to hand!). Any documents we need to save are saved to a USB memory stick. So it's kinda like a kiosk. Our daughter uses it a lot with a Qimo liveCD (lightweight Xubuntu based distro aimed at kids).

It also comes in handy as a fallback when she's hogging one of our laptops. So my wife or I can get online and do internet shopping/banking. And because it's a live CD and everything is stored in RAM, no traces of any transactions are stored on the PC. So once the PC's shut down any information like …

JasonHippy 739 Practically a Master Poster

I have heard that it is possible to set up a cross-compiler environment which will allow you to build executables for other platforms from within Linux, but I've never looked into it. The few cross-platform apps I've worked on have been done as per Rubbermans post.
e.g.
Using cross-platform libraries like QT or wxWidgets, separating any platform specific (or even compiler specific) code using #ifdef statements and using the preprocessor to perform conditional compilation. Then when it came to building the apps on different target platforms, it was a case of compiling the code in the targets native environment using a supported compiler.

I think google might be your friend here.
Here are a few links I found on the topic...
About cross-compilation:
http://en.wikipedia.org/wiki/Cross_compiler#GCC_and_cross_compilation
Cross-compiling wxWidgets for Windows on Linux:
http://wiki.wxwidgets.org/Cross-Compiling_Under_Linux#Cross-compiling_under_Linux_for_MS_Windows
MinGW as a cross compiler on Linux:
http://www.mingw.org/wiki/LinuxCrossMinGW

From an initial glance it looks like it'll be a bit of a pain to set up and get working. Good luck!

JasonHippy 739 Practically a Master Poster

First up, you might want to try using 'http://' in front of your URL to avoid the URL being interpreted as a 'file://' request. Otherwise, if that doesn't help take a look this. It describes the exact problem you are experiencing and the steps required to solve it:

Troubleshooting PHP 5

Does your browser ask if you want to download the php file instead of displaying it? If Apache is not actually parsing the php after you restarted it, install libapache2-mod-php5. It is installed when you install the php5 package, but may have been removed inadvertently by packages which need to run a different version of php.

If sudo a2enmod php5 returns "$ This module does not exist!", you should purge (not just remove) the libapache2-mod-php5 package and reinstall it.

Be sure to clear your browser's cache before testing your site again. To do this in Firefox 4: Edit → Preferences … Privacy → History: clear your recent history → Details : choose "Everything" in "Time range to clean" and check only "cache", then click on "Clear now".

Remember that, for Apache to be called, the URI in your web browser must begin with "http://". If it begins with "file://", then the file is read directly by the browser, without Apache, so you get (X)HTML and CSS, but no PHP. If you didn't configure any host alias or virtual host, then a local URI begins with "http://localhost", "http://127.0.0.1" or http://" followed by your IP number.

If …

JasonHippy 739 Practically a Master Poster

Compiles and runs fine, there is nothing wrong with it!

This is the example code from the link that Narue directed you to in your other thread isn't it?

Exactly what problems are you having?

JasonHippy 739 Practically a Master Poster

The problem here is with the use of the function pointer. Whether it is const or not is neither here nor there. From what I can remember about inline functions; virtual functions and functions pointed to by function pointers cannot be inlined. At least, that's what I was always told!

However, seeing Roshi's post. Perhaps the optimisation settings of the compiler might be able to circumvent the function pointer rule. Assuming that the optimising compiler is intelligent enough to realise that the function pointed to by the pointer can be inlined. And I suppose if the function pointer is const and is pointing to an inline function, that might be all the indication that is needed. Compiler optimisation has come a long way over the last decade or so. However, implementation of this could vary from compiler to compiler, so it might not guarantee that the function will always be inlined!
So this may work with gcc. But VS, Borland, ARM or other compilers might not support it.

Either way optimisations aside; typically inline functions are not inlined when called via a function pointer!

JasonHippy 739 Practically a Master Poster

That's looks like the IP address for your router, not the apache server.
The username and password you're being asked for in the image is the one for your router.
Try 127.0.0.1 (localhost) in your browser instead!

JasonHippy 739 Practically a Master Poster

You said you had the language pack, but I wonder if there are some additional libraries that you still need. You could use apt-cache search korean to see what other libraries are available. You might want to try using 'hangul' as a search term too. Install any related libraries you don't already have using the apt-get install command. I think some of the multi-byte languages require input method libraries, so installing any of those that appear in your korean/hangul searches may help. The only other thing is a font, but I would have thought that would be in the language pack.

JasonHippy 739 Practically a Master Poster

Assuming you're using Gnome:
1. Go to 'System->Preferences->Keyboard'
This will open the keyboard preferences window
2. Click on the Layouts tab
3. In the layouts tab select the 'Add' button.
This will pop up a dialog where you can set up the keyboard layout for whatever country you like. In this case, you want Korean!

Once you've done that, you simply set which of your keyboard layouts you want to use. I think there's a 'keyboard switcher' panel widget which you can put into a desktop panel and use to instantly switch between any keyboard layouts that you have set up.

If you're using KDE or any other desktop/WM, there will be a similar tool somewhere in the options to allow you to set your keyboard preferences.

JasonHippy 739 Practically a Master Poster

Set your keyboard preferences and add a layout which supports hangul. On my phone atm, and can't remember the exact steps! Will post again later if nobody else posts more detailed instructions.

JasonHippy 739 Practically a Master Poster

Basically in the first part of the code the condition in the if statement says "if the file reuters21578 does not exist in the mahout-work directory"
Note: The ! is the logical NOT operator.


If the file does not exist in the specified directory the code under the if statement (the 2nd part you wanted understand) uses the program curl to download the file from a website and saves it in the mahout-work directory.

JasonHippy 739 Practically a Master Poster

From anywhere on your system:

find / -iname "matrixcal"

If needed you can use jokers, e.g. "matrixcal*".
If you want to search case sensitive, use -name option instead.
By using the path "/", you can search from anywhere, find will always start from the root.

This will only list files called 'matrixcal' or in your additional blurb, files where the filename starts with 'matrixcal'. But the OP was looking for a way of listing all files which contain calls to a function called matrixCal. So your suggestion will not work! But you are correct about using / rather than .!

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

Just for future reference, webcams can be a bit hit and miss on Linux.

If your webcam is compatible with the UVC specification (USB Video device Class) then it is guaranteed to work as Linux has UVC drivers implemented.
Although admittedly this could vary from distro to distro. But AFAIK all of the major distros include the UVC drivers!

Take a look at:
http://en.wikipedia.org/wiki/USB_video_device_class
and:
http://www.ideasonboard.org/uvc/

Usually only very old webcams are incompatible with UVC and so will most likely only work under Windows unless somebody in the Linux community has created/reverse engineered drivers.

But most webcams from recent years should be UVC compliant. Apparently any webcams that are 'Certified for Windows Vista' will be UVC compliant and so should work properly on Linux using the Linux UVC drivers.

JasonHippy 739 Practically a Master Poster

One thing you need to bear in mind is that all of the commands available in BASH (and the various other shells in Linux) are programs or scripts that reside in various system folders specified in the $PATH environment variable.

The /bin/ directory typically contains programs/commands that are ran at boot-time.
The /usr/bin/ directory is the main system folder for user-space programs/commands.

Whenever you type a command in Bash you are simply running one or more of these programs and passing various parameters. So for example, the command ls -l calls the system program 'ls' (which lists the contents of a directory) and passes the parameter '-l' which gives more detailed information about the listed files.

There are lots of different ways of creating your own custom commands in Linux. And how you do it depends on how far you want to take things!

Creating your own commands could be as simple as using the pipe or redirection operators to string together several calls to various 'simple' system commands/programs(using the output from one command as inputs to others, or to redirect output from a program into a file).
Take a look at this link:
http://www.tuxfiles.org/linuxhelp/iodirection.html

Or you could write a script to perform a specific task. This could be done by writing a shell-script or by using some other scripting language (perl, python, lua etc).
Here's a link to one of the many shell-scripting tutorials out there:
http://www.freeos.com/guides/lsst/

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

Looking at the code, I think the problem lies here in your WinMain function:

// Create the engine (using the setup structure), then run it.
	new Engine( &setup );
	g_engine->Run();

I could be wrong but I think you need to do this:

// Create the engine (using the setup structure), then run it.
	g_engine = new Engine( &setup );
	g_engine->Run();

But then, from looking at the other errors, I'm not sure if g_engine is actually visible to WinMain....

In fact, looking at the code you've posted, g_engine is declared as an external variable in Engine.h and then you have a local pointer called g_engine in Engine.cpp... So the problem is, where exactly is the external instance of g_engine (declared in Engine.h) being held?
I think this is the problem the linker is also having.
It sees no problem with the local variable declared in Engine.cpp, but it cannot find the extern that is declared in Engine.h.

If the local instance in Engine.cpp is supposed the external instance you are referring to in Engine.h. i.e. you are trying to make the local instance externally available to other modules then perhaps you need to rethink things a little.
You can't make a local variable in the .cpp file external by declaring an extern in the header. (unless I'm terribly mistaken!)

So first up, I'd say remove the extern from Engine.h.
It also seems odd that your Engine class should store a pointer to …

JasonHippy 739 Practically a Master Poster

One thing springs immediately to mind. It's a bit of an off-chance, but it may apply to your situation.

If your DVD drive is USB and is powered completely by the USB port; (i.e. there's no external PSU required to power the drive.) You may need to ensure that it's plugged directly into one of the main USB ports on your PC rather than plugging into one of those composite hubs that expands a single USB port to provide three or four ports.

The only reason I mention this is because I have an external hard-drive which is powered solely by the USB (and it supports USB 1 and 2). And OK, it's NOT a DVD drive, but this could still apply! Anyway, for some reason it was not identified by any OS when it was plugged into my PC. The power LED on the drive was coming on, which made me think that everything was OK, but it just wouldn't spin up properly and was never detected by Windows XP, Ubuntu or Fedora.

I later discovered the problem was because I was plugging the drive into a USB expansion port on my USB keyboard. Plugging directly into one of the main USB ports on my PC fixed the problem entirely.

For some reason it seems that the drive wasn't getting enough juice from the port on the keyboard. And I knew there was nothing wrong with the port on the keyboard because USB memory sticks, …

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

Have you tried this?
http://tinyurl.com/4ymph98

JasonHippy 739 Practically a Master Poster

It would help if you told us the name of the 'awesome online game'! {rolls eyes}

Have you taken a look at the winehq website to see what it says about the 'awesome online game'?
Winehq lists a lot of windows programs that work with Wine and reports each programs compatibility/stability and also gives information on how to get trickier windows programs to work. (see http://appdb.winehq.org)

It also lists programs that don't work.
If your 'awesome game' is that popular, it should be listed somewhere on winehq. If you're really lucky it might even be one of the apps that works really well on Wine!

JasonHippy 739 Practically a Master Poster

It sounds as though your USB stick has some Windows only software pre-loaded on it by the manufacturer. This software is most likely stopping Linux from being able to mount the drive correctly.

I had a Sandisk USB stick which had similar problems a couple of years ago. I simply used a Windows PC to remove the preloaded software and completely reformatted the USB drive. Ever since then I've been able to use the USB stick on any PC, regardless of the OS!

This thread may help you, from a user on ubuntuforums who is having issues with the same type of drive:
http://ubuntuforums.org/showthread.php?t=1128275

Follow the suggestions in that thread and you should be fine!

JasonHippy 739 Practically a Master Poster

I just do the start without debugging...is that not right?

The problem here is that the input and output file paths are obtained from command line parameters. And as you're running the program via the IDE no parameters are currently being passed to your program.

But you can set up the command line parameters for your program in the VS IDE by doing the following:
1. Open up the properties page for your main project
2. In 'configuration properties->Debugging' you can enter the filenames/parameters in the 'command arguments' field.
3. Hit OK on the properties page to accept the changes.

With the command line parameters set, you can then run the program using F5 or Ctrl+F5. The parameters you set in the project properties will now be passed to the program each time it is ran from the IDE.

The other way of testing the program would be to open up a command line and then cd into whichever directory your program is in and run it from the command line passing the filenames.
e.g.
myprogram.exe file1 file2

JasonHippy 739 Practically a Master Poster

No probs.
I try not to give away complete solutions where possible. But when I do give complete solutions I try to make sure that things are explained in enough detail for the OP (and others) to learn something from it. I also try to offer a few alternatives, so the OP can choose which approach to take.

Which IMO is better than a cryptic one line response, or simply spoon-feeding code with no explanation.

Anyway, glad to have helped!

JasonHippy 739 Practically a Master Poster

Your post is a little on the vague side. Is there any chance you can provide us with some more specific information about your problem?

For example:
Which Linux distribution are you using? (e.g. Fedora 14?, or Ubuntu 10.10?, or OpenSuse 11.4? etc..)
What is the make/model of your pen-drive? (if known)
What are the exact errors you're getting?

If you can answer these questions, I'm sure somebody here will be able to answer your question very quickly!

JasonHippy 739 Practically a Master Poster

The short answer here is you can't! At least not like this. When you call stop() at a particular frame in the timeline in a movieclip, it stops playback at that frame for all layers in that movieclip.

But if you put the frames for the animation in layer 2 into a separate movieclip and then drag the instance of the movieclip onto the stage in layer 2.

So layer 1 contains whatever you currently have and layer 2 now has a child movieclip containing your other animation; then where you've put a stop in layer 1 of the parent clip, the parent clip will stop playing. But the child movie-clip on layer 2 should continue playing as it has it's own separate timeline.

Not sure if I've explained this well enough, but it's kinda difficult to explain clearly!

Hopefully the attached image should help to explain things a bit better....
I've used frame 6 as a stopping point, just to space things out a bit in the image to give you an idea of what I mean.
In the child movie clip you create you might want to add explicit calls to play() and stop() at the start and end frames of the animation, to ensure that it plays and also to ensure it stops when finished. (unless you want it to repeat indefinitely, in which case you can omit the call to stop() at the end!)

I hope that vaguely made …

JasonHippy 739 Practically a Master Poster

A 1 - AFAIK the Spiders used by search engines rely heavily on text content when indexing sites. So I don't think it's the case that they aren't crawled at all. It's more likely that googles spiders/crawlers are unable to see much of the text/infomation contained in flash sites as much of it is embedded in .swf files rather than in the HTML files (which is where the spiders concentrate on finding/indexing information). So Flash content always seems to trip them up. However there are ways to improve SEO for flash websites.

There is a good article about SEO and flash websites here:
http://www.hochmanconsultants.com/articles/seo-friendly-flash.shtml

A 2 - AFAIK, CSS is fine. When used properly CSS can actually aid Search engines / SEO. There are a few CSS techniques that can affect your ranking in a negative manner, but generally speaking using CSS is a good thing!
Take a look at this article:
http://www.stonetemple.com/articles/css-and-seo.shtml

JasonHippy 739 Practically a Master Poster

Actually, to correct pseudorandom21: LPCSTR stands for Long Pointer to a Constant STRing.
So LPCSTR indicates that the pointer is a const char* NOT a char* Incidentally, using the Microsoft naming conventions a char * pointer would be LPSTR !

As pseudorandom21 has correctly pointed out, you may need to use LPCWSTR if you're using unicode in your project.

Another thing to bear in mind is that the C in LPCSTR and LPCWSTR stands for constant. i.e. These are pointers to constant strings. So if you're getting error messages saying things like 'cannot convert const char* to char*' or 'cannot convert char* to const char*' then you may need to take a look at how you're using and/or storing the strings in question!

However as you haven't posted the exact errors you're getting regarding the LPCSTR's this is all conjecture! If you'd post some snippets of relevant code and some of the errors you're getting, somebody may be able to offer further help on this!

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

Ah thanks template<>.
I've never had to mix 'pure C' objects with C++ before, so I've never seen that before. I thought there must be another way around it though!
Great post!

JasonHippy 739 Practically a Master Poster

From what I've seen of his original code:

void DivisionSale::calculateTotalSale(DivisionSale arr[], int size)

He's passing an array of DivisionSale objects into his function, so it looks like more of a general helper function to use with the class rather than a member function which acts on a specific instance of the class.
So if he really wants this to be in his class, he should declare it to be a public static function. Then in the implementation he can do something like this:

double DivisionSale::calculateTotalSales(DivisionSale arr[], int size)
{
    double sum=0.0;
    for(int i=0; i<size; ++i)
        sum+=arr[i].getDivisionSale();

    return sum;
}

So he's effectively looping through the passed-in array, calling each divisions getDivisionSale function (which calculates and returns the current divisions yearly sales) and add it to the sum which is then returned.

So using the static function in main he'd do this:

double grand_total = DivisionSales::calculateTotalSales(div, NUM_DIVS);

Where div is the array of objects he has set up and NUM_DIVS is the number of divisions in the array!

Again, I would keep this kind of thing outside of the class myself, but it's certainly valid!

JasonHippy 739 Practically a Master Poster

I think it's because the calling conventions and object formats in C and C++ are slightly different. So the object file created by gcc is not compatible with the object file created by g++. Possibly something to do with the function name mangling or some-such. I don't have a massive amount of knowledge in this area, but it's certainly some kind of compatibility thing!

So because of the incompatible object formats, when you try to link the two objects to make your executable; I think g++ is unable to resolve the call to para_prep and is showing an error message.

So I guess you have two options here:
1. If mainlib really has to be compiled using gcc, then I suppose you could make mainlib a shared object (.so) and compile/link it with gcc and then use the shared object in your program (just like a .dll in windows programs). In which case you'll need to read up on creating .so's in C and how to use C-based .so's in a C++ program.

OR more simply:

2. You could use g++ to compile and link all three files!
Just because mainlib is written in C doesn't mean you can't use g++ to compile it. After all, any valid C program can also be considered to be a valid C++ program, so g++ should be able to handle it!

So perhaps try this:
g++ -c main.cpp
g++ -c mainlib.c
g++ -o …

JasonHippy 739 Practically a Master Poster

No, because the base object does not have any of the properties of the derived object.

Shape is your base class. You set up a pointer to point to a new instance of your Shape class. And although you cast your Shape pointer to a Circle pointer using an unsafe C-style cast, the Shape class does not contain any of the properties of a Circle, or any other derived class for that matter!
A base class object simply cannot be cast to a derived class object.

You can cast a derived object pointer to a base object pointer and back again. You can set a base object pointer to point to a new derived object and then cast the base class pointer to the appropriate type.

But you cannot set a base object pointer to point to a new base class instance and then cast it to a derived object pointer! It simply doesn't work that way!

Any instances of any of your Shape derived classes (Circle, Square etc) can safely be considered as valid Shape objects and as such can be cast safely.
But an instance of a Shape object cannot be cast to any derived type.

I'm sure somebody like Narue could put this far more succinctly than my somewhat chaotic fumbling attempt, but that's about the short of it!

If you want to do the more dangerous C-style casting, then CSurfer has it pretty much covered in his post. …

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

>>Also, in order to calculate the total sales for a single division, can't you do that in the constructor for the DivisionSale class?
I'm not too sure I agree with this suggestion. From a purely logical standpoint, that makes sense. From a class design standpoint it really doesn't though.

That value would be another variable that you need to store which you would have to update every time you modify the contents of the class. Additional variables make for additional complexity and add to the space requirements/size of the class/program.

It's a quick enough operation that it makes more sense to quickly calculate it when you need it. That way, you know that the value is current and hasn't been made obsolete in the mean time.

This is very true, but from the code the OP posted, the class already had the totalSales member variable in the class (albeit unused). And the sales values are only set once and there are no get/set functions to get or alter the intitial sales figures, so it would make sense to do it at construction time and simply return the stored value from getDivisionSale, rather than having to alter the getDivisionSale function to loop through the sales figures and create a total.

However, if the OPs requirements do change and they do require this, then it's not going to be a biggie to make the change!

@ OP's last post....
Yes that's pretty much what I was getting at.

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

For starters you have a problem in your DivisionSale class.
The size of the sales array needs to be 4 not 3. There are 4 quarters in a year, so you need to allocate space for 4 double values in your sales array:

class DivisionSale{
      private:
              double sales [3]; // <**** This should be 4 NOT 3!
...

As it stands: sales[3] will allocate space for 3 doubles that can be accessed by the indices 0,1 and 2. This is probably the main problem you're having! You're allocating space for 3 doubles in your array, but actually trying to use 4, which will overflow the array! A very definite definite no-no. So change that to 3 to a 4!

Also, in order to calculate the total sales for a single division, can't you do that in the constructor for the DivisionSale class?
e.g.

DivisionSale::DivisionSale(double qtr1, double qtr2, double qtr3, double qtr4)
{
	sales[0] = qtr1;
	sales[1] = qtr2;
	sales[2] = qtr3;
	sales[3] = qtr4;
	totalSales = qtr1 + qtr2 + qtr3 + qtr4; // total yearly sales for this division
}

That way each instance of the class stores each quarters sales and calculates it's own total yearly sales when the class is constructed!

To get the total yearly sales for each individual division you can then use your DivisionSale::getDivisionSale() function.

So if you need to calculate the sum of the total yearly sales for of all of the divisions, you just need …

JasonHippy 739 Practically a Master Poster

Part of the problem here is you are using an unsafe C-style cast. Also because you have a virtual function in your base class you're dealing with polymorphism.
When attempting to cast polymorphic types, you need to enable RTTI (Run Time Type Information) in your project and use the dynamic_cast operator to cast pointers between polymorphic types in a safe manner.

How you enable RTTI will vary depending on the compiler/IDE you're using.
Typically in VS you go to your project properties and in the 'C/C++ -> language settings' tab you set the 'Enable Run-Time Type Info' item to Yes.
Or you can go to the 'C/C++ -> Command line' tab and add the /GR switch to the additional options. If you're using another Compiler/IDE, you may have to consult your manual!

The dynamic_cast operator attempts to cast one type to another, but if the cast fails, it returns a null pointer. Which is far safer than using the C-style cast which will cast the pointer/object regardless of whether it is valid or not!

Also, with your classes you need to take note that an instance of a Circle can be considered to be a valid instance of a Shape, so casting from a Circle pointer to a Shape pointer should work, but the converse is not necessarily true. A Shape pointer doesn't necessarily point to a Circle, it could be pointing to a Square, or any other Shape derived class. It could even …

jonsca commented: Nice post. +14
JasonHippy 739 Practically a Master Poster

The local Lido, which was a huge outdoor public swimming pool. An olympic size pool with diving bay and 3 or 4 smaller pools. I spent many a summer there in my youth. It ended up being demolished in 1991 to make way for a supermarket.. Not nearly as much fun! :(