text stringlengths 256 65.5k |
|---|
How to declare an array with const size inside of class?
Jul 29, 2013 at 11:16am UTC
I wanted to add that the template argument is needed because its a "special case" but if that doesn't work what would be the next best way to solve this problem. I want to be able to declare the const size of the array outside the clas... |
I wrote the code bellow, but something strange is happening. Some parts of the string substitution with jinga2 are puting the substituted string into 'u( )', this way:
But this is happening only with 3 variables. Here the HTML template:
<!DOCTYPE html>
<html>
<head>
<title>Contract with Python</title>
<style ... |
I'm tring to run a simple scheduled periodic task on a Django app on Heroku using Celery. It works locally and I can watch the task running with:
python manage.py celerybeat
But when I push to heroku and run:
heroku run pythonm manage.py celerybeat
I get:
[2012-08-24 13:31:43,185: WARNING/MainProcess] __ - ... __... |
I was wondering how I would use a batch file or Python to open a random folder from a selection of many folders within a directory?
>>> import random
>>> import os
>>> files = os.listdir('/tmp')
>>> dirs = [f for f in files if os.path.isdir(f)]
>>> random.sample(dirs,1)
['tempdir']
This is how to do it in bash: How ca... |
Asynchronous Programming in Python
Twisted is pretty good. It sits as one of the top networking libraries in Python, and with good reason. It is properly asynchronous, flexible, and mature. But it also has some pretty serious flaws that make it harder than necessary for programmers to use.
This hinders adoption of Twis... |
I have been trying to create a small GUI for a definition-tester program I am making. My GUI needs to look like this:
Word: # label, then entry widgetDefinition: # label, entry widgetPart of Speech: # label, then entry widgetGo Quit # each are buttons
This is what I have so far:
from Tkinter import *
class GetWord:
... |
Every time I create an instance of the TestForm specified below, I have to overwrite the standard id format with auto_id=True. How can this be done once only in the form class instead? Any hints are very welcome.
views.py
from django.forms import ModelForm
from models import Test
class TestForm(ModelForm):
class Me... |
In PHP you can just use $_POST for POST and $_GET for GET (Query string) variables. What's the equivalent in Python?
In PHP you can just use
suppose you're posting a html form with this:
If using raw cgi:
import cgi
form = cgi.FieldStorage()
print form["username"]
print request.GET['username'] # for GET form method
pr... |
I am trying to achieve call Python functions from C++. I thought it could be achieved through function pointers, but it does not seem to be possible. I have been using boost.python to accomplish this.
Say there is a function defined in Python:
def callback(arg1, arg2):
#do something
return something
Now I need... |
I am on a Mac, and I am having libtool linking issues when trying to compile unixODBC for arm7 (for me to use in iOS). I downloaded unixODBC from their website and I use the following script to configure it and make it.
#!/bin/sh
# unset some shell variables
unset CC
unset CFLAGS
unset CPP
# make arm target
export CC=/... |
This is deliberate, since all expressions return something, even if it is only None. You'd see nothing but None in your interpreter.
You can explicitly show the return value with repr() or str(), or by printing (which calls str() on results by default):
>>> y = None
>>> repr(y)
'None'
>>> str(y)
'None'
>>> print repr(y... |
I need to display a piece of HTML only if a variable value appears in a list. I know that Django 1.2 has an 'in' operator. But I am working on a Google App Engine app. Is there a workaround I can use?
You can use your own template tag to achieve it or put it in your controller's logic.
Have a look at this snippet: http... |
Hi I've been trying to create an extension for jinja2 that would join multiple items with a separator, while skipping items (template fragments) that evaluate to whitespace.
There are several of those fragments and you never know in advance which ones will be non-empty and which ones will.
Sounds like a trivial task, b... |
Hello there i have the following code:
path = some destination on your harddrive
def K(path):
try:
getfile = open(path + '/test.txt')
line = getfile.readlines()
print line
getfile.close()
except:
line = getfile.readlines()
eval(line)
d = dict()
val... |
I'm developing a twisted.web server - it consists of some resources that apart from rendering stuff use adbapi to fetch some data and write some data to postgresql database. I'm trying to figoure out how to write a trial unittest that would test resource rendering without using net (in other words: that would initializ... |
I'm learning Python, and I'm trying out the with **** as ****: statement. I figure it works much like C#'s using(****) {, but I'm afraid I'm following outdated examples.
This is my code:
# -*- coding: iso-8859-1 -*-
import pprint
pow = 1, 2, 3
with pprint.pprint as pprint:
pprint(pow)
I assume what's happening her... |
(be sure to check out the EDIT at the end of the post before reading too deeply into the source)
I'm plotting a histogram of a population that seems to be of log Laplacian distribution:
I'm trying to draw a line of best fit for it to verify my hypothesis, but I'm having problems getting meaningful results.
I'm using th... |
All parts of Python on my computer were recently installed from the Enthought academic package, but use Pyscripter for editing and running code. I'm very early in my learning curve, and so could very well be overlooking some obvious things here.
When I try to create a plot and save it like so:
import matplotlib.pylab a... |
I have the following Django models
class ConfigurationItem(models.Model):
path = models.CharField('Path', max_length=1024)
name = models.CharField('Name', max_length=1024, blank=True)
description = models.CharField('Description', max_length=1024, blank=True)
active = models.BooleanField('Active', defaul... |
In case you’re tuning in late, the previous installment in this series is here. This is an absolutely ridiculously long blog post, feel free to either totally ignore it or to read only the top portion, it will likely contain all you need or want to know to keep up to date with what’s happening here. The rest is more of... |
I am using scrapy framework for data scraping and dumping item in MySQL database.
Here is my pipeline that is inserting output to MySQL, but its taking so much time. Any suggestions on how to optimize this?
class MysqlOutputPipeline(object):
def __init__(self):
dispatcher.connect(self.spider_opened, signals.spide... |
Kanor
Re : Idée projet Logiciel RDM Eurocodes Structures Bois, Acier, Béton...
D'aprés ce que je comprend Salome utilise code_aster
Sinon pdf qui me semble intéressant
http://calcul.math.cnrs.fr/Documents/Journees/dec2006/aster.pdf
ça date un peu 2006
Hors ligne
ossatureLibre
Re : Idée projet Logiciel RDM Eurocodes Str... |
I have polygon feature and want to be able to generate points inside it. I need this for one classification task.
Generating random points until one is inside the polygon wouldn't work because it's really unpredictable the time it takes.
Start by decomposing the polygon into triangles, then generate points inside those... |
Using fixtures in web2py
So you are ready to deploy your newly finished web2py app, but you don't like the idea of having to manually insert all of this fixture data again!
Create a new model, and name it x_fixtures.py. This way it will execute after all of your models.
Then for every table that you want to pre-populat... |
Bybeu
[résolu] Problème veille carte nvidia 4200 nvidia96
EDIT 27 mars 2013: j'ouvre un nouveau fil ici: http://forum.ubuntu-fr.org/viewtopic.php?id=1210781
Bonjour
Mon portable 12.04 plante en sortie de veille;
J'ai essayé
sudo s2ram -n
Machine matched entry 222:
sys_vendor = 'Dell Computer Corporation'
sys_... |
$Assumptions = x ∈ Reals && y ∈ Reals && a ∈ Reals && b ∈ Reals;
These work:
Cos[x/2] Sinc[x/2] == Sinc[x] // FullSimplify
(* True *)
Cos[y/2] Sinc[y/2] == Sinc[y] // FullSimplify
(* True *)
but these don't:
Cos[x/2] Sinc[x/2] + Cos[y/2] Sinc[y/2] == Sinc[x] + Sinc[y] // FullSimplify
(* Cos[x/2] Sinc[x/2] + C... |
I want to connect to a remote host, login, run a command and save the output in a variable. Following is the code I'm using.
import telnetlib
HOST = "172.19.35.69"
user = 'user'
password = 'pass'
tn = telnetlib.Telnet(HOST)
tn.read_until("User: ")
tn.write(user + "\n")
tn.read_until("Password:")
tn.write(password + "\n... |
Asynchronous Programming in Python
Twisted is pretty good. It sits as one of the top networking libraries in Python, and with good reason. It is properly asynchronous, flexible, and mature. But it also has some pretty serious flaws that make it harder than necessary for programmers to use.
This hinders adoption of Twis... |
In Python, given a module X and a class Y, how can I iterate or generate a list of all subclasses of Y that exist in module X?
Here's one way to do it:
import inspect
def get_subclasses(mod, cls):
"""Yield the classes in module ``mod`` that inherit from ``cls``"""
for name, obj in inspect.getmembers(mod):
... |
Updated and restructured by Jim Mock. Originally contributed by Jake Hamby.
ConfigureKernel
Configuring the DragonFly Kernel
The kernel is the core of the DragonFly operating system. It is responsible for managing memory, enforcing security controls, networking, disk access, and much more. While more and more of Dragon... |
Otras Recetas
Upgrade
En la página de la interfaz administrativa "site" existe un botón "upgrade now" (actualice la versión ahora). En caso de que no esté disponible o no funcione (por ejemplo por un problema de bloqueo de un archivo), actualizar web2py manualmente es muy fácil.
Simplemente descomprime la última versió... |
I'd like to align two lists in a similar way to what difflib.Differ would do except I want to be able to define a match function for comparing items, not just use string equality, and preferably a match function that can return a number between 0.0 and 1.0, not just a boolean.
So, for example, say I had the two lists:
... |
I'm in the process of attempting to automate Hyper-V for our dev\test lab. I downloaded the PSHyperV pack, most of the scripts work however when I attempt to shutdown the machine it fails with the error code 32768.
I also tried the script off Ben's blog.
However this also failed.
__GENUS : 2
__CLASS :... |
I just tracked down a nasty bug in my code to a gotcha with Python iterators.
Consider the following code...
class Numbers(list):
def even(self):
for val in self:
if val % 2 == 0:
yield val
even = property(even)
def odd(self):
for val in self:
if val %... |
fffredo
traduction française (résolu)
Bonjour la communauté, je suis sous kde 4.12.1 et ubuntu 13.10.
Tout marche bien sur ma monture depuis un bon moment et là d'un coup j'ai kickoff qui passe en anglais tout comme libreoffice et les menus clic droit ????
j'ai bien depuis longtemps les paquets de langue installé (je l... |
As you know Django’s forms.EmailField() is capable of validating email addresses but what if you wanted to validate the existence of a particular email address? I’ve found a pretty neat solution for that, it’s called Email Pie.Email Pie is a wonderful little JSON API that gives you a simple way to validate email addres... |
a = [1,2,3,4,5]
b = a[1]
print id(a[1],b) # out put shows same id.hence both represent same object.
del a[1] # deleting a[1],both a[1],b have same id,hence both are aliases
print a # output: [1,3,4,5]
print b # output: 2
Both b,a[1] have same id but deleting one isn't effecting the ot... |
I want to make the slug field as read_only depending on the other field value like "lock_slug".
Means There will be Two conditions.
1) When value of "lock_slug" is false then the slug field directly prepopulated from the field "title".
prepopulated_fields = {"slug": ("title",),}
2) When value of "lock_slug" is true th... |
pguimier
Re : Qarte arte.tv browser (ex Qarte+7)
@VinsS en ce moment même elles le sont, je peux les voir.
J'ai testé un :
rtmpdump -r rtmp://flashstreaming.cdn.arte.tv/a3974/o35 -y "mp4:geo/FR/cathedrale-sbs-logo_FR?h%3D0cbcd9807abb79b532c3a0db53b68be1" -W "http://www.arte.tv/flash/mediaplayer/mediaplayer.swf" -o "Le ... |
The code I'm using is:
import time
print(time.strftime("%H:%M:%S"))
In the dynamic shell, this (as you would expect) outputs a formatted string, e.g. 03:21:35
When executing the exact same code from a file, it throws the following error:
Traceback (most recent call last):
File "main.py", line 2, in <module>
prin... |
rezzakilla
Re : [Info] Installation du driver Libre ATI Radeon
Je dis ça comme ça...mais ça marche terrible sur ma 7500.....:D
Hors ligne
hugo69
Re : [Info] Installation du driver Libre ATI Radeon
ton tuto est dans la doc officielle mais ca naide pas beaucoup ma 9700ATI Hercules à fonctionner correctement.
Si je mets l... |
alex2423
Plus d'accès à la TV de SFR via VLC sur le PC
Hello tout le monde,
Je fais partie de ceux qui n'ont pas de TV. J'ai juste un bel écran Dell 24" que j'utilise comme TV. Je regardais la TV avec VLC via le flux SFR.
Depuis 1 mois à peu près, je n'ai plus d'image. J'ai encore le son.
Est ce que vous avez ce meme s... |
I've just started learning Python and this confused me as well for some time. Trying to figure out how it all works in general I came up with this very simple piece of code:
# Create a class with a variable inside and an instance of that class
class One:
color = 'green'
obj2 = One()
# Here we create a global variab... |
Editor's note: The second edition to Python Cookbook has been updated for Python 2.4 to include more than 200 recipes with solutions to problems that Python programmers face every day. We've selected two new recipes from the book to showcase here; check back next week for two additional recipes on implementing a ring b... |
I have a decorator and I want to assert that certain methods in my code are decorated with it.
import functools
def decorator(func):
def _check_something(*args, **kwargs):
# some logic in here
return func(*args, **kwargs)
return functools.wraps(func)(_check_something)
class MyClass(object):
... |
davilink
[Problème] Pc s'éteint tout seul
Bonjour, j'ai un problème d'ordinateur qui s'éteint tout seul. Je suis en plein milieu d'un visionnage d'un vidéo et youtube et tout à coup plus rien.
J'avais l'impression que le problème venait de firefox + flash, mais j'ai essayé avec chrome et le même problème est survenue.
... |
Original answer: I'm not sure if you will like how mathematical courses typically introduce matrices. As a programmer you might be happier with grabbing any decent 3D graphics book. It should certainly have very concrete 3x3 matrices. Also find out the ones that will teach you projective transformations (projective geo... |
Can I reset an iterator / generator in Python? I am using DictReader and would like to reset it (from the csv module) to the beginning of the file.
I see many answers suggesting itertools.tee, but that's ignoring one crucial warning in the docs for it:
Basically,
As several answers rightly remarked, in the specific cas... |
I have two lists,
[[1, 2], [4, 7], [11, 13], [15, 21]][[3, 4], [5,12], [23, 25]]
I want an output like this.
[[1, 2], [3,13], [15, 21], [23, 25]]
Anybody can help me?
I have two lists,
I want an output like this.
Anybody can help me?
The algorithm from Merging a list of time-range tuples that have overlapping time-rang... |
I know there's a similar topic about python console, but I do not know if they are the same. I tried system("clear") and it didn't work here.
How do I clear python's IDLE window?
The "cls" and "clear" are commands which will clear a terminal (ie a DOS prompt, or terminal window). From your screenshot, you are using the... |
I use Jinja2 as a website template engine, and all helper functions used in templates I've implemented as macros, but for one. This is it's Python code:
def arrow_class_from_deg(angle):
if angle is None:
return ''
arrow_directions = [
(0, 'n'), (45, 'ne'), (90, 'e'), (135, 'se'), (180, 's'),
... |
I am trying to use a entry to append the dbf part of a shapefile. So far I can only make a change to the dbf file by directly assigning the variable a value. I can only get the entry box to print a variable. What am I missing? I am using python 3.3.
import shapefile
from tkinter import filedialog
import tkinter as tk
... |
I'm trying to use the pyfacebook functions (https://github.com/sciyoshi/pyfacebook/) in a Google app engine project. I've followed the advice on the Facebook developer forum (http://forum.developers.facebook.net/viewtopic.php?pid=164613) and added the additional functions to the __init__.py file, copied that file to th... |
i have installed pyjamas on debian
however my program does not find the module, what could be the problem, i have installed pyjamas correctly using apt-get
krisdigitx-virtual-machine ~ # python jamas.py
Traceback (most recent call last):
File "jamas.py", line 3, in <module>
from pyjamas import Window
ImportError... |
L4ur3nt
Accéder au NAS DNS320 depuis toutes les applications sur Ubuntu 12.10
Bonjour, j'ai un soucis de connection à mon NAS DNS 320 sur Ubuntu 12.10.
J'arrive à y avoir accès en recherchant dans le réseau local mais je parviens pas à "accéder au NAS depuis toutes les applications"
J'ai déjà consulté plusieurs anciens... |
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 ... |
About
require 'parslet'
include Parslet
# Constructs a parser using a Parser Expression Grammar
parser = str('"') >>
(
str('\\') >> any |
str('"').absent? >> any
).repeat.as(:string) >>
str('"')
result = parser.parse %Q("this is a valid string"... |
Here is the code:
allowednamechars = string.ascii_letters + string.digits + '_+/$.-'
def stripname(name, allowed=""):
""" strip all not allowed chars from name. """
n = name.replace(os.sep, '+')
n = n.replace("@", '+')
n = n.replace("#", '-')
n = n.replace("!", '.')
res = u""
for c in n:
... |
JavaScript
heinz_stapff — 2011-10-09T13:34:24-04:00 — #1
I don't understand why I can't get either of these methodes to work but for sure there are syntax errors in the script that are not being reported by 'Developer' tools in IE8.
Script not working
function getprompt(){
/*
f1.innerHTML=' ';
var f1prompt=document.cre... |
SimPy: Simulating Systems in Python
by Klaus Müller and Tony Vignaux
02/27/2003
Simulating complex real-world systems is now possible with SimPy , an open source simulation package. SimPy, originally developed by the authors of this article, has been developed to production quality by a small team of enthusiastic open ... |
since Java doesn't provide a default way to do this,
what's a fast way to convert an Integer into a Byte Array?
e.g. 0xAABBCCDD => {AA, BB, CC, DD}
Have a look at the ByteBuffer class.
ByteBuffer b = ByteBuffer.allocate(4);
//b.order(ByteOrder.BIG_ENDIAN); // optional, the initial order of a byte buffer is always BIG_E... |
To see what's in your monkeyrunner, run this script:
#! /opt/android-sdk/tools/monkeyrunner
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice, MonkeyImage
for m in [MonkeyRunner, MonkeyDevice, MonkeyImage]:
print "%s:\n %s\n" % (m.__name__, dir(m))
You will see what's defined and where. For example... |
Yet another newbie question..
Let's say I have an user table in declarative mode:
class User(Base):
__tablename__ = 'user'
id = Column(u'id', Integer(), primary_key=True)
name = Column(u'name', String(50))
When I have a list of users identifiers, I fetch them from db with:
user_ids = [1, 2, 3, 4, 5]
users ... |
Python Scripts as a Replacement for Bash Utility Scripts
To demonstrate the power of combining Python scripts in a modular andpiped fashion, let's expand further on the problem space. Let's findthe top five users of the service. head is a commandthat allows you tospecify a certain number of lines to display of the stan... |
Building a Doubletalk Browser with wxPython
Okay, now let's build something that's actually useful and learn more about the wxPython framework along the way. As has been shown with the other GUI toolkits, we'll build a small application around the Doubletalk class library that allows browsing and editing of transaction... |
I have this code that takes a matrix and creates an array of the adjacent neighbors of each element in the matrix. The elements are ids that I will use as a key to look up values in a dictionary. "Hooked" helped me tremendously with writing this code in numpy format. What I would like to do is export the neighbor list ... |
"The @RaspberryPi Doorbell of Dooooooooommmmmmmm"
We had some good fun last night with the neighbourhood kids making use of ourDoorbell of Dooooooooommmmmmmm.
I've had a bigger doorbell project planned for quite a while but 2 weeks ago decided we should do a simpler Halloween one. Using various bits bought from Sparkfu... |
What is the best comment in source code you have ever encountered?
This is actual code I once had to support. After struggling to comprehend the logic in AstaSaysGooGoo and AstaSaysGaaGaa (where many more astaTempVars were declared and used ) I was ready to give up. I finally looked up and saw the "@author" comment and... |
03 May 2014
These days npm ships with nodejs, which you can install on ubuntu with::
sudo add-apt-repository ppa:chris-lea/node.js -y
sudo apt-get update
sudo apt-get install nodejs
By default I have 2 ways of using npm::
sudo npm -g install bower
This (depending on how and where npm was installed) installs itself in... |
What's the quickest way in python to determine if a string was compressed by zlib. I am using this currently.
def iscompressed(data):
result = True
try:
s =zlib.decompress(data)
except:
result = False
return result
I am sure there is a more elegant way. |
I'm getting the following warning message when I try to use a ctypes array as a numpy array:
Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes, numpy
>>> TenByteBuffer = ctypes.c_ubyte * 10
>>> a... |
ehmicky
Stego++, projet de bibliothèque de stéganographie
Salut à tous,
[Message mis à jour 19/11/11]
Je suis actuellement sur un projet de stéganographie (art de dissimuler un message secret dans "quelque chose" (fichier, phrase, etc.) d'apparence banal). Il s'agit de faire une bibliothèque C++, Stego++, qui permette ... |
I'd like to get posted-data from a form and display them. I used "{% url uasite1.views.sell_detail sell_detail.pk %}" to extract data according to their pk.
However, just [ NoReverseMatch ã»ã»ã», Reverse for 'uasite1.views.sell_detail' with arguments '('',)' and keyword arguments '{}' not found.] showed up. What's w... |
Saturday, December 31, 2005
Categories: resolution, goals, fpga, lisp, turbogears, python, programming
Well, in the spirit of the season, I will give my top 10 technical-related New Years resolutions (or goals, or whatever name you prefer).
10. Sign at least 3 customers up for ConsulTracker.com - This should (hopefully... |
I have been absolutely racking my brain over this, and can't seem to work out how to get around the issue. Please note that I have cut alot of irrelevant fields out of my models
I am in the middle of coding up my SQL-Alchemy models, and have encountered the following issue:
Due to multiple billing systems, each with co... |
In python, a dictionary is a hash table. First, create two dictionaries:
NO_dict = {x[0]: x[1] for x in ISO3166_CountryCodes_NO}
EN_dict = {x[0]: x[1] for x in ISO3166_CountryCodes_EN}
which gives you:
{'GR': 'Hellas', 'NO': 'Norge', 'SE': 'Sverige'}
{'GR': 'Greece', 'NO': 'Norway', 'SE': 'Sweden'}
You can then creat... |
The usual suspects -- profile it, find the most expensive line, figure out what it's doing, fix it. If you haven't done much profiling before, there could be some big fat quadratic loops or string duplication hiding behind otherwise innocuous-looking expressions.
In Python, two of the most common causes I've found for ... |
I am following Google App Engine "Hello world" tutorial in this link: https://developers.google.com/appengine/docs/python/gettingstartedpython27/helloworld
I want to load my helloworld.py application:
import webapp2
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = '... |
I am working on an desktop inbox notifier for StackOverflow, using the API with Python.
The script I am working on first logs the user in on StackExchange, and then requests authorisation for the application.
Assuming the application has been authorised through web-browser interaction of the user. The application shoul... |
Tyim
Réponses : 1
Bonjour,
Je viens de créer une nouvelle page ' http://doc.ubuntu-fr.org/installer_un_s … erveur_php '
Il est noté dans le tuto :
l'équipe qui gère le wiki souhaite également en être informée par l'intermédiaire de la liste de discussion de la documentation, d'autres contributeurs plus expérimentés vou... |
I'm havin issues with python (Sorry for my personal feelings before.. :P).
I have a txt file, it contains a custom language and I have to translate it to a working python code.
The input:
import sys
n = int(sys.argv[1]) ;;print "Beginning of the program!"
LOOP i in range(1,n) {print "The number:";;print i}
BRANCH n <... |
argmax() will only return the first occurrance for each row.http://docs.scipy.org/doc/numpy/reference/generated/numpy.argmax.html
If you ever need to do this for any shaped array, this works better than unravel:
import numpy as np
a = array([[1,2,3],[4,3,1]]) ## Can be of any shape.
indices = np.where( a == a.argmax()... |
thof February, 2012
This picture is like finding out that the Pope is not a Roman Catholic.
What you see there—click it for a much larger version[1]—is the result of a very innocent question from a Python programmer to me, after he found out that I am a Haskell programmer. I will give you the lesson that I gave, of mon... |
Commercial Services ✈ Flight Status API / Flight Tracking API / FlightAware API ✈ Documentation
FlightXML 2.0 Documentation
About
Using the FlightXML API, programs can query the FlightAware live flight information and recent history datasets.
Queries for in-flight aircraft return a set of matching aircraft based on a c... |
Sieves in Haskell
The other day I was answering a question on StackOverflow and decided the solution was worth talking about.
It was particularly interesting because it illustrated something: Haskell makes a darn good imperative language.
What do I mean? This statement seems absurd, Haskell has no notion of state! How ... |
Ok, I am trying to install PySerial 2.6 on my windows XP SP3 machine. After having unpacked the PySerial download and running the setup.py file I get this error.
C:\PYSERIAL\dist\pyserial-2.6\setup.py
Traceback (most recent call last):
File "C:\PYSERIAL\dist\pyserial-2.6\setup.py", line 44, in <module>
open(os.pa... |
Python 133 bytes
def cipher(t,r):
m=r*2-2;o='';j=o.join
for i in range(r):s=t[i::m];o+=i%~-r and j(map(j,zip(s,list(t[m-i::m])+[''])))or s
return o
Sample usage:
>>> print cipher('FOOBARBAZQUX', 3)
FAZOBRAQXOBU
>>> print cipher('ABCDEFGHIJKLMNOPQRSTUVWXYZ', 4)
AGMSYBFHLNRTXZCEIKOQUWDJPV
>>> print cipher('ABCDEFGHIJ... |
I created a list on twitter and added a user to it. Then I finally figured out how to write the code without an error. I am a newbie. Then Lo and behold when i get data it is whacked out. I have no idea what to do with it.
All I want is to get the usernames of everyone in the the list.
Here is the code:
the_list = api.... |
bishop
Re : Qarte arte.tv browser (ex Qarte+7)
VinsS !
J'ai réinstallé Qarte.
Avant de lancer Qarte j'ai refait un test avec rtmpdump... pas de problème.
J'ai supprimé le dossier caché .qarte puis testé Qarte:
bishop@JC:~/Bureau$ qarte -d
lang: /usr/share/locale/fr/LC_MESSAGES/qarte.mo
11:44:14: WARNING - utils Config ... |
I have a class:
class AccountTransaction(db.Model):
account = db.ReferenceProperty(reference_class=Account)
tran_date = db.DateProperty()
debit_credit = db.IntegerProperty() ## -1, 1
amount = db.FloatProperty()
comment = db.StringProperty()
pair = db.SelfReferenceProperty()
so, what I want is t... |
How do I find the playback time of media with gstreamer?
Here's a simple Python script to get the duration of anything gstreamer can decode. Note that all times in gstreamer are in nanoseconds.
duration.py:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division
import sys
import gobject
gobject.t... |
The following works on dev_appserver but it fails on production:
url = 'http://maps.google.com/maps/geo?q=%s' % region
result = urlfetch.fetch(url)
The error message I get is
ApplicationError: 2 :
Traceback (most recent call last):
File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.p... |
Zuerst legt man zwei Partitionen (oder wenn man LVM nutzt zwei logical Volumes) an, im folgenden hdax und hday genannt, und formatiert hdax mit dem Dateisystem des geringsten Misstrauens (z.B. ext3: mkfs.ext3 /dev/hday) und hday wird als Swap vorbereitet mkswap hday.
Falls man die Domain über drbd Spiegeln möchte sollt... |
blob: 8ac1b71bc2eec9bbbe8ae6e78dd744b2dfff3d93 (
plain
)
# Handle U-Boot config for a machine
#
# The format to specify it, in the machine, is:
#
# UBOOT_CONFIG ??= <default>
# UBOOT_CONFIG[foo] = "config,images"
#
# or
#
# UBOOT_MACHINE = "config"
#
# Copyright 2013, 2014 (C) O.S. Systems Software LTDA.
python () {
... |
Intro:There are the (probably) best solutions. But you have to know it and remember it and sometimes you have to hope that your Python version isn't too old or whatever the issue could be.
Then there are the most 'hacky' solutions. They are great and short but sometimes are hard to understand, to read and to remember.
... |
I'm running into some trouble running python/mysqldb on my raspberry pi. This is a pretty simple script, so I'm not sure what I'm missing. The "SELECT * FROM..." runs with no problem, but I can't seem to update the table with new values. The script runs without throwing errors, but when I ctrl-C, it gives me this:
Exce... |
I want to implement a customizable and extendable lexer-class.
My idea
2 different types of handlers:
Character-set handlers
Function handlers
When a character is read, it is pushed through all handlers being registered to the lexer. As soon as a handler matches and returns a valid Token, it is returned. When no handle... |
Solved: Changing the join-type to INNER_JOIN
I'm trying to get the original table-entry of a domain class after executing a hibernate criteria.
For example:
The domain class A got a hasMany association to the domain class B.
The entity of A with the id 1, got two entities of B with the ids 11 and 12.
I'm executing the ... |
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... |
I think that the above answers missed the key point.
Let's have a class with a method:
class A(object):
def m(self):
pass
Now, let's play with it in ipython:
In [2]: A.m
Out[2]: <unbound method A.m>
Ok, so m() somehow becomes an unbound method of A. But is it really like that?
In [5]: A.__dict__['m']
Out[5... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.