JasonHippy 739 Practically a Master Poster

OK, all of those messages are from when gcc attempts to build various python extensions/libraries. It would seem that it is unable to locate the files mentioned, so perhaps you don't have all of the source. Not sure what to suggest to fix that.
However, I will reiterate that you already have python 2.7 installed. You do not need to build python from source or install it manually. It is already on your machine and available to you and to any other programs that require it!

From looking at the instructions here:
The pre-requisites are Python 2.5 - So the version you already have pre-installed (2.7) should be fine because all of the 2.x series are backwards compatible with each other.

Then the other requirements, mxDateTime and Mako (optional) are available in the Ubuntu repositories:
Running the command apt-cache search --names-only mxdatetime lists two packages:

python-egenix-mxdatetime - date and time handling routines for Python
python-egenix-mxdatetime-doc - date and time handling routines for Python (documentation)

So to get mxDateTime installed you need to use:
sudo apt-get install python-egenix-mxdatetime python-egenix-mxdatetime-doc

And that's your other main dependency sorted!

A search for mako (which is optional) reveals these packages:

python-mako - fast and lightweight templating for the Python platform
python-mako-doc - documentation for the Mako Python library

So if you want those packages you can install them too!

The final optional dependency, psyco doesn't appear to be available. So you will need to download, build and install …

JasonHippy 739 Practically a Master Poster

By default, Ubuntu has Python pre-installed. And the last few versions of the *buntu family of distros use Python 2.7. So Python should already be available to you.

My current Kubuntu 12.04 LTS install reports Python version 2.7.3 installed.
And I don't imagine that there will be any critical differences between versions 2.7.3 and 2.7.5, so I wouldn't imagine that having 2.7.5 would be a pre-requisite. Any version of 2.7 would probably suffice.

So Python is pre-installed in Ubuntu. And if you need any additional python libraries/bindings, then you can search for them using apt-cache search xxx (where xxx is your search term)and install them using sudo apt-get install xxx (where xxx is the package name). With apt-cache search, if you pass the --names-only parameter/option, you will only see results with the search term in the package name (giving you a much shorter, more relevant list of results), otherwise you will see results which also have the search term in the package description.

In your original post, you mentioned that you wanted to install Python to complete the installation of another program. But which program are you trying to build/install? And can you post some more details on the errors that you are getting? That might shed more light on the problem.

From what I can see, nothing that you have posted indicates that Python (or a lack of) is the cause of the problem. The error you've posted is with regard to a missing file or folder which …

JasonHippy 739 Practically a Master Poster

To clarify Moschops and Ancient Dragons comments, let's take another look at your original code:

sample *e;
e = &e;

The line sample *e; declares a variable called 'e' which is a pointer to a sample object, so its type is sample*.
At this point the pointer is uninitialised and points to invalid memory (Which is kinda bad, pointers should really be initialised to null if you are not going to assign them to anything straight away!).
The variable 'e' is NOT an instance of the sample class, it is a pointer to an instance of the sample class. But again, at this point it does not point to anything valid.

Then in the next line:
e = &e; You are trying to assign the pointer to point to its own address.
The right hand side of the assignment operator (=) expects a pointer to (or the address of) a valid instance of the sample class to be passed (a sample*). But instead, it is getting the address of itself ('e').

Now remembering that the type of e is sample*, by passing &e to to the assignment operator, effectively you are passing a pointer to a pointer to a sample object (sample**).
So because what you are passing (sample**) is not what the compiler is expecting (sample*), you are getting a warning/error!

Now compare that to Ancient Dragons entirely correct code suggestion:

sample s; // an object of type sample
sample *e; // …
JasonHippy 739 Practically a Master Poster

The reason you are seeing strange values is because in your SetData function you are doing things backwards, you should be doing this:

a=x;
b=y;

NOT this:

x=a;
y=b;

To explain why you are seeing seemingly random values:
In your original code, you are passing the values x and y into your classes SetData function. At this point, the a and b members of the class are uninitialised; they haven't explicitly been given values, so they hold arbitrary/random values. Then your are assigning the passed in variables x and y whatever values are held in variables a and b (which are both uninitialised). So effectively you are just changing the passed in values and are not changing the values of a and b (which is what you want to be doing). Then when you call your print function, you are seeing the sum of the two arbitrary values.
I hope that clears things up for you!

JasonHippy 739 Practically a Master Poster

OK, sounds like it could be a DNS related issue.
This thread in the official kali forum might help you:
http://www.kalilinux.net/community/threads/installing-packages.61/

In it, the OP reports being unable to install any packages from the official repos via apt.
Turns out their DNS settings were causing the problem. Some way down the first page the OP posts the following as the solution to their problem:

Ok we have success,done a bit of googling and found some info on editing the etc/resolv.conf file. Changed the nameserver from my routers default address to googles 8.8.8.8,ran commands and hey presto we have lift off.. Thanks for everything...

So checking/changing your DNS settings might solve your problem!

JasonHippy 739 Practically a Master Poster

I don't know what compiler you're using, but from running your code through visual studio, your program initially seems to be doing what it should. The functions called in dummy_method seem to be working. For me, the fprintf call at the end of main displays check:_test answer with some additional gibberish characters on the following line.

At first I thought the reason for the gibberish characters might have been due to strings that were not null terminated. But from looking at your code a little more carefully, I'm pretty certain that the problem is in the way you are dealing with the input strings and creating your new nodes.

In dummy_method, you have declared two local variables ques and ans to act as buffers to store the users input. Then in your call to make_question_answer3 you are passing in pointers to both of these variables. In turn, inside make_question_answer3; in your calls to getnew you are passing the pointers again (in two separate calls). Finally in both calls to getnew, the new nodes char* member variables (guess) are assigned the passed in pointers.

So effectively, you are creating two new nodes and the guess member variables of both are set to point to the addresses of ques and ans respectively. Now the thing to bear in mind is that the ques and ans variables being pointed to by the guess variables of both nodes are local to dummy_method. So after your call to make_question_answer3 returns and we are back in …

JasonHippy 739 Practically a Master Poster

According to the Adobe website, the latest version of Adobe Reader available for Linux is 9.5.4.
If you go to http://get.adobe.com/uk/reader/otherversions/ and fill out the download form (select OS, language and version), the only downloads it lists for Linux are several versions of 9.5.4 in different package formats: .bin, .deb, .rpm, .tar.bz2.

So the version you installed via the Canonical partner repo (9.5.4) IS the latest version available for Linux.

If you are worried that Adobe Reader 9.5.4 is out of date or vulnerable to malicious exploits etc, you could always use one of the many other pdf viewers available for Linux instead: Okular, Evince, epdfview etc. And if you want to edit pdf's there are programs like pdfedit or libreoffice available that can do this too. All of the programs mentioned should be available in the repos of all Debian derived distros, so they should just be an apt-get install away. :)
Hope this is of some help to you!

JasonHippy 739 Practically a Master Poster

If you want to get the result of multiplying the entire contents of a TinyVector by a double and have the value returned as a double, (e.g. double result = myTinyVector * 5.034;) then this might work:
double operator *(const double &x);

Which you could define as:

template<typename T_numtype, int N_length>
double TinyVector<T_numtype, N_length>::operator*(const double &x)
{
    double temp=0.0;
    for (int i=0; i < N_length; ++i)
        temp+=data[i]*x;
    return temp;
}

Is that the kind of thing you're after?

JasonHippy 739 Practically a Master Poster

It looks OK to me! I've just tried compiling and running the code you posted in gcc on Linux, just to make sure I haven't missed anything. And it compiles and runs with no nasty surprises. It all seems to be doing what it should!

The scores are created, the search for a score works OK, the randomise also works and finally the vector gets sorted back into the correct order too.

One thing that you do need to bear in mind is that the example only has three scores in it, so it is highly possible that from time to time, the randomise function will randomly sort the vector into the order it was already in. You could try pushing a few more scores into the vector, that should make the results a bit more varied when the vector is randomised! Basically the more items are in the vector, the less likely it is (statistically speaking) that the randomisation will result in the the vector coming out unchanged!

Also if you want some ideas on randomisation, take a look at Narue's article on the subject.

JasonHippy 739 Practically a Master Poster

That's strange, so it's saying that you have gcc v4.6, but you aren't able to use it.
In fact file says that the gcc file you have is data and not an executable....hmm..
And according to your system information you don't have a default compiler installed.....

Have you installed the build-essential package yet? When you said gcc wasn't working I assumed that you at least had gcc installed, but now I'm thinking you don't have it at all....
I recommend installing build-essential with the command: sudo apt-get install build-essential
That would be my first suggestion. That package provides all of the packages you'll need to be able to compile from source(including gcc).

Hopefully that should solve your problem!

JasonHippy 739 Practically a Master Poster

Oops! You were supposed to run the 'file' and 'ldd' commands before doing anything to see what they said! Never mind, my bad! Looks I didn't explain myself clearly. I meant for you to run the two commands first and see what output they gave you. I suspected you were running 32 bit executables on a 64 bit machine. The output of both of those commands would have confirmed this if it was the case!

And if it did turn out to be the problem, that was when you should have installed the two packages. But that's a moot point now because you said that you are running a 32 bit system, so it looks like I was completely wrong. Sorry about that!

So those packages aren't going to help at all... you'll probably want to uninstall both of them using sudo apt-get remove ia32-libs gcc-multilib. Perhaps followed up with sudo apt-get autoremove to remove any unused/orphaned packages that the two removed packages depended on (if there are any!).

That should get you back to where you were before.
Once you've removed those two packages, try running the 'file' and 'ldd' commands on /usr/bin/gcc and see what it says. It might yield some clue as to what's going on!

I'm not sure what to suggest.....Perhaps purge gcc and reinstall it?
sudo apt-get purge gcc && sudo apt-get install gcc
Actually, hold off on doing that for now. I'll take a look at my Kubuntu install and investigate what …

JasonHippy 739 Practically a Master Poster

Open up a terminal and try the following commands:
file /usr/bin/gcc
and:
ldd /usr/bin/gcc
What output do they produce?

Also is your system 32 bit or 64 bit?

I have a feeling that you may be running a 32 bit version of gcc on a 64 bit machine, at least I think that's what usually causes this error!

If this is the case, then you probably need to install the gcc-multilib package:
sudo apt-get install gcc-multilib

If this doesn't fix the problem, you might also need the ia32-libs package, which allows you to run 32 bit apps on a 64 bit OS. Again, use sudo apt-get install ia32-libs

Hope this is of some help!

JasonHippy 739 Practically a Master Poster

$PIPESTATUS is an environment variable that holds the return values from any single, or chained commands in an array.... The page here should explain it far better than I can!:
http://www.linuxnix.com/2011/03/pipestatus-internal-variable.html

The && is a logical/boolean AND, similar to C, C++, Java etc.
As far as I understand it, the && inside the braces is part of the compound, boolean expression based on the commands contained in the braces. The && at the end of the line means that the next command (or line) in the bash script will only be executed if the commands to the left of the && (so basically if everything inside the braces) succeeds. So the next line or command in the shell script is the right hand part of the AND at the end of the code you've posted.

So it's kinda like:
If (make 2>&1 OR tee make.log AND exit $PIPESTATUS) AND NextLineOrCommand.....

So it's just a way of conditionally chaining several commands together.
At least I think that's the way it works!

JasonHippy 739 Practically a Master Poster

Take a look at my reply in the thread you posted in the Linux/unix forum:
http://www.daniweb.com/hardware-and-software/linux-and-unix/threads/434063/python3-linux-directory

There are instructions at the end of the post that should allow you to setup geany to use python3 instead of python2.

JasonHippy 739 Practically a Master Poster

This should work:

def texten():
    filehandle=open ( 'savetonight.txt', 'r' )
    text=filehandle.read()
    return text

def smabokstavertext():
    text = texten()
    print text.lower()

Basically, where you were calling texten, you need to create a variable to store the returned value.

So inside your texten function a local variable called 'text' is created, populated with the contents of the file and then returned.
Inside the smabokstavertext function, you now have another local variable called 'text' (this is not the same object, it is a separate object), which gets assigned the value returned by the call to the texten function.

ZZucker commented: helpful +7
JasonHippy 739 Practically a Master Poster

If you are using a version of Visual Studio, you could just pass the __FUNCTION__ macro into your logging function.
e.g.
_log.debug("message", __FUNCTION__);

The function macro will pass the name of the current function as a string.
see: http://msdn.microsoft.com/en-us/library/b0084kay%28v=vs.80%29.aspx

I think the __FUNCTION__ macro is also defined in gcc, so it should work for gcc, g++, mingw and cygwin too.

But if you're using another compiler, you might have to consult its documentation to see if there are any similar macros defined!

JasonHippy 739 Practically a Master Poster

In my experience the intellisense in VS has always been a bit flaky (assuming you're using VS) and shouldn't be relied upon too heavily! I've been using VS at work since version 6. I'm currently using 2008 and I don't think intellisense has ever worked properly. Very often, the intellisense database that VS uses gets corrupted and doesn't always update properly after making changes to problematic code. But you can usually clear up any problems with intellisense (albeit temporarily) by closing your solution, deleting it's corresponding intellisense database and then reopening the solution. Then the intellisense will rebuild the database and it'll be OK until it corrupts again. Which could be seconds, minutes, hours, days or even weeks later. But is guaranteed to happen at some point!

More importantly, what output does the compiler give when you attempt to compile your program? If you get the same errors when you compile your program, then you know for sure that there's a problem. I wouldn't worry too much about errors thrown up by intellisense. As I said, it's always been a bit flaky and problematic and shouldn't be relied upon too heavily! Granted, in this case, it could be correctly reporting a problem, or it could just be that the intellisense database has corrupted and isn't updating properly!

If I had a penny for every time the intellisense database went screwy over the years, I'd probably be as rich as Bill Gates... Well... OK, probably not! But I'd almost certainly have …

DaveTran commented: Great answer and has helped a C# junkie into the world of C++ +2
JasonHippy 739 Practically a Master Poster

OK, so you've forward declared the classes in the header files. And I could be wrong, but from what I've seen; you haven't included the header files for the forward declared classes in the corresponding .cpp files. Which is most likely why you're getting the error messages you've reported.

So for example, where you've forward declared the Game class in Entity.h, you should be including game.h in Entity.cpp.
Likewise, where you are forward declaring the Entity class in Game.h you will need to include Entity.h in Game.cpp.

Also you might want to consider using some inclusion guards in your headers to prevent things from being included multiple times. Otherwise you'll start getting errors about multiple definitions of the Entity and Game classes.

JasonHippy 739 Practically a Master Poster

The page you've gone into there has a bunch of bit-torrent files.
You can download the torrent files and then open them with a torrent program like Transmission, which will then allow you to download the dvd images from other users who have seeded the files on their PC's.

If you want the .iso files for the DVD's you can download them directly here:
http://cdimage.debian.org/debian-cd/6.0.5/amd64/iso-dvd/
Note: These are images for amd64 based systems. If you are after the DVD versions for i386, you need to go to:
http://cdimage.debian.org/debian-cd/6.0.5/i386/iso-dvd/

Basically all of the directories prefixed with bt- contain bit-torrent files. Directories prefixed by iso- contain .iso images of the installation disks.

BTW: The iso-cd directories contain the liveCD images if you don't want to download all of the DVD images for the full installer!

JasonHippy 739 Practically a Master Poster

And if you find that it runs OK, then you can look into dual booting/installing to your HD.

JasonHippy 739 Practically a Master Poster

Well, if you are unsure about whether it will work or not, you could just try a live cd. If you have a spare 8gb USB stick knocking about and you wanted to test more thoroughly you could even install a live cd image with persistent storage onto the USB drive using unetbootin (which is a free tool available for windows and linux). That way you could boot to the USB drive and try installing whatever additional software you'd usually use and see how your machine runs. And if there are any significant problems they should become apparent pretty quickly.

Try that for a few days and see how it is. You might find that everything works out of the box, or there could be problems with a driver, or it could just fail completely the first time you boot to USB. Either way, you'll have your answer. And by using a live cd, or live cd on USB you don't risk losing any data on your HD.

JasonHippy 739 Practically a Master Poster

Sounds like you're missing the glu package (libglu1-mesa-dev). A quick 'sudo apt-get libglu1-mesa-dev' should solve that problem for you! :)

JasonHippy 739 Practically a Master Poster

I could be wrong, but I think you just need to open up /etc/network/interfaces (or create it if it doesn't exist) and add the following lines:

auto eth0
iface eth0 inet dhcp
JasonHippy 739 Practically a Master Poster

Inclusion guards (or #include guards) will stop your header from being included multiple times:
e.g. globals.h

#ifndef GLOBALS_INCLUDED
#define GLOBALS_INCLUDED
// you'll need to #include the header/s
// required for SDL_Surface and SDL_Event here

const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;
const int SQUARE_HEIGHT = 22;
const int SQUARE_WIDTH = 10;
static SDL_Surface *image = NULL;
static SDL_Event event;

#endif // GLOBALS_INCLUDED

Then in main.cpp and any other modules that require the globals, you simply use #include "globals.h" and the variables in globals.h should be available/in scope in that module. Also I could be wrong, but you may need to make the non-const variables static (as shown in the snippet above.)

For more info on inclusion guards see this.

JasonHippy 739 Practically a Master Poster

Which will be your problem. You have two sets of definitions for those variables. Remove the declarations from main and include globals.h in main and any other files which need to use the globals. And don't forget to set up some inclusion guards in globals.h if you haven't already.
And you could also lose the extern keyword too. If both sets are defined as externs, that could also be a problem. Not used extern since my C days, but if memory serves you declared the variables in one module and then declared them as externs in another module which used/referenced them. If I'm not mistaken, declaring both sets as externs and giving both sets values will be a problem. Personally I'd avoid using extern and just stick them in a header which can be included in any modules that require them.

JasonHippy 739 Practically a Master Poster

In short, the private members of your base class should be declared as protected rather than private if you want derived objects to be able to access them directly.

JasonHippy 739 Practically a Master Poster

Well, take a look at what you're doing there:
bot.y = player.y - bot.y
So if the player is at y=0 and the bot is at y=4: The bot would be moved to y=-4.
So the bot jumps suddenly from a y-pos of 4, to a y-pos of -4.

Lets take another example: If the player is at y=300 and the bot is at y=200: The bot would move to y=100
So the bot is jumping suddenly from one position to another and isn't necessarily going towards the player.

Would it make sense to give the bot/bots a speed property? Then you could use a bit of basic geometry to calculate the distance and the angle to the player object, then rotate the speed by the sine/cosine of the angle to give you the distance to move on each axis. So perhaps something like:

// give the bots a speed they can move at (add it to your bot's class or something)
bot.speed = 5; 

// Calculate the distance and the angle between the bot and the player
var dx:Number = player.x - bot.x;
vay dy:Number = player.y - bot.y;
var angle:Number = Math.atan2(dy,dx);

// Optionally rotate the bot to point towards the player (may or may not apply to your game!)
bot.rotation = angle * 180 / Math.PI;

// move the bot
bot.x += Math.cos(angle) * bot.speed;
bot.y += Math.sin(angle) * bot.speed; 

NOTE: For the sake of convenience I've used 'bot' to represent the …

JasonHippy 739 Practically a Master Poster

ls and rm are a couple of command-line/system programs in Unix and Linux operating systems, they aren't regular expressions.
ls is used to list the files/directories in the current directory and rm is used to remove/delete files.
As stated, ls -l lists the files/folders in the current directory. The l parameter makes ls list more detailed information about the items in the current directory.
Similarly rm -rf will delete files/directories. The r parameter makes it delete files recursively (so it will go into any subdirectories and delete files there too), the f parameter suppresses any confirmation messages (e.g. "Are you sure you want to delete this file? (y/n)") and forcibly deletes any files.
So using rm -rf will delete everything in the current directory and everything in any sub-directories.

Opening a terminal session as root and using the rm -rf command at the root of the filesystem is one sure-fire way of deleting everything on your Unix/Linux system. Which may be why some of your class laughed when they saw it. It's OK to use rm -rf if you want to remove a lot of files/folders, but you need to be very careful when doing so! (Again, just don't use it at the root of the filesystem or in any system directories when you have root priveleges!)
Even as an ordinary user, using rm -rf in the wrong place could delete all files that you have the appropriate permissions for (so all of your personal files, …

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

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

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

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

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

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

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

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

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!

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

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

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

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

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 .!