A proper build server will no just give access to its directories. There must e some checks here and there. You will also need the ftplib.
I think thats your best hit.
A proper build server will no just give access to its directories. There must e some checks here and there. You will also need the ftplib.
I think thats your best hit.
And where is his code..... What has he done so far?
Well i think your code here is not complete to trace all the errors.
But The global name display is a method . so do this where ever you call the display method.
display() # This will call a function dispaly(). Note that display is not the same as display().
Happy coding :)
what exactly do you want to calculate?
can you be more specific?
:)
Check this out
import matplotlib.pyplot as mpl
print(dir(mpl))
##output
['Annotation', 'Arrow', 'Artist', 'AutoLocator', 'Axes', 'Button', 'Circle', 'Figure', 'FigureCanvasBase', 'FixedFormatter', 'FixedLocator', 'FormatStrFormatter', 'Formatter', 'FuncFormatter', 'IndexLocator', 'Line2D', 'LinearLocator', 'Locator', 'LogFormatter', 'LogFormatterExponent', 'LogFormatterMathtext', 'LogLocator', 'MaxNLocator', 'MultipleLocator', 'Normalize', 'NullFormatter', 'NullLocator', 'PolarAxes', 'Polygon', 'Rectangle', 'ScalarFormatter', 'Slider', 'SubplotTool', 'Text', 'TickHelper', 'Widget', '__builtins__', '__doc__', '__docstring_addendum', '__file__', '__name__', '__package__', '_backend_selection', '_imread', '_imsave', '_interactive_bk', '_pylab_helpers', '_setp', '_x', 'acorr', 'annotate', 'arrow', 'autumn', 'axes', 'axhline', 'axhspan', 'axis', 'axvline', 'axvspan', 'bar', 'barbs', 'barh', 'bone', 'box', 'boxplot', 'broken_barh', 'cla', 'clabel', 'clf', 'clim', 'close', 'cm', 'cohere', 'colorbar', 'colormaps', 'colors', 'connect', 'contour', 'contourf', 'cool', 'copper', 'csd', 'dedent', 'delaxes', 'disconnect', 'draw', 'draw_if_interactive', 'errorbar', 'figaspect', 'figimage', 'figlegend', 'fignum_exists', 'figtext', 'figure', 'fill', 'fill_between', 'fill_betweenx', 'findobj', 'flag', 'gca', 'gcf', 'gci', 'get', 'get_backend', 'get_cmap', 'get_current_fig_manager', 'get_fignums', 'get_plot_commands', 'get_scale_docs', 'get_scale_names', 'getp', 'ginput', 'gray', 'grid', 'hexbin', 'hist', 'hlines', 'hold', 'hot', 'hsv', 'imread', 'imsave', 'imshow', 'interactive', 'ioff', 'ion', 'is_numlike', 'is_string_like', 'ishold', 'isinteractive', 'jet', 'legend', 'loglog', 'matplotlib', 'matshow', 'minorticks_off', 'minorticks_on', 'mlab', 'new_figure_manager', 'normalize', 'np', 'over', 'pcolor', 'pcolormesh', 'pie', 'pink', 'plot', 'plot_date', 'plotfile', 'plotting', 'polar', 'prism', 'psd', 'pylab_setup', 'quiver', 'quiverkey', 'rc', 'rcParams', 'rcParamsDefault', 'rcdefaults', 'register_cmap', 'rgrids', 'savefig', 'scatter', 'sci', 'semilogx', 'semilogy', 'set_cmap', 'setp', 'show', 'silent_list', 'specgram', 'spectral', 'spring', 'spy', 'stem', 'step', 'subplot', 'subplot_tool', 'subplots_adjust', 'summer', 'suptitle', 'switch_backend', 'sys', 'table', 'text', 'thetagrids', 'title', 'twinx', 'twiny', 'vlines', 'waitforbuttonpress', 'winter', 'xcorr', 'xlabel', 'xlim', 'xscale', 'xticks', 'ylabel', 'ylim', 'yscale', 'yticks']
And there is not yaxis
This is the methods inside the module you imported.
pygame.image.load('player.png')
Give the fullpath to the image file ok ?
pygame.image.load('fullimagepath')
Then forget about the sys.path.append() stuff.
image is not a module.
;)
info ;)
sys.maxsize also exist in py2.6
well said ;)
Just refactored......
import matplotlib.pyplot as mpl
import numpy as npy # Redundant imports
import os #
import sys #
import string #
def isFloat(flt):
try:
float(flt)
return True
except ValueError:
return False
fileopen = open ('output.txt' , 'r')
filelist = fileopen.readlines()
angle = []
timeset = []
for onefile in filelist:
if( isFloat(onefile.strip())):
angle.append (eval (onefile))
for dt in range (0,len(angle)): #create time steps equal to the number of input angles
timeset.append (dt * 1) # why dt *1 ?? ,, just dt i think
mpl.plot (timeset , angle , 'r')
mpl.xlabel ('Time (Seconds)')
mpl.ylabel ('Angle (Degrees)')
mpl.yscale ('linear' , ([range (0,10)]))
mpl.show ()
Happy coding
And how do you intend to work with this data format?
can you post your code so far?
I am currently using this module difflib for a new app i am working on. Nice one. :)
well as Grib is found of helping....
I like his idea. basics will work like this....
class Hero:
def __init__(self,name,size,strenght):
self.name=name
self.size=size
self.strenght=strenght
def foo(self):
pass
# contains methods common to all heroes
...
class Lord(Hero):
def __init__(self,foo,bar):
Hero.__init__(self,foo,bar)
pass
# contains methods specific to Lords
...
class MainHero(Lord):
def __init__(self,foo,bar):
Lord.__init__(self,foo,bar)
pass
# contains main hero specific methods
...
phill = MainHero(...)
phill.foo() # That you cant call methods in other classes bases on inherintace
Very simple idea. But dont next classes like that. Very scary idea.
:)
i Think graphics modules is taken more seriously for college guys thank tkinter the main module.
There are a lot of bugs in your code.
example on line 11
11 evidence = open('c:\\Fummy_Tasks\\RECONSTR_ANALYSIS\\04052010\\test1_Strings\\word1.txt','rb')
You cant do this.` That is you keep opening a file that is already opened.
2. You cant use "rb"flag on a txt. rb is a read binary flag.
I just dont still get you. Do you want to read your file looking for specific words???
I think you need a full re factor.
Why cant you calculate the time interval for the shows and know how long a show takes so that you can provide how many minutes left for a show to end and start of a new show.
Very easy and handy it will.
Woooee well said!
Can you post your code?
Look i dont get you friend.
Can you explain well again what you want to achieve?
why not also in wxpython....
import wx
app=wx.App()
msg= wx.MessageBox("Are you sure you want to quit?","Press yes To quit",style=wx.YES_NO)
if msg == wx.ID_OK:
msg.Destroy()
I like one-liners but jureslak one-liner for third pseudo is not good for readability and maintainance
:)
hhhmmmmm
Slash12.. I think your algo. is too long to solve this case. Refactor i thing is needed.
:)
PIL uses image Magic on linux system. Images can be printed out even from the cmd very simple. There will only be a popup window.
eg.
From PIL import Image
im = Image.open("path","r")
im.show()
This simple pseudo will show the image.
;)
I am thinking of writting a tut about threading and socket. ;)
Are you looking something like search and replace stuff. I cant get you.....
Happy Newyear.
This is your newyear gift.
str="4:14.4-17M,5:14.4-2e13M,6:14.4-4e9M,7:14.4-8e,22:28.4-35M,\
23:28.4-2e30M,24:28.4-4e26M,25:28.4-8e18M,26:28.4-16e2M,27:28.4-18e,\
28:14.16-36M,29:14.16-2e32M,30:14.16-4e28M,31:14.16-8e20M"
d=[c for c in str.split(",")]
print([int(f.split(":")[0]) for f in d ])
##out Put
[4, 5, 6, 7, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]
And if you like it. you can upvote me a lil ok? :)
I dont even see the need for list comprehension here.... The speed dif. here is minimal or nothing at all.
Readability is null. There are good occassions list comp. is good but not certainly this.
What a mechanized code tonyjv my man. ha ha ha :)
try this.
very simple
import time
boom=59
while boom >0:
time.sleep(1)
print(boom)
boom -=1
Why that didnt worked? How come? :)
elif outputDic.has_key(keyIndex) == True:
No need for True keyword.
You can do this without the keyword True as If statement defaults to true.
simply...
elif outputDic.has_key(keyIndex):
Also helps ;)
os.popen("foo bar")
well do the job as long as he is willing to save his scrapped webpage and reopen it.
;)
Dic data can be sorted even if it conytain lists in list. But you have to sort them out yourself. They are not sorted automaticaly.
Panel helps event to have special precision and on window paltform, it give a diffenet frame colour.
Add the imports
import socket, ssl, mmap
This code is working fine with me.
Add the imports on the top of my updated post.
The only problem was the mmap which the ghost hack works fine. I have use a prototype here and its all good.
;)
Updated
import mmap,os
f= open("/home/richie/be.txt","r")
ff=len(f.read())
mm=mmap.mmap(-1,ff)
f.close()
fc=open("/home/richie/be.txt","r")
mf=fc.read()
mm.write(mf)
mm.seek(0)
print mm.read(20000)
mm.close()
#!/usr/local/bin/python3
import socket, ssl, mmap
bindsocket = socket.socket()
bindsocket.bind(('secure.dwdcweb.info', 8180))
bindsocket.listen(200)
i =0;
mapa = "";
def update_cache():
global i
global mapa
f = open("/var/logs/squid/access.log", 'r+b')
f=len(f.read()) # To get the size of the file
mapa = mmap.mmap(-1,f) # To trick the system to accept operation
f.close() # For strange reasons The file needs to closw and reopen. I just check that out
# else it produces nothing for mmap writting
u = 0
f1=open("/var/logs/squid/access.log", 'r+b')
for line in f1.read(): # You can also read the entire line into the mmap
f1.seek(i) # mapa.write(f1.read()) So there is no loop there
mapa.write(line) # Because the loop will not get you the actual lines in the file
u += 1 # If you want the actual line 100% This is not the solution
print("%d : %s", u, line) #I think you need to use realines() loop on the mapa after as
i = f1.tell() # This mapa write strip and make the file more clean and compact.
f1.close()
update_cache()
def do_something(connstream, data):
print("%s",data)
connstream.write("HTTP/1.1 200 OK\r\n");
connstream.write("Server: Secure Proxy RPC Server/0.1 (CentOS)\r\n");
connstream.write("Cache-Control: no-cache\r\n");
connstream.write("Pragma: no-cache\r\n");
connstream.write("Expires: Thu, 01 Dec 1994 16:00:00 GMT\r\n");
connstream.write("Content-Type: text/xml\r\n");
connstream.write("Access-Control-Allow-Origin: http://secure.dwdcweb.info\r\nAccess-Control-Allow-Methods: POST, OPTIONS\r\n");
connstream.write("Access-Control-Max-Age: 1728000\r\n");
connstream.write("\r\n\r\n<?xml version=\"1.0\" standalone=\"yes\" ?><row>\r\n");
connstream.write("</rows>\r\n");
def deal_with_client(connstream):
data = connstream.read()
# null data means the client is finished with us
while data:
if not do_something(connstream, data):
break
data = connstream.read()
# finished with client …
I come out with this.
We need to trick the system to accept our terms and conditions.
Here You ghost the mmap.mmap with our logical numbers with maintaining the exact anmout of data so that there will not be data trancation.
try this
#!/usr/local/bin/python3
import socket, ssl, mmap
bindsocket = socket.socket()
bindsocket.bind(('secure.dwdcweb.info', 8180))
bindsocket.listen(200)
i =0;
mapa = "";
def update_cache():
global i
global mapa
f = open("/var/logs/squid/access.log", 'r+b')
f=len(f.read()) # To get the size of the file
mapa = mmap.mmap(-1,f) # To trick the system to accept operation
u = 0
for line in f.read():
f.seek(i)
mapa.write(line)
u += 1
print("%d : %s", u, line)
i = f.tell()
f.close()
update_cache()
def do_something(connstream, data):
print("%s",data)
connstream.write("HTTP/1.1 200 OK\r\n");
connstream.write("Server: Secure Proxy RPC Server/0.1 (CentOS)\r\n");
connstream.write("Cache-Control: no-cache\r\n");
connstream.write("Pragma: no-cache\r\n");
connstream.write("Expires: Thu, 01 Dec 1994 16:00:00 GMT\r\n");
connstream.write("Content-Type: text/xml\r\n");
connstream.write("Access-Control-Allow-Origin: http://secure.dwdcweb.info\r\nAccess-Control-Allow-Methods: POST, OPTIONS\r\n");
connstream.write("Access-Control-Max-Age: 1728000\r\n");
connstream.write("\r\n\r\n<?xml version=\"1.0\" standalone=\"yes\" ?><row>\r\n");
connstream.write("</rows>\r\n");
def deal_with_client(connstream):
data = connstream.read()
# null data means the client is finished with us
while data:
if not do_something(connstream, data):
break
data = connstream.read()
# finished with client
connstream.close()
while True:
newsocket, fromaddr = bindsocket.accept()
update_cache()
connstream = ssl.wrap_socket(newsocket,
server_side=True,
certfile="/home/dwdataconcepts/domains/secure.dwdcweb.info/ssl.cert",
keyfile="/home/dwdataconcepts/domains/secure.dwdcweb.info/ssl.key",
ssl_version=ssl.PROTOCOL_SSLv3)
deal_with_client(connstream)
If you like it.... lil upvoting will do.
Happy holidays ;)
python Syntax (Toggle Plain Text)
1.
os.system('notepad.exe file')os.system('notepad.exe file')
works for me. Leaves the ugly command prompt window open and won't return control to python interpreter though...
This will open the notepad with the file/info you provided. In your case file as the opened file name.
Its not the solution .....
:)
MAy be converting the c++ script to python wont be that easy. I just tried and i think is insane idea. whops!
Look why not write a python script to implement the same functionalities. May be the interfaces of this C++ will not be the same but at least will produce the same results.
:)
Its turtleworld your own written module or what.
;)
Spot on Tonyjv. ;)
Pay attention to line 23 of tonyjv+ code.
That is the solution to why your data was not what you wanted.
Goodluck
:)
The idea is still the same.You are only getting confuse with the implementation of it.
This is the show.
1. You need a build in mediaplayer in your client. That will do the playing stuff. he media player should be able to stream online. Also you will need a bit of work on the mime types so as to play different mimes.
2. Understand that half downloaded files are unknown to the system to parse the mime hence know if its indeed a mov,flv,divx,mp4,mp3,av, etc. Hence you will use the backdoor to play those file. That is use point 1.
I told you from start about sockets.... Are you with me my friend?
:)
Is it a wamp installation?
if yes and you are on Win OS. turn on hiddend files .
on xp. got to mycomputer -> menu list ->look for Tools -> folder Option and you will get a pop up. look for turn hidden file on.
Its a radio button.
Go back to your Wamp and look for .htaccess file. Just remove it.
2. If its not there...
Do you realize also that your url extension got encoding of foo+bar+spam... its eg.
question. Did you encoded that yourself or the file input did.?
If you did... Then you must make sure you decode that before you parse the url looking for the said link.
2. If your file name is spaced eg.. hello world.php ..., make sure you put them together like hello_world.php or anyway you like.
But they must be together.
If this trouble shooting does not help you. remove and install the server again.
;)
homescore = array('i',[])
visitingscore = array('i',[])
Python uses list keyword or this sign [] as array.
That is pythonic system.
Strange........
Are you hosting yourself??
If not, then talk to your hoster about this issue ok?
What webserver are you useing?
:)