text
stringlengths
256
65.5k
Synchronized in Python Created on Oct. 14, 2011, 5:36 p.m. Some more fun with python decorators. This time about threading. Java gives us some nice threading primitives built into the language including the abstraction of the synchronized keyword. What this keyword ensures is that no two threads will enter the same blo...
See Understanding Techniques for WCAG Success Criteria for important information about the usage of these informative techniques and how they relate to the normative WCAG 2.0 success criteria. The Applicability section explains the scope of the technique, and the presence of techniques for a specific technology does no...
Download FREE PDF The NetBeans Platform is a generic framework for commercial and open-source desktop Swing applications. It provides the “plumbing” (such as the code for managing windows, connecting actions to menu items, and updating applications at runtime) that you would otherwise need to write yourself. The NetBea...
I've been trying to figure out why this query (on integers) is using an index scan when both values (the original table, and the table its looking up in) are integers. The first part is used to fill a table with values. The second part is the search query that I'm battling with. If you run the execution plan on the que...
Basically, what i'm trying to do is filter out a company inside of a query, and this code is the result of a lot of debugging. we've reduced it to as simple as possible and can't work out why "for company in Company.objects.filter(pk="E0433CAE-1756-11E1-A97B-7071BC08AB6F"):" fails. anywhere else and it works perfectly ...
I'm working on a captive portal projet on Windows. I've written this piece of code (similar to this) : from ctypes import wintypes import ctypes WlanApi = ctypes.windll.wlanapi hClientHandle = wintypes.HANDLE() phClientHandle = ctypes.pointer(hClientHandle) dwNegotiatedVersion = wintypes.DWORD() pdwNegotiatedVersion = ...
Does anybody know where to get list of working long2short service websites? The bigger the better - I need at least 100 of them. The list at http://hjacob.com/blog/2009/07/url-shortener-redirects/ looks pretty good. There are still a lot of dead links. Here are the listed URLs that responded For some reason, my favorit...
Simple core command line tools like nc, socat seem not to be able to handle the specific HTTP stuff going on (chunks, transfer encodings, etc.). As a result this may produce unexpected behaviour compared to talking to a real web server. So, my first thought is to share the quickest way I know of setting up a tiny web s...
I have a geo model with a PointField property. Everything works perfectly locally, but when I try to save an instance on the server, I get the following error: django.db.utils.DatabaseError: invalid byte sequence for encoding "UTF8": 0x00 I dug into the source and found that the values are being serialized differently...
I have simplified my models down a to make it clearer what I am trying to do. (models.py in app Teams) from django.db import models from django.contrib.auth.models import User import datetime class Team(models.Model): users = models.ManyToManyField(User) team_title = models.CharField(max_length=200) team_...
fenix122 Re : erreur avec apache2 : « Unable to open logs » [RESOLU] non non je sais faire les serveur sans interface j'ai fait sa surtout pour simplifier après non je ne suis pas tout a lettre car le tuto que j'ai suivi avait des erreurs pour certaine chose surtout pour c'est source pas bonne j'ai du aller sur le site...
Professeur Burp GNUPoly Bonsoir à tous, J'ouvre ce petit fil afin de vous faire part de ma très modeste contribution au monde libre. En effet, je met à la disposition de la communauté ma première application : Un clone du célèbre jeu de société Monopoly. C'est mon premier programme, et je me suis remis à la programmati...
If I have a Python script that requires at least a particular version of Python, what is the correct way to fail gracefully when an earlier version of Python is used to launch the script? How do I get control early enough to issue an error message and exit? For example, I have a program that uses the ternery operator (...
michelk la lecture de flux radio ne fonctionne plus(ubuntu 12.10 - rhythmbox) Bonjour, Après une mise à jour, la lecture de flux radio ne fonctionne plus (ubuntu 12.10 - rhythmbox). Lorsque je clique sur les noms des radios, celles-ci s'affichent avec un sens interdit. J'ai essayé de lancer rhythmbox à partir d'un term...
malbo [Tuto] identifier si on est dans un système UEFI ou Bios ATTENTION : CETTE MÉTHODE D’IDENTIFICATION EST OBSOLÈTE : IL FAUT UTILISER LA PROCÉDURE DE LA DOC : http://doc.ubuntu-fr.org/efi#identifier … n_mode_efi Le problème se pose pour des PC achetés en 2011 (et +) pour ceux qui souhaitent faire cohabiter Windows ...
Which Stack Exchange site has the longest name? Does Area 51 have a limit on proposal names? I need to know this for my userscript. The longest SE site names currently are: Code Golf and Programming Puzzles (33) Audio Recording and Production (30) Theoretical Computer Science (28) Science Fiction and Fantasy (27) Engli...
I've been stuck trying to figure this out for weeks. I previously asked a similar question found here but I never got any replies. I really cannot find any good documentation anywhere. All I need to do is use a worker (don't care what worker have django-celery and rq installed) to convert a file to flv when it is uploa...
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...
Python on my machine: def func(): start= time.clock() reduce(lambda x,y: x*y, range(1,50000)) end= time.clock() t = (end-start) * 1000 print t gives 1219 ms Scala: def timed[T](f: => T) = { val t0 = System.currentTimeMillis val r = f val t1 = System.currentTimeMillis println("Took: "+(t1 - t0)+" ms")...
I am not sure whats happening, but I am setting the newcontent and trying to add a countdown to each item however It seems not to be working, Sorry not quite sure how to explain it. with out the count down part of this script see below the script works fine COUNT DOWN PART $('#countdown'+members[i]['id]']).countDown({ ...
8.2 Git e Outros Sistemas - Migrando para o Git Migrando para o Git Se você tem uma base de código existente em outro VCS mas você decidiu começar a usar o Git, você deve migrar seu projeto de um jeito ou outro. Esta seção vai mostrar alguns importadores que estão incluídos no Git para sistemas comuns e demonstra como ...
I have an initialed dictionary list list_dic = [{'number': 1}, {'number': 2}] I also got a list of other objects, here just use int to represent another_list = [2,3,4] I want the result to be like this: list_dic = [{'number': 1, 2: None, 3: None, 4: None}, \ {'number': 2, 2: None, 3: None, 4: None}] Try use the leas...
I don't want the service to start after reboot. my code does this: service iptables stopservice iptables savechkconfig --level 123456 iptables offservice iptables statusiptables: Firewall is not running. but after reboot: [root@cteraportal ~]# service iptables status Table: filter Chain INPUT (policy ACCEPT) num targe...
Counter im trying to find the most effective way to count to 172 and stop. I am trying to have one bang move the number up and one number move the number down. But i want the number to stop when it gets to 172 Thanks here you go hope this is what you mean allof the following text. Then, in Max, select New From Clipboar...
I have a text file labeled "all.txt" It contains a regular english paragraph For some reason when I run this code: import nltk from nltk.collocations import * bigram_measures = nltk.collocations.BigramAssocMeasures() trigram_measures = nltk.collocations.TrigramAssocMeasures() # change this to read in yo...
I am trying to build a function in python that yields values of two dictionaries IF a particular value from dict1 matches a particular value of dict2. My function looks like this: def dict_matcher(dict1, dict2, item1_pos, item2_pos): """Uses a tuple value from dict1 to search for a matching tuple value in dict2. If a m...
DJ Raging-Bull Carte PCMCIA WiFi non détecté sur ThinkPad 600X Bonjour, J'ai récuperé un IBM ThinkPad 600X équipé d'un Penium III @ 500 MHz et de 446 Mo de RAM, le disque dur fait environ 12 Go et il dispose d'un lecteur CD. J'aimerais le refiler à ma mère qui s'en servirait pour de la bureautique de base. Je lui ai do...
Some things I have learnt about optimising Python I've been enjoying writing my research code in Python over the past couple of years. I haven't had to put much effort into optimising it, so I never bothered, but just recently I've been working on a graph-search algorithm which can get quite heavy - there was one scrip...
Play a part of a sample using groove~ Can i play a part of a sample using groove~ (non-looping)? I can set a startposition, but i can’t seem to define an endposition (or length to play). Should i use another object? Short answer: To play a sound from point A to point B, nothing beats play~. You just tell it, "start ". ...
nicky940 Re : Generateur de sources.list en Francais bonsoir je suis un nouvelle utilisateur d'ubuntu l'installation c'est dérouler a merveille version 9.10 jai depuis quelque temps un problème avec les mise jour qui m'indique un sens interdit qui m'indique ce message d'erreur :un problème irrémédiable est survenu pend...
If you simply need to do an Object.onSomething() probably you need to write a reactor over a object data model. What I mean? Put every relevant objects into a container make this container available to everyone. This container will implement the method def castEvent(self, eventName, args, kargs): In this method you it...
This question already has an answer here: Convert Python dict to object? 26 answers I'm very new to python and I wish I could do . notation to access dict object in python. Lets say I have test like this: >>>test = dict() >>> test['name'] = 'value' >>> print(test['name']) value But I wish I could do test.name to get v...
Let's say I have a list of objects. (All together now: "I have a list of objects.") In the web application I'm writing, each time a request comes in, I pick out up to one of these objects according to unspecified criteria and use it to handle the request. Basically like this: def handle_request(req): for h in handl...
I want to have a model with a ManyToMany relationship with itself, I don't know how to write this but I'l try to write some code to illustrate what I want to do. class Person(models.Model): name = models.CharField() occupation = models.CharField() friends = models.ManyToManyField('self', through = PersonFriend...
I have a button set, and would like to set the width of each button so they can be the same size (i.e. if I have 4 buttons of 25% each of the element) Basically the site has a table on the left, and within that table I have 4 options. The way it is right now is it's not using 100% of the left column, so it looks bad. I...
Review: SSDVM.Net FREE VPS — Quick Plan Thanks @ssdvm. He offered 10 free VPS for life last week and I was so lucky to get one. The detail of the plan: [»]Name: Quick [»]Disk: 10GB [»]Bandwidth: 1000GB [»]Dedicated Memory: 512MB [»]Burstable Memory(vSwap): 1024MB [»]CPU Share: Equal Share [»]IP Address: 1 [»]...
I've been working on a way to get tests produced from a generator in nose to have descriptions that are customized for the specific iteration being tested. I have something that works, as long as my generator target method never tries to access self from my generator class. I'm seeing that all my generator target insta...
I'm not sure, where to ask, so I try it here. Hello, I would be very interested in pyxfce. Is it still used. It seems, the content of the website is not so new anymore. What could be done with pyxfce? For example: In windows I had a taskbar icon, which pops up a list of alle available desktop icons and have quick acces...
Is there a way to make BaseHTTPServer.HTTPServer be multi-threaded like SocketServer.ThreadingTCPServer? You can simply use the threading mixin using both of those classes to make it multithread :) It won't help you much in performance though, but it's atleast multithreaded. from SocketServer import ThreadingMixIn from...
Python Documentation Tips and Tricks by Cameron Laird 05/17/2001 Traditional thinking judges the merit of a computing language on objective, rather mathematical dimensions: how object-oriented is it? Are its constructs orthogonal? Does the syntax admit ambiguities? While that's appropriate for abstract analysis, when w...
Tools version: Python 2.6.5 Django 1.3.1 memcached 1.4.10 python-memcached 1.48 Memcached is currently running: $ ps -ef | grep memcache nobody 2993 1 0 16:46 ? 00:00:00 /usr/bin/memcached -m 64 -p 11211 -u nobody -l 127.0.0.1 I'm using memcached and python memcached with my Django proj and I've set it ...
How do I do that? I'm trying NotesAdministrationProcess but some lack example in the help file. Searching the web is difficult since these method is seldom documented. Currently I'm using RenameNotesUser to rename the user but the changes only happen when I run 'tell adminp process new' on the server. How do I automate...
I want to use Punjab as an xmpp proxy for Facebook Chat Punjab is running well but when i ask chat.facebook.com it won't work SENT: <body rid='313820892' xmlns='http://jabber.org/protocol/httpbind' to='chat.facebook.com' xml:lang='en' wait='300' hold='1' content='text/xml; charset=utf-8' ver='1.6' xmpp:version='1.0' xm...
Nodetime Once the nodetime module has been added to a project, running require('nodetime').profile() will cause it to start sending HTTP and database statistics to the Nodetime service: The Nodetime profiler running within the application securely sends profiling data to the Nodetime server, where it is stored and sent...
I'm having a weird error with remapping arguments on Fuerte. In my rospy node, I have a line like baud_rate = rospy.param('~baud',4800) so when I'd like to change that on the commandline, I tried rosrun nmea_gps_driver nmea_gps_driver.py _baud:=38400 but instead of the parameter being set, I get the following error: E...
Computer models are great for studying the relative importance of the factors affecting the thing being modeled. One aspect of this is sensitivity analysis. In order to do a sensitivity study of the parameters affecting the Weasel Program, it would be convenient to use Python. This would allow me to use tools such as m...
I've got a module I want to log in Django that looks something like this: import logging logger = logging.getLogger(__name__) def foo(): #this is a test of logging logger.info("info foo") logger.warning("warn foo") logger.error("error foo") My LOGGING in settings.py is set to the following: LOGGING = {...
I am new in both flask and sqlalchemy, I just start working on a flask app, and I am using sqlalchemy for now. I was wondering if there is any significant benefit I can get from using flask-sqlalchemy vs sqlalchemy. I could not find enough motivations in http://packages.python.org/Flask-SQLAlchemy/index.html or maybe I...
Update: with mysql-5.5.30-1.fc18.x86_64 and MySQL-python==1.2.4 Django==1.4.2 South==0.7.6 the following works: class Migration(SchemaMigration_: def forwards(self, orm): db.rename_column('app_model', 'old_id', 'new_id') db.alter_column('app_model', 'new_id', self.gf('django...
How to make a field in Django Admin readonly or non-editable based on the value from another field?I have used readonly_fields=('amount',) but this wont fix my problem , as I need to manage it based on another field . You can override the admin's class MyAdmin(admin.ModelAdmin): def get_readonly_fields(self, reques...
widget.bind('',callback) # binding def callback(self,event) #do something i need to pass an argument to callback() .the argument is a dictionary object. You can use lambda to define an anonymous function, such as: data={"one":1,"two":2} widget.bind("<ButtonPress-1>", lambda event, arg=data: self.OnMouseDown(e...
I'm attempting to make a poll in Django which takes words from a text file (a list of words) to generate the question. For example, the question will be: How do you like "Pizza"? The word in " " will change everytime the question is answered. I have everything set up besides the random word. I wrote a view to randomly ...
I am trying to create a 3D surface with transparency. When I try the following code below, I expect to get two semi-transparent faces of a cube. However, both the faces are opaque inspite of supplying the alpha=0.5 argument. Any pointer on why this is happening and how to fix it ? I am using Python 3.3 (IPython noteboo...
Not quite sure I have the question fully formed, but what I'm trying to do is basically this: # where the indices correspond to attributes fore example: # [type, status] x = %w(a b) y = %w(c d) combine(x, y) #=> [["a", "b"], ["a", "d"], ["c", "a"], ["c", "b"]] The order of the array is always the same, so the reverse ...
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 ...
Problem with ' and " bramley msg:4475782 4:24 am on Jul 15, 2012 (gmt 0) I am converting a script from PHP to javascript and am completely stuck on how to write this line correctly: si='["http://img.youtube.com/vi/'+SSv[i]+'/0.jpg\' height=\''+hhh+'\' width=\''+www+'\' class=\'preview\' title=\''+SSt[i]+'\' onclick=\'v...
Pylades Re : /* Topic des codeurs couche-tard [1] */ It works! \o/ Bon, alors, vous en pensez quoi ? On met le planeur ? Avant le titre ? Après ? “Any if-statement is a goto. As are all structured loops. “And sometimes structure is good. When it’s good, you should use it. “And sometimes structure is _bad_, and gets int...
Stability provisional Maintainer Alberto Ruiz (aruiz at um dot es) Safe Haskell None size :: Matrix t -> (Int, Int) disp :: Int -> Matrix Double -> IO () zeros :: Int -> Int -> Matrix Double ones :: Int -> Int -> Matrix Double diagl :: [Double] -> Matrix Double row :: [Double] -> Matrix Double col :: [Double] -> Matrix...
Successfully made a word translator function, and from looking around with what other people have done in my class I know I need to split the sentence argument in the sentence function. But I don't know what to do with it! I've used http://www.mit.edu/~johnp/6.189/solutions/piglatin.py as a reference (it's python 2, ho...
Suppose I have $n-1$ distinguishable labels for internal nodes $A=\{a_1, a_2,\dots, a_{n-1}\}$ and $n$ distinguishable labels for leaves $B=\{b_1,b_2,\dots, b_n\}$ with $A$ and $B$ disjoint. What is the best way to iterate over all possible binary trees if I label without replacement? Disclaimer: I have no computer sci...
The code bellow uses Python introspection features to add two new commands to the PDB module 0just put the given function, and its call in a separate module, and import this module before starting debugging - you should have the 'disp' and 'undisp' commands do add and retract watches to variables. It works by monkeypat...
I noticed the exact same stack trace in crashes reported by HockeyApp for devices running on iOS 5. I never called [[NSNotificationCenter defaultCenter] removeObserver:self] except inside dealloc, so this could not be the cause of the crash. Here is how I was able reproduce the crash: from MasterViewController I push D...
What is, in your opinion, the most surprising, weird, strange or really "WTF" language feature you have encountered? Please only one feature per answer. In PHP function names are not case sensitive. This might lead you to think that all identifiers in php are not case sensitive. Guess again. Variables ARE case sensitiv...
If I have a module, foo, in Lib/site-packages, I can just import foo and it will work. However, when I install stuff from eggs, I get something like blah-4.0.1-py2.7-win32.egg as a folder, with the module contents inside, yet I still only need do import foo, not anything more complicated. How does Python keep track of ...
Cooking with Python, Part 1 Pages: 1, 2 Recipe 5.10: Selecting the nth Smallest Element of a Sequence Credit: Raymond Hettinger, David Eppstein, Shane Holloway, Chris Perkins Problem You need to get from a sequence the nth item in rank order (e.g., the middle item, known as the median). If the sequence was sorted, you ...
The first parameter of applyImpulse is a vector, the direction of the vector indicate the direction the impulse is to be applied and the length of the vector indicates the strength of the impulse. your code; new b2Vec2(Math.cos(30*Math.PI/180),Math.sin(30*Math.PI/180)); creates a vector at 30 degrees from the positive...
Basically I have a subpackage with the same name as a standard library package ("logging") and I'd like it to be able to absolute-import the standard one no matter how I run it, but this fails when I'm in the parent package. It really looks like either a bug, or an undocumented behaviour of the new "absolute import" su...
Chris__ Re : gReemote, télécommande + prog TV pour Freebox HD Merci tocks. Je pense aussi que la meilleur des solutions serait de minimiser dans la zone de notif quand on ferme la fenêtre. Je vais regarder ça dès que j'aurai un peu de temps. Pour réduire la fenêtre j'ai peur que ca commence à compliquer pas mal l'appli...
McPeter Re : Un 'autre' générateur de sources.list en ligne Je viens de rectifier le soucis sur le nom du fichier bash. Par contre je ne vois aucun soucis à l'exécution :\ pourrais tu me dire quel navigateur tu as utilisé et quel message d'erreur ça te renvoit ? (un copié/collé du message) le chmod +x est inutile là pu...
I've tried some suggestions from similar questions etc. None of it helped my situation. I'm using Facebook.py Licensed under the Apache License in Google App Engine with Python solution. I've the GraphAPI object created with the valid access token which was mine. And it was shown in App Engine log: Graph >>> facebook.G...
I have wrote a code in Python for CRP problem. The problem itself can be found here: http://cog.brown.edu/~mj/classes/cg168/slides/ChineseRestaurants.pdf And to give a short description of it: Suppose we want to assign people entering to a restaurants to potentially infinite number of tables. If $z_i$ represents the ra...
Sometime when writing a python script I will run into an error such as syntax or some Exceptions. The script will partially execute, but not everything. This is frustrating because I have to manually undo what the script executed before I can run the script again. Is there a way that I can have the script undo what it ...
gtk.Action — an action which can be triggered by a menu or toolbar item (new in PyGTK 2.4) class gtk.Action(gobject.GObject): gtk.Action(name, label, tooltip, stock_id) def activate() def block_activate() def block_activate_from(proxy) def connect_accelerator() def connect_proxy(proxy) def c...
How can I write a program to find the factorial of any number? This will work for the factorial (although a very small subset) of positive integers: unsigned long factorial(unsigned long f) { if ( f == 0 ) return 1; return(f * factorial(f - 1)); } printf("%i", factorial(5)); Due to the nature of your ...
I upgraded from 11.10 to 12.04, had no issues that I noticed. Recently tried to install something via software center, but it was throwing errors. Changed to trying to sudo apt-get install instead but again no luck. I've genuinely tried as much as I know to fix this, but I can't so I figured I'd ask here. I've done sud...
Just a short anecdote (hence 'community wiki'): Last week I thought it was a clever idea in a Django app to import the module pprint for pretty printing Python data only if DEBUG was True: if settings.DEBUG: from pprint import pprint Then I used here and there the pprint command as debugging statement: pprint(some...
Today I was writing a pretty basic asynchronous socket server. Having recently gotten to the point of proficiency with the socket and select APIs that I felt that this implementation went fairly smooth, I thought that I would share it with the hopes that someone else can learn something from it. This example is of cour...
from dionaea.core import ihandler, incident, g_dionaea from dionaea.util import md5file, sha512file from dionaea import pyev import logging import json import uuid logger = logging.getLogger('submit_http') logger.setLevel(logging.DEBUG) class submmithttp_report: def __init__(self, sha512h, md5, filepath): s...
I'm using the GAE testbed service and when I run users.get_current_user() I get None i.e. >>> import sys >>> sys.path.append("/usr/local/google_appengine") # for Mac OS X >>> from google.appengine.api import users >>> from google.appengine.ext import testbed >>> testbed = testbed.Testbed() >>> testbed.activate() >>> te...
Centos- 6, LVM2 after a system hang and hard reboot. lvdisplay and lvscan return no volumes. It had volumes earlier...how to recover? there is data on LV (logical volume) - shared as NFS export.. VG is listed under /etc/lvm/backup/datastore1. any ideas to restore the LV? vgdisplay -- Volume group -- VG Name ...
Názory k článku Perličky: úvod do referencí mach(neregistrovaný) ve článku nikdo nikoho nenutil se něco učit. Tento jazyk byl vymyslen člověkem z praxe pro lidi, řešící praktické věci. V žádném případě není výlupek ctností a akademické krásy - na druhou stranu, zatím co v jiných jazycích dokončujete ještě deklarace, ta...
I'm trying to build my own network attached storage based on FreeBSD+ZFS+standard components, but there are strange performance issues. The hardware specs are: AMD Athlon II X2 240e processor ASUS M4A78LT-M LE mainboard 2GiB Kingston ECC DDR3 (two sticks) Intel Pro/1000 CT PCIe network adapter 5x Western Digital Caviar...
Introducing Anobind My recent interest in Python-XML data bindings was sparked not only by discussion in the XML community of effective approaches to XML processing, but also by personal experience with large projects where data binding approaches might have been particularly suitable. These projects included processin...
I see it’s a common struggle for people to understand how to manage size and positions of the widgets in kivy. There is not much to it, really, just a few principles to understand, but they are better explained by example, i believe. dumb positionning Let’s create a root widget, and put two buttons in it. root = Wi...
Why does the css selector select, textarea, input[type="text"], input[type="password"],input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="te...
1. Passing configuration to the __init__ method which calls register implicitely: class Base: def __init__(self, *verbs): if not verbs: verbs = "get", "post" self._register(verbs) def _register(self, *verbs): pass class Sub(Base): def __init__(self): super().__init_...
Please show the simple and up to date standard way to create a python package for python 2.x I'd prefer to use pip for installing the package later. The package should contain a single class: class hello: def greet(self): print "hello" One should be able to do the following later: pip install my_package-0.1.1......
I'm trying to execute a system command with subprocess and reading the output. But if the command takes more than 10 seconds I want to kill the subprocess. I've tried doing this in several ways. My last try was inspired by this post: http://stackoverflow.com/a/3326559/969208 Example: import os import signal from subpro...
In declarative approach, I want to exclude one property, its working properly when my column name and property name are same. But if I give different name then its not working. Here is my sample code. Base = declarative_base() class tblUser(Base): __tablename__ = 'tblUser' User_Id = Column('User_Id', String(10...
For those who know perl, I'm looking for something similar to Test::Deep::is_deeply() in Python. In Python's unittest I can conveniently compare nested data structures already, if I expect them to be equal: self.assertEqual(os.walk('some_path'), my.walk('some_path'), "compare os.walk w...
wlourf Postez vos scripts Lua pour Conky ! Bonsoir à tous ceux pour qui chaque pixel du bureau compte, J'ouvre ce topic suite aux discussions sur le topic des conky pour discuter des scripts Lua dans conky. Lua est un langage de script léger et facile a utiliser qui permet d'ajouter de nouvelles fonctionnalités à nos c...
rekiem installer Je viens d'installer ubuntu avant j'était sous windows j'ai télécharger vlc media player mais je ne sais pas comment l'installer. Aidez moi sa ne doit pas etre très compliquer désoler pour le derangement. Hors ligne Bobbybionic Re : installer Bonsoir Tu as "téléchargé vlc" ? Le .exe sans doute je me tr...
If I have two identical sets, meaning a == b gives me True, will they have the same iteration order? I tried it, and it works: >>> foo = set("abc") >>> bar = set("abc") >>> zip(foo, bar) [('a', 'a'), ('c', 'c'), ('b', 'b')] My question is, was I lucky, or is this behavior guaranteed?
Here's the code in question: #!/usr/bin/python import pycurl c = pycurl.Curl() values = [ ("key", "YOUR_API_KEY"), ("image", (c.FORM_FILE, "file.png"))] # OR: ("image", "http://example.com/example.jpg"))] c.setopt(c.URL, "http://imgur.com/api/upload.xml") c.setopt(c.HTTPPOST, values) c.perform()...
Suppose I have $n-1$ distinguishable labels for internal nodes $A=\{a_1, a_2,\dots, a_{n-1}\}$ and $n$ distinguishable labels for leaves $B=\{b_1,b_2,\dots, b_n\}$ with $A$ and $B$ disjoint. What is the best way to iterate over all possible binary trees if I label without replacement? Disclaimer: I have no computer sci...
I would like to write doctests for my pyramid web app, using the webtest module. I tried it like this: from my_webapp import main from webtest import TestApp app = TestApp(main({})) result = app.get('/') This raises a KeyError (because some.url is not known) when my code reaches this line: url = request.registry.setti...
I try add schema validation as it describe in official cornice doc and the do that through decorator like service_name.post(schema=SomeSchemaClass) but it's doesn't work import colander class TrackSchema(colander.MappingSchema): genre = colander.SchemaNode(colander.String(), location="body", type='str') @track.post...
Where can I find an online interactive console for programming language or api? @kuszi Put a great answer as a comment to the question, but I almost missed it because it was a comment rather than the answer. This link goes to a huuuge list of REPs and REPLs for tons of languages. repl.it supports multiple languages inc...
Using Vim as a password manager The other day at work, we were having a discussion about managing passwords. Gone are the days where you could keep everything in your head. Having accounts on over hundreds of sites and apps, I find myself clicking the forgot password link far too often. A non solution is using the same...
This program has been disqualified. Author &&& Submission date 2011-06-20 19:41:18.339674 Rating 5672 Matches played 5 Win rate 60.0 import random #Weighted random beat previous inputs def weighted_choice(C, p): x = random.random() for elmt in range(len(C)): if x <= p[elmt]: return C[elmt] ...