text stringlengths 256 65.5k |
|---|
When VLC is running, it prevents the computer from suspending.
I want it to allow suspend IF VLC is stopped (the media finished playing).
How can this be done?
You could set up a DBus query to get the play state of VLC and kill the process when it's done playing. That should release its hold on suspend state.
I was exp... |
I have a linux server, and a linux desktop.
I have written the following simple script to dump the database of a django web application:
#! /bin/bash
set -o errexit
cd $(dirname $0)
. virtualenv/bin/activate
cd mysite
export DJANGO_SETTINGS_MODULE="settings.my_hostname"
django-admin.py dumpdata --settings=$DJANGO_SETTI... |
There are two ways to do this. It's super simple to write a regex that will grab whatever value is between <a href= and >. This works pretty well:
>>> s = "<p>Hello World</p><a href="http://example.com">More Examples</a><a href="http://example2.com">Even More Examples</a>"
>>> re.findall('<a href="?\'?([^"\'>]*)', s)
[... |
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... |
I need to classify words into their parts of speech. Like a verb, a noun, an adverb etc.. I used the
nltk.word_tokenize() #to identify word in a sentence
nltk.pos_tag() #to identify the parts of speech
nltk.ne_chunk() #to identify Named entities.
The out put of this is a tree. Eg
>>> sentence = "I am Jhon ... |
Since version trunk 288 you can create dummy databases with SQLDB(None) and they can be used to generate form. Here is how.
Define the following helper function:
def form_factory(*a): return SQLFORM(SQLDB(None).define_table(*a))
and now you can create a controller like the following
def index():
form=form_factory... |
In .NET System.Object.GetHashCode method is use in a lot of places throughout the .NET base class libraries. Especially when finding items in a collection fast or to determine equality. Is there a standard algorithm/ best practise on how to implement the GetHashCode override for my custom classes so I don't degrade per... |
I have to access a POS terminal under ms windows xp. I am using python 2.7. The crucial function in the DLL I load that does the payment accepts two pointer to structures, but it crashes returning 1 (Communication error) but without further messages. Please note that when the payment function is called, not all the ele... |
The question is interesting. So you want a "loose" curve which joins points (A) and (B) and whose length is 8 units.
Obviously, the difficult part is to ensure that the length is 8 units (or at least close to that amount). The general problem depends on which curve is chosen (See Wikipedia's arc length article), but in... |
I’ve recently been working on a parallel processing task in Python, using the multiprocessing module’s Pool class to manage multiple worker processes. Work comes in large batches, so there are frequent periods (especially right after startup) where all of the workers are idle. Unfortunately, when workers are idle, Pyth... |
I've been struggling to get memcache working on my app for a bit now. I thought I had finally got it working where it never reads from the database (unless memcache data is lost of course), only to have my site shut down because of a over-qota number of datastore reads! I'm currently using a free appspot and would like... |
Is there a list somewhere of recommendations of different Python-based REST frameworks for use on the serverside to write your own RESTful APIs? Preferably with pros and cons.
Please feel free to add recommendations here. :)
Something to be careful about when designing a RESTful API is the conflation of GET and POST, a... |
lukophron
[python]Monsieur Cinéscript
Salut,
Suite à une demande, j'ai pondu un script python pour mettre à jour la liste des films trouvés sur le topic-jeu Quel film c'est ?
Ça tourne, ça remplit son objectif (et son deuxième objectif qui était de me remettre à apprendre Python ^^)
Maintenant, il y aurait mieux.
Je po... |
I am attempting to migrate from Ubuntu 12.04 to 13.10 and am having some issue being able to log into my samba domain from the 13.10 workstation when I use the same settings on the 12.04 workstation. This is most probably due to the depreciation of smbfs for cifs-utils
My working setup on Ubuntu 12.04 is as following:
... |
For this to work you will need the Jquery form plugin http://jquery.malsup.com/form/ At the top of web2py_ajax.html add
...
response.files.insert(3,URL(r=request,c='static/js',f='jquery.form.js'))
...
at the bottom of web2py_ajax.html replace with the following code
...
function web2py_trap_form(action,target) {
jQ... |
mac-gyver31
Re : Client Ubuntu + Active Directory et partage avec Windows serveur 2003
En fait ce post est plutôt tournée vers l'intégration d'un ordi dans un domaine windows 2003 dans le cadre d'un serveur LTSP.
Un serveur LTSP ?? Tu veux dire Linux Terminal Server Project ?
T'es sûr ? Car je ne vois pas bien le rappo... |
gtk.Alignment — a widget that controls the alignment and size of its child
class gtk.Alignment(gtk.Bin):
gtk.Alignment(xalign=0.0, yalign=0.0, xscale=0.0, yscale=0.0)
def set(xalign, yalign, xscale, yscale)
def set_padding(padding_top, padding_bottom, padding_left, padding_right)
def get_padding()
+--g... |
I'm trying to write a numpy array into txt file:
a = numpy.array([1,2,3])
numpy.savetxt('a.txt',a,fmt='%.3f')
when I open the txt file it looks like:
1.0002.0003.000
but when I paste it in word it looks like:
1.0002.0003.000
The problem is that another program reads the txt file as input line by line:
data = fid.readl... |
doudoulolita
Re : Faire une animation sur la création de jeux vidéo libres
Bibliographie:
- La 3D libre avec Blender d'Olivier Saraja - ed Eyrolles - 35 € pour la 1ère édition. Disponible à la FNAC ou chez Eyrolles pour la 4ème édition.
- Blender, Créez des animations 3D de Marie-France et Jean-Michel Soler - ed. Pears... |
Databases
hieronymus — 2012-08-28T07:37:17-04:00 — #1
Hi,
I have a python script that executes 3 queries in 2 transactions on a MySQL database. Today I added an index to one of the used tables to resolve speed issues reported by the slow query log.
The problem is that the script fails quite fast since this change. It r... |
#2676 Le 15/02/2013, à 19:14
mulder29
Re : TVDownloader: télécharger les médias du net !
Et je reçois
python: can't open file
alors que j'ai installé Python 2.7.3, hier.
Hors ligne
#2677 Le 15/02/2013, à 19:26
k3c
Re : TVDownloader: télécharger les médias du net !
si tu tapes
which python
ça affiche quoi ?
Dernière mod... |
import itertools
class Indexable(object):
def __init__(self,it):
self.it = iter(it)
def __iter__(self):
for elt in self.it:
yield elt
def __getitem__(self,index):
try:
return next(itertools.islice(self.it,index,index+1))
except TypeError:
r... |
I have a ESRI shapefile (from here: http://pubs.usgs.gov/ds/425/). I looking to use python to lookup information from the shape file (surficial material in this case) at a given latitude/longitude.
What is the best way to go about solving this problem?
Thanks.
Final solution:
#!/usr/bin/python
from osgeo import ogr, os... |
Sylau
[RESOLU]Command not found
Bonjour à tous,
c'est la première fois que je poste pour un problème, et c'est bon signe: j'ai toujours trouvé les réponses
J'ai fait l'installation d'un Ubuntu Server et j'aimerais installer le paquet qui donne des suggestions du genre:
sylvain@sylvain-laptop:~$ python1
No command 'pyth... |
With python, type checking is usually done at runtime. Python will tell you of type problems when you run the code. At runtime Python will tell you if there is a problem with the program
However there are now tools to type check your python programs before you run them. Unfortunately it is not a widely known that you c... |
I have a 2 files.
funcattrib.py
test_import.py
funcattrib.py
import sys
def sum(a,b=5):
"Adds two numbers"
a = int(a)
b = int(b)
return a+b
sum.version = "1.0"
sum.author = "Prasad"
k = sum(1,2)
print(k)
print("Function attributes: - ")
print("Documentation string:",sum.__doc__)
print("Function name:",s... |
from operator import itemgetter
your_list.sort(key=itemgetter('date'), reverse=True)
Related notes
don't use list, dict as variable names, they are builtin names in Python. It makes your code hard to read.
you might need to replace dictionary by tuple or collections.namedtuple or custom struct-like class depending on ... |
I've been working on creating a subclass of db.Model that is automatically cached, i.e.:
instance.put would store the entity in memcache before persisting it to the datastore
class.get_by_key_name would first check the cache, and if missed, would go to the datastore to retrieve it and cache it after retrieval
I develop... |
I can tag files with nautilus but haven't found a solution to find files by tags so far. Tracker-search-tool doesn't offer to search for tags, nor does Nautilus, nor any other application I'm aware of. Just upgraded to 11.04.
It's called tracker-tag:
It's provided by the tracker-utils package, which is the command line... |
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...
~0 users here now
Check for typos in your programs with the book's online diff tool.
"Invent Your Own Computer Games... |
JavaScript
shtoom — 2011-06-07T07:23:10-04:00 — #1
OK folks I am just going to fire a question out into cyber space!
How can I display 3 random images with descriptions from a flickr account? I know there are galleries that can handle this but they seem to display one large image with small thumbnails at the bottom lik... |
I am currently trying to log into a site using Python however the site seems to be sending a cookie and a redirect statement on the same page. Python seems to be following that redirect thus preventing me from reading the cookie send by the login page. How do I prevent Python's urllib (or urllib2) urlopen from followin... |
How can I update Numpy into the newest one? Should I download .dmg file from here:
Is this .dmg only for 10.5? I have installed numpy using these instructions:
My current Numpy is 1.2.1. I'm running on Mac OS X 10.6.1 Snow Leopard. Thanks!
How can I update Numpy into the newest one? Should I download .dmg file from her... |
abelthorne
The Humble Voxatron Debut
Après la concurrence de l'IndieRoyale Bundle pas pour Linux, Wolfire revient dans la course avec le Humble Voxatron Debut. C'est la saison des bundles !
Bon, après un bundle d'un seul jeu (Frozen Synapse) récemment, voilà qu'ils nous refont le coup du jeu unique (Voxatron, donc) et ... |
I have the following models:
class ProjectUser(models.Model):
categories = models.ManyToManyField('UserCategory', blank=True, null=True)
user_id = models.PositiveIntegerField(db_index=True)
name = models.CharField(max_length=80)
actual_rank = models.FloatField(default=0)
class UserCategory(models.Model... |
If I understand you correctly this should do it:
var a = $('.simpleCart_input').html();
alert(a);
Based on your comment you want this:
var a = $('.simpleCart_input').val();
$('.simpleCart').text(a);
(For the code to do it's purpose you need a span with the class simpleCart.)
Final suggestion:
Just to add the code for... |
How would one create an iterative function (or iterator object) in python?
Iterator objects in python conform to the iterator protocol, which basically means they provide two methods:
Here's a simple example of a counter:
class Counter:
def __init__(self, low, high):
self.current = low
self.high = h... |
Topic: iRedMail in jail?
Do iRedMail is working in jails?
----
Urgent issue? Pay iRedMail developer to solve it remotely at $39.
Works on Red Hat Enterprise Linux, CentOS, Debian, Ubuntu, FreeBSD, OpenBSD
You are not logged in. Please login or register.
Do iRedMail is working in jails?
----
Sorry, you didn't explain cl... |
I have created a PHP-script to update a webserver that is live inside a local directory. I'm migrating the script into Python. It works fine for the most part, but after a PUT command the size of the file appears to change. Thus, the size of the file is different from that of the file on the server. Once I download aga... |
I edit avd from from API Level-14 to google API's(Google Inc.)-API Level-8... after this my edited avd not working.. its show only black screen after some loading..like crash over some times....whats the reason ... help... thanks
10-11 14:55:02.548: W/PackageParser(397): /data/app/SoftKeyboard.apk (at Binary XML file l... |
This weekend I was working on a project and I needed to use a binomial distribution to test the probability of an event (the probability that x of y characters would be alphanumeric given random bytes). My first solution was to write the test myself since it is rather simple.
def factorial(n):
if n == 0:
re... |
I have been presented with a simple but slow performing LINQ to Entities query which I've pasted below.
Could anybody give me some pointers on how to improve performance? The query below has been significantly improved since I inherited it but I don't know what else I can do without moving to the DB (which isn't an opt... |
hlou
[Résolu]Xubuntu echec du traitement des paquets
Bonjour,
J'ai installé xubuntu 12.04.1 et à par les mises à jour systemes, je ne peux plus rien installer via la logithèque ou synaptic.
Le téléchargement de paquets se lance et au bout de quelques minutes, un message me dit "échec de traitement des paquets :l'instal... |
Is there an easy way to rename a group of files already contained in a directory, using Python?
Example: I have a directory full of *.doc files and I want to rename them in a consistent way.
X.doc -> "new(X).doc"
Y.doc -> "new(Y).doc"
import glob, os
def rename(dir, pattern, titlePattern):
for pathAndFilename in gl... |
This is a pretty common need... I can't imagine wading through a models.py file that's 10,000 lines long :-)
You can split up the models.py file (and views.py too) into a pacakge. In this case, your project tree will look like:
/my_proj
/myapp
/models
__init__.py
person.py
The __init... |
Mindiell
Re : Topic des lève-tôt… Faisons manger leurs caleçons aux couche-tard! [4]
Si c'est Floyd Pepper...
Eh mais c'est l'week-end !
Hors ligne
PPdM
Re : Topic des lève-tôt… Faisons manger leurs caleçons aux couche-tard! [4]
Bonjour, Golgoth devait en bricoler un mais il n'a pas dis quand!
Hors ligne
raspouillas
Re... |
I'm currently using the modified Gram-Schmidt algorithm to compute the QR decomposition of a matrix A (m x n). My current problem is that I need the full decomposition Q (m x m) instead of the thin one Q (m x n). Can somebody help me, what do I have to add to the algorithm to compute the full QR decomposition?.
import ... |
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... |
I want to build a bot that basically does the following:
Listens to the room and interacts with users and encourages them to PM the bot.
Once a user has PMed the bot engage with the client using various AI techniques.
Should I just use the IRC library or Sockets in python or do I need more of a bot framework.
What woul... |
Not as simple as using split, however:
string input = "FirstName=ABC;LastName=XZY;Username=User1;Password=1234";
string username = Regex.Match(input, "Username=(?<username>.*?)(;|$)").Groups["username"].Value;
In this case, groups can be in any order.
And, if you like to get creative:
var answers = from tuple in input... |
I am working on a django project (my first), and in one of my views, I have a sophisticated html snippet with JS weaved within it. I would like to reuse this "component" somewhere else in the same view. Is there a way of achieving this? Please let me know if this design is faulty to begin with?
Use the
Not sure, if you... |
bowmore
Re : Qarte arte.tv browser (ex Qarte+7)
Si je lance
python /usr/bin/qarte
J'obtiens
python /usr/bin/qarte
(qarte:23575): Gtk-WARNING **: Impossible de trouver le moteur de thème dans module_path : « pixmap »
Affiché une quinzaine de fois, puis Qarte-1 démarre bien. Dans le terminal, il y a ça:
15:33:40: INFO ... |
I have a model called UserProfile defined as
class UserProfile(models.Model):
user = models.OneToOneField(User, related_name='userprofile_from_user')
user_types = models.ManyToManyField(UserType, related_name='userprofiles_from_user_types', null=True, blank=True)
def has_user_types(self, user_types):
... |
ADcomp
Re : ADesk Bar : Barre de lancement rapide [python/gtk/cairo]
@sam7 : je suppose que tu parles de mon live "Madbox" .. comme je te l'ai dit sur l'autre post, il n'est pas prévu pour une installation "normale" et les paquet *-fr ne sont pas installés. Sinon , j'ai une mise à jour de mon live en cours ( plus conve... |
Django
Django RSS feed • Hire me for Django web development
Today I wanted to tinker around with the experimental support for Python 3 in Django 1.5 (alpha). So, my first question was, how well does
virtualenvplay with Python 3? And that's when I learned about the new(ish)venvmodule available in Python 3.3.
The quix.dj... |
I've managed to do this with growl for windows. Here's something that should get you started real quick:
Install growl for windows
On the 'security' tab of the growl configuration, disable the 'require password for LAN apps'(YMMV, I manage security using windows firewall) and enable 'Allow network notifications'
The ab... |
k3c
Re : TVDownloader: télécharger les médias du net ! [2]
Merci Julien
J'ai testé avec succès pour plusieurs vidéos comme
par contre le --resume devrait être optionnel
python d8_julien.py http://www.d8.tv/d8-art-de-vivre/pid5205-d8-a-vos-regions.html
rtmpdump -r "rtmp://geo2-vod-fms.canalplus.fr/ondemand/geo2/1304/A_V... |
The question reads:
Write a Python program that initializes a global variable to 5. The keydown event handler updates this global variable by doubling it, while the keyup event handler updates it by decrementing it by 3.
What is the value of the global variable after 12 separate key presses, i.e., pressing and releasin... |
If I am having
char = 'a'
how can I increase the value into 'b' and then into 'c' and so on..
I don't want to replace it or change it. Its much like
char = char + 1
If I am having
how can I increase the value into 'b' and then into 'c' and so on..
I don't want to replace it or change it. Its much like
char = char + 1
... |
I have seen the great tutorial by Peter Colling Ridge on
http://www.petercollingridge.co.uk/pygame-physics-simulation/
and I am extending the PyParticles script
The code is available on the site(for free), I am using PyParticles4.py
Classes used in the tutorial
The Particle Class
Circular 2d objects with radius,mass,ve... |
There are subtle differences in UCS2 and UCS4 (Windows and Linux, for example) builds of Python due to bugs, conflicting or deprecated standards, etc.
unicodetest.py:
#-*- coding: utf-8 -*-
print 'Result:', u'𐄣' == u'\U00010123'
print 'Len:', len(u'𐄣'), len(u'\U00010123')
print 'Repr:', repr(u'𐄣'), repr(u'\U00010123... |
I have a function as part of a game for a tutorial. The function in question should trigger another function if a condition is met (if theobject == "code")
# right room
def right_room():
print "You see a table with two objects: a map and a code translator"
print "You can take one object"
print "Which object... |
I wrote my first code with Google Task Queue Python API. It is supposed to send out an email every time URL is entered into the address bar. Although it shows a task in default task queue in my dashboard, I don't know why is it not executed even after an hour of initiating it.
queue-mail.py:-
class sendMail(webapp.Requ... |
Module: Sequel
Extended by:
, , , , , ,
Includes:
Defined in:
lib/sequel/core.rb,
lib/sequel/sql.rb,
lib/sequel/model.rb,
lib/sequel/version.rb,
lib/sequel/dataset.rb,
lib/sequel/database.rb,
lib/sequel/timezones.rb,
lib/sequel/model/base.rb,
lib/sequel/exceptions.rb,
lib/sequel/deprecated.rb,
lib/sequel/dataset/sql.rb... |
I get a big array (image with 12 Mpix) in the array format from the python standard lib. Since I want to perform operations on those array, I wish to convert it to a numpy array. I tried the following:
import numpy
import array
from datetime import datetime
test = array.array('d', [0]*12000000)
t = datetime.now()
numpy... |
I have a fair background in java, trying to learn python. I'm running into a problem understanding how to access methods from other classes when they're in different files. I keep getting module object is not callable.
I made a simple function to find the largest and smallest integer in a list in one file, and want to ... |
i'm using a form with a TypeChoiceField, this is the form's code:
class AnagraficaForm(forms.Form):
usertype = ((1,'Privato'),(0,'Libero professionista/Azienda'))
nome = forms.CharField(max_length=100)
cognome = forms.CharField(max_length=100)
telefono = forms.CharField(max_length=50,required=False)
... |
I'm trying to use the following code to accept in a file as an argument in Terminal which will then be read and update the body variable with its contents. If the file is not passed in then I want to have the prompt where the user can enter their own body copy.
require 'posterous'
Posterous.config = {
'username' => ... |
I am trying to graph a Pandas dataframe using Matplotlib. The dataframe contains four data columns composed of natural numbers, and an index of integers. I would like to produce a single plot with line graphs for each of the four columns, as well as error bars for each point. In addition, I would like to produce a lege... |
JavaScript
maya90 — 2013-04-21T22:01:22-04:00 — #1
how would I sort this array so the member with the highest points prints first?
<font face='Courier New'>
var members = [{
name: "stephen gupta",
points: 52
},{
name: "laura kowalski",
points: 67
},{
name: "John Rodriguez",
points: 33
}];
</font>
how ... |
Kedoc
Re : script install wifi BCM94311MCG
Petit point...
Je me suis aperçu ce soir qu'il me suffit d'utiliser l'interrupteur matériel de ma carte pour l'éteindre et la rallumer, un coup au démarrage sous Ubuntu, et je peux ensuite l'utiliser (en wifi ouvert, et en WEP, ça fonctionne).
Je n'ai pas encore bien compris, ... |
ogaby
Re : [ATTENTION] Faille de sécurité critique dans le noyau Linux !
vi...
Avec cette simple ligne, on peut bénéficier des mises-à -jour de sécurité plus rapidement que sur un dépà´t européen. Je dis "européen" car je vis en Allemagne et mon dépà´t "normal" n'a pas encore cette mise-à -jour.
Hors ligne
zappinggg
Re... |
Earlier this summer, I started taking a look at the OCaml programming language in anticipation of the compilers class I’m taking this fall.
OCaml is a strongly, statically typed, functional language with type inference. It’s pretty neat, and supports imperative programming as well as object-oriented constructs for when... |
anonym_user
Re : Besoin de testeurs pour Pap'rass
Salut,
Excellente idée ce soft !
J'ai juste un petit problème : les doc ne se classe pas dans les chemises que je crée. Après chaque tentative de classement la recherche sur le classeur m'indique qu'il est vide. La recherche par mot clé retrouve le doc mais le document ... |
Hello everybody (first post here).
I am trying to send data to a webpage. This webpage request two fields (a file and an e-mail address) if everything is ok the webpage returns a page saying "everything is ok" and sends a file to the provided e-mail address. I execute the code below and I get nothing in my e-mail accou... |
Have a function fix(), as a helper function to an output function which writes strings to a text file.
def fix(line):
"""
returns the corrected line, with all apostrophes prefixed by an escape character
>>> fix('DOUG\'S')
'DOUG\\\'S'
"""
if '\'' in line:
return line.replace('\'', '\\\'')... |
moko138
Re : Qarte arte.tv browser (ex Qarte+7)
Il me semble avoir vu - dans un autre fil - un contournement des discriminations géographiques par un vpn, non ?
En ligne
J5012
Re : Qarte arte.tv browser (ex Qarte+7)
Il me semble avoir vu - dans un autre fil - un contournement des discriminations géographiques par un vp... |
i am building a string that i check in mysql db.
eg:
formFields[] is an array - input1 is: string1
array_push(strings, formFields)
1st string and mysql query looks like this:
"select * from my table where id in (strings)"
formFields[] is an array - input2 is: string1, string2
array_push(strings, formFields)
2nd string ... |
I am running Tutorial application example for Quickly ( I named App Smallbrowser). This is code from SmallbrowserWindow.py :
import gettext
from gettext import gettext as _
gettext.textdomain('smallbrowser')
from gi.repository import Gtk, WebKit # pylint: disable=E0611
import logging
logger = logging.getLogger('smallbr... |
The Postman REST Client is pretty popular for testing an API. There are others, I'm sure, but I'm working with folks who like Postman.
Postman 10 has some automation capabilities. Some.
However. (And this is important.)
It doesn't provide much help in framing up a valid complex JSON message.
When dealing with larger an... |
Im new to scons and am having problems with scons dependancies in a hierarchichal build with a variant directory.
Im able to reproduce the problem in a reduced environment that consists of 2 subdirs under the SConscript directory (moduleA and moduleB) as follows:
.|-- SConstruct|-- file.conf|-- moduleA| |-- SConscript|... |
Knapzakprobleem
Gegeven een verzameling van objecten, elk met gewicht en waarde, bepaal welke (deel)verzameling van objecten meegenomen wordt in de knapzak, zodat het totale gewicht onder de limiet blijft en de totale waarde gemaximaliseerd wordt.
Inhoud
Verschillende definities[bewerken]
Er is de beschikking over obje... |
How can I check if a Python object is a string (either regular or Unicode)?
To check if an object
isinstance(o, basestring)
because both
To check if the type of
type(o) is str
To check if
isinstance(o, str)
The above also work for Unicode strings if you replace
However, you may not need to do explicit type checking ... |
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... |
I have a script to report me about all files, in a directory, so that users will be required to erase them (it's a really badly managed cluster, w/o real superuser). When I run the script I get: OSError: [Errno 13] Permission denied: ' ls: : Permission denied I can't write the dir name (company policy) The code is:
#!/... |
I just tracked down a nasty bug in my code to a gotcha with Python iterators.
Consider the following code...
class Numbers(list):
def even(self):
for val in self:
if val % 2 == 0:
yield val
even = property(even)
def odd(self):
for val in self:
if val %... |
my goal is to generate a plot like the following:
What i need is to get an array of annotations, then place these annotations rightly aligned onto the plot. How can i achieve this? The text should go until just before the y axis.
One way is to use fig.text(). You can do something like:
fig = plt.figure()
fig.text(0.8,0... |
display vector without looping it
Jul 15, 2013 at 8:57pm UTC
I was looking to make a way to view the contents of a vector without looping the vector? Kind of like in Python, you can just print the list and display its contents without looping it.
I know i can just print the elements in the split function but i wanted t... |
kevlar
Ella : projet de logiciel d'animation Flash & SVG pour Linux
Le projet est aujourd'hui bien avancé : version 0.3.1.2 au 2 Novembre 2010 !
Ella (Elegant Light Linux Animator) est un projet amateur destiné à fournir à la communauté linuxienne un générateur d'animations Flash & SVG wysiwyg, fonctionnel, léger, bien... |
January 6th, 2013 at 2:16 pm by Dr. Drang
On Friday, a colleague asked me if I had a quick solution for determining the spring stiffness of a tapered leaf spring. Yup. This may be the first time I’ve been able to use an old blog post directly for work.
But as I read through the solution, I realized I’d done the numeric... |
I have two apps with nearly identical code base (same functionality, just different branding) that I am trying to do virtual hosting with using mod_wsgi and apache.
the virtual host settings for both apps (in two separate files) are identical (with the exception of paths of course)
WSGIPythonHome /home/ubuntu/BASELINE
... |
times = defaultdict(list) for pq in (db.PlayedQuestion.collection .find({'play.$id': {'$in': play_ids}})): if pq['time'] is not None: if pq['right']: times['right'].append(pq['time']) elif pq['answer']: times['wrong'].append(pq['time'])
What I noticed was that is was quite slow. For example, looping over 12,200 docume... |
Tabla de contenidos
PyGTK 2.0 es un conjunto de módulos que componen una interfaz Python para GTK+ 2.0. En el resto de este documento cuando se menciona PyGTK se trata de la versión 2.0 o posterior de PyGTK, y en el caso de GTK+, también a su versión 2.0 y siguientes. El sitio web de referencia sobre PyGTK es www.pygtk... |
goyou
[Astuce] Calculatrice Numpy dans Python dans un Terminal [Résolu]
Bonjour,
Pour quelqu'un qui a déjà installé numpy sur son pc, l'idée est de pouvoir invoquer un terminal qui charge python et qui charge numpy automatiquement pour s'en servir comme d'une calculatrice.
C'est-à-dire qu'on obtient une fenetre en lign... |
I was going to suggest the compiler module, but it ignores comments:
f.py:
# For Translators: some useful info about the sentence below
_("Some string blah blah")
..and the compiler module:
>>> import compiler
>>> m = compiler.parseFile("f.py")
>>> m
Module(None, Stmt([Discard(CallFunc(Name('_'), [Const('Some string b... |
bisk8
Re : [HOW TO] adesklets : configuration des desklets
Bonjour,
Alors la je commence a désespérer avec le adesklets: volume.py
C'est le seul que je n'arrive pas a faire marcher, tous les autres sont ok.
Lorsque je le lance en test
python ./chemin/du/script/volume.py --nautilus
puis touche t il se lance, n'est pas ... |
Traceback (most recent call last):
File "scripts/rule_bison.py", line 75, in <module>
return Code = subprocess.call([bisonExe, '-d', '-p', prefix, inputFile, '-o', outputCpp])
File "/usr/lib/python2.7/subprocess.py", line 493, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.7/subp... |
Efhache84
Réponses : 13
Bonjour à tous,
petite demande pour un script, je cherche à vérifier le délai écoulé depuis un accès ssh.
Pour ce faire, dans les logs j'ai des lignes du genre :
Aug 7 12:16:06 (none) authpriv.info dropbear[9655]: exit after auth (root): Exited normally
Aug 7 12:16:06 (none) authpriv.info drop... |
That seems that I've used wrong function. With .fromstring - there're no error messages
xml_ = load() # here comes the unicode string with Cyrillic letters
print xml_ # prints everything fine
print type(xml_) # 'lxml.etree._ElementUnicodeResult' = unicode
xml = xml_.decode('utf-8') # here is an error
doc = lxml.e... |
Minimum XFree version should be 3.3.3.1 because this version has extended XInput support, the second side switch works now and the blocking mouse effect has been fixed.
If you must use any prior version, XInput support should be available since 3.1.2.d.
XInput support in XFree is configured basically in a file called X... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.