richieking 44 Master Poster

And was there anythin special to include sys???
At least if you wanted a nice grib on the file operation. include os.

also you could simply use ....

with open(filename,"w") as opfile:
   opfile.write(foo.decode('utf8')

or use

with open(os.chmod(os.path.realpath(filename),0777),'w'):

to get super control over the created file.

in the end....

import urllib
import webbrowser
import os
#'http://www.imdb.com/list/SuSZdwCyHzU/'
def savePage(urll,filename):
    page=urllib.urlopen(urll).read()
    print(page)
    ##sys.argv[0]=filename
    with open(os.chmod(os.path.realpath(filename),0777),'w') as outfile:
        outfile.write(page.decode('utf8'))

savePage('http://www.daniweb.com/software-development/python/threads/406620/1735920#post1735920','outIMDB.html')
webbrowser.open('outIMDB
richieking 44 Master Poster

tip.

You need to use a while loop to keep the programe runing to take all the input and write to disk by closing the file. That is you must have your file operation in a first while loop to reopen the file after every input/data recieved from the serial.

richieking 44 Master Poster

very simple with stringstream. for example you want to use int from string and you dont know how to convert it. use this.

string int_in_string ;
getline(cin, int_in_string);
int int_from_string;
stringstream(int_in_string) >> int_from_string ;
cout << int_from_string;
## normal int
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

To use only cout... you need to add the namespace.

using namespace std;

or

std::cout<<foo;
richieking 44 Master Poster

can you please put your code into the code tags?

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

declare

double x, y;

and use. To handle the precisions.

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

instead of working on char.... in cpp there is a string. very flexible and you can easily do that.

string foo = "hello";
foo +=" world";
std::cout << foo;
// out put 
hello world
richieking 44 Master Poster

Put your code in the code tag first.At least make it readable.

richieking 44 Master Poster

show some code please

richieking 44 Master Poster

try this

#include <iostream>
using namespace std;


int main(int argc, char **argv)
{
	string foo, bar;
	cout <<"Enter a word :\n";
	getline(cin,foo);
	for(unsigned int ista=0;ista <foo.length();++ista){
		bar += foo[ista];
		cout <<bar<<endl;
		}
	return 0;
}
richieking 44 Master Poster

Can you show what you have already?
Some code please.....

richieking 44 Master Poster

I want the user to enter a letter A through F, yes; however, I want A/a=0, B/b=1, etc. In the function main, I declared and initialized upper and lowercase letters, A-F, 0-5, as ints. As far as the rows go, just a regular old int is fine.

do the type checking first after you receive the user input . When you know the type, the you check the value. if say the type is a char, ... you write ifs to assign an int of 0-5 to your checking variable then switch for action.

A little logic here. type checking...

richieking 44 Master Poster

Why all these unnecessary includes???? at least string and iostream will do.

richieking 44 Master Poster

pyPdf is a simple as abc. it cant get cheaper than that!

Bosterk commented: Thank +1
richieking 44 Master Poster

Do you have to delete only the first five lines ?????

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

for multiple snowflakes... consider using threading.

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

Check this out.
1. You will need 2 frame for that. or 1 dialog box and a frame. Its your choice.
2. overide the wx.App() and in the oninit method, call the dialog box/frame.
3. Dialog box/frame must be a main frame. Once the check is ok..., the the dialog box/frame should call the second frame which is the operational window and hide the dialog box/frame password check.

4. If the password is not correct,,, then re ask for the password.

Hope you got the idea.

richieking 44 Master Poster

Hello.
1. Can you explain yourself very well about your ie6 and what you want to achieve.
2.Python got a webbrowser module. Just import and use. This will use your native default browser on your system.

richieking 44 Master Poster

Grib. SlowFile.readline was not called therefore the delay will not work.
it should be like......

def main():
    ftp = FTP(HOST, USER, PASSWD)
    try:
        name = "foo.txt"
        src = SlowFile(name, "r", delay = 0.2)
        ftp.storlines("STOR " + name, src.readline()) # this part....
    finally:
        ftp.quit()
    
if __name__ == "__main__":
    main()
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

why dont you try the ftp lib

richieking 44 Master Poster

The bases of inheritance makes it clear .... that is if you inherit from a class you will have its methods into you new derived class. But and only but ....! you will not be able to genericaly call those methods in the parent class if you have the same methods in your class. The parent methods becomes like a virtual methods and only active when you have not over ruled them with your custom methods.

Hope i am clear. :)

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

Well how about getting each details out.
friends = {
'Fred' : {'city' : 'Pasadena', 'age' : 45},
'Adam' : {'city' : 'Dallas', 'age' : 27},
'Lisa' : {'city' : 'Chicago', 'age' : 31},
'Ulla' : {'city' : 'Las Vegas', 'age' : 19},
'Mark' : {'city' : 'New York', 'age' : 24}
}

print "Name %20s %5s"%("City","Age")  
print "="*38
for x in sorted(friends):
	print "%s  Details are %s "%(x, [ y for y in friends[x].values()])  

----output--------
Name                 City   Age
======================================
Adam  Details are ['Dallas', 27] 
Fred  Details are ['Pasadena', 45] 
Lisa  Details are ['Chicago', 31] 
Mark  Details are ['New York', 24] 
Ulla  Details are ['Las Vegas', 19]

from my htc phone

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
richieking 44 Master Poster

what a nice piece of article tony. you got talent my friend :) .

Azmah commented: agreed +2
richieking 44 Master Poster

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

richieking 44 Master Poster

I dont really like idle. Python is a great language but idle is like ?????
pydev or geany will do. try them out.

Also to you Twisted velocity , Try and simplify what you want to do. Always think abut the easiest way in solving a problem.

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.

richieking 44 Master Poster

yea check line 36 of your code. what are trying to achieve?

Btw on *nix platforms cd~ will take you to the user dir. Why do you need double cd~/~????.
try that with only one cd~ ok?
cheers

richieking 44 Master Poster

That is a piece of logic here.
1. You create your app
2. You create another script to execute if the time for purchasing your app has reached.
that is..................

if time > time_to_reg:
   destroyapp()

The you have the method destroyapp() coded to remove the files and other stuffs. Hope you got the idea.

richieking 44 Master Poster

Google for pyaudio. Also if you want a linux native app, there are other libs for banshe,audacious, in pytyon that you can use then it will use their audio engine respectively.

richieking 44 Master Poster

Or this snippet .;)

while range(9) in guess:
       break
richieking 44 Master Poster

Never knew wx python does not yet support python3.x because that's what i use currently, do you think that in the nearest future it will.

Dont Even think about that for now. It will take some time. There is a lot of loads on the developers at the moment.

Just stick to TK if you want py3k, else you may atleast use py2.7 which goes well with wxpy2.8 and still call in the future function in into your code.

vegaseat commented: good point +13
richieking 44 Master Poster

simple shall we?

def main():
  print(int(input("Number :"))+1)
main()
richieking 44 Master Poster

simple shall we?

def main():
  print(int(input("Number :"))+1)
main()
richieking 44 Master Poster
protein="GWEIQPYVWDECYRVFYEQLNEEHKKIFKGIFDCIRDNSAPNLATLVRVTTNHFTHEQAMMDAVKFSEVLPHKKMHRDFLEKLGGLSAPVDNHIKGTDFKYKGKAKNVDYCKEWLVL"

pp="LLCCCCCCCCCCCCCCCCCCHHHHHHHHHHHHHHHHHCHHHHHHHHHHHHHHCCCCHHHHHHHCLLLCCCCCHHHHHHHHHHHHHHHHHHHCCCCCCCCCCCHHHHHHHHHHHHCCL"

gor="cccccccccccchhhhhhhhhhhhhhhhhhhhhhhccccccccceeeeecccccchhhhhhhhhhhcccchhhhhhhhhhhhhccccccccccccccccccccccceeceeccceec"

aber="CCCCCCCCCCCCHHHHHHHCCHHHCHHHHHHHHHHCCCCHHHHHHHHHHHCCCCCCHHHHHHHCCCCCCCHCCHHHHHHHHHHCCCCCCCCCCCCCCCCCCCCCCCCCHHHHHHHCC"


for i in range(len(protein)):
	print i+1,protein[i], pp[i], gor[i], aber[i] ,"\n"

This wil give you one check on each line.
If you want the result to be what you have pasted up there, then your code is entirely wrong.

richieking 44 Master Poster

Also why not create noneZero object .??
Well its a matter of design.

richieking 44 Master Poster

Too much; C-coding; richieking? ;)

print """Equations
    Enter empty line to finish the program!
"""

while True:
    d = raw_input("Number:" )
    if d is '':
        break
    d = int(d)
    print '{d} + 1 = {answer}'.format(d=d, answer=d+1)
		
## Then continue from there

its still in the blood too much
:)

richieking 44 Master Poster

look at the right -> there is up and down sign.
click on up.

richieking 44 Master Poster

well you can upvote me a little if you care to.
Thanks

richieking 44 Master Poster
print "Equations"

print "a+1 (1), a+2 (2), a+3 (3), a+4 (4)"

while True:
	d=int(raw_input("number:" ))
	if d==0:
		break;
	if d == 1:
		print a+1
		
## Then continue from there