better regular expression?
Hi,
I am trying to construct a regular expression using the re module that
matches for
1. my hostname
2. absolute from the root URLs including just "/"
3. relative URLs.
Basically I want the attern to not match for URLs that are not on my
host.
The following statement satisfies numbers 1 and 2, but not 3:
line =
re.sub(r'(href=")(http[s]?://'+hostname+'[/]?|/)([^"]*?)(")',r'\1\2\3'+sInfo+r'\4',line)
An improvement that also partially satisfies number 3 is
line =
re.sub(r'(href=")(http[s]?://'+hostname+'[/]?|/|[^h][^t][^t][^p][^:][^/][^/])([^"]*?)(")',r'\1\2\3'+sInfo+r'\4',line)
This is not complete because if the relative url is less than seven
characters, than it will not match.
Any suggestions?
Thanx.
--
http://mail.python.org/mailman/listinfo/python-list
better regular expression?
Hi,
I am trying to construct a regular expression using the re module that
matches for
1. my hostname
2. absolute from the root URLs including just "/"
3. relative URLs.
Basically I want the attern to not match for URLs that are not on my
host.
The following statement satisfies numbers 1 and 2, but not 3:
line =
re.sub(r'(href=")(http[s]?://'+hostname+'[/]?|/)([^"]*?)(")',r'\1\2\3'+sInfo+r'\4',line)
An improvement that also partially satisfies number 3 is
line =
re.sub(r'(href=")(http[s]?://'+hostname+'[/]?|/|[^h][^t][^t][^p][^:][^/][^/])([^"]*?)(")',r'\1\2\3'+sInfo+r'\4',line)
This is not complete because if the relative url is less than seven
characters, than it will not match.
Any suggestions?
Thanx.
--
http://mail.python.org/mailman/listinfo/python-list
better regular expression?
Hi,
I am trying to construct a regular expression using the re module that
matches for
1. my hostname
2. absolute from the root URLs including just "/"
3. relative URLs.
Basically I want the attern to not match for URLs that are not on my
host.
The following statement satisfies numbers 1 and 2, but not 3:
line =
re.sub(r'(href=")(http[s]?://'+hostname+'[/]?|/)([^"]*?)(")',r'\1\2\3'+sInfo+r'\4',line)
An improvement that also partially satisfies number 3 is
line =
re.sub(r'(href=")(http[s]?://'+hostname+'[/]?|/|[^h][^t][^t][^p][^:][^/][^/])([^"]*?)(")',r'\1\2\3'+sInfo+r'\4',line)
This is not complete because if the relative url is less than seven
characters, than it will not match.
Any suggestions?
Thanx.
--
http://mail.python.org/mailman/listinfo/python-list
Create social networks easily using Redis and Python
Its really simple to create a scalable social network using Redis, to demonstrate this I wrote a small library called "resn" in python that can provide out of the box support for friends, news feed, asymmetric connections (like Twitter) and authentication. It uses the redis-py library by Andy McCurdy and Amir Salihefendic's redis_wrap. It can be used along with any python web framework including django, flask, pylons etc .This library can be used by app developers who need to create mini social networks and can be found at https://github.com/vivekn/resn/ Hope this helps, Vivek Narayanan -- http://mail.python.org/mailman/listinfo/python-list
Environment Variable
Is it possible to set an environment variable in python script whose
value is retained even after the script exits.
Doing the following creates an environment variable "name" which is
visible to only subprocesses created by os.system() and os.popen().
os.putvar("name", "vivek")
Is it possible to somehow create this environment variable inside
python script which will be avaibale even after the script exits. In
otherwords, after I run my script, if I do a "echo $name" in my shell,
it should return the value "vivek"
--
http://mail.python.org/mailman/listinfo/python-list
tree data structure
Hi! all i am a new member on this list. I have to implement tree data structure using python. How it can be done in python. Is there an existing data structure which can be used as tree? I have searched archives and manuals but no luck. Regards VK Hug the REALITY ;-) Disclaimer The facts expressed here belong to everybody, the opinions to me. The distinction is yours to draw... __ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/ -- http://mail.python.org/mailman/listinfo/python-list
passing dictionary objects with soap
Hi! all, How can i return dictionary type element from a soap server to a client. What should be the entry section of a wsdl file. Regards VK Hug the REALITY ;-) Disclaimer The facts expressed here belong to everybody, the opinions to me. The distinction is yours to draw... __ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Openings
Hi, I have just completed my B.tech this year and have above six months experience in OpenERP framework as a technical consultant.In these six months I have completed nearly 5 modules and acted as an active member.Now, my company is going under a financial crisis and so, I think I have to leave this job.But I want to continue my career in OpenERP or Python. Thanks and Regards! Vivek Poddar -- http://mail.python.org/mailman/listinfo/python-list
Request for suggesstions and comments
Hi all, I have to write a network server (sort of) and I am looking for your valuable comments. Currently I have written a prototype in VB6 but it can only handle up to 30 or so clients. I need to upgrade the application so that it can handle up to 1000-1500 clients at a time (later if every thing works fine then hoping for 5000-6000 client). The scenario is as follows. 1. An server application (above mentioned app) will be listening on a particular port for client connection. The client will be connecting to it using TCP protocol. 2. The server will be continuously sending a trigger pulse to all the clients connected on this port (say every 3 sec). 3. Each client (in my case another app written in VB6) will be sending a string of approx. 70-75 chars every 1 sec. 4. Each string will contain a start and an end char. 5. Each string will contain some data eg. first 4 char acc. id, next 10 char user name etc. 6. As the data may come in small chunks (due to the nature of network and buffering), it will be the server's responsibility to buffer incoming data and look for valid strings in buffer. 7. Once the server software find a valid string in buffer, it should extract the valid string from the buffer and parse it (extract the data in the string) and insert into a database server with timestamps (in my case SQL Server 2k). 8. The server will also have to send the valid string to two other ports (one for showing status in GUI) and second to a remote client which will further parse the data and do some processing on the data (currently written in VB). There can be around 20-30 such clients. For GUI there will be around 5-10 clients. 9. The remote clients to whom the valid string is being sent can also send some data to be sent back to the clients from whom we are receiving data per sec. For this the remote client will send data to the server and the servers responsibility will be again to parse this data and send it to the appropriate client on the other side. This string can also be intended for broadcasting, in that case we may need to send data to all the clients on other side. This is a general view for the application. Now here are the issues on which I am requesting your comments and suggestions. Q. Is it possible to write an application for this kind of server activity in Python? I mean whether Python will be suitable for this kind of high activity load, real time app? Q. How much time it can take (approx.) to develop such kind of server? Q. Do we need multi threading? If so, then whether the Socket modules will be safe to use with multi threading? Q. What modules for networking (socket ?), database access etc should I use? Currently as I am just planning about the solutions so I don't have much of questions in my mind. But if it is possible to write this kind of app in Python easily (relative to C family of language ;) , then surely I will have some more questions for experts out there ;) . As for me, I have written some small scripts in Python. I have used Tk for GUI, PostgreSQL and Mysql for my Database, some CGI programming with apache, reporting using reportlab. But that was a long time back (some 2 yrs back). After that I joined one organization working on M$ platforms. So, since then I am working in VB6 only. But I am confident that after 7-10 days of study I can again start working with Python (Which is of course my favorite language :) . Eagerly waiting for your comments and suggestions. TIA, Vivek Kumar __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- http://mail.python.org/mailman/listinfo/python-list
Fwd: Infotech Enterprises Limited
-- Forwarded message -- From: Mahendra <[EMAIL PROTECTED]> Date: Jul 3, 2007 5:17 PM Subject: Infotech Enterprises Limited To: [EMAIL PROTECTED] Hi Further to our discussions, We are looking for Python developers/ C++ who are willing to work in Hyderabad. Infotech Enterprises Limited is a CMMIL5 company with morethan 5500 professionals working in to Various domains. For further information you can logonto www.Infotech-Enterprises .com Regards Mahendra Rao.A Human Resources Team Infotech Enterprises Limited Email: [EMAIL PROTECTED] www.infotech-Enterprises.com Tel : 040 - 23124040 Plotno - 11; Software units Layout Madhapur Hyderabad -- http://mail.python.org/mailman/listinfo/python-list
Re: Determine from a HTTP request if the user is on a Smart Phone, IE, Firefox
> > its userAgent or UserAgent String. Though its easy to send request with > any( fake) userAgent but its industry standard to get browser information > from userAgent only. > > http://www.useragentstring.com/pages/useragentstring.php > > > > On Mon, Jan 31, 2011 at 2:46 PM, James Mills > wrote: > >> On Tue, Feb 1, 2011 at 8:16 AM, Sascha wrote: >> > I am returning specialised website html according to what platform the >> > user is on. Is there a way to determine if the user is on a Smart >> > Phone or on IE or on Firefox? >> >> I have an iPad and just wrote a simple demo app to test this: >> >> http://prologic.no-ip.org:8000/ >> >> Source: http://codepad.org/zdZJgm1j >> >> Basically if you check for the string "iPad" in >> the User-Agent header. Obviously this only >> works for iPads running IOS and the built-in >> Safari Web Browser - but I'm sure other tablet/mobile >> devices provide similar unique User-Agent strings. >> >> cheers >> James >> >> -- >> -- James Mills >> -- >> -- "Problems are solved by method" >> -- >> http://mail.python.org/mailman/listinfo/python-list >> > > -- http://mail.python.org/mailman/listinfo/python-list
Re: [python-list] - what do you think ?
I think that will help people like me who just depend on gmail, and I know there are various ways to do filtering in gmail, but just addition of the tag in [ ] will help avoiding those.. I kindly second that... On Tue, Feb 8, 2011 at 6:12 PM, Rhodri James wrote: > On Wed, 09 Feb 2011 01:59:46 -, David Robinow > wrote: > > On Tue, Feb 8, 2011 at 5:03 PM, Rhodri James >> wrote: >> >>> On Tue, 08 Feb 2011 12:18:50 -, wrote: >>> On Tue, Feb 08, 2011 at 10:16:42PM +1100, Ben Finney wrote: > Either your mail client already knows how to filter messages > appropriately depending on which mailing list they came from; or, you > should use a better mail client. > mutt is quite good ;-) >>> >>> Definitely a step up from Outlook :-) >>> >> Not sure what your beef with Outlook is, but it does know how to >> >> filter messages appropriately. >> [I've never used mutt.] >> > > Nor have I, but according to the manual it can handle mailing lists > perfectly well. mutt has been around for a while. > > > -- > Rhodri James *-* Wildebeest Herder to the Masses > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
