text stringlengths 256 65.5k |
|---|
i have an application where we allow users to use Oauth2 for authentication and even Custom User Registrations. All the Users are saved into the default User entity in the datastore. If the user is logging in using Oauth2 for the first time a new record in the default User entity is created like this:
"""Check if user ... |
How can I add constant acceleration to this pendulum as a whole while using this code? The code right now is describing a pendulum, how would I alter it to describe a pendulum in a moving train (where the train has a constant acceleration)? Any help would be appreciated, thank you in advance.
from math import sin, pi
f... |
I'm trying to build a simple API with the bottle.py (Bottle v0.11.4) web framework. To 'daemonize' the app on my server (Ubuntu 10.04.4), I'm running the shell
nohup python test.py &
, where test.py is the following python script:
import sys
import bottle
from bottle import route, run, request, response, abort, hook
@h... |
Shanx
Re : /* Topic des codeurs [8] */
Gnagnagna...
J'ai corrigé l'indentation, par contre pour découper le main je vais attendre que le programme fonctionne...
/**** PENDU ****/
#include<stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <ctype.h>
#define TAILLE_MAX 50
void clean_stdin(void);
... |
What you're referring to is called "constrained optimization". This is a really well-studied branch of evolutionary computation, and you can find dozens of resources describing common techniques for solving these problems. Carlos Coello-Coello does a tutorial on the subject each year at GECCO, the primary EC conference... |
When trying to refresh a materialized view based on a query that uses a mssql table (using the SqlServer Gateway), I run into the following error: After some investigation I found this was caused by a “NOT NULL” constraint on the mview-table. A small scenario:
ORA-12008: error in materialized view refresh path
ORA-0140... |
Routers
Resource routing allows you to quickly declare all of the common routes for a given resourceful controller. Instead of declaring separate routes for your index... a resourceful route declares them in a single line of code.
Some Web frameworks such as Rails provide functionality for automatically determining how... |
This is somewhat related to the question posed in this question but I'm trying to do this with an abstract base class.
For the purposes of this example lets use these models:
class Comic(models.Model):
name = models.CharField(max_length=20)
desc = models.CharField(max_length=100)
volume = models.IntegerFiel... |
According to Django docs Django can be configured with FastCGI.
Here's our setup (note that I don't control Apache setup at my workplace and I'm required to use FastCGI since we already have it, rather than install WSGI):
The fcgi-relevant part of our apache conf is:
LoadModule fastcgi_module modules/mod_fastcgi.so
# I... |
help me to understand these errors
Nov 25, 2013 at 8:52pm UTC
machine.cpp: In member function `bool bottleStack::pop(int)':
machine.cpp:24: invalid types `int[int]' for array subscript
machine.cpp: In member function `bool bottleStack::peek(int)':
machine.cpp:33: invalid types `int[int]' for array subscript
machine.cpp... |
yann458
Probléme avec l'utilitaire Motion
Bonjour,
L'utilitaire Motion fonctionne bien avec ma webcam.
Mais J'ai changer de webcam en passant à la marque Logitech c270 (edition limité) ,
l'utilitaire gucsview , à l'air de bin fonctionner.
Par contre avec l'utilitaire motion , ça ne marche pas et aucune mise à jour de c... |
= Introduction =
Welcome, GNU Radio beginners. If you are reading this tutorial, you probably already have some very basic knowledge about how GNU Radio works, what it is and what it can do - and now you want to enter this exciting world of Open Source digital signal processing (DSP) yourself.
This is a tutorial on how... |
I'd stick with a Python 2 book instead.
Yes, a lot of changes applicable to Python 3 have been back-ported, and with each new 3.x release the transition from 2.x to 3.x is made easier. But a Python 3.x book will not tell you how to adapt your code to work in Python 2.7. Your Python 3.x code will have surprising effects... |
I'm trying to get a file from a database and write it to disk. The file is stored as BLOB.
Now I have the following code:
#!/usr/bin/python
import MySQLdb
db2 = MySQLdb.connect(host="localhost",
user="root",
passwd="root",
db="digit")
cur = db2.cursor()
... |
Ive read your previous answers about this error onthe site, but not sure exactly how i could change my code to fix it in mine. It's a long code, sorry about that :$
import random
#QUESTION 1a:
#CONSTRUCTOR FUNCTION:
def makestk(): #This function returns a new stack in the form of a tagged tuple.
... |
On Amazon.com…
Click through to Amazon.co.uk (which goes to the index page, not the page for the book you were looking at):
OK… search for that book on the amazon.co.uk store:
I’m stumped.
On Amazon.com…
Click through to Amazon.co.uk (which goes to the index page, not the page for the book you were looking at):
OK… sea... |
I'm trying to package the pychess package into a zip file and import it with zipimport, but running into some issues.
I've packaged it into a zipfile with the following script, which works:
#!/usr/bin/env python
import zipfile
zf = zipfile.PyZipFile('../pychess.zip.mod', mode='w')
try:
zf.writepy('.')
finally:
... |
In python, True and False are integers (1 and 0 respectively). You could use a boolean (True or False) and the not operator:
var = not var
Of course, if you want to iterate between other numbers than 0 and 1, this trick becomes a little more difficult.
To pack this into an admittedly ugly function:
def alternate():
... |
I'm trying to write some python code which can create multipart mime http requests in the client, and then appropriately interpret then on the server. I have, I think, partially succeeded on the client end with this:
from email.mime.multipart import MIMEMultipart, MIMEBase
import httplib
h1 = httplib.HTTPConnection('lo... |
The idea of recursion is not very common in real world. So, it seems a bit confusing to the novice programmers. Though, I guess, they become used to the concept gradually. So, what can be a nice explanation for them to grasp the idea easily?
To explain recursion, I use a combination of different explanation, usually to... |
___ _ __ _______ ___
/ _ \ '_ \_ / _ \/ _ \
| __/ |_) / / __/ __/
\___| .__/___\___|\___|
|_|
Q&A for professional and enthusiast programmers
Q&A for computer enthusiasts and power users
Q&A for Ubuntu users and developers
Q&A for linguists, etymologists, and serious English language enthusiasts
Q&A for u... |
Hub49
logiciel de calcul de surfaces
Bonjour,
J'ai vu sur Framasoft pléthore de logiciels, mais lequel pourrait convenir selon vous pour mon activité de couvreur ? Je dois en effet faire face parfois à des formes de toits complexes et faire un métrage est hasardeux parfois...
Si il existe un logiciel qui à partir de de... |
SkippedResults
When querying RavenDB, you sometimes get a result that contained skipped results. What are those? And why do we care? Let us assume that we have the following index:
from img in docs.Images
from tag in img.Tags
select new { tag }
And you issue the following query:
/indexes/ImagesByTag?query=tag:NoSQL
E... |
We have two applications that are both running on Google App Engine. App1 makes requests to app2 as an authenticated user. The authentication works by requesting an authentication token from Google ClientLogin that is exchanged for a cookie. The cookie is then used for subsequent requests (as described here). App1 runs... |
I was trying to port forward my minecraft server, using port 25566, and for some reason it wasn't working. So, I opened minecraft to enter localhost, and after clicking login, the window closed and placed an error log report on my desktop. The same thing happens with all subsequent tries. Here is the error report:
#
# ... |
def swap(ary,idx1,idx2):
tmp = ary[idx1]
ary[idx1] = ary[idx2]
ary[idx2] = tmp
def mkranks(size):
tmp = []
for i in range(1, size + 1):
tmp = tmp + [i]
return tmp
def permutations(ordered, movements):
size = len(ordered)
for i in range(1, size): # The leftmost one never moves
... |
MEH-TECH
Re : [Support] Team Fortress 2
Je me disais aussi que c’était du pipo... Je me connecterai dans la soirée alors pour le récupérer
Merci
Hors ligne
MEH-TECH
Re : [Support] Team Fortress 2
C'est bon je l'ai reçu
Hors ligne
kurapika29
Re : [Support] Team Fortress 2
Bien le bonjour, chez moi depuis le début TF2 es... |
When I type this into the interpreter, calling 'y' seems to invoke the destructor?
class SmartPhone:
def __del__(self):
print "destroyed"
y = SmartPhone()
y #prints destroyed, why is that?
y #object is still there
Here is one run, output does not make sense to me.
C:\Users\z4>python
Python 2.7.3 (default,... |
In the last article I started a discussion of the Unicode facilities in Python, especially with XML processing in mind. In this article I continue the discussion. I do want to mention that I don't claim these articles to be an exhaustive catalogue of Unicode APIs; I focus on the Unicode APIs I tend to use most in my ow... |
You can fix this by finding out what exactly causes the "pygame parachute".
Your first step to find this out is to add detailed logging to your code. Start off with poor man's print() logging:
print("importing pygame")
import pygame
print("initialising pygame")
pygame.init()
...
With that sort of code you might get an... |
Here's a list of non-LISP languages that allow for macros (including those mentioned in other answers) -- the links are to an explanations of the respective macro systems:
Languages that have features that are kind of like macros, or which accomplish more or less the same thing in different ways (namely Smalltalk and I... |
In PIL (and mostly all softwares/librairies that use libjpeg) the quality setting is use to construct the quantization table (ref.). In libjpeg the quality number "scale" the sample table values (from the JPEG specification Section K.1). In other librairies there's different tables assign to different qualities (ex.: P... |
Let's try another test. Let's this time try having NISTNet emulate a circuit with 25% datagram loss. To do this we edit our rule, entering 0 into the delay field, entering 25 into the "Drop %" field and again hitting "Update". When we run our ping test it now looks like:
ping -c 10 -i 2 -s 1460 192.168.2.1
PING 192.168... |
The general problem I am trying ot debug is why a C program can call a function with no problem, but when the same function is called in Python it causes a segfault.
I'm trying to get the Python OpenCV bindings to access an AVT GigE GC1360H Camera using modules/highgui/src/cap_pvapi.cpp. I can read and display frames f... |
Author Rekrul
Submission date 2011-07-07 16:42:47.900396
Rating 6505
Matches played 4267
Win rate 65.29
Use rpsrunner.py to play unranked matches on your computer.
import random
SIZE = 11
WEIGHT_FACTOR = 4.8
class HistoryNode(object):
def __init__(self, parent=None):
if parent is not None:
self.... |
Kubke Lab:Research/ABR/Notebook/2013/10/29
From OpenWetWare
(→Fabiana: Tested signal filters)
(→Feedback from Andy)
(5 intermediate revisions not shown.)
Line 6: Line 6:
| colspan="2"|
| colspan="2"|
<!-- ##### DO NOT edit above this line unless you know what you are doing. ##### -->
<!-- ##### DO NOT edit above this l... |
This question already has an answer here:
print difflist
for line in difflist:
if ((line.startswith('<'))or (line.startswith('>')) or (line.startswith('---'))):
difflist.remove(line)
print difflist
Here, initially,
difflist = ['1a2', '> ', '3c4,5', '< staring', '---', '> starring', '> ', '5... |
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... |
Alex0000
Déconnexion sur Batterie [Samsung]
Bonjour à tous
J'ai un problème récurrent avec mon wifi quelque soit l'os ou la version de celui-ci. Après un petit temps sur batterie ( entre 5min et 1h) il se déconnecte de plus le gestionnaire de connexion ne montre plus aucun wifi.
Sur Windows, l'outils de résolution de p... |
Right now, I have Ubuntu 13.04, and using sudo-apt-get dist-upgrade does not get me the 13.10 update.
Whenever I sudo-apt-update or upgrade lately, I get:
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
It has been for a couple of months (I'm not actually sure, but it has been a long time), and I want to... |
You should use the new print() statement, available with Python 2.6+
from __future__ import print_function
print("hi there", file=f)
The alternative would be to use:
f = open('myfile','w')
f.write('hi there\n') # python will convert \n to os.linesep
f.close() # you can omit in most cases as the destructor will call if... |
Kanor
Re : Idée projet Logiciel RDM Eurocodes Structures Bois, Acier, Béton...
D'aprés ce que je comprend Salome utilise code_aster
Sinon pdf qui me semble intéressant
http://calcul.math.cnrs.fr/Documents/Journees/dec2006/aster.pdf
ça date un peu 2006
Hors ligne
ossatureLibre
Re : Idée projet Logiciel RDM Eurocodes Str... |
So the task i am trying to accomplish is for two string inputs such as '1' + '2' to return '3',
I would like to be able to be able to do something like this,
d = {'1': 1, '2': 2, '3': 3}
So i have a dictionary like this ^, then I can do
d.get('1')
In hopes it would return 1, except it returns None, How would I work a... |
Yes and no. The FK relationship is described at the class level, and mirrors the FK association in the database, so you can't add extra information directly in the FK parameter.
Instead, I'd recommend having a string that holds the field name on the other table:
class ValidationRule(models.Model):
other = models.Fo... |
Mibixy
Re : Live Voyager 12.10
bonjour, bonsoir, joyeux noël
voilà je viens poster là parce qu'après de longues recherches, (peut-être pas au bon endroit.. pas avec les bons mots clefs je ne sais pas...) je ne trouve pas de script de connexion vpn pour les intégrer à wicd... NM fonctionne très mal chez moi. pourquoi ? ... |
In almost all 2D platformers I've played, your avatar always starts off on the left side of the world, and continues on to the right. Is there something designers gain by doing this?
I'm not sure if there's any technical reason, but a large portion of the world reads from left to right (and many early games were made i... |
I’m a hacker, and I love to build stuff for the Web.
Wednesday 3rd February, 2010
A year and two blogs ago, I wrote about the way I prefer to organize my Django projects and deployments. Since then, I’ve refined my approach, taking into account the experience I’ve accrued, and the changing nature of Django itself. In t... |
Despite the many stories that I've heard about people having problems installing numpy, scipy, and matplotlib on Mac OS X Lion, I've never had any problem until today. I recently updated my system and attempted to install the latest versions of NumPy and SciPy. The NumPy installation went fine and the test ran as expec... |
I am stuck trying to get a python based webserver to work.
I want to do Basic Authentication (sending a 401 header) and authenticating against a list of users. I have no trouble sending the 401 response with "WWW-Authorize" header, I can validate the users response (base64 encoded username & password), however, the log... |
Package portage
source code
_get_stdin()
Buggy code in python's multiprocessing/process.py closes sys.stdin and reassigns it to open(os.devnull), but fails to update the corresponding __stdin__ reference. source code
_movefile(src, dest, **kwargs)
Calls movefile and raises a PortageException if an error occurs. source ... |
FelixP
[Résolu] ! Script pour noms de musique
Salut à tous ! J'ai une petite question à vous poser… (Eh oui !)
Je cherche un script pour me créer un fichier avec la liste des noms des musiques qui sont dans un dossier donné, avec la syntaxe de Wikipédia (histoire de remplir ses serveurs de données !) en sachant que les... |
You can perform local assignments as a side effect of list comprehensions in Python 2.
import sys
say_hello = lambda: [
[None for message in ["Hello world"]],
sys.stdout.write(message + "\n")
][-1]
say_hello()
However, it's not possible to use this in your example because your variable flag is in an outer scop... |
I have a plot in a tkinter.Toplevel window and I would like to have it use a custom spaced x-axis. Currently it is set as default so the numbers are evenly spaced (0,5,10,15... etc.). I would like to have a tick mark for each data point I have (example 2,6,15,30). I am sure it is just some key word under some header, b... |
Consider the following code example (python 2.7):
class Parent:
def __init__(self, child):
self.child = child
def __getattr__(self, attr):
print("Calling __getattr__: "+attr)
if hasattr(self.child, attr):
return getattr(self.child, attr)
else:
raise Attrib... |
tiramiseb
Re : configuration des DNS
S'il-te-plait, pour des citations utilise la balise "[ quote ]" et non la balise "[ code ]", c'est pénible de devoir défiler horizontalement pour lire les phrases que tu cites...
Hors ligne
kr2sis
Re : configuration des DNS
ça y est je sui perdu...:o
est ce qu'on peut faire doucemen... |
import os
import sys
import time
import base64
import hmac
import mimetypes
import urllib2
from hashlib import sha1
from poster.streaminghttp import register_openers
def read_data(file_object):
while True:
r = file_object.read(1 * 1024)
print 'rrr',r
if not r:
print 'r'
... |
luc765
Re : Synthèse vocale SVOX Pico
Merci à frafra et tuxmuraille, pour votre travail.
J'utilisais espeak avec mbrola, la qualité de SVOX est nettement meilleure
J'ai installé gSpeech sur Lucid via la compilation pour SVOX. Tout est parfait.
Dans l'utilisation est-il possible de modifier la vitesse de lecture par un ... |
I need to create models of existing previously unknown tables. Others have had said to
You can look at inspectdb code, and instead of outputting code return classes.
but for a python newbie I am having difficulties. Could anyone offer a more concrete example on how to do this? Many thanks.
UPDATE2: I can now create a m... |
Experimenting with Google App Engine
Google App Engine was actually the last project I worked on before I left Google. I was the PM of the project when it started, but has grown quite a bit since I left Google last June, and now it is has many more engineers and a handful of extremely talented PMs. I was fortunate enou... |
'{:%m}'.format(datetime.datetime.now())
seems to work.
Of course, you could take the less direct approach:
'{:02d}'.format(datetime.datetime.now().month)
Or you could use old style string interpolation:
'%02d' % (datetime.datetime.now().month)
but I like the first one because I think it's cool ...
Finally, I don't s... |
TERMS & CONDITION Alfamart official partner merchandise FIFA piala dunia Brazil 2014
Peraturan Lomba :
Lomba dimulai tanggal 16 Januari - 16 April 2014
Penutupan Pendaftaran tanggal 16 April 2014 Pukul 17:00 WIB
Pemenang akan diumumkan pada tanggal 5 Mei 2014
Penyerahan Hadiah 12 Mei 2014
Peserta Kompetisi diwajibkan L... |
I suspect this is a regular expression problem - and a very basic one, so apologies.
In Python, if I have a string like
xdtwkeltjwlkejt7wthwk89lk
how can I get the index of the first digit in the string?
Thanks!
Use
>>> import re
>>> s1 = "thishasadigit4here"
>>> m = re.search("\d", s1)
>>> if m:
... print "Digit f... |
In Python 2.x I'm able to do this:
>>> '4f6c6567'.decode('hex_codec')
'Oleg'
But in Python 3.2 I encounter this error:
>>> b'4f6c6567'.decode('hex_codec')
Traceback (most recent call last):
File "<pyshell#25>", line 1, in <module>
b'4f6c6567'.decode('hex_codec')
TypeError: decoder did not return a str object (ty... |
I would like to invoke the following code in-situ wherever I refer to MY_MACRO in my code below.
# MY_MACRO
frameinfo = getframeinfo(currentframe())
msg = 'We are on file ' + frameinfo.filename + ' and line ' + str(frameinfo.lineno)
# Assumes access to namespace and the variables in which `MY_MACRO` is called.
curren... |
Hada de la Luna
[résolu] 12.04 LTS : régler la luminosité de façon "définitive"
Bonjour,
pour une personne qui a des problèmes avec la luminosité excessive de l'écran, j'aimerais savoir comment régler cela de façon "fixe" qui ne soit pas remise en question à chaque démarrage.
En effet, en utilisant : Paramètres système... |
I tested some different algorithms, measuring speed and number of collisions.
I used three different key sets:
For each corpus, the number of collisions and the average time spent hashing was recorded.
I tested:
Results
Each result contains the average hash time, and the number of collisions
Hash Lowercase ... |
I am using the class based generic views.
class MyView(UpdateView):
model = MyModel
success_url = "/test/list"
Now this is working fine.
But i want to make the parent class so that my all views inherit from it and define success_url there like this
class MyMixin(object):
def __init__(self, *args, **kwargs)... |
I'm using SQLAlchemy
import hashlib
import sqlalchemy as sa
from sqlalchemy import orm
from allsun.model import meta
t_user = sa.Table("users",meta.metadata,autoload=True)
class Duplicat(Exception):
pass
class LoginExistsException(Exception):
pass
class EmailExistsException(Exception):
pass
class User(object):
"""... |
Alright, now that I've got some time to post my experience after figuring this all out, and thanks to Craig for getting me on the right track. Here's what you need to do (at least with SVN v1.4 and Trac v0.10.3):
Locate your SVN repository that you want to enable the Post Commit Hook for.
inside the SVN repository ther... |
I am trying to write a wrapper script for a command line program (svnadmin verify) that will display a nice progress indicator for the operation. This requires me to be able to see each line of output from the wrapped program as soon as it is output.
I figured that I'd just execute the program using subprocess.Popen, u... |
Learning From Mistakes
12/13/2000
Shortly after I wrote my news article on the Python wiki program MoinMoin, Jürgen Hermann announced a new version with this notice:
This is a security update, which explains the short release cycle. It replaces someexec()calls by__import__(), which is much safer (or actually, safe in c... |
According to the documentation, they're pretty much interchangeable. Is there a stylistic reason to use one over the other?
I like to use double quotes around strings that are used for interpolation or that are natural language messages, and single quotes for small symbol-like strings, but will break the rules if the s... |
For a project that I’m considering I’ve spent a few hours looking into using Python to access GMail. There’s a nice Python library called libgmail, but it’s a bit overkill since all I want is to see how many unread emails I have. After a bit of searching I found ot that there’s an atom feed that can be used to do exact... |
Lets say I have path to a module in a string module_to_be_imported = 'a.b.module'
How can I import it ?
>>> m = __import__('xml.sax')
>>> m.__name__
'xml'
>>> m = __import__('xml.sax', fromlist=[''])
>>> m.__name__
'xml.sax'
You can use the build-in
import sys
myconfigfile = sys.argv[1]
try:
config = __import__(my... |
Lesson Goals
In this two-part lesson, we will build on what you’ve learned aboutWorking with Webpages, learning how to remove the HTML markup fromthe webpage of Benjamin Bowsey’s 1780 criminal trial transcript. Wewill achieve this by using a variety of string operators, string methodsand close reading skills. We introd... |
degolarson
RESOLU connexion ok mais ouverture pages web lente ou imopssible
bonjour
j'ai déjà posté ici : http://forum.ubuntu-fr.org/viewtopic.php?id=21092
mais le pb était peut être un peu différent
quand je tape une recherche dans Google ou bien dans ma barre personnelle d'onglets l'ouverture de la page est souvent l... |
I try to explain here what I am trying to do:
I have one shapefile and one independent dbf table with the same fields. In the dbf table all the fields are populated but in the shapefile attribute table just one, lets name it "OneField". What I want to do is to check that the values from "OneField"(Shapefile) are the sa... |
After several months thinking about it, and just two requests, I finally decidedto publish satyr's code. I decided to use github because I already switched tosatyr from hg to git, mainly for testing and understanding it. I think Ican live with hg, althought branch management in git seems to be given morethought and a g... |
Download
FREE PDF
The DZone Refcard #43 is an introduction to system high availability and scalability terminology and techniques (http://refcardz.dzone.com/refcardz/scalability). The next logical step is the scalable handling of massive data volumes resulting from having these powerful processing capabilities.
This Re... |
Outside of the syntax clarification on re.match, I think I am understanding that you are struggling with taking two or more unknown (user input) regex expressions and classifying which is a more 'specific' match against a string.
Recall for a moment that a Python regex really is a type of computer program. Most modern ... |
Every now and then Liraz and I find ourselves chatting about how much we love Python, but more so the lessons we have learned from coding, and how to apply them to create beautiful Python code. I've tried to refine some of the "lessons" into practical guidelines that I apply religiously to all new code I write, and the... |
There's a 1 Gigabyte string of arbitrary data which you can assume to be equivalent to something like:
1_gb_string=os.urandom(1*gigabyte)
We will be searching this string, 1_gb_string, for an infinite number of fixed width, 1 kilobyte patterns, 1_kb_pattern. Every time we search the pattern will be different. So cachi... |
#8676 Le 23/02/2013, à 20:54
#8677 Le 23/02/2013, à 20:57
golgoth42
Re : Topic des Couche-Tard (cinquante-sept)
salut tout le monde
juste pour infos: il y a une fuite nucléaire aux états unis ....
une fuite dans un centre de stockage de déchets pour être un peu plus précis
et une source genre ça ça aide, même si un can... |
"Copy and paste coding" (getting bisect's sources into your code) is not recommended as it carries all sorts of costs down the road (lot of extra source code for you to test and maintain, difficulties dealing with upgrades in the upstream code you've copied, etc, etc); the best way to reuse standard library modules is ... |
What is the procedure for completely uninstalling a Django app, complete with database removal?
Like so.
for c in ContentType.objects.all():
if not c.model_class():
print "deleting %s"%c
c.delete()
django app is a "set" of *.py files and a directory with a django-app-name. So you can simply delete ... |
I'm attempting to remove all whitespace from a selected string search using regexp. The code works but it continues to return an error that I'm not sure how to resolve ...?
elif searchType =='2':
print " Directory to be searched: c:\Python27 "
directory = os.path.join("c:\\","SQA_log")
userstring = r... |
Hizoka
Re : [g2s] GUI d'extraction de fichiers mkv
En fait la fonction qui permet d'extraire dans le même dossier, il faut cliquer dessus à chaque fois. Tu pourrais pas mettre une option à cocher dans préférences qui permettrait de la garder toujours active ?
Réinitialise les préférences.
Par contre il n'y a plus l’icô... |
Yesterday I came across a blog post from 2010 that said less than 10% of programmers can write a binary search. At first I thought “ah, what nonsense” and then I realized I probably haven’t written one myself, at least not since BASIC and Pascal were what the cool kids were up to in the 80’s.
So, of course, I had a cra... |
What would be the most elegant\efficient way to reset all fields of a certain model instance back to their defaults?
I once did it this way. No better way I could think of.
from django.db.models.fields import NOT_PROVIDED
for f in instance._meta.fields:
if f.default <> NOT_PROVIDED:
setattr(instance, f.name... |
pilepoil
Asus X59SL problème accès internet (seulement Google, BNP)
Salut,
J'ai depuis peu de temps le Asus X59SL.
J'ai mis un double boot Ubuntu et Vista.
Sous Vista, pas de soucis d'accès à internet.
Sous Ubuntu 8.10 64 bits, j'ai accès uniquement à Google et à BNP (et peut être d'autres, mais pas nombreux).
J'ai fai... |
#1001 Le 25/04/2010, à 17:05
oGu
Re : [ VOS SCRIPTS UTILES ] (et eventuelles demandes de scripts...)
Bonjour à tous !
Tout d'abord félicitations pour l'excellente tenue de ce forum et pour tous les scripts que j'ai piqué sur ce topic!!
Etant passé de Firefox à IceCat dernièrement, j'aimerais qu'un Ubuntero sachant scri... |
In brief:
I have a problem with compiling vim with preferred python version.
When I use --enable-pythoninterp it compiles with system OSX python version.
When I use --enable-pythoninterp=dynamic I get an error in vim while trying :py import sys
Here is what I was doing in more detail:
% git clone https://github.com/b4w... |
If I try to spawn a process from a pylons controller, the server does not close the connection after sending the reply.
Assume that test.py is a long running process, then this method in a pylons controller creates a response, but keeps the connection open:
def index(self):
from subprocess import Popen
Popen(["... |
I'm not sure if the title gave the best description. But this here is my problem. I have a class named 'Ball'. Each ball has its own width, radius and color. My code worked great while I was adding my own balls before the loop eg. ball1 = Ball() .... ball2 = Ball() I'm using pygame and what I want is so that whenever I... |
It occurred to me that you may have actually be asking how to implement the + operator for dictionaries, the following seems to work:
>>> class Dict(dict):
... def __add__(self, other):
... copy = self.copy()
... copy.update(other)
... return copy
... def __radd__(self, other):
... ... |
A lesson in refactoring
Some advice to a fellow developer on Reddit’s “Ask Anything Monday" the original code looked like this:
cad_script.write("TEXT\n")
cad_script.write("Justify\n")
cad_script.write("TL\n") # Top-left justification
cad_script.write("0.30,0.30\n")
cad_script.write("0.5\n")
cad_script.write("90\n")
ca... |
We seem to have a tradition of using the Homestar Runner character 'Trogdor the Burninator' to request tag deletion.
I thought we could use crisper images, so I made my own. >:)
@iglvzx's Trogdor is great, sure, but I always imagined trogdor as having a red skin (yes, I have played peasant's quest, but my artistic styl... |
I am writing a Django app using mongodb. For a simple GET request I need to get results from database for which I am making a connection in the HTTPRequestHandler. The db operation for the HTTPRequest isn't a heavy operation. Should I close the connection in that handler itself. Her is the code snippet.
def search(requ... |
[UPDATE 16 Aug 2011]Armin Ronacher has written a nice module called unicode-nazi that provides the Unicode warnings I discuss at the end of this article.
Though I can't use Python 3 for any of my projects, it does have a few nice things. One particular behaviour where it improves on Python 2 is forbidding implicit conv... |
Hada de la Luna
[résolu] 12.04 LTS : régler la luminosité de façon "définitive"
Bonjour,
pour une personne qui a des problèmes avec la luminosité excessive de l'écran, j'aimerais savoir comment régler cela de façon "fixe" qui ne soit pas remise en question à chaque démarrage.
En effet, en utilisant : Paramètres système... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.