text stringlengths 256 65.5k |
|---|
Django: Showing the help_text of a model field as a title attribute in the form
Maybe it’s just me, but I find the standard way Django outputs the help_texton form elements quite annoying. If you use form.as_ul, it looks somethinglike this:
<li><label>Label text:</label><input type="text">This is the helptext.</li>
Whi... |
I am here and waiting.
In mathematics, you don't understand things. You just get used to them.I have the result, but I do not yet know how to get it.All physicists, and a good many quite respectable mathematicians are contemptuous about proof.
Offline
>>> def pi(n):
s = Decimal()
for i in xrange(0,n+1):
s += ((-1**... |
#0 Re : -1 » 0 A.D. : Une super bonne nouvelle! » Le 21/04/2010, à 15:20
DRYSTHAN
Réponses : 1
Si quelqu'un à réussi à le faire tourner sur ubuntu la marche a suivre m'intéresse.
En attendant je vais regarder ici mais l'anglais et moi sa fait 2.
http://forums.taleworlds.com/index.php?topic=99405.30
#2 Re : -1 » Pb inst... |
I have terminal.app set to accept utf-8 and in bash I can type unicode characters, copy and paste them, but if I start the python shell I can't and if I try to decode unicode I get errors:
>>> wtf = u'\xe4\xf6\xfc'.decode()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'as... |
Email and SMS
Setting up email
Web2py provides the gluon.tools.Mail class to make it easy to send emails using web2py. One can define a mailer with
from gluon.tools import Mail
mail = Mail()
mail.settings.server = 'smtp.example.com:25'
mail.settings.sender = 'you@example.com'
mail.settings.login = 'username:password'
... |
Your score will be (highest n for your program on your machine)/(highest n for my program on your machine)
Rules
You must calculate an exact integer solution. Since the factorial would be much higher than what can fit in a 64 bit unsigned integer, you can use strings if your language does not support large integers
Sta... |
I have a model like this:
class Issue(models.Model):
project = models.ForeignKey(Project, null=True, blank=True)
key = models.CharField(max_length=30, null=True, blank=True)
title = models.CharField(max_length=400)
description = models.TextField(null=True, blank=True)
createdByUser = models.ForeignK... |
Got this exercise on a python exam. Trying to return a deep o copy of a list like this:
l = list()
l = [0,1,2]
l1 = l
l[0] = 1
l1 should contain [0,1,2] not [1,1,2]
The exercise specified to implement it by using a metaclass.
class deep(type):
def __new__(meta, classname, bases, classDict):
return type.__n... |
bipede
Re : Besoin de testeurs pour Pap'rass
Merci bipede
Il n'y a pas de quoi
Ca fonctionne pour ton scanner ?
Hors ligne
jeremix
Re : Besoin de testeurs pour Pap'rass
Oui, ça fonctionne, mais je retape la valeur voulu à chaque fois (au cas où ça provoquerais un problème), car cela m'affiche 2 résolutions différentes.... |
I asked the most efficient method for mass dynamic string concatenation in an earlier post and I was suggested to use the join method, the best, simplest and fastest method to do so (as everyone said that). But while I was playing with string concatenations, I found some weird(?) results. I'm sure something is going on... |
It’s still in beta, but if Gooey lives up to what it says on the tin:
Turn (almost) any command line program into a full GUI application with one line
It’ll be massively popular with Python developers.
It’s still in beta, but if Gooey lives up to what it says on the tin:
Turn (almost) any command line program into a fu... |
I've found it useful to have a contextmanager version of os.chdir(): on exit it chdir()s back to the original directory.
This allows you to emulate a common (Bourne) shell-scripting pattern:
(
cd <some dir>
<do stuff>
)
I.e. you change to a new dir <some dir> inside a subshell (the ( )) so that you are sure to return t... |
Getting Started Guide
Platforms:
Console and Blocking Mode
Console and Blocking modes run on all platforms where Python 2.5+ can be installed. Tested on Windows XP, Vista, Ubuntu 8.04/8.10, Eee PC, Mac OS.
GUI Mode
Pylot GUI will run on all platforms that support Python and wxWidgets. The GUI has mostly been developed ... |
I am trying to find all forms of insertions between 2 strings. So I have a list of 14 million strings and then I have to check for each string what possible insertions can transform one string to another (basically counting insertion frequencies). Say x is one string and y is another string where x is a sub-string of y... |
What are metaclasses? What do you use them for?
A metaclass is the class of a class. Like a class defines how an instance of the class behaves, a metaclass defines how a class behaves. A class is an instance of a metaclass.
While in Python you can use arbitrary callables for metaclasses (like Jerub shows), the more use... |
Im trying to do a HEAD request of a page.
I am trying
import misc_urllib2
.....
opender = urllib2.build_opener([misc_urllib2.MyHTTPRedirectHandler(), misc_urllib2.HeadRequest()])
with misc_urllib2.py containing
class HeadRequest(urllib2.Request):
def get_method(self):
return "HEAD"
class MyHTTPRedirectHand... |
I've written some code that works when typed directly into the interpreter, but fails when called.
Here's some code (there's a lot here to make it reproducible):
import scikits.statsmodels.api as sm
import pandas as pd
data = sm.datasets.longley.load()
df = pd.DataFrame(data.exog, columns=data.exog_name)
y = data.endog... |
I am relatively new to Django and have really been struggling with an implementation of a custom django-taggit app through the tastypie REST API. I have researched this and keep running into the same issues. I appreciate any help and guidance you can provide.
I have a Model that I am trying to add Tags to with django-t... |
I have Intel i7-2600K quadcore, with hyperthreading enabled on Ubuntu 12.04. I know that I can find out how many cores I have in Python with import multiprocessing; multiprocessing.cpu_count(), but that gives me 8 because I have hyperthreading enabled on 4 physical cores. I'm rather interested in finding out how many p... |
I'm new to python, so I have some problems with the efficiency of my computation. I'm using this code to fill my H matrix and my h vector (x_tr, x_te and c are lists):
for l in xrange(0, b):
for ls in xrange(0, b):
H[l][ls] = 1.0/n_tr * numpy.sum([numpy.exp(-((numpy.linalg.norm(x_tr[i]-c[l])**2 + numpy.lina... |
Developing a PythonWin Sample Application
During the rest of this section, we will develop a sample application using PythonWin. This will lead us through many of the important MFC and PythonWin concepts, while also leveraging the dynamic nature of PythonWin.
MFC itself has a tutorial/sample called Scribble, which deli... |
I want to remove a character from a certain position in a string. Specifically, I want to remove the first character. For example, my string starts with a ":" and I want to remove that only, there are a lot of ":" in the string which shouldn't be removed. I am writing my code in Python
s = ":dfa:sif:e"
print s[1:]
pri... |
Recently while solving a programming puzzle in Python, I needed to merge a series of N iterators, each yielding values in sorted order, into a single iterator over the sorted values. The trick is that, when asked for a value from the merged series, you must extract all N iterators’ next values to determine which is the... |
I have followed the documentation how to do the i18n but the words still show up in English.
Settings.py:
USE_I18N = True
LANGUAGES = (
('en', 'English'),
('de', 'German'),
)
LANGUAGE_CODE = 'de'
Views:
from django.utils.translation import ugettext as _
...
messages.set_level(request, messages.SUCCESS)
messages.su... |
Another key point is that the mouse messages all report the position in "Screen Coordinates" (i.e., relative to the top-left corner of the screen) rather than in "Client Coordinates" (i.e., relative to the top-left corner of our window). You use a member function PyCWnd.ScreenToClient() to transform these coordinates.
... |
What is the fastest way to remove all multiple occurrence items from a list of arbitrary items (in my example a list of lists)? In the result, only items that occur a single time in the list should show up, thus removing all duplicates.
input: [[1, 2], [1, 3], [1, 4], [1, 2], [1, 4], [1, 2]]
output: [[1, 3], ]
This sol... |
JavaScript
matt6frey — 2013-08-11T14:27:13-04:00 — #1
Hey everyone,
I always struggle with Javascript, I am trying to create an animation for a website. When the page loads, a div section covers the main page and after five seconds, the elements within it are to slide to either side and then the div is to dissolve and ... |
I would like to read a file, update the website, read more lines, update the site, etc ...The logic is below but it's not working. It only shows the first line from the logfile and stops. Is there a way to iterate over 'return render_to_response'?
#django view calling a remote python script that appends output to the l... |
Going to see what i can come up with.
But if you change your mind and decide to use pygtk instead, here it is:
enjoy!!
EDIT
I started making a poor man's version of a terminal using the text control widget.I stopped because there are flaws that can't be fixed, such as when you use the sudo command.
import wx
import sub... |
Addressing the above "too small a task to require a library" issue by a straightforward implementation:
def sizeof_fmt(num):
for x in ['bytes','KB','MB','GB','TB']:
if num < 1024.0:
return "%3.1f %s" % (num, x)
num /= 1024.0
Example:
>>> sizeof_fmt(168963795964)
'157.4GB'
by Fred Cirer... |
A, B, C,â¦. Z, AA, AB, â¦.AZ, BA,BB,â¦. , ZZ,AAA, â¦., write a function that takes a integer n and returns the string presentation. Can somebody tell me the algorithm to find the nth value in the series?
Treat those strings as numbers in base 26 with
Here's a Java implementation:
static String convert(int n) {
... |
In Python can you select a random date from a year. e.g. if the year was 2010 a date returned could be 15/06/2010
It's much simpler to use ordinal dates (according to which today's date is 734158):
from datetime import date
import random
start_date = date.today().replace(day=1, month=1).toordinal()
end_date = date.toda... |
DatEpicCoderGuyWhoPrograms
less info
237 reputation
111
bio website mobile.twitter.com/…
location Minneapolis, MN
age 28
visits member for 2 months
seen Sep 12 at 12:04
stats profile views 414
life == "good"
Here's some things you should know about me.
Don't wake me up earlier than 7:30, unless you want your face dente... |
I am trying to create a matrix transpose function for python but I can't seem to make it work. Say I have
theArray = [['a','b','c'],['d','e','f'],['g','h','i']]
and I want my function to come up with
newArray = [['a','d','g'],['b','e','h'],['c', 'f', 'i']]
So in other words, if I were to print this 2D array as columns ... |
Topic: [SOLVED] Internal server error
==== Required information ====
- iRedMail version:
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):
- Linux/BSD distribution name and version:
- Related log if you're reporting an issue:
======== Required information ====
- iRedMail version: 0.8.5 - iRedAdmin-Pro v2.0 (LD... |
Thank you all for helping. Below this post I put the corrected version's of both scripts which now produce the equal output.
Hello,
I have written a little brute string generation script in python to generate all possible combinations of an alphabet within a given length. It works quite nice, but for the reason I wan't... |
You can use the datetime module to parse dates:
import datetime
print datetime.datetime.strptime('2010-08-27', '%Y-%m-%d')
print datetime.datetime.strptime('2010-15-27', '%Y-%m-%d')
output:
2010-08-27 00:00:00
Traceback (most recent call last):
File "./x.py", line 6, in <module>
print datetime.datetime.strptime(... |
This Setter can be used to change the contents of an IntSet by mapping the elements to new values.
Sadly, you can't create a valid Traversal for a Set, because the number of elements might change but you can manipulate it by reading using folded and reindexing it via setmap.
>>> adjust setmapped (+1) (fromList [1,2,3,4... |
I have Time Machine set up on a FireWire 800 external drive on my MacBook Pro. I have another USB external drive (formated NTFS with Paragon drivers so that I can store files bigger than 4 GB and access them from Windows) with iMovie media etc and TM has been backing that up successfully (I can see the files in TM disk... |
mao-40
Re : TBI + wiimote + ubuntu
En ce qui concerne 'gtkwhiteboard.ico', ce n'est pas l'image de calibration je pense, puisque le logiciel demande de calibrer l'écran avec les 4 coins du bureau et après cela fonctionne bien.
Ah ok, j'essaierai au demain au vidéo-projcteur.
Dernière modification par mao-40 (Le 04/02/2... |
here's a simple OpenCL Matrix Multiplication kernel which is driving me crazy:
By the way I am using pyopencl.
__kernel void matrixMul( __global int* C,
__global int* A,
__global int* B,
int wA, int wB){
int row = get_global_... |
Editor's note: Last week, in part one of this two-part series of hack excerpts from Gaming Hacks, author Simon Carless showed you how to write your own MMORPG macros. This week, Simon is back, giving you the hacking tools you need to create your own animations using this hack by chromatic.
Related Reading
Learn the bas... |
Summary
XHTML should be delivered as application/xhtml+xml. Most modern browsers, with the exception of Internet Explorer 6, support the MIME type application/xhtml+xml. This article demonstrates how to use content negotiation to deliver application/xhtml+xml to user agents that support that MIME type, and text/html to... |
Can I place:
from __future__ import absolute_import
inside __init__.py on the top level dir on my package and garantee that the absolute_import will be applied to all code that runs inside that package or sub-packages?
Or should I put that directive in each model that does an absolute import?
I maintain a Python packa... |
I'm trying to edit an existing object through a form, but every thing is not being populated with the current value. This object did have a value but when I went to edit, nothing showed up in the all field and only showing blank field.
Here's the model:
class Flow (models.Model):
title = models.CharField("Title", m... |
Audiofeeline
Modifier GRUB avec GRUB CUSTOMIZER
Bonjour à tous,
alors que je surfais paisiblement, je suis tombé sur un article de Tux-Planet qui présente GRUB CUSTOMIZER : http://www.tux-planet.fr/grub-customizer/
Je tenais à vous en faire part car ça faisait un petit moment que je cherchais une telle solution.
Bien à... |
If i input an integer i get invalid. I want it to do invalid if its not a number 0 or greater. Any help greatly appreciated!
from Tkinter import *
import tkMessageBox
from Tkinter import *
import tkMessageBox
class MyApp(object):
def __init__(self):
self.root = Tk()
self.root.wm_title("Question 7")
... |
ZhangHuangbin wrote:
*) You should remove it from Postfix, that's why you need this plugin for per-user restriction.
Check!
It works now. I just updated the plugin a little:
"""Reject sender login mismatch (sender in mail header and SASL username)."""
import logging
from libs import SMTP_ACTIONS
REQUIRE_LOCAL_SENDER = ... |
Trying to write a simple lowpass filter in python to run against lena. Then I'd like to run an inverse filter to run against the lowpass and try to get the original back (well, as close to original). I'm new to programming in python and not quite sure where to start. I tried rearranging a highpass filter code but it do... |
Say you’re making a basic scatterplot using D3, and you need to create some SVG circle elements to visualize your data. You may be surprised to discover that D3 has no primitive for creating multiple DOM elements. Wait, WAT?
Sure, there’s the append method, which you can use to create a single element.
svg.append("circ... |
Mangatd
[Résolu] Kdenlive rendu impossible et conflit avec libavcodec-extra-53
Bonjour,
Comme l'indique le sujet, je ne peux pas faire de rendu à cause d'un problème de codecs :
- Pour Xvid4, il lui manque libxvid
- Pour H264, il lui manque libx264
- Pour AVI DV, pcm_s16le
- Pour MPEG4 et Flash, libmp3lame
J'aimerais p... |
def main():
print "Welcome To the Date Converter"
print "Please Enjoy Your Stay"
print
date_string = raw_input("Please enter a date in MM/DD/YYYY format: ")
date_list = date_string.split('/')
import datetime
d = datetime.date
d.strftime('%B %d, %Y')
main()
That's what I have so far I k... |
Python gives us the ability to create 'private' methods and variables within a class by prepending double underscores to the name, like this: __myPrivateMethod(). How, then, can one explain this
>>> class MyClass:
... def myPublicMethod(self):
... print 'public method'
... def __myPrivateMethod(self... |
ZhangHuangbin wrote:
*) You should remove it from Postfix, that's why you need this plugin for per-user restriction.
Check!
It works now. I just updated the plugin a little:
"""Reject sender login mismatch (sender in mail header and SASL username)."""
import logging
from libs import SMTP_ACTIONS
REQUIRE_LOCAL_SENDER = ... |
There is a Fourier transform method here. Using the example from belisarius it might be done as below. Caveat: I do not guarantee I made no cut-and-paste errors. Your mileage may vary. Considerably.
(* sample data *)
g[x_] := x + 1/2 Sin[x] + RandomVariate[NormalDistribution[.2, .05]];
SeedRandom[1111];
xmax = 8*Pi;
nH... |
I know I can check if the object has a next method for it to be a generator, but I want some way using which I can determine the type of any object, not just generators.
Don't do this. It's simply a very, very bad idea.
Instead, do this:
try:
# Attempt to see if you have an iterable object.
for i in some_thing_... |
Django real world functional testing
20 Jan 2012
In the real world, a django application may be deployed on a real production plateform with as many layers as needed:
WSGI server
proxy
…
When we write functional tests with the dummy web client, we do not cover what’s going on over all those layers that composed applica... |
I created cgi script (running at localhost with apache) which will load text from textarea and then I will work with it. I have problems with characters like š,ť,é,.. that they are not displayed correctly. I tried it many ways. Here is one version of my short code in wchich I am just searching right way to deal with... |
Splitsch
[résolu]Installer OpenOffice 2 (beta) ,avec Synaptic
Bonjour à tous,
voila, j'ai esayé d'installer OOo avec Synaptic. J'ai sélectionner les paquets qu'il fallait, puis, je lance le téléchargement.La, il en télécharge quelque un, il les configure, mais pour les autres, voici ce qu'il indique
W: Échec de la récu... |
How to find the intersection and union of two lists in Python
My friend Bill had previously alerted me to the coolness of Python sets. However I hadn't found opportunity to use them until now. Here are three functions using sets to remove duplicate entries from a list, find the intersection of two lists, and find the u... |
Consider the following situation:
class A(object):
def __init__(self):
print('Running A.__init__')
super(A,self).__init__()
class B(A):
def __init__(self):
print('Running B.__init__')
# super(B,self).__init__()
A.__init__(self)
class C(A):
def __init__(self):... |
mao-40
Re : TBI + wiimote + ubuntu
En ce qui concerne 'gtkwhiteboard.ico', ce n'est pas l'image de calibration je pense, puisque le logiciel demande de calibrer l'écran avec les 4 coins du bureau et après cela fonctionne bien.
Ah ok, j'essaierai au demain au vidéo-projcteur.
Dernière modification par mao-40 (Le 04/02/2... |
I'm pretty sure my code is correct but it doesn't seem to returning the expected output:
input anti_vowel("Hey look words") --> outputs: "Hey lk wrds".
Apparently it's not working on the 'e', can anyone explain why?
def anti_vowel(c):
newstr = ""
vowels = ('a', 'e', 'i', 'o', 'u')
for x in c.lower():
... |
mol1
Re : Hortus belli projet de tower defense (finissons le jeu d'helly)
Un lien vers une esquisse de musique :
http://ubuntuone.com/7RqEp9oXkT6K338qog5WlX
Hors ligne
Ypnose
Re : Hortus belli projet de tower defense (finissons le jeu d'helly)
La zike est pas mal.
J'aiderai bien mais je suis pas bon codeur C, donc si v... |
Jx7
Re : [script] Télécharger de nombreuses quotidiennes de canal+ (suite)
J'ai l'impression que tu as un problème de droits d'écritures.
Hors ligne
Jx7
Re : [script] Télécharger de nombreuses quotidiennes de canal+ (suite)
Où as-tu placer le script?
Hors ligne
Jx7
Re : [script] Télécharger de nombreuses quotidiennes d... |
How can I color a Pygame image surface? I either want to change every pixel that is color A into color B, or else change every pixel into color B. Either works, so long as transparent regions remain the same.
Essentially what a surfarray does is directly modify the pixel values of pygame surfaces, and can operate on ea... |
I have a model which has a datetime field. Now given a particular datetime - DT, I need to get the object which has the datetime closest to DT. Is this possible?
Thanks,
I have a model which has a datetime field. Now given a particular datetime - DT, I need to get the object which has the datetime closest to DT. Is thi... |
I recently wrote the following Python function which will take a Google Picasa contacts.xml file and output a dictionary with ID and Name.
def read_contacts_file(fn):
import xml.etree.ElementTree
x = xml.etree.ElementTree.ElementTree(file=fn)
q = [(u.attrib["id"], u.attrib["name"]) for u in x.iter("contact"... |
I have random crashes of my Mac OS X application and there is no indication of a bug in my code.How to debug such kind of bugs? I have no access to user's computer where it is randomly crashes.
Here is an example of crash log:
OS Version: Mac OS X 10.8 (12A269)
Report Version: 10
Crashed Thread: 0 Dispatch queu... |
Table of Contents
NetBSD uses the CMU RAIDframe software for its RAID subsystem. NetBSD is the primary platform for RAIDframe development. RAIDframe can also be found in OpenBSD and older versions of FreeBSD. NetBSD also has another in-kernel RAID level 0 system in its ccd(4) subsystem (see Chapter 15, Concatenated Di... |
use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
~8 users here now
News and links for Django developers.
Can someone help me with this views.py issue? (self.django)
... |
_ClassType install_lib
cmd.Command --+
|
install_lib
initialize_options(self)
Set default values for all the options that this command supports.
finalize_options(self)
Set final values for all the options that this command supports.
run(self)
A command's raison d'etre: carry out the action it... |
Can the Blobstore in GWT/GAE be used as a database? Or is a new Blobstore created each time I launch the application? I would like to store information without losing it when the application is closed. But I can't seem to find a way to name a Blobstore and then reference it by its ID. Thanks!
If all you want to do is s... |
pango.Color — an object representing a RGB color
class pango.Color(gobject.GBoxed):
pango.Color(spec)
A pango.Color objectis a gobject.GBoxed
pango.Color(spec)
a string specifying the new color
a new pango.Colorobject.
Creates a new pango.Color usingthe color attributes specified by the string spec. The string in... |
Numpy has a set function numpy.setmember1d() that works on sorted and uniqued arrays and returns exactly the boolean array that you want. If the input arrays don't match the criteria you'll need to convert to the set format and invert the transformation on the result.
import numpy as np
a = np.array([6,1,2,3,4,5,6])
b ... |
raspouillas
Re : Topic des lève-tôt… Faisons manger leurs caleçons aux couche-tard! [4]
Je ne faisait aucune allusion au problème de @souen.
Dernière modification par raspouillas (Le 15/06/2012, à 20:37)
ljere
Re : Topic des lève-tôt… Faisons manger leurs caleçons aux couche-tard! [4]
alors voici la première partie du ... |
Automatic Text Summarization
It sounds like you're interested in automatic text summarization. For a nice overview of the problem, issues involved, and available algorithms, take a look at Das and Martin's paper A Survey on Automatic Text Summarization (2007).
Simple Algorithm
A simple but reasonably effective summariz... |
A random assortment of tips for getting stuff with some mix of expedience, safety, and broad coverage.
For single tracks, start with Skreemr. It doesn’t manage to find that much, unfortunately, but it’s a quick check. Other similar services include BeeMP3 and SeeqPod, which have (IMO) clumsier UIs. Once you’ve checked ... |
enebre
Re : Gmediafinder : Youtube/dailymotion/vimeo.. sans flash et bien plus....
bonjour smo,
je viens de réinstaller gmf sur mon petit netbook et
git clone git://github.com/smolleyes/gmediafinder2.git gmf2
cd gmf2/Gmediafinder
python gmediafinder.py
je constate que python-mecahanize n'est plus intégré dans les deps... |
I'm developing a library using a number of glib datastructures (GHashTable, GSList etc.). I've been checking my code frequently for memory leaks using valgrind. Most of the issues valgrind points out are quite easy to fix, however there's a few that I can't figure out.
All of these are reported as 'possibly lost'.
At t... |
I'm experimenting with BCBio's GFF parser, in the hope I can use it for my tool. I've taken a test .gbk file from NCBI's RefSeq database, and used it to parse into a .gff file.
Code I used (from http://biopython.org/wiki/GFF_Parsing):
#!/usr/bin/python
from BCBio import GFF
from Bio import SeqIO
def convert_to_GFF3():
... |
Controllo d'accesso
web2py include un meccanismo di Controllo d'accesso basato sui ruoli (Role Based Access Control) potente e personalizzabile.
Questa è la definizione di RBAC da Wikipedia:
"Nella sicurezza informatica, il Role-based access control (in italiano: Controllo degli accessi basato sui ruoli) in sigla RBAC ... |
Use random.shuffle() to shuffle a list, in-place:
import random
words = ["python", "java", "constant", "immutable"]
random.shuffle(words)
print(*words)
input('')
Demo:
>>> import random
>>> words = ["python", "java", "constant", "immutable"]
>>> random.shuffle(words)
>>> words
['python', 'java', 'constant', 'immutable... |
I've made a server based on cherrypy but I have a repetitive task which takes a long time (more than a minute) to run. This is all fine until I need to shut down the server, then I am waiting forever for the threads to finish.
I was wondering how you'd detect a cherrypy shutdown inside the client thread so that the thr... |
mars
Connaissances de base pour Kubuntu
Bienvenue à tous les lecteurs.
Ce sujet a pour but d'apporter les connaissances de base à toute personne débutant sous Kubuntu.
Il est très bon pour tout débutant de lire ce post, mais il est aussi très conseillé aux personnes plus expérimenté, car il contiendra des conseils de b... |
bertrand47
[Résolu] Duplicate sources list
J'ai depuis quelques jours une erreur "duplicate sources list", visiblement du à un doublon i386 et amd64. J'ai une installation amd64.
W: Duplicate sources.list entry http://security.ubuntu.com/ubuntu/ precise-security/main amd64 Packages (/var/lib/apt/lists/security.ubuntu.c... |
The following C++ code compiles and runs correctly for GNU g++, LLVM and every other C++ compiler I threw at it except for Microsoft VC6 and VC7:
template<typename A, typename B> int HasVoidReturnType(A(*)(B)) { return 0; }
template<typename B> int HasVoidReturnType(void(*)(B)) { return 1; }
void f(double) {}
int foo()... |
Se acaba de lanzar Django 1.5. La nueva versión incluye interesantes mejoras decritas en las release notes. Éstos son algunos de los aspectos más destacados:
Django 1.5 introduce soporte para un modelo de usuario configurable. El modelo básico de usuario de Django sigue presente, pero ahora el framework soporta especif... |
pops
logiciel d'animation en pixel art
Bonjour,
Je voulais vous présenter un petit logiciel d'animation en pixel art sur lequel je travaille depuis un peu plus d'un mois.
C'est encore très sommaire, mais il commence a être utilisable :
On peut dessiner avec des couleurs indexées, animer, il y a quelques brosse et on pe... |
use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
499 users here now
/r/programming is a reddit for discussion and news about computer programming
Guidelines
Please t... |
Hizoka
Re : [glade2script-GTK2] Interface graphique pour script bash ou autre.
bah le principe en lui même je le pige.
mais c'est son application où j'ai du mal.
Il va falloir que je me penche bien sur tes exemples.
Hors ligne
frafa
Re : [glade2script-GTK2] Interface graphique pour script bash ou autre.
CouCou !
oulah ... |
II. Statistiques et simulation▲
II-A. Références multi-cellules▲
Il est possible de traiter plusieurs cellules avec une seule règle, en utilisant une référence multi-cellules. Pour illustrer cette notion, je vais introduire une nouvelle table de démonstration avec une clé primaire composée, afin de pouvoir travailler s... |
vince06fr
Re : Nettoyage dans les noyaux (kernel)
Umuntu : Si tu veux prendre le temps de traduire ce script, surtout ne te gêne pas comme tout est "hardcodé" dans le script, la seule chose à faire est... De modifier l'ensemble des textes en français présents dans le script pour les mettre en anglais.
Une fois le scrip... |
How do I URI::encode a string like:
\x12\x34\x56\x78\x9a\xbc\xde\xf1\x23\x45\x67\x89\xab\xcd\xef\x12\x34\x56\x78\x9a
To get it in a format like:
%124Vx%9A%BC%DE%F1%23Eg%89%AB%CD%EF%124Vx%9A
(as per RFC 1738)
Here's what I've tried:
irb(main):123:0> URI::encode "\x12\x34\x56\x78\x9a\xbc\xde\xf1\x23\x45\x67\x89\xab\xcd\x... |
Python
lampprogrammer — 2013-10-31T12:29:07-04:00 — #1
I can't seem to determine what a model's field type is from within a template. I'm iterating through all rows and fields and want to implement special handling for certain field types, but it doesn't work. Here's how my object looks in models.py:
class MyModel(mode... |
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... |
#1251 Le 05/02/2012, à 19:35
chaoswizard
Re : TVDownloader: télécharger les médias du net !
Voilà, la version 0.5 est arrivée dans le PPA !
Ubuntu ==> Debian ==> Archlinux
Hors ligne
#1252 Le 05/02/2012, à 20:08
ynad
Re : TVDownloader: télécharger les médias du net !
@Greg_lattice
comme f.x0 avec la même ligne de comma... |
Possible Duplicate:
Learn Python the Hard Way Exercise 17 Extra Question(S)
In this exercise I have to rewrite the code in one line. I tried to write the lines of code like this(from sys import argv,from os.path import exists) but it gives me a syntax error. So, I'm very curious, how can I write this exercise on one li... |
I have a piece of code looking like this :
TAxis *axis = 0;
if (dynamic_cast<MonitorObjectH1C*>(obj))
axis = (dynamic_cast<MonitorObjectH1C*>(obj))->GetXaxis();
Sometimes it crashes :
Thread 1 (Thread -1208658240 (LWP 11400)):
#0 0x0019e7a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x048c67fb in __waitpi... |
It so happened that I had to use arrays of PostgreSQL. In Django models do not have native support for arrays, so I used django_arrayfields. But for display in the admin should I use for the field hoprizontal_filter IntegerArrayField.
models.py
class Group(models.Model):
name = models.TextField()
class User(models... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.