Error
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.

print

simple ftp client example - python
Tuesday, 22 November 2011 07:47
// with few slight modifications (like s.recv -> s.read) you can run this script in pys60
// iam too lazy to add comments to this prog, since this is only snippets no comments

import socket
import time
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)#main socket
#***************************************
def sendcmd(cmd):
global s
s.send(cmd+"\r\n")
#***************************************
def getline():
global s
return s.recv(1024)
#***************************************
def execute(cmd):
sendcmd(cmd)
return getline()
#***************************************
#command executing sequence and delay is important in this module
def getpasv(cmd):
global s
ss=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
#temporary socket for pasv connection.
a=execute("PASV")
print a
print "connecting to %s:%d" % parse(a)
ss.connect(parse(a))
sendcmd(cmd)
fhandle=open("d:\\a.rar","wb")#replace d: with e: for memory card if pys60
while 1:
tmp = ss.recv(1024)
if not tmp:
break;
fhandle.write(tmp)
fhandle.close()
ss.close()
time.sleep(1) #this delay is required
return getline()
#***************************************
def parse(st):
x=st[st.rindex("(")+1:st.rindex(")")]
y=x.split(",")
ipaddr=y[0]+"."+y[1]+"."+y[2]+"."+y[3]
portnum=(int(y[4])*256)+int(y[5])
return ipaddr,portnum
#***************************************
print "program started"
try:
s.connect(('ftp.myserver.com',21))
print getline()
print execute("USER shankar")
print execute("PASS support123")
print execute("CLNT FileZilla")
print execute("OPTS UTF8 ON")
print execute("CWD /Tools")
print execute("PWD")
print execute("TYPE I")
print getpasv("RETR datarecovery.rar")
print execute("QUIT")
s.close()
except socket.error, e:
print "ERROR: %s" % e
print "done!"
#***************************************

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/sg2EIsKOqJo/13919

 
pys60 socket example dns resolver
Saturday, 19 November 2011 03:02
// dns resolver using sockets in pys60


import appuifw
import socket
import sys
def puts(s):
sys.stdout.write(s)
sys.stdout.flush()
def gets(s):
puts(s)
return sys.stdin.readline()
t=appuifw.app.body.get()
appuifw.app.body.set("")
print "**************"
print "dns query by shankar."
#apid=socket.select_access_point()
#print apid
ap=socket.access_point(2)
socket.set_default_access_point(ap)
puts("connecting to network...")
try:
ap.start()
print "OK.\nconnected, our ip:",ap.ip()
a=1
print ""
except:
print "FAILED\nError: unable to connect."
a=None
while a:
name1=gets('domain: ')
try:
ip=socket.gethostbyname(name1)
#appuifw.note(unicode(name1 + ' = ' + ip))
print name1,"=>",ip
a=appuifw.query(u"continue?","query")
except SymbianError:
print "Error: connection error."
a=None
except:
print "Error: query error."
if gets("continue[a/]?")=='a':
a=1
else:
a=None
print ""
print 'script completed.'
print "disconnecting from network."
ap.stop()
print "**************"
appuifw.app.body.set(t)

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/VO17zBvA7qM/13901

 
simple example thread in pys60
Thursday, 17 November 2011 01:12

import appuifw
import e32
import thread
def mine():
global running
print "new thread started"
while running:
print "thread running"
e32.ao_sleep(2)
print "thread stopped"
def startth():
global running
running=1
thread.start_new_thread(mine,())
def stopth():
global running
running=0
def cl():
appuifw.app.body.set(u"")
def about():
appuifw.note(u"programmed by shankar.")
def quith():
stopth()
print "bye"
lock.signal()
cl()
appuifw.app.title=u"thread_demo"
appuifw.app.exit_key_handler=quith
appuifw.app.menu=[(u"clear screen",cl),(u"Menu1",((u"About",about),(u"Quit",quith))),(u"thread",((u"start new",startth),(u"stop all",stopth)))]
lock=e32.Ao_lock()
lock.wait()

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/bQtzwAtKr6w/13885

 
need help with my assignment.
Thursday, 04 August 2011 07:28
// description of your code here
i need a recursive program that will promt the user to enter a path to any folder and print a list of files saved under the entered folder.

// insert code here..

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/v-7sYGc9vJs/13459

 
Time Magazine Is Cloaking Itself Behind a Paywall [Blip]
Tuesday, 19 July 2011 12:34
Time Magazine has just joined the New York Times in its paywall-erecting ways. Subscribers will soon be offered "all-access" plans that cover the bases from print to mobile and web. Non-subscribers will be locked out for three months. More »


Read more: http://feeds.gawker.com/~r/gizmodo/full/~3/Q_JqOMSrp10/time-magazine-is-cloaking-itself-behind-a-paywall

 
Start
Prev
1


Page 1 of 3
Taxonomy by Zaragoza Online