text
stringlengths
256
65.5k
Django REST Framework Django REST framework is a powerful and flexible toolkit that makes it easy to build Web APIs. Some reasons you might want to use REST framework: The Web browseable API is a huge usability win for your developers. Authentication policies including OAuth1a and OAuth2 out of the box. Serialization t...
Pacer Pacer is a JRuby library that enables very expressive graph traversals. Pacer allows you to create, modify and traverse graphs using very fast and memory efficient stream processing thanks to the very cool Pipes library. That also means that almost all processing is done in pure Java, so when it comes the usual R...
Selected ramblings of a geospatial tech nerd Best bang for your analytical buck As (geo)data scientists, we spend much of our time working with data models that try (with varying degrees of success) to capture some essential truth about the world while still being as simple as possible to provide a useful abstraction. ...
Editor's note: Meerkat predated the popularity of syndication, feed services, and feed readers. Now that other groups are providing this service, we have removed Meerkat in favor of their better solutions. We maintain these articles for the sense of historical interest. Meerkat, O'Reilly Network's Open Wire Service, ex...
After spending a lot of time in Scheme, it’s hard not to think in recursion from time to time. When I recently started to improve my Python skills, I missed having Scheme optimize my tail recursive calls. For example, consider the mutually recursive functions even and odd. You know a number, n, is even if it is 0, or i...
Helping web2py: Bugs, enhancements and documentation web2py is very welcoming towards bug reports, documentation improvements and enhancements. Google Group The main forum for discussing bugs and new features is: web2py-users (URL is https://groups.google.com/forum/#!forum/web2py) Filing a bug report via Google Code If...
Is there a way to concat numbers in Python, lets say I have the code print(2, 1) I want it to print 21, not 2 1and if i use "+", it prints 3. Is there a way to do this? You could perhaps convert the integers to strings: print(str(2)+str(1)) Use the string formatting operator: print "%d%d" % (2, 1) EDIT: In Python 2....
i'm trying to get a total of sales by category. I know there is a way to do this with python, but i would rather do it with querys or aggregation. My models: class Item(models.Model): category= models.ForeignKey(Category) name = models.CharField(max_length=40) class Category(models.Model): name = models.CharFi...
Web2py supports multiple database connections since Fall 2007. It also supports distributed transactions (for postgresql, mysql and firebird) Assuming you have two (or more) connections let's say: db1=DAL('postgres://...') db2=DAL('firebird://...') in your models or controllers, you can commit them both explicitly wit...
What’s your new year’s resolution? One of mine is to be more active in helping and mentoring new Pythonistas, which is why I wrote the twitter bot behind @PythonQuestions. Inspired by the @MongoQuestion twitter bot, @PythonQuestions tweets new Stack Overflow questions tagged “Python”. How it Works The Stack Overflow po...
goyou [Astuce] Calculatrice Numpy dans Python dans un Terminal [Résolu] Bonjour, Pour quelqu'un qui a déjà installé numpy sur son pc, l'idée est de pouvoir invoquer un terminal qui charge python et qui charge numpy automatiquement pour s'en servir comme d'une calculatrice. C'est-à-dire qu'on obtient une fenetre en lign...
/projects/mymath$ ls __init__.py __init__.pyc mymath.py mymath.pyc tests and under the directory tests I have /projects/mymath/tests/features$ ls steps.py steps.pyc zero.feature I tried to import my factorial function sys.path.insert(0,"../../") #import mymath from mymath.MyMath import factorial But it said No...
alex2423 Plus d'accès à la TV de SFR via VLC sur le PC Hello tout le monde, Je fais partie de ceux qui n'ont pas de TV. J'ai juste un bel écran Dell 24" que j'utilise comme TV. Je regardais la TV avec VLC via le flux SFR. Depuis 1 mois à peu près, je n'ai plus d'image. J'ai encore le son. Est ce que vous avez ce meme s...
Introduzione web2py[web2py] è un framework open source per lo sviluppo agile di applicazioni web sicure ed incentrate sui dati; è scritto ed è programmabile in Python[python]. web2py è un full-stack framework, contiene cioè tutti i componenti necessari per costruire applicazioni web pienamente funzionanti. web2py è pro...
I'm testing out various phylogenetic libraries in Python. I want to read in a Newick tree, then, given a list of taxa, generate the smallest tree that contains them all. This task is quite simple and efficient in dendropy and ete2: newick = '((raccoon, bear),((sea_lion,seal),((monkey,cat), weasel)),dog);' taxa = ['racc...
Have you ever wondered: what is the correct way to check if a Javascript variable is an Array? Do a Google search and you will get a great variety of answers. And, unfortunately, there's is no correct answer. This is one of the sad things about Javascript, not only are there many varying implementations of the language...
Sawdust Software We code for those who create Written by Mike Salguero Published October 29, 2013 I have been an Obama fan for years, and generally have given him the benefit of the doubt on a lot of hard decisions he has made during his tenure as president… Recently, however, I have been surprised (horrified) by the a...
This is a very Fabric specific question, but more experienced python hackers might be able to answer this, even if they don't know Fabric. I am trying to specify different behaviour in a command depending on which role it is running for, i.e.: def restart(): if (SERVERTYPE == "APACHE"): sudo("apache2ctl gra...
Based on the reference provided by Alan Donovan, which says you should use the path matrix (which has a 1 if there is a path from node i to node j) instead of the adjacency matrix (which has a 1 only if there is an edge from node i to node j). Some sample python code follows below to show the differences between the so...
Bear with me, I'm new to GUI Programming, IronPython, WPF and .NET. However, I am fairly familiar with Python. I have read through many tutorials regarding databinding such as DevHawk but these are too advanced for me. Issue: I'd like to display in a Listbox control the file paths from a python list that can be modifie...
You are here: Home ‣ Dive Into Python 3 ‣ Difficulty level: ♦♦♦♦♢ ❝ You’ll find the shame is like the pain; you only feel it once. ❞ — Marquise de Merteuil, Dangerous Liaisons So you want to release a Python script, library, framework, or application. Excellent. The world needs more Python code. Python 3 comes with a p...
Tony95 Re : Ella : projet de logiciel d'animation Flash & SVG pour Linux Salut à tous je savais pas trop où poster donc je le fais ici. J'ai un petit soucis en GTK, j'aimerais créer une interface permettant de charger et sauvegarder des fichiers mais j'arrive vraiment pas à m'en sortir pour le code. En gros j'ai une fe...
I'm struggling to figure out how to profile a simple multiprocess python script import multiprocessing import cProfile import time def worker(num): time.sleep(3) print 'Worker:', num if __name__ == '__main__': for i in range(5): p = multiprocessing.Process(target=worker, args=(i,)) cProfile....
no_spleen Re : Petit guide pour aider au choix d'un langage Le fichier de maillage est trops gros à poster ! Hors ligne tshirtman Re : Petit guide pour aider au choix d'un langage un code permettant de générer un fichier de ce type alors? je vais regarder ton code voir si je voit quelque chose de choquant pour les perf...
#2276 Le 24/10/2012, à 21:35 11gjm Re : TVDownloader: télécharger les médias du net ! Re-bonjour , @chaoswizard : Ça fonctionne à merveille . MERCI beaucoup . ******** Suivi du process : _ double-clic sur "mainGui.exe" _ dans la nouvelle boîte , entré "http://www.pluzz.fr/castle.html" ===== INFO pluzzdl.pyc Début du té...
Mod_python's PSP: Python Server Pages by Gregory Trubetskoy 02/26/2004 The new 3.1 version of mod_python introduces several major additions and enhancements over the previous 3.0 version. They are PSP, Cookie, and Session support. This article will introduce the first addition on the list, PSP. Python Server Pages (PSP...
#0 Re : -1 » Qarte arte.tv browser (ex Qarte+7) » Le 03/04/2012, à 21:00 elboulangero Réponses : 951 Salut ! Ca a l'air de la boulette ce petit Qarte, cependant chez moi ça marche pas. J'ai bien la liste des vidéos qui s'affiche, je peux faire glisser les videos dans la liste des vidz à telecharger. Puis quand je cliqu...
Could someone explain this? Code: list = ( (0, 'foo'), (1, 'bar'), (2, 'baz'), ) class Klass: def bat(self): print '-1' for l in list: if not hasattr(Klass, l[1]): print '%s should print %d' % (l[1], l[0]) def _f(self): print l[0] _f.__doc__ = 'Get %s' % l...
I am new to Python and figured I'd play around with problems on Project Euler to have something concrete to do meanwhile. I came across the idea of timing different solutions to see how they rate against each other. That simple task turned out to be too complicated for my taste however. I read that the time.clock() cal...
This is a puzzling problem that's difficult even to name, let alone describe. I'll start with the essential facts and then give what background information might be relevant. Consider two mongoengine document models: class Bar(Document): # ... # field definitions # ... def bar_func(self): pass ...
midgard_dbus API is very simple, but my approach was to make it just simple as possible. Basically we have two major methods of midgard_dbus: constructor, which registers object at path send, which asynchronously send message to object at given path New initialized object doesn't do anything special. It just waits for ...
Table Of Contents Configuring ACE Appliance Ethernet Interfaces Ethernet Interface Configuration Quick Start Configuring a Layer 2 Ethernet Port Adding a Description for an Ethernet Port Configuring the Ethernet Interface Speed and Duplex Mode Configuring the Ethernet Interface Speed Setting the Interface Duplex Mode D...
So you're building a web application, and using the excellent contrib.auth subsystem to manage user accounts. Most probably you need to store additional information about your users, but how? Django profiles to the rescue! Django provides a lightweight way of defining a profile object linked to a given user. The profil...
inconnu Re : Petit guide pour aider au choix d'un langage Encore une fois merci pour toutes ces références (j'ai déjà trois bouquins de 300 pages à m'infuser ). Bon c'est quand même passionnant, dès fois un peu complexe, mais je suis globalement assez surpris de la qualité. Pour tout dire, je ne pensais pas qu'il exist...
So you're building a web application, and using the excellent contrib.auth subsystem to manage user accounts. Most probably you need to store additional information about your users, but how? Django profiles to the rescue! Django provides a lightweight way of defining a profile object linked to a given user. The profil...
CyrilouGarou Création de miniatures pour dossiers d'artistes dans librairie amarok Bonjour à tous, Nous sommes nombreux à utiliser l'excellent amarok pour écouter notre zic. Amarok permet de ranger sa collection de la façon suivante (exemple de chemin pour la chanson hells bells d'ACDC) /home/cyril/Ma\ Musique/A/AC_DC/...
I want to do disguised LSA attacks on OSPF network and be able to more analyze, so I do not know how it works in practice. This is a penetration test. The attack is described in the address [+]. I have run the network are as follows: Source program in accordance with the above photo are as follows: #!/usr/bin/env pytho...
I have a small problem. And i think I am f=doing something silly but can not figure it out first : i want to fire a dynamically constructed sql on mysql from python. Its simple insert statement but the values can have double quotes and other special characters in them. So, i was not sure how to do this. Then i came acc...
I am starting a new blog, "#tail -f findings.out", which can be found here. I have collected various gotchas and helpful tips during my time working in information technology, and I hope to share the more useful such items on the new blog. I wanted to separate out such things from more theoretical ponderings found in T...
El 19 de Junio pasado tuvo lugar el segundo "How strong if your Fu", torneo de hacking organizado por los chicos de Offensive Security. Tuve la oportunidad de participar (haciendo team con Hackspy) y fue una experiencia bastante interesante. A diferencia de otros torneos, los de Offsec siempre son un tanto reales. (TRY...
I'm making an app from Netutus http://net.tutsplus.com/tutorials/python-tutorials/building-ribbit-with-django/ and I got this error when I ran syncdb. I did some research I found I had to put an related_field in ForeignKey but I still had the error. Error : one or more models did not validate: forum.userprofile: Rever...
For this given code I am getting an exception. I don't know how to clear this. package com.new_xml_parse; import java.net.URL; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.N...
I begin to develop on app engine with python 2.7 and I'm really confuse with the datastore and ancestors / keys / parents. As an example, I'm trying to develop a simple forum with categories,subjects and response. I don't find the way to represent relation and use them. I've explored and explored again the documentatio...
Rails sure has stirred up a lot of buzz lately (and rightly so), but now there's another great way to develop your next web app. It's lean, it's mean, it's easy to configure and use, and it shouldn't be a surprise that it's based on Python, a language that truly makes the common cases fast and easy. Meet TurboGears -- ...
fffredo traduction française (résolu) Bonjour la communauté, je suis sous kde 4.12.1 et ubuntu 13.10. Tout marche bien sur ma monture depuis un bon moment et là d'un coup j'ai kickoff qui passe en anglais tout comme libreoffice et les menus clic droit ???? j'ai bien depuis longtemps les paquets de langue installé (je l...
Here's an algorithm: Split the image into RGB and take the blue channel. You will notice that areas that were yellow in the color image are now dark in the blue channel. This is because blue and yellow are complementary colors. Invert the blue channel Create a greyscale search pattern with a circle that's the same size...
#0 Re : -1 » Skrooge, utilisation, trucs et astuces ! [Comptabilité personnelle] » Le 16/11/2012, à 01:21 bemawi Réponses : 616 Je suis en train de tenter de faire un template pour générer un rib. Certes, il va me manquer le nom du titulaire du compte et la fameuse clé rib, mais pour le moment, c'est plus par "fun" que...
#include <windows.h> #include <tchar.h> #define IDC_SECOND_SCREEN 1500 LRESULT CALLBACK fnOutputScreen_WndProc(HWND hwnd, unsigned int msg, WPARAM wParam, LPARAM lParam) { return (DefWindowProc(hwnd, msg, wParam, lParam)); } LRESULT CALLBACK fnWndProc(HWND hwnd, unsigned int msg, WPARAM wParam, LPARAM lParam) { switc...
Almost every modern processor has special memory instructions built in specifically to deal with this problem. For example, many processors have a swap instruction. This atomically swaps a value between a local variable in a thread and a global variable that is shared between threads. (Under the covers the "local varia...
HKH Re : Cerise 0.8 - TPE, freelances, artisans effectivement ca ne fonctionne pas avec ces identifiants...! J ai crée une entreprise nom : Ubuntu login ubuntu pass ubuntu Bon test Hors ligne j1100 Re : Cerise 0.8 - TPE, freelances, artisans Hop je m'abonne. Ça va fortement m'intéresser dans 2-3 ans quand je serai patr...
I am creating python files through the course of running a python program. I then want to import these files and run functions that were defined within them. The files I am creating are not stored within my path variables and I'd prefer to keep it that way. Originally I was calling the execFile(<script_path>) function ...
Componentes y Agregados (plugin) Los componentes y los agregados o plugin son características relativamente novedosas en web2py, y existen diferencias entre los desarrolladores sobre qué son o qué deberían ser. La confusión deriva mayormente de los distintos usos de esos términos en otros proyectos de software y del he...
I have a text file like this: 1123411111 Using Python 2.7, I want to turn it into a list of lists of lines, where line breaks divide items in the inner list and empty lines divide items in the outer list. Like so: [["11","2","3","4"],["11"],["111"]] And for this purpose, I wrote a generator function that would yield th...
CSS scott1964 — 2013-11-18T10:37:06-05:00 — #1 Greetings ... I am developing a site that uses a wordpress theme ... the customer wants it customized to include two login panels for Attorneys and Reporters at the very top of the screen. I've altered the index file to include the correct markup, but for some reason, the ...
Composite Manager Retained Drawing Protocol RFC Robert Carr 02/28/07 Outline and justification: Results from development in the creation of 'first generation' mainstream composite window managers has outlined the need for several reconsiderations in regards to applications interacting and communicating with the composi...
While answering Random start of line, I came upon a strange interaction between \raggedright and \parshape. If a ragged-right paragraph ends in a short line, this line will be "the most ragged". \documentclass{article} \begin{document} \raggedright i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i...
I'm trying to use Google App Engine to deploy a BootlePy + PeeWee web application. I use PeeWee with SQLite. Here is PeeWee's source code: try: import sqlite3 except ImportError: sqlite3 = None Here is the error I'm getting in my Google App Engine development console: ImportError: No module named _sqlite3 Why ...
Untwisting Python Network Programming by Kendrew Lau 08/10/2006 Networking is an essential task in software applications nowadays. Many programming languages have support for network programming to various extents. While the core libraries of most languages allow low-level socket programming, other libraries and third-...
If you have a copy of Python 3 lying around, you can do this in a jiffy. First off, transcribe the passwords in an array like this. (Don't type in the >>> characters.) >>> passwords = ["hideout", "flowing", "blanket", "dealing", "banning", "leaving", "studies", "fencing", "battles", "chamber", "parties...
662 users here now /r/programming is a reddit for discussion and news about computer programming Guidelines Please try to keep submissions on topic and of high quality. Just because it has a computer in it doesn't make it programming. Memes and image macros are not acceptable forms of content. If there is no code in yo...
GNU Awk 4.1: Teaching an Old Bird Some New Tricks, Part II In an earlier article ("GNU Awk 4.0: Teaching an Old Bird Some NewTricks",published in the September 2011 issue of Linux Journal), Igave a brief history of awk andgawk and provided a high-level overviewof the many new features in gawk 4.0. I recommend reading t...
link5192 Re : [How-to] Desktop Screenlets Bonjour à tous, Je me permet aussi de remonter ce topic, j'ai voulu lancer le screenlets terminal (http://gnome-look.org/content/show.php/ … tent=74844) mais impossible celui-ci ne veut pas demarrer ... quelq'un aurait-il une solution ? Ubuntu 12.04 (Precise) sur Dell Inspiron ...
I have a file structure like this: dir_a __init__.py mod_1.py mod_2.pydir_b __init__.py my_mod.py I want to dynamically import every module in dir_a in my_mod.py, and in order to do that, I have the following inside the __init__.py of dir_a: import os import glob __all__ = [os.path.basename(f)[:-3] for f in glob.glob(o...
I think you have the right idea, except that the colors will be more distinguishable if you pass the colormap hsv numbers which are spread out over the range (0,1): hsv(float(i)/(len(data)-1)) For example: import matplotlib.pyplot as plt import matplotlib.dates as md import numpy as np import datetime as dt import sci...
#1676 Le 28/06/2012, à 20:51 AnsuzPeorth Re : [glade2script-GTK2] Interface graphique pour script bash ou autre. re, Bon, pour les whitelits, il faut indiquer la section et la variable ... Je vais réfléchir pour faire mieux ... Mais je pense que ce sera dur de faire différent, il faut bien indiquer la section et la var...
I want to dynamically add ckeckboxes to my gui through a premade list. How would I populate the GUI with the names in my list? They all have the same type of functionality, so that should not be an issue. If you want to populate your GUI with a premade list at startup: from Tkinter import * root = Tk() premadeList = ["...
right now, i have the following plot: import matplotlib.pyplot as plt fig2 = plt.figure() ax3 = fig2.add_subplot(2,1,1) ax4 = fig2.add_subplot(2,1,2) ax4.loglog(x1, y1) ax3.loglog(x2, y2) ax3.set_ylabel('hello') I want to be able to create axes labels and titles not just for each of the two subplots, but also common l...
I have code that generates this error: ** Message: pygobject_register_sinkfunc is deprecated (GstObject) Traceback (most recent call last): File "PlayingVideo.py", line 199, in <module> player = VideoPlayer() File "PlayingVideo.py", line 84, in __init__ self.constructPipeline() File "PlayingVideo.py", line 99, in const...
I am using webpy framefork. I want to serve static file on one of requests. Is there special method in webpy framework or I just have to read and return that file? If you are running the dev server (without apache): Reference: http://webpy.org/cookbook/staticfiles Update. If you really need to serve a static file on #!...
I have created a script to automatically generate base ANZLIC standard metadata using arcpy based coding. Can anyone help me convert it to OGR/GDAL python? This is so that it can be run in QGIS and work with all types of vector and raster data. The working code with some comments on important sections is below. import ...
as long as all the main functions are named differently function conky_something1() --stuff end--of function something1 function conky_something2() --stuff end--of function something2 function conky_something3() --stuff end--of function something3 you can stick them all into the same script and then on conky you can l...
Making Old Things New Again There have been recent releases of two of the Python-XML projects in which I'm involved; 4Suite and Amara XML Toolkit. One common theme in both releases was marked improvements to the XML document creation APIs. These improvements are significant enough to discuss and compare to the other sy...
The question is interesting. So you want a "loose" curve which joins points (A) and (B) and whose length is 8 units. Obviously, the difficult part is to ensure that the length is 8 units (or at least close to that amount). The general problem depends on which curve is chosen (See Wikipedia's arc length article), but in...
Hello everyone Last week, Alex Gaynor announced the first public release of Topaz, a Ruby interpreter written in RPython. This is the culmination of a part-time effort over the past 10 months to provide a Ruby interpreter that implements enough interesting constructs in Ruby to show that the RPython toolchain can produ...
Oni Re : [How-to] Desktop Screenlets Salut. Je viens de réinstaller screenlets. Lorsque je lance une musique avec Listen (mon lecteur par défaut), le module "Now Playing" me renvoie une erreur comme vous pouvez le voir sur la capture ci-dessous. J'ai installé le paquet "python-dcop" au cas où... mais même problème. Si ...
doudoulolita Re : Faire une animation sur la création de jeux vidéo libres Bibliographie: - La 3D libre avec Blender d'Olivier Saraja - ed Eyrolles - 35 € pour la 1ère édition. Disponible à la FNAC ou chez Eyrolles pour la 4ème édition. - Blender, Créez des animations 3D de Marie-France et Jean-Michel Soler - ed. Pears...
This project is archived and is in readonly mode. OverflowError on a large object oid Reported by Georges Racinet | April 1st, 2014 @ 08:49 AM rel-2.5.2 os-linux Debian 7, x86_64, libpq5 9.3.4-1.pgdg70+1 (latest version fromapt.postgresql.org), Python 2.7.3 (stock Debian) through a virtualenv Hi, I'm getting an Overflo...
This program has been disqualified. Author Rekrul Submission date 2011-07-28 07:59:57.781458 Rating 7640 Matches played 1126 Win rate 76.55 import random SIZE = 6 WEIGHT_FACTOR = 7. class HistoryNode(object): def __init__(self, parent=None): if parent is not None: self.depth = parent.depth + 1 ...
Enttec DMXUSB PRO serial communication issues, device closes Hello all, I am having issues with my Enttec DMXUSB PRO device. I am trying to send out a message to multiple lights at once (multiple channels that control the light intensity) but whenever I try to do this I get the following error: imp.dmx.usbpro: Serial c...
SQLITE Vs PICKLE pywebsite.sqlitepickle is a little module I just made which combines sqlite and pickle for persistence. Useful since it works with python3, and both pickle and sqlite are included with pythons (including pypy). Import the module. >>> from pywebsite import sqlitepickle An in memory db. >>> db = sqlite...
A coworker left some data files I want to analyze with Numpy. Each file is a matlab file, say data.m, and have the following formatting (but with a lot more columns and rows): values = [-24.92 -23.66 -22.55 ; -24.77 -23.56 -22.45 ; -24.54 -23.64 -22.56 ; ]; which is the typical explicit matrix creation syntax used by ...
galanga Re : Qarte arte.tv browser (ex Qarte+7) @Christophe: content de voir que cela a commencé à fonctionner... Pour le second cas qui fait une erreur, c'est parce qu'il manque un back slash sur le guillemets fermant de ...3789-visual-crop-medium.jpg ; essayez avec cela : items.append("<item>\n <title>Dominique ...
I've found a few questions on the module but the more common problem seems to be getting the argument list right which I think I have managed (eventually) I am trying to run a program that expects an input like this in the command line, fits2ndf in out with 'in' being the filepath of the file to be converted and 'out' ...
Tony95 Re : Ella : projet de logiciel d'animation Flash & SVG pour Linux Salut à tous je savais pas trop où poster donc je le fais ici. J'ai un petit soucis en GTK, j'aimerais créer une interface permettant de charger et sauvegarder des fichiers mais j'arrive vraiment pas à m'en sortir pour le code. En gros j'ai une fe...
AKA Flask Howto: Add request execution time to log output By Jay Taylor, published April 24th 2013 I scoured the internet high and low for a way to add request execution time logging to my Flask server console output, but failed to find any examples of how to do it. Here is my formula for one way to make it happen. We ...
pef RealRipper: enregistreur de flux Real Bonjour à tous, Je me permet de faire de la pub pour un logiciel libre que j'ai crée Il s'agit d'une interface graphique à MPlayer permettant d'enregistrer de manière conviviale un flux Real (rtsp://, fichiers .ram) dans un fichier. Pourquoi ce logiciel ? Etant auditeur CNAM, j...
Decorators are joy to use. Write? Not so much. One needs to mess with wrappers, function metadata and a fair amount of bookkeeping. Enough things to bury any useful semantics under them. There got to be a better way. Let’s find that out. Current state Currently in a decorator you need to create a wrapper, update it’s m...
Class Based Views Django's class based views are a welcome departure from the old-style views. REST framework provides an APIView class, which subclasses Django's View class. APIView classes are different from regular View classes in the following ways: Requests passed to the handler methods will be REST framework's Re...
Python 2.3 introduced the logging module to the Python standard library. logging provides a standard interface for outputting information from a running application. The classic example of a logging mechanism is writing data to a text file, which is a plain old log file. While the log file is likely the most common for...
Le viste web2py utilizza Python per i modelli, i controller e le viste, sebbene per quest'ultime utilizzi una sintassi leggermente modificata per consentire di creare codice più leggibile senza imporre alcuna restrizione sul corretto utilizzo di Python. Lo scopo di una vista è di includere codice Python in un documento...
gio Functions def gio.content_type_can_be_executable(type) def gio.content_type_equals(type1, type2) def gio.content_type_from_mime_type(mime_type) def gio.content_type_get_description(type) def gio.content_type_get_icon(type) def gio.content_type_get_mime_type(type) def gio.content_type_guess(f...
Pastebin.com is a utility for sharing snippets of text with anyone. The service is simple: go to pastebin.com, paste your text, click submit, and share the link. It’s useful for sharing time-saving snippets with you team, or for an impromptu, informal code review of changes that for one reason or another haven’t been c...
The error happens when executing the following lines, output[counter] = h['url'] name = '%(name)s%(#)03u' % {'title': user_input, '#': counter} urllib.urlretrieve(output[counter], name) counter += 1 >>>> File "/base/python_runtime/python_dist/lib/python2.5/urllib.py", line 225, in retrieve >>> tfp = open(filename, 'wb'...
I recently came across a Python class factory implementation that fit a problem I am working on really well. The only difference is that I wanted have the base and sub classes in different packages. When I try to do this, however, I run into a problem whenever I try to load the base class. Structure: BaseClass.py from ...
Here's a WebGL-powered invitation to the GNU Hackers Meeting 2013, which is taking place in Paris on August 22-25 Free, hardware-accelerated WebGL support is recent under GNU/Linux, you'll need Mesa/Mesa-DRI 9 and Linux kernel 3.6 from Debian sid plus a recent Firefox, though a Mesa-software fallback is usually availab...
Pierre Thibault Comment fonctionnent les pipes et les commandes shell avec Python Bonjour, J'ai de la difficulté à comprendre comment les redirections fonctionnent avec les commandes shell et Python. Par exemple, si dans un shell bash je tape: aa | bb Si je tape la commande précédente, cela veut dire que la sortie de l...
I'm writing a small sqlalchemy shim to export data from a MySQL database with some lightweight data transformations—mostly changing field names. My current script works fine but requires me to essentially describe my model twice—once in the class declaration and once as a list of field names to iterate over. I'm tr...
Eleven PPA désactivés : quid ? Salut tout le monde ! J'ai fait récemment la mise à niveau vers Raring, et ma foi c'est que du bonheur. Cependant, j'ai eu la désagréable surprise de voir que la plupart de mes dépôts (c'est-à-dire tous) étaient désactivés pour la mise à niveau vers Quantal... Ca vous dit quelque chose ?....
Quand un programmeur a besoin de résoudre un problème informatique, il écrit (généralement) un programme pour cela. Son programme contient une implémentation, c'est-à-dire si on veut une "transcription dans un langage informatique" d'un algorithme : l'algorithme, c'est juste une description des étapes à effectuer pour ...
A while ago I saw plotly appear on my G+ stream.People seemed excited about it but I was too busy to look at it properly and just assumed: must be some sort of new matplotlib: ain’t nobody got time for that! Then, one of the guys from plotly reached out saying I should take a look.I took a brief glance and realised tha...