Re: Is Python a commercial proposition ?

2012-07-29 Thread Michael Hrivnak
http://www.djangosites.org/ Instagram, Pinterest, Washington Post, and The Onion all use djangoto run their websites. http://stackoverflow.com/questions/1906795/what-are-some-famous-websites-built-in-django Django is of course a very highly-regarded web framework written in python, but there are

Re: PyCon for students?

2012-07-27 Thread Michael Hrivnak
Having a conference during the summer is generally more expensive, because you have to compete with tourists for lodging and such. For this reason, summer-time conventions are often in places where nobody wants to be during the summer, like Phoenix. That said, Santa Clara probably isn't a cheap l

Re: from future import pass_function

2012-07-26 Thread Michael Hrivnak
In case the rest of the email didn't make it obvious, everything you quoted me on was sarcasm. I know those things can't be done, and I explained why they can't and shouldn't be done. Michael On Thu, Jul 26, 2012 at 5:16 AM, Devin Jeanpierre wrote: > On Thu, Jul 26, 2

Re: from future import pass_function

2012-07-26 Thread Michael Hrivnak
It's not uncommon for "pass" to be referred to as a control statement, although I see your point that it isn't exerting as much control over the flow of execution as others. As further evidence, this doc categorizes it as a "statement" within "flow control tools": http://docs.python.org/tutorial/c

Re: from future import pass_function

2012-07-25 Thread Michael Hrivnak
If we want pass(), then why not break() and continue()? And also def() and class()? for(), while(), if(), with(), we can make them all callable objects! Except that they are control statements. They are not objects, they have no type, and they can never be evaluated in an expression. And most

Re: How to safely maintain a status file

2012-07-09 Thread Michael Hrivnak
Please consider batching this data and doing larger writes. Thrashing the hard drive is not a good plan for performance or hardware longevity. For example, crawl an entire FQDN and then write out the results in one operation. If your job fails in the middle and you have to start that FQDN over,

Re: How to safely maintain a status file

2012-07-08 Thread Michael Hrivnak
What are you keeping in this status file that needs to be saved several times per second? Depending on what type of state you're storing and how persistent it needs to be, there may be a better way to store it. Michael On Sun, Jul 8, 2012 at 7:53 AM, Christian Heimes wrote: > Am 08.07.2012 13:2

Re: None shown in output

2012-06-21 Thread Michael Hrivnak
The last three lines print the return value from the "get_numbers" function, which isn't returning anything. In python, the default return value is None, and that's why you're seeing it. Michael On Thu, Jun 21, 2012 at 11:42 PM, Xander Solis wrote: > Hello Python list, > > Noob here with a newb

Re: Python script for device automatic update.

2012-06-15 Thread Michael Hrivnak
Let udev run your script when the appropriate device is connected. http://www.reactivated.net/writing_udev_rules.html Then you just need to run an ssh command against the correct mount point. Honestly, python might be overkill for this. Consider writing a very small bash script. Michael On Fr

Re: Finding all loggers?

2012-06-14 Thread Michael Hrivnak
>>> import logging >>> logging.Logger.manager.loggerDict {} >>> logging.getLogger('foo') >>> logging.getLogger('bar') >>> logging.Logger.manager.loggerDict {'foo': , 'bar': } Enjoy, Michael On Thu, Jun 14, 2012 at 5:03 PM, Roy Smith wrote: > Is there any way to get a list of all the loggers th

Re: why i can't read sda1 with python?

2012-06-04 Thread Michael Hrivnak
Which makes total sense. If any user could directly read the entire contents of the disk, filesystem permissions would be useless. Michael On Mon, Jun 4, 2012 at 4:14 AM, Xia wrote: > so only root or accounts in group disk can access /dev/sda1, -- http://mail.python.org/mailman/listinfo/pytho

Re: Maintaining Multiple Copies of Python (Linux)

2012-05-30 Thread Michael Hrivnak
http://www.virtualenv.org/ You can install multiple versions of the python interpreter in ubuntu without issue. You can use virtualenv to maintain different site packages for whatever purposes you need. Michael On Wed, May 30, 2012 at 4:38 PM, wrote: > Hi all, > > For various reasons, I would

Re: Python Gotcha's?

2012-04-05 Thread Michael Hrivnak
I'm surprised nobody beat me to posting this: >>> def foo(stuff=[]): ... stuff.append('bar') ... print stuff ... >>> foo() ['bar'] >>> foo() ['bar', 'bar'] >>> foo() ['bar', 'bar', 'bar'] On Wed, Apr 4, 2012 at 6:34 PM, Miki Tebeka wrote: > Greetings, > > I'm going to give a "Python Gotcha's"

Re: Re: Python Gotcha's?

2012-04-05 Thread Michael Hrivnak
This is not a gotcha, and it's not surprising. As John described, you're assigning a new value to an index of a tuple, which tuples don't support. a[0] += [3] is the same as a[0] = a[0] + [3] which after evaluation is the same as a[0] = [1, 3] You can always modify an item that happens to be

Re: Problem connecting to SMTP/IMAP server using SSL

2012-04-02 Thread Michael Hrivnak
m my laptop > using imaplib.IMAP4_SSL() without the VPN turned on. > > Thank you, > > Julien > > On Apr 2, 3:10 pm, Michael Hrivnak wrote: >> That method uses the default port 993.  Can you connect to that port >> at all from your computer?  For example, try using a teln

Re: Problem connecting to SMTP/IMAP server using SSL

2012-04-02 Thread Michael Hrivnak
That method uses the default port 993. Can you connect to that port at all from your computer? For example, try using a telnet client. Michael On Sat, Mar 31, 2012 at 1:39 AM, Julien wrote: > Hi, > > I'm able to connect to an Exchange server via SMTP and IMAP from my > iPhone using SSL and w

Re: why can't I pickle a class containing this dispatch dictionary?

2012-04-02 Thread Michael Hrivnak
Pickle cannot pickle a reference to an instance method. So the problem is that self.myDict has values which are references to instance methods. Without questioning what this is trying to do or why (I assume it's a proof of concept), here is a way to make it picklable: http://pastebin.com/1zqE52mD

Re: os.path.isdir do not work for Foder named '2011-07-03'

2011-07-18 Thread Michael Hrivnak
What is the output of: >>> os.path.exists("C:\Users\조창준\Desktop\logs\2011-07-03") ? One possible issue here is that for some reason os.path.isdir() can't even access the directory either because of permissions, misinterpretation of the path, or some other reason. Michael 2011/7/19 Nulpum : > I

Re: Looking for general advice on complex program

2011-07-16 Thread Michael Hrivnak
Multiple clients reading from and writing to a central collection of related data is a problem that has been largely solved. Use a database, and have the clients act on it with transactions. There's no reason to re-invent the wheel. You could have the clients connect to the database directly ove

Re: Proposal to extend PEP 257 (New Documentation String Spec)

2011-07-16 Thread Michael Hrivnak
Dodgy medium? Such as? I just avoid sending code over any medium that is going to change the text in any way. Are you sending it with an instant messenger client or something? There are lots of ways, some very convenient, to transfer files without them being modified. If you need to quickly sha

Re: Proposal to extend PEP 257 (New Documentation String Spec)

2011-07-14 Thread Michael Hrivnak
Was tried at least once before: http://www.python.org/dev/peps/pep-0287/ Check in here with your ideas: http://www.python.org/community/sigs/current/doc-sig/ Have any other languages mandated the use of a specific documentation markup? Michael On Thu, Jul 14, 2011 at 7:02 PM, rantingrick wrote

Re: Virtual functions are virtually invisible!

2011-07-10 Thread Michael Hrivnak
the language to accommodate your refusal to follow the most basic best practices. Best of luck, Michael On Sun, Jul 10, 2011 at 10:35 PM, rantingrick wrote: > On Jul 10, 7:31 pm, Michael Hrivnak wrote: >> It sounds to me like you need a better IDE, better documentation, >> and/or

Re: Virtual functions are virtually invisible!

2011-07-10 Thread Michael Hrivnak
It sounds to me like you need a better IDE, better documentation, and/or better code to work on and use. I don't understand why it's difficult to look at a derived class as see what methods are overridden. If you are working on the code, it is quite obvious what methods exist in the base class.

Re: parsing packets

2011-07-10 Thread Michael Hrivnak
In order to find the end of the packet, include a field that is the packet length. This is what IP packets do to find the end of their header. http://en.wikipedia.org/wiki/IPv4#Header And the TCP header (see "data offset") does the same: http://en.wikipedia.org/wiki/Transmission_Control_Protoco

Re: Question regarding DNS resolution in urllib2

2011-06-25 Thread Michael Hrivnak
That would be a help to you, and a way to give back to the open source community. Best of luck, Michael On Fri, Jun 24, 2011 at 6:17 AM, saurabh verma wrote: > Michael Hrivnak wrote: >> >> The latest libcurl includes the CURLOPTS_RESOLVE option >> (http://curl.haxx.se/libcur

Re: Online payment

2011-06-25 Thread Michael Hrivnak
There are many open-source options that you should consider before deciding to write your own. For example, Satchmo: http://www.satchmoproject.com/ Also, don't be afraid to integrate with something not written in python. If you can find something with a nice API that meets your needs, it's proba

Re: Emails backup in python 3.2

2011-06-21 Thread Michael Hrivnak
Why not use one of the many projects and products that are designed to store email? Do you have a special reason for wanting to implement your own email storage? I'm thinking that you can use fetchmail with your favorite mail store, and you won't need to write any code at all. http://fetchmail.b

Re: Strategy to Verify Python Program is POST'ing to a web server.

2011-06-18 Thread Michael Hrivnak
On Sat, Jun 18, 2011 at 1:26 PM, Chris Angelico wrote: > SSL certificates are good, but they can be stolen (very easily if the > client is open source). Anything algorithmic suffers from the same > issue. This is only true if you distribute your app with one built-in certificate, which does indee

Re: Question regarding DNS resolution in urllib2

2011-06-18 Thread Michael Hrivnak
The latest libcurl includes the CURLOPTS_RESOLVE option (http://curl.haxx.se/libcurl/c/curl_easy_setopt.html) that will do what you want. It may not have made its way into pycurl yet, but you could just call the command-line curl binary with the --resolve option. This feature was introduced in ve

Re: How do you copy files from one location to another?

2011-06-18 Thread Michael Hrivnak
Python is great for automating sysadmin tasks, but perhaps you should just use rsync for this. It comes with the benefit of only copying the changes instead of every file every time. "rsync -a C:\source E:\destination" and you're done. Michael On Fri, Jun 17, 2011 at 1:06 AM, John Salerno wrot

Re: Strategy to Verify Python Program is POST'ing to a web server.

2011-06-18 Thread Michael Hrivnak
Authentication by client SSL certificate is best. You should also look into restricting access on the server side by IP address. Michael On Sat, Jun 18, 2011 at 7:34 AM, mzagu...@gmail.com wrote: > Hello Folks, > > I am wondering what your strategies are for ensuring that data > transmitted to

Re: Easy function, please help.

2011-02-08 Thread Michael Hrivnak
Your function only works if n is an integer. Example: >>> num_digits(234) 3 >>> num_digits(23.4) 325 When doing integer division, python will throw away the remainder and return an int. Using your example of n==44, 44/10 == 4 and 4/10 == 0 Before each iteration of the while loop, the given exp