Blogsearch << pop full >>
-
Emillo Pucci Orange Python Box Clutch « My Fabolous Life
Emillo Pucci Orange Python Box Clutch. By Sierra Simone on 15 December 2011 in Accessories, Lifestyle with No Comments. Emillo Pucci Orange Python Box Clutch. Love this bright orange. Retails for $1750 ...
Dec. 15, 2011, 7:34 p.m.
-
Everything Sysadmin: Two interesting Python tutorials
Two interesting Python tutorials. A great explanation about "yield" followed by a discussion of coroutines and more: Generator Tricks for Systems Programmers; http://www.dabeaz.com/generators/Generators.pdf. In the sequel ...
Dec. 15, 2011, 3:53 p.m.
-
LOVE AESTHETICS | by Ivania Carpio: OUTFITS | Plastic and Python
OUTFITS | Plastic and Python. Photobucket jeans: Vintage Levi's turtleneck: H&M clear hair accessory: DIY bag: special edition Candy bag, gifted by Furla Took these pictures last Tuesday on what might have been the last ...
Dec. 15, 2011, 3:13 p.m.
-
Python Software Foundation News: PSF Proffers Payment to Port to ...
As news of Python 3 porting becomes a more frequent occurrence and Python 3.3 development takes strides towards becoming the version everyone wants, the PSF has their own way of helping: money. With a grant program ...
Dec. 15, 2011, 3 p.m.
-
Writing API clients in Perl and Python | Mark Allen [blogs.perl.org]
It's hard for me to be neutral vis a vis Perl and Python because I am much more comfortable writing Perl, but I felt like the release process for python was really not very straightforward. Learning how python projects write, ...
Dec. 14, 2011, 3:27 a.m.
-
CleanupManager for with statements « Python recipes « ActiveState ...
Inspired by unittest.TestCase.addCleanup(), CleanupManager provides a means to programmatically add resources to be cleaned up when leaving a with statement. This makes it easy to use with optional resources, and ...
Dec. 13, 2011, 7:20 p.m.
-
HTML template animation built on PyQuery « Python recipes ...
The beginnings of a class for "animating" plain HTML to produce a dynamic HTML output as an alternative to a templating language. It's inspired by Ruby's hquery library, which describes itself as "unobtrusive server scripting". ...
Dec. 13, 2011, 7:20 p.m.
-
Recursively walk Python objects « Python recipes « ActiveState Code
A small function that walks over pretty much any Python object and yields the objects contained within (if any) along with the path to reach them. I wrote it and am using it to validate a deserialized data-structure, but you can ...
Dec. 13, 2011, 5:42 p.m.
-
Montreal Python » Montréal-Python 26 : Jolly Justification
Monday, December 19th, 6 days before christmas, Montreal-Python is inviting you to their last 2011 meeting, at UQAM, Sherbrooke building, room SH-R810, 200 sherbrooke west. The event is free and even though we can't ...
Dec. 13, 2011, 4:01 a.m.
-
Improved Signals/Slots implementation in Python « Python recipes ...
As this uses WeakKeyDictionary and WeakSet, this is a Python 2.7+ implementation only. (I tested in Python 2.7 and Python 3.2) As a note, if you're using this in Python 2.7, you may want to consider changing 'self. ...
Dec. 13, 2011, 1:51 a.m.
-
QLD blonde spotted python - Aussie Pythons & Snakes
Sex: Male hey i want to buy an adult blonde spotted python email jtgriesel@hotmail.com.
Nov. 20, 2011, 2:58 a.m.
-
Python from Scratch – Create a Dynamic Website | Nettuts+
We've covered quite a bit of Python in the previous tutorials in this Session. Today, we're going to combine everything we've learned so far to build a.
Nov. 19, 2011, 9:32 p.m.
-
Python Is All the Rage and Michael Kors Watches Follows Suit ...
Michael Kors watches for 2011 includes the popular python pattern taken directly from the runway and interpreted for the wrist in a fun new watch. Bring a little jungle into your wardrobe with this striking design keeping with the ...
Nov. 19, 2011, 9 p.m.
-
Python Divide a string - Stack Overflow
up vote 0 down vote favorite. share [fb] share [tw]. I have a string like this: <td casd2" aasdeft" class="satyle3"> <b><a asddidasd?ct=Peasds&fasdaao=Monsdar &pID=19635"... I need the 19635. Someone can help me ? python string ...
Nov. 19, 2011, 8:35 p.m.
-
Robert Conley: Python
Python is a very versatile programming language. Additionally, it's flexible, fast, and high-level. I've reacquanted myself with it after spending a little time with it a couple of years ago when I was writing scripts for os calls. ...
Nov. 19, 2011, 7:42 p.m.
-
Python powered sprinkler system wastes no water - Hack a Day
One thing that annoyed [Jashua] to no end was hearing his automated sprinkler system kick on in the middle of the night, when it had rained earlier in the day. He wished that his sprinklers were a bit smarter, so he decided to ...
Nov. 19, 2011, 4:24 p.m.
-
Urwid for Python, a ncurses library
I really like ncurses programs, it's certainly what I use the most for an every day usage. The from Python provides some elements to build an application,
Nov. 19, 2011, 2:20 p.m.
-
Hilda Wagner Blog » Guide Critique Python 2.six Text Processing ...
Python 2.six Text Processing: Newcomers Manual by Jeff Mcneil. Pages 380. Publisher Packt Publishing Price tag – INR 1287 (ebook INR 942.65). Notice: People who would like to sample the guide can for the publisher's websites. This could ...
Nov. 19, 2011, 2:19 p.m.
-
Socket Broadcast Help « Python recipes « ActiveState Code
1. ▼. The classes in this module are stepping stones for building discoverable services on a network. Server replies are to be handled by the importer. Python, 78 lines. Download. Copy to clipboard ...
Nov. 19, 2011, 1:50 p.m.
-
Monty Python tshirt Nudge Nudge | T Shirt
now only : 14.99 Monty Python tshirt Nudge Nudge This awesome Monty Python tshirt features the fantastic Monty Python ...
Nov. 19, 2011, 12:55 p.m.
Delicious << pop full >>
-
Index of /~schwehr/Classes/2011/esci895-researchtools
Dec. 15, 2011, 8:17 p.m.
-
Python Ecosystem - An Introduction » mirnazim.org
Dec. 15, 2011, 8:16 p.m.
-
oop - What is a metaclass in Python? - Stack Overflow
Dec. 15, 2011, 8:12 p.m.
-
Project Euler
Dec. 15, 2011, 8:11 p.m.
-
sqlmap: automatic SQL injection and database takeover tool
Dec. 15, 2011, 8:10 p.m.
-
Photoshop Embedded Python Pipeline - Tech Artists Forums
Dec. 15, 2011, 8:05 p.m.
-
Hovertruck/sublime-pyflakes - GitHub
Dec. 15, 2011, 7:52 p.m.
-
Работа с PySide / Python / Хабрахабр
Dec. 15, 2011, 7:42 p.m.
-
Cookbook/Matplotlib -
Dec. 15, 2011, 7:34 p.m.
-
Think Python: How to Think Like a Computer Scientist
Dec. 15, 2011, 7:27 p.m.
-
ProdEagle - Welcome
Nov. 20, 2011, 2:04 p.m.
-
Mailgun Blog - Handle Incoming Emails like a Pro [Mailgun API 2.0]
Nov. 20, 2011, 2:04 p.m.
-
Getting Started with WSGI
Nov. 20, 2011, 1:58 p.m.
-
Pythex: a Python regular expression editor
Nov. 20, 2011, 1:57 p.m.
-
Python from Scratch – Create a Dynamic Website
Nov. 20, 2011, 1:57 p.m.
-
Installation of MySQL server on Apple Mac OS X 10.7 aka Lion | A Non-Programmer Approach to Django
Nov. 20, 2011, 1:57 p.m.
-
Python Extension Packages for Windows - Christoph Gohlke
Nov. 20, 2011, 1:57 p.m.
-
Python from Scratch – Create a Dynamic Website | Nettuts+
Nov. 20, 2011, 1:53 p.m.
-
Introduction to Programming using Python
Nov. 20, 2011, 1:53 p.m.
-
http://tin.nu/sudoku.html
Nov. 20, 2011, 1:52 p.m.
Diigo << pop full >>
-
Hidden Treasures of the Python Standard Library
Tags: python
Dec. 8, 2011, 10:02 a.m.
-
Web Sockets tutorial with simple Python server | @yaaang's blog
-
» Threaded Python Websocket Server And Javascript Client | NuBlue Blog
-
A minimal Python WebSocket server « Popdevelop – A developer team from Malmö, Sweden
-
getpython3.com
This site aims to be a resource for Python 3 for developers.
Tags: python development
Dec. 8, 2011, 9:48 a.m.
-
NLTKからKyTeaでコーパスを読み込むJPKyteaTokenizer作りました « once upon a time,
-
DjangoでJinja2を使いたいという話 « taichino.com
-
python - Project structure for Google App Engine - Stack Overflow
Tags: recommended python project structure
Dec. 8, 2011, 8:54 a.m.
-
jcalderone: Filesystem structure of a Python project
Tags: recommended python project structure
Dec. 8, 2011, 8:54 a.m.
-
What is the best project structure for a Python application? - Stack Overflow
Tags: recommended python project structure
Dec. 8, 2011, 8:53 a.m.
-
recommended python project structure - Google Search
Tags: python project structure recommended
Dec. 8, 2011, 8:53 a.m.
-
Python: Lambda Functions
Annotations:-
>>>foo = [2, 18, 9, 22, 17, 24, 8, 12, 27]
>>>
>>>print filter(lambda x: x % 3 == 0, foo)
[18, 9, 24, 12, 27]
>>>
>>>print map(lambda x: x * 2 + 10, foo)
[14, 46, 28, 54, 44, 58, 26, 34, 64]
>>>
>>>print reduce(lambda x, y: x + y, foo)
139 -
import commands
>>>
>>>mount = commands.getoutput('mount -v')
Tags: lambda python filter map reduce
Dec. 8, 2011, 8:35 a.m.
-
-
Spell Checking in Python - Blog::Quibb
-
30 free programming eBooks - citizen428.blog()
Tags: ebooks programming Free books javascript python perl haskell erlang
Dec. 8, 2011, 8:25 a.m.
-
pyjon.reports 0.6 : Python Package Index
"Pyjon.Reports is a module bridging z3c.rml, genshi and pypdf together to provide a simple mean of creating templated pdf documents in python."
Tags: opensource python reports pdf templates programming development libraries
Dec. 8, 2011, 8:24 a.m.
-
Hooked on Mnemonics Worked for Me: xxxswf.py
-
Python Ecosystem
Tags: python
Dec. 8, 2011, 8:05 a.m.
-
Getting started with the SciPy (Scientific Python) library
-
Python decorator mini-study (part 1 of 3)
-
11 : Do You Speak my Language? - Over the Years
Dzone << pop full >>
-
A Python tutorial on Data Types Supported by Pyhton and Operators, Type Conversion
A tutorial on Python Data types, Operators and Type Conversion.
Dec. 15, 2011, 3:45 p.m.
-
Python Mock: how to assert a substring of logger output
A way to unit test a method's error handling if the method can't raise exceptions.
Dec. 15, 2011, 2:24 p.m.
-
Pulp - Open Source repository management from RedHat
Pulp is a Python application for managing software repositories and their associated content, such as packages, errata, and distributions. It can replicate software repositories from a variety of supported sources, such as http/https, file system, ISO, and RHN, to a local on-site repository. It provides mechanisms for systems to gain access to these repositories, providing centralized software installation.
Nov. 18, 2011, 12:41 a.m.
-
Javascript In Your Ruby: Mongoid Map Reduce
We’re pretty fond of MongoDB at work and I’ve been getting an opportunity to kick some of the more interesting tyres recently. I thought I’d document something I found myself doing here, half hoping it might be useful for anyone else with a similar problem and also to see if anyone else has a much neater approach. The examples are obviously pretty trivial, but hopefully you get the idea.
Nov. 17, 2011, 4:13 p.m.
-
The NoSQL Paradox
Ladies and gentlemen, I present the NoSQL Paradox: if a company chooses to store its data in a comparatively esoteric datastore, they'll be able to hire better programmers, because they'll attract only those who cared enough to learn it. And for programmers the paradox is even more pronounced: the datastores to learn, if you want to get a good job, are the datastores that people don't learn merely to get a job. See what I did there?
Nov. 16, 2011, 4:41 p.m.
-
Creating Your Own Freaking Awesome Programming Language
IMHO, every software developer should go through the mental process of learning how to write a parser or how to build a compiler. The key is understanding the common patterns found across language implementations. It makes you better as a programmer!
Nov. 16, 2011, 1 p.m.
-
Good to Great Python reads
Extensive list of excellent Python resources, for all levels of Python expertise.
Nov. 16, 2011, 12:16 p.m.
-
Developing (a.k.a. Testing) in Python - Part 1: Python and Java
The first article in Daniel Gottlieb's series "Developing (a.k.a. Testing) in Python" is a comparison between Python test cases and java compile-time checking.
Nov. 16, 2011, noon
-
Danger with django expression objects
I've recently been dealing with a bunch of concurrency issues in our django app.
Nov. 16, 2011, 4:53 a.m.
-
Coding Challenge: The Luhny Bin
Try your hand at this coding challenge devised by Bob Lee of Square. Do you have what it takes to escape the Luhny Bin?
Nov. 15, 2011, 5:27 p.m.
-
What to Use for Python Web Applications
My friend Jamie Rumbelow has started a new project and decided to use Python. He asked a great question over on Stack Overflow which basically came down to what should I use for my first proper Python web application project
Nov. 14, 2011, 6:17 p.m.
-
Python Zone - Everything for the Python & Django developer
Everything for the Python & Django developer. Vote this up if you like python!
Nov. 14, 2011, 12:38 p.m.
-
OpenCV in Python
OpenCV (Open Source Computer Vision) is a library of programming functions for real time computer vision [Ref]. In this post we will see how to use some of the basic functions of OpenCV in Python.
Nov. 14, 2011, 5:14 a.m.
-
Codemash ticket give away
CodeMash is a unique event that will educate developers on current practices, methodologies, and technology trends in a variety of platforms and development languages such as Java, .Net, Ruby, Python and PHP.. Here is your change to win a free ticket
Nov. 11, 2011, 7:41 a.m.
-
Google App Engine 1.6.0 Out of Preview Release: Python 2.7 and MapReduce
When we announced our plans to leave preview earlier this year, we made a commitment to improving the service by adding support for Python 2.7, Premier Accounts and Backends as well as several changes launching today:
Nov. 9, 2011, 3:45 p.m.
-
Stackato, a Private PaaS for Python, PHP, Java, and more, gets Management and Monitoring
Stackato is an infrastructure-agnostic PaaS built on top of Cloud Foundry. It extends Cloud Foundry and enables a private PaaS for Python, Java, Ruby,PHP, Perl, and Node.js applications.
Nov. 9, 2011, 5:48 a.m.
-
Google Python Class Day 2 Part 4
Conclusion tutorial covering latest functionality.
Nov. 8, 2011, 2:19 p.m.
-
Face and eyes detection in OpenCV
This post shows how to use a Haar Classifier in OpenCV in order to detect faces and eyes on an image.
Nov. 4, 2011, 4:05 p.m.
-
Getting Setup with Python
Quick guide for entire newbies for getting setup with their python environment. The first post in a multi-part series.
Nov. 3, 2011, 4:49 p.m.
-
The 'ugliness' of Python
I want to take on a big question, one that nobody’s really answered: which language is more beautiful, Ruby or Python?
Nov. 3, 2011, 4:49 p.m.
Reddit << pop full >>
-
Early Christmas present: WebFaction raises the memory for shared hosting plans to 256MB, including existing accounts. :-)
-
Scripting KVM with Python, Part 1: libvirt
-
Beginner at Programming, Where Should I Go Next?
submitted by FitSkeezixI recently became interested in learning about computer science and programming and went through MIT's 6.00 Introduction to CS open course ware course which uses Python to teach the basics of computer programming. I'm wondering where would be the best place to continue learning. The next logical step would be to take MIT's first course for CS majors, but the only one available is from 2005, when they still used Scheme. Would it be worth trying to tackle a new language so early on in my learning when I only have a basic grasp of Python at this point?
Thanks in advance to anyone who bothers to respond.
[link] [4 comments]
Dec. 15, 2011, 3:10 p.m.
-
Got myself into a multithreaded mess
submitted by AeroNotixHi all!
In creating a pdf-to-tif conversion tool, I ended up needing it to be multithreaded due to the way in which a particular third-party executable would not correctly return that it had completed. Also, due to the way Qt works, I needed to use Qt specific threading elements (Qt threads can emit signals and communicate with the main GUI thread, regular Python threads, cannot).
Overall, this was working pretty well, except that the aforementioned executable still wouldn't return properly and allowed itself to fire off the entire thread stack of work at the same time, bringing the system to a crawl.
I created a new set of classes, using
QRunnableas the task, and aQThreadPoolas the threadhandler, this works great, except I cannot get the threads to synchroniously communicate with the GUI thread.My flow works like this:
When the convert method is fired, it creates a thread in a pool, which then iteratively fires off a new thread inside a new threadpool, which each new thread has it's own
QObject(sinceQRunnabledoesn't have it's own method for firing signals), and when it is completed it calls a method in the main class to update it's progress bar.Each new class that is created receives the
clsparameter all the way from convert. This is where we get the reference to the main class to call it's method.What's strange is that the
cls.update_progress_barmethod is being called, as when all the processing is complete, it updates the progress bar as if nothing happened. Except it does it at the end of processing, which is useless, and also hangs the window whilst it's doing it.I cannot seem to figure out where it's hanging, as the thread which is creating all the other threads is called within 0.001s (I thought maybe it was hanging creating the threads themselves).
Any help would be greatly appreciated!
[link] [26 comments]
Dec. 15, 2011, 1:45 p.m.
-
Dead Simple Connection Pooling with Twisted
-
No one should be forced to parse XML using DOM. That's why I wrote this module.
-
PyCon US 2012: I've got something special for you.
-
Secure Python programming hints anyone?
submitted by dgrogzI'm going to a capture the flag hacking contest at my university tomorrow. My job in my team is to secure the services written in Python. Does /r/python have some good advice?
[link] [12 comments]
Dec. 14, 2011, 5:22 p.m.
-
wxPython Project Phoenix Documentation Beta Released
-
pretty solid Python metaclasses explanation from Stackoverflow community Wiki
-
Any of you guys use Doxygen with Python? If so how did it go.
submitted by The_SourgrapesJust curious about the experiences of others before I jump in. I would love to learn from your mistakes :P
[link] [7 comments]
Dec. 14, 2011, 3:10 a.m.
-
wxPython 101: Creating Taskbar Icons
-
Generators and iterators form the backbone of how Python deals with infinite lists of data. Computer Science folk might be a little bored now, because this is the only data structure that matters to non-theoretical branches of science, physics and engineering...
-
PyCharm 2.0 (Python/Django IDE) released, adds Mako, Jinja2, Cython support and more
-
Installing Numpy and Scipy on Mac OSX
submitted by BobbyBentonHey all,
Just new to Mac (used to use Ubunutu and the like), and trying to install Numpy and Scipy seems ridiculously hard compared to other Unix based systems.
I have perused the interwebs and have found a few dead ends on how to install Numpy and Scipy. I have got Homebrew working, and have installed python 2.7.2 there and also the fortran compiler.
I used the following instructions to do the above:
$ brew install python $ brew install gfortran $ brew install pkg-config $ easy_install pip $ pip install numpySauce: https://jholewinski.wordpress.com/2011/07/21/installing-matplotlib-on-os-x-10-7-with-homebrew/
but this does not seem to be working... Help a nublet out, will ya?!
Many thanks!
EDIT A big big thank you to everyone that has posted. It means a lot that you people would help out some random person on the internet.
For future reference, I ended up installing Fink for Mac OS 10.7 and have so far installed NumPy, SciPy, and Matplotlib, without too much hassle, it has just taken quite some time for Fink to organise and install all the relevant dependencies.
I hope that helps people out in the future!
[link] [17 comments]
Dec. 13, 2011, 10:04 a.m.
-
Announcing TurboGears 2.1.4
-
How would one go about creating a virtual microphone device in Python?
submitted by terremotoThere's a lot of background noise on my laptop's microphone when I'm on Linux, but using Audacity, I can do a pretty good job of elimnating the noise. However, that isn't very useful for live recordings for things like VOIP. On Windows, the driver included a feature to handle this, and I want to recreate this is Linux using pyaudio and numpy to handle processing the data, but right now, I can't figure out how to emulate a microphone. Any pointers greatly appreciated.
[link] [18 comments]
Dec. 13, 2011, 4:42 a.m.
-
For fun: color coded trove classifiers
-
Python URL manipulation
-
Help! Why's my recursive loop eating dictionary values? (Code inside!)
submitted by confusedbeginner2011Basic stuff here, but I'm trying to read through a directory and return a dictionary with the values being a list of images in a subdirectory, and the keys being the path to the subdirectory.
def imagesWithSubdirectories(path): dictionary = {} for items in os.listdir(path): imageList = [] newPath = os.path.join(path, items) if newPath[-4:] == '.gif' or newPath[-4:] == '.jpg' or newPath[-4:] == '.bmp' or newPath[-4:] == '.png': print "Found an image at %s!" % newPath imageList.append(newPath) dictionary[path] = imageList elif os.path.isdir(newPath) == True: print "Found a directory, going recursive at %s!" % newPath imagesWithSubdirectories(newPath) return dictionarySo, I'm getting close, but I'm losing the values of imageList each time through the for loop, so at the end of execution I have a dictionary that looks like:
{'original path' : [last image processed in that path]}Any ideas?
[link] [11 comments]
Dec. 13, 2011, 1:48 a.m.
Stackoverflow << pop full >>
-
How can you parse xml in Google Refine using jython/python ElementTree
I trying to parse some xml in Google Refine using Jython and ElementTree but I'm struggling to find any documentation to help me getting this working (probably not helped by not being a python coder)
Here's an extract of the XML I'm trying to parse. I'm trying to return a joined string of all the
dc:indentifier:<oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd"> <dc:creator>J. Koenig</dc:creator> <dc:date>2010-01-13T15:47:38Z</dc:date> <dc:date>2010-01-13T15:47:38Z</dc:date> <dc:date>2010-01-13T15:47:38Z</dc:date> <dc:identifier>CCTL0059</dc:identifier> <dc:identifier>CCTL0059</dc:identifier> <dc:identifier>http://open.jorum.ac.uk:80/xmlui/handle/123456789/335</dc:identifier> <dc:format>application/pdf</dc:format> </oai_dc:dc>Here's the code I've got so far. This is a test to return anything as right now all I'm getting is 'Error: null'
from elementtree import ElementTree as ET element = ET.parse(value) namespace = "{http://www.openarchives.org/OAI/2.0/oai_dc/}" e = element.findall('{0}identifier'.format(namespace)) for i in e: count += 1 return count
Dec. 15, 2011, 8:29 p.m.
-
Django - Inline (has no ForeignKey to)
I'm trying to implement
InlineModelsBut i'm getting error message. Will you please help me ? thank youmyproject.api.models
from django.db import models from django.contrib.auth.models import User from myproject.song.models import Album, Song, Artist class UserLibrary(models.Model): user = models.ForeignKey(User)myproject.api.admin.py
from django.contrib import admin from myproject.song.models import Song, Album, Artist, Music from myproject.api.models import UserLibrary class SongInline(admin.TabularInline): model = Song class UserLibraryAdmin(admin.ModelAdmin): search_fields = ['user'] inlines = [ SongInline, ] admin.site.register(UserLibrary, UserLibraryAdmin)Here is my traceback
Exception at /admin/api/userlibrary/add/ <class 'myproject.song.models.Song'> has no ForeignKey to <class 'api.models.UserLibrary'>
Dec. 15, 2011, 8:28 p.m.
-
Opensource Online IDE
There're several online IDEs for PHP and some even for Python, but is there any open-source online IDE like IDEone that supports atleast the major languages (PHP, Python, Ruby etc..)?
Dec. 15, 2011, 8:23 p.m.
-
load parameters from a file in Python
I am writing a Python class to model a process and I want to initialized the parameters from a file, say
'input.dat'. The format of the input file looks like this.'input.dat' Z0: 0 0 k: 0.1 g: 1 Delta: 20 t_end: 300The code I wrote is the following. It works but appears redundant and inflexible. Is there a better way to do the job? Such as a loop to do readline() and then match the keyword?
def load(self,filename="input.dat"): FILE = open(filename) s = FILE.readline().split() if len(s) is 3: self.z0 = [float(s[1]),float(s[2])] # initial state s = FILE.readline().split() if len(s) is 2: self.k = float(s[1]) # kappa s = FILE.readline().split() if len(s) is 2: self.g = float(s[1]) s = FILE.readline().split() if len(s) is 2: self.D = float(s[1]) # Delta s = FILE.readline().split() if len(s) is 2: self.T = float(s[1]) # end time
Dec. 15, 2011, 8:23 p.m.
-
Python date time, get date 6 months from now
I am using the datetime module. I am looking to calculate the date 6 months from the current date. Could someone give me a little help doing this?
Edit: The reason I am wanting to generate a date 6 months from the current date is to produce a Review Date. If the user enters data into the system it will have a review date of 6 months from the date they entered the data. Does this help?
Cheers
Eef
Dec. 15, 2011, 8:21 p.m.
-
Beautifulsoup parse through poor tags
My understanding is that regex is the poor man's approach to dealing with beautifulsoup, but I was wondering if it's my only option if there aren't well defined tags in the html I'm trying to parse?
I'm ultimately just trying to get some simple data from the html...but it's just in a series of tables that look like this:
<table width="733" border="0" cellpadding="2"> <tr> <td align="right" valign="top" nowrap="nowrap" bgcolor="#29ff36"> <font size="-1" face="Verdana, Arial, Helvetica, sans-serif"> <strong> PART CODE: </strong> </font> </td> <td align="left" valign="top" nowrap="nowrap"> <font size="-1" color="#7b1010" face="Verdana, Arial, Helvetica, sans-serif"> PART# (//THIS IS WHAT I WANT) </font> </td> <td> </td>Is there a good way to approach this without regex?
Thanks for the help guys. This site is incredible
Dec. 15, 2011, 8:20 p.m.
-
Matplotlib animations - how to export them to a format to use in a presentation?
So, I learned how to make cute little animations in matplotlib. For example, this:
import numpy as np import matplotlib import matplotlib.pyplot as plt plt.ion() fig = plt.figure() ax = fig.add_subplot(111) ax.set_xlim(0, 1) ax.set_ylim(-2,2) dt = 0.01 q = 0.01 t = np.arange(0,1,dt) x = np.sin(2*np.pi*t) line, = ax.plot(t,x, '-') fig.canvas.draw() for i in xrange(100): x = (1-q) * x + q* np.random.normal(size = len(t)) line.set_ydata(x) fig.canvas.draw()This works and it's very nice. But how I use this to make a movie I can display, for example, in a pdf presentation? I tried to do
fig.savefig("test.gif")but there's an error message indicating that matplotlib doesn't export gifs.Is there a way of doing this without resorting to external tools (like making a lot of png's and stitching them together)?
Dec. 15, 2011, 8:17 p.m.
-
how to pass 'F' key events etc to python subprocess
I'm trying to control a program in DOS using the python subprocess module. How do I pass keyboard actions/events (e.g. F1,...,F12, Alt, Alt-Shift etc) to the program? e.g.
proc=Popen(['my_program','keyboard actions'],stdin=PIPE,stdout=PIPE,shell=True)
Dec. 15, 2011, 8:16 p.m.
-
Check if request is AJAX in Python
Is there a way to check if a request is AJAX in Python?
The equivalent of PHP's
$_SERVER['HTTP_X_REQUESTED_WITH'] == 'xmlhttprequest'?
Dec. 15, 2011, 8:12 p.m.
-
Numpy matrix power/exponent with modulo?
Is it possible to use numpy's linalg.matrix_power with a modulo so the elements don't grow larger than a certain value?
Dec. 15, 2011, 8:10 p.m.
-
Python C extension: Use extension PYD or DLL?
I have a Python extension written in C and I wonder if I should use the file extension DLL or PYD under Windows. (And what would I use in Linux?)
Are there any differences (besides the filename)?
I found an unofficial article. Is this the secret of pyc? Why can't I find any official article on this topic?
Dec. 15, 2011, 8:10 p.m.
-
appengine import_transform custom value
From what I could figure out, it is not very easy to assign default values to properties in the bulkloader.yaml file. I learned that one way to set default values is to write your own function:
- property: status external_name: status import_transform: extrabulkloadfunctions.staticvalue(int)So I modified the transform.none_if_empty(int) function so that it returns the string 'in queue' instead of None.
def staticvalue(fn): def wrapper(value): if value == '' or value is None: return 'in queue' return fn(value) return wrapperI was wondering though, since input_transform only accepts a function, whether it would be possible to pass in a default value so that I don't have to write a new function for every single kind of default value I want to pass in. I.E:
import_transform: extrabulkloadfunctions.staticvalue("default A") import_transform: extrabulkloadfunctions.staticvalue("default B")etc.
Thanks!
Dec. 15, 2011, 8:04 p.m.
-
ConfigParser with Unicode items
my troubles with ConfigParser continue. It seems it doesn't support Unicode very well. The config file is indeed saved as UTF-8, but when ConfigParser reads it it seems to be encoded into something else. I assumed it was latin-1 and I thougt overriding
optionxformcould help:-- configfile.cfg -- [rules] Häjsan = 3 ☃ = my snowman -- myapp.py -- # -*- coding: utf-8 -*- import ConfigParser def _optionxform(s): try: newstr = s.decode('latin-1') newstr = newstr.encode('utf-8') return newstr except Exception, e: print e cfg = ConfigParser.ConfigParser() cfg.optionxform = _optionxform cfg.read("myconfig")Of course, when I read the config I get:
'ascii' codec can't decode byte 0xc3 in position 0: ordinal not in range(128)I've tried a couple of different variations of decoding 's' but the point seems moot, since it really should be a unicode object from the beginning. After all, the config file is UTF-8? I have confirmed that's something is wrong in the way ConfigParser reads the file by stubbing it out with this DummyConfig class. If I use that then everything is nice unicode, fine and dandy.
-- config.py -- # -*- coding: utf-8 -*- apa = {'rules': [(u'Häjsan', 3), (u'☃', u'my snowman')]} class DummyConfig(object): def sections(self): return apa.keys() def items(self, section): return apa[section] def add_section(self, apa): pass def set(self, *args): passAny ideas what could be causing this or suggestions of other config modules that supports Unicode better are most welcome. I don't want to use
sys.setdefaultencoding()!
Dec. 15, 2011, 8:01 p.m.
-
doxygen, python and function parameters
Doxygen get me docs similarly to
http://www.stack.nl/~dimitri/doxygen/examples/pyexample/html/classpyexample_1_1PyClass.html
But I want to see Functions with parameters similarly to c/c++.
Is there some settings for that?
Dec. 15, 2011, 7:56 p.m.
-
Shared Non-Contiguous-Access Numpy Array
I have a numpy array that I would like to share between a bunch of python processes in a way that doesn't involve copies. I create a shared numpy array from an existing numpy array using the sharedmem package.
import sharedmem as shm def convert_to_shared_array(A): shared_array = shm.shared_empty(A.shape, A.dtype, order="C") shared_array[...] = A return shared_arrayMy problem is that each subprocess needs to access rows that are randomly distributed in the array. Currently I create a shared numpy array using the sharedmem package and pass it to each subprocess. Each process also has a list, idx, of rows that it needs to access. The problem is in the subprocess when I do:
#idx = list of randomly distributed integers local_array = shared_array[idx,:] # Do stuff with local arrayIt creates a copy of the array instead of just another view. The array is quite large and manipulating it first before shareing it so that each process accesses a contiguous range of rows like
local_array = shared_array[start:stop,:]takes too long.
Question: What are good solutions for sharing random access to a numpy array between python processes that don't involve copying the array?
The subprocesses need readonly access (so no need for locking on access).
Dec. 15, 2011, 7:45 p.m.
-
Full Mesh Creation from User Inputs in Python
I am working on creating a full mesh as per user inputs with weights, other parameters associated to each edge. As of now, I have a naive implementation of it.
import sys weit = input("Enter Number of Weights: ") int(weit) for i in range(0,weit): print "Enter details for weit ",i+1 source=int(input("Enter source:")) destination=int(input("Enter Destination:")) weight=int(input("Enter Weight:")) param=int(input("Enter Param:"))With the graph data I have collected, I will design a bin packing algorithm. Is there a better way to create the Full Mesh as per user inputs in Python.
EDIT 1:
import sys import networkx as nx i_nodes=input("Enter number of nodes") print "Graph Creation" G=nx.complete_graph(i_nodes)Any idea, about how to add user input weights and other parameter values to each bidirectional edge to a complete graph in Networkx?
Dec. 15, 2011, 7:39 p.m.
-
Python max and min problems
I'm pretty new to Python, and what makes me mad about my problem is that I feel like it's really simple.I keep getting an error in line 8. I just want this program to take the numbers the user entered and print the largest and smallest, and I want it to cancel the loop if they enter negative 1.
"'int' object is not iterable" is the error.
print "Welcome to The Number Input Program." number = int(raw_input("Please enter a number: ")) while (number != int(-1)): number = int(raw_input("Please enter a number: ")) high = max(number) low = min(number) print "The highest number entered was ", high, ".\n" print "The lowest number entered was ", low, ".\n" raw_input("\n\nPress the enter key to exit.")
Dec. 15, 2011, 7:34 p.m.
-
Comment conventions in python
It seems like you can use both
'''comments...'''and"""comments..."""for multi-line comments. Is there any substantive difference between the two, or is it just a matter of preference?
Dec. 15, 2011, 7:30 p.m.
-
Pythonic way to send contents of a file to a pipe and count # lines in a single step
given the > 4gb file myfile.gz, I need to zcat it into a pipe for consumption by Teradata's fastload. I also need to count the number of lines in the file. Ideally, I only want to make a single pass through the file. I use awk to output the entire line ($0) to stdout and through using awk's END clause, writes the number of rows (awk's NR variable) to another file descriptor (outfile).
I've managed to do this using awk but I'd like to know if a more pythonic way exists.
#!/usr/bin/env python from subprocess import Popen, PIPE from os import path the_file = "/path/to/file/myfile.gz" outfile = "/tmp/%s.count" % path.basename(the_file) cmd = ["-c",'zcat %s | awk \'{print $0} END {print NR > "%s"} \' ' % (the_file, outfile)] zcat_proc = Popen(cmd, stdout = PIPE, shell=True)The pipe is later consumed by a call to teradata's fastload, which reads from
"/dev/fd/" + str(zcat_proc.stdout.fileno())This works but I'd like to know if its possible to skip awk and take better advantage of python. I'm also open to other methods. I have multiple large files that I need to process in this manner.
Dec. 15, 2011, 7:20 p.m.
-
Migrate App engine python appliaction to Appscale platform
How can i migrate complete App engine python appliaction to appscale which is installed on Amazon EC2.?
i need to migrate All datastore records, Cron Job, taskqueue and index. The Appengine is currently running now.
Dec. 15, 2011, 7:15 p.m.