JasonHippy 739 Practically a Master Poster

Ever since the HD died on our main XP pro desktop at home, I've completely switched to Linux.

The hardware in our main desktop PC does not meet the minimum spec for Vista or 7. And XP is nearing the end of it's shelf life, so reinstalling XP would be pointless. Plus we can't afford to upgrade our PC or buy a new one. Besides, other than a dead HD there really isn't anything wrong with the existing harware either. So our hand is more or less forced!

As soon as we get a new HD, it will be resurrected to run Ubuntu or Fedora.

I've been using *nix for a few years now. I have an old tablet PC running Ubuntu 9.04, a laptop running Ubuntu 9.10(via USB stick...Another machine with a dead HD!) and a much older laptop with Damn Small Linux.

As a developer, *nix provides all the development tools I'll ever need.
*nix also provides enough software to meet my familys rather basic IT needs, Firefox, OpenOffice, Evolution, VLC etc.

And none of my family are particularly big on games, so they aren't missed! They only play things like solitaire and minesweeper and whenever I want to get my fps frag-time in, I'm happy to fire up something like Urban Terror, Nexuiz, Wolfenstein:Enemy Territory or Alien Arena! (at least on the one laptop we have that can handle those games! heh heh!)

My family enjoy the relatively hassle-free user …

JasonHippy 739 Practically a Master Poster

Well, for starters, if you'd enclosed your code in code tags it would have been a bit easier to read. But anyway, here are the problems I spotted in your code: (Apologies if there are any I've missed!)

1. Unless I'm mistaken there appears to be a closing brace '}' missing at the end of the GetDate function

2. GetDate is supposed to return an int, but it doesn't actually return anything, so you either need to make it return something or change its return type to void, otherwise you'll get another error later on.

3. Look at your CheckLeapYear function definition:
e.g.

int CheckLeapYear(year);
{
	if(((year % 100 == 0)&&(year % 400 == 0)) || ((year % 100 != 0) && (year % 4 == 0)))
		return true;
	else
		return false;
}

The parameter list should be 'int year' not 'year', the return type of the function should really be bool as you are returning true/false. Also you've stuck a semi-colon at the end of the line, which completely skips the function body....Doh!

4. Immediately after the CheckLeapYear function definition there is an extra closing brace '}'. This is probably the one that was missing from the end of the GetDate function! This is part of your reported problem! More on this later!

5. At the top of your code you have declared/prototyped a function called 'CalcDayNumOfYear', which returns an int and takes three int parameters, yet towards the end of your …

JasonHippy 739 Practically a Master Poster

I am sorry to have say that you are completely mistaken about this description.
The definition of || is that it evaluates its left operand first; if that operand yields true, then the result of || is true and the right operand is not evaluated.

Similarly, && evaluates its left operand first; if that operand yields false, then the result of && is false and the right operand is not evaluated.

Oops, yeah you're right! Of course it is! {face-palm} What the hell was I thinking?? I definitely dropped the ball there! {ashamed}

Hang on... Just for the sake of my own sanity... {firing up compiler}
I'm gonna try copying the OPs code and then making my suggested changes and compiling and running (didn't do that earlier, just used notepad to type my solution and then cut/pasted into my post! heh heh!)....

OK, that works...

Now lets get rid of the extraneous ANDs that I've put into the if's and shift the checks against null to the left of the OR's..
Now compile and....Yup that works... Hmmm, now I feel really stupid!!
Thanks for correcting me there arkoenig!

So the conditions of the two if statements in the add function should be:

if(!*q || num<(*q)->data)

and

if( r->data<=num && (!r->link || r->link->data>num) )

For want of a better word, I really am a twit* sometimes! (*substitute the 'i' for an 'a' is more like it!)
I use this stuff …

JasonHippy 739 Practically a Master Poster

OK, well arkoenig hit the nail on the head with his description of the problem.
This thread is becoming a little painful to read now, so I think I'll put you out of your misery. But I'll explain things as I go, that way I'm not just spoon-feeding code. Also, that way, you'll at least be able to understand what's going on!

Before we go into that, here's a quick note on the AND (&&) and OR (||) operators:
With the boolean logical comparisons, expressions are evaluated from left to right.
With an AND, if the left-hand expression evaluates to false, the AND returns false without bothering to evaluate the right-hand expression.
However, OR's will only return after evaluating the expressions on both sides.

Bearing that in mind, let's get onto your problem:
First up, the first 'if' statement in your add function:

if(num<=r->data||r==NULL)

Simply moving the 'r==NULL' comparison to the left does not solve the problem:

if(r==NULL || num<=r->data)

This is because the OR evaluates both sides of the expression before returning a value. So in cases where r is NULL, the left hand side of the expression will evaluate to true, but due to the nature of the OR it will also attempt to evaluate the right hand expression.
But because r is NULL, the attempt to read r->data in the right hand expression will cause a crash. So you need to include an additional test in the …

JasonHippy 739 Practically a Master Poster

No that's different, in this case p will actually be modified. Hmm, this is gonna be tricky to explain!

I'll try not to confuse you too much, but this is as I understand it! (I'm sure one of the more senior guru types here will jump in and save me if I am off slightly!)

In this case, I'm assuming that you've declared a pointer to a node called p and set it to point to null as per your original code.

struct node *p=NULL;

This creates a node pointer on the stack which initially contains the memory address of NULL (0x00000000).
For the purposes of this example, I'll use an arbitrary hexadecimal value to represent the location in memory of p:

---------------------------
address      |   contents
===========================
0x45ab34da   |   0x00000000
---------------------------

So that's the variable 'p' pointing to null.

When you call the new version of your append function, it wants a pointer to a pointer. At the moment 'p' is just an ordinary pointer, so to pass a pointer to a pointer into the function you have to pass the address of 'p' (in other words &p) when you call the function:

append(&p, 14);

When the append function is called and its stack-frame is initialised, a pointer to a node pointer (q) is created, this points to the location in memory of the pointer p.
So q looks like this: (Again, I'll use an arbitrary address)

---------------------------
address      |   contents …
JasonHippy 739 Practically a Master Poster

If it worked once, why shouldn't it work again??

Did you refresh the folder view on the server after it claimed to have written the file the second time? (you probably did, but I mention it on the off-chance that you didn't!)

I also notice that you are not checking whether OpenFile or WriteFileText succeeded...Would it not be an idea to test the success or failure of either of those?

If the file wouldn't open in the first place, that would be the first potential point of failure. Attempting to write to a file that wasn't actually open would be a segfault in the making if you ask me! CRASH!! heh heh!

Other than that the code looks more or less OK.

JasonHippy 739 Practically a Master Poster

In your main function you are trying to call the foo::bar function directly, without an instance of the foo object. Usually you'd do something like

foo myfoo;
myfoo.bar(3);

and even then the bar function would have to be a public function. As it currently stands, the bar function is private (as it has not already been specified otherwise... at least according to your foobar example!)

In order to be able to call the foo::bar() function directly without an instance of the foo class, you'd need to ensure that the bar function was a public static function e.g.

class foo{
public:
	static void bar(int n){};
};

Which would allow you to call the function directly, but you'd have to do it like this:

foo::bar(3);

Not sure if any of this helps, but it's a start!
Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

I understand that sounds wonderful. I have to ask about one detail though of how to set up this parameter. Do I need to first connect and then check this in the if statment or will I just write the if statement.

For example do I need the first line here ?

sftp->Connect(hostname, port);

if (sftp->Connect(hostname, port)) {
  //perform your transfer if true/non-zero
} else {
  //error handling if false or zero
}

{facepalm}

No, you don't need to call it twice! You just call it once inside the if statement as recommended by myself and Fbody!

Basically the Connect function is called inside the if statement. The if statement then evaluates the return value from the Connect call.
So if the Connect function returns true (or non zero), then the code under the if statement is executed. Otherwise if Connect returns false (or 0) then the code under the else is used!

I hope that clears things up for you!

JasonHippy 739 Practically a Master Poster

Have you tried this??

if(sftp->Connect(hostname, port))
{
	// do something
}
else
{
	// Whoops sftp->Connect() failed!!
}

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

Are you sure that compiles?? The 'using namespace std;' is before the #includes. So unless I'm mistaken, nothing in the std:: namespace will be visible to the compiler until after the first #include.

Anyway that aside, as Rash has already pointed out; inside your append function you cannot reassign the passed-in pointer to point to another memory address...
Well... You can, but because of the way that parameters are passed to functions, this change will only be visible inside the function. Outside the function, the change to the pointers address will have had no effect.

e.g.
In main you are creating a 'struct node' pointer p, which initially points to nothing/NULL. You are then passing the pointer into your append function. Because the passed-in pointer is NULL, you are creating a new 'struct node' instance and then assigning the passed-in pointer to point to the new instance.. Inside the append function that's fine, but this does not change the pointer in the calling function(i.e. in main). The pointer here will still be pointing to nothing / NULL.

There is a quick solution using your existing code but it is a bit hacky looking. If you alter your append function to return a 'struct node*' like this:

struct node* append(struct node *q,int num)
{
	// In both instances you were creating a new node, 
	// so may as well factor this outside of the if..else!
	struct node *r= new struct node;
	r->data=num;
	r->link=NULL;

	//if(q==NULL)
	if(!q) …
JasonHippy 739 Practically a Master Poster

IMHO the swfobject script is the simplest and best way of embedding flash content in HTML pages.

Using swfObject will guarantee that all users of your website will be able to see something, even if it's the alternate content. The script runs when the page is viewed and can determine which type of browser is in use allowing the script to generate appropriate HTML embed tags for the users browser.

It also checks to see if flashplayer is installed and the version of flashplayer. If no flashplayer is detected, or the users installed version is too old, the script can display alternative content, or can be set up to redirect the user to a page where they can download a newer version of flashplayer.

Without swfobject, I think you can do it like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
	<head>
		<title>page title</title>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
	</head>
	<body>
		<div>
			<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="800" height="600" id="myFlashContent">
				<param name="movie" value="my_swf.swf" />
				<!--[if !IE]>-->
				<object type="application/x-shockwave-flash" data="my_swf.swf" width="800" height="600">
				<!--<![endif]-->
					Alternative content to go here, if no flashplayer is present
				<!--[if !IE]>-->
				</object>
				<!--<![endif]-->
			</object>
		</div>
	</body>
</html>

It's been a while since I've embedded any .swfs manually though, so for the code above, I just used the swfobject generator tool to create a statically published page and removed any reference to the swfobject script from the generated HTML. The remaining code should be more or less what …

JasonHippy 739 Practically a Master Poster

your proposal pretty much depends on whether there's access to definition of the CDataExchange class or not.

Ah good point, I haven't done any MFC in a looooong time so I'm rusty as hell!
I wasn't sure what pDX was pointing to, but now that you mention it, pDX... Yes that's probably a pointer to a CDataExchange object...Of course! {facepalm} Doh!

Well, after looking at the definition of CDataExchange, m_bSaveAndValidate is a public member variable, so using:

pDX->m_bSaveAndValidate = FALSE;

Should solve the OP's problem as suggested in my previous post!

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

If you use ShellExecuteEx you can run another program as a separate process:

#include <iostream>
#include <string>

#include <windows.h> // required for various Win32 API bits
#include <io.h> // required for _access()
#include <shlobj.h> // required for SHGetSpecialFolderPath
#include <shellapi.h> // required for ShellExecuteEx

// helper functions
std::string GetSpecialFolderPath(int csidl_value);
void RunProgram(std::string path);


int main()
{

	std::cout << "Opening 'My Documents' folder as a separate process..." << std::endl;
	RunProgram(GetSpecialFolderPath(CSIDL_PERSONAL));

	std::cout << "Opening 'Desktop' folder as a separate process..." << std::endl;
	RunProgram(GetSpecialFolderPath(CSIDL_DESKTOPDIRECTORY));

	std::cout << "Running notepad as a separate process..." << std::endl;
	// Try putting the path to a program on your system here:
	RunProgram("C:/WINDOWS/system32/notepad.exe");

	std::cout << "Attempting to run something which doesn't exist..." << std::endl;
	RunProgram("C:/thisdoesntexist.exe");

	std::cout << "\nPress return to continue..."; 
	std::string dummy;
	std::getline(std::cin, dummy);

	return 0;
}

// Get the path to a special system directory using its CSIDL_ value
std::string GetSpecialFolderPath(int csidl_value)
{
	LPSTR rawPath = new CHAR[MAX_PATH];
	SHGetSpecialFolderPath(0, rawPath, csidl_value, 0);
	std::string path(rawPath);
	delete rawPath;
	return path;
}


// Run the program at the passed-in path
void RunProgram(std::string path)
{
	// check the specified path actually exists
	if( _access(path.c_str(), 0) == 0 )
	{
		// it exists, so lets open it
	// first set up some shell execute info for the program/folder/document
		SHELLEXECUTEINFO sei;
		sei.cbSize = sizeof(SHELLEXECUTEINFO);
		sei.fMask = 0;
		sei.hwnd=0;
		sei.lpVerb="open";
		sei.lpFile=path.c_str();  // this is the only bit that we'll change for now
		sei.lpParameters=0;
		sei.nShow=SW_SHOWNORMAL;
		sei.hInstApp=0;
		sei.lpIDList=0;
		sei.lpClass=0;
		sei.hkeyClass=0;
		sei.dwHotKey=0;
		sei.hIcon=0;
		sei.hProcess=0;
		sei.lpDirectory=0;
		
		// finally, let's attempt to run whtaever is at the passed-in …
JasonHippy 739 Practically a Master Poster

From the looks of this line:

pDX->m_bSaveAndValidate(FALSE);

It seems to me that you're trying to use a boolean member variable as a function, which is why you're getting that particular error.

I'm pretty certain if you search for the definition of m_bSaveAndValidate it will be declared as a boolean variable NOT as a function which takes a boolean as a parameter.
i.e.

bool m_bSaveAndValidate;

So the reason you are getting that error is because you are trying to use a variable as a function.

If the boolean flag is a public member/property of the class pointed to by pDX, then you should be able to set it directly like this:

pDX->m_bSaveAndValidate = false;

Otherwise, if m_bSaveAndValidate is a private or protected member of whatever class is pointed to by pDX, you will have to use a public function to get or set the value of the flag. If there are currently no public functions in the class which get or set the value of the flag, then you will have to add them to the class yourself.
e.g. in your header:

class YourClass : public WhateverItsDerivedFrom
{
	private: // or it might be under protected!
		bool m_bSaveAndValidate;
		// Other private member variables/functions here

	public:
		// constructor, destructor and other public member variables and functions here
		
		// Accessor functions to get and set the flag
		void SetSaveAndValidate(bool bState){m_bSaveAndValidate = bState;}
		bool GetSaveAndValidate(){return m_bSaveAndValidate;}
};

That way you can call your 'set' function for …

JasonHippy 739 Practically a Master Poster

You could try a free open-source javascript script called 'swfObject.js', which is a cross-platform, cross-browser compatible javascript file which can detect the type of browser being used and attempts to detect the version of flashplayer installed before generating appropriate, browser specific HTML to embed the .swf at runtime.

If no flashplayer is present, you can simply specify alternate content to use.

Check out the swfobject project page here:
http://code.google.com/p/swfobject/

With swfobject.js, you can:

  • specify the .swf file to embed in the page
  • specify alternative content if no flashplayer is installed (i.e. the image you want to display!)
  • specify the minimum version of flashplayer required
  • pass flashvars, params, attributes to the target .swf.

It's a pretty robust script, it's used widely and it's got quite a large community of users and contributors/maintainers, so if you do get stuck you can always post a question on their forums.

There is also a downloadable tool which will help you to create the appropriate HTML/javascript code for your page (available as a dynamic HTML page or an Adobe AIR application). You just fill in the path/name of the swf to embed, set any of the other myriad of options and then click the 'generate' button to create some code which you can cut/paste into your HTML page.

If you download the latest version of the script and put a copy of it into the js folder of your website, then …

JasonHippy 739 Practically a Master Poster

The -T option should still work AFAIK.

Just off the top of my head, have you set up the path to the script file properly in the parameter to the -T option?

Otherwise, have you set up a search path for the script using the -L option?

If none of that helps, can you post the exact line you're using for the call to ld? It might shed some light on the problem you're having!

This webpage might also help:
http://linux.about.com/library/cmd/blcmdl1_ld.htm

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

Sorry, I've not had much free time to myself recently. What with work, the band, family holidays etc I've had to put the tut idea on hold temporarily.
Time is still a bit tight atm and will be for the next couple of months, but I am working on things whenever I get the chance.... Or at least whenever I remember to! heh heh!

I've taken things from the other direction with regard to the XML driven banner. I've been working on a class for the actual animation, which will take parameters read from the XML (image, text, animation options etc.). I'll work on the XML Loader at a later date.

I think I've more or less worked out how to structure the animation class now.
I just need to finalise the animation class and then the final part will be to create a main class which will read in XML from a file and dynamically create an instance of the animation class.

Once I've done this I'll get onto writing it all up into a tutorial!

Anyway, just so you can see some progress I've attached a .swf demo of a prototype of my animation class. I've embedded an image in it for now and hard-coded the text and the parameters for the animation. This was all done in pure actionscript NOT the Flash IDE!

Cheers for now,
Jas.

BTW: @ Lusiphur : Nice ideas, for some tutorial topics. They …

JasonHippy 739 Practically a Master Poster

Someone left a comment on one of my posts similar to, "Linux won't be popular on the Desktop until it runs Windows applications." To which I silently responded, "Huh? and, "You've got to be kidding me." We have WINE for running Windows applications and it works reasonably well for those who care to spend the time to work through any problems with it. I don't think the Linux Community needs to spend time on such an undertaking. Is anyone asking Apple to run Windows applications so that it will gain popularity? No? Then, why should Linux? If you want to run Windows applications, run them on Windows.

Linux is Linux. Mac OS is Mac OS. And, Windows is Windows.

Why does anyone want or need any crossover?

If application vendors want to create applications that run on Linux, that's great. I'm behind that 100 percent. If Intuit, for example, wants to create QuickBooks that runs on Linux, I'd buy it. If Adobe created Photoshop for Linux, they'd have an audience. And, if Microsoft created Microsoft Office for Linux, it would sell too. After all, the first operating system that MS Office ran on was the Mac OS.

And, why would you want to run Windows applications when we have OpenOffice.org, KOffice, GIMP and many others that are actually better than their Windows counterparts? They're so good that all three of the ones I mentioned …

JasonHippy 739 Practically a Master Poster

{rolls eyes and sighs!}

OK, I'm assuming this is a Windows version of CS3 that you are trying to install on Ubuntu, which is a Linux based OS.

If that is the case you should know that Linux is not Windows, Windows applications do not run on Linux or vice versa!

At least not by default anyway....

If you install Wine, which is basically a Windows emulator/compatibility layer (Search for it in ubuntu's package manager or the software centre) you can install and run some Windows applications on your Linux box.
But be warned, it doesn't work with every Windows program.
The Wine projects website lists lots of programs that will run properly under Wine and also lists configuration options to improve the performance of some applications that don't run quite so well.

I'm not sure if CS3 will successfully install or run under Wine in Linux, you'll have to take a look at the wine website, or try it for yourself.

Otherwise have you considered using any free / open source alternatives to CS3 on Ubuntu??
For example instead of Fireworks or Photoshop, you could try Gimp.
Instead of Illustrator you could try Inkscape. Instead of Flash, you could use the free Adobe Flex SDK.

Regarding PHP development, you'll most likely need to install an apache server, mysql and php5.
Take a look at these links:
https://help.ubuntu.com/9.10/serverguide/C/httpd.html
https://help.ubuntu.com/9.10/serverguide/C/mysql.html
https://help.ubuntu.com/9.10/serverguide/C/php5.html

JasonHippy 739 Practically a Master Poster

Well, this topic isn't particularly C++ related, but....

When you say bootable, do you mean that you simply want it to auto-run from the USB stick when the USB stick is inserted?

Or do you mean that you want the computer to boot from USB into your product when the computer is turned on?


If it's just a case of auto-running the app when the USB stick plugged in, then you just need to create an autorun.inf script file which will run your application when the USB device is inserted. But you should note that for security reasons, a lot of savvy Windows users will have auto-play disabled. So this could prove more or less pointless as windows users with autoplay disabled would have to manually start your program themselves.

But if you want to boot into your app from startup via USB; As far as I'm aware, you'll need to create and include your own minimalist version of an OS on the USB drive to run the app in.

In other words, your minimal OS boots from the USB drive and then runs your application.

I don't think it's possible to do this with Windows, for starters you'd have to have to install a heavily cut-down and customised version of windows on each USB stick you distribute which would prove expensive for you what with the cost of Windows licences. Secondly, I'm not sure whether Microsoft would allow this kind of …

JasonHippy 739 Practically a Master Poster

From looking at the line of code in question:

((serverDlg*)m_pDlg)->OnReceive(port);

If typecasting is required, shouldn't one of the C++ cast operators like dynamic_cast be used to safely typecast the pointer, instead of doing a potentially unsafe C-style cast?
e.g.

// attempt to cast m_pDlg using dynamic_cast
serverDlg *pSrvDlg = dynamic_cast<serverDlg*>(m_pDlg);

// if we've got a valid pointer, call the OnRecieve function
if(pSrvDlg)
    pSrvDlg->OnRecieve(port);
else
    // Some code here to handle the eventuality that m_pDlg
    // could not successfully be cast from CDialog* to serverDlg*

If there's any possibility that m_pDlg could point to a different CDialog based class, using dynamic_cast would be critical to avoid a runtime error/segfault in cases where m_pDlg points to a different type of CDialog derived object.

However, if you 100% know that the object pointed to by m_pDlg will only ever be a serverDlg object, then perhaps you should change the type of m_pDlg at declaration to be a serverDlg pointer rather than a CDialog pointer, which would then completely negate the need to typecast.

That's my two pence on the matter!
Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

Woah, I wasn't expecting that..So we're starting with advanced rocket science now are we?? There's no messing about here is there?!

I was hoping to ease myself in gently, seeing as I'm a bit rusty ATM.

OK, I've just taken a look at the site and the configurator...Wow, there's quite a lot of work that's gone into that! Kudos to Ken Burns, that's pretty comprehensive! Definitely some food for thought..

OK, now I just need to try to simplify the idea, create something similar and then write a tutorial..hmmm...This is gonna be a real puzzler!

What are we aiming for here for the purposes of the tut?
Perhaps a simple masked banner which uses an XML file to:
A: Load an image to animate
B: Set some text in a text-field
C: Set some basic animation options for the text and the graphic (start and end positions, start and end alpha vals and type of tweening to use??)

Sound good?
I'll try to make a start on that during whatever free time I get over the next couple of weeks. Once I've got something working, I'll start drafting the tut. Then when it's all done, I'll post it up in it's own thread.
My end result won't look anywhere near as stunning as Mr Burns' though!

Wish me luck!
Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

OK,
I rarely start threads here, I'm more of a solutions guy than a problems guy; but I've started this thread off the back of something posted elsewhere by my good friend and regular poster in this forum, rajarajan07. (quoted below!)

Jason always gives the great explanation for the thing he known. Thats Great!

Jason is the right person to write tutorials on Daniweb! Jason plz consider this.

I think my reply to this warrants its own thread, for reasons which will become apparent shortly...Before that there are some inevitable and inordinately long-winded ramblings: (Sorry!)

First up, I must say thanks to Raja for the vote of confidence. It really means a lot to me, especially when lately it seems to me as if I've forgotten more about Flash and Actionscript than some people ever learn. So perhaps writing some AS3 tutorials here would help me to at least retain, if not refresh or even expand what remaining knowledge I have in this area.

Unfortunately thanks to my currently insane schedule, my post-count here has been pretty low of late. But if I ever get enough free time I'd definitely be up for writing some tutorials on AS3.

So now we come down to the nitty-gritty and the main reason for my post. And this is the part I need your help/feedback on:
When/if I finally manage to find enough time to create some AS3 tutorials, are there any particular topics that you'd like me …

JasonHippy 739 Practically a Master Poster

Currently listening to the final mixes of my bands new 3 track e.p.
My drums sound great! The rest of the band aren't so bad! heh heh!

Can't wait 'til they're mastered now....

If anybody's interested (like any of my friends or other regulars/semi-regulars here who've stumbled accross my occasional ramblings), some rough pre-production demo mixes of the three new tracks are uploaded to our myspace page: myspace.com/kinasis. (I think there's a link in my sig. atm)

Jas.

JasonHippy 739 Practically a Master Poster

If you ever have lots of objects on-screen and you want two specific objects to swap depths, you could do something like this:

// get the indices of the two objects we're interested in:
var index1:Number = getChildIndex(object1);
var index2:Number = getChildIndex(object2);

// And swap depths using the other objects original index:
setChildIndex(object1, index2);
setChildIndex(object2, index1);

Doh, ignore the above quoted part of my original post. i.e. The bit about swapping two objects depths. I completely forgot about two other depth related functions:

// Swap the depths of two DisplayObjects
swapChildren(child1:DisplayObject, child2:DisplayObject):void;

// Swap the depths of the objects at the specified childIndex's
swapChildrenAt(index1:int, index2:int):void;

In which case, to swap the depths of two objects, you'd just use:

swapChildren(object1, object2);

I can't believe I forgot those two functions!
Jas.

[edit:] PS. This is a good place to look up the available depth functions:
http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/display/DisplayObjectContainer.html

JasonHippy 739 Practically a Master Poster

Oh, one other thing I've just thought of....
If 'movi' is an instance name in the IDE; for example if you added 'movi' to the stage from the library in the IDE and 'movi' is the instance name you gave it. Then you might need to use something like this to get 'movi' to the topmost layer:

var targetObj:DisplayObject = getChildByName("movi");
if(targetObj)
    setChildIndex(targetObj, numChildren-1);

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

In AS3 everything that gets added to the stage has it's own childIndex property, which relates to the objects depth.
When adding DisplayObjects using addChild, the first item added will appear at the bottom and any subsequently added items will appear over the top of the previously added item.

To change an objects depth/childIndex in AS3, you call the setChildIndex function which is a global function. The declaration of the function looks like this:

setChildIndex(child:DisplayObject, index:int):void

Where 'child' is the object you want to change the depth/childIndex for and 'index' is the new index/depth you want to use.

So to make 'movi' go to the top you can use this:

setChildIndex(movi, numChildren-1)

NOTE: Just as 'setChildIndex()' is a global function, 'numChildren' is a global property. 'numChildren' is the number of children that are currently added to the stage. So if there are four DisplayObjects on the stage, then the childIndex properties of the objects will range from 0 to 3 (0 being at the bottom and 3 at the top.).
Bearing this in mind, setting the child index of movi to numChildren-1 will put movi in the topmost layer.

If you want to see this in action, here is a very trivial example using the Flex SDK (I don't have the Flash IDE atm, so I use the Flex SDK instead).

Anyway, what I'm going to do here is create a simple ball class called SimpleBall.
I'm then going to create …

JasonHippy 739 Practically a Master Poster

Personally I find Eclipse a bit slow and bloated on *nix. But that might be down to my crappy hardware more than anything else!

My IDE of choice for C++ on *nix is Code::Blocks. It's relatively small, it's fast, it looks and behaves similarly to Visual Studio and it integrates and works really well with the native *nix compilers (gcc, g++, nasm etc). Code::Blocks also ships with C/C++ project templates for several popular graphics/GUI libraries (wxWidgets, QT, OpenGL, OGRE, GTK etc), which can help to get new projects up and running quickly with a mininmum of fuss.

Incidentally, if you're interested in developing applications using C++ and wxWidgets, then the 'codeblocks-contrib' package is another must-have for Code::Blocks as it includes the wxSmith plugin, which can aid rapid application development with wxWidgets.

The wxSmith plugin extends Code::Blocks allowing you to visually/graphically place wxWidget controls on dialogs and windows. The plugin then auto-generates C++ code in your project in a very similar way to Visual Studio. If you've ever done any MFC development in Visual Studio on Windows; you'll find that using wxSmith with Code::Blocks is very similar!

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

I'm with iamthwee on this. I primarily use Ubuntu and Gnome.
I also have an older laptop with Xubuntu on it (Ubuntu & Xfce).

I've tried a lot of other distros on my PC's, but I always seem to come back to the Ubuntu/Debian variants.

The Ubuntu/Debian-based distros have enough features to allow me to just be able to get on with things. The install process is quick, simple and versatile (you can run a liveCD, do a traditional install or install the liveCD onto a USB stick with persistent storage for personal files etc.), package management is a doddle, installing and uninstalling software is a breeze. I am just more productive using Ubuntu. After installing the OS, I just need to download a few extra packages and I can hit the ground running!

Also with regard to the desktop managers, the Gnome and Xfce desktops are really simple to customise and use. They are also comparatively lightweight (especially Xfce).

Personally, I've always found the KDE desktop to be a little counter-intuitive, it also seems slow and bloated and customising the look and feel can be a real ball-ache as there are so many needlessly complicated configuration options.

So for me it's Ubuntu/Debian and either the Gnome or the Xfce desktops!

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

Hell, there are shed-loads of distros that can be installed onto a pen-drive.

Depending on the capacity of your pen-drive, it could be anything from tiny distributions like DSL, Slitaz or Puppy, to full fat distros like Fedora or Ubuntu and everything in between.

Take a look at www.pendrivelinux.com it has instructions for installing many flavours of *nix on pendrives. 4Gb is probably enough to install a live version of virtually any distro. And most of 'em ship with some basic development tools, if only gcc, possibly also g++. But you'll still need to install additional development libraries.

Personally I've been running one of my laptops from an 8GB stick with Ubuntu installed for some time now. (Dead HD, can't afford a new one ATM!)
Alongside the Ubuntu liveCD stuff that went on there, I've added lots of other programs (Code::Blocks, MonoDevelop etc.) and development libraries (Boost, wxWidgets etc). And I've still got a good 2Gb or so left over for my projects/documents.

And it performs quite well too. The boot time isn't quite as fast as a native install of Ubuntu because it's basically a liveCD that can be used on virtually any machine, so it probes the system for hardware etc. each time it boots which takes some time and it also has to mount the virtual file-system, which also takes a little time. But the overall speed of the OS is good. However, because it uses a virtual file-system, read/write …

JasonHippy 739 Practically a Master Poster

Well, it's all academic now!
I've had no luck with my attempts to mount or open the virtual file-system that had all of my data on it, so I've just cut my losses and reformatted the USB drive and re-installed Ubuntu on it.

But I won't close this thread just yet, just in case anybody can post any insight that could be of use here should anybody else be having similar problems!

Jas.

JasonHippy 739 Practically a Master Poster

Personally I like to avoid the type of vendor lock-in imposed by the likes of Apple wherever possible. Plus there are a catalogue of problems I've had in the past with Apple and their products in particular, which I won't go into here.

Now, I'm not telling you to boycott Apple, or having a go at you for using 'em. I'm just saying because of what happened to me; I'm definitely not using any of their products again, be it hardware or software!

I'm probably lumped in with a very small, unfortunate minority of Apple users/customers/malcontents who've consistently recieved shoddy goods from them and also got shoddy support to boot. But it was enough to permanently turn me away from them. They've just lost all credibility with me!

Now, I'm sure they've probably improved their goods and services somewhat in the interceding years since those incidents, but I just don't want to take that chance any more or throw any more good money at 'em! But if you're having more luck with them, more power to ya! heh heh! :)

As far as I'm concerned Apple can shove their iMacs, iPhones and iPads up their collective aHoles! heh heh!

Anyway, getting back on topic; You'll probably think I'm some kind of luddite dinosaur or something, but I just use a cheap, generic mp3 player which I can plug straight into the USB port to copy music directly onto, before promptly rocking out! I don't even …

JasonHippy 739 Practically a Master Poster

As iamthwee has said, you need to install g++ to be able to compile C++ on *nix.

But if it's a C++ IDE you're after, then Code::Blocks is probably the best on *nix. Anjuta is another of the commonly used *nix C++ IDE's.

In both cases you'll still need to ensure that you've got g++ installed as both ide's are basically graphical frontends for gcc/g++!

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

Well if super-volcanoes, asteroids/meteors, solar flares/gamma blasts, or our own species' rotten stupidity and greed doesn't finish us off, I like Frank Zappas thoughts about the end of the world:

It isn’t necessary to imagine the world ending in fire or ice – there are two other possibilities: one is paperwork, and the other is nostalgia. - Frank Zappa

J.

JasonHippy 739 Practically a Master Poster

Hmm, that's a very interesting question...
I tend to listen to a lot of different music at work and at home, but my choices usually depend on my mood and my activity rather than any specific language I might be using.

For example, if I'm debugging code, reviewing code, or doing anything that requires intense concentration; I'll usually throw on something more atmospheric. e.g. light classical, folk, acoustic, light jazz, ambient, industrial, noise or drone. But the exact selection will depend on my mood, so it could be anything from Norah Jones to Merzbow.

However, if I'm banging out code, then it'll be something with a bit more energy. Again this would depend on my mood, but I usually select something that I can rock out to when code-jamming! So it could be virtually anything from rock, metal, thrash, death/black metal and grindcore to dance, glitch, drum & bass, electro and industrial. I usually choose something technical or unusual (Tool, Meshuggah, Venetian Snares, Frontline Assembly etc.), but sometimes you can't beat something simple that rocks out in straight 4/4!

So going back to the original question, no I don't listen to a particular genre when programming in a particular language. But if I had to equate a programming language to a specific music genre then I guess this would be my list:
Assembly/Machine code:
Industrial/Electro Pop/New Wave (think Kraftwerk, Throbbing Gristle or Devo), full-fat geek!

C++:
Math Metal (Meshuggah, Dillinger Escape Plan, …

JasonHippy 739 Practically a Master Poster

It's not often I start a new thread, but I've hit a bit of an unusual problem...Admittedly one of my own making...

I have a laptop with a completely dead HD, which I've been using for a while with Ubuntu 9.10 installed on a bootable 8Gb USB stick with approx 3Gb of persistent storage. I've been using it for a little while now and everything was going rather swimmingly until I ran Bleachbit to clear some space by cleaning some of the caches, but somehow it completely borked the install so it won't boot fully. (Not sure exactly how I did it. I obviously checked something I shouldn't have in Bleachbit!)

It gets to the LiveCD boot menu and I can start Ubuntu running, but beyond that there's just nothing. No splash, no desktop, just blackness. I can't even get ubuntu to boot into a command line from the menu....Like I said, Borked! (with a capital B!)

From analysing the contents of the USB stick, I can see that the liveCD contents are all there. But I can't find the home folder or any of the documents that are stored in there. But there are several large files that are approximately the right size to account for the allocated storage space for the home folder and all of the other parts of the system. So it's evidently some kind of virtual file-system that's in use. The files have seemingly arbitrary names consisting of letters, numbers and other …

JasonHippy 739 Practically a Master Poster

Ah, still no luck eh?

Hmm, I think I'm just about out of ideas!
Like I said installing the restricted extras was all I needed to do to get ffmpg onto my tablet PC. I can't really think of anything else offhand.

Otherwise, you'll have to persist in your attempts to build ffmpg from source....Perhaps the Ubuntu forums might have some better answers for you!

Sorry, I've been unable to solve your problem! {epic fail!}

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

OK. The reason I mentioned adding the repositories was because I thought that perhaps you didn't have the libfaac library on your machine. I was thinking that you were having trouble getting the libfaac library.

As mentioned in my previous post, after reading your first post again, it's obviously an error being reported by configure. The option --enable-nonfree needs to be specified somewhere to enable libfaac to be included in the build process....But as I said in my last post, I'm not sure where this needs to be specified.

However, now that you have the other repositories enabled, instead of building ffmpg from source, perhaps you could just use synaptic or aptitude to install the restricted extras package instead?
e.g.

sudo apt-get install ubuntu-restricted-extras

That should install the restricted extras (extra multimedia codecs and plugins etc), which will also install the ffmpg libraries which the gstreamer ffmpg plugin depends on.

The restricted extras package was all I needed to get ffmpg onto my Ubuntu 9.04 tablet! None of that building from source nonsense required. It may be worth a try!

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

Ah, I'm at work ATM, so I don't have a *nix machine handy.

But if memory serves the list of software sources is stored in

/etc/apt/sources.list

So you could perhaps try:

sudo {insert name of preferred command-line text editor here} /etc/apt/sources.list

e.g.

sudo nano /etc/apt/sources.list

Typically if the universe, multiverse and/or restricted repositories are disabled, their entries will be commented out in the file with a #. So to re-enable them you just need to remove the # character from the start of the lines they're listed on and then save the file.


Also, going back to your original post:
With regard to the build error you're getting, it looks like you need to specify the '--enable-nonfree' option somewhere.

Unfortunately, I'm still not 100% au-fait with the way that Linux/Unix software is built using configure and makefiles. So I'm not sure exactly where you need to specify this.

As a stab in the dark, perhaps when you run configure from the command line, you need to do something like this:

./configure --enable-nonfree

Otherwise it probably needs to be added to the configure script, or the makefile somewhere.

I'm still pretty lazy and wintarded with regard to the *nix build process. I tend to use CodeBlocks project files for most of my personal programming projects. The few other bit's of *nix software I've built from source using configure and makefiles have had simple dependencies, so I've had no reason to mess with any …

JasonHippy 739 Practically a Master Poster

Have you enabled all of the repositories in your software sources settings?
I think if you go to 'system->administration->software sources' and ensure that the universe, multiverse and restricted repositories are enabled, that might solve the problem.

Also why are you trying to build ffmpg? What's wrong with the version in the main Ubuntu repository? Have you tried installing it using aptitude or synaptic yet? I have 9.04 on my old tablet PC and it's got the version of ffmpeg from the main repo on it (I think it was part of the restriced extras package). Video playback and video conversion works fine for me!

JasonHippy 739 Practically a Master Poster

Yes, the two pages I linked to give details of the syntax, but if you read both of the pages in their entirety, they go on to explain some of the mechanics of the functions. I'll admit they don't go into detail about any differences between using them in user-mode or kernel mode, but it's a start at least!

However, there is nothing to stop you from browsing the Linux source code and taking a look at the read and write functions yourself. (Linux is open-source after all!). If you take a look at the sources, you should be able to work out what's going on for yourself! The site that Salem linked to would help with this.

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

See here and here you should be able to find everything you need from those two links, including these two pages:
http://linux.die.net/man/3/read
http://linux.die.net/man/3/write

Cheers for now,
Jas.

JasonHippy 739 Practically a Master Poster

Looks like it might be a bug in the update from Karmic to Lucid.

Take a look at this thread:
http://www.daniweb.com/forums/thread281259.html

Jas.

p.s. How is Lucid? I still haven't updated, so I haven't tried it yet!

JasonHippy 739 Practically a Master Poster

Whilst I agree that Ubuntu is a great Linux distro to get started with; Looking at the original post, the title mentions that the PC in question runs Windows ME, which implies to me that the hardware will be quite old. So perhaps a more lightweight distro would be in order.

I'd wager that Ubuntu would most likely be a bit too bloated and heavyweight for a machine of that age. However Xubuntu might be worth a try, dependant on the amount of RAM the PC has. But you'd probably have to use the alternate install CD rather than the liveCD..I think the liveCD of Xubuntu would still be a bit too heavyweight!

Failing that, perhaps WattOS (Ubuntu-based lightweight distro) or Zeven OS (a little known Xubuntu-based lightweight distro).

Otherwise there are plenty of other distros available like Unity, Slitaz, Vector, Zenwalk, Antix, Tiny ME, Puppy and DSL which are all geared towards running on older hardware. But like I said, it does depend on the exact specs of the machine.

There are shed-loads of different Linux distros out there and they're all free. So as long as you have a bit of free-time and a decent internet connection you can download several different versions of Linux per day. My advice is to take some time and shop around a bit. Take a look at distrowatch.com, google/search for lightweight linux distros, download some LiveCD's and find the distro that works best for you and …

JasonHippy 739 Practically a Master Poster

I've just noticed your question about software patents.
With regard to the patent issues surrounding Mono, this is a very valid concern and one of the more rational arguments against the use of Mono.

You can see some information about the issues surrounding the Mono patent problems on the wikipedia page for the Mono project:
http://en.wikipedia.org/wiki/Mono_%28software%29

The main points to note from the wiki page are:
1. Most of Mono. i.e. The actual part that implements the ECMA standard stuff for the C# language is probably free of any patent issues, but several components in the Microsoft compatibility layer of Mono (which isn't actually fully implemented, or required to develop or use Mono applications) is the part which is under dispute.

2. In 2009 Microsoft placed their ECMA specifications for C# and .NET under their community promise, meaning that they won't use their patents against anybody else who implements, distributes or uses alternative implementations of .NET. But their position on things not covered by their ECMA specs like ASP.NET, ADO and Windows Forms is still unclear (and it is these that are the main bone of contention with Mono, along with certain other windows .NET libraries that are not covered by the ECMA.).

Also mentioned is the fact that Microsoft signed a deal with Novell which protects Novells developers and customers from prosecution for developing/using Mono, but it doesn't cover anybody else using Mono. Because of this, people like Richard Stallman believe …

JasonHippy 739 Practically a Master Poster

01010111011001010110110001101100
00100000010010010010000001110011
01110101011100000111000001101111
01110011011001010010000001110100
01101000011000010111010000100000
01100010011001010110000101110100
01110011001000000110010001101111
01101001011011100110011100100000
01101001011101000010000001110100
01101000011001010010000001101111
01101100011001000010110101110011
01100011011010000110111101101111
01101100001000000111011101100001
01111001001000010010000000111010
00101001

JasonHippy 739 Practically a Master Poster

From what I've seen there are two main camps who are opposed to Mono. There are the Microsoft haters, many of whom simply dislike Mono because it implements C# and emulates the .NET runtime, which are both 'evil' Microsoft technologies. Others see the Mono runtime as an unnecessary, unwelcome and bloated addition to their system. There are other arguments used by various other groups who are anti-Mono, but those are probably the top two from the Microsoft haters!

Then there are all of the 'Windows only' Microsoft lovers/snobs who see Mono as an inferior version of .NET. The way they see it, Microsoft will always be one step ahead of the Mono project. Microsoft will introduce new features into .NET and the Mono project will follow on behind them like lost, scavenging dogs.

But this viewpoint doesn't hold a lot of water IMHO. Even if Microsoft does go ahead and add lots of new features to .NET, Mono doesn't necessarily need to try to keep up with them. What they've already implemented of .NET will do the job sufficiently. Mono already allows users of different platforms to be able to compile C# code on their native platform. (Which is the main thing)

All it will mean is that Mono applications would not have the most cutting edge features of the very latest version of .NET. But the core .NET features are still there and are enough to allow many developers to develop robust applications with.

As …

JasonHippy 739 Practically a Master Poster

It seems to me that the only reason these corporations are starting to persecute open source projects is because they represent a growing threat to their greedy profit margins!

This quote sums things up nicely (not sure who originally said it!):
Nothing is done for the common good where there is money to be made.

In recent years there has been a gradual swing towards using open source software. Personally I don't know a single person who owns a PC who doesn't use software from at least one open-source project. Obviously the corporations are waking up to that fact and now they are trying to do something draconian about it in order to protect their profits.

It's not like they aren't making enough money already is it? It's just playground bullying tactics taken to the nth degree. Are they really losing out on that much money due to open-source? If so, perhaps we aught to squeeze them a bit more by encouraging more people to switch to free/open source software.

The corporations know full well that even if they don't have a valid/solid case against an open-source project, the very threat of legal action would be enough to cause many projects to simply fold as I suspect most open source projects couldn't afford to pay the costs for legal help during any case against them. So in many cases fighting against such a lawsuit would be completely infeasible, probably causing them to settle out of …

rich3800 commented: To make a REASONABLE profit is the goal. +0
JasonHippy 739 Practically a Master Poster

Or perhaps just leave it as

else
JasonHippy 739 Practically a Master Poster

Try adding the following include:

#include<WinReg.h>

Cheers for now,
Jas.