richieking 44 Master Poster

So maybe post your code and we can start from there.
Also without any experience in signals and slots, You do not have any chance in GUI. Thats the whole point of GUI.

richieking 44 Master Poster

You may wanna change your class name to say txt or whatever.
Array is a C++ lib. MosChops just warned you aboout that.
Now add change to say class txt and add this code.

   enum {MAX_INT=5};// global enum

  bool operator ==(txt a){
      return a.getSize() == getSize();
            }

    const int getSize(void)const{
        int sum  = 0;
        for (int x=0; x < MAX_INT; x++) {
            sum += arr[x];
        }
        return sum;
    }

I want you to figure things out yourself.

richieking 44 Master Poster

And what do you mean by manually?
Please explain....

richieking 44 Master Poster

First of all your your design or approach to your idea is wrong.
you must understand or read more about templates. Every template must be initialized with a data type.
1.Example: in the main I don't see that. Eg. Node<?> *foo. Etc.
2. Your there is no data in your
container to manipulate. You must put data first because how do you want to printque if it's empty.??

Form HTC 816.

richieking 44 Master Poster

So what is your problem now??
Do you have any issues??

richieking 44 Master Poster

ok i will be very brief with my answer.
Your question:

since "state" is a pointer, why doesn't -> work? ptr[i] -> state = num; // doesn't work. why?

Yes it will work only if you understand how pointers work.
1. when you operate on pointers like *ptr[i].state=num; you loose the pointer in the way pointer is been called. you subscript or dive into the container. Something like a manual operation.
You can code like ptr->state = &num; to put the address of num into the state pointer how ever your intensions are different.
You are mixing apples and oranges. You need to understand both skills.
Also understand the differences between the 2 datatype.
int *state is an int pointer which its used commonly in 3 different ways due to safety but other people may diffe as this is entirely my point of view.
1. state = new int;
2. state = &num;
3 state = num; where num is an int pointer.

Your last question:

// cout << ptr[i] -> state; // doesn't work. why?
Because ptr has lost the pointerness. You have traded off its power as a pointer to a mere array. Arrays and pointer shares some similarities and this operation is one of them. Its called indexing.
You could write cout << ptr->state; but that will cause 3 errors according to what you wanna achieve.
1. You will recive the address of …

richieking 44 Master Poster

void Database::getPNResults(bool* bErrors)

can you show how you called this fuction in your code?
Also understand the basic use of a pointer.
Pointers on creation are initialized to point to a specific memmory or points to a 0/NULL.

I stand to be corrected but If you dont follow this basic rules, you will fall into a segfault/null pointer errors just like what you have now.

richieking 44 Master Poster

Deleting data in vector comes with a lot of work. For your operation, you need to consider list.

Now based on your code , from line 49 to end. i dont personally like how you are dealing with the vector. vector comes with iterator to use to loop through your vector.

on line 60 your if statement must look like this
if(userDetails[i].getUserName()==name){
userDetails.erase(userdetails[i]) ;
userDetails.resize();
}

Vectors limitation is this form or operations so next time plan your tasks very well and think about which libs to use.

richieking 44 Master Poster

Can you show your code?

richieking 44 Master Poster

I will use associative array or any think like a hash.
read in the string and insert it into the object.
pseudo

user dataType<string,int> foo;
string data;
getline(cin,data);

loop through;
for(int c =0;c< data.lenght();c++){
//now yu check to see if the letter has been entered before.
//in this case string is the key and int is the value.
if(foo.key(c)==c){
int v= foo.getValue(c);
foo[c]=v+1;
}
else{
foo[c]=1;
}

}

Got the idea??? simple

richieking 44 Master Poster

Next time show some code ok?
int foo = sizeof(array)/sizeof(int);

richieking 44 Master Poster

Yes you did

richieking 44 Master Poster

Mate you miss the road. This is not java but CPP pot. Get out....

richieking 44 Master Poster

sure well said; on line 1 ; is the bad fox.

richieking 44 Master Poster

Your problem is number 12 in the while loop. The logic was not right.
try this

string data;
static int count=0;
while(getline(d_file,line)){
    data +=line;
    count++;
    if(count==2){
        user_vec.push_back(data);
        count=0;
    }
}

you caould have had the data setup the way you want before inserting into the vector. Its called planning.

richieking 44 Master Poster

counted_ptr must be a template/generic type which is well designed.

template<class T>
count_ptr{
  count_ptr():t(tp){}
  operator()(){}
  operator +(){}
  operator=(){}
private:
  T t;
};

int main(){
//class foo object  bar
foo bar;

// now count_ptr serves as a container that can accept and manipulate class 
//foo objects.
count_ptr<bar> count_ptr_bar.


}

get back to the basis of generics.
send from my phone so its not a working code. just the righ path.

richieking 44 Master Poster

No one will go the those link for you. Provide your code and your errors and we might have a look at them.

we dont get paid for anything here... remember that.

richieking 44 Master Poster

That says all about MS VC++. I compiled and run copy on my phone, later at home on my ubuntu and that was perfect. Also sure copy uses memmove() because C++ is build on C but copy is one of the best and easy way to achieve the said trivial task. Thats my take. ;-)

richieking 44 Master Poster

that was not my intention.... i wanted to explain or proof why i support the copy method instead of the old style iteration.

Also the las code was a typo i made.

int *exp(int *arr, int size){
    int *temp=new int[size*2];
        temp=arr;
        for(int i=size;i<size*2;i++)
            temp[i]=i*2;
    return temp;
}

the mistake was using simgle data alloc.
ofcourse this can be optimised to call delete on temp.
Whats your say Dragon? I need your view mate. yea it trivial but hay is fun.

richieking 44 Master Poster

or this.

int *exp(int *arr, int size){
    int *temp=new int[size*2];
    for(int x=0;x<size;x++)
        temp[x]=arr[x];
    return temp;
}

but for quality... i will use the copy method.

richieking 44 Master Poster

You are right if you go about it that way.
Another best form is to use the Algorithm copy.
like this

int *exp(int *arr, int size){
    int *temp=new int(size*2);
    copy(arr,arr+size,temp);

      return temp;
}
richieking 44 Master Poster

Asigning array of the same data type which is bigger copies the data. so i think its more efficient this way.

nt *exp(int *,int);

int main(){

    int ar[]={4,3,7,5,7,8,6,5,4,2};
    int *foo;
    foo = exp(ar,10);
    for_each(foo,foo+10,[](int &c){ cout <<c<<endl;});


  return 0;
}


int *exp(int *arr, int size){
    int *temp=new int(size*2);
      temp = arr;
      return temp;
}
richieking 44 Master Poster

your code is even more error prone. memory leaks.
new allocation always need to be freed.
On line 16. for something simple like this, there was no need using new alloc. just simple

const int foo=10;
int afoo[foo];

something more simpler and effective for basic data ops. The point is you are allowed to do as you please but clean our mess after.

Just a cup of coffee advice.

richieking 44 Master Poster

MixedExpression.cpp.
Look at line 94 bout printdata method. The logic is not right.
You seem to read data to out output file object but not printing to screen. check your logic and debug well.

richieking 44 Master Poster

you need to chmod the file. i think is os.chmod(filname,octal value)

richieking 44 Master Poster

Vegaseat be nice will you.?
yea i faultered. Its PYTHON. thanks for your tip ))

richieking 44 Master Poster

you need to put the ode that opens the file in try-except braces.
Then open a wxMessagebox inside the catch(exeption) brace. Its been along time i worked with wx but the style and logic is the same on GUI's.

try{
    open file()
    }
except(msg){
     wxMessageBox(values,message,...)
     }
richieking 44 Master Poster

it is function / method overloading.

operator overloading is quiet a different stuff. ))

richieking 44 Master Poster

hay buddy work on this .
i have not check it but should work.

chunk_val = raw_input("chunk values : ").lower() # values to search

check_val = raw_input("check stuff : ").lower() # search values. dont repeat search values. eg values appears once for checking
data ={}  #dir to keep distinct

for c in chunk_val:    #ussual stuff
    for x in check_val:
        if x == c:
            print c+"\n";
            if c not in data.keys():
                data[c]=1
            else:
                data[c] = data.get(c)+1

print " ".join((["-" for x in range(10)]))
for x in data.values():
    print(x)


print data  # debug dir
richieking 44 Master Poster

very strange. can you show your code?

richieking 44 Master Poster

Also you can bring the innitializing of the
int[] values = new int[numbValues]; into the constructor.

 Object(int numbValues) {
values = new int[numbValues];
this.numbValues = numbValues;
}

but leave the declaration outside .
that is
`int [] values;'

By this you will be fine also.
that means you will need to called the class with a value new Object(33);

nostalgia commented: Solved my problem, thanks! +0
richieking 44 Master Poster

Can you be kind to yourself and show us some code dear friend?

richieking 44 Master Poster

That is the getters and the setters methods.

richieking 44 Master Poster

Sometimes its more easier to do a prototype as NormR1 said.
Nice you got it fix

richieking 44 Master Poster

TrickyT show what you have done so far ok..?

richieking 44 Master Poster

please close the thread.

richieking 44 Master Poster

sorry its fillRect..
pardon me ...

richieking 44 Master Poster

reduce the setColor values to (0,0,619,419).

Image may overlapse as the size are identical hence ot of bounds error. try that!

richieking 44 Master Poster

Look at the thi...

template <class R, class A1, class A2, class A3>
inline typename _TessFunctionResultCallback_0_3<false,R,A1,A2,A3>::base*
NewPermanentTessCallback(R (*function)(A1,A2,A3)) {
  return new _TessFunctionResultCallback_0_3<false,R,A1,A2,A3>(function);
}

notice that you used class for the

template <class R, class A1, class A2, class A3>

but you have use a typename for the method. Atleast either you use a class for type or the typename keyword to make things uniform.

also until one got the full code to compile and run. detecting errors like this is eternal work.

First, thank you to both of you, I answer below:

Yes, I understand that the problem is with code-B, but what I don't understand is why is giving an error if I am changing nothing in the code. Just to be clear:

- I downloaded this external library.
- I created a new project (the one you call code-A) with VS2010 and added openCV and this external library (adding headers and libs).
- I wrote few lines of code using this library. Compiles OK and works.
- I opened my bigger project (code-B), that has also openCV and run it. Compiles OK and works.
- I added the headers and libs of the external library in the properties panel, the same way as I did in code-A, and I do not add or change anything in the code-B. If I try to compile, it gives the errors mentioned.

I know that I might be repiting myself, but I don't understand …

richieking 44 Master Poster

Most of the IDE's may tell you the line where you got these errors. Also as stated by the errors, fixing it is just a simple thing. At least for now you know what the problem is. That is the begining of the solution. :-)

richieking 44 Master Poster

but why bothering yourself about char for switch???
Use int which is very clean and really the best for switch.

logic means less complications but efficient.

int asn;
cin>>ans;
switch(ans){
  case 1:
   break;
  case 2:
   break;
 default:
  break;
}

very simple. why ASCII for a simple algo.? Why make it complex if you can make it simple and effective.?

richieking 44 Master Poster

Also to what AD said. You must always assign 0 to a pointer after you delete. So that you dont get a pointer hunging around with unknown memory.

bar *foo = new bar;
         foo->set_name("name");
          foo->get_name();
          delete foo;
       foo = 0;

To release 100% the memory and secure the pointer's behaviour.

richieking 44 Master Poster

Because of this memory problem the creator of C++ came up with pointers and dynamic memory.

Look into that if you need a memory management.

richieking 44 Master Poster

Sofia, Can you please show some organized data info.?? dealing with what you got shown here is virtually not possible.

richieking 44 Master Poster

nice one.

list comprehension gives python the style and beauty with smooth power to do great tasks easy.

richieking 44 Master Poster

Try this

>>> print "\n".join([x for x in "dog,cat,bird,good,bad,blah,blah,blah".split(",")])
dog
cat
bird
good
bad
blah
blah
blah
>>>
richieking 44 Master Poster

Thanks for your reply, following is my full content. All I need is to display the textarea content after submitting the form.

File Name - TEST.PHP
File Content

<?php
echo "Question = ".$_POST;
?>

<form name=f1 method=post action="test.php">
<textarea name="question"></textarea>
<input type="submit" value="Submit">
</form>

You have an internal error because your php code is wrong.

<?php
       echo "Question = ".$_POST['question'];
     ?>

should be

<?php
       echo "Question = "$_POST['question']; // $_GET['question'] depending on post/get
     ?>

pay attention to $_POST[] global var.
not .$_POST[].....
Take away the dot ok?

richieking 44 Master Poster

For some reason it just jumps to the else statement instead of going to if and elif.
Any input would really be apreciated.

a=raw_input( "What is your name: ")
b= int(raw_input( "What year were you born: "))
c= int(raw_input( "What year is it now: "))
print "Hello",a,"you are",c-b,"years old."
class object():
    'userAge'== c-b
    'teenager'== (13,14,15,16,17,18,19)
    if 'userAge' <=12:
         print "You are really young"
    elif 'userAge'=='teenager':
         print "You are a teen"
    else:
         print "You're really old."
         
         
object()

You just need to take your time and learn python. Read pybooks and practice a lot

Ene Uran commented: agree +8
richieking 44 Master Poster

That mean you got a logic error. check your while and if loops well.

richieking 44 Master Poster

yep close the thread and then open a new thread. Dont ever mix threads because it does not help other readers in the future.