text
stringlengths
256
65.5k
web2py supports both session and memcache. To enable sessions simply do from gluon.contrib.gql import * db=GQLDB() session.connect(request,response,db) To enable memcache from gluon.contrib.gae_memcache import MemcacheClient cache.ram=cache.disk=MemcacheClient() Then every program/example that uses sessions or cache ...
If you want to change just the palette, then PIL will just get in your way. Luckily, the PNG file format was designed to be easy to deal with when you only are interested in some of the data chunks. The format of the PLTE chunk is just an array of RGB triples, with a CRC at the end. To change the palette on a file in-p...
#0 -1 » Adresse IP USA » Le 18/10/2012, à 23:41 Nchou Réponses : 2 Bonsoir, J'aimerais consulter des sites comme Netflix pour avoir accès aux séries américaines sans les télécharger. Cependant, l'accès à ce genre de site est bloqué car mon adresse IP est localisée en France et non en Amérique. Que faire ? Est-ce qu'il ...
I'm trying to do some interpolation with scipy. I've gone through many examples, but I'm not finding exactly what I want. Let's say I have some data where the row and column variable can vary from 0 to 1. The delta changes between each row and column is not always the same (see below). | 0.00 0.25 0.80 1.00------|-----...
In your original question, you asked "Why would you want to pass the definition for a method through another method?" Then, in a comment, you asked "Why don't you just modify the method's actual source code?" I actually think that's a very good question, and a difficult one to answer without hand-waving, because decora...
I would like to improve my preg_replace regex. This is to clean a features list. I want allow for the begining of each line: alphanumeric characters == and alphanumeric characters -- alphanumeric characters ++ alphanumeric characters ** alphanumeric characters my regex: $features = " == Category one → feature...
I have a Django app where users submit orders for payment. Clearly, security is important. I want to minimise the amount of code that I have to write, to avoid introducing any security holes, and ease maintenance. The model is simple: class Order(models.Model): user = models.ForeignKey(User) created = models.Da...
Suppose I have a python function that takes two arguments, but I want the second arg to be optional, with the default being whatever was passed as the first argument. So, I want to do something like this: def myfunc(arg1, arg2=arg1): print (arg1, arg2) Except that doesn't work. The only workaround I can think of i...
phiphi076 Re : La mise a jour clamAV et clamtk @awass la commande te permet de lancer le programe en mode graphique avec les droits "root" administrateur (avoir accès au système) . lorsque tu lance clamav "normalement" sans les droits administrateur , tu peut pas faire les mises a jour des liste de virus et programe de...
For optimal performance, you can probably just use an array of longs rather than a list. We had a similar requirement at one point to implement a download time estimator, and we used a circular buffer to store the speed over each of the last N seconds. We weren't interested in how fast the download was over the entire ...
I've found a few questions on the module but the more common problem seems to be getting the argument list right which I think I have managed (eventually) I am trying to run a program that expects an input like this in the command line, fits2ndf in out with 'in' being the filepath of the file to be converted and 'out' ...
I have a script where I ask the user for a list of pre-defined actions to perform. I also want the ability to assume a particular list of actions when the user doesn't define anything. however, it seems like trying to do both of these together is impossible. when the user gives no arguments, they receive an error that ...
I have a line from A to B and a circle positioned at C with the radius R. What is a good algorithm to use to check whether the line intersects the circle? And at what coordinate along the circles edge it occurred? Taking Compute: Then the intersection is found by.. (h,k) = center of circle. So we get: So solving the qu...
So I know this site gets far too many questions about Zed Shaw's Learn Python the Hard Way, but I'm going through ex42., extra credit #3, has got me hung up. I am having trouble getting the class Engine to effectively start and transition into the class Map where the game can begin going through the different functions...
bidou10 mise à jour de sécurité importante bonjour à tous, depuis un petit moment, j'ai une mise à jour de sécurité importante qui ne veut pas se faire, elle apparait à chaque fois décochée. j'ai essayé cette commande dans le terminal, mais je ne suis pas très fort dans ce domaine et j'aimerai avoir un petit coup de ma...
So it's another n-dimensional array question: I want to be able to compare each value in an n-dimensional arrays with its neighbours. For example if a is the array which is 2-dimensional i want to be able to check: a[y][x]==a[y+1][x] for all elements. So basically check all neighbours in all dimensions. Right now I'm ...
I would like to store Python objects into a SQLite database. Is that possible? If so what would be some links / examples for it? You can't store the object itself in the DB. What you do is to store the data from the object and reconstruct it later. A good way is to use the excellent SQLAlchemy library. It lets you map ...
Here's what's to be done for maintaining GCC. Apart from the target-specific configuration machinery, there shouldn't be any major differences within GCC between the GNU/Hurd and GNU/Linux ports, for example. Especially all the compiler magic is all the same. Last reviewed up to the Git mirror's 3a930d3fc68785662f5f3f4...
Code: Public Sub ProjectViewCmd(ID As Long, Stat As String) Dim i As Integer Dim MyBox As String 'if it is a project lead If Stat = "Active Lead" Or Stat = "Dead Lead" Then DoCmd.OpenForm "Project Leads", acNormal If Stat = "Dead Lead" Then Forms![Project Leads].Controls(BothOption).Value = True Forms![Project Leads].F...
I have some code that uses a multidimensional look-up table (LUT) to do interpolation. The typical application is a color space conversion, where 3D inputs (RGB) are converted to 4D (CMYK), but the code is rather general. The look-up table is a numpy array, which will generally have a shape like (4, 17, 17, 17). Here, ...
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...
CoffeeScript is a little language that compiles into JavaScript. Underneath that awkward Java-esque patina, JavaScript has always had a gorgeous heart. CoffeeScript is an attempt to expose the good parts of JavaScript in a simple way. The golden rule of CoffeeScript is: "It's just JavaScript". The code compiles one-to-...
chaoswizard Re : TVDownloader: télécharger les médias du net ! Bonsoir, Non ce n'est pas possible, RtmpDump (et je suppose Flvstreamer) n'arrive pas à parser l'URL si elle n'est pas découpée. J'avais étudié ce problème en mettant au point Arte Live Web pour TVO. Bon courage pour votre projet Je viens pourtant de tester...
If you register a tag like this: # mytags.py import datetime from django import template register = template.Library() @register.simple_tag def my_current_time(format_string): return datetime.datetime.now().strftime(format_string) Then use it: # details.html {% load mytags %} {% <check this completion list It doe...
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...
Can you create images like this: when you have something like 0 = green (#54ff00) 1 = white (#ffffff) 2 = red (#ff0000) 3 = blue (#0048ff) Image (Python list of integers defined above): [[2,0,0,0,0,0,0], [0,3,0,0,0,0,0], [0,3,2,1,1,0,0], [0,3,2,2,2,1,1], [0,3,2,0,0,1,0], [0,0,0,0,0,1,0], [0,0,0,0,0,1,0]] with...
Selenium is an application that automates web browsers, helping you test your web application from a user perspective, in an automated manner. These properties make Selenium tests a perfect fit for validating your js-level functionality and implementing acceptance tests. Of course, it has some drawbacks: you need to ru...
I'm asked to make a program that calculates the addition of two polynomials of n and m degrees. I made two dictionaries (one for the first polynomial and the other is for the other polynomial) since each one has the coefficients as values and degrees as keys so that I can check whether the keys from both dictionaries a...
I can't seem to get my Flask app to close or reuse DB connections. I'm using PostgreSQL 9.1.3 and Flask==0.8 Flask-SQLAlchemy==0.16 psycopg2==2.4.5 As my test suite runs the number of open connections climbs until it hits 20 (the max_connections setting in postgresql.conf), then I see: OperationalError: (OperationalEr...
So I'm getting some interesting behaviour from some filters stacked within a for loop. I'll start with a demonstration: >>> x = range(100) >>> x = filter(lambda n: n % 2 == 0, x) >>> x = filter(lambda n: n % 3 == 0, x) >>> list(x) [0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 84, 90, 96] Here we get the expec...
oliver2004 problème wifi avec portable HP nx6125... Salut à tous, je viens d'installer sans trop de mal Kubuntu 7.10 sur mon portable HP Compaq nx6125 (j'ai de la chance il n'est pas tatoué...). Aparemment tout marche sur la machine... sauf le wifi... j'en ai pas besoin là maintenant mais j'en aurai sûrement besoin et ...
I am having difficulty in establishing a connection with XMPP (Prosody) . But if I use PSI it works fine and request for your suggestions. Here is the code snippet of my python : client = xmpp.Client(host) client.connect(server=(host,port)) client.auth(username, passwd,resource='', sasl=1) client.sendInitPresence() In...
I am very new to programming so I decided to start with Python about 4 or 5 days ago. I came across a challenge that asked for me to create a "Guess the number" game. After completion, the "hard challenge" was to create a guess the number game that the user creates the number and the computer (AI) guesses. So far I hav...
I am getting an error here and I am wondering if any of you can see where I went wrong. I am pretty much a beginner in python and can not see where I went wrong. temp = int(temp)^2/key for i in range(0, len(str(temp))): final = final + chr(int(temp[i])) "temp" is made up of numbers. "key" is also made of numbers. ...
An important part of a usable web site is a well-designed navigation bar. Something that any navigation bar should have is an indication of where the user is. Common practices for this include using a bold face for the link, a different color or adding a small icon next to the current section link. To do that, you coul...
Given a file myapp.py from celery import Celery celery = Celery("myapp") celery.config_from_object("celeryconfig") @celery.task(default_retry_delay=5 * 60, max_retries=12) def add(a, b): with open("try.txt", "a") as f: f.write("A trial = {}!\n".format(a + b)) raise add.retry([a, b]) Configured ...
I'm trying to see whether nodes reside within the volume of a sphere, and add the node id to a list. However, the efficiency of the algorithm is incredibly slow and I'm not sure how to improve it. I have two lists. List A has the format [{'num': ID, 'x': VALUE, 'y': VALUE, 'z': VALUE] while List B has the format [{'x':...
My naive reading of the numpy.argsort() documentation: Returns-------index_array : ndarray, int Array of indices that sort `a` along the specified axis. In other words, ``a[index_array]`` yields a sorted `a`. led me to believe that I could do my sort with the following code: import numpy a = numpy.zeros((3, 3, 3)) a +=...
I learned about pystones today and so I decided to see what my various environments were like. I ran pystones on my laptop that is running windows on the bare metal and got these results Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" f...
All programs need to perform input and output. This chapter covers common idioms for working with different kinds of files, including text and binary files, file encodings, and other related matters. Techniques for manipulating filenames and directories are also covered. Use the open() function with mode rt to read a t...
Mindiell Re : Topic des lève-tôt… Faisons manger leurs caleçons aux couche-tard! [4] Si c'est Floyd Pepper... Eh mais c'est l'week-end ! Hors ligne PPdM Re : Topic des lève-tôt… Faisons manger leurs caleçons aux couche-tard! [4] Bonjour, Golgoth devait en bricoler un mais il n'a pas dis quand! Hors ligne raspouillas Re...
I have the following, class Company(db.Model): companyvalid = db.BooleanProperty(required=True) class AddCompanyForm(djangoforms.ModelForm): class Meta: model = Company exclude = ['companyentrytime'] exclude = ['companylatlong'] however I cannot get the o/p from the Django stored in...
On Unix, how can Iretrieve the output of a ksh function as a Python variable?The function is called sset and is defined in my ".kshrc". I tried using the subparser module according to comment recommendations. Here's what I came up with: import shlex import subprocess command_line = "/bin/ksh -c \". /Home/user/.khsrc &&...
Sometime you want an insert form that, upon submission and after the insert, retains the preceding values to help the user insert a new record. This can be done: db=SQLDB('sqlite://db.db') db.define_table('user', SQLField('name','string')) And in controller def test(): form=SQLFORM(db.user) if form.accepts...
djara Re : Récupération de windows après insttallation de ubuntu 12.10 64bit Merci. Je te tiens informer dans quelques minutes du résultats. Merci Hors ligne djara Re : Récupération de windows après insttallation de ubuntu 12.10 64bit Voila ce que j'ai obtenu en reprenant avec la version officiel le lien : http://paste...
UPDATE: 2.x support is now mainline! Please read the wiki page for important information about the update. A warm welcome to you, traveller. You have arrived at the home of Py-StackExchange, the library definitively proven† to be the best library for using the SE API from Python. If you are still interested (and by gol...
This article has a snippet showing usage of __bases__ to dynamically change the inheritance hierarchy of some Python code, by adding a class to an existing classes collection of classes from which it inherits. Ok, that's hard to read, code is probably clearer: class Friendly: def hello(self): print 'Hello' ...
Posted by Nick SiegerThu, 18 Jan 2007 03:59:31 GMT This is part 3 in our ongoing conversation tracking the development of JRuby. Official Rails support in February? That’s not far away! What do you mean by “official”? Thomas Enebo: Largely, we just want to spend some extra TLC on fixing up various Rails issues between ...
#1501 Le 14/12/2011, à 22:25 olitask Re : [ VOS SCRIPTS UTILES ] (et eventuelles demandes de scripts...) salut, si tu veut envoyer seulement une image sélectionnée,ce script doit convenir.<metadata lang=Shell prob=0.84 /> #!/bin/sh if [ -f "$1" ]; then notify-send -i "gtk-go-up" "Picasa upload" "Votre image va être...
How can I get the file name from a file path in Ruby? For example if I have a path of "C:\projects\blah.dll" and I just want the blah. Is there a LastIndexOf function in Ruby? How can I get the file name from a file path in Ruby? For example if I have a path of "C:\projects\blah.dll" and I just want the blah. Is there ...
All in all it was pretty simple to get my flask app up and running on Elastic Beanstalk. I ran into a couple of gotchas, and wanted to share them to save others some time. I relied heavily on two tutorials to get going my first app up: Three main gotchas where (see below for how to get solve / work around): As of June ...
PotatoMasher Re : Script d'installation pour imprimantes Brother D'accord, alors j'ai retiré brscan2 de /etc/sane.d/dll.conf. brscan-skey -l donne toujours le même device, "Not Registered". Après avoir jeté un coup d'oeil aux groupes, je réalise que mon utilisateur n'est pas membre du groupe "scanner" et du groupe "san...
I am having problem saving additional information about each user automatically when a new user signs-up. I have created a profile for User model extension to save additional data about my users. However, when the signal handler gets called at post_save, the data stored in the request is not passed to the signal_handle...
i hope this request is legit. i'm taking a programming course in python for engineers, so i'm kinda new at this business. anyway, in my homework i was requested to write a function with receive two strings and check if one is a (permutation/Anagrm) of the other. (which means if they both have exactly the same letters a...
I have a generator that yields nodes from a Directed Acyclic Graph (DAG), depth first: def depth_first_search(self): yield self, 0 # root for child in self.get_child_nodes(): for node, depth in child.depth_first_search(): yield node, depth+1 I can iterate over the nodes like this for node, ...
I have a 500GB Toshiba 2.5' HD, which I formated using Debian Wheezy 64bit. I created 2 partitions (180GB and 320GB). RPi would only recognize the first partition. So, I tried creating the partitions using the raspberrypi. Here are my surprising findings: root@raspberrypi:/home/ozn# fdisk -l Disk /dev/mmcblk0: 4025 MB,...
pango.FontFace — an object representing a group of fonts varying only in size. class pango.FontFace(gobject.GObject): def describe() def get_face_name() def list_sizes() A pango.FontFaceobject represents a group of fonts with the same family, weight, slant,stretch and width but varying sizes. A list of fon...
pilote [résolu] impossible d'acceder au site adobe.com bonjours, voici le problème -> Firefox ne peut établir de connexion avec le serveur à l'adresse www.adobe.com -> Opéra: Vous tentez d'accéder à l'adresse http://www.adobe.com/, actuellement injoignable... etc. a priori c'est le seul site à me faire ça ! Je ne sais ...
I'dl like to generate some alphanumeric passwords in python. Some possible ways are: import string from random import sample, choice chars = string.letters + string.digits length = 8 ''.join(sample(chars,length)) # way 1 ''.join([choice(chars) for i in range(length)]) # way 2 But I don't like both because: way 1only u...
So I tried the code below and it downloads attachments alright. The problem is on my gmail account, there are emails that were sent using MMS mail through mobile phone. Email attachments from mobile network A can be downloaded by the script below , while those that came from mobile network B fails. Here are the links t...
I want to group the below query by GetSetDomainName and select the row which has the maximum GetSetKalanGun.In other words, I am trying to get the row with the maximum KALANGUN among those which have the same DOMAINNAME. var kayitlar3 = ( from rows in islemDetayKayitListesi select new { KAYITNO = ro...
I'm tring to reduce the size of a 2D array by taking the majority of square chunks of the array and writing these to another array. The size of the square chunks is variable, let's say n values on a side. The data type of the array will be an integer. I'm currently using a loop in python to assign each chunk to a tempo...
I was working with python and matplotlib but my script crashed so I had to turn off the terminal (Ubuntu 12.04, matplotib-1.1.0, python2.7). Now if I try to run any script it crashes on the line import matplotlib.pyplot as plt with the following error Traceback (most recent call last): File "new.py", line 4, in <mod...
As the title states, I am lost here because I can upload files to MEDIA_ROOT via the site, but when I attempt to serve them I get a 404 error. The most annoying part is that this worked for ages, now something changed and it's broken. UPDATE: I've narrowed the problem down. If I change:MEDIA_URL = '/media/' Django serv...
I'm leaning python and tried this code to test my 1st bit of OOP coding but I'm not sure how to fix this pesky error. This example of from Learning Python by mark Lutz 4th edition - Page 650. Any ideas? #File person.py (start) class Person: def __int__(self, name, job=None, pay=0): self.name = name ...
nam1962 [résolu, du coup tuto] Comment nettoyer mauvaise install de langues Comment peut on récupérer un desktop en francais sous 12.04 ou 12.10 ? Je viens d'installer un Airis pour un ami en Xubuntu 12.04 Tout est total ok, mais le desktop est en anglais (tous les fichiers locale indique pourtant fr_Fr ou fr UTF8). Y ...
I'd be interested in some before-and-after c# examples, some non-idiomatic vs idiomatic examples. Non-c# examples would be fine as well if they get the idea across. Thanks. Idiomatic means following the conventions of the language. You want to find the easiest and most common ways of accomplishing a task rather than po...
The Documentation for python requests module says for hooks that "If the callback function returns a value, it is assumed that it is to replace the data that was passed in. If the function doesn’t return anything, nothing else is effected" Now i am trying to return a value(int in my case) from my hook function and it...
In an earlier post, I presented a technique for adding node tagging to Wallaby without adding explicit tagging support to the Wallaby API. Node tags are useful for a variety of reasons: they can correspond to informal user-supplied classifications of nodes or machine-generated system attributes (e.g. “64-bit”, “high-me...
I need to version n number of fc's which start with sde."ENT-QA". I need to select only those feature classes and run versioning for it. Can anyone help me in writing the query for selecting only fc's which start with sde."ENT-QA". Remeber ENT-QA is mentioned has quotes. Thanks in advance. import arcpy arcpy.env.worksp...
I'm trying to mount external hard drive. As I know, to mount manually, I should use fdisk -l to determine which device refers to the drive. When I'm doing so without sudo I have next output: user@desktop:~/tmp$ /sbin/fdisk -l Disk /dev/sda: 320.1 GB, 320072933376 bytes 255 heads, 63 sectors/track, 38913 cylinders, tot...
Something we have been spending some time working on in this cycle has been fixing the mess that is the system tray. This is based upon an awesome specification submitted to Freedesktop by KDE. The spec has been implemented by KDE, we have written an implementation for the GNOME panel and it will ship in Ubuntu 10.04 L...
Go through all the numbers m from 0 to N, deciding whether to include m in the set as encountered. You need to update the probability of including the next number based on the numbers already treated. Let's apply this idea to the example given, with n=3 and N=5. First consider m=0. There are 3 numbers remaining, and 5 ...
I was solving the Find the min problem on facebook hackercup using python, my code works fine for sample inputs but for large inputs(10^9) it is taking hours to complete. So, is it possible that the solution of that problem can't be computed within 6 minutes using python? Or may be my approaches are too bad? Problem st...
Got a new mac and now I'm trying to install/update some stuff. THe first issue I get is that http requests made from inside scripts/programs (such as git or ruby gem) doesn't work. I'll put an example below of the workaround I used because it illustrates the issue better than any explanation. Any help is appreciated! L...
January 4th, 2012 at 9:26 pm by Dr. Drang This is a relatively simple way to get affiliate links to Apple’s digital offerings: Mac apps, iOS apps, songs, albums, ebooks, audiobooks, movies, TV shows—anything Apple sells through iTunes or the Mac App Store. It’s a bottom-up rewrite of a workflow I described last week th...
I use the following method, which works fairly well: 1) Store your passwords in separate gpg encrypted files. For example ~/.passwd/<accountname>.gpg 2) Create a python extension file with a name of your choosing (e.g., ~/.offlineimap.py), with the following contents: def mailpasswd(acct): acct = os.path.basename(acc...
From comments, it is clear that the question is to enumerate rooted unordered labelled full binary trees. As explained in this paper, the number of such trees with n labels is (2n-3)!! where !! is the double factorial function. The following python program is based on the recursive proof in the referenced paper; I thin...
Web client programming is a powerful technique for querying the Web. A web client is any program that retrieves data from a web server using the Hyper Text Transfer Protocol (the http in your URLs). A web browser is a client; so are web crawlers, programs that traverse the Web automatically to gather information. You c...
This is Q version 1, from the v1 branch in Git. This documentation applies tothe latest of both the version 1 and version 0.9 release trains. These releasesare stable. There will be no further releases of 0.9 after 0.9.7 which is nearlyequivalent to version 1.0.0. All further releases of q@~1.0 will be backwardcompatib...
I normally use WGET to download an image or two from some web-page, I do something like this from the command prompt: wget 'webpage-url' -P 'directory to where I wanna save it'. Now how do I automate it in Perl and Python? That is what command shall enable me to simulate as if I am entering the command at the command-p...
#0 -1 » Annulée » Le 12/09/2014, à 21:49 Jacky33490 Réponses : 2 Bonjour et Merci à tous pour la solution à venir : Après 2 tentatives de mises à niveau 12.04 LTS vers 14.04.1 LTS avec problèmes j'ai donc installé 14.04.1 LTS avec image iso. Sous 12.04 mes sauvegardes et restaurations à l'identique se faisaient parfait...
I'm making a game in python, and I have some code set up as such: istouching = False death = True def checkdead(): if istouching: print "Is touching" death = True while death is False: print death game logic I know the game logic is working, because "Is touching" prints, but then when ...
Note that that parsing is already done for you in inspect - take a look at inspect.findsource, which searches the module for the class definition and returns the source and line number. Sorting on that line number (you may also need to split out classes defined in separate modules) should give the right order. However,...
open sourceresearch software. Yes! All this software is free! It’s been paid for already. I hope this article will guide people towards making use of these valuable public domain resources. We used an adaptive control scheme so at no point was robotic geometry measured, and instead the software *learnt* how to move the...
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 ...
malbo Re : Windows 8.1+Ubuntu... Ton Boot-Info est là : Boot Info Script e7fc706 + Boot-Repair extra info [Boot-Info 27Sep2013] ============================= Boot Info Summary: =============================== => Grub2 (v1.99) is installed in the MBR of /dev/sda and looks at sector 175118912 of the same hard ...
Why format() is more flexible than % string operations I think you should really stick to format() method of str, because it is the preferred way to format strings and will probably replace string formatting operation in the future. Furthermore, it has some really good features, that can also combine position-based for...
Hello everyone Last week, Alex Gaynor announced the first public release of Topaz, a Ruby interpreter written in RPython. This is the culmination of a part-time effort over the past 10 months to provide a Ruby interpreter that implements enough interesting constructs in Ruby to show that the RPython toolchain can produ...
There is a lot of topics on Django concurrency, but after checking a lot of those, I don't feel I have found my answer when it comes to transactions. Django version 1.3.1. Postgresql version 8.4.7. A very simple version of my models could look like this: def Member(Model): money = PositiveIntegerField(default=0) us...
There are dozens of other WP installs on the same server, subject to the same ModSec rules, and none of them has a problem. This is the only WP install that has jetpack installed and it only occurs when JetPack is active. The problem is as follows: Some actions on the post/page edit screen (so far it seems to be the on...
#1251 Le 05/02/2012, à 19:35 chaoswizard Re : TVDownloader: télécharger les médias du net ! Voilà, la version 0.5 est arrivée dans le PPA ! Ubuntu ==> Debian ==> Archlinux Hors ligne #1252 Le 05/02/2012, à 20:08 ynad Re : TVDownloader: télécharger les médias du net ! @Greg_lattice comme f.x0 avec la même ligne de comma...
Here is the code I ran: import timeit print timeit.Timer('''a = sorted(x)''', '''x = [(2, 'bla'), (4, 'boo'), (3, 4), (1, 2) , (0, 1), (4, 3), (2, 1) , (0, 0)]''').timeit(number = 1000) print timeit.Timer('''a=x[:];a.sort()''', '''x = [(2, 'bla'), (4, 'boo'), (3, 4), (1, 2) , (0, 1), (4, 3), (2, 1) , (0, 0)]''').timeit...
I've been working really hard on a game, with the intent to compile it to an .exe like have been able to do in the past with my wxPython programs, but py2exe/pyinstllaer and pygame from what I have researched don't go very great together. To get my .exe to work, I have to paste all of the pygame dll/pyc files into the ...
I've used the code below in a project before. It will work as long as the field on which you're basing your key name on is required. class NamedModel(db.Model): """A Model subclass for entities which automatically generate their own key names on creation. See documentation for _generate_key function for req...
This might be a silly question but I couldn't find a good answer in the docs or anywhere. If I use struct to define a binary structure, the struct has 2 symmetrical methods for serialization and deserialization (pack and unpack) but it seems ctypes doesn't have a straightforward way to do this. Here's my solution, whic...
I created a gist based on this question: https://gist.github.com/735861 Following Amber's advice, the private keys are encrypted and decrypted using DES. The encrypted key is represented in base 36, but any other character-based representation will work as long as the representation is unique. Any model that would need...
You can read a file and then tokenize and put the individual tokens into a FreqDist object in NLTK, see http://nltk.googlecode.com/svn/trunk/doc/api/nltk.probability.FreqDist-class.html from nltk.probability import FreqDist from nltk import word_tokenize # Creates a test file for reading. doc = "this is a blah blah foo...
AuthorPosts March 18, 2011 at 11:36 am #3514 Hi There, Was wondering if it is possible to have something on the top right of the home page. So exactly the same as the logo but directly opposite the logo on the right? My client wants to put his contact number there so I would just create the image I just need to know wh...
Sometimes, it is a pain in the ass to write tests for Django apps (even though Django provides some pretty awesome testing tools out of box). One of the scenarios is testing middleware. Let’s take a look at this middleware. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 from .cart import Cart class CartMiddleware: def process_re...