text
stringlengths
256
65.5k
Python: UseCase: Replace single occurrence of "_" which shouldn’t start and ends with "_". mystr = "This_is_Something____funny__but_important" re.sub(r'(?<!_)(_(?!_))', '#', mystr) 'This#is#Something____funny__but#important' Note: If you want to modify for different char sets(for beginners)! replace below keywordschars...
tomtom Re : [HOW TO] adesklets : installation sous Ubuntu Breezy raaah ! j'ai un probleme d'interpreteur python ! J'ai installé toutes les librairies via synaptic et adesklets aussi. J'ai DL YAB (Yet Another Bar) et j'ai ca : [i]tomtom@barad-luin:/mnt/config/programmes/adesklets/yab-0.0.2$ [/i][b]ls -l[/b] total 56 -rw...
Chris__ Re : gReemote, télécommande + prog TV pour Freebox HD Hmmm l'upload du fichier deb a raté... Désolé :-) Cette fois il a réussi Hors ligne tocks Re : gReemote, télécommande + prog TV pour Freebox HD Pour la barre sa fonctionne très bien. Moi aussi en regardant, je ne trouve pas vraiment d'endroit pour rajouter c...
Pacer Pacer is a JRuby library that enables very expressive graph traversals. Pacer allows you to create, modify and traverse graphs using very fast and memory efficient stream processing thanks to the very cool Pipes library. That also means that almost all processing is done in pure Java, so when it comes the usual R...
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...
I am trying to get my api to give me the reverse relationship data with tastypie. I have two models, DocumentContainer, and DocumentEvent, they are related as: DocumentContainer has many DocumentEvents Here's my code: class DocumentContainerResource(ModelResource): pod_events = fields.ToManyField('portal.api.resour...
The AsciiDoc distribution includes a source filter for highlightingcode syntax. DocBook Outputs AsciiDoc encloses the source code in a DocBook programlistingelement and leaves source code highlighting to the DocBook toolchain(dblatex has a particularly nice programlisting highlighter). TheDocBook programlisting element...
I have seen some fascinating statistics about what HTML markup is actually in use on the web. Have there been any similar studies more recently than this? This dates from January 2011, but isn't that widespread: http://try.powermapper.com/demo/statsversions.aspx I recently needed to come up with some HTML element stati...
k3c Re : TVDownloader: télécharger les médias du net ! [2] @ bibichouchou As-tu une méthode pour récupérer le manifest des vidéos du groupe M6 (M6,W9,6ter) ? Merci PS: Oui, je sais, presque toutes les vidéos sont chiffrées. Hors ligne 11gjm Re : TVDownloader: télécharger les médias du net ! [2] Bonjour , @k3c : je voul...
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...
For my own personal work and reasons, I’ve been moving as much of my non-browser based development into the world of Python as I can manage. Any reasons why are sort of beyond the scope of this and I might write them out sometime later. But for the time being, I wanted to discuss the question of Python web development....
Using psycopg2 with virtualenv on Ubuntu JauntyMaverick Update 2009-11-02: Well I am dumb-- psycopg2 can be installed with pip/easy_install. The reason I got the error before was because I didn't have the required dependencies installed. On Ubuntu, I used apt-get build-dep. So, here's the summary: Update 2010-05-17: He...
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'm beginning python and I'm trying to use a two-dimensional list, that I initially fill up with the same variable in every place. I came up with this: def initialize_twodlist(foo): twod_list = [] new = [] for i in range (0, 10): for j in range (0, 10): new.append(foo) twod_list....
I know that ObjectIds contain the date they were created. Is there a way to query this aspect of the ObjectId? Thanks. Popping Timestamps into ObjectIds covers queries based on dates embedded in the ObjectId in great detail. Briefly in JavaScript code: // This function returns an ObjectId embedded with a given datetime...
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...
plasticgoat [Résolu] message d'erreur au lancement de synaptic Voilà le message d'erreur : W: Impossible de localiser la liste des paquets sources http://fr.archive.ubuntu.com breezy/universe Packages (/var/lib/apt/lists/fr.archive.ubuntu.com_ubuntu_dists_breezy_universe_binary-i386_Packages) - stat (2 Aucun fichier ou...
New! – the latest version supports USB cameras, and features a sample app for live video display! Introduction The libfg library provides a simple high-level C API for controllingVideo4Linux devices, including analog video cameras, TV and webcams. Overview Linux has support for TV tuners and frame grabbers. This is pro...
bobleblob Re : [HowTo] Sauvegarder son "home" avec rsync Bonjour, Existe t-il uneformule générique ou expression rationnelle pour exclure tous les fichiers et répertoires cachéssans en spécifier la liste exhaustive dans --filter "- .thumbnails/" (par exemple pour les vignettes). Salut, pour faire rapide et efficace, tu...
A couple weeks ago, Facebook launched a link prediction contest on Kaggle, with the goal of recommending missing edges in a social graph. I love investigating social networks, so I dug around a little, and since I did well enough to score one of the coveted prizes, I’ll share my approach here. (For some background, the...
Hello! I have an interesting problem that seemed simple to me, but I'm unable to solve it on my own. Suppose I am drawing k numbers out of n numbers labeled from 1 to n.Considering all $\binom{n}{k}$ combinations of numbers drawn, how often does the maximal difference q between two consecutive numbers – but also betw...
#1001 Le 25/04/2010, à 17:05 oGu Re : [ VOS SCRIPTS UTILES ] (et eventuelles demandes de scripts...) Bonjour à tous ! Tout d'abord félicitations pour l'excellente tenue de ce forum et pour tous les scripts que j'ai piqué sur ce topic!! Etant passé de Firefox à IceCat dernièrement, j'aimerais qu'un Ubuntero sachant scri...
I tested this with both CL1317198 (post debugger changes) and 20813.00 (pre changes) and getting the same behavior. Create new python app Add unit test item def test_A(self): text = 'hello world' text = text.upper() print(text) self.assertEqual(text, 'HELLO WORLD') put breakpoint on fir...
I have the following class: class Enemy(pygame.sprite.Sprite): def __init__(self): pygame.init() pygame.sprite.Sprite.__init__(self) # Basic variables self.speed = [2,2] # Sets up the image and Rect self.bitmap = pygame.image.load("badguy.png") self.bitmap.set_colorkey((0,0,0)) self.shipRect = s...
A Guide to Testing in Django #2 Viewable in Serbo-Croatian - Thanks to Vera Djuraskovic! As part two in this series on testing in Django (part I if you missed it), we're going to continue expanding the test suite on the venerable "polls" app. As with the previous post, the code can be found on Github with tags marking ...
If, like me, you often write documents directly in HTML or XHTML, then you probably find that it’s hard to write correct markup. There are lots of mistakes that are easy to make and hard to notice, such as failing to write the close tag for an element, omitting compulsory attributes like the alt attribute on img elemen...
Hello, I am using XFCE4 and Slim on my laptop and usually only use the laptop screen. When I bring it to work I use an extra display and extend the desktop to it. If I connect the screen before X starts, it expands on the two screens and I lose my keyboard shortcuts (although I still see them in the configuration panel...
Geotagging Geotagging (also written as GeoTagging) is the process of adding geographical identification metadata to various media such as a geotagged photograph or video, websites, SMS messages, QR Codes[1] or RSS feeds and is a form o consists of latitude and longitude coordinates, though they can also include altitud...
hectorau_ben Re : [tuto]Installation de Dofus 2.0 par paquet debian et rpm (pour la doc) Même si tu m'as toujours pas répondu, dofus marche parfaitement, sans AUCUN ralentissement, mais le son ne marche pas ... Même si l'Updater est ouvert et que j'ai activé le son dans le options et biensûr, je n'ai pas trouvé la solu...
Not TeX-related, but since you inquired about a Python script... #!/usr/bin/env python # Generates QR code from given text using Google charts API. import urllib2 import sys # change those to your heart's content. See http://code.google.com/apis/chart/docs/gallery/qr_codes.html for more info ENCODING='utf-8' IMAGE_WIDT...
A well designed application should probably support Copy and Paste. While it sounds simple, it actually entails a few features. Copying from Your Application to Other Applications This means that your application should offer up data formats that other applications can read. So a user should be able to copy in your app...
This is defined in my settings.py TEMPLATE_CONTEXT_PROCESSOR = ( "django.core.context_processors.request", # <- HERE "django.contrib.auth.context_processors.auth", "django.core.context_processors.debug", "django.core.context_processors.i18n", "django.core.context_processors.media", "django...
This question is similar to Atomic operations in Django? however for Django 1.4. I'm wondering if there is a way to do this without resorting to "raw SQL". My setup is a little different then his so I'll explain. I have a record for a User and a generic table called UserRecords. Here's the definition for UserRecord. cl...
We're starting a new project in Python with a few proprietary algorithms and sensitive bits of logic that we'd like to keep private. We also will have a few outsiders (select members of the public) working on the code. We cannot grant the outsiders access to the small, private bits of code, but we'd like a public versi...
Here's the very dumb way: def divisorGenerator(n): for i in xrange(1,n/2+1): if n%i == 0: yield i yield n The result I'd like to get is similar to this one, but I'd like a smarter algorithm (this one it's too much slow and dumb :-) I can find prime factors and their multiplicity fast enough. I've an ge...
So I have a class that I've set something like class Piece: def __init__(): self.txt = "\u2665" # some methods... # including a method validMovements(), which works properly, no errors here def __repr__(): return self.txt Now i proceed to doing the following code class GameManagement:...
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...
Yoko 12 [Résolu] Problème avec apt-get update Bonsoir à tous, Après avoir fait des changement dans mon sources.list, j'ai voulut lancer apt-get update. Mais il reste bloqué à 36%, après il me dit que le delais de connexion est dépasser pour se connecter au serveurs. Voici le contenu de mon sources.list (j'imagine qu'el...
#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...
#2851 Le 19/03/2013, à 02:35 M@dinko12 Re : TVDownloader: télécharger les médias du net ! Bonjour, je ne comprends pas si le projet tvdownloader est au point mort à cause des fragmentations de M6Replay (les fichiers téléchargés font 0 octets même après MAJ des plugins) ? Et pas envie de lire 114 pages, j'ai lu les dern...
malbo [Tuto] Principes (quelques) de Ubuntu en mode UEFI - Equivalence Bios-UEFI pour les amorceurs de Grub L'amorceur de Grub dans le système Bios peut se trouver dans le MBR ou dans le secteur de Boot d'une partition. Son équivalent dans le système UEFI est un fichier qui porte l'extension .efi et qui se trouve (dans...
Underscore templates - classic vs. precompiled JavaScript performance comparison Info Benchmarking difference in performance of rendering simple Underscore template - classic vs. precompiled Preparation code <script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.0-rc.2/lodash.min.js"></script> <script>   var lodas...
I recently stumbled upon this and am checking here to see if what I am proposing is indeed feasible and can be considered a breach of privacy. For obvious reasons I am not revealing the website which exhibits this property The URLs are of the format : https://xxxxxxxxyyyyyzzzz/xyz/<6 digit rand>_<17 digit rand>_<10 dig...
lukophron Re : [python]Monsieur Cinéscript ah, bug du forum, je voyais mon dernier message en triple, je veux effacer les doubles et il m'efface tout.enfin bref ça veut dire quoi "je voulais voir ce que ça donnait" ? et heureusement que j'ai dit "ne pas faire la màj"... le problème, lorsque tu fais des trucs comme ça, ...
I'm using Ubuntu 12.04 (upgraded from 11.10), everything seemed to work fine until today when my laptop monitor suddenly stopped working. Here are the facts: My laptop is a Dell Latitude E6410, Intel graphics. External Monitor is attached through a docking station. Everything worked fine for about 6-7 month, then upgra...
grim7reaper Re : /* Topic des codeurs [8] */ On va prendre une autre approche : vous me conseillez quoi pour commencer, dans un cas et/ou dans l'autre ? Pour Haskell, le fameux Learn You a Haskell for Great Good! (une traduction existe, je ne sais pas ce qu’elle vaut), si tu veux approfondir il y a aussi Real World Has...
Say I have 3 entities: class A(db.Model): something = db.StringProperty() class B(db.Model): somethingelse = db.StringProperty() class C(db.Model): reference = db.ReferenceProperty() where the Reference in C can be either A or B, how to I determine, given an instance of C, the reference's type (A or B)? Regards,...
January 7th, 2013 at 7:40 pm by Dr. Drang Last summer, I wrote a couple of scripts for creating Markdown reference-style links in BBEdit. One of them was for new links, the other was for reusing a link that’s already in the file. What I didn’t do, for reasons that aren’t clear to me, was write scripts for adding links ...
I do this for builds for multiple platforms (rather than debug/release) but the concept's the same. The basic idea is that you need 2 files in the project root - a SConstruct to set up the build directories (or "variant directories" as they are known in scons), then a SConscript that describes the actual build steps. I...
Information on groups, servers and shards are stored in a MySQL Instance called state store or backing store. This instance is a repository for all this information and the engine used might be any supported by MySQL, although a transactional engine must be picked to truly provide fault-tolerance. Note though that we h...
Kubke Lab:Research/ABR/Notebook/2013/10/29 From OpenWetWare Hearing development in barn owls Main project page Previous entry Next entry General Entries Feedback from Andy Personal Entries Fabiana Trying to apply a low pass filter to ABR data Using package signal install.packages("signal") library(signal) Read test fi...
Etoma Re : /* Topic des codeurs [7] */ Écrire du code est très exigeant. C'est plaisant. Hors ligne tshirtman Re : /* Topic des codeurs [7] */ si les experts d'haskell peuvent l'aider… (j'aime bien ce gars… c'est le mec qui code git-annex et upload des paquets debian depuis un netbook tournant à l'énergie solaire dans ...
blob: 92bcfaa0dccd470763187f988ad4302c31809068 ( plain ) ''' Created on Dec 26, 2012 __author__ = "Elizabeth 'pidge' Flanagan" __copyright__ = "Copyright 2013, Intel Corp." __credits__ = ["Elizabeth Flanagan"] __license__ = "GPL" __version__ = "2.0" __maintainer__ = "Elizabeth Flanagan" __email__ = "elizabeth.flanagan@...
You do not say what the format of the file is. Based on your attempt, I'm assuming that your file contains just a single integer on each line. Here are some of the problems with your function: You are passing an argument to the function called l, but not using it. You should be using it as the name of the file to open,...
I want to check a set of sentences and see whether some seed words occurs in the sentences. but i want to avoid using for seed in line because that would have say that a seed word ring would have appeared in a doc with the word bring. I also want to check whether multiword expressions (MWE) like word with spaces appear...
I wrote some code in Flask for site menu: def menu(parent_id=0, menutree=None): menutree = menutree or [] cur = g.db.execute('select id, parent, alias, title, ord from static where parent="'+ str(parent_id) +'" and ord>0 order by ord') fetch = cur.fetchall() if not fetch: return None return ...
smo Re : Gmediafinder : Youtube/dailymotion/vimeo.. sans flash et bien plus.... ola ok cool je vais regarder ca apres, la j en fais un "normalement" c est un peu (beaucoup...) plus complique pour les ppa j vous tiens au jus ! et whoue si vous avez des idees, hesitez pas hein ... j aimerais bien avoir des visualisations...
DamienD [RESOLU] problème webcam avec motion Bonjour, je tente d'utiliser motion avec ma webcam. C'est une webcam Carrefour: Webcam cwc22 J'ai une image avec le logiciel Cheese. Avec motion, voici le problème: damien@damien:~$ motion [0] could not open configfile /etc/motion/motion.conf: Permission denied [0] Not confi...
Today, NewsBlur is going real-time. Blogs using the PubSubHubbub protocol (PuSH), which includes all Blogger, Tumblr, and many Wordpress blogs, will instantaneously show new updates to subscribers on NewsBlur. Making this happen, while not for the faint of heart, was straight-forward enough that I’m sharing the recipe ...
wlourf Postez vos scripts Lua pour Conky ! Bonsoir à tous ceux pour qui chaque pixel du bureau compte, J'ouvre ce topic suite aux discussions sur le topic des conky pour discuter des scripts Lua dans conky. Lua est un langage de script léger et facile a utiliser qui permet d'ajouter de nouvelles fonctionnalités à nos c...
The API for PyMongo, the Python driver for MongoDB, has been pretty stable for quite some time now. In general, I think that the driver does a great job of exposing all of MongoDB’s functionality in a way that is both MongoDB-ish and Pythonic (of course I’m biased — if you have suggestions for improvements please let m...
Related Reading An excerpt from Chapter 20: GUI Development, from Python Programming on Win32. This is the first of three excerpts covering Tkinter, PythonWin, and wxPython. This excerpt only covers Tkinter. In this chapter, we examine the various options for developing graphical user interfaces (GUIs) in Python. We wi...
I have a hunch that I need to access an item in a list (of strings), modify that item (as a string), and put it back in the list in the same index I'm having difficulty getting an item back into the same index for item in list: if "foo" in item: item = replace_all(item, replaceDictionary) list[item]...
How to host Pyblosxom as a WSGI application with Twisted Dependencies Note: The stated requirement to downloadtwisted_wsgi.pyfound inwsgi_app.pyin the Pyblosxom distribution only applies to Twisted Web 1, not Twisted Web 2, as Twisted Web 2 has WSGI support built in. Twisted: If you chose to download the release tarbal...
from bottle import * from storm.locals import * from middlestorm import MiddleStorm #other bottle code like this here... @get('/') def index(): return 'index' db = create_database("mysql://user:pass@localhost/mydb") myapp = MiddleStorm(app, db) run(app=myapp, reloader=True, host='0.0.0.0', port=4321) I get this ...
I have this Python application that gets stuck from time to time and I can't find out where. Is there any way to signal Python interpreter to show you the exact code that's running? Some kind of on-the-fly stacktrace? I have module I use for situations like this - where a process will be running for a long time but get...
Are unix/linux sha256/sha512 passwords in /etc/shadow key-strengthened? Yes. They use a crypt procedure that does a default of 5000 rounds of hashing. The sha256-crypt/sha512-crypt procedure is described hereand in java Can I change the number of rounds? Yes. Simply edit /etc/pam.d/passwd or /etc/pam.d/common-password ...
After seeing a conversation in a forum from many years ago that was never resolved, it caused me to wonder how one would correctly create a tuple that referenced itself. Technically, this is a very bad idea since tuples are supposed to be immutable. How could an immutable object possibly contain itself? However, this q...
Fields are used to describe specific properties of a documentedobject. For example, fields can be used to define the parameters andreturn value of a function; the instance variables of a class; and theauthor of a module. Each field consists of a tag, an optionalargument, and a body. Each docstring markup langauge marks...
benney [Resolu] Firefox fait planter mon ordi après passage de 12.04 à 14.04 Bonjour, je viens de passer (de tenter) de la version 12.04 à la version 14.04 de xubuntu via un CD d'installation. au préalable, lors de l'installation j'avais utilisé sans incident le navigateur Firefox lors de la sécession live sur le CD. j...
I have just written a pseudo-code (actually in Python) of a binary search algorithm. def binSearch(lst, number): left = 0 right = len(lst) - 1 while left <= right: middle = left + ((right - left) / 2) if number == lst[middle]: return True else: if number < lst[middle]: right = midd...
After coding my divisor code which I did as a practice for my GCSE stuff which I have to take soon, I have decided to ask the community if there are any bugs or ways I can improve my code. import time, math from array import * def programme(): num = input("Enter your Number: ") try: intnum = int(num) ...
28marc28 Postfix est en train de me rendre fou ... Bonsoir à tous, je reviens vers vous ce soir car j'ai configuré postfix et tout le reste ... Je peux envoyer des messages en local et vers l'exterieur. En revanche, les messages entrants sont bloqués en file d'attente, je commence à péter les plombs cela fait 4 jours q...
Is there any elegant way to exploit the correct spacing feature of print numpy.array to get a 2D array, with proper labels, that aligns properly? For example, given an array with 4 rows and 5 columns, how can I provide the array and appropriately sized lists corresponding to the row and header columns to generate some ...
I'm building an application where users are able to create profiles for themselves by answering a bunch of multiple-choice questions. Users are also able to search for other users by specifying criteria for answers to these questions. Let's say we have 9 questions q1 .. q9, each with 6 possible answers (0 through 5). T...
I am trying to calculate the relative entropy given two collections and have a question regarding some issues. Supposed we have two sets, $Real$ and $Calculated$, and their respective probability mass functions, $P$, and $Q$. Relative Entropy, or Kullback Leibler Divergence is defined as the following: $$\sum_{i=0}^{n}...
With the following code: import pytest def test_a(): with pytest.raises(Exception): 1/0 If I run pylint on it, it will make a complain that "raises" is not a member of module pytest: E: 3,9:test_a: Module 'pytest' has no 'raises' member Which is obviously not true. Any idea why pylint is making such a mist...
You should design your Python files to be usable as modules. Then the master can import the functions it needs from the others, and call those functions with the desired arguments (like start and end). Here is a tutorial about modules in Python. http://www.tutorialspoint.com/python/python_modules.htm I have no idea wha...
You can check that an attribute starts with a certain value using ^=: find("img[src^='https://www.example.com/image']") The article, The Skinny on CSS Attribute Selectors, describes the various checks (equals, starts with, ends with, etc.): #Equals find("img[src='https://www.example.com/image']") #Contains somewhere f...
I'm trying to convert hex values into base 64. I have a script that does some calculations to each value. I then want to convert the final values to base 64 import base64 for i, v in enumerate([0x31, 0x37, 0x32, 0x2e]): z=i+v #adds positional index to hex value q=z+0x27 #adds constant x=q^i # XORs with pos...
I have a relatively simple question which I am having trouble finding a solution to in SQLAlchemy: I wish to create a mapped attribute of an object which is populated from another table. Using the SQLAlchemy documentation example, I wish to make a user_name field exist on the Address class such that it can be both easi...
/projects/mymath$ ls __init__.py __init__.pyc mymath.py mymath.pyc tests and under the directory tests I have /projects/mymath/tests/features$ ls steps.py steps.pyc zero.feature I tried to import my factorial function sys.path.insert(0,"../../") #import mymath from mymath.MyMath import factorial But it said No...
enebre Re : Gmediafinder : Youtube/dailymotion/vimeo.. sans flash et bien plus.... bonjour smo, je viens de réinstaller gmf sur mon petit netbook et git clone git://github.com/smolleyes/gmediafinder2.git gmf2 cd gmf2/Gmediafinder python gmediafinder.py je constate que python-mecahanize n'est plus intégré dans les deps...
I assumed that you're using cache decorators. The code below is a decorator that returns a view decorated with another decorator (i.e. cache_page) only if user is not admin. So admin will always get the non-decorated (non-cached) page, and other users will get decorated (so possibly cached) page. It works with all poss...
Python 3 OOP Part 5 - Metaclasses Previous post The Type Brothers The first step into the most intimate secrets of Python objects comes from two components we already met in the first post: class and object. These two things are the very fundamental elements of Python OOP system, so it is worth spending some time to un...
I have made the following code to render the map using tiles, it loops through the file and translates letters into tiles (rectangles); currtile_x = 0 currtile_y = 0 singlerun = 1 if singlerun == 1: singlerun = 0 with open('townhall.map', 'r') as f: for line in f: for character in line: ...
pops logiciel d'animation en pixel art Bonjour, Je voulais vous présenter un petit logiciel d'animation en pixel art sur lequel je travaille depuis un peu plus d'un mois. C'est encore très sommaire, mais il commence a être utilisable : On peut dessiner avec des couleurs indexées, animer, il y a quelques brosse et on pe...
In SQLAlchemy Declarative, how do I set up default values for columns, such that transient or pending object instances will have those default values? A short example: from sqlalchemy import Column, Integer, String from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class A(Base): __tabl...
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...
abelthorne Re : [BUNDLE] Humble Indie Bundle (HIB 12 + hebdo merge + promos été) Il y a eu une mise à jour pour la version Steam de Rocketbirds ; maintenant il fonctionne. J'ai jeté un coup d'œil aux fichiers, ce n'est pas du Flash. Il y a aussi eu une màj pour Mark of the Ninja mais elle ne corrige apparemment pas le ...
Distributing noise in 3 dimensions using jit.gl.mesh Hello everybody, I’m trying to generate a 3-dimensional point cloud starting from jit.noise, but I can’t get to "scale" the otuput of jit.noise (which goes from 0 to 1) to the vertex array requested by the jit.gl.mesh (which is signed normalized -1. – 1.) In the exam...
spyke Re : La communauté du jeux sous Linux http://www.JeuxLinux.fr jerhum oki mais alors je ny arrive pas a les faire tourner justement est ce normale comme wolfenstein , quake4 etc..... Hors ligne foxylechou Re : La communauté du jeux sous Linux http://www.JeuxLinux.fr il faut autoriser le fichier a être exécuter dan...
Developing a web browser in Python - is it possible? Sure, it's possible. Why should it be any different to other languages? Python is still a complete and proper programming language, even if it is rather high-level. Now I'm not sure it would produce great The question is: why would you want to do that anyway, with al...
Does pill A or pill B save the most lives? Which web design results in the most clicks? Which in vitro fertilization technique results in the largest number of happy babies? A lot of questions out there involves estimating the proportion or relative frequency of success of two or more groups (where success could be a s...
An Introduction to List Comprehensions in Python The basics. Let’s start with a simple list. >>> my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]>>> my_list[1, 2, 3, 4, 5, 6, 7, 8, 9, 10] Quite often, we’ll need to build a new list from the elements of an existing list. For example, let’s say we want to make a list containing...
languages wernaeh at April 26th, 2010 19:00 — #1 Hello everyone Recently, I've been having quite some performance problem with using a large (\~\~500 MB) std::vector\, which is repeatedly getting resized, cleared, and dropped in a tight loop. Weirdly, the problem comes from the STL that accompanies Visual Studio 2008. ...
I have a very sparse undirected graph. I need to decompose it into n sets of edges. In each of these sets, all edges are independent (no two edges share any vertices). Every edge in the graph is contained in exactly one of these sets. The goal here is to minimize n. Note that this problem is somewhat different from the...
pops logiciel d'animation en pixel art Bonjour, Je voulais vous présenter un petit logiciel d'animation en pixel art sur lequel je travaille depuis un peu plus d'un mois. C'est encore très sommaire, mais il commence a être utilisable : On peut dessiner avec des couleurs indexées, animer, il y a quelques brosse et on pe...
I am equally passionate about writing code as I am about building businesses. You really should Follow @paltman Do you have an iOS or web application that you'd like help with? Eldarion offers lean coaching, software development, code reviews, and in some cases staff augmentation. You should consider it for your Django...
I am learning PyQt and coming from webdesign, so excuse this question that must have very obvious answer.So I am building a PyQt application and I would like to spread methods to several files to correspond different parts of GUI. How can I access textbox locating in fileA.py from fileB.py. : #fileA.py import sys from ...