Stefano Mtangoo 455 Senior Poster

So where is your code and How do you do that?
I would refrain from Long dead IDE like DevCPP and get decent one like C::B or Codelite.
I use CodeLite

Try this example and see if it compiles

//
// Simple retro-style photo effect done by adding noise to
// the luminance channel and reducing intensity of the chroma channels
//

// include standard OpenCV headers, same as before
#include "cv.h"
#include "highgui.h"

// all the new API is put into "cv" namespace. Export its content
using namespace cv;

// enable/disable use of mixed API in the code below.
#define DEMO_MIXED_API_USE 1

int main( int argc, char** argv )
{
    const char* imagename = argc > 1 ? argv[1] : "lena.jpg";
#if DEMO_MIXED_API_USE
    // Ptr<T> is safe ref-conting pointer class
    Ptr<IplImage> iplimg = cvLoadImage(imagename);

    // cv::Mat replaces the CvMat and IplImage, but it's easy to convert
    // between the old and the new data structures
    // (by default, only the header is converted and the data is shared)
    Mat img(iplimg);
#else
    // the newer cvLoadImage alternative with MATLAB-style name
    Mat img = imread(imagename);
#endif

    if( !img.data ) // check if the image has been loaded properly
        return -1;

    Mat img_yuv;
    // convert image to YUV color space.
    // The output image will be allocated automatically
    cvtColor(img, img_yuv, CV_BGR2YCrCb);

    // split the image into separate color planes
    vector<Mat> planes;
    split(img_yuv, planes);

    // another Mat constructor; allocates a matrix of the specified
        // size and …
Stefano Mtangoo 455 Senior Poster

And FYI: there are several GUI RAD builder for wxWidgets, both commercial and free
Commercial:
wxDesigner By wxDeveloper Robert Roebling
DialogBlocks By wxDeveloper Julian Smart

OSS:
wxSmith - Inbuilt with Code::Blocks
wxFormBuilder - Stand alone inheritance driven RAD
wxDevCPP RAD - inbuilt designer in wxDevCpp

See here for comparison

NicAx64 commented: g00d +2
Stefano Mtangoo 455 Senior Poster

I'm having trouble even beginning to GUI program in C++. I'm using DevC++ with WX widgets and I've downloaded the DevPac.
I really need something to help me understand the basics. For example. How would one go about creating a project and programming a GUI applicatin. Also, when you compile a project (i've compiled some of the ready made examples) why is there so many files generated along with it? I've probably done something wrong.

Is there a good book to explain the basics of GUI programming? Or a good and detailed article. I was hoping there was a book like GUI Programming for dummies or something which will spell it out for me as I've having trouble reaching the starting line.

Thanks to anyone who can suggest anything.

Danny2000

Hi Dan,
I would suggest you get decent compiler/IDE. You can choose Either C::B, CodeLite or wxDevCpp which is well maintained version of DevCpp. Then get yourself up on C++. For GUI with wxWidgets, use the official book PDF for free and get your head on it. Then try yourself to do something and for any question, ask here or in wxForum Also there is very active mailing list, well supported by developers of wxWidgets. You can browse wxWiki and get some docs there. Don't forget to visit home page for more info

As of IDE, I'm biased like anyone else and I recommend CodeLite …

Stefano Mtangoo 455 Senior Poster

but i used c++ and its work

printf and scanf aren't c++ but C.
that said, here are some links to push you:
http://www.daniweb.com/forums/thread10660.html
http://www.daniweb.com/forums/thread136139.html
http://www.daniweb.com/code/snippet216707.html

Are you using Borland Old compiler? ;)

Stefano Mtangoo 455 Senior Poster
$q="select all from news where author id='$id'";

Whuch Kind of database is his?
AFAIK, it should go like this:

$q="SELECT * FROM news WHERE author id='$id'"
Stefano Mtangoo 455 Senior Poster

The code is working now. The change you suggested in addition to few other changes worked. Thanks a ton.. :). Will be posting the working code soon.

And please use code tags. I have found very difficult to follow your code without an editor here

Stefano Mtangoo 455 Senior Poster

Who make better programmers? Men or Women? :) Just curious coz all around the world, in academics, women surpass men. But in this field, i guess its men :). What you say? I am a male by the way!

We have at least Narue(female) and Ancient Dragon (Male) and they are both competent and helpful friends here. I'm confident to call them C++ experts. So what's your question?

Gender have nothing to do with their being that way but rather learning and practice and learning and practice and L&P&L&P...to death!

Stefano Mtangoo 455 Senior Poster

so what is the problem? Did you try any of above, or even bother to read my post?

Stefano Mtangoo 455 Senior Poster

little ahead of intermediate i would say. but not at a high advance level. so basically if it was from those choices il go for advanced

Here is my guide to simplify life:
1. [optional but very helpful] Design UseCase diagram to show interactivity of your system components. I have found ArgoUML a good tool to do this.
2. Design your database and relationships. I have found MySQL workbench very helpful and the best, at least for me. From WB you can export sql dumps et al.
3. Design how your interface will look like. You can use even MS word or anything to draw (Even a paper)
4. Design rough interaction of UI, Java Classes/Servlets and Database
5. Implement no 4.
6. Refine your system, adding and removing until you feel it is ready for BETA test ;)

Take a jump and I will be happy to help if you hit a wall

Stefano Mtangoo 455 Senior Poster

I did struggle when i was installing fedora onto my laptop, but installing ubuntu seemed a little easier. Maybe it was because i had no prior experience in linux installations. But i still prefer fedora to ubuntu probably because its a tad bit more challenging to use.

I agree with you in that Ubuntu have things simplified. Installation is breeze and simple :)

Stefano Mtangoo 455 Senior Poster

Hi hielo & evstevemd,

Thanks a lot for your replies :).

@hielo:
Actually I am having a huge number of PHP files that should be accessed using Ajax. So I have to change the code of each an every PHP file to make it compatible with Ajax requests :(. I was wondering whether there is a solution without touching the PHP files :(. Anyway thanks a lot for taking some time to reply me.

@evstevemd:
I am using jQuery $.post to send Ajax requests. It works fine for non redirecting PHP scripts, but when PHP script calls the redirect function, it works in an unpredictable manner :(. May be I am using it incorrectly :/. I will go through the jQuery documentation and try it again. Thanks a lot for your reply.

If anyone knows how to handle it using jQuery $.post please be kind enough to share it with me :)

Thanks a lot

Hielo have said it well, but I would avoid that code complexity by removing the redirection instruction in my php and just *load* the php file to be redirected to in post callback function; roughly something like below. But for that, you have to "touch" PHP files. If you don't want to touch them, then check Hielo's method. Again, we don't know what the pages does exactly but it is worth to check JQuery append if page.php and redirect.php are to *not* overwrite the content of a div

$.post('page.php',params, function(){ 
   	$('#yourDisplayDiv').load('redirect.php');
  
      });
Stefano Mtangoo 455 Senior Poster

Must it be Jsp?
If no then go for MySQL workbench. It is great app for design, Administration and Querying MySQL database. If it must be JSP then learn JDBC.

Stefano Mtangoo 455 Senior Poster

level as in ?

Programming skills level. Expert, Advanced, Intermediate, NewBee?

Stefano Mtangoo 455 Senior Poster

thanks all.
I think I have to separate them.
My dream have turned into boost nightmare ;)

Stefano Mtangoo 455 Senior Poster

Hi All,

I have a PHP code which do some changes to the POST variables it receives and redirect the page to some other page. This PHP code was initially designed to work without Ajax. So there wasn't any problem with the redirect function and it perfectly handles the POSt variables and redirect the user to another page.

So now I want to use the same PHP code with Ajax... :)
I tried it and and it did not gave me the results I was expecting. Problem is with the redirect function. Other PHP lines execute perfectly fine( it stores some data in the database).

So is there any way to ignore the redirect call or just to filter out the redirecting url into a javascript variable ?

Thanks in advance for taking some time to read this

I would recommend JQuery library for easy AJAX calls. With JQuery, you just select the element (Let say a Div) and clear it. then AJAXically get the content of page you want to redirect using load() function. Read the $.post, ajax() and load as well as selectors

Stefano Mtangoo 455 Senior Poster

I want to pass a character not a string

Isn't Character a string with length 1?

Stefano Mtangoo 455 Senior Poster

what is your level?

Stefano Mtangoo 455 Senior Poster

Check W3school

Stefano Mtangoo 455 Senior Poster
Stefano Mtangoo 455 Senior Poster

Your problem is that those function do not belong in you abstract class. It seems like you are not abstracting enough, if you want only
some function of the base class to be implemented. Whats wrong with simply letting the child develop the necessary functions? You might
not necessarily need polymorphism depending on your problem. If you want state your problem and we'll be glad to help.

FP,
It is kind of plugin app. The Plugins *must* implement some methods and other are *optional*. So I don't want to force them to implement optional features. The issue is Plugin manager when loading the plugin instances, it casts them to pointer to Abstract class. For that manner if method isn't defined in AC, then I cannot use it, you see.

Stefano Mtangoo 455 Senior Poster

>What do you mean by "all with no-op bodies"
An empty body, such that when the member function is called, it returns immediately with some suitable default:

virtual ResultSet getResults() { return ResultSet(); }

I want default value to be NULL so that whenever I encounter NULL I know that there is no implementation for this function. I wonder If NULL will be suitable for function that returns some type of value (Non void functions)

Stefano Mtangoo 455 Senior Poster

>I want its kids to be concrete classes But I don't want to implement the all methods of the class.
Oddly enough we just had a discussion about this. You can make the "optional" member functions simply virtual instead of pure virtual (all with no-op bodies). Then include a pure virtual destructor in the base class to make it abstract if there are no more pure virtuals left in the base class.

It's not a perfect solution, but depending on your actual needs as opposed to the description you've given, it may be suitable.

seem something i'm looking for :)
What do you mean by "all with no-op bodies"

Stefano Mtangoo 455 Senior Poster

What do you want to happen when you do this?

SecondChild sc;
sc.setResults("foo");

and how do you want what happens to differ from what happens when you do this?

BaseDB b;
b.setResults("foo");

In both cases, you're trying to call a member function that isn't defined.

I want them to be dummy functions, because Child classes will choose which one to implement. If they implement some of them and leave some, it will still be abstract class. So I'm finding a way to implement a sort of "default" function in case user doesn't want.
I just have no Idea how to make those dummy/default functions.

Stefano Mtangoo 455 Senior Poster

Just wanted to point out that because there are more threads in the Windows forums than Linux doesn't automatically mean it's more stable or in any way better. Actually it just means that more people use Windows and that the people that use Linux are more technical therefore needing less help. And why do people still use Windows? Because we live in a world governed by money, not ideals, you should know that.

We don't have stats, so anyone of you can be wrong.
But AFAIK, windows have more problems than Linux.
I have used windows for long time and Linux too and that is my verdict from experience.
(I have used MS 95, 98, ME, 2000, XP, Vista and Ubuntu 8.04, 10.04 and Mandriva 2010)

Stefano Mtangoo 455 Senior Poster

Lets not forget wxWidgets as well. Like QT its cross platform, it allows the user to plug in OpenGL or use GDI(on windows), not sure what the GDI equiv on linux is. Qt may also support this i dont know but from what litle i have done with wxWidgets it seems like a good job. Code::Blocks supports wxWidgets, Qt and win32 so i would suggest trying it out as an IDE to compare which GUI toolset you like best. The only thing i can mark VS as better for is that its intellisence is more sophisticated but as again code::blocks is crossplatform i decided to start to use it instead.

To be fully honest i think which GUI toolset you choose to use will depend on which one feels right and makes most sence to you individually.

I second wxWidgets.
It is great toolkit, with native widgets in platform and great docs/Support. There are a lot of Apps made of it, some listed on wxwidgets.org. About IDE, there are plenty of them, all supporting some form of GUI builder (some: Codelite+wxFormBuilder, C::B+ wxSmith, wxDevcpp et al)

I would suggest you go for wxWidgets+CodeLite+wxFormBuilder. If you want to support wxWidgets, buy then DialogBlocks, GUI builder and IDE by "father" of wxWidgets, Julian Smart.

Stefano Mtangoo 455 Senior Poster

Hi,
I have abstract base class with some kids deriving from it. I want its kids to be concrete classes But I don't want to implement the all methods of the class. I'm trying to find a trick to go around doing this and I'm running out of thought on this. below is illustrative code of what I want to do.

Thanks for your help

class BaseDB {
	BaseDB();
	virtual ResultSet getResults()=0;
	virtual void setResults(std::string sql)=0;
	virtual void someMoreFunction()=0;

};


class FirstChild :public BaseDB {
	ResultSet getResults(){
		//do some stuffs
	}
	
	void setResults(std::string sql){
		//some more stuffs
	}
	
	//I don't want to implement someMoreFunction() in this class
}

class SecondChild :public BaseDB {
	ResultSet getResults(){
		//do some stuffs
	}
	
	void someMoreFunction(){
		//some more stuffs
	}
	
	//I don't want to implement setResults(std::string sql) in this class
}
Stefano Mtangoo 455 Senior Poster
Stefano Mtangoo 455 Senior Poster
Stefano Mtangoo 455 Senior Poster

Shell is something you interface with OS via Black screen.
For Linux is something like bash and windows is CMD

Kernel is the heart of OS, shell is not
Some links for brushing:
http://www.pcguide.com/vb/showthread.php?t=6424
http://www.linuxforums.org/forum/linux-newbie/9164-shell-kernel.html
http://www.allinterview.com/showanswers/65174.html

Stefano Mtangoo 455 Senior Poster
DROP tabble_name ;

don't condemn me, that is from heading ;)
Now, seriously PMC have got it!

Stefano Mtangoo 455 Senior Poster

What about this tutorial? Or even this one?

Stefano Mtangoo 455 Senior Poster

MY question is,
like we do for integer and float,
Integer.parseInt(args[0])
Float.parseFloat(args[1])

How do we take character input from command line ?

Those are methods to convert stuffs since command args are passed as Strings (i.e String[]).
So to get a string it is as easy as

String argX = args[i];//to get the i-1th argument
Stefano Mtangoo 455 Senior Poster

The second method is actually using Exception handling:

#include <iostream>
using namespace std;
#include <stdexcept>

int main()
{
int [] arr1 = {10,69,30,12,11,34,56,78,35};

for ( int i=0; i<max; ++i )
{
try{ cout << "Data: " arr1[1] << endl; 
}
catch (out_of_range &ex) { 
cout << e.what() << endl; //the error message...
}
}

return 0;
};

This is more funny!
Good work for submitting to a professor teaching you Java ;)

Stefano Mtangoo 455 Senior Poster

There are two ways I know you can go about using exception handling to solve your question.

The first way is the use if simple if-statement:

for ( int i=0; i<max; ++i )
{
if (! (i < 0) || (i >= max) ) { cout << "Data: " arr1[1] << endl; 
}
}

The second method is actually using Exception handling:

#include <iostream>
using namespace std;
#include <stdexcept>

int main()
{
int [] arr1 = {10,69,30,12,11,34,56,78,35};

for ( int i=0; i<max; ++i )
{
try{ cout << "Data: " arr1[1] << endl; 
}
catch (out_of_range &ex) { 
cout << e.what() << endl; //the error message...
}
}

return 0;
};

Sounds like Home work.
I don't like to help people earn your degree. They should earn by their efforts.
So show efforts first

Stefano Mtangoo 455 Senior Poster

If boost chokes you try POCO
I think the docs are reasonable and forum is there for asking questions

Stefano Mtangoo 455 Senior Poster

have you seen libmad?

Stefano Mtangoo 455 Senior Poster

I second Bruce's Thinking in C++.
I have read Java counterpart and I can say he is good writer.
Apart from that check the links:
http://www.cprogramming.com
http://www.cprogramming.com/tutorial.html
http://www.cplusplus.com/
http://www.cplusplus.com/doc/tutorial/

Stefano Mtangoo 455 Senior Poster

Don't use database/table name in displaying result

while($rows = pg_fetch_all($myresult))
{	
	echo "<pre>";
	echo "<div>".$rows['timestamp']."</div>";
}
Stefano Mtangoo 455 Senior Poster

I'm getting used to be called "man". this is crazy.

Add to your signature
Ms. Kim and put it in little large fonts. May be it will reduce the count ;)

Stefano Mtangoo 455 Senior Poster

not mega-maverick but may I suggest Code Igniter.
It have a lot of classes coded by experts for you to use.
You can use it with Ajax calls too

Stefano Mtangoo 455 Senior Poster

also see this

Stefano Mtangoo 455 Senior Poster

Thank you guys. I am learning and I appreciate your help. Sometimes the challenge is to know what to even call your search in Google.

I got #1 of my question to work, but I am still struggling with #2.

I have tried many things but here is what I have now. Database is called playerdb and the table I want to show data from is also called playerdb.

<? php
$result2 = mysql_query("SELECT UPDATE_TIME FROM playerdb AND TABLE_NAME = 'playerdb'");


echo "Last updated on : $result2";


?>

I appreciate any help.
Cheers

You need to add column in your table that will store last update time that will be modified each time the row get modified

Stefano Mtangoo 455 Senior Poster

You can search this forum for even more examples.

I second that, this is kind of FAQ, and a lot of practical examples.
Just pick one and post any problem you get (There is nice example from PHPMyCoder)

Stefano Mtangoo 455 Senior Poster

what does this mean:

action="<?=$_SERVER?>"

and this:

value="<?=$data?>"><?=$data

<?=$_SERVER?> refers to the same file, that is the same file currently being executed. suppose the code is in index.php, when you call <?=$_SERVER?> it means you are calling index.php

value="<?=$data?>"><?=$data fills html value with data from array with index id and name

hope you get it :)

Stefano Mtangoo 455 Senior Poster

Just to point error in your original code,
what this is supposed to do?

if(count == 10);

AFAIK, it should be something like

if(count == 10){
 //do some funny stuffs here
}
Stefano Mtangoo 455 Senior Poster

Now I have resolved the stack direction thing I have this error:
Note that, the line 415 in my_global.h is simple ifdef include

#ifndef stdin
#include <stdio.h>
#endif

here is error
----------Build Started--------
C:\WINDOWS\system32\cmd.exe /c ""mingw32-make.exe" -j 2 -f "learn MySQL_wsp.mk""
----------Building project:[ basics - Release ]----------
mingw32-make.exe[1]: Entering directory `C:/Documents and Settings/stefano/Desktop/C++/learn MySQL'
gcc -c "C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/main.c" -DSTACK_DIRECTION=1 -o ./Release/main.o "-I." "-I." "-I./mysql"
In file included from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/mysql/my_global.h:76,
from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/main.c:1:
./mysql/config-win.h:203:1: warning: "finite" redefined
./mysql/config-win.h:161:1: warning: this is the location of the previous definition
./mysql/config-win.h:245:1: warning: "STACK_DIRECTION" redefined
<command-line>: warning: this is the location of the previous definition
In file included from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/mysql/my_global.h:415,
from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/main.c:1:
c:\mingw-4.4.1\bin\../lib/gcc/mingw32/4.4.1/../../../../include/stdio.h:491: error: expected declaration specifiers or '...' before '(' token
c:\mingw-4.4.1\bin\../lib/gcc/mingw32/4.4.1/../../../../include/stdio.h:491: error: expected declaration specifiers or '...' before '(' token
In file included from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/main.c:1:
C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/mysql/my_global.h:616:1: warning: "my_reinterpret_cast" redefined
In file included from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/mysql/my_global.h:76,
from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/main.c:1:
./mysql/config-win.h:307:1: warning: this is the location of the previous definition
In file included from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/main.c:1:
C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/mysql/my_global.h:1566: error: static declaration of 'rint' follows non-static declaration
mingw32-make.exe[1]: *** [Release/main.o] Error 1
mingw32-make.exe[1]: Leaving directory `C:/Documents and Settings/stefano/Desktop/C++/learn MySQL'
mingw32-make.exe: *** [All] Error 2
----------Build Ended----------
5 errors, …

Stefano Mtangoo 455 Senior Poster

Hi,
please help me with error.
I want to run simple project below.
I have a lot of errors below and don't know how to fix it.

I use GCC port (Mingw)

#include "mysql/my_global.h"
#include "mysql/mysql.h"
#include <stdio.h>

int main(int argc, char **argv)
{
  printf("MySQL client version: %s\n", mysql_get_client_info());
}

error
----------Build Started--------
C:\WINDOWS\system32\cmd.exe /c ""mingw32-make.exe" -j 2 -f "learn MySQL_wsp.mk""
----------Building project:[ basics - Debug ]----------
mingw32-make.exe[1]: Entering directory `C:/Documents and Settings/stefano/Desktop/C++/learn MySQL'
gcc -c "C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/main.c" -g -DSTACK_DIRECTION=1 -o ./Debug/main.o "-I." "-I." "-I./mysql"
In file included from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/mysql/my_global.h:76,
from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/main.c:1:
./mysql/config-win.h:203:1: warning: "finite" redefined
./mysql/config-win.h:161:1: warning: this is the location of the previous definition
./mysql/config-win.h:245:1: warning: "STACK_DIRECTION" redefined
<command-line>: warning: this is the location of the previous definition
In file included from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/mysql/my_global.h:415,
from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/main.c:1:
c:\mingw-4.4.1\bin\../lib/gcc/mingw32/4.4.1/../../../../include/stdio.h:491: error: expected declaration specifiers or '...' before '(' token
c:\mingw-4.4.1\bin\../lib/gcc/mingw32/4.4.1/../../../../include/stdio.h:491: error: expected declaration specifiers or '...' before '(' token
In file included from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/main.c:1:
C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/mysql/my_global.h:616:1: warning: "my_reinterpret_cast" redefined
In file included from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/mysql/my_global.h:76,
from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/main.c:1:
./mysql/config-win.h:307:1: warning: this is the location of the previous definition
In file included from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/main.c:1:
C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/mysql/my_global.h:1566: error: static declaration of 'rint' follows non-static declaration
mingw32-make.exe[1]: …

Stefano Mtangoo 455 Senior Poster

And as for the jquerey, I was avoiding using it as It really requires ALL users to have this effect to really make it work. I may still add a fade in fade out for the people with javascript enabled. But that's the reason I didn't want to do it that way, not matter how much i'd like too.

Whoever disables JS then will miss a lot of goodies in this world

Thanks to eveyone that helped out :)

Glad you resolved
Cheers :)

Stefano Mtangoo 455 Senior Poster
Stefano Mtangoo 455 Senior Poster

Download the free Visual Studio 2010 Express Edition. It has C# and C++ on board. See if this can be a starting point to learn C#. And NO, I'm not a guy from MS :icon_cheesygrin:

Thanks for try to convert me to windows ;)
The problem is I'm X-platform fan, so that won't work.
I plan to go for mono, but I don't know good deal of differences and where to start.
All I know is mono has something to do with C# and that it have Banshee, my favo Audio Player made with it :)

So where do I start programming with Mono, having zero knowledge of C#? and how does Mono differe from M$'?