JasonHippy 739 Practically a Master Poster

Well, have you tried google?? heh heh! :P

And I'm not just being gratuitously facetious here, there is a serious point I'm trying to make.

For example:
After reading your post I really didn't know what CAN was, so I did a bit of googling of my own because I'm kinda curious like that.

According to wikipedia:

"Controller–area network (CAN or CAN-bus) is a vehicle bus standard designed to allow microcontrollers and devices to communicate with each other within a vehicle without a host computer."

(see http://en.wikipedia.org/wiki/Controller_area_network)

Hopefully this is the CAN you're referring to, it's the closest thing I could find!

Next I tried googling NCTYPE_UINT8. About half-way down the page I found a couple of .pdf manuals for the National Instruments CAN API which both appear to relate to the CAN bus standard mentioned above, so it looks like I'm on the right track!

The manual details all of the types used by the API and assuming this is the API you're using (I think the chances are pretty good!), it would seem that NCTYPE_UINT8 has been defined as unsigned char.
(see www.ni.com/pdf/manuals/370289c.pdf and www.ni.com/pdf/manuals/321369a.pdf to get the manuals)

So, given that information I guess you'd need to convert the string from your text box into a c-style string (char * or char array[]) and then perhaps convert (or typecast) and copy that into an unsigned char array.

And I think that's …

jonsca commented: All good points and well researched! +4
JasonHippy 739 Practically a Master Poster

Have you tried this?

su -c 'yum update xpdf'
JasonHippy 739 Practically a Master Poster

I'm still not 100% certain on what you're doing in this program. Evidently it's some take on the game Mastermind, but the code is poorly designed and rather haphazardly implemented, if I may be so bold!

One thing that immediately strikes me is your operator == overload in Mastermind.h.
You're attempting to compare a vector of strings with a string?...There's no way that'll work, that'll just get stuck in infinite recursion. Every time it hits 'if(a==b)' the == overload will get called again. (and again, and again, and again etc..)

If you really need to compare a string against a vector of strings, perhaps you need to do something like this:

inline bool operator ==(vector<string> a, string b)
{
	for(std::vector<string>::iterator it = a.begin(); it!=a.end(); it++)
		if( (*it)==b)
			return true;

	return false;
}

Which would iterate through the strings in a and return true if one of them matched b. Alternatively, you could modify it to return true if all of the strings match b, depending on what you want the overload to do!

But that's only one of the problems.
As you pointed out, there is also a crash at line 65, where it doesn't like the ==, but look at what you're comparing....
Try rewriting that section like this and see what errors you get:

//check for black
		for(int j=answer_->front(); j!=answer_->back(); j++)
		{
			int ans = answer_[j];
			int pop = population_[i][j];

			//if(answer_[j]==population_[i][j])
			if(ans==pop)
			{

Try that and you'll see why that …

JasonHippy 739 Practically a Master Poster

Most of this code looks just plain wrong, so it is unsurprising that you're getting errors! I think you need to read up a bit on the correct use of iterators.

For example, the statement starting:

if(answer_->at(individual) .....

is incorrect. You can't pass an iterator to at().
Besides, the iterator 'individual' already points to an instance of whatever variables are contained inside answer_. (That is, assuming you've correctly declared individual as an iterator...That portion of code hasn't been posted!)

Anyway, 'answer_->at(individual)' is completely wrong!

At the start of your for loop, the iterator points to the first item in the container (answer_->begin()) and it loops until the iterator reaches the end of the container.

There are several other fundamental problems with your code.

Initially it looks to me as if you have two containers that you are trying to traverse and you want to compare the contents of one against the other. But without knowing exactly what you're trying to do or what kind of variables are stored in your containers, it's kinda difficult to help you at this stage.

If you could post a little more code, or describe in more detail what you are storing in the std::library containers and what you are trying to achieve...That would allow us to understand what you're trying to do and will help us to help you.

From what I've seen so far, if my assumptions are correct; you need to perhaps try …

JasonHippy 739 Practically a Master Poster

I prefer VLC and it's in the repos. This isn't Windows so I don't suggest downloading unknown apps from the Internet. Mplayer is good but you have to install MS codecs. VLC will play just about anything.

I second that motion! VLC is my media player of choice on all platforms!

JasonHippy 739 Practically a Master Poster

I could be wrong, but I think it depends on the terms of the licence that your copy of windows falls under.

So if you have a full-price retail copy of XP, then under the terms of the licence I believe you're entitled to install it on several machines. (Not sure if there is an upper limit on the number of machines it can be installed on though!)

Whereas if you have a cheaper (but still legit) OEM copy, I believe it can only be installed on one machine for the life of that machine. So if you attempted to install an OEM version on several machines, it'll only let you register/activate it on one of them.

{edit}: Your best bet may be to take a look at the gumph that came with your XP disks and see what that says. Alternatively you could contact Microsoft's customer support and ask them to clarify the matter for you!

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

That's actually Avant Window Navigator. It's in the repos. Very nice dock.

@mooreted:
Ah, I'd never heard of that one before....Nice!

@OP:
I also noticed from the screenshots you linked to that the standard Gnome top and bottom bars are actually still on the screen, they've just been hidden. This can be done by right clicking on each bar individually (i.e. one at a time) and selecting properties. From here you can check the 'show hide buttons' tab which puts buttons at each end of the bar. Clicking one of the buttons will cause the bar to slide off to that side of the screen, leaving only one button visible. Clicking this will slide the bar back onto the screen!

JasonHippy 739 Practically a Master Poster

I don't know about direct communication between flash and python, but here is a link to a post I made a couple of months ago which contains a link to, and some info about a python script that populates an xml file which is used by a little flash app.
http://www.daniweb.com/forums/post1125626.html#post1125626

Basically the python script in the example in the link in my post monitors the open windows on your pc and logs the amount of time a particular application has the primary focus. The python script periodically writes out data to an XML file.
There is also a flash file which reads the XML file and produces a pie-chart highlighting each program window that has been opened since the python script was started and how much time each application has had the focus.

I know flash files can communicate directly with javascript using the fscommand external interface routines. But as mentioned, I'm unaware of any way of directly communicating between flash and python (it may be possible, but I've personally not seen anything yet!).

However, the XML route is certainly one way to go with Python!
If the python script regularly updates the XML file, you could always set up a timer to time when to reload the XML file and perform any processing required on the data from the XML.

Cheers for now,
Jas.

p.s. Just out of curiousity, are you planning on doing this as an Adobe …

JasonHippy 739 Practically a Master Poster

Typically in *nix, when you open up a console it opens in your home directory. Bearing this in mind, when you're using the chmod command, are you actually in the directory that you saved hello.py in? The error message appears to say that the file cannot be found, so it sounds to me like you're not in the correct directory!

If you are in the wrong directory, try using:

chmod a+x /path/toscript/hello.py

Obviously substituting '/path/toscript/hello.py' with the actual path to the file.
e.g.

chmod a+x /home/username/Documents/pyscripts/hello.py

Otherwise use cd to move into the appropriate directory before trying the chmod command.
e.g.
Open up a terminal and type:

cd /path/toscript 
chmod a+x hello.py

Again, substitute /path/toscript/ with the actual path to your python script.

The only other thing I can suggest is perhaps you need to explicitly qualify that the file is in the current directory by using './' at the start of the filename in the call to chmod:
e.g.

cd /path/toscript
chmod a+x ./hello.py

Also note: After doing the 'cd' and before doing the 'chmod' in the two examples above, you might also want to consider using the 'ls' command to make sure that your .py file is definitely there!
e.g.

ls -l hello.py

If the file is there, then it will be listed by the 'ls' command, but if it says that the file cannot be found, then you must've saved it …

JasonHippy 739 Practically a Master Poster

Take a look at these two articles which both provide details about the available programs/libraries for detecting memory leaks in *nix:
http://www.linuxjournal.com/article/6059
http://www.linuxjournal.com/article/6556

Other than Valgrind, it lists several tools/libraries.....

For programs compiled in C:
mtrace
memwatch
dmalloc

For C++ programs:
dmalloc
ccmalloc
NJAMD
YAMD
mpatrol
Insure++

Valgrind seems to work fine for me (EDIT: But then I'm not using it for embedded stuff!). As a consequence, I've not really used any of the others, so I can't make any solid recommendations.

I guess your best course of action would be to read the articles and try a few of the listed programs/libraries out and see what works best for you!

Cheers for now,
Jas.

Salem commented: Nice looking list - thanks +20
JasonHippy 739 Practically a Master Poster

Perfect Dark! That game was ace!
Goldeneye was another great fps on the N64.
I loved those two games.

But I think my favourite game of all time has to be Elite, which I remember playing on the old BBC's at primary school. I also had it on my Amstrad CPC.

But the ultimate version of the game for me was Frontier:Elite2 on the Amiga....Me and my nerd friends probably spent years of our youth on that game.... Love it!

I recently discovered Oolite, an cross-platform open-source clone of Elite. Pretty good, but I still think I prefer Frontier:Elite 2 on the Amiga.

Salem commented: Right on, commander! +0
JasonHippy 739 Practically a Master Poster

Have you tried this?? heh heh! ;)

If you had you would have found this little gem, which tells you everything you need to know! Doesn't get much simpler than that does it??

Cheers for now,
Jas.

Salem commented: Easy money :) +20
JasonHippy 739 Practically a Master Poster

Don't get me wrong, I am a big fan of open source, but I'm not one of those frothy mouthed *nix/open source zealots or anything. Heh heh!

The only reason I'm running solely on *nix ATM is because my old windows machines at home were quite old and ran very slowly with XP. Especially after service pack 3. The hardware didn't meet the minimum specs for Vista or 7 (nowhere near!), so upgrading the OS wasn't an option. And I can't afford to buy a new PC ATM either.

So when the hard-drives in the XP machines eventually started dying one by one, I decided there wasn't much point in replacing the hard drives and putting XP back on them. Especially with XP reaching the end of its shelf life! So I stuck various flavours of *nix on 'em and they boot and run noticeably faster than ever before.

At the end of the day; to me a computer is a tool, a means to an end. And the operating system is merely a component of that toolset.
I can do all of the things I did in Windows with *nix. A lot of the open source stuff I use in Windows is available in *nix and there are open source equivalents for everything else I used in Windows (except FlashDevelop!), so my workflow hasn't really changed much. So for now *nix is the best tool for the job!

But I do have a Windows …

JasonHippy 739 Practically a Master Poster

Thanks for the info about SharpDevelop. I'll have to try that out on my work PC (all of my personal PC's are running *nix at the moment..Long story!).

And as for Flashdevelop....I've been using that for the last few years...Or at least I had been, until my last windows machine did it's final BSOD.
FlashDevelop is an amazing IDE for flash development! If you use something like Inkscape (or any other vector GFX package) to create .svg GFX for your flash apps, you can completely forego the Flash IDE. It's nothing short of brilliant.

And if you add the Papervision AS3 3D library and Blender to that mix you're laughing! 3D fps in flash anybody?? heh heh!

Now I'm on *nix, I've had to leave Flashdevelop behind, so I'm using Inkscape and the Flex3 SDK command line tools for my flash dev stuff. I think Flashdevelop is the only thing that makes me miss Windows! But I've started working on my own *nix frontend for the flex SDK tools, so who knows...Maybe I can get that working before Phillipe and the rest of the Flashdevelop guys finally manage to port FD to *nix! heh heh!

Anyway, I'm starting to ramble and go off-topic now...Time to shut up methinks!

JasonHippy 739 Practically a Master Poster

P.S. There's also the /usr/share/app-install/desktop/ directory which also contains .desktop files for applications and the /usr/share/app-install/icons/ directory which contains icons for installed applications.

JasonHippy 739 Practically a Master Poster

OK hopefully this will clear up some of your questions:

The linux executable format
Most binary executable programs in Linux do not have an extension like in Windows (which use the .exe extension).
For example, the 3D program Blender, in windows the executable is called 'blender.exe'. In *nix it's just called 'blender' (no file extension)

The program launchers (I guess these are more or less equivalent to a program shortcut in windows) use the .desktop extension and are basically XML files.

File-system/paths
Regarding the Linux filesystem, the '/' at the start of a path indicates the root/top level of the file-system. It doesn't necessarily refer to any single drive per se.

So in a shell if I typed the following path:

cd /

it would take me to the root of the filesystem. Likewise:

cd /media/

Would take me to the media directory, which is off the root of the file-system. Incidentally, the media directory is where any removable USB storage devices will be listed.

Speaking of which, if we had an 8GB USB stick plugged into our PC with the volume label JAS8GB; to access it from the command line in windows you'd navigate to whatever drive letter it was assigned to:

cd J:\

(or K:\ or whatever!).

To access the device from *nix, as long as the device was mounted (which Ubuntu/Gnome seems to do automatically on insertion of USB drives), you'd need to navigate to:

/media/JAS8GB/

More on …

sneaker commented: good post :) +1
JasonHippy 739 Practically a Master Poster

I prefer gnome to KDE but I don't know what this is but I thought I might give it a try. If anyone knows what this is and where to get it, please let me know, thanks.


http://www.tomshardware.com/gallery/ubuntu-linux,0201--6247----jpg-.html

I think it's either Docky or CairoDock that's been used to replace the standard desktop bars in Gnome. I'm quite happy with the default Gnome look, so I've never tried using either of them myself. Consequently I don't really know much about them.

Your best bet is probably to do a bit of googling about Docky and/or Cairo Dock, then install one of them and have a play!

I don't think you can have both installed at the same time, I think it's a case of having one or the other. But I could be wrong!

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

I think most of the Gnome stuff is still on your PC. Synaptic is probably just downloading and installing a few packages that you got rid of (like the python 2.6 related packages) and re-installing the Gnome desktop.

As I mentioned in your other thread. Once the re-install is complete, you should be able to reboot your computer and then change your default session to Gnome from the login screen.
Fingers crossed that should have fixed it.

If not, then you'll need to back-up whatever personal stuff you've got on your PC and any other files for customisations you might have made before doing a full re-install.

JasonHippy 739 Practically a Master Poster

Well as far as I understand things, the bigger *nix based open-source companies like Red Hat (makers of Fedora) and Canonical (Ubuntu) make their money from paid technical support.

So for example, a company/business which uses Ubuntu on their systems/servers can pay Canonical a subscription each year, which entitles the company to professional technical support directly from Canonical.

Home users can also pay for support if they want to, but generally most home users will use the free public forums / IRC channels for support. But for companies and businesses, paid support is the best way to go as it ensures a timely and technically accurate response in their time of crisis.

I'm not sure how much their support packages cost, but I'd imagine it would be rather expensive and they must sell a lot of them!
So that's one way, selling technical support for your product.

Another way of making money from an open source project is to set up a paypal donation page so people can donate money directly to the project.

Due to the nature of donations the downside here is; you aren't guaranteed any kind of regular income, if any at all. Many small open-source projects get next to nothing. But if you manage to create something exceptional, which is used by a lot of people and particularly if your software has commercial uses; you could get a lot of donations, which even if only small, could still add up …

JasonHippy 739 Practically a Master Poster

Woah, that news came as a bit of a shock! I've had a few interesting exchanges with Dave in the past couple of years (both in the forums and via PM's etc) and learnt rather a lot from him. Dave was a great bloke, a unique character and was certainly one of the most knowledgable contributors on the C/C++ forums here.

My sincerest thoughts go out to you Aia and all the rest of Dave's close family and friends.
RIP Dave!

JasonHippy 739 Practically a Master Poster

What Salem meant was, have you added mystack.cpp to the project tree in your solution? I'm with Salem here, I strongly suspect you have not!

In Visual Studio, take a look at the solution explorer window and see what files are listed in there. You should have myStack.h listed under "Header Files" and main.cpp and myStack.cpp listed under "Source Files".

If you don't see mystack.cpp listed, right-click the "Source Files" folder in the solution explorer and select "add->existing item", then navigate to the location of mystack.cpp, select the file and hit ok. That will add mystack.cpp to your solution.

Also if you haven't added myStack.h to the list of header files in the project tree of the solution explorer either, you should add that too by right clicking on the "Header Files" folder, select "add->existing item", navigate to the location of the header, select the header file and click OK and that file will also be added to your solution.

Once you've correctly added all of the files to the solution, try re-compiling your project and it should compile without any further linker errors.

Basically the problem was the compiler found the myStack header file, but it didn't know where to look for the actual implementation, i.e. the myStack.cpp file. And it was this that caused the linker errors you were getting.

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

You could try booting into rescue-mode from a Ubuntu live-CD as described here.

But I'm not sure exactly what this would do, as I've never tried it!
It might be pretty much the same as doing a fresh re-install!

JasonHippy 739 Practically a Master Poster

Won't it corrupt anything on my system? Can you be more precise? I am not very confident about "trying deleting files"; If you understand me.

What Manuhar has suggested is actually quite sensible and safe! If you open your home-directory with Nautilus and then press ctrl-h to show hidden files and folders you should see lots of directories with names that start with a full-stop.
Typically they just contain user-specific initialisation files and settings for individual programs.

By deleting the .mozilla directory from your home directory, it will simply erase any of your .ini settings for Firefox. It will also erase any add-ins that you've added to firefox (e.g. adblock plus, personas etc.), but that's no biggie, you can always re-install them. You might also lose any bookmarks you have and perhaps a few other firefox related odds 'n ends, but certainly nothing critical!

Anyway, if you delete the .mozilla folder and then re-start firefox, firefox should re-create the directory and set up a new ini file for you and hopefully that should allow Firefox to start up!

I've had similar problems with other programs in *nix, most noteably in Code::Blocks (a C++ IDE). There have been a few times where Code::Blocks has refused to start for me. But by removing the .codeblocks directory from my home folder (thus deleting the .ini files and other settings). The next time I try running Codeblocks, the program sets itself up from scratch, creating new ini files for itself …

JasonHippy 739 Practically a Master Poster

The first thing I'd check are your publish settings.
It could be that you need to set your .fla up to use the network rather than the local filesystem. This is part of the security sandboxing for flash.
I think by default it is set to 'use local filesystem', which is probably why it works locally for you, but does not work on the server. Perhaps try changing that setting to 'use network' instead and then re-export your .swf uploading it to your server and testing it.

It's been a considerable while since I used the flash IDE, so I can't remember exactly where you need to go to get to the publish settings...I think it might be something like 'file->publish settings' from the menu, but I could be wrong!

Anyway, that would certainly be my first port of call, so give that a shot and let me know how you get on.
Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

Thanks Jason, Last week I utilized the scorm and know how to pass and retrieve variables from there! You caught up one thing ie. Moodle. I want to know more about moodle and need some tutorials about the installation, working with moodle etc. but not from the site Moodle.org. That is little bit confusing me.. not user friendly for me...

Hey Raja.
Um. I'm sorry to tell you this, but in my previous employment I never got to use Moodle directly. That was left to the QA dept who had to test and review all of our e-learning content on various SCORM/AICC compliant LMS's (including Moodle!).

My main role involved developing SCORM/AICC compliant e-learning content in flash and packaging it for use in LMS's like Moodle. But the QA dept were the ones who actually used it!

Initially we developed a suite of fully customisable, re-skinnable generic flash templates (e.g. menu system/GUI/interface template, page/content template, audio template etc.) to serve as a base for all of our e-learning courses. Once we'd got the generic templates working properly with some sample content, we went on to use them to rapidly develop and package entire courses of top quality, award-winning e-learning content.

I was also involved in developing a few bespoke LMS/VLE/CMS type systems, but I can't really help with Moodle as I've never used it!

I seem to recall Moodle requiring an apache server installed with MySQL and PHP. In other words a typical LAMP/WAMP server …

JasonHippy 739 Practically a Master Poster

OK, forgive me for being a little slow on the uptake here, but I'm a bit confused by the 'snow effect' you refer to. You don't really give much detail about the effect or how you've added it, other than you've added it to the timeline at a particular frame. But what exactly is it?

Is it a built in effect? or something you've scripted? or a flash movieclip/sprite that you're superimposing and playing on top of the video??

The reason I'm asking is, if we know how you've implemented the actual snow effect and how you're starting it, it might give us some clue on how to stop it. If you catch my drift?

Also, which versions of the Flash IDE and Actionscript are you using? This information will help others here to help you. If others here use the same version of the IDE as you they'll usually be more willing/able to give you some pointers.)

Incidentally I'm running a *nix OS, so I don't actually use the Flash IDE for flash dev anymore. I use Inkscape or the flash drawing API to create GFX and then use the Flex SDKs command line tools to compile my AS3 classes into .swfs. So I'm a bit rusty on certain aspects of using the Flash IDE. But if I know which version you're running I might be able to help point you in the right direction!
Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

Hey Raja,
funnily enough I used to work in the e-learning sector a few years ago. You'll need to take a look at the SCORM, AICC and IMS standards.

As long as your e-learning content satisfies their criteria then it should be usable in virtually any SCORM or AICC compliant LMS (Learner Management System), VLE (Virtual Learning Environment) or CMS (Content Management System) (e.g. Moodle).

Most of it is to do with how you package up the e-learning modules and there are also some standard javascript interfaces that you have to implement/use to allow data to be exchanged between the LMS/VLE/CMS and your flash content. (e.g. passing user data in to the e-learning module at the start of a session and then passing users scores out to the LMS/VLE at the end).

There are a few tools that can help you to package flash stuff into SCORM/AICC compliant elearning modules, but offhand I can't remember their names...Which is typical! If anything does come flooding back I'll repost!

Anyway. most of the SCORM and AICC stuff looks like a nightmare at first, but once you settle into things, you should be OK!

On the flip-side, I've been out of the loop for a few years now, so I don't know if the industry has moved on since then, or how far it has moved on. So I'm rusty as hell with that side of things..Even remembering simple actionscript is becoming more of a chore nowadays.... …

JasonHippy 739 Practically a Master Poster

It looks more or less correct, it at least looks as if it should calculate the tax correctly. The only obvious problems I can see are the conditions in your if..elif.. block, which needs a couple of minor tweaks.

At the moment, if you enter the value 50000 you'll get 0 returned as the amount of tax due. As mentioned, this is down to the conditions in your if..elif statement block. You need to use <= instead of < in a few places. In fact your if..elif block can actually be simplified a little.

For example, you could do this:

#calculate the amout of tax due to the tax given income

def calTax( income ):
    tax = 0
    if income <= 25000: # less than or equal to 25000
        tax = income * 0.25
    elif income <= 50000: # less than or equal to 50000
        tax = 25000 * 0.25 + (income - 25000) * 0.33
    else: # must be greater than 50000
        tax = 25000 * 0.25 + 25000 * 0.33 + (income - 50000) * 0.5
    return tax

def main ():
    taxableIncome = int(raw_input("Enter taxable income: "))
    governmentTake = calTax ( taxableIncome )
    print "The tax on $%0.2f is $%0.2f" % (taxableIncome,governmentTake)

main()

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

I've used Monodevelop on *nix briefly...And not for anything particularly serious either. More out of morbid curiosity than anything else I suppose.

Primarily I'm a C++ programmer by trade, but as a one-off I did some pretty heavy .NET development in C# a few years ago for one of my previous employers (using VS2005).

Now, I've not done any serious C# development since then, but I'd recently heard about Monodevelop as an alternative IDE for C#. And I've been quite impressed by some of the *nix apps that have been created for the Mono runtime (Tomboy Notes, F-Spot etc.). So I figured "What the hell, let's try it out!".

So I installed it on one of my Ubuntu machines.
After installation, I fired up the Monodevelop IDE and managed to successfully import the VS2005 solution for a multi-monitor screensaver I wrote back when I was learning C# (in preparation for my previous employers big project!). And lo and behold it built and ran with no problems. No modifications whatsoever were needed to the code...Great!

I've since tinkered about, creating a few other random apps and overall the Monodevelop IDE seems to me to be rather well featured. But personally, I don't think Monodevelop is quite as fully featured, or as powerful as Visual Studio. However, it is certainly a very viable, not to mention FREE alternative to Visual Studio.

Definitely worthy of consideration whatever OS you run IMHO! It's great for anybody starting out …

JasonHippy 739 Practically a Master Poster

I would use

Calculate = sum

instead of the above code ;)

Heh heh, good point Gribouillis, that's far better! I completely forgot about sum {slaps forehead!}. That completely eliminates the need for the calculate function and brings the OPs main function down to just 2 lines of code! Well spotted, my hat's off to you sir!

def main():
    myArray=(0,5,10,15,20)
    print "The answer is", sum(myArray)

main()
JasonHippy 739 Practically a Master Poster

BTW: Isharas suggestion of using a 'for ... in range(...)' loop is also a good one.

It will allow the python version of the calculate function to keep exactly the same signature as the C++ version, so you could consider using that if you were worried that your teacher/professor/lecturer might mark you down for not keeping the function signatures the same.

But at the same time, they may allow for the fact that you've recognised that in the context of the python port, the size parameter is redundant and really only applicable to the C++ version. So there are two ways of looking at it!

Both solutions will work, the code will do exactly the same thing, but I guess at the end of the day it depends on what whoever is marking your work is looking for.

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

You're quite close.
You have a few errors in there.

First off in main you're calling calculate, but you've defined the function as intCalculate. There's one straight off the bat.

Also your for loop should be:

for i in intValues
    intAnswer += i

NOT

for i in intAnswer
    intAnswer+= values[i]

The other error in the above is you've called the 2nd parameter to the calculate function 'intValues' and then you're referencing a non-existent object ('values') in your for loop.

Also, because we're using python, the calculate function does not need to know the size of the tuple/array, that's more of a C++ thing. A simple for i in intValues will suffice, so intSize is completely unneeded.

So your port from C++ to python should look something like this:

def main():
    myArray = (0, 2, 4, 8, 16)
    print "The answer is ", Calculate(myArray)

def Calculate(values):
    answer = 0
    for i in values:
        answer += i
    return answer

main()

Which is the python equivalent to the C++ code you posted (or at least it would be if the C++ was correct, I'll show you where you went wrong with that later in the post, mainly typos from the look of it!).
When porting code from one language to another, you need to fully understand the differences and similarities between the languages you are using.

Sometimes things do not require a literal translation.
As you've seen with my python port of …

JasonHippy 739 Practically a Master Poster

When you get to the login screen, will the system allow you to change the default session to Gnome?

If so, simply boot your pc and then when it gets to the login screen, change the default session to Gnome before logging in.
Once you get to the Gnome desktop, as long everything still works properly without crashing or anything, then you should be pretty much sorted.

If you are unable to change the default session to Gnome, or if Gnome is totally borked, perhaps you could try re-installing Gnome. Once Gnome has re-installed, you could then try rebooting and changing the default session to Gnome before logging in. That should sort you out nicely.

Once you know Gnome is OK, you can then uninstall the KDE desktop if you want (or you could leave it in case you decided to go back to it and try it again at some point)!

Otherwise, worst case scenario: Back up all of your personal files and any major customisations you've made (I usually back up custom themes and screensavers I've made and a few other bits 'n bobs as well.) and then re-install Ubuntu. But obviously this is pretty much the last-ditch solution!

Personally I'm not a fan of KDE either! Far too many configuration options to customise the desktop to the way I like it. It also seemed really clunky, unintuitive and slow! I especially hate the main start menu...Yuk! I find Gnome far simpler …

JasonHippy 739 Practically a Master Poster

You haven't really given us much information on exactly what you're doing or more importantly which distro you're using.

Are you updating existing packages or downloading new ones?
Do you already have a version of libmp3lame-dev? or is it a new dependency for one of the packages you're trying to update?

My best guess is you need to download/install the libmp3lame-dev package. But how you'd actually do that would depend on which *nix distro you have installed and which package manager you're using.

JasonHippy 739 Practically a Master Poster

BTW: I forgot to mention the header files you've included.
You don't need to include the old C header files (stdlib.h, stdio.h and string.h) so they can also be removed!

JasonHippy 739 Practically a Master Poster

Are you sure that the code you've posted even compiles??
I've not looked at your code in great detail, but from briefly looking at it I've spotted a few obvious errors that shouldn't allow this code to compile, let alone run and segfault!

For starters there's your misuse of the 'class' keyword in the for loop at line 149. You aren't declaring a class here, you're creating an iterator. I would've expected this line of code to throw a compiler error. Remove the class keyword there, that should solve that problem.

Also at line 371 you're declaring a C-style char array, but it isn't using a constant value. This should be throwing an error at compile time too. Arrays in C/C++ require a fixed value for their size. Variable length arrays cannot be created in this manner. Besides, if you need a variable length array in C++ it is far better to use one of the std::library containers like std::string, std::vector, std::deque which can robustly do their own memory management (so you don't have to!).

In fact, actually looking at your code, you don't really need cval at all:
It's obvious that cval is a C-style char array copy of whatever is stored in val and val is a std::string. And the thing to bear in mind here is that the std::string class has a c_str() member function which returns a C-style char array.

So in other words, you can completely remove cval. Rip …

Ancient Dragon commented: Nice comments +27
JasonHippy 739 Practically a Master Poster

Hi all,
I want to download latest software for graphics and multimedia. can anyone give me the exact URL where I can download the latest multimedia software.

You want latest software of graphics and multimedia. You know adobe suite is the best solutions to have all in one package, but it is not free of cost for you. {Piracy instructions snipped}

As far as I understand it, both of you guys are treading on thin ice here. According to the rules here, we're supposed to be keeping things legal, so discussing downloading pirated software would be a definite no-no! I'm surprised that none of the admins have spotted this yet!

Personally I'd say if you want the latest graphics and multimedia software, you should go out and buy it.

But if you can't afford it, then you should be aware that there are free and/or open source equivalents for most commercial software nowadays.
For example, there are programs like Inkscape, Gimp and Paint.NET available for doing more traditional graphics. Definite alternatives to using the expensive likes of Photoshop, Fireworks or Illustrator.

If you're interested in flash development, then there is the free Adobe Flex3 SDK, which allows you to create flash movies using mxml/AS3. There are also programs like FlashDevelop and Minibuilder which act as graphical frontends / IDE's for the Flex SDK. A definite replacement for using the rather costly Flash IDE.

OK, I will admit that some of the free/open source programs …

JasonHippy 739 Practically a Master Poster

OK first up, I'm not familiar with Newton Raphson so I can't actually help you out with the algo. But I can see the problem with your code.

The reason you never see any output is because your while loop loops infinitely because the value of the variable 'err' never changes.

None of the values ever change after the first time through the loop:
'x' and 'y' stay as 1.0 and 1.0.
So the calculated values of 'dx' and 'dy' are the same on each iteration of the loop.
Therefore 'xnew' and 'ynew' also have the same value calculated each time, as do 'm' and 'err'.

It's obvious to me that you're trying to loop until the potential error in the calculated value has dropped below a certain threshold, in order to get an accurate result.

The only way you're going to be able to decrease the amount of error would be to mutate one or more of the variables, based on one or more of the other calculated variables. Don't ask me which ones though, I really don't know. I'd leave that to one of the more educated CS types here!

My uneducated guess would be to assign x the value of xnew and y the value of ynew before reiterating, but I could be drastically wrong on that! I haven't got time to look up Newton Raphson either..Sorry!

Otherwise, perhaps there is something else that is missing from your …

JasonHippy 739 Practically a Master Poster

I don't know if this is of any use to you.
Claims to be a patch which allows libshout to be built with mingw.

Might be worth taking a look and having a go!

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

Well at least you're gradually getting there! You at least managed to build the vorbis/ogg libraries!

BTW: Sorry I didn't get more involved after my initial post...Had a few technical problems with our router over the weekend. Our cats were involved in an incident with it. Some fiddly soldering was required to fix it, which in turn meant hunting for my soldering iron and solder! Damn cats! Grrr..

I don't think it's a compiler problem per se. The error message says that there are conflicting definitions for the uint32_t type. So it's a problem with a couple of header files somewhere.

Can't say I've ever seen this sort of thing before.
Not entirely sure of the best way around it either....That's a bit of a showstopper isn't it!

You aren't alone though, it would seem that other people have been experiencing the same problems for some time. Here's something I found on this problem dated 2006:
http://lists.zerezo.com/mingw-users/msg02642.html

There's probably a way around it. We're just gonna have to do some digging to get to the bottom of it. I'm sure somebody's come up wtih a workaround if not a solution by now!

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

OK, well just quickly, here's how I'd tackle this problem (see code below!).

NOTE: I've just blatted this function out quickly, off the top of my head in gEdit. So I haven't actually compiled or tested it, but it should be more or less correct. Call it a proof of concept if you like!

I don't usually comment code so heavily either, but hopefully my excessive commenting will allow you to understand what's going on without the need for further explanation.
So without further ado, the code:

//////////////////////////////////////////////////////////////////////////////
/// countClumps - count the number of clumps in a string
//////////////////////////////////////////////////////////////////////////////
/// \param <min_clump> Minimum clump size
/// \param <strIn> The string to check
/// \param <strOut> Output string - longest clump found
/// \return <unsigned int> The number of clumps found in strIn
//////////////////////////////////////////////////////////////////////////////
unsigned int countClumps(unsigned int min_clump, const std::string &strIn, std::string &strOut)
{
	// Counters. 'number of clumps' and 'size of largest clump'.
	unsigned int numClumpsFound=0, largestClump=0;

	// if the string is shorter than the minimum clump size, 
	// don't bother doing anything. Just return!
	if(strIn.size()<min_clump)
		return 0;

	// Loop through the input string using const_iterators
	// To explain the break condition: 
	// we don't need to check for the start of a clump past the
	// character at strIn.end()-min_clump.
	// The increment section has also been left intentionally blank
	for( std::string::const_iterator clumpStart = strIn.begin(); clumpStart <= strIn.end() - min_clump; )
	{
		// create an iterator for the end of the clump
		std::string::const_iterator clumpEnd …
JasonHippy 739 Practically a Master Poster

With 'songbird' (i.e. the actual songbird executable, the file with no file extension), have you ensured that it is flagged as executable?
Try right-clicking on it from the desktop or Nautilus, open up the properties and ensure that the tickbox to allow execution is checked.
That may help.

Otherwise open up a terminal, navigate to the location of the songbird executable and try running it from the command line. See what that does. Running from the command line in a terminal should allow you to see any error messages that are thrown in the event that the program exits abnormally. (whereas running from Nautilus/the desktop, you might not see any error messages or any reasons for the programs failure.) Perhaps there are one or more dependencies that are not met, or some other problem.

If the program just fails silently from the command line (i.e. program fails and produces no output), then I guess you're out of luck. Perhaps the best bet in that case would be to contact the songbird developers to try and find out what the problem might be!

I was going to have a go at installing Songbird on one of my Ubuntu machines to see if I could get it working and guide you through the steps required. But after looking at the songbird website and seeing the minimum requirements for songbird, I'm more inclined to stick with VLC and Rhythmbox for my *nix multimedia needs.

But I've found …

JasonHippy 739 Practically a Master Poster

There's no need to uninstall mepis at all, you can simply get the Ubuntu installer to install Ubuntu using the entire drive and mepis will be replaced by Ubuntu.

All you need to do is the following:
1. Back up any personal files that you want to keep. (probably the most important step!)

2. Put the Ubuntu CD in your CD drive and reboot your pc from the CD drive. Once the CD has booted into the CD's menu you can begin the installation of Ubuntu.

At some point during the early stages of installation, you'll be asked how you want to install Ubuntu on the machine. You'll have several options. I can't remember exactly how the options are worded, but there are options to allow you to do the following:
1. Create a new partition for Ubuntu, or resize an existing partition.
This option would allow you to install Ubuntu on your PC and keep mepis on there as well. Enabling you to dual-boot mepis and ubuntu. In other words if you choose this option, then whenever you boot your pc you'll see a list of all installed operating systems and you can choose which one you want to boot into.

2. Install Ubuntu on the entire drive
Meaning the installer will delete all partitions on the drive and then auto-create whatever default partitions it requires before installing Ubuntu. This will effectively delete mepis when it repartitions the drive and Ubuntu will …

JasonHippy 739 Practically a Master Poster

Narue has explained this in great detail here. Her post includes a pretty comprehensive solution!

Cheers for now,
Jas.

EDIT: Ooops, looks like Vernon beat me to the punch there!

Nicely done Vernon. A bit more verbose than my entry!

JasonHippy 739 Practically a Master Poster

Hi all,

I am trying to write a general function that when called is able to write the value of all the member variables of an object passed to it. This function is part of a class.

The class objects that I want to write out each have a member called "key" which stores the names of the other variables in the class in a vector of strings.

I'm basically trying to write the following type of function to write out the contents of the member variables:

void writeObject2File( string objectName, string outputFilename )
{
    ofstream datafile;
    datafile.open( filename.c_str() );

    for ( unsigned int i=0; i<key.size(); i++ )
        datafile << objectName.c_str()->key.at( i ).c_str();
}

This doesn't work, which I guess is probably quite a novice error. The issue I'm having right now is with the following bit:

objectName.c_str()->key.at( i ).c_str();

How do I use the objectName string which defines the name of the object to access the specific object? And how do I then use the variable names stored in the vector key to access their values and subsequently print them to the datafile?

I would really appreciate it if someone can help me sort this out.

Thanks in advance,

Kartik

As far as I can see it, your function takes a std::string as the first parameter. So what is going into the function is not actually an instance of your class, but merely a string representing the name of the class. Perhaps you should alter the function so it takes an …

JasonHippy 739 Practically a Master Poster

Hi,
I know this is compiler thing but I just wanted to know if anyone here have ever been succesful in compiling libvorbis/libogg with MINGW. It's weeks now I cant do it!

I have tried with MSYS but nope i cant get far. I wonder why these developer consider only MSVC stuffs but are not in favor of GCC in windows :(

The only time I ever had to compile the vorbis/ogg libraries on Windows, (back in my first job!) I was using Visual studio, so I've never tried it with mingw. But I've managed to build it in *nix using gcc though (only while tinkering, nothing serious!).

Anyway, if it compiles in *nix with gcc, then there should be a way of compiling it in windows with mingw....Or at least I would have thought so!

What sort of errors are you getting??
Note: I've not used mingw for a long while and my last windows machine here at home died a few weeks ago and I don't plan to re-install windows when I eventually fix it either**. So I'm not sure if I'll be of much use, but I'll see what I can do to help!

Even if I can't help; if you post your errors, somebody else here who uses mingw might be able to help.
Cheers for now,
Jas.

** I'm planning on replacing the hard-drive and then installing *nix...I've had enough of Windows! Plus XP's shelf life has …

JasonHippy 739 Practically a Master Poster

Well, for starters I would've used code tags when posting the code! heh heh!

Other than that, I can see three main errors in the code:
1. The variable 'option' is uninitialised before it is used in the while loop in main. So I'd recommend initialising it to something..Anything will do, as long as it isn't '6'!

2. and 3. The variables sum and x in your standard_dev_array() function are also uninitialised before they are used by the += operator, both of these should be initialised at declaration too.

Other than that it should work OK. Perhaps tidying the output to the screen may be the only tweaks you want to make to this!

I've just double checked your original code with VS2008 and the 3 errors I spotted were the only problems it found too!

Here's your code again. I've put additional comments next to the most relevant bits.

// 
// CCOM 3033
// Asig #3



// Library
#include <iostream>
#include <string>
#include <cmath>



using namespace std ;  




// Prototypes
void display_instructions () ;					// Prototype for displaying instructions                  
void display_menu () ;							// Prototype for displaying the menu                
void insert_array (float[] , int) ;             // Prototype for the insert array function          
void display_array (float[] , int) ;            // Prototype for displaying the inserted array        
void average_array (float[] , int) ;           // Prototype for calculating and displaying the average value of an array    
void standard_dev_array (float[] , int) ;       // …
JasonHippy 739 Practically a Master Poster

A couple of questions first..
Exactly what is a clump?
Exactly what is your program supposed to be doing?

The reason I ask is because you haven't really explained your program or the problem particularly clearly.

Regarding the code:
The logic in your code is difficult to understand because you've used a lot of single-letter identifiers (e.g. k, g, p, i, y etc etc). And there are no comments in the code either.

If you at least use meaningful identifier names, it makes your code much more readable and makes your logic and your intentions more obviously apparent to others. Sure, k,g,p,i and y all mean something to you at the moment because you just wrote the code. But it doesn't explain anything to any third-parties who might have to read your code (e.g. myself, the rest of the Daniweb community, your programming teacher/lecturer/professor etc. etc.).

Putting meaningful comments into your code would also allow anybody reading your code to be able to understand your intentions and may also help somebody spot any logical errors in your code.

As it stands, you could end up looking back at this code in a few months and be completely lost yourself!

Also, even if you get your program working; if your code/logic is hard to read/understand, you could well end up getting marked down by whoever is marking your homework. Which is another important thing to bear in mind!

For future reference when …

JasonHippy 739 Practically a Master Poster

Taking things right back to the beginning and assuming that there was at least a README or something. Have you read any of the documentation that shipped with the template? That would be my first port of call. Any decent template should come with detailed instructions on how to modify it. Or at least, one would expect it to! It's pretty shoddy if it didn't!

Also, I'm afraid that without seeing some source code, nobody here is going to be able to help you very much. And because the template is somebody elses work and therefore most likely covered by copyright (unless it's under a CC licence or something similar), you're not going to be allowed to post the source here either.

If you're having real problems, it would probably be best to either contact templatemonster or the author of the template for support.

So my advice is this:
1. Make a backup of the original template.
2. Read through any documentation that came with the template.
3. Carefully follow any instructions for modifying the template.
4. If there is no documentation, or you are having too much trouble, contact templatemonster or the author of the template for support.

Regarding the library, anything that appears in the final swf will be somewhere in the library. If you methodically trawl through the entire library and carefully replace any relevant assets you should be able to replace all of the bits you need to.

JasonHippy 739 Practically a Master Poster

I have just imported an swf file and i want this movie clip to be played at a lot slower frame rate?

Offhand, I don't think you can! As far as I'm aware, external swf's will play back at whatever frame-rate the parent is using.

If you brought your parent .swf's frame-rate down to at least match the frame-rate of the external .swf, then the external swf should play back at the correct speed.

I remember this being a problem since AS2 (if not before then!) and I think the main workaround was to open clips with a different frame-rate in a popup/separate page - allowing them to run at their native speed. However, I've done a quick search and found this link:
http://www.flashessential.com/archives/71

Which claims that by using stage.frameRate in AS3 you can dynamically alter the frame-rate of a .swf at runtime. But again it is the parent .swf that gets it's frame-rate altered, not the loaded .swf.

But I suppose if you could use some code to find out the framerate of the external .swf (not sure how, I'll leave you to work that out) you could perhaps load the external .swf, then set the parent clips frame-rate to match the frame-rate of the external .swf. The external .swf is then played back. Finally, once the external .swf is finished with, you can set the parent back to its original frame-rate.

Which is another possibility I suppose!

Otherwise, is there …