text
stringlengths
256
65.5k
I need to create instances of a custom object (Bar in the example below) based on a given string. If I do not change the type to Bar and run the below code: import argparse VALID_BAR_NAMES = ['alfa', 'beta', 'gamma', 'delta'] class Bar: def __init__(self, name): if not name in VALID_BAR_NAMES: r...
I recently wrote a rather ugly looking one-liner, and was wondering if it is better python style to break it up into multiple lines, or leave it as a commented one-liner. I looked in PEP 8, but it did not mention anything about this This is the code I wrote: def getlink(url): return(urllib.urlopen(url).readlines()[...
Please walk through the Getting Started guide from the appengine documentation. It will help you get through the initial setup problems like this. http://code.google.com/appengine/docs/python/gettingstarted/helloworld.html Here is the sample Handler from that documentation. from google.appengine.ext import webapp from ...
About twise faster than all theese variants (at least at python 2.7.2) seq_2 = set() # Here I use generator. So I escape .append lookup and list resizing def F(f): # local memory local_seq_2 = set() # lookup escaping local_seq_2_add = local_seq_2.add # static variables linker ='CTGTAGGCACCATCAAT...
SVG paths can be parsed and turned into a seqence of cairo commands that re-draw them. This took a while, the pyparsing had me in knots, but now it's short and sweet. A fuller implementation of what can be done in SVG would be really nice. (Hint...) Make sure you pass it a very simple SVG file (from Inkscape is best) -...
I am new to linear cryptanalysis, so I decided to try to break a toy cipher that was designed to be vulnerable to linear cryptanalysis. Unfortunately, I can't get it to work no matter how hard I try. I've read the Wikipedia article and several papers, but they always seem vague on how to turn equations that hold over t...
The difference between having _init_.py and not having one in your module directory is: When you have __init__.py (blank one), you can import the module using from dirname import MyModule But when you dont have _init_.py at all, you cannot import the module without adding the path till that module to PYTHONPATH. In th...
Ian Ward's email: first name at this domain wardi on OFTC, freenode andgithub This is the text from the Nontrivial Django Forms talk I gave last Tuesday at the April meeting of the Ottawa Python Authors Group. This talk starts where the Django forms documentation leaves off. class ToDoForm(forms.Form): task = forms...
You can use a Queue to feed back failures into the Pool through a loop in the initiating Process: import multiprocessing as mp import random def f(x): if random.getrandbits(1): # on failure / exception catch f.q.put(x) return None return x*x def f_init(q): f.q = q def main(pending): ...
Automatic Event Binding Another area of GUI development that is often tedious and error-prone is associating user actions or events, such as clicking on a mouse button, with the action to be performed, such as incrementing a counter. This is known as binding an event to a handler. Because this is such a common operatio...
Thanks for everyone's replies. Here is another attempt at summarizing them. Pardon if I say too many "obvious" things: I knew nothing about least squares before, so everything was new to me. NOT polynomial interpolation Polynomial interpolation is fitting a polynomial of degree n given n+1 data points, e.g. finding a c...
I'm trying to fetch some data from http://m.finnkino.fi/events/now_showing, but at the moment I'm failing badly because I'm not even able to load the page source with python. At the moment I'm using following code: req = urllib2.urlopen(URL,None,2.5) page = req.read() print page Here is the traceback for timeout error...
Is there a way to whiten out the background of the axis label so that when it crosses the axis line itself, the latter does not run through it? For example, this script (the best I managed so far) #!/usr/bin/python import matplotlib.pyplot as plt xx=[1,2,3] yy=[2,3,4] dy=[0.1,0.2,0.05] fig=plt.figure() ax=fig.add_subp...
I first came across Grinder a year or so ago but never got beyond installing it on my machine. The latest version, which is still in beta, has a lot of new features, including support for the Jython scripting engine. The latest version also has a console, which collects and displays timing information generated by the ...
You are here: Home ‣ Dive Into Python 3 ‣ Difficulty level: ♦♦♢♢♢ ❝ Certitude is not the test of certainty. We have been cocksure of many things that were not so. ❞ — Oliver Wendell Holmes, Jr. Kids today. So spoiled by these fast computers and fancy “dynamic” languages. Write first, ship second, debug third (if ever)....
I know I posted before but this time I'm hoping to really mesh out all the basics of my code and hopefully get a better understanding of classes. Know that I'm very inexperienced with classes, so a lot of this will be really silly stuff. Here's my code class Player(pygame.sprite.Sprite): def __init__(self): ...
I'm trying to create a Django app on Heroku, as detailed by the Heroku/Django Cedar stack tutorial. I've gotten to the point where I deploy my code on Heroku, but when I run heroku run python appname/manage.py syncdb, I get the following trace: Traceback (most recent call last): File "planamo/manage.py", line 10, in <m...
Here's how to alias cp65001 to UTF-8 without changing encodings\aliases.py: import codecs codecs.register(lambda name: codecs.lookup('utf-8') if name == 'cp65001' else None) (IMHO, don't pay any attention to the silliness about cp65001 not being identical to UTF-8 at http://bugs.python.org/issue6058#msg97731 . It's in...
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...
I have just installed OpenCV on my Windows 7 machine. As a result I get a new directory: C:\OpenCV2.2\Python2.7\Lib\site-packages In this directory I have two files: cv.lib and cv.pyd. Then I try to use the opencv from Python. I do the following: import sys sys.path.append('C:\OpenCV2.2\Python2.7\Lib\site-packages') im...
I'm trying to follow the below piece of code from a book, but I am having trouble understanding it. I was hoping someone could help clarify the following issues: When I don't anything in the textctrl, the has_sel is set to false but how does the IF stmt gets executed? What is event_id? Is it the event_id for the whole ...
Pylades /* Topic des codeurs couche-tard [1] */ Bienvenue dans le TdCCT 0x1. Ceci est la suite de ce fil. Voici le rappel des règles du jeu, formulées par le message initial de samuncle : Bienvenue dans ce nouveau topic psychédélique, ou le but est de coder le plus tard possible (oui, c’est bien connu, il est plus faci...
I have the following files: pack/__init__.py pack/subpack/__init.__py pack/subpack/mod2.py And the following code fails on the last line: from pack import * #should import everything print subpack #NameError: name 'subpack' is not defined I would expect the subpackage to be imported - why is there a difference, ...
Topic: [FAQ] How to dump disclaimer text from LDAP/MySQL automaticly. Note Signing disclaimer on outgoing mails is available in iRedMail/iRedOS-0.5.0 and later, users upgrade from 0.4.0 or even older versions can add this feature manually with steps explained in our Upgrade Tutorial (0.4.0 -> 0.5.0). ============ Note ...
Module: ActionView::Helpers::DateHelper Included in: Defined in: actionview/lib/action_view/helpers/date_helper.rb Overview Action View Date Helpers The Date Helper primarily creates select/option tags for different kinds of dates and times or date and time elements. All of the select-type methods share a number of com...
I have the following django URL: url(r'^companies/$', 'companies', name='companies'), If I go to http://localhost:8000/companies/ it works perfectly. However, if I try adding any GET variables to the URL django raises a 404. For example, if I go to http://localhost:8000/companies/?c=1 django raises a 404. What's stran...
Multiple Conditions with variable Statements Hi all, I’ve built a simple patch to consider multiple conditions with variable statements (">" and "<" must be set dynamically, so i cannot use the [if] object). Here is my patch below. Since it should be much, much easier to achieve that, I’m wondering how you would simpli...
I looked for a way without redefining the function and not using explicit knowledge about it (so it can be generalized) pl[f_, lims_] := Module[{eps = 0.05}, Off[InverseFunction::"ifun"]; Print@Plot[f[u], {u, lims[[1]], lims[[2]]}, Exclusions -> {{f[u] == f[InverseFunction[f][u]], Abs[(f[u] - f[u + e...
This is how I changed Django 1.0.2 to add 'view' permissions. Sorry there is no diff available. [X] 1. Added 'view' to default permission list #./contrib/auth/management/__init__.py def _get_all_permissions(opts): "Returns (codename, name) for all permissions in the given opts." perms = [] for action in ('a...
The Internet, with its simple protocol and ubiquity, has opened up huge opportunities for programs to communicate between computers, a task that always seemed complex and daunting in the past. Now there is a new dilemma. Which framework should you use for automating communication? The two most popular frameworks, Enter...
Basically I want to make the body of the Earth "transparent" so that an object (a point or a patch, etc) and its antipodal image can be displayed simultaneously on the same orthographic map. Is this possible to do with matplotlib and basemap? How about just plotting two projections? It's a bit of a cheat, but here you ...
Hey everyone Im very new to programming and python-opencv in general, ive already searched for an answer for this but I couldn't find it. Im trying to do motion tracking using my webcam by: taking absolute difference of the current frame and the previous frame This is converted to greyscale and run through a threshold ...
Journey into Haskell, part 4 I’ve been reading Read World Haskell now, after having finished the delightful Learn You a Haskell Tutorial. I’m up to chapter 6, about to dive into Typeclasses. In the meantime, I’ve picked a toy project that also has a taste of usefulness: a script to convert the Hackage database in...
simohamed5130 bureau 3d bonjour, j ai iinstallé ubuntu 12.04 et je veux personnliser mon bureau en 3d, puisque je suis debutant , j ai cru que j ai tout fais, j ai suivi les instructions au: http://doc.ubuntu-fr.org/bureaux_3d pour glxinfo | grep "direct rendering" , la reponse etait : direct rending : yes puis , j ai ...
Hagar de l'Est [How-To] Installer OpenOffice.org avec les RPMs officiels Si vous n'avez pas la patience d'attendre que les dépôts soient mis à jour pour installer la dernière version d'OOo, voici la méthode manuelle à partir des RPMs officiels. NB: avant d'installer, si vous avez modifié la configuration des dictionnai...
It sounds like you're new to Prolog. If so, welcome! Let's analyze this. This unfortunately-named function has two clauses. Prolog looks at the clauses in order to see which one applies. When it finds one that matches, it tries to perform it. If there's a failure somewhere in performing it, it will back up and try the ...
Environment: Python 2.6.5, Eclipse SDK 3.7.1, Pydev 2.3 I am trying to parse and change values in XML data in Python using xml.dom.minidom and I'm having an issue with blank text nodes. When I parse an XML file into a DOM object and then convert it back to a string using toxml(), the closing "Description" tags get mess...
GNU Awk 4.1: Teaching an Old Bird Some New Tricks, Part II In an earlier article ("GNU Awk 4.0: Teaching an Old Bird Some NewTricks",published in the September 2011 issue of Linux Journal), Igave a brief history of awk andgawk and provided a high-level overviewof the many new features in gawk 4.0. I recommend reading t...
I'm looking for method in python to sum a list of list that contain only integers.I saw that the method sum() works only for list but not for list of list.There is anything fit for me? thank you try something like this: In [18]: lis=[[1,2],[3,4],[5,6]] In [19]: sum(sum(x) for x in lis) Out[19]: 21 or: In [21]: sum(sum...
I'm crawling a search results page and scrape title and link information from the same page. As its a Search page, I have the links to the next pages as well, which I have specified in the SgmlLinkExtractor to allow. The description of the problem is, In 1st page, i have found the links of Page2 and Page3 to crawl and ...
I'm using the following code to serve uploaded files from a login secured view in a django app. Do you think that there is a security vulnerability in this code? I'm a bit concerned about that the user could place arbitrary strings in the url after the upload/ and this is directly mapped to the local filesystem. Actual...
I'm attempting to write a genetic algorithm framework in Python, and am running into issues with shallow/deep copying. My background is mainly C/C++, and I'm struggling to understand how these connections are persisting. What I am seeing is an explosion in the length of an attribute list within a subclass. My code is b...
I'm trying to solve following problem: I have IIS on my production server with valid wildcard ssl certificate. The site binded to both of somedomain.com:80 and somedomain.com:443. Also, I have Python (2.6.4) application which fetchs data from a site. I hadn't any problems until I checked the Require SSL IIS option. Aft...
Does python have any way to easily and quickly make CLI utilities without lots of argument parsing boilerplate? In Perl 6, the signature for the MAIN sub automagically parses command line arguments. Is there any way to do something similar in Python without lots of boilerplate? If there is not, what would be the best w...
I am using SWIG to generate a C extension Python library. I have a C datatype which is essentially a sequence type which maps (conceptually) to the list data type in Python. I have generated the extension using SWIG, but now, want to improve the SWIG interface so that code written using the library, is more Pythonic. I...
Lately I have been really interested in voice over IP, I think there is a lot of power in it. I was using Asterisk, but I’ve moved onto a much better and more powerful solution, FreeSWITCH. I was playing with it recently and decided a Caller ID spoofing interface would be fun. When the following script is ran, it will ...
kevin54 Re : [ VOS SCRIPTS UTILES ] (et eventuelles demandes de scripts...) @yvon22 Merci cela marche bien pour mes fichiers de + 2 jours. Mais pour garder les 3 derniers dimanches, cela est possible avec cette commande ? Hors ligne Fenouille84 Re : [ VOS SCRIPTS UTILES ] (et eventuelles demandes de scripts...) Voici u...
The following script will tell you that you could be reducing the size of your pages by 10-13% if you chose to get rid of superfluous white space and newlines. import urllib2 SITES = ["stackoverflow.com", # put all your sites domains here... ] stats = [] for site in SITES: stream = urllib2.urlopen("http://...
This PHP PayPal class provides a very simple interface for integrating Paypal payments into a website: The Minfraud bundle includes the Maxmind Minfraud API wrapper component that was built to support this component and detect fraud using the Maxmind Minfraud service. See the component page for more details. "I was rea...
Your proxy-server needs to store cookies, search stackoverflow for cookielib. Many web sites authenticate clients in different way, so your job is to fake client as much as possible with your proxy-server. Some web sites authenticate by browser type, some by creating cookies and storing sessionId in it, or other JavaSc...
Pierre Thibault Comment fonctionnent les pipes et les commandes shell avec Python Bonjour, J'ai de la difficulté à comprendre comment les redirections fonctionnent avec les commandes shell et Python. Par exemple, si dans un shell bash je tape: aa | bb Si je tape la commande précédente, cela veut dire que la sortie de l...
Audio Linkblogging by Jon Udell 07/18/2005 In my first column on this topic, I showed how little-known features of the HTTP protocol, the MP3 file format, and certain media players conspire to enable random access to MP3 files hosted on standard web servers. And I described a rudimentary service that combines these fea...
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...
In the GCC testsuite, at this point: Running /home/tschwinge/tmp/gcc/hurd/gcc/testsuite/gcc.c-torture/unsorted/unsorted.exp ... ... expect had gone bonkers: $ ps --all --format=hurd-long -w PID UID PPID PGrp Sess TH Vmem RSS %CPU User System Args [...] 3567 1000 10295 3567 3567 2 137M 856K 98.2 ...
Working with Forms In addition to screen-based components, you also have the ability to use forms to combine multiple components into one screen. This section discusses the Form class as well as the components that can be placed on a form. Form A Form object is a screen that contains an arbitrary mixture of items, incl...
Recently I wrote a function to generate certain sequences with nontrivial constraints. The problem came with a natural recursive solution. Now it happens that, even for relatively small input, the sequences are several thousands, thus I would prefer to use my algorithm as a generator instead of using it to fill a list ...
How to send a "multipart/form-data" with requests in python? How to send a file, I understand, but how to send the form data by this method can not understand. Basically, if you specify a >>> import requests >>> response = requests.post('http://httpbin.org/post', files=dict(foo='bar')) >>> response.status_code 200 and...
While integrating a Django app I have not used before, I found two different ways used to define functions in classes. The author seems to use them both very intentionally. The first one is one I myself use a lot: class Dummy(object): def some_function(self,*args,**kwargs): do something here self is...
I would like to scale an ImageField before the model gets saved to the disk, but somehow get an unreadable image out. The goal is to scale it without ever saving it to the disk. This is my attempt so far: IMAGE_MAX_SIZE = 800, 800 class Picture(models.Model): ... image = models.ImageField(upload_to='images/%Y/%...
I have been trying to make a block of code that finds the index of the largest bid for each item. Then I was going to use the index as a way to identify the person who paid that much moneys name. However no matter what i try I can't link the person and what they have gained from the auction together. Here is the code I...
I have a piece of assessment that requires me to swap words within a list. I have given a txt file that contains a column of words that are the 'old words' and a column of word that are the 'new words'. I am required to define a function that check the string to see if a word from the 'old words' list/column is in the ...
FelixP [Résolu] Sources de Logiciels ne veut plus démarrer… Salut ! Je reposte mon problème car il semblerait que mon ancien post soit tombé dans les abîsses… Lorsque je veux ouvrir la liste des sources de logiciels, j'obtiens une erreur… Ce problème est apparu, je crois, après ajout du dépot permettant d'installer cam...
Singleton pattern should be the most known design pattern out there(maybe the most overused design pattern as well). The idea is to restrict the object creation to only one instance. The typical way of achieving this is to declare the Singleton class’s constructor as private and then provide a static method to do the o...
sheep Xubuntu moitié en français moitié en anglais Bien le bonjour à tous J'ai remonté un vieux pc pour que mes gosses puissent jouer à leurs jeux sans me piquer le mien Comme il est vieux j'ai donc installé une xubuntu 12.04, elle fonctionne bien, cependant certains menus ne sont pas traduits en français. Au début tou...
I have googled for the answer, but the ".stop()" so frequently mentioned doesn't work for me. The Chrome window the test was running in remains open. def test_getResults(self): sel = selenium('localhost', 4444, "*chrome", 'http://blackpearl/') sel.start() # do stuff def tearDown(self): sel = selenium('l...
In TextMate, open the Bundle Editor and select the language you'd like to do this in. (If you'd like to have this functionality in all languages, use the Source bundle) Click the plus symbol at the bottom left, and choose "New Command." Chose "Nothing" for the Save field and "Selected Text or Line" for the two input fi...
Rik Poggi is right, string 'Июнь' cannot be a month for python-dateutil. Digging a little into dateutil/parser.py, the basic problem is that this module is only internationalised enough for handling Western European Latin-script languages. It is not designed up to be able to handle languages, such as Russian, using...
Using the program 'screen' works fine; I can see data being transmitted to the XRF module. How do I get the data from the serial port, so I can do some processing on it? I tried perl but it didn't read anything. I haven't tried this on a Pi, but I use python to access a serial port on a Beagle Bone.Python serial can be...
The following works locally but not when deployed: import urllib import urllib2 import simplejson as json url = 'https://www.googleapis.com/rpc' requests = [{ 'method': 'freebase.text.get', 'apiVersion': 'v1', 'params': { 'id': ['en','bob_dylan'] } },{ 'method': 'freebase.text.get', 'apiVersion': 'v1'...
def test(request): u="username" p= 'password' url='url' req = urllib2.Request(url) base64string = base64.encodestring('%s:%s' % (u , p )).replace('\n', '') d = {} req.add_data(d) //while authentication i dont send any data, but it is treated as POST request only if data is sent, so sending ...
I have a function that updates a MySQL table from a CSV file. The MySQL table contains the client account number -- this is what I use to compare with the CSV file. At some point, some of the queries will fail because the account number being compared from the CSV file has not been added yet. How do I get the records f...
I'm trying to split an inputted document at specific characters. I need to split them at [ and ] but I'm having a difficult time figuring this out. def main(): for x in docread: words = x.split('[]') for word in words: doclist.append(word) this is the part of the code that splits them into my list. How...
L4ur3nt Accéder au NAS DNS320 depuis toutes les applications sur Ubuntu 12.10 Bonjour, j'ai un soucis de connection à mon NAS DNS 320 sur Ubuntu 12.10. J'arrive à y avoir accès en recherchant dans le réseau local mais je parviens pas à "accéder au NAS depuis toutes les applications" J'ai déjà consulté plusieurs anciens...
I have been writing a program for a GUI based plotter using matplotlib and tkinter. I have added a toplevel window for some options. I want to execute a function and quit the toplevel window after clicking a button. Is that possible? The problem that I face is that I have used a toplevel window which has to be called f...
November 24th, 2012 at 3:58 pm by Dr. Drang I’ve known about John D. Cook’s blog, The Endeavor, for quite a while, but for some reason I didn’t subscribe to its RSS feed until recently. Now that I’ve corrected that omission, it takes every bit of strength I have to keep from responding to each of his posts. They’re all...
Author goska Submission date 2012-02-06 19:38:40.216248 Rating 3362 Matches played 455 Win rate 32.09 Use rpsrunner.py to play unranked matches on your computer. import random class RPS: def __init__(self): self.num = 0 self.statistika = [0 for x in range(3)] + [1 for x in range(5)] self.str...
FelixP [Résolu] ! Script pour noms de musique Salut à tous ! J'ai une petite question à vous poser… (Eh oui !) Je cherche un script pour me créer un fichier avec la liste des noms des musiques qui sont dans un dossier donné, avec la syntaxe de Wikipédia (histoire de remplir ses serveurs de données !) en sachant que les...
I'm trying to create a "cool" image uploading interface in django admin panel. The problem is that I'm using inline interface for uploading image instances, but I'm using jQuery Ajax form to upload images, so there were another form I need to create for uploading. And now django view function can't receive request.FILE...
Weighing in at less than 100 lines of code, nginxparser provides two features. loading: from nginxparser import load load(open("/etc/nginx/sites-enabled/foo.conf")) [['server'], [ ['listen', '80'], ['server_name', 'foo.com'], ['root', '/home/ubuntu/sites/foo/']]]] and dumping: from nginxpar...
Hi! I have a very big sdf file, and I need to extract from it only a group of selected molecules (that I have in a list, name sorted). Any ideas to solve this in python? bigfile’, ‘r’) Hi! I have a very big sdf file, and I need to extract from it only a group of selected molecules (that I have in a list, name sorted). ...
More Patterns Because it's so easy and fun, I want to add another pattern: class NthWeekdayPatternTests(unittest.TestCase): def setUp(self): self.pattern = NthWeekdayPattern(1, WEDNESDAY) def testMatches(self): firstWedOfSep2004 = datetime.date(2004, 9, 1) self.failUnless(self.pattern.ma...
How to get cyrillic string from document? I have fallowing code: import urllib from BeautifulSoup import BeautifulSoup page = urllib.urlopen("http://habrahabr.ru/") soup = BeautifulSoup(page.read()) for topic in soup.findAll(True, 'topic'): print topic print raw_input() There is cyrillic words on the site but ...
Shortest program that draws the Mandelbrot set Last post 04-13-2007 1:35 PM by mbessey . 22 replies. Page 1 of 1 (23 items) Sort Posts: Previous Next 04-08-2007 4:50 AM The Real WTF Joined on 08-23-2006 Posts 22 Shortest program that draws the Mandelbrot set The challenge is simple: create the smallest program you can ...
The pseudo-polytime algorithm for a knapsack can be used for k=2. The best we can do is sum(S)/2. Run the knapsack algorithm for s in S: for i in 0 to sum(S): if arr[i] then arr[i+s] = true; then look at sum(S)/2, followed by sum(S)/2 +/- 1, etc. For 'k>=3' I believe this is NP-complete, like the 3-partiti...
I'm having some trouble sorting data from a text file by a certain field. Possibly by multiple fields later. The .txt is several thousands of lines of code. I'm brand new to python so my code is probably a bit messy. For example, this is the textfile i would read from: stuff 123 1200 id-aaaa stuart@test.com 322 1812 id...
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... ~25 users here now News and links for Django developers. Anyone have experience with Finite State Machines? (self.dj...
Pylades Re : /* Topic des codeurs couche-tard [1] */ It works! \o/ Bon, alors, vous en pensez quoi ? On met le planeur ? Avant le titre ? Après ? “Any if-statement is a goto. As are all structured loops. “And sometimes structure is good. When it’s good, you should use it. “And sometimes structure is _bad_, and gets int...
The apps api provides applications a method to interface with the BitTorrent client that an application has been installed within. The API allows sandboxed access to the client for tasks such as adding a torrent or an rss feed. This document outlines the raw interface presented by the client. If you’d like a somewhat m...
November 3rd, 2011 | Published in Google Android [This post is by Elliott Hughes, a Software Engineer on the Dalvik team. — Tim Bray] If you don’t write native code that uses JNI, you can stop reading now. If you do write native code that uses JNI, you really need to read this. What’s changing, and why? Every developer...
I'm writing a log collection / analysis application in Python and I need to write a "rules engine" to match and act on log messages. It needs to feature: Regular expression matching for the message itself Arithmetic comparisons for message severity/priority Boolean operators I envision An example rule would probably be...
loubrix [RESOLU] sources.list bizarre... Bonsoir, après une mise à jour normale, faite dans la journée, je me suis aperçu que j'avais un triangle jaune dans le systray, avec un message "les informations de mise à jour sont obsolètes. Ceci est peut-être du à un problème sur le réseau ou à un dépot qui n'est plus disponi...
I am trying to use a cgi script calling mapserver to display a raster layer that is stored in a PostGIS database. However, only a blank white image is returned and I don't know where the problem is. The request seems to go through, but here is an error in the postgres log that I don't understand and the result is a whi...
rmanf30 Re : Test de Qualité des Codecs Libre VS x264 - Septembre 2010 Ma surprise à propos des paramètres été justifiée, apparemment ils ne sont pas corrects. -sn -vcodec huffyuv -acodec flac %1.mkv J'ai le message d'erreur suivant : "Peut-être des paramètres incorrects tels que bit_rate , le taux , la largeur ou la h...
Le langage Python A propos de Python Python est un langage de programmation haut niveau. Sa philosophie de design met en avant la productivité du programmeur et la lisibilité du code. Il possède une syntaxe minimaliste avec très peu de commandes basiques et une sémantique simple, mais il a également une librairies stan...
This series of articles by David Mertz assumes readers have a familiarity with basic object-oriented programming concepts: inheritance, encapsulation, and polymorphism. We pick up where the basics leave off; how some "exotic" techniques can make applied programming tasks easier, more maintainable, and just plain more e...
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...
I have a string "42 0" (for example) and need to enter into an array the two integers. can i do a .split on a space? thanks in advance text = "42 0" nums = [int(n) for n in text.split()] 6 answers is not nearly enough for a question that OP could easily have answered himself by testing in the interpreter: >>> "42 0".s...
You could split the problem up into two pieces: Some kind of search algorithm that will enumerate possible strings in the grid. A way of testing whether a string is a valid word. Ideally, (2) should also include a way of testing whether a string is a prefix of a valid word – this will allow you to prune your search a...
I need to read data from a huge table (>1million rows, 16 cols of raw text) and do some processing on it. Reading it row by row seems very slow (python, MySQLdb) indeed and I would like to be able to read multiple rows at a time (possibly parallelize it). Just FYI, my code currently looks something like this: cursor.ex...
Serving Images Basic Directory Set-up First let your urls extend beyond images: import web urls = ( '/images/(.*)', 'images' #this is where the image folder is located.... ) Basic Image Class Now create the class that will handle them: import os class images: def GET(self,name): ext = name.split(".")[-1] #...