JasonHippy 739 Practically a Master Poster

OK, it's been a while since I took a look at Unity, so my memory of it is a little hazy. But at a guess, you might want to check that the keyboard shortcut to lock the screen hasn't been changed or disabled somehow.

If you go to System settings->Keyboard->Shortcuts, then take a look for an entry for locking the screen. You might find that the shortcut has been disabled, or changed, or possibly removed.

If you get there and it says that ctrl+alt+L is still the combination and it's enabled, but it's still not working; try changing they keyboard shortcut to something else (like ctrl+shift+alt+L) to see if that works.

If that fails, then you've probably found a bug in Unity. In which case, you might want to report the problem to the Ubuntu devs.

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

@Deceptikon: I know about couts precision, but the OP was saying that they weren't allowed to use setprecision and the line they specified was the line to modify. Those two suggestions were the only things I could think of that could make a difference to that line of code. Changing the literals to floats would increase the risk that the values would be truncated, so changing c to a double would be the best bet. But as you say it doesn't get around the issue with couts default precision.

I've had a little play with this during some long builds at work and TBH, I can't see a way of getting the intended result without using setprecision!

But setting the precision isn't the only step required, you still need to declare c as a double.
To illustrate:
Compiling and running this under Visual Studio 2008:

#include <iostream>
#include <iomanip>

int main()
{
    float c = 4.0 - 1.99999990;
    std::cout << "c = " << std::fixed << std::setprecision(7) << c << std::endl;
    return 0;
}

outputs:
c = 2.0000000

I'm guessing this is due to the range of values that float can approximate, so there are almost certainly some rounding errors. So the expected value is not displayed.
But if you change c to a double, recompile and run:

#include <iostream>
#include <iomanip>

int main()
{
    double c = 4.0 - 1.99999990;
    std::cout << "c = " << std::fixed << std::setprecision(7) << c << …
JasonHippy 739 Practically a Master Poster

Walt, I am aware of which forum this is, but from the OP's post it's kinda ambiguous which language they are trying to write in. Are they trying to write in C or C++? They have an extremely bad mix of both in their code.

And it wouldn't be the first time that a noob incorrectly posted a C++ question in the C forum would it? How many times has C code been incorrectly posted in the C++ forum, or vice versa?

Because of the ambiguity, I simply tried to cover both bases. Does that really deserve being downvoted?

If the OP's code was intended to be C, they now know what to do to correct their code and can safely ignore the C++ related parts of my answer. If by some chance they have posted in the wrong place and were trying to write C++, they also know what they need to do.

Also my reply was a little brief because I was on my phone at the time. Thanks to the fiddly nature of my phone and the limited screen-space, my reply wasn't as comprehensive or detailed as I would have liked.

Seriously, what is your problem? Are you having a bad day or something? Lighten up! :)

JasonHippy 739 Practically a Master Poster

Incidentally, if you must use scanf (which you really shouldn't in c++) you can #include <cstdio>

JasonHippy 739 Practically a Master Poster

Actually, the problem is that iostream is a c++ header file. Also namespaces are a c++ thing.
If you are using GCC for C, then you need to #include <stdio.h> for scanf.

If you are trying to compile C++, you need to use g++ not GCC.
You might also want to consider using cin (which is provided by iostream) rather than scanf, which is an old C function which is superceded by C++'s i/o streams implementation.

nmaillet commented: Good +5
JasonHippy 739 Practically a Master Poster

Continue is a reserved keyword in C and C++, so give your char array a different name.

JasonHippy 739 Practically a Master Poster

As the code stands, the two literal values in the calculation are implicitly treated as doubles. Have you tried changing c to a double, or you can change the literals to floats by putting an f at the end of each e.g. 4.0f - 1.99999990f.
Those are about the only changes I can think of to that particular line of code that might make a difference. Changing c to a double would be my bet!

JasonHippy 739 Practically a Master Poster

I haven't used Mint in a long while, so I don't know the exact name for this package. But try running the following command and see what results it lists: apt-cache search libglib
The libglib package usually has the version number appended after it, so see what the above command lists for you and download/install the latest version using apt-get.

The intltool package should also be in the repos, so an apt-get install should solve that one too!

JasonHippy 739 Practically a Master Poster

With std::vector, you can do either!
If you know what the vector should contain when your class is instantiated, you can initialise the vector with whatever it needs to contain in your class constructor. Or if you know how many elements it will need to contain, you could initialise it to allocate a fixed amount of space (to avoid reallocations). But vectors are dynamic containers, they are not like ordinary C style arrays. So if you just want your class object to start out with an empty vector, then you can declare it as a member of your class and it will be given a default, empty initialisation and you can populate it on the fly.

Regarding your initialisation problems, if you post a snippet of your code; I'm sure somebody here can steer you in the right direction!

JasonHippy 739 Practically a Master Poster

OK, a couple of things:
Firstly you've posted in the wrong forum. This is C code, not C++! (Not the end of the world, but FYI!)
Secondly, well done for using the code tags feature (most noobs forget this), but please remember to correctly indent your code in future as it makes it a lot easier for other users to read and understand!

In relation to your actual problem, this line looks problematic:

/*to display as matrix format*/
for(i=0;j<r1;i++) 

If I'm not mistaken, the 'j' in the break condition of the for loop should be an 'i'.
So change it to:

/*to display as matrix format*/
for(i=0;i<r1;i++) 

And that should solve your problem! :)

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

@OP: The page you posted lists folders with all of the available versions of CentOS.
Assuming you want to use the latest version, open the link for '6.3'.
Then open the 'isos' link/folder. From here you'll have two choices, 'i386' or 'x86_64'. Depending on your systems architecture, open the appropriate link (i386 for 32 bit intel or x86_64 for 64 bit) and you'll see a bunch of ISO's and torrent files. There is also a readme file in there that will tell you what each of the ISO's are for.
It looks like there's a LiveCD, a LiveDVD, a two DVD full install package, a minimal installation ISO (which will give you a bare bones command line install) and a net install ISO (Which will download packages from the internet as the system is installed).

From this page you can either download the ISO directly, or download a torrent file and then download the ISO using transmission or some other bit-torrent software. So simply double click on the one you want or right click and use 'save link as' (or whatever your browsers equivalent is!)

So for a 32 bit install, you want to download one of the ISO's from:
http://www.gtlib.gatech.edu/pub/centos/6.3/isos/i386/

For a 64 bit install, go to:
http://www.gtlib.gatech.edu/pub/centos/6.3/isos/x86_64/

JasonHippy 739 Practically a Master Poster

At the end of the day, Linux desktop environments are a very subjective topic. You could ask ten different Linux users and get ten completely different answers. Everybody has their own preference, but there isn't necessarily a 'best' desktop environment per-se. It's more a case of finding the one that is best for you! So it ultimately depends on your preferences (how you want your OS to look and behave) and what works best on your hardware.

Gnome 3, KDE, Cinnamon and Unity tend to work more smoothly on newer hardware and these are probably the most modern, polished desktops available. For older hardware, there are more lightweight desktops like XFCE and LXDE. Then there are other, alternate Window managers that do not have a desktop per-se; like Openbox, Fluxbox etc. And then there are tiling window managers that allow you to control the entire desktop experience with the keyboard (so no need for the mouse) like RatPoison, DWM and XMonad.

Also, with Linux you can install as many different desktop environments/window managers as you like. So if you wanted to; after installing a Linux distro you could install several desktops and switch between them to see what they are like. Depending on the display manger/login manager your chosen distro uses, you can usually set which environment to use at the login screen (before logging in) by selecting the session type.

But seeing as you are new to Linux and may not be comfortable doing this; if you have enough …

JasonHippy 739 Practically a Master Poster

Wow, that is truly a mess!

Here are some of the problems I've spotted from an initial look (after pasting into a text editor and auto-indenting the code):
1. Your class and functions have all been declared and defined inside main.
I recommend that you take the class definition and the function definitions and move them outside of main.
So your program should be structured something like this:

// #includes
...

// class definition here
...

// function definitions here
...

// main function
int main()
{
// Create your array of Invoice objects
// call selection sort function and display sorted array
// call insertion sort function and display sorted array
// etc.....
}
  1. Inside your Invoice class, the char array q is unsized. You might want to consider giving it a size, or making it a char*, or a const char* (if use of std::string is out of the question). Also you shouldn't be using new here, if you are going to use new anywhere it should be in the constructor when that member is initialised. Also bear in mind, if you are going to use new in the constructor for your class, you should also have a destructor which deletes that member using delete[] if it is an array!

  2. As your class currently stands: Because you haven't marked any public:, private: or protected: sections in your class, everything is implicitly private. Meaning that your constructor is private. Therefore there is no way …

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

No problem. I'm glad my humble thread has proved to be useful!

JasonHippy 739 Practically a Master Poster

The link you mentioned seeing on the desktop is the installer for backtrack!

Double clicking on it will run the 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

That was the first thing I did when I realised the battery had ran out. I plugged the charger into it, restarted the laptop, then shut it down fully and left it to charge. Once it was fully charged, I started it back up and logged in and that was when it failed to connect to my wireless network.

As mentioned previously, I don't think it's a problem with the wifi card as wifi works on all of the other distro's I've ran on it. Incidentally, it's not dual/multi boot or anything. My laptop has no HD and the DVD drive is broken, so I run various distros on several USB drives (with persistent storage). Evidently something is borked big time on the Arch install! XD
I still suspect some dodgy/corrupt data or config settings either in the kernel or in some other hardware or network service that runs on startup.... The trouble is I'm having trouble finding where it has gone wrong. :s

JasonHippy 739 Practically a Master Poster

OK, I have a very strange problem which recently started on my laptop (running Arch Linux) and it's got me really stumped!

Basically my battery ran out whilst I was away from my laptop and it shut down... Which shouldn't really be a problem. But when I plugged my laptop in and restarted it a little later on, I could no longer connect wirelessly to my home network or see any other nearby wifi networks. It used to auto-connect to my home network using wicd. And up until this problem started, tools like wifi-menu, wicd-curses and wicd-gtk would show all of my neighbours wifi networks alongside my own too. But nowadays it sees nothing! :(

After trying to connect to my home wifi network manually using wpa_supplicant I kept getting errors like:
Could not set interface wlan0 flags: Operation not possible due to RF-kill
As far as I understand it, rfkill monitors the state of any hardware / software switches that control the wireless card. For some reason it sees the hard switch as always off (hard blocked:yes), regardless of whether it is in the on or off position. So for some reason, something thinks that the actual 'hard' switch, the physical switch for the wifi card on the front of my laptop is off, and never registers that it has been turned on. Consequently the wireless card is never getting powered up....Very odd!

Running the command rfkill list all yields the following output regardless of whether the wifi …

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 don't know about Seamonkey extensions, but there is a Firefox extension called ChmFox which can be used to view chm files (Not sure if that's compatible with Seamonkey though).

There are also several standalone programs which can be used to view chm files in Linux.
xchm is a chm viewer which should be in the repos of most, if not all distros. I tend to use this as my default chm viewer.
GnoCHM, ChmSee and KchmViewer are three other chm viewers which immediately spring to mind, but there are probably several others available too. Your best bet would be to use one of your distros package management tools to search for chm and it will list any viewers that are available.

JasonHippy 739 Practically a Master Poster

They aren't ASCII characters, they're Unicode. See this!
.

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

Vern, from what I can gather from the little portuguese I know, it's kinda like a substitution cypher where the letters T E N I S are substituted for P O L A R and vice versa. Incidentally, tenis is portuguese for shoes!

So the sentence "A polar bear wearing tennis shoes" would end up being encoded as something like "I tenis bois woisalg pollar rheor"

JasonHippy 739 Practically a Master Poster

Because of Unity I also recently stopped using Ubuntu. I have been using Crunchbang linux which is also based on debian but uses Openbox for the desktop. I am really enjoying the simplicity of Openbox, it just gets out of your way and lets you work.
The only reason I use a distro other than debian is for the added audio / video / non-free software support out of the box. If you get by without these things I wouldn't bother to switch your distro. After all none of the others mentioned would exist without Debian (except Arch).

Yes, I used Crunchbang for a while during my distro hopping phase. Completely forgot to mention it in my previous post. I've got to say, I really liked Crunchbang. And I run fairly old and/or low-spec hardware too, so the lightness of Crunchbang was a definite plus and being Debian based it's instantly familiar. And Openbox is extremely intuitive too. I'd definitely recommend Crunchbang to anybody wanting to get away from Ubuntu and Unity. I just fancied switching to a light distro with a rolling release schedule.... Hence choosing Arch! :)

Arch requires a lot more manual configuration and general Linux know-how than most other distros. But IMHO this is a good thing because after installing the base system, you can tailor your install to meet your own needs. For example; My arch install is pretty minimal. Very few services running on startup and no graphical login/display manager. So …

JasonHippy 739 Practically a Master Poster

The only reason I steel keep windows in dual-boot is gaming)) Windows is good for some issues, but I've made my choice...

I'm not a massive gamer, so I'm not too bothered about the lack of the latest, greatest games on Linux. But I can see why the more hardcore gamers out there prefer to keep their Windows partitions on their machines.

That said, the gaming situation on Linux seems to be improving. More and more independent games companies are releasing their titles on multiple platforms (including Linux). And after years of rumours and speculation, Valve recently confirmed that they ARE porting Steam and the Source engine to work natively on Linux. Which is something that Linux users have been requesting for years. So I imagine it should do rather well when it is finally launched.

And of course, if Valve do finally release Steam for Linux and it proves to be popular; it might cause more of the major players in the gaming industry to sit up and take Linux more seriously as a gaming platform. Note the emphasis there on might! Heh heh! Even if other games companies aren't attracted to Linux, a native Steam client would still be a major boon to Linux gaming!

JasonHippy 739 Practically a Master Poster

Ubuntu is based on Debian, so other than the UI (No Unity or Gnome 3 in Debian. Debian 6 uses Gnome 2.6) there aren't really many differences.

The main differences are:

  1. By default, Debian tends to use slightly older, better tested packages. Which pretty much assures a stable and relatively bug-free desktop experience. Whereas Ubuntu tends to use newer, more bleeding edge packages. And because of this Ubuntu is often quite buggy after a new release. But to be fair, any major bugs are usually fixed within a few weeks. Incidentally, in my experience it's worth holding off upgrading your Ubuntu installation until a month or so after any new release to give time for any initial bugs to be fixed by the time you upgrade. :)

  2. Because of Debians free software guidelines, Debian doesn't have any non-free software installed by default. So there is no built-in support for non-free multimedia audio/video codecs, no flashplayer plugin etc. Whereas Ubuntu gives you the option of installing non-free codecs in the installer. So with Debian, if you want to use non-free codecs/software you'd have to install them manually by adding some additional, external repositories to your sources.list.

Despite these minor differences, Debian is great! A really stable OS with a large (if slightly dated) selection of additional software.

Personally I like to use the latest, greatest, bleeding-edge versions of my favourite software. So I was a Ubuntu user from versions 7.10 to 10.10. But I'm not a fan of …

androtheos commented: I completely agree with your motives for moving from Ubuntu, I'm surpised they are sticking with Unity. +0
JasonHippy 739 Practically a Master Poster

Yes you certainly could do that.
I don't know exactly what you're doing in your program, but from your description; when you mentioned c=//desription I imagined you were doing something like this:

bool getContact(Contact &c){
    // do some things...
    if(condition)
    {
        Contact c2;
        c2.foo = foo;
        c2.bar = bar;
        c = c2;
        return true; // success
    }
    return false; // failed
}

If this is the case, it would be more efficient to manipulate the passed in struct directly.
e.g.:

bool getContact(Contact &c){
    // do some things...
    if(condition)
    {
        c.foo = foo;
        c.bar = bar;
        return true; // success
    }
    return false; // failed
}

But again, it depends on exactly what you're doing in your code.

JasonHippy 739 Practically a Master Poster

The 2nd version passes a reference to an instance of Contact into the function, so you'd assign values like this:

c.member_value1 = value1;
c.member_value2 = value2;

etc.

JasonHippy 739 Practically a Master Poster

If you wanted to use a pointer, you could do this:

Contact* getContact(){
    Contact* c = 0; // initialise Contact ptr to null

    // do some things
    if(condition)
    {
        c = new Contact;
        // assign values to the struct pointed to by the pointer 
    }

    return c; // Returns null if condition failed
}

Then in your main program (or other wherever the function is called) you'd be able to check the returned pointer. If the returned pointer is null, you know the call to the function failed.
Also, because the above snippet uses the 'new' keyword, in the cases where the function returns a pointer to a valid object, you need to ensure you call delete on the pointer as soon as the returned object is finished with. Otherwise you'll have a memory leak!

JasonHippy 739 Practically a Master Poster

You can't return null unless you are returning a pointer from a function. But if you don't want to use pointers there are a couple of options.
You could do something like this:

Contact getContact(){
    Contact c;
    // initialise c to some default state which indicates it's uninitialised
    // do some things
    if(condition)
        // assign c

    return c; // Returns default Contact if condition failed
}

That way when your function returns; if the returned contact is in it's default state you know the function failed.

Otherwise you could do something like this:

bool getContact(Contact &c){
    // do some things
    if(condition)
    {
        // assign values to c
        return true; // success
    }   
    return false; // failed
}

Then in your main program you can call it like this:

Contact c;
if(getContact(c))
{
    // getContact returned true, so c was initialised with some data
    // do whatever you need to do next
}
else // failed
{
    // Do whatever you need to do in event of failure
}
JasonHippy 739 Practically a Master Poster

Can you post the code in question? It may help to shed some more light on the problems you're having!

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

When you initially declare your array, this is ok:
GLfloat Light_Position[]= {0.0f, 1.0f, 3.5f, 1.0f};
That will create an array and initialise it with the specified values at declaration.

But later in your program where you do this:
light_Position[]={tVector3.x,tVector3.y,tVector3.z, 1.0f};
Depending on which version of the C++ standard you are using:
Because the array has already been declared/initialised and/or because you are using the square brackets, this line is erroneous.

To fix the problem:
If you're using the new C++0x standard, then simply removing the square brackets should work:
light_Position={tVector3.x,tVector3.y,tVector3.z, 1.0f};
The C++0x standard (or whatever it's called this week! Heh heh) allows you to use extended initialiser lists like this.

Otherwise, if you are using the old C++ standard, then you should assign new values to each item in the array separately. e.g.
light_Position[0]=tVector3.x;
light_Position[1]=tVector3.y;
And so on!

JasonHippy 739 Practically a Master Poster

From what I can see, any compiler should compile the code, but most should issue a warning about the pointer being uninitialised.

As far as I understand things:
With most compilers, when you declare a pointer and you don't initialise it to point to anything; it will point to an arbitrary memory address. So the pointer could be pointing to anywhere in memory. Then when you assign a value to an address pointed to by the pointer as you have, I'm not sure if that's undefined behaviour or what. (Never really looked that hard at the standard docs!). But in the cases where it actually 'works' (e.g. using g++ or Codeblocks with mingw etc); for example: When you assign the value of 3 to x->a in your code. You're most likely writing over the contents of the arbitrary memory address/addresses pointed to by the pointer. Which is probably more than a little dodgy.

If you initialised the pointer to null where you're declaring it in your code, the code would compile on C::B without warning, but you'd get a seg-fault at runtime (exactly as you're reporting with DevC++). So perhaps DevC++ is automatically setting uninitialised pointers to unll. IDK, but that's one possible explanation for the behaviour you're seeing.

Either way, regardless of the compiler you're using. When declaring pointers you should always either:
A. Assign them to point to null (or 0) if you aren't going to be using them right away.
Or:
B. Assign …

JasonHippy 739 Practically a Master Poster

Linux is my OS of choice for reasons already outlined by Mike, Rubberman and a few others. (So I won't repeat them!).

The only place I use Windows nowadays is at work. And I don't have any choice over that.
But I do use a lot of free and/or open-source software packages on my work PC. Mainly because I am already familiar with them and can be productive using them.

For a number of years, all of my home computers have been running various flavours of Gnu/Linux. My wife and kids have all been using it and they love it too! After a lot of problems with malware on their XP system, I even got my parents to switch to Linux rather than buying a new PC with a newer version of Windows. I can't count the amount of times I got phone calls about problems with that PC when it had XP on it. If I wasn't up there removing viruses, or fixing registry problems, I was reformatting and re-installing Windows and drivers etc. I really don't know what they were doing to that poor machine!

After trying Ubuntu 10.04, they decided they liked it and stuck with it. So they saved their money and got full use of their computer again, with the added bonus of no more malware infections. Since getting them started with Ubuntu and teaching my mum and my sister some basic sys-admin skills using the GUI (I didn't want to scare them off …

JasonHippy 739 Practically a Master Poster

Take a closer look at your code. The problem is occurring because you need to input the year before doing any of your calculations.
As your code stands, the value of EasterDay is being calculated before the user has even input the year.
So the uninitialised year variable is used in your calculations!

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

Sorry I didn't notice that. Yes, you need to make sure that the functions in your header always have the same signature as those in your .cpp file.
Currently there is a mismatch, your header says that the function returns a std::vector of std::strings, but the version in your .cpp file returns a std::string.
So you either need to change the function prototype in the header to return a std::string, or you alter the implementation in your .cpp file to return a vector of strings (which will mean updating the functions signature and updating the code to use a vector of strings)

In fact, looking at your code from an OO point of view, I'd recommend using a vector of strings for the 'name' member variable (rather than an array of strings) and make getNames return a vector of strings as stated in your header. You should also consider creating a constructor for your class which will populate the 'name' member variable of your class at instantiation, rather than doing it each time getNames is called. Then your getNames function can simply return a copy of the 'name' member variable.

JasonHippy 739 Practically a Master Poster

Because you're passing rect by value into the area function, a copy of the Rectangle object is created inside the function using the default copy constructor (which will be automatically created by the compiler as you haven't created a copy constructor).
The first call to the Rectangle destructor occurs when it drops out of scope after your area function returns, destroying the local copy of the Rectangle.
The second call to the Rectangle destructor occurs when 'rect' drops out of scope when your main() function ends.
To avoid a local copy of the passed-in Rectangle being made, you could set the area function up to take a const reference to a Rectangle object instead.

Hope this clears things up for you!

edit: Damn, beaten to the punch again! Very quick as ever Mike!

lastbencher commented: Thanks :) +0
JasonHippy 739 Practically a Master Poster

In your .cpp file you are redefining the Circle class, which was already defined in the header. This would certainly cause a linker error.

Remove the entire class statement from your cpp file (lines 7-24 in your 2nd snippet) and you should be good to go.

JasonHippy 739 Practically a Master Poster

With the ls command, the 'l' flag uses a longer listing format, 't' sorts by modification time and 'r' reverses the order of the sort.

To list folders recursively you'd need to use the 'R' flag!

Remember man pages are your friend.
To see all of the available options for the ls command use: man ls

JasonHippy 739 Practically a Master Poster

Mine's fairly self explanatory. My name is Jason and Hippy is a nickname my friends gave me many years ago. Partly due to the long hair and beard I've been sporting since my teens and partly due to the fact I was vegetarian back then!

I'm in my 30's now. The long hair is long gone and I'm not vegetarian anymore. But the nickname has stuck!