richieking 44 Master Poster

Another easy way is formating as woooee just stated.

Here format so that your data show on line by line. So lets say you have the whole time stuff on line 5.

You just replace all line 5 with your new time stamp. Always think about future and updates. Planing is very important in programming.

Your case is solved. ;)

I have studied this very carefuly, that if a programe is well planed. Its very easy to update. No need for regex and crude methods. Regex in when all simple logic can not fix or you need need to find mixed up scatered data in a file.

Thats my take ;)

richieking 44 Master Poster

on line 31 where you have delete.php. you must add the data to be deleted.

<a href="delete.php?userID=$row['id']&name=$row['name']">delete</a>

The you get the values the run your delete query in the delete.php.
eg:

$userId=$_GET['userID']
$name=$_GET['userID']

## then connect to your sql db and run your delete query.

;)

richieking 44 Master Poster

ha ha.... not that cruel am i?
;)

richieking 44 Master Poster

i Just voted for wxpython baby <-_-> ;)

richieking 44 Master Poster

Improve over this script. This should work for you.

from __future__ import print_function

words=["happy",'monty python',"hello","zombi","bone","monty"]

def word(words):
 for x in words:
    if x.endswith('y'): #get the ends
      f=[y for y in x]  #strip to list for easy slicing
      fex1=f[0:-1]      #take the end away
      fex1.append("ier") # append your wish
      print("".join(fex1)) #convert to string.
    elif x.endswith('e'):
      f=[y for y in x]
      fex2=f
      str(fex2.append("r"))   
      print("".join(fex2))
##output
happier
boner
montier

help your self ;)

richieking 44 Master Poster

Gribouillis updated

Information like this will always need a callback into action. Therefore i thought of updating your script a little.

with open("logfile.txt","a+") as logfile:
     logfile.writelines(str(stdout_value)+"\n") # To get the newline. easy to work with that

In the end. You can read-in your data for further manipulation if needed.
I understand Gribouillis just gave you a simple pseudo just to give you the idea.

;)

richieking 44 Master Poster

So where does your error lies?

richieking 44 Master Poster

Start looking into wxpython ok? You must at least start with a GUI . I prefer wxpython.
I can write you one but the problem is, will you understand the script at all to even extend it??

Your answer plz. ;)

richieking 44 Master Poster

Well you are welcome. You can now close the thread and upvote me if you liked my lil help ;)

richieking 44 Master Poster

Tkinter not that matured for game. very limited....

richieking 44 Master Poster

Do you want a consul script or GUI???

be specific plz ;)

richieking 44 Master Poster

I think you need a GUI script. That will be more handy.

Writting a recursive script to recurse through your entire file system is not that good on resources.

Think about it.
;)

richieking 44 Master Poster

Right on buddy. Right on!

richieking 44 Master Poster

Can you at least put your code in the code tag plz?
;)

richieking 44 Master Poster

Use the style wx.TE_RIGHT ok?

eg

wx.TextCtrl(self,-1,style=wx.TE_RIGHT)
ciliath commented: genial +0
richieking 44 Master Poster

Favolas

Try this ok.??

sd=[]
sd.append("b"*2)
for x in range(3):  
        sd.append("a"*5)
        sd.append("b"*4)
df=sd[0:-1]
df.append("b"*2)              
print(df)   

## output ##
['bb', 'aaaaa', 'bbbb', 'aaaaa', 'bbbb', 'aaaaa', 'bb']

Hope it does work

richieking 44 Master Poster
richieking 44 Master Poster

Well you can also place your loop in a function then use threading. With this you can manage the flow of your programme and CPU usage.

use modules sys,os,thread and time together.

Why am i saying this?... you can check with the CPU percentage or even give one core of the CPU to your application.

If The CPU reaches some level, You can halt the processing of your code.
I hope you get me. ;)

richieking 44 Master Poster

Can you tell me the name of the client you want to write your python script to hook with?

eg. yahoo,msn,skype etc..... what is the name?

richieking 44 Master Poster

Here is corrected version with advice from StackOverflow:
Python Syntax (Toggle Plain Text)

1.
from __future__ import print_function
2.
import time
3.
import sys
4.
wipe = '\b'*len(time.asctime())
5.
print("The current date and time are: "+' '*len(wipe), end='')
6.
while True:
7.
print(wipe+time.asctime(), end='')
8.
sys.stdout.flush()
9.
time.sleep(1)

from __future__ import print_function import time import sys wipe = '\b'*len(time.asctime()) print("The current date and time are: "+' '*len(wipe), end='') while True: print(wipe+time.asctime(), end='') sys.stdout.flush() time.sleep(1)

stdout must be flushed manually if not use newline.

I recommend of trying to use ContextEditor and setup starting the python program by F9-, commands. You can easily test multiple versions of Python, and program does not run in changed environment.
23 Hours Ago 1:23 pm

tonyjv

There is something wrong with all these IDEs. All the known ide's for python failed to execute your code well. Syntaticaly your code it right so i could not think of any errors again. You are matured with python than i am.

Well it only worked flawlessly via CMD prompt.....
The question is... What is wrong?? the ide's or pyhton????
coming from C++ to python, i find a lot of stuffs scary at times with python. Today(Nov 28 ) is exactly 17 days since i started pythoning.

Yea i know. Python is easy to pick up.
Well good one there.
;)

richieking 44 Master Poster

this is simple. ts the same style just like crearting login script.

i will advice you to read about how to create php login manager. google around. write something and i will direct you from there. ok?


;)

richieking 44 Master Poster

First check in google if itune got API interface for python and start working from there ok?
;)

richieking 44 Master Poster

Can you at least provide us with your code...???
;)

richieking 44 Master Poster

szabizs Just gave you the sutff.

However if you really want to search and replace. Please advice and i will script something for you.
;)

richieking 44 Master Poster

There are several ways to achieve this. I will talk about 2 of them.

1. You can have a script to create a mail account on your server eg.like gmail,yahoo.
The user get created account with the pop/smtp client once signed up.

2. You cant jest create a php/mysql backend system that will also help sending messages only amist your users.

:)

richieking 44 Master Poster

I see ;)

richieking 44 Master Poster

Ysisoft..

Have you tried your code?

The logic on line 3 ie. wipe=len(time.asctime())*'\b'

Instead of backspacing... It is forwardspacing time the len.
That is on idle.
On Geany it is not outputting anything.
And on my favourite Pydev kum Aptana/c++/Java/php It is doing the same like Idle with unicode error

richieking 44 Master Poster

Of course if you would like to show real time instead of doing exercise you would do for example:
Python Syntax (Toggle Plain Text)

1.
from __future__ import print_function
2.
import time
3.

4.
old_t =''
5.
print("The current date and time are: ", end='')
6.
while True:
7.
t = time.asctime()
8.
print('\b'*len(old_t)+t, end='')
9.
old_t = t
10.

11.
time.sleep(1)

Well Ysisoft....

I have added some nice bits to your code. I think we are getting there.

Check this out.

from __future__ import print_function
import time,os

old_t =''
while True:
    t = time.asctime()
    print((os.system('clear'), "The current date and time are: ",u''*len(old_t)+t, end='')
    old_t = t
    time.sleep(1)
richieking 44 Master Poster

just google around friend..... Just type the client you want work withfor python module.
;)

richieking 44 Master Poster

or you can do this

print ("The total is %f"%( discounted_total))

I prefer this ....

richieking 44 Master Poster

VulcanDesign.....

Can you please give a benchmark to support your claim or just dont write what you dont know.
The world is waiting for your benchmark pleeeeeeeeeeeeeease

;)

Besides the screen clearing prove i have given you... and besides the one i say it works cross platform...

Do you have a different one?
If not. Please dont disturb anyone anymore ok?
;)

Note. the syntax is not print("\n") *100 , but print("\n" *100) and this prints nothing ok??? Blah

Its python syntatic suger. have a try ok?

richieking 44 Master Poster

Put your idea into a class. You see you are importing a basic file which has only function not a class. That means python will not be able to import that.

secondly you when you import trial.

To use any variable or method in trial.... do

trial.ip
trial.foo
trial.get_config.ip

With this .. python will get it for you.

Hope you get the idea ;)

richieking 44 Master Poster

Python ruby or perl will do just that.

I think python should be your first option as it is very easy to grasp.
;)

richieking 44 Master Poster

I suggest doing a class for your module with normal methods with return values.

I am getting your idea.

why not like.....

1. The system ask for cmd (1.to add ip, 2. to exit)
2. User makes a choice. if choice 1.
3.The user get cmd. Please add ip.....

4.After ip added and enter..
5. Another choice. 1. to add shares to the entered ip, 2. to enter new ip , 3. to quit.

Hope you get the idea. It will be full interaction with the user and also easy for you to process the code.

note. IP's and Shares are packed into dict with ip as keys and shares as values.
That is IP(key) can have as many values (shares) as possible.

;)

richieking 44 Master Poster

aaahhh do you have any benchmark to your claims.???

print('\n' *100)
is use for clearing the screen if you do not know.
it is just like os.system('clear') on *nix system and os.system('CLS') on dos,windows.

print "\n"*100 works for cross platform. ok ??
;)

richieking 44 Master Poster

Well mark the thread close and if you wish to upvote me....... you are welcome. ;)

richieking 44 Master Poster

look you can add this to make it a little interesting

import time



a = 0
b = 0
FirstRun = True

while 1:               
    a = a + 1               #Adds one second
    if a > 59:              #Accounts for minutes
        b = b + 1
        a = a - 60
    print '\n' *100   
    print("The current time is  %d :%d"%( b  ,a))
    time.sleep(1)

This makes the screen clear so that it looks like a real time.
;)

richieking 44 Master Poster

Can you please post your code again well .
Use code ok?
;)

richieking 44 Master Poster

try this

import time,

a = 0
b = 0
FirstRun = True

while 1:               
    a = a + 1               #Adds one second
    if a > 59:              #Accounts for minutes
        b = b + 1
        a = a - 60
       
    print("The current time is  %d :%d"%( b  ,a))
    time.sleep(1)

;)

richieking 44 Master Poster

You need the API of the client eg. Yahoo or msn or google then you ceck if there is python wrapper to that.

Start looking into the API of the client and google around for any python module to start from there
:)

richieking 44 Master Poster

1.You have on line 2 assigned config_list and on line 7 again????
2.You exit logic is no where to be found
3.Why are you checking ip with a string (if ip.lower()==deny.lower())???

ip is a series of numbers so there is no lower method

Besides the logic behind your code i dont get it.

Please explain very well what you intend to do.

;)

richieking 44 Master Poster

Please close the thread and upvote me if you think i deserve it. ;)
Thanks

richieking 44 Master Poster

move you module to your home dir and try appending again
maybe it might be permission stuff
;)

richieking 44 Master Poster

There are 2 things here that you must check up.

1. If the module exists in the same project in IDE(eclipse) it should call that for you. But i have a problem with eclipse as it default to jython and custom modules are not that consistant.

You can change the default jython anyway.

2. to be on the safe side, you can append your module to the python module path and python will include that in its module search.

import sys

sys.path.append("/path/to/custom/module")

very simple ;)

richieking 44 Master Poster

Well you can try this.

from __future__ import division

my_list=list(raw_input("enter number: ")) # you take the input from the user
avg=sum([int(x) for x in my_list])/len(my_list) 
print(avg)

#out Put
enter number: 1234
     2.5

hope it helps ;)

richieking 44 Master Poster

IS ANYONE INTERESTED IN THIS APP???

I am looking for guys 1 or 2 to write some open source application in python.
We will decide what app. we want to write.

1.App in GUI (wx)
2.The app will have its dedicated website.
3. The app in multi platform

And other cool stuff.

Please contact me at richard.king@noblis-system.com

;)

richieking 44 Master Poster

What ide are you using?? Check also if you do not have wordwrap on.

:)

richieking 44 Master Poster

well you are always welcome buddy. i was once like you ;)

richieking 44 Master Poster

Look at this example. The if was not tested with True

word="The lazy fox jump over the fence"

word=word.split()
for x in word:
    if x:
      print x
print ("X now is finished, X is null or zero")

Just play around stuff you will get it ;)

richieking 44 Master Poster

The if will fail once the object is equal to 0/Null.

The logic is
1. you checked for a condition if it is True.
2. if the condition is not.... then branch.

To check for True condition with if... You do not repeat True as if default condition check is True. So repeating True again does not make any impact.
Hope you get it.
;)