Posts by avelino • 352 points
18 posts
-
0
votes5
answers989
viewsA: How to remove an Element from an XML with Python?
Like the BeautifulSoup, usually it meets most of the XML reading problems well, but it is important you see the other types of parsers it has, if you need to know how to handle.…
-
1
votes1
answer290
viewsA: How to create a Connection Pool using python and sqlAlchemy?
Follow the documentation page: http://docs.sqlalchemy.org/en/latest/core/pooling.html Take an example: engine = create_engine('postgresql://me@localhost/mydb', pool_size=20, max_overflow=0) If you…
-
1
votes1
answer54
viewsA: What if I don’t want any queryset in a Django view?
I believe you are using Generic view (so your impression of needing a query), see all types of Generic views: https://docs.djangoproject.com/en/1.10/ref/class-based-views/ Most basic generic view:…
-
0
votes1
answer91
viewsA: Proxy problem (enterprise) using dev_appserver.py - GAE
The big problem is that your CMD is not with active proxy, you need to raise http_proxy within your CMS: Access the control panel and click on Systems Goes into advanced (tab), click on environment…
-
1
votes1
answer65
viewsA: Python Open-ID Framework
If you want to access only Google services there is a lib called gdata[1] maintained by Google, here is the documentation[2], here[3] Google talks a little more about it. If you want a lib to…
-
1
votes1
answer229
viewsA: uwsgi configuration for high traffic
This depends a lot on the machine you are using too! From what I saw in your configuration this going up only 1 worker, IE, you have a uwsgi process serving with 4 processes, I recommend going up…
-
1
votes1
answer114
viewsA: Code running in background on Google App Engine
The Task Queue Java API will help in what you need: https://developers.google.com/appengine/docs/java/taskqueue/ I put a few examples for you to understand how it works... Tasks within transactions:…
-
0
votes3
answers1401
viewsA: HTML 5 audio player with forward/backward
I recommend you look at the flowplayer, it is very good and in case the browser does not support Html5 it does fallback to flash! http://flowplayer.org/ I used it in the Jovempan FM project that…
-
3
votes3
answers16338
viewsA: How to create and read an XML with Python?
There are several ways to read XML with Python, one of the simplest ways is the Xmltodict, it converts the XML structure to a Dict (Python dictionary): https://pypi.python.org/pypi/xmltodict Take an…
-
1
votes2
answers1175
viewsA: Python Numpy library
The numpy needs some libs (dll) from the operating system with this the LFD UCI, generated some executables for Windows where simplifies the installation, follows below the mirror:…
-
0
votes6
answers1877
viewsA: Code refactoring to convert GPS coordinates into DMS format into an array
I think this might solve your problem: <?php function DMStoDEC($deg,$min,$sec) { // Converts DMS ( Degrees / minutes / seconds ) // to decimal format longitude / latitude return…
-
3
votes3
answers3083
viewsA: How to do a search ignoring Python accent?
You can write a method to remove accents: import unicodedata def remove_accents(input_str): nkfd_form = unicodedata.normalize('NFKD', input_str) only_ascii = nkfd_form.encode('ASCII', 'ignore')…
-
2
votes5
answers989
viewsA: How to remove an Element from an XML with Python?
The easiest way to mess with XML that I found until today was using xmltodict, That doesn’t mean it’s performatic. Follow the example of how to use: doc = xmltodict.parse(""" <mydocument has="an…
-
2
votes1
answer226
viewsA: How to upload with progress bar using pyside qftp?
In the pyside you have a method called Qprogressbar, he does exactly what you need. self.client = QtNetwork.QFtp() self.connect(self.client, QtCore.SIGNAL('stateChanged(int)'), self.updateStatus)…
-
2
votes5
answers1562
viewsA: Optimize function to include classes also looking in sub-directories
You can use the spl_autoload, see an example: spl_autoload_register(NULL, FALSE); spl_autoload_extensions('.php'); spl_autoload_register(); set_include_path(get_include_path() . PATH_SEPARATOR .…
-
0
votes3
answers716
viewsA: Django: How to group records using the YEAR from a Fielddate field?
In Django we don’t have group by, but thinking about these kind of cases we created the Aggregate and annotate[1] >>> from django.db.models import Count >>> pubs =…
-
0
votes3
answers1932
viewsA: Is there a more efficient way to create an array from another array dynamically, filtering the contents of the first one?
You can use the set from python it removes repeated items from a list. >>> a = [1,2,3] >>> b = a + [4,5,6,3,2,1] >>> print b [1, 2, 3, 4, 5, 6, 3, 2, 1] >>> print…
-
4
votes4
answers5034
viewsA: Set Custom Error 403 Page
Just pass the file walk: ErrorDocument 403 /dir/file.html Another reference: https://stackoverflow.com/questions/8703540/custom-error-403-page-php…