text stringlengths 256 65.5k |
|---|
This requires that you install soaplib.
We assume this soaplib server:
from soaplib.wsgi_soap import SimpleWSGISoapApp
from soaplib.service import soapmethod
from soaplib.serializers.primitive import *
from time import ctime
from wsgiref.simple_server import make_server
class MyServer(SimpleWSGISoapApp):
@soapmetho... |
livier
Re : Connaissances de base pour Kubuntu
Un clic droit sur le bouton rouge "déconnexion" ouvre aussi le gestinnaire de sessions, mais plus directement
La différence fait peur. L'indifférence aussi mais pas aux mêmes.
J'ai vu bien des choses dans ma petite vie, et je mesure amèrement l'impuissance à les dire.
Hors... |
Anarcheon
Perte d'éléments suite à utilisation de compiz
Bonjour à tous,
Utilisateur relativement récent d'Ubuntu (<1 an), j'ai voulu faire mumuse avec compiz. J'essaie d'installer le cube et quelques autres "décorations", mais finis par me rendre compte que c'était aussi bien avant, et que j'irai bidouiller un peu plu... |
janosch
[Résolu] Problème de paquet cassé...
Bonjour,
je me permets de solliciter votre aide car je ne m'en sort malheureusement pas du tout.
J'ai eu la malencontreuse idée de faire un glisser-déposer d'un fichier vidéo présent sur mon bureau, sur l’icône de VLC présente dans le dock Cairo, pensant naïvement que cela a... |
Virtualici
Re : [Tuto] - Ma personnalisation Xubuntu (et autres variantes)
j'ai tout tenté ! au mieux j'ai ça : ):
[sudo] password for boubou:
Sorry, try again.
sudo: 3 incorrect password attempts
boubou@boubou-M51SE:~$ *******
******* : commande introuvable
boubou@boubou-M51SE:~$
les : ******* c'est mon pass.
Hors l... |
michcauch
my-weather-indicator ne fonctionne plus après mise à jour
my-weather-indicator ne fonctionne plus, juste après une mise à jour de my-weather-indicator sous 12.04. J'ai ce message d'erreur quand je le lance depuis un terminal :
michel@bureau:~$ my-weather-indicator
Traceback (most recent call last):
File "/usr... |
Python no deja de sorprenderme cada día. Y es increíble la cantidad de cosas que trae “de serie”. A veces me da la sensación de que le saco muy poco provecho.
Hace relativamente poco que me puse a pensar: Si casi todo lo que hago lo hago en consola, ¿por qué no hacerlo más bonito con curses? Pero no me decidía. El otro... |
Some more options. In Ipython with pylab enabled, dedent is already in the namespace. I checked and it is from matplotlib. Or it can be imported with:
from matplotlib.cbook import dedent
In documentation it states that it is faster than the textwrap equivalent one and in my tests in ipython it is indeed 3 times faster... |
Oni
Re : [How-to] Desktop Screenlets
Salut.
Je viens de réinstaller screenlets.
Lorsque je lance une musique avec Listen (mon lecteur par défaut), le module "Now Playing" me renvoie une erreur comme vous pouvez le voir sur la capture ci-dessous.
J'ai installé le paquet "python-dcop" au cas où... mais même problème.
Si ... |
I am wanting to load another program into my python GUI. The other program takes in a textfile and prints out a result I want to print the result out in my other program I was just wondering how i would go about this using the subprocess module
is this correct thing to do?
def test(self,event):
t=subprocess.check_o... |
I'm trying to find out how much time it takes to execute a Python statement, so I looked online and found that the standard library provides a module called timeit that purports to do exactly that:
import timeit
def foo():
# ... contains code I want to time ...
def dotime():
t = timeit.Timer("foo()")
time =... |
Do check out Oli's links. You basically see the authenticated username as verified by Basic HTTP Authentication in Django by looking at request.META['REMOTE_USER'].
Update: Tested the proposed patch for ticket #689, which is available up-to-date in telenieko's git repository here. It applies cleanly at least on revisio... |
Here is my code with some notes:
import re
import itertools
nouns = ['bacon', 'cheese', 'eggs', 'milk', 'houses', 'dog']
CC = ['and', 'or']
def search_and_replace(text):
noun_patt = r'\b(' + '|'.join(nouns) + r')\b'
CC_patt = r'\b(' + '|'.join(CC) + r')\b'
patt = r'({0},? )+{1} {0}'.format(noun_patt, CC_pat... |
I'm using easygui.multchoicebox() to select a number of items in a tuple. How do I make a conditional that executes code when certain items from the tuple are selected?
Here is example code that does not work (nothing is returned):
from easygui import *
fieldnames = ["Yes", "No", "Maybe"]
choice = multchoicebox("Pick a... |
Possible Duplicate:
Syntax error on print with Python 3
I know Python is supposed to be the god of interpreted languages... its simplicity, its lack of redundancy, blah blah blah. But since I'm too used to C, C++, Java, Javascript and Php, I must admit this is annoying. Here's my code:
#!/usr/bin/python3.1
def shit(tex... |
In your existing code you can change the list to a generator expression:
dest = "\n".join(line for line in src.split("\n") if line[:1]!="#")
This very small change avoids the construction of one of the two temporary lists in your code, and requires no effort on your part.
A completely different approach that avoids th... |
I have a model (/core/models/milestone.py) that uses a custom class as an attribute:
from core.models.IntegerRangeField import IntegerRangeField
class milestone(models.Model):
name = models.CharField(max_length=128, null=False, blank=False)
completion = IntegerRangeField(min_value=0,max_value=100, n... |
I am trying to understand python hash function under the hood. I created a custom class where all instances return the same hash value.
class C(object):
def __hash__(self):
return 42
I just assumed that only one instance of the above class can be in a set at any time, but in fact a set can have multiple el... |
I'm trying to use "mixin" to add "delete-undelete" functionality to my models.
Now, the model overrides the "objects" to something specific.
My concern is that what if I want another mixin with another custom manager object?
ie, I have 'delete-undelete' mixin with custom manager to filter on deleted field.
and suppose ... |
on Android 4.2.2, seems still having the same problem. Is it the correct behavior, or some thing missing here?
got the event id through Instances.query(Globals.sContext.getContentResolver(), proj, begin, end); proj= String[]{Instances.EVENT_ID, Instances.BEGIN, Instances.END...};
use the even id to view the event in ca... |
So I'm missing something here. When a user has spent all of the points they have and are prompted on whether or not they would like to add more points to the pool, and the user selects 'n' they are continuously prompted to add more points to the pool. Which should not happen. I've tried fiddling around with the placeme... |
Hi,
From 3 days, I am continuously making my efforts to get this thing to do in Python, which I can easily do in PHP.
I just want following lines from PHP file (abc.php) to Python (abc.py).
<?php
$mind = explode(',', $_GET['mind']);
$data = '';
if(in_array('good', $mind))
{
$data .= file_get_contents('good.txt');
}
if... |
Phoenamandre
Re : Suivi des bogues d'Ubuntu 12.10
j'ai le même problème que toi avec mon dell xps !
autre bogue, si vous êtes touchés par un problème de maya qui ne veut pas démarrer
https://bugs.launchpad.net/maya/+bug/1047599
Hors ligne
vlotho
Re : Suivi des bogues d'Ubuntu 12.10
Salut j'ai une ribembelle de warning ... |
Apart from asking Guido directly, I don't think your going to find any explanation of this.
The syntax has been around from the very beginning. The earliest version of python sources I could find was python 1.0.1. Looking at the changelog in the Grammar file we find references to even earlier versions. In version 2 of ... |
I have created a django app where users can be looged in with both django app username or facebook username. Now i want to implement a logout functionality while logging in through facebook . Can somebody help me to do this.Please help me to find any tutorials which explains these. I will paste my code here.
html faceb... |
I am looking for the best way to refactor the Python code below. I think there is a Pythonic way to do this in 2 or 3 lines of code, but couldn't figure it out. I have searched Stackoverflow but couldn't find similar problems and solutions. Many thanks!
list1 = [(Python, 5), (Ruby, 10), (Java, 15), (C++, 20)]
list2 = [... |
If you're trying to use HTML data from a database or a variable, you'll need to use the XML() function.
There is an explanation from Massimo:
Let's assume you have the html data in a variable called x. When you print it in a view with
{{=a}} or {{=DIV(a)}} or {{=DIV(P(a))}} etc.
the content of a is automatically escap... |
This is my python file:-
TestCases-2
Input-5
Output-1,1,2,3,5
Input-7
Ouput-1,1,2,3,5,8,13
What I want is this:-
A variable test_no = 2(No. of testcases)
A list testCaseInput = [5,7]
A list testCaseOutput = [[1,1,2,3,5],[1,1,2,3,5,8,13]]
I've tried doing it in this way:
testInput = testCase.readline(-10)
for i... |
I have a datastore storing images as a blob property. I want to use get_serving_url to serve images on the fly.
def urlserve(self):
return images.get_serving_url(str(self.key.urlsafe()),350)
It gives me a URL like
http://localhost:8097/_ah/img/ahBkZXZ-cmFqaW5pbmF0aW9uciYLEglpbWFnZWxpc3QiDWRlZmF1bHRfaW1hZ2UMCx... |
I have the following code:
#!/usr/bin/python
# -*- coding: iso-8859-15 -*-
import pygame, random
from pygame.locals import *
pygame.init()
clock = pygame.time.Clock()
and so on
The app all appears OK, but when I compile the code I get the following error:
Traceback (most recent call last):
File "fish.py", line ... |
The following sections describe how to configure security for your Web Service:
Access control security refers to configuring the Web Service to control the users who are allowed to access it, and then coding your client application to authenticate itself, using HTTP/S or username tokens, to the Web Service when the cl... |
Vicks
openoffice et accents circonflexes...
Bonjour à tous,
J'ai un gros problème avec les acents circonflexes que je ne peux pas utiliser lorsque je suis sous openoffice. Cependant, sur le reste de ma config il n'y a aucun problème...
Merci beaucoup de votre aide...
@+
Vicks
Hors ligne
Vicks
Re : openoffice et accents... |
I have made a numpy array out of data from an image. I want to convert the numpy array into a one-dimensional one.
import numpy as np
import matplotlib.image as img
if __name__ == '__main__':
my_image = img.imread("zebra.jpg")[:,:,0]
width, height = my_image.shape
my_image = np.array(my_image)
img_buffer = my_i... |
I'm having a weird problem where, when doing a lot of playing in the Powershell commandline, at some point it will stop executing any commandline application like cmd.exe or more.com, but will continue to execute Powershell functions and such. I can open up a new Powershell window
The situation
I'm using Powershell Com... |
I'm wondering if there exists a python module that would allow me to do something like this:
x = MagicNumber()
x.value = 3
y = 2 * (x + 2) ** 2 - 8
print y # 42
x.value = 2
print y # 24
So MagicNumber would implement all the special operator methods, and they would all return instances of MagicNumber, while keepin... |
I am trying to build a static library with Scons. All I want to do is to build the object files and the library file in a build directory called "build-release".
Using VariantDir I can make scons build the object files in the build-release directory, but the libStringUtilities.a is still being wrote in the current dire... |
I would like to put the 2 functions (color and check) into the most general formEq a => ....But I don't know how to do that.
This is a very simple graph: each node has 2 neighbours, and any adjacent nodes must have different colors
color :: [(Int, Int)] -> [(Int, Int)] -> Bool
color x [] = True
color a ((x,y):rest) =
... |
Add Field (Data Management)
Summary
Adds a new field to a table or the table of a feature class, feature layer, raster catalog, and/or rasters with attribute tables.
Usage
Coverages, stand-alone tables, feature classes from ArcSDE and personal or file geodatabases, layer files, raster catalogs, and shapefiles will work... |
I have multiple Network Interface Cards on my computer, each with its own IP address.
When I use gethostbyname(gethostname()) from Python's (built-in) socket module, it will only return one of them. How do I get the others?
Use the
>>> import netifaces
>>> netifaces.interfaces()
['lo', 'eth0']
>>> netifaces.ifaddresses... |
RPi.GPIO
Let's now talk about RPi.GPIO, another popular library (there is a third one that is popular which I'll cover soon) for interfacing with hardware on the Pi. We will start by installing it. One tool I always install on a machine that will be used for python, is easy_install. It is part of python-setuptools. Aft... |
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... |
This is a sort of follow-up post to ZeroMQ, iOS and Python from a year ago. I again wrote a test app and server. Of the earlier components, iOS stayed, but ZeroMQ I replaced with WebSockets and the server is this time written in Clojure.
Idea of the exercise is the same as last time: two-way communication between an iO... |
Currently I am using an apps built in python. When I run it in personal computer, it was fine.
However, when I move it into a production server. It is keeping to show me the error attached as below:.
As what I researched, I got the reason the end user browser stop the connection while server is still busy of sending da... |
I have two table posts & categories
post_id | post_title | post_content | post_cat--------------------------------------------------1 Hello World welcome to my.. 1. .. .. ..
categories table
cat_id | cat_name | cat_parent-----------------------------1 News NULL2 Sports 1. ... ..
Let's say current category link for news... |
in Perl:
if ($test =~ /^id\:(.*)$/ ) {
print $1;
}
In Python:
import re
test = 'id:foo'
match = re.search(r'^id:(.*)$', test)
if match:
print match.group(1)
In Python, regular expressions are available through the
The
I have used
Also note that there is no need to escape the
match = re.match("^id:(.*)$", test)
... |
I am able to print mtime attribute of files. I am only concerned with files modified in say the last xxxx amount of minutes. I touched files in the directory so i know there are new files there.
file_list_attr = sftp.listdir_attr('/path')
fdir = sftp.listdir(path=source)
for f in file_list_attr:
print "name=%s, mod... |
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'm trying to get state of a VPN connection via DBus in Python.
Here is my code:
name="testVPN"
proxy = dbus.SystemBus().get_object('org.freedesktop.NetworkManagerUserSettings', '/org/freedesktop/NetworkManagerSettings')
iface = dbus.Interface(proxy, 'org.freedesktop.NetworkManagerSettings')
connections = iface.ListCon... |
I've written a python script that does some work with numpy and scikit's audiolab. I want to create a standalone app using py2app but I keep getting the same error no matter which OS X computer I test it on.
ImportError: dlopen(/Users/transfer15/Desktop/app/dist/PCMAlign/app/Contents/Resources/lib/python2.7/numpy/linal... |
Am doing a project with Flask, Gevent and web socket using flask development server environment. I used flask_login. Here
how can get i get the Unique Session ID for each connection?
I want to store the SessionIDin the Database and delete it once client disconnects.
How to get total active connections
from flask_login ... |
I have a simple python (2.7) script that should execute few svn commands:
def getStatusOutput(cmd):
print cmd
p = subprocess.Popen([cmd],stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
output, status = p.communicate()
return status, output
svn_cmd = [
["svn co " + FIRMWARE_URL + "/br... |
siscard
Re : Open Office, Reconnaissance de caractères, Xsane, Kooka et Cie...
L'erreur de segmentation est revenue comme elle avait disparue.
Si quelqu'un a une idée, je suis preneur.
Tout ce que j'ai trouvé, c'est que le logiciel essaie d'utiliser un espace de mémoire qui ne lui est pas attribué; alors cela provient ... |
How can I output colored text to the terminal, in Python? What is the best Unicode symbol to represent a solid block?
This somewhat depends on what platform you are on. The most common way to do this is by printing ANSI escape sequences. For a simple example, here's some python code from the blender build scripts:
clas... |
I can't seem to get the nose testing framework to recognize modules beneath my test script in the file structure. I've set up the simplest example that demonstrates the problem. I'll explain it below.
Here's the the package file structure:
./__init__.py./foo.py./tests ./__init__.py ./test_foo.py
foo.py contains:
def du... |
Single-threaded use appears to work:
$ echo 'int main(void) { int *a; a[10]=0; return a[5]; }' | ↩
gcc -o a -fmudflap -x c - -lmudflap
$ ./a
*******
mudflap violation 1 (check/write): time=1227208721.922064 ptr=0x1023de0 size=4
pc=0x1037a33 location=`<stdin>:1:26 (main)'
/usr/lib/libmudflap.so.0(__mf_check+0x33... |
« La Programmation Orientée Objet, c'est bien joli, mais ça me fait passer deux fois plus de temps à réfléchir qu'à coder ! »
C'est fou le nombre de gens qui pensent cela… Et pourtant, s'ils savaient comme ils ont tort ! En effet, pour faire de la « belle » POO, il ne faut pas réfléchir deux fois plus que ce que l'on c... |
The following browser view should return the content of the front page of the first Plone Site in it's context. However, I can not seem to obtain an object which is able to render html content.
from Products.Five import BrowserView
from zope.component import getMultiAdapter
class RenderFirst (BrowserView):
def __ca... |
Here are my models:
class User(db.Model):
id = db.StringProperty(required=True)
created = db.DateTimeProperty(auto_now_add=True)
updated = db.DateTimeProperty(auto_now=True)
name = db.StringProperty(required=True)
email = db.StringProperty()
class Page(db.Model):
id = db.StringProperty(required=... |
I would like to explain a simple code on how to use watershed here. I am using OpenCV-Python, but i hope you won't have any difficulty to understand.
In this code, I will be using watershed as a tool for foreground-background extraction. (This example is the python counterpart of the C++ code in OpenCV cookbook). This ... |
I have a UITextView added on my UIView programmatically. The textview added is not editable, it is just to display some data. The data displayed in the textview is getting from array.The no of the textviews are same as texts which I Stored in Array.Textview is displaying from start to end one by one.I need to set the p... |
sali10
ecrire un script
bonjour tout le monde
je voulais ecrire un script en C , qui manipule un fichier texte, il doit lire le fichier et faire des modification par exemple a chaque fois qu'il rencotre le mot 'a5b6 il le remplace par ahbv....comment proceder?
Hors ligne
Jean-Julien
Re : ecrire un script
J'ai l'impress... |
I'm looking for a way to include/exclude files patterns and exclude directories from a os.walk() call.
Here's what I'm doing by now:
import fnmatch
import os
includes = ['*.doc', '*.odt']
excludes = ['/home/paulo-freitas/Documents']
def _filter(paths):
matches = []
for path in paths:
append = None
... |
Hi,
I'm having a problem with the Synaptic package manager on my Xubuntu Dapper subnotebook: When I click the "Reload" button, I get an error message saying a couple of sources - which are listed in the message - could not be loaded, might not be available anymore or whatever. When I search for a specific package, the ... |
Jan 21, '04 10:19:00AM • Contributed by: jemandel
I periodically need to use PPTP to access my systems inside a firwall, but want the rest of my traffic to go through my normal default route. To do this, i need to invoke pppd with the "nodefaultroute" option and have an ip-up script add a route to the private network... |
Given the following two csv files that contain strings only, how can I load them into an (numpy) array?
**1.txt**A,B,DE,G,A**2.txt**A,B,DE,G,A**data**1,A,B,D1,E,G,A2,A,B,D2,E,G,A
You can load them using
>>> import numpy as np
>>> data1 = np.loadtxt("1.txt", dtype=np.object, delimiter=",")
>>> data2 = np.loadtxt("2.txt"... |
The default for Apache/mod_wsgi is to only load application code on first request to a process which requires that applications. So, first step is to configure mod_wsgi to preload your code when the process starts and not only the first request. This can be done in mod_wsgi 2.X using the WSGIImportScript directive.
Pre... |
Editor's note: Meerkat predated the popularity of syndication, feed services, and feed readers. Now that other groups are providing this service, we have removed Meerkat in favor of their better solutions. We maintain these articles for the sense of historical interest.
Meerkat, O'Reilly Network's Open Wire Service, ex... |
Earlier today I asked this question about the __del__() method of an object which uses an imported module. The problem was that __del__() wants to make use of the module os, but sometimes (not always) the module has already been deleted. I was told that when a Python program terminates, the order in which objects and m... |
brital
[Résolu]Problème Python3, Tkinter et les canvas.
Bonjour,
J'ai recopié l'exemple du livre de G. Swinnen "Apprendre à programmer avec Python3"(chapitre 9 page 85): tracé de lignes dans un canevas.
Le problème, c'est quand j'appuie sur le bouton "changer la couleur", la couleur de la future ligne ne change pas. Et... |
xxkirastarothxx
MegaUpload : BotMU v1.0.1
Bonjour à tous
Et bien voila, depuis quelques temps j'ai remarqué que le capcha de Megaupload a disparu.
Comme il s’agissait du point le plus bancale du développement d'une automatisation de téléchargement sur Megaupload, le projet était en attente.
Maintenant que ce point n'ex... |
#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... |
NodeVisitor traverses the AST depth-first and visits each node only once, on enter. Therefore it's problematic to do something serious with it. Is it possible to change its default behavior?
Nope. You should write your own visitor. Recursively visiting all nodes is fairly simple, so if the ast module stuff doesn't do i... |
I can't figure out why lsof on my Mac (10.8.2, MacBook Pro) is so slow.
On my Mac, lsof takes more than a minute:
$ touch /tmp/testfile
$ time lsof /tmp/testfile
real 1m16.483s
user 0m0.029s
sys 1m15.969s
On a typical Linux box, running Ubuntu 12.04, lsof takes 20 ms:
$ touch /tmp/testfile
$ time lsof /tmp/test... |
Don't use index to loop over a sequence
Don't :
for i in range(len(tab)) :
print tab[i]
Do :
for elem in tab :
print elem
For will automate most iteration operations for you.
Use enumerate if you really need both the index and the element.
for i, elem in enumerate(tab):
print i, elem
Be careful when usi... |
I have these two lists:
boys = [1,2,3]girls = [1,2,3]
How would you build all possible (monogamous) pairings [boy, girl]? With only 3 of both boys and girls, I think this is the list of all the possible pairings:
[ [[1,1], [2,2], [3,3]], [[1,1], [2,3], [3,2]], [[1,2], [2,1], [3,3]], [[1,2], [2,3], [3,2]], [[1,3], [2,1]... |
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... |
Multiple statements found
08 Sep, 2014
Arijjan V writes (excerpted):
When I enter code into the compiler I continue to get multiple statement error messages.Even if I copy the code from the book.
I use Idle 34 on windows professional 7. This is what I typed into the Idle Shell.
found_coins = 20
magic_coins = 70
stolen_... |
O'Reilly Book Excerpts: Python Cookbook, Second Edition
Cooking with Python, Part 1
Editor's note: The second edition to Python Cookbook has been updated for Python 2.4 to include more than 200 recipes with solutions to problems that Python programmers face every day. We've selected two new recipes from the book to sho... |
sali10
ecrire un script
bonjour tout le monde
je voulais ecrire un script en C , qui manipule un fichier texte, il doit lire le fichier et faire des modification par exemple a chaque fois qu'il rencotre le mot 'a5b6 il le remplace par ahbv....comment proceder?
Hors ligne
Jean-Julien
Re : ecrire un script
J'ai l'impress... |
Basically I have setup local site, and pointed a TLD to that location for development purposes. But now I have a problem, because I can only load the website exactly once, subsequent attempts to access the site gets a no data received page in Chrome. And the following error gets logged:
[Fri Nov 01 11:23:33 2013] [noti... |
Dernière news : Fedora-Fr aux 15èmes Rencontres Mondiales du Logiciel Libre
Bonjour,
J'ai un problème avec le son sur fedora 15.
Ma config possède un micro externe brancher sur l'entrée et un micro stéréo interne mais aucun de ne fonctionne.
J'ai essayer de mettre tout les volumes alsamixer a fond mais ça ne résout pas... |
What is the best way (or even the various ways) to pretty print xml in python?
import xml.dom.minidom
xml = xml.dom.minidom.parse(xml_fname) # or xml.dom.minidom.parseString(xml_string)
pretty_xml_as_string = xml.toprettyxml()
Here's my (hacky?) solution to get around the ugly text node problem.
uglyXml = doc.topretty... |
Not a homework question, but a possible interview question...
Given an array of integers, write an algorithm that will check if the sum of any two is zero.
What is the Big O of this solution?
Looking for non brute force methods
Not a homework question, but a possible interview question...
Looking for non brute force me... |
If I have class as following:
class theater:
def __init__(self):
self.__seatMatrix=[10]*5
self.__seats=seating[0]
self.__rows=len(seating)
How can I implement a get/setter to update the values for seats? The idea is that seating=[10]*5, 5 rows with 10 seats. I've been turning my head around... |
You're on the right track.
Let's take a look at your example:
for(int i = 0; i < data.Length; i++)
data[i] = (byte)(256 * Math.Sin(i));
OK, you've got 11025 samples per second. You've got 60 seconds worth of samples. Each sample is a number between 0 and 255 which represents a small change in air pressure at a point... |
Is it possible to get the results of a test (i.e. whether all assertions have passed) in a tearDown() method? I'm running Selenium scripts, and I'd like to do some reporting from inside tearDown(), however I don't know if this is possible.
CAVEAT: I have no way of double checking the following theory at the moment, bei... |
Today, we're happy to announce RethinkDB 1.14(Brazil). Download it now!
The 1.14 release includes over50 enhancementsincluding:
Seamless migration (read more below)
Simple binary data support
Python 3 support
Support for returning changes from multiple writes
Betterdocumentation
New options for handling conflicts on in... |
Need to take the values from one array, put them through a function and put them in another array. It is meant to be done using a pair of nested for loops. Please help. Complete beginner here.
EDIT: Ok to clarify, I have a 2-d array with various values in it. I want to apply a function to all of these values and have a... |
Can I add a member variable / method to a Python generator?
I want something along the following lines, so that I can "peek" at member variable j:
def foo():
for i in range(10):
self.j = 10 - i
yield i
gen = foo()
for k in gen:
print gen.j
print k
Yes, I know that I can return i AND j every... |
lynn
Re : [g2s] GUI d'extraction de fichiers mkv
Le résultat que je t'ai envoyé, c'était avec le logiciel présent mais planté. Celle ci, c'est avec le logiciel fraîchement lancé
lynn@raring-64:~/downloads$ ps ax | grep -v grep | grep mkv-extractor-gui
5715 ? S 0:00 bash /usr/share/mkv-extractor-gui/mkv-ext... |
What are some common, real world examples of using the Builder Pattern? What does it buy you? Why not just use a Factory Pattern?
The key difference between a builder and factory IMHO, is that a builder is useful when you need to do lots of things to build an object. For example imagine a DOM. You have to create plenty... |
git_fast_filter
Yet faster than git-filter-branch (i.e., minutes instead of hours), but similar in spirit, is to use git_fast_filter. However, this requires a bit more coding, and no neat ready-packed solution exists. In contrast to git-filter-branch, this will create a new repo from an old one. It is assumed that mast... |
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... |
Vikin712
[Résolu] Nom des paquets sur Precise
Bonsoir.
Comme je suis encore sur Lucid et que je vais devoir migrer, après test je me pose la question sur certains paquets présents dans les dépôts de Precise.
J'ai fait deux installations par défaut; Live-CD et alternate sur un PC et je me retrouve avec des paquets marqu... |
There are posts in the returned json with media=null so post['data']['media'] will not have oembed field (and hence, url field):
{
"kind" : "t3",
"data" : {
"downs" : 24050,
"link_flair_text" : null,
"media" : null,
"url" : "http://youtu.be/aNJgX3qH148?t=4m20s... |
There was a duplicate to this question that had a better answer. See http://stackoverflow.com/a/10382359/1623645, which suggests ijson.
Update:
I tried it out, and ijson is to JSON what SAX is to XML. For instance, you can do this:
import ijson
for prefix, theType, value in ijson.parse(open(jsonFileName)):
print pr... |
If you want to trigger an action when a regex matches an text pattern, you probably need some mapping of regex to the action (let's assume it is a reference to a function defined in the same file as the mappings). Say we define the rules in a python file rules.py like this:
mappings = [
# (regex, action_name)
(... |
Note: This question has been re-asked with a summary of all debugging attempts here.
ps = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE).communicate()[0]
After running for a few days, the call is erroring with:
File "/home/admin/sd-agent/checks.py", line 436, in getProcesses File "/usr/lib/python2.4/subproces... |
in Python, I have created a text generator that acts on certain parameters but my code is -at most of the time- slow and performs below my expectations. I expect one sentence per every 3-4 minutes but it fails to comply if the database it works on is large -I use the project Gutenberg's 18-book corpus and I will create... |
I have following python project file structure:
/main.py
/functions/func1.py
/functions/func2.py
/functions/serv_func.py
Main.py works with pkgutil. It uses function load_module(name), where name can be func1, func2 or serv_func. Func1.py doesn't have any import statements in it and load_module(func1) works fine for i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.