text stringlengths 256 65.5k |
|---|
You can use the db.rename_column function.
class Migration:
def forwards(self, orm):
# Rename 'name' field to 'full_name'
db.rename_column('app_foo', 'name', 'full_name')
def backwards(self, orm):
# Rename 'full_name' field to 'name'
db.rename_column('app_foo', 'full_name', 'name... |
I have a dictionary of keys like A1-A15, B1-B15 etc. Running dictionary.keys().sort() results in A1, A10, A11 ...
def sort_keys(dictionary):
keys = dictionary.keys()
keys.sort()
return map(dictionary.get, keys)
How do I sort it so that they get in the right order, ie A1, A2, A3 ... ? |
Mike Yavel
Blender
Suite à mon passage sous Ubuntu HH et à diverses mises à jour, je n'arrive plus à lancer Blender. Pour résoudre le problème, je suis allé sous Synaptic et j'ai sélectionné Blender pour une désinstallation complète. Puis, j'ai essayé de le ré-installé mais j'avais oublié qu'il fallait faire un sodo ap... |
I am a newbie. So starting to learn python, I tried to generate random values by passing in a negative and positive number.
Let say -1, 1. Can someone let me know how I should do this in python.
Thanks in advance
>>> import random
>>> random.uniform(-1, 1)
0.4779007751444888
>>> random.uniform(-1, 1)
-0.100285817105749... |
Python 3.2 in case that matters...
The following code shows that the "concrete class" can either implement some_method as a static method or an instance method:
import abc
class SomeAbstractClass(metaclass=abc.ABCMeta):
@abc.abstractmethod
def some_method(self): pass
class ValidConcreteClass1(SomeAbstractClass)... |
After you've made your .scheme or .schemedef file (see Add Support for Your Language) there's still something missing from that authentic professional feeling when programming with your newly defined language. For that you need to create an auto-indenter.
Please note: You need to have PyPN installed for this to work! S... |
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 ... |
Extensions
firebird_fdw 0.2.3
A PostgreSQL foreign data wrapper (FDW) for Firebird
README
Contents
Firebird Foreign Data Wrapper for PostgreSQL
This is an experimental foreign data wrapper (FDW) to connect PostgreSQL to Firebird. It provides basic functionality, including both read (SELECT) and write (INSERT/UPDATE/DEL... |
I created a simple program using a glade .xml file and it, whenever I run the program, it crashes!
Here's the Python code:
#!/usr/bin/env python
import pygtk
pygtk.require("2.0")
import gtk
class TutorialApp(object):
def __init__(self):
builder = gtk.Builder()
builder.add_from_file("tutorial.xml")
... |
I have not been able to install Pymunk and Pygame for the same version of python. I have tried binaries, source installs, fink, and Macports, for system python, python 2.6, and python 2.7, with 32 and 64 bit versions.
In some cases the pymunk unit tests cause a segmentation fault, in some cases I get symptoms similar t... |
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. ... |
JavaScript
juhusoldat — 2010-03-15T10:43:57-04:00 — #1
Hi!
Im making a little picture presentation and i have currently this working code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Pilt</title>
... |
PyPN is an extension that allows you to use Python to script almost anything in PN. This can be simple text formatting, or complex macros for automation.
See Install PyPN for installation instructions.
After PyPN is installed, go to View > Window > Scripts (or press Alt+F10). You should be able to see the Scripts menu,... |
The only way I can find would require you to write a bit of Python code.
This is the site that provides a module for Pythonhttp://code.google.com/p/pygooglevoice/
This page gives you details on how to set a message to read. Look for the Mark function under the Message section.sphinxdoc. github.com/pygooglevoice/api.htm... |
By default web2py stores tickets (errors) on the local file system. This is because most of the tickets are caused by database failures. Anyway You can move the tickets to a database by creating a script like:
import os, time, stat, datetime
from gluon.restricted import RestrictedErro()
db=SQLDB('postgres....')
db.defi... |
I have the following code that fails to display object images. But displays normal images fine.
My Model
class News(models.Model):
title-----------
image = models.ImageField(upload_to='images')
body------------
Template tag coding
from django import template
register = template.Library()
from ----.models import ---
de... |
I'm having a issue when using pydev for testing where my tests keep hanging. I've dug into the issue and know what the root cause is. I've provided samples of the code below that can be used to reproduce the issue.
I'm mainly testing on Centos 6.3, python 2.7, eclipse juno, pydev 2.7.1, however the issue also occours o... |
This is only my second day of learning Python 3.3 so I admit I have a lot to learn.
In short, I have two lists: List1 is full of odd numbers, List2 is full of even numbers. They are the same length (each has five numbers).
I want to create List4 that contains [1,2,3,4,5,6,â¦] by combining each element of List1 with th... |
I'm having some difficulties with AjaxForm file upload and the app engine blobstore. I suspect the difficulty is because the blobstore upload handler (subclass of blobstore_handlers.BlobstoreUploadHandler) mandates a redirect response, rather than returning any content, but I'm not sure. I'm expecting to get an XML doc... |
pilepoil
Asus X59SL problème accès internet (seulement Google, BNP)
Salut,
J'ai depuis peu de temps le Asus X59SL.
J'ai mis un double boot Ubuntu et Vista.
Sous Vista, pas de soucis d'accès à internet.
Sous Ubuntu 8.10 64 bits, j'ai accès uniquement à Google et à BNP (et peut être d'autres, mais pas nombreux).
J'ai fai... |
I’ve shown how you can grab data from SPSS and use it in Python commands, and I figured a post about the opposite process (taking data in Python and turning it into an SPSS data file) would be useful. A few different motivating examples are:
Creating a set of permutations using the itertools Python library (see 1 and 2... |
[SOLVED - Provided example contains the answer!] I am trying to implement a program which is started in fullscreen and does not allow any userinput (wether mouse nor keyboard) because it just reacts on UDEV-Signals, when a usb-stick or cd is inserted. I want to prevent, that a user puts in a keyboard / mouse and does s... |
I've implemented full-text search using pg_search gem for my Rails application
My migration to create index looks like
execute(<<-'eosql'.strip)
CREATE index mytable_fts_idx
ON mytable
USING gin(
(setweight(to_tsvector('english', coalesce("mytable"."name", '')), 'A') ||
' ' ||
setweight(to_tsvector('e... |
If you just want the strings:
print("\n".join(element for element, count in c.most_common(10)))
If you want the strings and the counts printed in the form ('foo', 11):
print ("\n".join(str(element_and_count)
for element_and_count in c.most_common(10)))
If you want the strings and counts in some other format o... |
Ok here's the story. I save big float numbers in an xml file. for example 0.016780745002189634. Numbers are saved correctly in file but when i parse the xml and i read them , some of them , (i pressume the largest ones) sax breaks them into two different numbers. Like: 0.016780 and 745002189634 . I am using utf-8 encod... |
In Python 2, a common (old, legacy) idiom is to use map to join iterators of uneven length using the form map(None,iter,iter,...) like so:
>>> map(None,xrange(5),xrange(10,12))
[(0, 10), (1, 11), (2, None), (3, None), (4, None)]
In Python 2, it is extended so that the longest iterator is the length of the returned lis... |
This is a simple python wsgi server that prints out Hello guys!!! on 0.0.0.0:8080.
from wsgiref.simple_server import make_server
content = 'Hello guys!!!'
def application(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/plain')])
return [content]
server = make_server('0.0.0.0', 8080, a... |
I am using urllib2 to post data to a form. The problem is that the form replies with a 302 redirect. According to Python HTTPRedirectHandler the redirect handler will take the request and convert it from POST to GET and follow the 301 or 302. I would like to preserve the POST method and the data passed to the opener. I... |
I installed Python 2.6.2 earlier on a Windows XP machine and run the following code:
import urllib2
import urllib
page = urllib2.Request('http://www.python.org/fish.html')
urllib2.urlopen( page )
I get the following error.
Traceback (most recent call last):<br>
File "C:\Python26\test3.py", line 6, in <module><br>
... |
I m trying to generate heatmaps for the some data. I need the positive to have a gradient of blue and negative a gradient of red.
import matplotlib.pyplot as plt
import numpy as np
arr = array([[ 2.155, 3.093, -5.377, 7.973, 6.564, 6.348, 10.279,
1.536],
[ 0.355, -2.848, 0.65 , 6.877, 1.08 ,... |
I'm trying to read from a PS3 controller in python on Ubuntu and I'm not having much luck. I started with the ps3joy driver from Willow Garage (http://www.ros.org/wiki/ps3joy) which supposedly publishes all the important bits of the PS3 controller to something I had never heard of called "uinput". Apparently it's a lin... |
Emesene is an instant messenger for the WLM (Windows Live Messenger) network which works on both Windows and Linux.
Emesene 1.5 brings a lot of new features and bugfixes, most notable being the webcam (video) support. Changes in 1.5:
* Compatible with the latest Window Live Messenger(tm)
* New plugin set (Plus! colors,... |
I am trying to write a function to post form data and save returned cookie info in a file so that the next time the page is visited, the cookie information is sent to the server (i.e. normal browser behavior).
I wrote this relatively easily in C++ using curlib, but have spent almost an entire day trying to write this i... |
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... |
Summary
AsyncIO is the new hot topic for Python 3.4 which was just recently released. In my opinion, AsyncIO is a big game changer for Python. Where it makes sense, many libraries are sure to port some or all of their code to take advantage of it. I'm going to show you my version of a client and server I wrote after di... |
ADcomp
Re : ADesk Bar : Barre de lancement rapide [python/gtk/cairo]
Yep ..
@ all : lien pour les sources rectifié ( )
@ frafa :
-add n'importe quoi, puis fermer fenetre sans ajout, ajoute quand meme une entrée vide. tu devrait gerer ca...
+1
-et si pas trop galere a coder avoir acces aux reglages d'un plug-in via clic... |
I'd like to generate matrices of size mxn and rank r, with elements coming from a specified finite set, e.g. {0,1} or {1,2,3,4,5}. I want them to be "random" in some very loose sense of that word, i.e. I want to get a variety of possible outputs from the algorithm with distribution vaguely similar to the distribution o... |
I have produced a Python script which creates multiple buffers of specific (listed) featureclasses within a geodatabase. This is achieved by running each feature through a for loop.
I would like to know if/how it would be possible to list featureclasses from more than one geodatabase?
Currently I am using env.workspace... |
Possible Duplicate:
Hyperref warning - Token not allowed in a PDF string
The following code:
\subsection{The classes $\mathcal{L}(\gamma)$}
generates the errors:
Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref) removing `math shift' on input line 1938.
Package hyp... |
I've got a model like this:
class Talk(BaseModel):
title = models.CharField(max_length=200)
mp3 = models.FileField(upload_to = u'talks/', max_length=200)
seconds = models.IntegerField(blank = True, null = True)
I want to validate before saving that the uploaded file is an MP3, like this:
def... |
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... |
I implemented a FTP Server in Python using pyftpdlib.ftpserver
This works fine with mput/put operations but fails with mget/get. Following exception is thrown:
[]10.203.200.136:62408 Connected. 10.203.200.136:62408 ==> 220 pyftpdlib 0.5.2 ready. 10.203.200.136:62408 <== USER user 10.203.200.136:62408 ==> 331 Username ... |
July 21st, 2009 at 6:30 pm by Dr. Drang
Update 9/21/09
While all the logic and thinking behind the scripts in this post is still true, the scripts themselves have been updated. I’ve put everything in a GitHub repository to make it easy to download all at once.
For years I’ve been recording BBC Radio 2’s music shows wit... |
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... |
doudoulolita
Re : Faire une animation sur la création de jeux vidéo libres
Bibliographie:
- La 3D libre avec Blender d'Olivier Saraja - ed Eyrolles - 35 € pour la 1ère édition. Disponible à la FNAC ou chez Eyrolles pour la 4ème édition.
- Blender, Créez des animations 3D de Marie-France et Jean-Michel Soler - ed. Pears... |
A quick performance test showing Lutz's solution is the best:
import time
def speed_test(func):
def wrapper(*args, **kwargs):
t1 = time.time()
for x in xrange(5000):
results = func(*args, **kwargs)
t2 = time.time()
print '%s took %0.3f ms' % (func.func_name, (t2-t1)*1000.... |
Implementing Tagging in a Django Application
my motivation
Although I’ve used many Web based applications that employ tagging, I’ve yet to create an application of my own with this feature. But now, I have two potential projects on the horizon that could benefit from tagging, and I’m thinking about how to best implemen... |
Is there a way to add a show desktop button in Tint2?
Offline
You can't really add a button to tint2, but you can tweak openbox to show desktop when you double-click the desktop. This is how I do it:
<mousebind action="DoubleClick" button="Left"> <action name="ToggleShowDesktop"/></mousebind>
add this after the followi... |
Using instruction I try to connect Python + uWSGI.
I made default project in a folder /home/sanya/django/pasteurl.However, have opened it in a browser I get
uWSGI Errorwsgi application not found
Logs contain the following:
binding on TCP port: 9001
your server socket listen backlog is limited to 64 connections
added /h... |
Using regular expressions!
>>> import re
>>> s = "ABCDXYv"
>>> re.findall(r'.{1,2}',s,re.DOTALL)
['AB', 'CD', 'XY', 'v']
I know it has been a while, but I came back to this and was curious about which method was better; mine: r'.{1,2}' or Jon's r'..?'. On the surface, Jon's looks much nicer, and I thought it would be ... |
I was saving a piece of work I had worked on for 2 hours.
After I saved it my computer shut off when I got it back up and running I try to open my drawing and this happens.
Traceback (most recent call last): File
"/usr/share/mypaint/gui/filehandling.py", line 306,
open_cb(self=<gui.filehandling.FileHandler object>,... |
Recently I have been trying to learn WebPy and when attempting to use a template in the tutorial (http://webpy.org/docs/0.3/tutorial) I come across this error when trying to access the page.
File "/Library/Python/2.7/site-packages/web.py-0.37-py2.7.egg/web/application.py", line 239, in process
return self.handle()
File... |
I need to extract data from HTML-files. The files in question are, most likely, automatically generated. I have uploaded the code of one of these files to Pastebin: http://pastebin.com/9Nj2Edfv. This is the link to the actual page: http://eur-lex.europa.eu/Notice.do?checktexts=checkbox&val=60504%3Acs&pos=1&page=1&lang=... |
Gemnoc
Re : Logiciel de CAO 2D/3D (Conception Mecanique)
Une autre demande pour Ellypsis, pourrais-tu démarrer FreeCAD de cette façon dans le terminal :
freecad --write-log
Ceci va enregistrer un fichier journal FreeCAD.log dans le dossier ~/.FreeCAD, ouvres-le et postes le contenu ici.
J'ai testé rapidement le Sketch... |
I have a list and want to pass thru django raw sql.
Here is my list
region = ['US','CA','UK']
I am pasting a part of raw sql here.
results = MMCode.objects.raw('select assigner, assignee from mm_code where date between %s and %s and country_code in %s',[fromdate,todate,region])
Now it gives the below error, when i exec... |
I need to write a function that takes an original list of unique values and a resulting list:
[0,1,2,3][0,3,1,2]
and detect that only a single element was moved then report exactly what was moved where. If the resulting list is not the result of moving exactly one item from source to destination, this code should fail.... |
jbfabin
mise à jour / téléchargement des paquets impossibles
Bonjour, quand je veux mettre à jour mon système, j'obtiens le message :"le téléchargement des informations du dépot a échoué".
si quelqu'un peut m'aider, je lui serai reconnaissant.
PS : au terminal, j'obtiens ces messages :
W: Impossible de récupérer http:/... |
corgx
questions de newbie
J'ai plusieurs questions à propos de l'installation de fichiers dans ubuntu et j'ai décidé de les poser ici car ça concerne principalement les lecteurs:
-Je n'ai pas compris comment foctionne synaptic: les paquets qu'il propose sont-ils stockés sur mon ordinateur où il les télécharge avant de ... |
Is there a way to find out if the user has entered any data in the terminal window without having to use the blocking stdin.
I am implementing a chat client using twisted python and the client code should display messages from other connected clients. As soon as the client enters a message and hits enter, i want it to ... |
michcauch
my-weather-indicator ne fonctionne plus après mise à jour
my-weather-indicator ne fonctionne plus, juste après une mise à jour de my-weather-indicator sous 12.04. J'ai ce message d'erreur quand je le lance depuis un terminal :
michel@bureau:~$ my-weather-indicator
Traceback (most recent call last):
File "/usr... |
I am looking to discover the best possible practice for building up a file tree inside a GAE/python.
It seems rather efficient to keep everything in one file and route everything there via WSGI.
Though for a complex and multifaceted site it makes sense to have distinct files serving different purposes.
I ran into some ... |
Maybe I miss-understand the question, but can't you just do this (python 2.7.1)?
test file:
"""
DOC STRING!!
"""
def hello():
'doc string'
print 'hello'
hello()
Interactive session:
>>> M = ast.parse(''.join(open('test.py')))
>>> ast.get_docstring(M)
'DOC STRING!!'
You can also walk through the ast, looking f... |
I have to integrate my application with an existing (not modifiable) Python script which sends the JSON messages without '\0' or any other "end-of-message" character. Is there any better way to handle incoming messages that just to read data from the socket byte after byte and count brackets? In this application sendin... |
I have the following class hierarchy in Django, using multi-table inheritance:
class Vehicle(models.Model):
name = models.CharField(blank=True)
class Car(Vehicle):
color = models.CharField(blank=True)
As I use multi-table inheritance, at the database level, there two database tables, one for Vehicle and another ... |
Edit: Since it appears that there's either no solution, or I'm doing something so non-standard that nobody knows - I'll revise my question to also ask: What is the best way to accomplish logging when a python app is making a lot of system calls?
My app has two modes. In interactive mode, I want all output to go to the ... |
I'm using App Engine with Python. In order to store the images of my users, I write them directly to the blobstore as indicated in Google documentation.
My code is below:
# Image insertion in the blobstore
file_name = files.blobstore.create(mime_type='image/jpeg')
with files.open(file_name, 'a') as f:
f.write(self.... |
I'm working on using gevent and tornado inside the same application so that libraries that doesn't support tornado's ioloop can be subdued to use gevent to act asynchronously. I thought I'd need to run two real systems threads, one dedicated to Tornado's ioloop and another dedicated to gevent's loop. However, trying to... |
I need to do some HTML parsing with python. After some research lxml seems to be my best choice but I am having a hard time finding examples that help me with what I am trying to do. this is why i am hear. I need to scrape a page for all of its viewable text.. strip out all tags and javascript.. I need it to leave me w... |
The goal of my test is to assert that a popup does not appear after certain actions. Previously to test if the popup exist, i have used exception handling.
try:
self.driver.find_element_by_id("fancybox-close").click()
except Exception ('ElementNotVisibleException'):
print "No popup"
This works fine for the tes... |
I have periodic data with the index being a floating point number like so:
time = [0, 0.1, 0.21, 0.31, 0.40, 0.49, 0.51, 0.6, 0.71, 0.82, 0.93]
voltage = [1, -1, 1.1, -0.9, 1, -1, 0.9,-1.2, 0.95, -1.1, 1.11]
df = DataFrame(data=voltage, index=time, columns=['voltage'])
df.plot(marker='o')
I want to create a... |
I've a problem with my Matplotlib graph.
My Programm:
I read sensor data and save it in a csv file with one decimal place (00.0)
after saving I readout the individual data into a list
my list is called tempList and the numbers are float
My Plot:
plt.plot(tempList, color='r', linewidth=2.0)
plt.xticks(range(len(tem... |
I can't read body from POST request on Google app engine application whenever I send string which contains colon ":"
This is my request handler class:
class MessageSync(webapp.RequestHandler):
def post(self):
print self.request.body
Ad this is my testing script:
import httplib2
json_works = '{"works"}'
json_doesnt... |
I just found this answer on the Web:
import unicodedata
def remove_accents(input_str):
nkfd_form = unicodedata.normalize('NFKD', input_str)
only_ascii = nkfd_form.encode('ASCII', 'ignore')
return only_ascii
It works fine (for French, for example), but I think the second step (removing the accents) could be... |
Bioinformatics, the use of computers in biological research, is the newest wrinkle on one of the oldest pursuits--trying to uncover the secret of life. While we may not know all of life's secrets, at the very least computers are helping us understand many of the biological processes that take place inside of living thi... |
grim7reaper
Re : Besoin de conseils pour débuter en python
Merci, cette documentation me semble plutôt complète et complexe pour un débutant python
Complexe, non je ne pense pas.
Du moins ce n’est pas le but.
Outre ce cadre universitaire assez réduit, ce cours s’adresse à toute personne désireuse d’apprendre Python en ... |
I have the following code:
settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'tectcom',
'USER': 'test',
'PASSWORD': '***146***',
'HOST': '',
'PORT': '', ... |
I have Nginx serving my static Django files which is being run on Gunicorn. I am trying to serve MP3 files and get them to have the head 206 so that they will be accepted by Apple for podcasting. At the moment the audio files are in my static directory and are served straight through Nginx. This is the response i get:
... |
According to the Python documentation it has to do with the accuracy of the time function in different operating systems:
The default timer function is platform
dependent. On Windows, time.clock()
has microsecond granularity but
time.time()âs granularity is 1/60th of
a second; on Unix, time.clock() has
1/10... |
Захотелось мне поведать как использовать связь ManyToMany, начал я значит писать пост, но так как я хотел его детализировать то он слишком разросся... И я решил сначала написать пост о том, как создавать первый проект и приложение на Django, чтобы потом ссылаться сюда.
-- начинал я этот пост писать еще в том году, да в... |
I'm currently writing up some basic tests to ensure pages in a medium sized Django application are GETting and POSTing correctly. However, using django.test.client.Client isn't reliably failing when it should be. It returns a 302 response even when there's obviously placed errors in my code.
in my app/urls.py:
url(r'^m... |
PHP
lostty84 — 2013-10-14T07:41:24-04:00 — #1
hello, i have been trying to get a newline in an email, i have tried '\r\
' and i have also tried \
\
, i dont know where i am getting it wrong, and also i included a transaction amount ($tranx_amt) in the email, and it is coming up with 4 decimal places. the markup is belo... |
I'm familiar with the following questions:
It seems that the answers in these questions have the luxury of being able to fiddle with the exact shrinking of the axis so that the legend fits.
Shrinking the axes, however, is not an ideal solution because it makes the data smaller making it actually more difficult to inter... |
Gemnoc
Re : Logiciel de CAO 2D/3D (Conception Mecanique)
Une autre demande pour Ellypsis, pourrais-tu démarrer FreeCAD de cette façon dans le terminal :
freecad --write-log
Ceci va enregistrer un fichier journal FreeCAD.log dans le dossier ~/.FreeCAD, ouvres-le et postes le contenu ici.
J'ai testé rapidement le Sketch... |
The tracker in the lower-right corner (highlighted in red) reports y-values relative to the y-axis on the right.
How can I get the tracker to report y-values relative to the y-axis on the left instead?
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(6)
numdata = 100
t = np.linspace(0.05, 0.11, numdata... |
I need to integrate spell check mechanism in Django application. I found that Haystack has "Spelling Suggestions" method to use it. So I have installed latest dev version(2.0.0 beta) of haysatck with Django(1.4.1).
I have downloaded apache-solr-3.6.0 and configured as like in doc.
schema.xml
./manage.py build_solr_sche... |
g_barthe
interface python et apprentissage boa constrictor
Bonjour,
Je voudrais commencer à developper qq applications (avec interfaces graphiques) en python (pour windows et linux). Je recherche donc un éditeur qui permettrait de realiser l'interface de maniere simple et non en code pur. J'ai bien trouvé "wxglade" mai... |
I am seeing a very unusual behavior in python.. Kindly let me know what am i doing wrong!!
bc = [[0]*(n+1)]*(n+1)
for i in range(n+1):
bc[i][i] = 1
print (bc)
Output
[[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]
I am trying to initialize the diagonal elements of two dimensional array to 1, but it is ini... |
I have a huge list of networks (called A) and I need to check if the addresses of these networks are present in another network list (called B) :
The format of the two lists is the following:
Liste A
1.2.3.4
145.2.3.0/24
6.5.0.0/16
3.4.1.0/24
Liste B
1.5.6.7
10.0.3.0/24
1.2.3.0/24
3.4.0.0/16
Expected result of the in... |
I followed the Haystack tutorial to set up for Whoosh
>>> pip install whoosh
settings.py
import os
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
'PATH': os.path.join(os.path.dirname(__file__), 'whoosh_index'),
},
}
and I am getting an empty lis... |
I have a fairly simple plotting routine that looks like this:
from __future__ import division
import datetime
import matplotlib
matplotlib.use('Agg')
from matplotlib.pyplot import figure, plot, show, legend, close, savefig, rcParams
import numpy
from globalconstants import *
def plotColumns(columnNumbers, t, out, s... |
I'm using GoogleApp Engine and occasionally when I send a query to BigQuery via the JSON API, I will get incorrect results. It is usually only confined to a single table within BigQuery (I make a new table for every batch job that is created). When I run into this issue in production, I log the Query i submitted and tr... |
Pylades
Re : /* Topic des codeurs couche-tard [1] */
It works! \o/
Bon, alors, vous en pensez quoi ? On met le planeur ? Avant le titre ? Après ?
“Any if-statement is a goto. As are all structured loops.
“And sometimes structure is good. When it’s good, you should use it.
“And sometimes structure is _bad_, and gets int... |
I'm a true n00b (amateur, learning Python for fun), so as a programming exercise (to test my newfound knowledge of OAuth and App Engine), I adapted Mike Knapp's OAuth on App Engine code and was able to successfully get a request token and exchange it for an access token from Twitter.
However, when I attempted to do the... |
The following is the simplest code I could come up with that allowed me to position the image at position (0, 0, -10):
#!/usr/bin/env python
import pyglet
from pyglet.gl import *
window = pyglet.window.Window()
glEnable(GL_DEPTH_TEST)
image = pyglet.image.load(... |
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... |
JDMK and Legacy IT Management
by Stephen B. Morris
02/16/2005
Consolidation, integration, refactoring, and migration are some of today's popular data center catchwords. All of these words reflect some kind of renewal or replacement process--the old is either substantially modified or thrown in the garbage and replaced ... |
You must give a presentation tomorrow and you haven't prepared any figures yet; you must document your last project and you need to plot your most hairy class hierarchies; you are asked to provide ten slightly different variations of the same picture; you are pathologically unable to put your finger on a mouse and draw... |
#6 Re : -1 » message d'erreur » Le 13/09/2014, à 04:44
#7 Re : -1 » [RÉSOLU] Supprimer les anciens noyaux » Le 11/09/2014, à 05:46
nesthib
Réponses : 16
Désolé, pas de commande magique.
Mais si :
kernel_clean () {
KEEP=2
KERNELS=($(dpkg -l | awk '/ii linux-image-[0-9]\./{gsub("-generic","",$2); print $2}'))
KERNE... |
This post is a summary of some things I learned trying to understand what the logo above means, after I discovered it on the copyright page of Introducing James Joyce (1942). Introducing is a brief selection of Joyce’s works (including selections from Dubliners, Portrait, Ulysses, and Finnegans Wake) selected and intro... |
leYB
Re : lexmark x2670
Que dit :
ls -l /usr/local/lexmark/lxk08/bin/printdriver
-rwxr-xr-x 1 root bin 63851 2008-11-06 09:47 /usr/local/lexmark/lxk08/bin/printdriver
Hors ligne
leYB
Re : lexmark x2670
En changeant le groupe c'est toujours pareil?
sudo chgrp root /usr/local/lexmark/lxk08/bin/printdriver
Cela donne:
~... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.