JasonHippy 739 Practically a Master Poster

Edit: Sorry, looks like my phone accidentally posted this midway through composing my response. Didn't notice until I'd posted the one below... I hate this phone sometimes. It has a mind of it's own!

JasonHippy 739 Practically a Master Poster

For future reference, please post your code here on the forum rather than on a 3rd party site. And please don't forget to use code tags!

For everybody elses benefit, here's the OP's code:

#include <iostream>
#include <string>
#include <time.h>

using namespace std;
const int MAX_SIZE = 100;
string words[MAX_SIZE];
int counter = 0;

void print_permutations(string s)
{
	bool exists = true;
	int i=0;
	int j=0;
	srand(time(NULL));
  
	for(int k = 0; k < s.length()/2; ++k)
	{
		i = rand()%s.length();//-1;
		j = rand()%s.length();//-1
		/*if (i < 0)
			i = 0;
		if (j < 0) 
			j = 0;
		if (i == j) 
			 i++;
		if (i > s.length()-1) 
			i = 0;*/
		if(i != j){
			s[i] = s[i] ^ s[j];
			s[j] = s[i] ^ s[j];
			s[i] = s[i] ^ s[j];
		}
	}

	if(exists == true)
	{
		for(int m = 0; m < MAX_SIZE; m++)
		{
			if(words[m] == s)
			{
				cout << "Permutation exists" << endl;
			}
			break;
		}
	}else
		{
			words[counter] = s;
			cout << "permutation: " << s << endl;;
		}
}


int main()
{
	string word;
	do{
		cout << "\nPlease enter a word" << endl << "Original Word: ";
		cin >> word;
		print_permutations(word);
		counter++;
	}while(word != "1");
}

Now from what I can see, despite the fact it probably compiles (although, if memory serves you might need to include cstlib for srand and rand) your code is full of logical problems and doesn't look like it will find all permutations of any given string.

I won't go into all …

JasonHippy 739 Practically a Master Poster

A variable preceded by an asterisk * is a pointer. The asterisk is called the indirection operator and is used to dereference pointers.

As it's name suggests a pointer is a variable which points to a variable of a specific type. So all a pointer holds is the memory address of the variable in question.

So in your code *bd is a pointer to a complex variable, so it points to/stores the memory address of a complex variable.

If there is more than one asterisk, it means that there are further levels of indirection.
So **d is a pointer to a pointer to a complex value (in other words it points to another pointer, which points to a complex value).
And ***TS is a pointer to a pointer to pointer to a double value.
So it points to a pointer, which points to another pointer, which points to a double value.

I'm not sure I've explained particularly clearly, but here's a simple, contrived example to show you what I mean:

#include <iostream>
int main()
{
    int i=25;
    int *pI = &i; // points to i
    int **ppI = &pI; // points to pI
    int ***pppI = &ppI; // points to ppI

    // Now lets see what each pointer holds at each level of indirection:
    std::cout << "Address of pI: " << pI;
    std::cout << "\n1st level: " << *pI;

    std::cout << "\n\nAddress of ppI: " << ppI; 
    std::cout << "\n1st level: " …
JasonHippy 739 Practically a Master Poster

Personally I use sudo on the command line for most administrative tasks on my Debian/Ubuntu based installs. Except if I have a lot to do, in which case I'll switch to root using sudo su .

You can open a root terminal using the command gksudo gnome-terminal In older versions of Ubuntu (10.10 and earlier) there used to be a launcher for the root terminal which you could add/enable in the system menu using the old gnome menu editor (alacarte). But since the shift from Gnome 2 to Unity from 11.04 onwards, I don't know if there is a launcher directly available (I'm not a fan of Unity, I use Xfce or Openbox as my default WM now!).

If the default key combination 'Alt F2' still brings up the 'run' dialog, you could use that to enter the command: gksudo gnome-terminal This should prompt you for your password. Then, if you entered your password correctly a root terminal session will be opened.

Otherwise, if the 'Alt F2' shortcut doesn't work any more (I've not used Unity very much, so I'm not that familiar with it. Did I mention I don't like it? Heh heh! ), you could try opening that new fangled 'dash' thing in the top left and then type the command in there!

And that should be OK for occasional use, but if you want to use a root terminal often and you don't want to type the command every time; you could try …

JasonHippy 739 Practically a Master Poster

In my experience most companies just want somebody who can do the job. Personal appearance isn't always that big a factor. However, at the same time attitudes towards personal appearance can vary wildly from company to company, it can also vary depending on the nature of the position you are applying for (i.e. whether or not you will be meeting clients).

As a long-standing extreme-metal drummer, my appearance is generally somewhat alternative/hobo-like. Heh heh.
Combat trousers/jeans, T-shirts featuring bands nobody has heard of, boots, long goatee beard, long hair and some facial piercings (no hair or piercings atm though. I look more like a deranged, big-bearded Uncle Fester nowadays!)

Despite my alternative preferences, whenever I go to job interviews I make a point of wearing an all black shirt/tie/trousers/boots combo. But I still look more than a little unconventional. Over the years I've had two interviews where I've been told that my appearance was a factor in not getting the position. But in most cases where I've failed at interview it was usually because there were better qualified and/or more experienced candidates.

On the flip side of that, every programming job I've succesfully interviewed for and accepted has been attributed to my ability to write code, my natural enthusiasm for what I do and to my generally amiable, yet self-deprecating personality. In these cases, my physical appearance has never come into the equation.

My last job had a fairly strict dress code (shirt, trousers, shoes, …

DJSAN10 commented: :) :) +0
JasonHippy 739 Practically a Master Poster

As far as I'm aware libxerces is the same as pretty much any other library in Debian based systems. It should be available in the repositories (the exact version will depend on which version of Ubuntu you're running).

You can use apt-get to install the packages for the library and the dev files.
Then to use them in your C/C++ programs you simply #include the appropriate headers and link with the library when compiling/linking.

So perhaps try:

sudo apt-get update
apt-cache search libxerces

This will update the list of available packages and will display any xerces packages available.
Then to install the relevant packages use:

sudo apt-get install libxercesXXX libxercesXXX-dev

Where XXX is any version information you saw listed in the apt-cache search command you ran previously.

Once you have the files installed, you're ready to use xerces in your program.
Note: To link your program with libxerces you need to use the switch -lxerces-c in your build scripts or in the gcc/g++ command line.

JasonHippy 739 Practically a Master Poster

During the setup? Which setup?

Use the steps I've outlined in my previous post regarding using the 'Disk image' option in unetbootin.
Once you've followed those steps and pressed OK, unetbootin should take care of everything else and should install the live-CD/DVD image onto your USB drive.
I don't recall any additional steps to this procedure (but I do admit I could be wrong!)

Once that's done, you should just need to reboot your PC with the USB drive plugged in to boot into OpenSuse.

NOTE: On reboot you might want to check the boot settings in your BIOS and make any changes to ensure that booting from USB is given higher priority than booting from the HD. Then save your changes and exit BIOS.

Or do you mean that you want help with the OpenSuse installer?
i.e. You've successfully used unetbootin to install Suse on the USB drive, you've booted into the live Suse desktop and you've selected the option to install OpenSuse on your PC, but you're having trouble understanding how to use the installer to set up a dual boot. Is that the problem?

Otherwise you need to clarify things further!

JasonHippy 739 Practically a Master Poster

As you have Windows 7 installed on your PC, I recommend using the Windows version of unetbootin. So to get OpenSuse onto your USB drive you'll need to do the following:

  1. Boot into Windows and login to your desktop.
  2. Download and install the windows version of unetbootin
  3. Download the .iso for the latest version of OpenSuse
  4. Insert your USB drive and format it. You can do this quickly and easily in Windows by opening 'My Computer' and then right clicking on the entry for the USB drive and selecting 'Format...'. NOTE: Ensure it is formatted as FAT32
  5. Run unetbootin to install the OpenSuse .iso onto your USB drive.

NOTE: When you first run unetbootin the 'Distribution' radio button is selected; which allows you to select a version of a distribution, which it will then download. You do not want to use this option because it typically contains download links for outdated versions of the distros it supports. So you need to select the 'Disk Image' Radio button instead.

Here is a screenshot of unetbootin, taken from the unetbootin projects sourceforge page. The screenshot depicts using unetbootin to install Ubuntu 10.10 on a USB drive, using the 'Disk Image' option.

To install Suse onto a USB stick with unetbootin using the 'Disk Image' option:

  1. Select the 'Disk Image' radio button in unetbootin
  2. Select 'ISO' in the dropdown box next to the 'Disk Image' radio button
  3. Click the '...' button on the …
JasonHippy 739 Practically a Master Poster

Have you tried installing VLC?
VLC will play just about any multimedia file-type.

There is a VLC browser plugin available for Linux, but I can't remember if it is included in the installation of the main VLC player package or if it is a separate package. Best bet would be to take a look in your distros software repositories and see what VLC packages are available.

You could either do this graphically by opening up the GUI for your distros default package manager and set a search filter for vlc, or use the command line to search. So, for example if you were on a Debian based system you could use apt-cache search vlc on the command line to list all packages in the repositories related to vlc.

JasonHippy 739 Practically a Master Poster

I was only really looking for what was causing your linker error yesterday, so I only gave your code a cursory look. But after taking a closer look at your code, I can see a few other problems which I didn't spot yesterday.

1. In the printf statements in your percent() and large() functions, you're outputting the address of the variables result and insult, rather than their actual values. So remove the ampersands (&) before the variable names in your printf statements. That fixes part of the issue with incorrect values being displayed.

2. Your calcpercent function will not produce any useful results because you are using integer mathematics.
So for example, if you entered 5 and 10 as the two values, you would expect it to return 50%. But because you are using ints, your calculation zz=(xx/yy)*100 would actually yield 0.
Because in integer mathematics in C and C++, 5/10 = 0 and 0*100 = 0.
So, you may have to either change the function to take and return float or double values. Otherwise if you require integers to be used, you'll have to cast one or more of the values in the division operation to a floating point value and then cast the final result back to int. e.g.

return (int)(((float)xx/yy)*100);

What that does is, cast xx to a float, so the rest of the percentage calculation will yield a floating point value, which is then cast back to int and returned.

JasonHippy 739 Practically a Master Poster

Your implementations of calcpercent and calclargest do not have their parameter lists included.

You've declared them before main as taking (int, int) and (int, int, int) parameters respectively.
E.g.:

int calcpercent (int xx,int yy);
int calclargest (int pp, int rr, int qq);

Yet in your actual implementation of the functions, their parameter lists are empty.

int calcpercent () // oops, no parameters!
{
	int xx;int yy;int zz; // xx and yy should be in the parameter list, not here!
	zz=(xx/yy)*100;
	return zz;
}

int calclargest () // oops, no parameters!
{
	int pp,rr,qq,w; // pp, rr and qq should be in the parameter list above
	if (pp<rr && pp<qq)
		w=pp;
	else
		if (rr<pp && rr<qq)
			w=rr;
		else 
			w=qq;
		return w;
}

Because you've omitted the parameter lists from the implementations of calcpercent and calclargest; the compiler/linker will see the two versions with no parameters as separate, valid functions. But it will not be able to find definitions for the two you forward declared which take int parameters. Which WILL cause a linker error, which is exactly what you've reported.

If you move the function parameters into the parameter lists of the implementations of both functions (as indicated in the snippets I posted) your program should compile and link without error.

Also, if you're using an up to date compiler, you should be getting warnings about using scanf. scanf_s is a safer implementation of scanf and should be used if your compiler supports it. If …

JasonHippy 739 Practically a Master Poster

From what I can see, the variable 'i' shouldn't be in scope in your item_onmouseup function because it is declared as a local variable in the for loop in the main bit of AS code in your keyframe. So you should really be getting some kind of error about an undeclared variable in your event handler function, because 'i' should really only be visible/in scope inside the for loop!

However, if the variable is visible/in scope in your event listener (which it really shouldn't be); the reason it's always going to the else statement should be obvious. Take a look how you're using 'i' in your loop:

In the main bit of actionscript on the keyframe, 'i' is declared in your for loop and is used to index the Movieclip objects in your array, where you add the event listeners and set the button-mode for each.

So 'i' starts at 0 (first object in the array). Because 0 is less than the break condition (i < array.length, where array.length would be 4). The body of the loop is entered, the 1st Movieclip's button state is set and has event listeners added.
Then 'i' is incremented (therefore i==1) and the loop reiterates.

Because 'i'==1 the condition (i < 4) is true. So the body of the loop is entered, the button state is set, event listeners are added for the 2nd item in the array. 'i' is then set to 2 and the loop reiterates.

JasonHippy 739 Practically a Master Poster

Aha, now we're getting somewhere!
From your original posts, you sounded like a flash novice. I only suggested the XML idea as it would be far easier for a novice to get up and running. Php and flash is a little more advanced.

I've got to admit, I've never really used PHP much. And although I'm aware you can get PHP working with flash, I've not had the need (or the desire) to do so. But then I haven't done any serious web development since I changed jobs a few years ago and went back to C/C++!

Anyway, going back on topic....
Using google (search terms: "php and flash AS3"), I found this within seconds:
http://www.ultrashock.com/forum/viewthread/90294/

Your code looks very similar to the posters code in this thread. Take a look at the replies from the user called Nutrox. It looks like his code might solve your problem.

Also there is this tutorial I found on kirupa.com which may help you to understand how to get php working with flash:
http://www.kirupa.com/forum/showthread.php?306368-Newbie-tutorial-AS3-PHP-Notepad

Again, it may not be exactly what you're after. But try the tutorial on its own in order to understand how to get variables/data into flash from php files. Once you've got it working and you understand it, then you can apply appropriate fixes to the code for your blog.

Another thing to look at might be Alessandro Crugnola's Serializer class which allows you to …

JasonHippy 739 Practically a Master Poster

none of them r impressive

Even if none of the links brought up by the link in cwarn23's post are exactly what you're after, at least take a look at the tutorials and/or any source code for those websites that were kind enough to provide them. Try to understand how their flash blog works. Learn from any relevant sources you can find online and then build your flash blog to fit your needs.

any other hve any idea ??

For starters, try taking a look at some RSS reader tutorials. They may not be exactly what you're looking for; and they might not be particularly impressive either, but once you understand the way they work you can adapt one to suit your needs and use it as a basis for your blog.

If you already have a blog on Wordpress, Joomla or some other popular blogging service; A simple flash RSS reader connected to the RSS feed of your blog would be a simple and immediate solution to your problem. That way, you can put your .swf on your website and it can pull-in up-to-date content from your blogs RSS feed (text and images).

Getting a simple RSS reader up and running shouldn't be too hard, but you'll need to learn a bit of actionscript first, which is where the tutorials should come in handy. I'll leave it to you to google for some flash RSS reader tutorials though, there are plenty out there!

You'll also …

JasonHippy 739 Practically a Master Poster

Of all of the current distros, Slackware are the longest running distro (started 1993), closely followed by Debian (also 1993), then Suse(1994), then Red hat(1994). So if you were to go by age/maturity, then Slackware could be considered the one true Linux!
See http://imgon.net/di-1HGH.png

Also Debian and Red hat both serve as a basis for lots of derivative distros. So again, this could put either of them into contention for the 'one true Linux' too.

BTW: I looked into the LSB a bit further and it seems that Debian are on the LSB committee and are technically compliant. Their only minor failing is that their package manager cannot handle rpm's. But as mentioned, by using Alien, Debian users (and users of derivatives) can convert LSB compliant rpm's to .deb's which they can install, so it's really a non-issue.
Also the LSB packages are not installed by default in Debian, but are available in the repos. So if you want your Debian based system to be LSB compliant, you can install the relevant package/s yourself.

JasonHippy 739 Practically a Master Poster

Isn't it sufficient to remove CentOS partition and to resize Win 7 one with Win 7 Disk Management tool?

No, because CentOS (and other Linux distros) replace the windows MBR/bootloader with an alternative bootloader like Grub or Grub2. So simply removing the CentOS partition and resizing the Windows 7 partition isn't enough.

As rubberman has already stated, you first need to boot into windows and restore the Windows MBR before using a disk management/partitioning tool to remove the CentOS partition and resize the Windows 7 partition.

JasonHippy 739 Practically a Master Poster

If you mean the LSB, then no. As I mentioned previously, the LSB is a set of standards for Linux distros to adhere to (or at least try) in order to maintain compatibility between different distros. Basically it gives all Linux distros a common base.
Debian based systems it seems are only partly compliant because they use .deb packages rather than .rpm packages (The LSB comittee decided rpm should be the packaging system of choice for the LSB). But Debian users can use Alien to convert LSB compliant rpm's to .deb's to side-step this issue.

My point was, if all distros followed the LSB then your question about 'one true linux distro' would be completely null and void. Because they'd all have a common base and would therefore all be 'true' linux distros, regardless of their chosen window manager, desktop manager or even the package management system. That is at least, as long as their package management system supports installing LSB compliant rpm's in some form, even if it is via another tool like debian do with Alien!

JasonHippy 739 Practically a Master Poster

Ubuntu, Mint, Debian, Opensuse and Fedora tend to be quite popular choices of distro, but I don't think there is any such thing as 'one true distro'.
Peoples views are different about Gnu/Linux and it's many different flavours.
What one person prefers, another may detest!

The other thing to remember is that all Gnu/Linux distros are a combination of the Linux Kernel bundled together with the complete Gnu toolchain plus lots of free software and the odd bit of non-free proprietary software here and there (the inclusion of which tends to be highly controversial in some circles!)

So if anything, as Linux IS the Kernel itself, I guess you could say that the Linux Kernel is the one true, pure Linux!

Also, there are efforts being made to standardise Gnu/Linux, try googling 'linux standard base'.
The aim of the LSB project is to standardise the entire system structure based on 'POSIX', the 'single UNIX specification' and several other standards to ensure maximum compatibility (including backwards compatibility) between Linux distros.
So in a sense, as long as all distros follow the standards set by the LSB, there would be no need for 'one true' Linux distro, as they would all be standardised.

Those are my thoughts!

JasonHippy 739 Practically a Master Poster

No worries, glad to have helped!

JasonHippy 739 Practically a Master Poster

Hey Will.
Gerard, Caligula... and Greywolf are correct.

In order to understand why your code is not working, take another look at the definition of _matrix in your code.

_matrix is declared as std::vector<std::vector<float>> . So it's a std::vector, NOT an instance of your Matrix class.

So this code: _matrix.GetM(i,k) is failing because functions like GetM() , NumRows() and NumCols() which you're using in the operator* function are all member functions of your Matrix class, NOT member functions of _matrix, which is a std::vector.

Hope that clarifies things for you!

JasonHippy 739 Practically a Master Poster

Hey Andy.
You might want to try adding an event listener for the ENTER_FRAME event and set up a handler function to update the text box each time the event is detected.

The ENTER_FRAME event is an event which is dispatched by Flash's event dispatcher each time a new frame is drawn. So by adding an event listener and a handler, you can update the text box each time a new frame is drawn.

Here's a simple, yet complete example of what I mean (Note: This is done in AS3/Flex not the Flash IDE...I've not used the Flash IDE for years!):

package 
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.text.TextField;
	
	/**
	 * Example using Flex SDK.
	 * Creates two text fields.
	 * Uses an event listener and a handler function to update the text-boxes
	 * with the X and Y positions of the mouse cursor.
	 */
	[SWF(backgroundColor="0xffffff", width="800", height="600", frameRate="25")]
	public class UpdateText extends Sprite 
	{
		private var text1:TextField;
		private var text2:TextField;
		
		public function UpdateText()
		{
			// Add two text fields to the stage.
			text1 = new TextField;
			addChild(text1);
			text2 = new TextField;
			text2.y = 20; // place text2 directly underneath text1
			addChild(text2);
			
			// Set up an event listener to listen for the ENTER_FRAME event.
			this.addEventListener(Event.ENTER_FRAME, onEnterFrame);
		}
		
		// This is the function we specified in our event listener.
		// This will deal with updating the text boxes each time the listener
		// detects an ENTER_FRAME event 
		private function onEnterFrame(e:Event):void
		{
			text1.text = "Mouse X = " …
JasonHippy 739 Practically a Master Poster

It sounds like the program you're trying to build can target several different platforms or architectures.
When you are calling './configure', the configuration is failing because it doesn't know which platform you are targetting. So you may need to pass some parameters to the configure command.

Check for any README files or other documentation in the directory containing the source code. Instructions for building the program should be somewhere in the extracted archive. Otherwise check the official website for the project.

Incidentally, you neglected to mention which program you're trying to build.
Can you post the name of the program and a link to where you downloaded the source code? It might help in diagnosing your problem!

JasonHippy 739 Practically a Master Poster

If you have natty and you execute the code in red, it will upgrade to Oneiric alpha. It almost did with my Installation and It is hard to revert!

Oops, sorry! My bad, looks like I should have proof-read and sanity checked my post.
The offending line in red should have been:

sudo apt-get upgrade -f

NOT

sudo apt-get dist upgrade -f

Apologies for that!

So the full instructions for installing Gnome3 should have been:

sudo add-apt-repository ppa:gnome3-team/gnome3
sudo apt-get update
sudo apt-get upgrade -f
sudo apt-get install gnome-shell
JasonHippy 739 Practically a Master Poster

try:

tar -xfz /home/liveuser/Downloads/pckg.tar.bz2

or:

cd /home/liveuser/Downloads
tar -xfz pckg.tar.bz2

EDIT: If I'm not mistaken; because you are trying to extract a .bz2 archive, I think you need to use -xjf rather than -xzf. -xzf is for .tar.gz, -xjf is for .tar.bz2.

Alternatively, you could just use -xf and leave the tar program to work out the appropriate method of extraction.

JasonHippy 739 Practically a Master Poster

I lurk there sometimes. It's usually pretty quiet. Sometimes there are several people on there not talking to each other, heh heh. But occasionally somebody might break the silence and start a conversation!

JasonHippy 739 Practically a Master Poster

At the end of the day it is a completely subjective topic. The 'best' distro is the one that works best on your hardware and best fits your work-flow and your needs. If you are new to Linux, I recommend getting hold of some livecd's for different distros and see which one you like best.

IMHO with Linux, there is so much choice out there it's really hard to pick a single distro above all others!

JasonHippy 739 Practically a Master Poster

Try this:

sudo update-grub

Or this:

sudo grub-mkconfig -o /boot/grub/grub.cfg

That should reconfigure and update the grub2 bootloader menu.

JasonHippy 739 Practically a Master Poster

AFAIK, on Linux .bin files are usually self-extracting files.
Things like the linux versions of the Oracle/Sun Java runtime and Flashplayer are often distributed as .bin files, which self-extract and then run an installer/script to install the program.

In order to use .bin files, you usually just need to run them. But you'll almost certainly need to make the file executable by changing its permissions before you'll be able to run it.

IMPORTANT NOTE: You should only change the .bin files permissions and run it if you are happy that it is from a trusted source and it is genuine! (a fairly basic bit of common sense, but I feel it's worth mentioning)
As long as you are happy that the file is genuine, or you're willing to take a risk, then you can proceed...

To change the permissions, you can usually do this graphically via your desktop file-manager by navigating to the files location and right clicking on it. Then select 'properties' and locate and tick a checkbox in the properties dialog to make the file executable.
Otherwise, you can do it from the command line:

chmod +x /path/to/filename.bin

where '/path/to/' is the path to your file and 'filename.bin' is the name of your .bin file

The next step is simply to run it, either by double clicking on it in your file manager, or via the command line:

/path/to/filename.bin

If changing permissions and executing the file doesn't work with your .bin file, then …

JasonHippy 739 Practically a Master Poster

Assuming that the problem is a damaged or dirty DVD drive and you can't afford to replace the drive; you could try installing the .iso for the liveCD onto a USB thumb-drive if you have one. I think you need at least a 2Gb USB drive to do this. For instructions, see here

If you don't already have a copy of the Ubuntu 10.04 .iso, you'll need to download it. Also, as the target machine is problematic, you might want to use another PC to download and install the .iso to the USB drive following the instructions in the link above.

Once you've installed the .iso onto a USB stick, you simply need to restart the target machine with the USB drive plugged in. You might also want to check the boot priority in the BIOS to ensure that USB has higher priority than the HD at boot-time. You should now be able to boot into and install Ubuntu on the target machine using the USB drive.

NOTE: When installing from the USB drive; if you still get that same error message, it could also indicate that the HD on the target machine is failing, or that there is a problem with some of your RAM. You can use memcheck86 to test your RAM. memcheck should be on the USB install and should be an option at boot-time when booting from the USB drive.

Once you've installed Ubuntu to your HD, you can then …

JasonHippy 739 Practically a Master Poster

If Ubuntu is installed on the logical 'D:\' volume; when you are running Ubuntu, you ARE accessing the D drive and it IS mounted. It's just not called 'D:\'

The thing to bear in mind here is that the various Linux file-systems are completely different to the NTFS/FAT based file-systems used by Windows. Also different drives/volumes in Linux are not assigned letters like in Windows. So when you are logged into Ubuntu, the root of your 'D:\' partition will be the '/' directory, this is called the root directory. All of the subdirectories off of root '/bin/', '/home/', etc are also technically all on the 'D:\' too. As I said, it's just not called 'D:/'

Linux treats pretty much everything as a file. Any devices attached to a Linux system will have a file-entry somewhere in the '/dev/' folder. To mount the 'C:\' manually, you'd have to identify which file in '/dev/' relates to your drive/volume. Typically drives/volumes are usually given names like sda1, or sdb1 in /dev/.
After identifying which of the entries relates to your 'C:\' partition, you could manually mount it. But as Ubuntu auto-mounts any attached devices/filesystems that are present, your 'C:\' should be auto-mounted anyway when you log in and should appear as an icon on the desktop.

So from Ubuntu you should easily be able to access your windows partition and manipulate the files on it.

But AFAIK, Windows cannot mount, read or write to anything other than NTFS …

JasonHippy 739 Practically a Master Poster

I'd also recommend Gimp as a free alternative, but it's not the most intuitive editor out there. It does involve a bit of a learning curve, but it's worth taking the time to learn as it is extremely powerful once you know your way around it.

If you're running Windows, Paint.NET is another free image editor. IMHO, it's one of the best free image editors for Windows. I've used it for years on my Windows machines at work. Definitely recommended!

Paint.NET is powerful, high quality and is intuitive and easy to use, so it's great for editing images quickly and easily. It supports a wide range of file formats and there are a lot of built in image effects. Plus it's extensible via plugins, with lots of additonal plugins available on the paint.net forums.

The only potential downside is it requires the '.NET 3.5 sp1' runtime to be installed. But if you're running Vista or 7, that shouldn't be a problem as .NET should already be installed. However if you're running XP, you'll need to download and install the .NET runtime if you don't already have it! (Saying that, I think recent Paint.NET installers will automatically download and install the .NET runtime if it isn't already present!)

JasonHippy 739 Practically a Master Poster

If you liked Ubuntu 10.10 with Gnome 2 and you wanted to go back to it, you could use the 'classic' mode instead of unity in 11.04.
At the 11.04 login screen, you can change the WM/Session type to 'classic' and when you log in it gives you the familiar Gnome 2 interface that you are already used to.

Otherwise, Mint might be a good distro to try. It's based on Ubuntu and is aimed at people who are new to Linux. The latest version is based on Ubuntu 11.04, but the Mint developers have stuck with Gnome 2 as an interface, they're not using Unity at all!

Mint also comes pre-installed with multimedia codecs for proprietary formats (Mp3, Mp4 etc) plus the flash plugin for the browser. So Audio, video and flash works out of the box, with no need to install additional packages.
It also features a custom menu system too, which looks kinda similar to the windows start menu or the classic KDE start menu.

As I said, it's aimed at beginners and is easy to get started with. Being Ubuntu based, it has great hardware support, plus it includes a lot of extras in it's default install that many other distros do not include in theirs. Personally it's not my cup of tea, but it might be perfect for you!

JasonHippy 739 Practically a Master Poster

In your posted code, because you used the constructor argument, it will allocate space for 10 int objects in the vector and initialise them all to 0.
Then in your for loop, you're pushing back 10 more int values (remember push_back pushes additional objects into the end of the vector) ranging from 0 to 9.
So your vector will contain 20 ints (10 which are initialised to 0, plus 10 more containing the values 0..9)

Whereas if you use the reserve() function, the difference is that the vector will allocate space for 10 ints, but their values will not be initialised. In other words, it will have allocated space for 10 ints, but the vector initially holds no actual values, it is empty.
So because the vector is empty, if you use push_back to add some ints, the values will be added from the start of vector. So you'd end up with a vector which contains the values 0..9.

I hope I've explained that clearly enough!

JasonHippy 739 Practically a Master Poster

Declarations of for loops have three sections that are in a specific order:

for({initialiser}; {break_condition}; {increment/decrement})

But the increment and conditional sections in all of your for loops are in the wrong place. And because you're putting things in the wrong place, your loops are not doing what you're expecting them to!

In all of your for loops you are doing this:

for(int i=1; i++; i<=n) // for(init; increment; break_cond)

When you should be using:

for(int i=1; i<=n; i++) // for(init; break_cond; increment)
hqt commented: good :) +1
JasonHippy 739 Practically a Master Poster

You asked for a way of closing another window without using FindWindow and I posted a couple of links to code that would help you to achieve this. The first link shows you how to get the handles/PIDs of all running processes with a particular name. The second link shows some code which will shut down a named process.

So in relation to your program; when the button is clicked, you could get the process ID's of any running instances of "TestWin" and then close them down. All you'd need to do is take a look at the code in the links and then write something similar to meet your needs.

And regarding RegisterWindowMessage, you made no reference to this in your original post. I hadn't considered passing Windows messages, but now that you mention it; it sounds like a more elegant solution than attempting to find and close named processes as I suggested!

However, I've not done anything with the Windows API or MFC for a long time now, and I've never had the need to mess around with custom windows messages either. So I'm not sure I can be of much help.

Taking a quick look at MSDN it looks like you need to do something like this:
1. Create a new/custom Windows message using RegisterWindowsMessage
2. When the button is clicked in your main application, it sends the relevant windows message using SendMessage passing the HWND_BROADCAST handle to broadcast the message …

JasonHippy 739 Practically a Master Poster

If you want to create your own distro completely from scratch, go to http://www.kernel.org and download the source code for the core Linux Kernel.
You might want to take a look at http://www.linuxfromscratch.org/ too, which will guide you through the steps required to build your own distro.

It'll be a lot of work, but you can create your own custom distro from scratch like this.

Otherwise, all Linux distros should have their source code available somewhere in their repos. So you could derive your custom distro from an existing one.
Fedora, Debian and Ubuntu seem to be common distros that are used as a base for derivatives.

JasonHippy 739 Practically a Master Poster

The code for the USB driver will more likely be a Kernel module, so I think you'll need to take a look at the Linux kernel source code. The source for the kernel used in Ubuntu 10.10 should be in the repos.

If you want to create your own kernel modules, you might want to look at this, which deals with compiling new/custom kernels in Ubuntu 10.10
https://help.ubuntu.com/10.10/installation-guide/i386/kernel-baking.html#id2874520

JasonHippy 739 Practically a Master Poster

Wow, it's been absolutely ages since I used the Flash IDE. My memory of it is hazy to say the least. I use the Flex SDK nowadays and do everything exclusively in AS3 code. But if memory serves I think shape-tweening is only available to shape objects on the stage.
e.g. Geometric vector shapes created using the Flash IDE's drawing tools. I don't think they're available to other objects on the stage (buttons, movieclips, sprites etc.)

I could be wrong, but I think that's the case!

JasonHippy 739 Practically a Master Poster

Perhaps take a look at this:
http://www.codeproject.com/KB/threads/getprocessid.aspx

Discusses getting the PID's of any running instances of a particular program.

There is a post in the comments about closing process here:
http://www.codeproject.com/KB/threads/getprocessid.aspx?msg=1473071#xx1473071xx

Might be what you're looking for!

JasonHippy 739 Practically a Master Poster

Personally, I'd agree with whoever reviewed your code.

If you have any accessor functions in your class which allow other modules to get/set the values of these statics, you should promote them to be static class members and declare them in the header file for your class.

Otherwise if they are only used internally by your class, you should declare them in the classes unnamed namespace in your implementation (.cpp) file. This will localise them to the class/module in which they are declared.

Moving the static declarations out of the member functions where they're used and into the unnamed namespace will keep all of the internally used statics grouped together, so readers/maintainers of the .cpp file can see all of the statics which are used internally by the module.

Also, keeping these internal statics out of the class declaration in the header file aids in hiding complexity/implementation details. That is, hiding details that clients/users of the class do not need to know about. Not in the sense of hiding trade secrets or anything. This is more to do with only exposing things in the header file that clients/users of the class NEED to know about.

So things like static variables, constants or functions which are only used internally by the class are ideal candidates for putting into the unnamed namespace in the implementation/.cpp file. Clients/users of the class do not need to know about these in the header. The most important thing to clients/users is …

JasonHippy 739 Practically a Master Poster

Hey all.
Figured this might be a good place to post this.
After seeing some pics on Facebook of a recent Daniweb sponsored event; seeing all of that Daniweb swag made me wonder if Dani or one of her minions have considered setting up an online store to sell some of it? I couldn't see anything on the site about an existing store, but I'm pretty sure a lot of people from the community would part with some cash for some Daniweb branded items. (especially those in far flung corners of the world who can't make it to NY.).

As long as setting up and running the store isn't too expensive, it could provide another revenue stream while at the same time advertising the site... It was just a thought!

Is there already a store?
If not, would there be much demand for one?
What do you guys 'n gals think?

jingda commented: Nice idead +0
JasonHippy 739 Practically a Master Poster

If you use wxWidgets with Code::Blocks there's a RAD/GUI plugin called wxSmith which gives you the ability to drag and drop wxwidgets controls onto a design view and the plugin will auto-generate some boiler-plate code for you. Very similar to using visual studio with MFC and Windows Forms applications.

JasonHippy 739 Practically a Master Poster

I think only RGB is supported in Flash (or ARGB for formats like .png), so you might need to create a copy of your CMYK image and convert it to RGB or ARGB in Photoshop and perhaps tweak it a bit to match the original if there are any massive differences in colour, before importing the converted and tweaked image into your flash file!

Otherwise, if converting from CMYK doesn't work particularly well, perhaps forgo using CMYK altogether and stick to creating images for flash using RGB/ARGB?

JasonHippy 739 Practically a Master Poster

Looking at the code you've posted (which is C rather than C++), it seems to be using a simple sockets connection to determine whether the website is up or down. The headers included in the listing that you don't have, or don't recognise are all Linux/Unix specific headers.

I'm still familiarising myself with Linux programming so I may be wrong, but I don't think anything from "sys/types.h" and "arpa/inet.h" is being used in the listing. So these headers are not required and can probably be discounted/removed.

Regarding the other Linux specific headers:
1. "unistd.h" is used for the call to close(sock); at line 50. Not sure what to suggest there for Windows. (The winsock function closesocket()?)
2. "sys/socket.h" is required in order to be able to use sockets in Linux. For windows you'll almost certainly need to use "winsock2.h".
3. "netdb.h" is required for the definitions of the addrinfo struct and the getaddrinfo() and freeaddrinfo() functions. Again, these should be implemented or at least have equivalents somewhere in the Windows Sockets API.

From what I've seen, the code you've posted should be fairly easy to port to Windows. You just need to bone up on the Windows Sockets API. It's been ages since I did anything with sockets on Windows, but MSDN documentation can be found here:
http://msdn.microsoft.com/en-us/library/ms740673%28v=VS.85%29.aspx
http://msdn.microsoft.com/en-us/library/ms741416%28v=VS.85%29.aspx

And I assume you know what you're doing with regard to creating a .dll, so I'll leave that side of …

JasonHippy 739 Practically a Master Poster

There are plenty of book recommendations in this sticky, which is listed at the very top of the C++ section here on Daniweb!

JasonHippy 739 Practically a Master Poster
JasonHippy 739 Practically a Master Poster

As far as I understand it, everything is treated as a file in Unix and Linux. Even devices and running processes.

Typically, the file-system entries for all connected hardware/devices can be found in the /dev directory (and its sub-directories). If you open up a terminal and cd to /dev and then use ls -a -l , you can see which files refer to which devices.

There are two types of devices, block and char. Block devices tend to be things like RAM and hard-drives and char devices are pretty much anything else.

I don't know much more than that myself atm, so I can't really elaborate further, but I hope this helps!

rch1231 commented: Accurate and short. +8
JasonHippy 739 Practically a Master Poster

I only suggested 8Gb because a DVD can hold up to 4.7 Gb and I wasn't sure how big the Fedora 15 DVD iso image was!
But if it's under 4Gb, then it should fit on a 4Gb USB drive if you have one!

Otherwise as mentioned before, the live cd is less than 600Mb and will easily fit on a CD!

JasonHippy 739 Practically a Master Poster

Download the Fedora 15 Live CD .iso and burn that to disk instead.
The Live CD won't have all of the extra packages that are on the DVD, but it will allow you to install the base system. Once you've installed Fedora from the Live CD, you can use yum to download and install any additional programs/packages you need.

EDIT: Another thought:
Alternatively, you could try using something like UNetbootin to install the Fedora DVD image onto an 8Gb USB thumb-drive (if you have one. If you don't, then use the Live CD instead!), then alter the boot order in your BIOS settings to allow you to boot the PC via USB.
Then reboot with the USB drive plugged in and your PC should boot into the DVD image on the USB drive.

JasonHippy 739 Practically a Master Poster

1. Check your distros package manager and make sure you have the libx11-dev package installed (on debian based distros) OR libx11-devel (on Fedora/rpm based distros). This provides the basic headers that will allow you to create client programs using Xlib. The runtime binaries should already be installed. If you need the package, install it using one of your distros package management programs (aptitude, apt-get, yum....whatever!)

2. To include the headers in your programs use: #include <X11/Xlib.h> Finally and most importantly:
3. Use the '-l X11' option on the command-line to allow the linker to find the appropriate library and link your program.
e.g. gcc -o myprogram myprogram.c -l X11 That's all I can think of offhand. Hope that clears things up for you!