text
stringlengths
256
65.5k
Now on PyPI! You can now find Stack.PY on PyPI, Python's package index. This means that you can install the package simply by running the following command in a terminal: pip install stackpy About from stackpy import API, Site # Print the names of all Stack Exchange sites for site in API.sites: print site['name'] #...
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... 668 users here now /r/programming is a reddit for discussion and news about computer programming Guidelines Please t...
I'm currently building large xml files with xml.dom.minidom and then writing them out to file via the toprettyxml. is there a way to stream the xml to a document because I'm hitting memory errors. def run(self): while True: domain = self.queue.get() try: conn = boto.connect_sdb(awsa, aws...
In cellForRowAtIndexPath(), I allocate a UIButton in the cell. When button pressed, delegate is called that needs to allocate a UIImageView at the same absolute location on the screen as the button, in order to begin a drag of the UIImageView to elsewhere on the screen But, when I read the x,y of delegate's 'sender' (t...
DJ Raging-Bull Carte PCMCIA WiFi non détecté sur ThinkPad 600X Bonjour, J'ai récuperé un IBM ThinkPad 600X équipé d'un Penium III @ 500 MHz et de 446 Mo de RAM, le disque dur fait environ 12 Go et il dispose d'un lecteur CD. J'aimerais le refiler à ma mère qui s'en servirait pour de la bureautique de base. Je lui ai do...
In Python, with iterators, the Visitordesign pattern is useless. And a strongly-ingrained habit. Which I'm trying to break. Here's a common Visitorapproach: class Visitor: def __init__( self ): ... def visit( self, some_target_thing ): ... def all_done( self ): ... v = Visitor() for thing in some_iterator()...
ogaby Re : [ATTENTION] Faille de sécurité critique dans le noyau Linux ! vi... Avec cette simple ligne, on peut bénéficier des mises-à -jour de sécurité plus rapidement que sur un dépà´t européen. Je dis "européen" car je vis en Allemagne et mon dépà´t "normal" n'a pas encore cette mise-à -jour. Hors ligne zappinggg Re...
FTG [script/python] Nautilus et picasaweb! Bonjour à tous, depuis longtemps je voulais réaliser un petit script python a l'aide des API Google, me permettant d'uploader en 2 temps 3 mouvements un paquet de photos de Nautilus vers Picasaweb par un clic droit de souris. Je n'avais pratiquement rien à faire aujourd hui et...
I'm using pyhook and pyhk to map keystrokes on a windows XP machine, and it works fine except for when the keystroke (say, ctrl+z) already exists in the application. In that case, the ctrl+z passes to the application and triggers the action that has been mapped to it. If you are familiar with autohotkey, note that auto...
The question has already been answered by aaronasterling However, someone might be interested in how the variables are stored under the hood. Before coming to the snippet: Closures are functions that inherit variables from their enclosing environment. When you pass a function callback as an argument to another function...
In Python 3.3+: from datetime import timezone def utc_to_local(utc_dt): return utc_dt.replace(tzinfo=timezone.utc).astimezone(tz=None) In Python 2/3: import calendar from datetime import datetime, timedelta def utc_to_local(utc_dt): # get integer timestamp to avoid precision lost timestamp = calendar.timeg...
What is currying? How currying can be done in c++? Please Explain binders in STL container? In short, currying takes a function g(x) == f(x, Y) This new function may be called in situations where only one argument is supplied, and passes the call on to the original The binders in the STL allow you do to this for C++ f...
I'm reading my data from the excel file and then writing it into the DB in Django. I'm using python xlrd module I'm getting the following error:- 'ascii' codec can't encode character u'\xc1' in position 6: ordinal not in range(128) I've tried all the solutions like 1) I was using str(variable) . Removed it. Now storin...
fenix122 Re : erreur avec apache2 : « Unable to open logs » [RESOLU] non non je sais faire les serveur sans interface j'ai fait sa surtout pour simplifier après non je ne suis pas tout a lettre car le tuto que j'ai suivi avait des erreurs pour certaine chose surtout pour c'est source pas bonne j'ai du aller sur le site...
Question: Write a program that asks the user to enter a number of seconds, and works as follows: There are 60 seconds in a minute. If the number of seconds entered by the user is greater than or equal to 60, the program should display the number of minutes in that many seconds. There are 3600 seconds in an hour. If the...
Based on Welford's algorithm: import numpy as np def online_variance(datum,n=0.0,mean=0.0,M2=0.0): n += 1 delta = datum - mean mean = mean + delta/n M2 = M2 + delta*(datum - mean) variance = M2/n # use this for population variance # variance = M2/(n - 1) # use this for sample variance ...
I have a 7zip archive that I need to extract to another directory as opposed to the directory that the archive is located in however I get the error "Error:Incorrect command line". The command I am running is 7zr e -o extract/ {name_of_archive}.7z. What am I doing wrong? Try this command instead ( According to the 7z m...
I got MemoryError when I run the following code in sl4a on my HTC Desire: def load_words(): print "Loading word list from file..." inFile = open(words.txt, 'r', 0) wordlist = [] for line in inFile: wordlist.append(line.strip()) print " ", len(wordlist), "words loaded.\n" return wordlist...
I'd very much like to avoid state binding to entities when querying through session, and take advantage of class mapping without relying on: session.query(SomeClass) I have no need for transactions, eager/deferred loading, change tracking, or any of the other features offered. Essentially I want to manually bind a Res...
Servicios El W3C define los servicios web como "sistema de software destinado al soporte de interacción máquina-a-máquina en forma interoperable sobre una red". Esta es una definición muy general, e implica una gran cantidad de protocolos destinados a las comunicaciones máquina-a-máquina, no a máquina-a-persona, como p...
After scratching the surface of Logstash (and my head) I wanted to understand a bit better how Logstash' filters work, so I set myself the task of parsing a file with a file input and using some of the filters to grab bits and pieces of it for further processing. I also ran into a few surprises... The input file contai...
am trying to deploy my application on google app engine but getting following error Starting update of app: timezzzzpass, version: 4 Scanning files on local disk. 2011-06-06 17:46:22,095 ERROR appcfg.py:1965 An unexpected error occurred. Aborting. Traceback (most recent call last): File "C:\Program Files\Google\goog...
I'm trying to create a messaging system where a message's sender and recipients can be generic entities. This seems fine for the sender, where there is only object to reference (GenericForeignKey) but I can't figure out how to go about this for the recipients (GenericManyToManyKey ??) Below is a simplified example. Per...
I need to split a string into words, but also get the starting and ending offset of the words. So, for example, if the input string is: input_string = "ONE ONE ONE \t TWO TWO ONE TWO TWO THREE" I want to get: [('ONE', 0, 2), ('ONE', 5, 7), ('ONE', 9, 11), ('TWO', 17, 19), ('TWO', 21, 23), ('ONE', 25, 27), ('TWO', 29, 3...
nesthib [astuce/awk] pourquoi awk est si puissant ? un petit exemple une petite astuce pour montrer la puissance d'awk (et plus généralement des « petits » programmes en ligne de commande) j'avais un fichier de log de la forme : 20xx-xx-xx xx:xx:xx username1 Lorem ipsum dolor sit amet 20xx-xx-xx xx:xx:xx username2 cons...
So I have a UIImage that I load with [UIImage imageNamed]. I then save that file to my documents directory. My issue is that the file originally had 240 resolution. When I retrieve the file from the Simulator's documents directory, it now has 72 resolution. How can I save it at the same resolution it was loaded as? Her...
Introducción web2py[web2py] es un marco de código abierto para el desarrollo ágil de aplicaciones web seguras conectadas a servicios de bases de datos; está programado en Python[python] y es programable en Python. web2py es un marco de desarrollo completamente integrado, es decir, contiene todos los componentes que nec...
要搭建SAE Python 的本地运行环境还是有点麻烦,相对GAE 来说,毕竟SAE 刚内测一个多月。下面简单说一下Window 下搭建的过程。 环境需求 比如我想用tornado + Mysql 下载安装 官方说是确保python 版本是 2.6(2.5不行,我的用2.7也可以) 打开官方的安装文档 https://github.com/SAEPython/saepythondevguide 或者点这直接下载压缩包 解压,打开dev_server 目录, 按你的需求修改 setup.py,我用tornado 就修改如下 install_requires = [ 'Werkzeug', #'Djan...
I was just testing the speed of different string concatenation/substitution methods out of curiosity. A google search on the subject brought me here. I thought I would post my test results in the hope that it might help someone decide. import timeit def percent_(): return "test %s, with number %s" % (1,...
Selected ramblings of a geospatial tech nerd Best bang for your analytical buck As (geo)data scientists, we spend much of our time working with data models that try (with varying degrees of success) to capture some essential truth about the world while still being as simple as possible to provide a useful abstraction. ...
I think this might be a good job for paste. plot "<paste A B" u 1:($2-$4) w points #whatever line style you want... #xA #yA-yB For the file where xA != xB, I'm a little unclear whether you want to plot only the set of points with are common to both (the intersection of the two sets) or whether you wa...
I have been struggling to find examples on void* example in JNA. I am trying to understand how to use Pointer in JNA. For example IN C : int PTOsetApiOpt(int iOpt,void* lpValue,int iLen) Parameters: iOpt: int lpData: address from which data should be read. iLen: length of data returns int values : 0 as success or -1 as...
I recently installed the hg tip version of Ropemacs and I'd like to use it when editing remote files using TRAMP. Has anyone done this? When I try to use M-/ to complete a variable name, I am asked to enter the Rope project root folder and I enter: /ssh:myhost:/path/to/myproject/ and it gives me the following error: Op...
With respect to Python, I am somewhat shocked at some of the other answers. This is what Andrew Kuchling (Python Functional Programming HOWTO) says: The designers of some computer languages choose to emphasize one particular approach to programming. This often makes it difficult to write programs that use a diffe...
solved this simply by using potrace instead of autotrace. for reference, these are the steps: convert bitmap to svg (linux command line): potrace -s sourceimg.bmp use svg as glyph (python): import fontforge font = fontforge.open('blank.sfd') glyph = font.createMappedChar('A') glyph.importOutlines('sourceimg.svg') font....
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... ~20 users here now News and links for Django developers. Beginner question about CDNs (self.django) submitted 2 mont...
open source pywurfl is a Python language package that makes dealing with the WURFL in Python a little easier. It contains tools that allow you to retrieve objects that represent devices defined in the WURFL or manipulate the WURFL device hierarchy by using a simple set of API functions or a pywurfl specific query langu...
I was working with inheritance in WTForms. I had next class: class MyForm(WTForms): ... def process(self, formdata=formdata, obj=None): super(self.__class__, self).process(formdata=formdata, obj=obj) And I had error (not always, but in some cases with similar forms - it is even more strange): Maximum r...
I am having an odd issue with Django generic foreign keys where the generic field will not stick if I assign it using the constructor. It will only stick post-construction. I cannot find any information on this, so I'm creating a new question on this. Any ideas why this is occurring? Below is my class class Answer(mode...
I have a class and it's modelForm. class UserGoal(models.Model): user = models.ForeignKey(User) goal = models.ForeignKey(Goal) deadline = models.DateTimeField(blank=True, null=True) goalETA = models.DateTimeField(blank=True, null=True) def __unicode__(self): return u'%s, %s, %s ' %(self.user...
I have attempted to encode the string 'الله', but when I decoded it all I got was '????'. Base64 converts Of course they can. It depends on how your language or Base64 routine handles Unicode input. For example, Python's Python 2.5.1 (r251:54863, Jul 31 2008, 22:53:39) [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2 ...
This is a dirty/untested theoretical implementation using jQuery/Django. We're going to assume the voting up and down is for questions/answers like on this site, but that can obviously be adjusted to your real life use case. The template <div id="answer_595" class="answer"> <img src="vote_up.png" class="vote up"> <...
in azure solution: 1 refactor in test project doesn't find all from impl project in test_tableservice.py, refactor-rename TableService from the following code: class TableServiceTest(AzureTestCase): def setUp(self): self.tc = TableService(account_name=credentials.getStorageServicesName(), ...
Another interesting problem I stumbled across on reddit is finding the longest substring of a given string that is a palindrome. I found the explanation on Johan Jeuring's blog somewhat confusing and I had to spend some time poring over the Haskell code (eventually rewriting it in Python) and walking through examples b...
Dernière news : Fedora-Fr aux 15èmes Rencontres Mondiales du Logiciel Libre Bonjour, Je m'arrache les cheveux depuis quelques jours avec Apache et les hôtes virtuels. J'ai configuré un hôte virtuel comme indiqué dans la documentation: sites.conf # Activation des hôtes virtuels NameVirtualHost *:80 # Hôte virtuel par dé...
I'm following the Flask-SQLAlchemy tutorial. I have Flask 0.9, sqlalchemy 0.7.8 and flask-sqlalchemy 0.16 on python 2.6. I'm trying to create a "one to many" relationship, like in their tutorial. class Person(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(50)) addresses =...
Le Farfadet Spatial Re : Petit guide pour aider au choix d'un langage Salut à tous ! Sur amazon, j'ai trouvé ce livre "Python - Les Fondamentaux du langage - La Programmation pour les scientifiques. de Matthieu Brucher" Très bon livre, dans la mesure où tu sais déjà programmer et que tu es intéressé par la partie scien...
I'm trying to use Django's Paginator with CouchDB. The below code will successfully retrieve the docs/records from Couch. However, the problem is that it's returning all records; not the 5 per set that I want. Am I making a mistake somewhere, or is Django's Paginator not compatible with Couch? def content_queue(request...
XML-RPC in Python by Dave Warner 11/22/2000 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 communica...
This question already has an answer here: I have a list [1,2,3,4,5,6,7,8] I want to convert this as [[1,2,3,4][5,6,7,8]] in python. Can somebody help me with this This question already has an answer here: To take an input: def chunks(l, n): return [l[i:i+n] for i in range(0, len(l), n)] mylist = [1,2,3,4,5,6,7,8] w...
Im getting strangest error in django so far: 'if' statement improperly formatted Template that raises the error is this: {% if diff >= 0 %} <span class="pos">+{{ diff }} {% else %} <span class="neg">-{{ diff }} {% endif %} </span> <span>{{ a }}</span> view that has a and diff in context is this: def add(request, kaar...
Why don't you just use dic.get('b', 'b') Sure, you can subclass dict as others point out, but I find it handy to remind myself every once in a while that get can have a default value! If you want to have a go at the defaultdict, try this: dic = defaultdict() dic.__missing__ = lambda key: key dic['b'] # should set dic[...
An Introduction to GraphViz and dot Pages: 1, 2 Basic Concepts of dot A generic dot graph is composed of nodes and edges. Our hello.dot example contains a single node and no edges. Edges enter in the game when there are relationships between nodes, for instance hierarchical relationships as in this example, which produ...
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...
when I run the program from the command line I get no errors and it seems to execute, but nothing happens! I'm ready to stab my eyes out from staring at code for so long. I just want this to work so I can turn it in and be done with this assignment. The program is supposed to run as follows. python bulk.py (directory n...
Handling with specific rows or columns in Jitter matrix? Hi, I am new to Jitter and I would be really grateful for any help… All the questions are about Jitter matrix: 1. Is it possible to do any math operations on a specific column or row without having to deal with every single cell? 2. Is it possible to swap specifi...
Yes. Learn Python. I find I build functionality around five times as fast in Python as in C# or VB.NET. There's simply less typing and hassle to it. Enough about productivity: let's talk about fun. Python lets you play with dynamic typing, functional programming techniques (hello, generator comprehensions!) and brain-b...
Akamine Impossible d'accéder au menu "Pilotes additionnels" Bonjour, J'ai récemment installé Steam pour Linux. Sur le wiki associé ils demandent des mises à jour des pilotes additionnels, seulement impossible d'accéder au menu "Pilotes additionnels", Ubuntu rencontre une erreur que ce soit après plusieurs reboot, avec ...
I just watched this video: https://www.youtube.com/watch?v=Fk02TW6reiA It shows a formula to calculate an answer for the following problem: There are 2 customers expected every 3 minutes in a store Therefore there are 6 customers expected every 9 minutes What is the likelihood of there being 4 or less in the store in 9...
Hi all, new here i have this python function def gtest(request): p = request.POST print p g = p['information'] print g to_json = { "key1": "value1", "key2": "value2" } jsonValidateReturn = simplejson.dumps({"jsonValidateReturn": "ddddd"}) return HttpResponse(jsonValidateRe...
I store some data in files which follow this naming convention: /interesting/data/filename-YYYY-MM-DD-HH-MM How do I look for the ones with date in file name < now - 1 month and delete them? Files may have changed since they were created, so searching according to last modification date is not good. What I'm doing now...
[UPDATE 16 Aug 2011]Armin Ronacher has written a nice module called unicode-nazi that provides the Unicode warnings I discuss at the end of this article. Though I can't use Python 3 for any of my projects, it does have a few nice things. One particular behaviour where it improves on Python 2 is forbidding implicit conv...
Calling Haskell from C appears quite easy, and thus can also be easily called from Java with JavaCPP. For example, to call the fibonacci_hs() function from the sample code Safe.hs: {-# LANGUAGE ForeignFunctionInterface #-} module Safe where import Foreign.C.Types fibonacci :: Int -> Int fibonacci n = fibs !! n wher...
I have a class: class Foo: def __init__(self, a, b): self.a = a self.b = b Where a is a float and b is a tuple containing a position in Cartesian coordinates. Let's say a = Foo(1.23, (1, 2)). What I want to do is make it so that if we do a + 4.56 or 7.89 - a or whatever, that it evaluates a to be a...
mars Connaissances de base pour Kubuntu Bienvenue à tous les lecteurs. Ce sujet a pour but d'apporter les connaissances de base à toute personne débutant sous Kubuntu. Il est très bon pour tout débutant de lire ce post, mais il est aussi très conseillé aux personnes plus expérimenté, car il contiendra des conseils de b...
I want to implement a symbol type, which keeps track of the symbols we already have(saved in _sym_table), and return them if they exist, or create new ones otherwise. The code: # -*- coding: utf-8 -*- _sym_table = {} class Symbol(object): def __new__(cls, sym): if sym not in _sym_table: return s...
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...
Morse Code on an LED Difficulty: beginner This tutorial will guide you through safely connecting up an LED to your Raspberry Pi and being able to turn it on and off from Python. Then you will write a program to take input from the keyboard and send it out in Morse code from the LED. REQUIREMENTS: INSTRUCTIONS: If you a...
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... ~17 users here now News and links for Django developers. Setting up mysql database with Django (self.django) submitt...
joko Re : Qarte arte.tv browser (ex Qarte+7) bonjour, grands compliments à VinsS et consors, vraiment épaté. bravo à tous les p'tits fouineurs ! qualité vidéo géniale, rien à voir avec celle du site d'arte +7 !!! Dernière modification par joko (Le 06/11/2012, à 12:35) Je suis un homme, quoi de plus naturel en somme ? l...
I create a database in mysql and use webpy to construct my web server. But it's so strange for Chinese character between the webpy's and MySQLdb's behaviors when using them to access database respectively. Below is my problem: My table t_test (utf8 databse): id name1 测试 the utf8 code for "测试" is: \xe6\xb5\x8b\x...
This article extends my discussion of advancedprogramming, but strays into an area that is not exclusively objectoriented. What we are interested in for this installment is ways ofwriting programs that are declarative rather thanimperative. In many cases, simply notating facts is more conciseand less error prone than p...
If a site uses .htaccess file to rewrite the URL for e.g. better SEO. Is it possible to find out what is the "real" URL? This is not possible unless you know the rewrite rule. In some cases direct access the "real" file is forbidden entirely. Other than that you could try using DirBuster with a custom directory list, s...
Following this example, I've created a little hello.pyd library file, the contents of which are at the end of this question. When I enter python interpreter I get the following: D:\test\build\lib.win32-2.6>C:\Python26\python.exe Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)] on win32 Type ...
I'm an experienced TCL developer and write my own procedures to help myself along. i.e. a proc i call putsVar, it prints out the value of the variable in a definitave format, so I know which variable it is and what the value is "set foo 1 ; putsVar foo" Result 'foo="1"' I'd like to do the same kind of thing in python, ...
Tabla de contenidos PyGTK 2.0 es un conjunto de módulos que componen una interfaz Python para GTK+ 2.0. En el resto de este documento cuando se menciona PyGTK se trata de la versión 2.0 o posterior de PyGTK, y en el caso de GTK+, también a su versión 2.0 y siguientes. El sitio web de referencia sobre PyGTK es www.pygtk...
Short answer The character class for all arabic digits and latin letters is: [0-9A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02af\u1d00-\u1d25\u1d62-\u1d65\u1d6b-\u1d77\u1d79-\u1d9a\u1e00-\u1eff\u2090-\u2094\u2184-\u2184\u2488-\u2490\u271d-\u271d\u2c60-\u2c7c\u2c7e-\u2c7f\ua722-\ua76f\ua771-\ua787\ua78b-\ua78c\ua7fb-\ua7f...
I'm trying to build a simple API with the bottle.py (Bottle v0.11.4) web framework. To 'daemonize' the app on my server (Ubuntu 10.04.4), I'm running the shell nohup python test.py & , where test.py is the following python script: import sys import bottle from bottle import route, run, request, response, abort, hook @h...
Do I need any special kind of software to view the responses I get after requesting something? Like with Klout for example, I can get all the code returned as I need it, I just don't know where to put it. Is it because I'm missing a soiftware program or something? Most of the Stack Exchange API can be accessed via simp...
I had something different in mind, that is, like this: all(x in a for x in b) and all(x in b for x in a) This checks if all letters in a occur in b, and all letters of b occur in a. This means that they 'match' if a and b are sets. But since there was already a good answer, I decided to do a speed comparison, and it t...
The decode method of unicode strings really doesn't have any applications at all (unless you have some non-text data in a unicode string for some reason -- see below). It is mainly there for historical reasons, i think. In Python 3 it is completely gone. unicode().decode() will perform an implicit encoding of s using t...
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...
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 ...
toma222 [HOW TO] adesklets : configuration des desklets Il existe désormais un article sur le wiki concernant Adesklets donc je vous conseille de vous y fier, ce tutoriel n'étant plus mis à jour. J'ouvre ce deuxième post au sujet de adesklets, afin de permettre une meilleure lisibilité de l'ensemble.Celui-ci a donc pou...
Textpattern Forum Re: adi_matrix – Multi-article update tabs Hi Adi:) After installing I get this in extensions>adi_matrix Warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE Field = 'article_image'' at line 1 SHOW FIELDS ...
Components and plugins Components and plugins are relatively new features of web2py, and there is some disagreement between developers about what they are and what they should be. Most of the confusion stems from the different uses of these terms in other software projects and from the fact that developers are still wo...
When I use QFTP's put command to upload a file it only uploads around 40 bytes of the specified file. I'm catching the dataProgress signal and I'm getting the progress but the total size of the file is only read to be around 40 bytes. Is there anything wrong with my code, or is it a problem on the FTP server's side? He...
After 10 minutes of work I have written a function presented below. It returns a list of all primes lower than an argument. I have used all known for me programing and mathematical tricks in order to make this function as fast as possible. To find all the primes lower than a million it takes about 2 seconds. Do you see...
If you care about getting correct spelling of musical notes, you're going to need a more sophisticated approach. For instance, your F# major scale will read [F#, G#, A#, B, C#, D#, F], when what you really want is E# for the leading tone. Similarly, if you care about spelling, you'll need to implement flats as well. If...
I have an apache webserver which I have setup a website using flask using mod_wsgi. I am having a couple of issues which may or may not be related. With every call to a certain page (which runs a function performing heavy computation that takes over 2 seconds), the memory increases about 20 megabytes. My server starts ...
I shall try to explain in the perspective of pre-django 1.5 The django's auth models provides a set of "convenience" methods like login, logout, password reset, etc for you which work seamlessly. It is a very common scenario to have more fields - so One approach would be to create a userprofile model, which either inhe...
I'm using python, django and google app engine and I'm getting the error below. However, bookdescription is a TextProperty not a StringProperty so I don't understand why the multi-line error is happening. The error is intermittent, sometimes the page will render fine, sometimes not. I'm new to coding so any and all hel...
I need to get all text files with numeric names: 1.txt, 2.txt, 13.txt Is it possible to do with glob? import glob for file in glob.glob('[0-9].txt'): print(file) Does not return 13.txt. And there seems to be no regex's one or more + operator. What can I do?
To explain why your script isn't working right now, I'll rename the variable unsorted to sorted. At first, your list isn't yet sorted. Of course, we set sorted to False. As soon as we start the while loop, we assume that the list is already sorted. The idea is this: as soon as we find two elements that are not in the r...
My understanding was that python strings are immutable. I tried the following code: a = "Dog" b = "eats" c = "treats" print a, b, c # Dog eats treats print a + " " + b + " " + c # Dog eats treats print a # Dog a = a + " " + b + " " + c print a # Dog eats treats # !!! Shouldn't python prevented the assignment? I am pr...
Meerkat: The XML-RPC Interface by Rael Dornfest 11/14/2000 Editor's note: Meerkat predated the popularity of syndication, feed services, and feed readers. Now that other groups are providing this service, we have removed Meerkat in favor of their better solutions. We maintain these articles for the sense of historical ...
Tales of Rescuing Old Hardware by Mikhail Zakharov 05/05/2005 Everything began one fine day when I visited our storage room to see if there was anything interesting for me to look at. Soon I came across an old shabby dark-gray Toshiba notebook thrown there amidst different computer rubbish long ago, from the time when ...
Are there unforeseen problems in mixing different types in a Python list? For example: import random data = [["name1", "long name1", 1, 2, 3], ["name2", "long name2", 5, 6, 7]] name, long_name, int1, int2, int3 = random.choice(data) I'm using this code to randomly set several related parameters within a functi...
I want to suppress warning. But the following code does not suppress warnings. import rpy2.robjects as robjects kstest=robjects.r['ks.test'] suppressWarnings=robjects.r['suppressWarnings'] x=robjects.IntVector([1, 2, 3]) y=robjects.IntVector([1, 2, 4, 5]) result=suppressWarnings(kstest(x, y)) print result print result[...
In lazy programming languages, you can have recursion that doesn't define an end point. The result could be an infinite data structure, but that's OK as long as you don't try to use all of it. For example, a common way to define the entire fibonacci series in Haskell is this: fibS = 1:1: zipWith (+) fibS (tail fibS) T...