text stringlengths 256 65.5k |
|---|
Hey Stack Overflow I am fairly new to Python and I have an issue with my for loop that I can't quite seem to figure out.
I am trying to read into a FASTA file which has the following example text:
>seq1AAACTACCGCGTTT>seq2AAACTGCAACTAGCGTTT>seq3AAACCGGAGTTACCTAGCGTTT
What I would like to do is read into my file and prin... |
A few years ago I developed the sitescraper library for automatically scraping website data based on example cases:
>>> from sitescraper import sitescraper>>> ss = sitescraper() >>> url = 'http://www.amazon.com/s/ref=nb_ss_gw? url=search-alias%3Daps&field-keywords=python&x=0&y=0' >>> data = ["Amazon.com: python", ["Lea... |
wq.io is a Pythonic library for consuming (input), iterating over, and generating (output) external data resources in various formats. wq.io facilitates interoperability between the wq framework and other systems and formats.
Tested on Python 2.7 and 3.4.
# Basic install
pip install wq.io
# Alternatively, install the w... |
The way Applied cryptography 2ED explains the puzzle is as follows (I paraphrase it):
Bob generates 2^20 messages of the form
x,ywherexis a puzzle number andyis the secret key. Bothxandyare different for each of the one million message. Encrypt each message using symmetric cipher with a different 20-bit key. Send all m... |
I'm a python noob. Have installed virtualenv and pip, and everything looks OK to me, but when trying to import packages installed through pip, python doesn't find them. I'm on OS X and have the system python 2.6 in /usr/bin, so installed 2.7 into /usr/local/bin via the package installer. When installing pip and virtual... |
Below is the code that I use for the form to enter new cases into the GAE datastore. When I try to enter the form I get the type error below saying I am using an unexpected keyword argument. I am new to python and GAE does anyone have any idea what I'm doing wrong?
class Case(db.Model):
user = db.StringProperty(req... |
One way to do this is to create a Manager and defines a function with the raw SQL query. Create the model object attaching the new calculated field referencing to the model class with self.model
Class MyModel(models.Model):
fieldA = models.FloatField()
fieldB = models.FloatField()
objects = MyModelManager(... |
I can understand that if I join individual queries that are "individually fast" the combination may become slow because the default execution plan may be non-optimal. However when I know the number of rows for one query is very small I think I should be able to use hints to control the joins.
select cj.a, cv.b
from (... |
Hizoka
Re : [g2s] GUI d'extraction de fichiers mkv
En fait la fonction qui permet d'extraire dans le même dossier, il faut cliquer dessus à chaque fois. Tu pourrais pas mettre une option à cocher dans préférences qui permettrait de la garder toujours active ?
Réinitialise les préférences.
Par contre il n'y a plus l’icô... |
I am importing a dmp file using the following command:
imp user/pass file=file.dmp log=logfile.log full=y ignore=y destroy=y
I get the following errors:
. . importing table "MESSAGE_BOARD"
IMP-00058: ORACLE error 22993 encountered
ORA-22993: specified input amount is greater than actual source amount
IM... |
This article outlines how to set up your new Django site from scratch. I tend to use Dreamhost Web Site Hosting so there will be a few notes specific to them.
If you are unsure how to set up Python and Django using Dreamhost then checkout my previous article.
I hope you find it useful and drop me a comment if you have ... |
I have a function (shown below) where I'm using a popup and TextInput to display some text and in most cases the text content is larger than the popup window and hence the need for scrolling. Without ScrollView I need to rely on keyboard arrow keys for scrolling and I tried implementing ScrollView so that I can scroll ... |
Kedoc
Re : script install wifi BCM94311MCG
Petit point...
Je me suis aperçu ce soir qu'il me suffit d'utiliser l'interrupteur matériel de ma carte pour l'éteindre et la rallumer, un coup au démarrage sous Ubuntu, et je peux ensuite l'utiliser (en wifi ouvert, et en WEP, ça fonctionne).
Je n'ai pas encore bien compris, ... |
Going with @Justin's comment, here is how I would save and read the session each time:
import cPickle as pickle
def WriteProgress(filepath, progress):
with open(filepath, 'w') as logger:
pickle.dump(progress, logger)
logger.close()
def GetProgress(filepath):
with open(filepath, 'r') as logger:
... |
I have written a function to handle post data received from a web page. The Emphasis is on making getting post data easy: using the function allows the coder to specify the required data, type, and default value all in one line.
I'm using django and it provides a nice dict of post data. this will be passed to the funct... |
When I load the html page the results from the database are not appearing. I am using python and jinja2. The {{ initial_city }} is displaying the correct results, the problem seems to be with get_deals or on the html file where I have used jinja2. I want to display results that equal to the city chosen on the main page... |
raspouillas
Re : Topic des lève-tôt… Faisons manger leurs caleçons aux couche-tard! [4]
Je ne faisait aucune allusion au problème de @souen.
Dernière modification par raspouillas (Le 15/06/2012, à 20:37)
ljere
Re : Topic des lève-tôt… Faisons manger leurs caleçons aux couche-tard! [4]
alors voici la première partie du ... |
I've been working on using python to get access to Facebook insights information. I was able to get public information (e.g. 'likes' from cocacola's page) in addition to app insights for apps that I have developed.
Because I am the admin and developer for both pages and apps, when I go to facebook.com/insights I will s... |
I have a file structure like this:
dir_a __init__.py mod_1.py mod_2.pydir_b __init__.py my_mod.py
I want to dynamically import every module in dir_a in my_mod.py, and in order to do that, I have the following inside the __init__.py of dir_a:
import os
import glob
__all__ = [os.path.basename(f)[:-3] for f in glob.glob(o... |
Is it possible to launch Blender in a mode where everything that appears in the Blender Console is sent to a file?
On Linux/Ubuntu its
In Python you can do
import sys
file = open(filepath, "w")
sys.stdout = file
#...
#...
sys.stdout = sys.__stdout__ #reset
file.close()
to catch the console output while your script is ... |
UPDATE: If i change
from scitools.std import *
to e.g.
from scitools.std import sqrt, zeros
everything works fine..
I'm trying to run nosestests -s myfile.py, but I'm getting this error all the time:
======================================================================
ERROR: Test if modulename can be imported, and ... |
johnatan57950
Re : [tuto]Installation de Dofus 2.0 par paquet debian et rpm (pour la doc)
bj quand je clique sur l'icone dofus je suis venue a telcharger dofus mise a jours et tout le reste et une fois fini je clique sur jouer et sa me met adobe air L'installation de cette application est endommagée. Essayez de la réin... |
Phoenamandre
Re : Suivi des bogues d'Ubuntu 12.10
j'ai le même problème que toi avec mon dell xps !
autre bogue, si vous êtes touchés par un problème de maya qui ne veut pas démarrer
https://bugs.launchpad.net/maya/+bug/1047599
Hors ligne
vlotho
Re : Suivi des bogues d'Ubuntu 12.10
Salut j'ai une ribembelle de warning ... |
A while ago my computer died, so I decided to look for online ipython notebooks services like wakari to get something done while I get my computer fixed if I ever do. However, their free plan gave me a "no resources available" message. Then I remembered that I had a free account from the awesome service nitrous.io.
I k... |
I'd like to generate a stub SOAP web service class using the Python soaplib module, based on an existing WSDL. The idea is to generate a mock for a third party web service.
Does any such code generator exist, or must we write our own?
Martin
Okay, I had a go at hacking my wsdl2interface (http://pypi.python.org/pypi/wsd... |
You could try this implementation for Linux / Mac (and possible other Unices) (code attribution: found on ActiveState Code Recipes).
On Windows you should check out msvcrt.
import sys, termios, atexit
from select import select
# save the terminal settings
fd = sys.stdin.fileno()
new_term = termios.tcgetattr(fd)
old_ter... |
I've come from Django and was wondering how do I specify the default value of model if referenced just by calling it. Ie. <= @user %>
In Django, we can use in the model class;
def __unicode__(self):
return self.fieldname
And it will use whatever field name or combined string we specify. Is this possible in rails?
... |
I tried clustering a set of data (a set of marks) and got 2 clusters. I would like to graphically represent it. Bit confused about the representation, since I don't have the (x,y) coordinates.
Also looking for MATLAB/Python function for doing so.
EDIT
I think posting data make the question clearer. I have two clusters ... |
Playing a system sound
Showing an picture
Playing a sound file
Playing a video
Playing from a web cam
Composing media
Using Quickly to get it all started
Using Glade to get the UI laid out
Using quickly.prompts.choose_directory() to prompt the user
Using os.walk for iterating through a directory
Using a dictionary
Usin... |
loic_e
Kubuntu Dapper sur Sony VAIO VGN-FE28H
Voici la procédure d'installation utilisée pour installer Kubuntu Dapper sur un Vaio VGN-FE28H:
Caractéristiques:
Processeur Intel Core Duo
Fréquence 1.67 GHz
Quantité de RAM 1 Go
Type de RAM DDR2-SDRAM
Disque dur 160 Go
Puce graphique nVIDIA GeForce 7400 Turbo Cache
Taille... |
I've just started using web2py with Google AppEngine for an app of mine. For some reason, I'm unable to save/retrieve data using the DAL. Here's the code I'm using:
At the end of db.py:
from aeoid import middleware
from aeoid import users
import json
db.define_table('files',
db.Field('name', 'text'... |
AnsuzPeorth
[HtmlDesktopTools] Tout pour votre bureau en HTML5/JS/CSS3
Bjr,
N'ayant pas trouvé une taskbar qui me convienne, j'ai codé, pour le fun, une taskbar html. Plutot que de me faire juste ma taskbar, j'ai plutot développé un outils qui permet de faire ses widgets en html pour le bureau, dont ma taskbar.
Ce proj... |
Please consider using this website to upload your scripts:
It's a bit more organized and allows for easier browsing/uploading/viewing/downloading. If you have any comments/suggestions on that site, please use the feedback link. Eventually the scriptshare website's functionality will be incorporated into pnotepad.org, b... |
How to choose a point uniformly from a convex polytope $P \subset [0,1]^n$ defined by some inequalities, Ax < b ? (Here A is an m-by-n matrix, x is n-by-1 and b is m-by-1.) I imagine that you could start with a uniformly chosen point in the cube and do some process to get a point with Ax < b.
See the answers to this qu... |
So I'm following this tutorial in order to search some of my models. However, there is a lack of documentation for what is provided and as someone new to Django, I'm confused as to what is missing in order to make this work.
So here's what I have:
EDIT
Revised the search template to include an input field to fetch the ... |
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... |
smo
Re : Gmediafinder : Youtube/dailymotion/vimeo.. sans flash et bien plus....
ola
ok cool je vais regarder ca apres, la j en fais un "normalement" c est un peu (beaucoup...) plus complique pour les ppa
j vous tiens au jus !
et whoue si vous avez des idees, hesitez pas hein ... j aimerais bien avoir des visualisations... |
That is (probably) not an exact answer, but i guess it might help.
Django Admin offers you to override save method with ModelAdmin.save_model method (doc is here)
Also Django api have a get_or_create method (Doc is here). It returns two values, first is the object and second one is a boolean value that represents wheth... |
You can use Flask to run webapps.
The simple Flask app below will help you get started.
from flask import Flask, jsonify
app = Flask(__name__)
@app.route('/sampleurl' methods = ['GET'])
def samplefunction():
#access your DB get your results here
data = {"data":"Processed Data"}
return jsonify(data)
if __nam... |
I want to add a field to an existing mapped class, how would I update the sql table automatically. Does sqlalchemy provide a method to update the database with a new column, if a field is added to the class.
SQLAlchemy itself doesn't support automatic updates of schema, but there is a third party SQLAlchemy Migrate too... |
I have a list of say two values, I'm then supposed to multiply each value by an integer until both elements in become integers and append these new values to a new list. Say I have a list [0.5,1], what's supposed to happen is that I'm gonna multiply each by 2 and get 1 and 2 and append these to a new list [1,2]. For th... |
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... |
I have Post and Tag models:
class Tag(models.Model):
""" Tag for blog entry """
title = models.CharField(max_length=255, unique=True)
class Post(models.Model):
""" Blog entry """
tags = models.ManyToManyField(Tag)
title = models.CharField(max_length=255)
text ... |
ZhangHuangbin wrote:
*) You should remove it from Postfix, that's why you need this plugin for per-user restriction.
Check!
It works now. I just updated the plugin a little:
"""Reject sender login mismatch (sender in mail header and SASL username)."""
import logging
from libs import SMTP_ACTIONS
REQUIRE_LOCAL_SENDER = ... |
I'm beginning python and I'm trying to use a two-dimensional list, that I initially fill up with the same variable in every place. I came up with this:
def initialize_twodlist(foo):
twod_list = []
new = []
for i in range (0, 10):
for j in range (0, 10):
new.append(foo)
twod_list.... |
naingenieu
CSyD - divisez vos données
Bonjour tout le monde
Je viens vous présenter un projet tout droit tiré de mes cours de maths, j'ai nommé Can Split your Data
Le principe
Ce petit logiciel en python permet de décomposer un mot de passe, une phrase en plusieurs clés qui pourront être, toutes ou en parties, réunies ... |
ubuntiny
[Résolu] Problème avec arista
Salut à tous!
Voilà le problème: j'ai essayé d'installer arista, un encodeur permettant de manipuler les vidéos (encodage, modification du format de lecture etc...), mais après installation, lorsque je clique sur le raccourci arista situé dans le menu applications de gnome, ou lor... |
I have implemented a function for calculating historical volatility using close the close method as described by Haug on page 166.
When I implemented the formula given by Haug, it resulted in some negative values for the variance. The data I am using is not suspect, so the fault must lie in either:
my implementation or... |
I ended up using the gdata library and rolling my own blog summarizer, which uses the gdata library to fetch a Blogspot blog on Google App Engine (wouldn't be hard to port it to other platforms). The code is below. To use it, first set the constant blog_id_constant and then call get_blog_info to return a dictionary wit... |
I'm solving exercise 17 from Euler's project, which is about number spelling (GB). I searched the web for number spelling rules, but didn't find anything suitable.
Does anyone have a link to english number spelling rules (GB) (for example when to use/not to use 'and')?
For example, how to spell correctly 342?
Here is m... |
Here is a nice, tidy Python solution. I made no attempt to be terse here.
This modifies the file in-place, rather than making a copy of the file and stripping the newline from the last line of the copy. If the file is large, this will be much faster than the Perl solution that was chosen as the best answer.
It truncate... |
I've got a library that takes in a very simple C image structure:
// Represents a one-channel 8-bit image
typedef struct simple_image_t {
uint32 rows;
uint32 cols;
uint8 *imgdata;
} simple_image;
I didn't create this library, nor this structure, so I can't change it. I'm responsible for wrapping this libra... |
Is Kolmogorov-Smirnov test self-sufficient to prove normal distribution of a time series? And then test efficiency of a market?
Wikipedia says
so yes but also warns that a large number of data points might be required. Why don't you apply the Jarque-Bera test?
I think I've a simpler example to show that a normal distri... |
Iâm working on a library where the user shall be able to simply declare a few classes which are automatically backed by the database. In short, somewhere hidden in the code, there is
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class LibraryBase(Base):
# important library stuf... |
There are specific lines that I want to remove from a file. Let's say it's line 20-37 and then line 45. How would I do that without specifying the content of those lines?
With
sed '20,37d; 45d' < input.txt > output.txt
If you wanted to do this in-place:
sed --in-place '20,37d; 45d' file.txt
Just read it into memory, ... |
I want to use cron and this script (http://askubuntu.com/questions/23593/use-webcam-to-sense-lighting-condition-and-adjust-screen-brightness):
import opencv
import opencv.highgui
import time
import commands
def get_image():
image = opencv.highgui.cvQueryFrame(camera)
return opencv.adaptors.Ipl2PIL(image)
camera... |
Accessing Microsoft Files Using Sharity-Light
07/12/2000
Windows still got you trapped? Maybe SAMBA File System support is what you need. Michael Lucas explains how to use SMBFS.
It is possible to access data on a Microsoft computer from your FreeBSD system if the two computers are networked together. In this article, ... |
I am trying to use reflect feature of sqlalchemy but running into issues.
This is the mysql table i am trying to reflect.
| Country | CREATE TABLE `Country` (
`Code` varchar(8) NOT NULL,
`Country` varchar(64) NOT NULL,
`IsValid` varchar(1) DEFAULT 'Y',
PRIMARY KEY (`Code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1... |
Okay, I log onto the MySQL command-line client as root. I then open or otherwise run a python app using the MySQLdb module as root. When I check the results using python (IDLE), everything looks fine. When I use the MySQL command-line client, no INSERT has occurred. If I change things around to _mysql instead of MySQLd... |
How can I wrap a recursive function, recursive calls included? For example, given foo and wrap:
def foo(x):
return foo(x - 1) if x > 0 else 1
def wrap(f):
def wrapped(*args, **kwargs):
print "f was called"
return f(*args, **kwargs)
return wrapped
wrap(foo)(x) will only output "f was called"... |
The problem: I have a geodatabase with several datasets and many more feature classes within. The fields within the feature classes have been populated through joins with shapefiles and manual edits. Often times string fields will become populated with whitespace (i.e. '', ' ', ' ', etc) or the string "Null", and numer... |
I am practicing over the summer to try and get better and I am a little stuck on the following:
Given a string, return a new string where the first and last chars have been exchanged.
Examples:
frontBack("code") → "eodc"
frontBack("a") → "a"
frontBack("ab") → "ba"
Code:
public String frontBack(String str)
{
... |
Python Algorithms: Greedy Coin Changer
by Noah Gift
Because I am going to implement a Coin Changing Restful Web Service using Google App Engine for a presentation I am doing for PyAtl next month, I thought I would show three approaches that I could think of. In doing a google search for "Python Greedy Coin Change", I d... |
UPDATE: There is now a Node.js addon for loading and calling dynamic libraries using pure JavaScript: node-ffi. Also, node-waf is no longer being used to compile Node.js extensions.
TRANSLATIONS: This post was translated to Chinese:http://www.oschina.net/translate/how-to-write-your-own-native-nodejs-extension
Introduct... |
I tested this question with Sage, and the experiment suggests a clear pattern of asymptotics. Most polynomials are irreducible. Of the reducible ones, a third are of course divisible by $x$ (Edit: If 0 coefficients are allowed; see below.) An $O(1/\sqrt{d})$ fraction are each divisible by $x+1$ and $x-1$. That's becaus... |
I'm loading an image on the page with a 'file:///some_dir/image.jpg' src path. I can access the image in a regular tab using this path. Also, saving the page as HTML and using this path for the image works. However, the image does not load on the live page. In chrome it shows part of the alt text, and in firefox it sho... |
Plugins
Plugins add additional functionality to the users Popcorn video. They bring a large set of additional features from across the web, such as GoogleMaps, Facebook, Twitter, and many more. In doing so, users can add additional content from these web services and begin to create Popcorn experiences.
Attribution
Pur... |
I installed audiolab from this source:
Those are the only windows binaries for python 2.7 I was able to find.
When I call from scikits import audiolab I get the following error:
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
from scikits import audiolab
File "C:\Python27\lib\site-pac... |
I just started Python and I've got no idea what memoization is and how to use it. Also, may I have a simplified example?
Memoization effectively refers to remembering ("memoization" -> "memorandum" -> to be remembered) results of method calls based on the method inputs and then returning the remembered result rather th... |
I need in my django project run long tasks. Desided to use celery with redis as broker. Installed redis runs:
The server is now ready to accept connections on port 6379
Than I install django-celery, configure:
import djcelery
djcelery.setup_loader()
BROKER_HOST = "localhost"
BROKER_PORT = 6379 #redis
BROKER_USER = "gue... |
More Test-Driven Development in Python
by Jason Diamond
02/03/2005
In the first article in this series, Test-Driven Development with Python, Part 1, I started to build an event tracking application using the principle of test-driven development. Before writing any new code or making changes to any existing code, I wrot... |
I'm trying to build a little app that lets you switch between to pages. This is what I got so far:
import tkinter
from tkinter import ttk
def main():
root=tkinter.Tk()
root.title("Control")
first_page = FirstWindow(root)
root.mainloop()
def change_to_secondwindow():
first_page.grid_forget()
sec... |
I can understand that if I join individual queries that are "individually fast" the combination may become slow because the default execution plan may be non-optimal. However when I know the number of rows for one query is very small I think I should be able to use hints to control the joins.
select cj.a, cv.b
from (... |
Depending on your needs it may be helpful to know that a significant amount of time is spent converting a Graphics expression to output Box forms. Example:
graphics = Import["http://exampledata.wolfram.com/usamap.zip", "Graphics"];
Timing[cell = Cell[BoxData@ToBoxes@graphics, "Output"];]
{1.466, Null}
It is now signif... |
Is there a way in sqlalchemy to turn off declarative's polymorphic join loading, in a single query? Most of the time it's nice, but I have:
class A(Base) :
discriminator = Column('type', mysql.INTEGER(1), index=True, nullable=False)
__mapper_args__ = { 'polymorphic_on' : discriminator }
id = Column(Integer, p... |
I have a numpy matrix
1 23 4
I want to 'concatenate' the rows of the matrix to get a new matrix
13 24
Is there a simple way to do this?
Looks to me more like you want to concatenate the columns. Maybe something like this would suffice?
In [25]: import numpy as np
In [26]: a = np.array([[1,2],[3,45]])
In [27]: a
Out[27]... |
I've got a set of actions which share some base checks. My code looks like this:
def is_valid(param): …some pretty complex things unit-tested on their own…
class BaseAction(object):
def run(self, param):
if not is_valid(param):
raise ValueError(…)
return self.do_run(param)
class Ju... |
I don't seem to able to get rid of this error, when I try to exist the game. the game runs fine but only get the error when I try to exist the game.
import pygame
from pygame import *
import random
import time
import os
import sys
from pygame.locals import *
black = (0,0,0)
white = (255,255,255)
pygame.init()
def game(... |
Today suddenly I am getting following error.
import win32com.client
xl=win32com.client.Dispatch("Excel Application")
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
xl=win32com.client.Dispatch("Excel Application")
File "C:\Python27\lib\site-packages\win32com\client\__init__.py", line ... |
I'm trying to create a python script that copies files from a remote server to my local drive. The problem is that I noticed that it doesn't spawn a thread to copy other files in parallel.
import shutil
import threading
LocalPath = "C:\\folder1"
RemotePath = "X:\\folder1"
# downloader/copier
def monitorCopy (Filename) ... |
I need an IronPython\Python example that would show C#/VB.NET developers how awesome this language really is.
I'm looking for an easy to understand code snippet or application I can use to demo Python's capabilities.
Any thoughts?
Many good questions generate some degree of opinion based on expert experience, but answe... |
Pysync has implemented rolling on top of zlib's Adler32 like this:
_BASE=65521 # largest prime smaller than 65536
_NMAX=5552 # largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1
_OFFS=1 # default initial s1 offset
import zlib
class adler32:
def __init__(self,data=''):
value = z... |
Your form would have to be constructed based on some variables passed to it from your POST (or blindly check for attributes). The form itself is constructed every time the view is reloaded, errors or not, so the HTML needs to contain information about how many fields there are to construct the correct amount of fields ... |
I am deploying a Django project on an ubuntu stack with a postfix SMTP mail server, hosted on Amazon's EC2. I can send out email from the server using the Linux mail program. But when I try to send email using django.core.mail.send_mail, the email is never received.
Here are my settings:
EMAIL_BACKEND = 'django.core.ma... |
I have the following class hierarchy:
class A(object):
def __init__(self, filename, x):
self.x = x
# initialize A from filename
# rest of A's methods
class B(A):
def __init__(self, filename):
super(B, self).__init__(filename, 10)
# rest of B's methods
Both classes are passed the... |
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. ... |
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... |
Imagine the following project structure
app/ foo/ __init__.py a.py b.py
In a.py i have class A wich uses class B from b.py file, and B class from b.py uses A class form a.py
if I write:
from foo.b import B
in a.py and
from foo.a import A
in b.py, the recursion occurs
How can I do properly import, without merging A an... |
6 January 2010, by Ben 4 comments
Why? Well, for a minimalist framework, I do like web.py’s close-to-the-SQL approach. But as soon as you have more than a couple of database operations, you find you’ve got code that repeats itself repeats itself. In the case of Gifty, I was repeating column names.
But I didn’t want a f... |
However, there is a pitfall in both solutions. The reason is that it merges the values with the same hash. So, it depends on whether the used values may have the same hash. It is not that crazy comment as you may think (I was also surprised earlier), because Python hashes some values the special way. Try:
from collecti... |
In python, you can use the PyCrypto library. Defining some helper functions:
from Crypto.Cipher import Blowfish, AES
from Crypto import Random
def encrypt(plaintext, key, crypto_class, mode, iv=None):
block_size = crypto_class.block_size
if iv is None:
iv = Random.new().read(block_size)
cipher = cr... |
am wondering if I'm doing this right.
I want to split a huge py file into ten .py files ( or controllers, if you will). The reason being it's neat, and doesn't contain thousands of code lines in one single file.
Every .py file will have its own request handler.
Each .py file will serve a certain function.
(the question... |
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... |
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...
~21 users here now
Welcome to r/DailyProgrammer!
First time visitors of Daily Programmer please Read the Wiki to lea... |
Adobe Flash Professional version MX and higher
Adobe Flex
This technique relates to:
See User Agent Support for Flash for general information on user agent support.
The objective of this technique is to show how non-text objects in Flash can be marked so that they can be read by assistive technology.
The Flash Player s... |
Programmers typically place debuggers in the "uh oh" corner of their toolboxes, somewhere between the network packet sniffer and the disassembler. The only time we reach for a debugger is when something goes wrong or breaks and our standard debugging techniques such as print statements (or better yet, log messages) do ... |
Welcome to the first nearly-useful edition of Twisted Conch in 60 Seconds. In previous posts, I demonstrated how to create an SSH server no one could log in to, and then how to create an SSH server with password authentication but no content beyond that. Today I'll show you how to present some data to clients which con... |
This is the error Iâm getting since I updated Thin from version 1.2.7 to 1.2.8. When I uninstall the newer version and tell my bundle to use 1.2.7 again everything is fine.
/usr/lib/ruby/gems/1.8/gems/thin-1.2.8/lib/thin/request.rb:52:in `initialize': uninitialized constant Thin::HttpParser (NameError)
from /usr/lib/... |
Introduction
web2py[web2py] is a free, open-source web framework for agile development of secure database-driven web applications; it is written in Python[python] and programmable in Python. web2py is a full-stack framework, meaning that it contains all the components you need to build fully functional web applications... |
Bismut
Re : [HOW TO] adesklets : configuration des desklets
Bon, je ne trouve toujours pas le moyen d'afficher mes desklets au bon endroit, voici le contenu de mes fichiers :
.adesklets
# This is adesklets configuration file.
#
# It gets automatically updated every time a desklet main window
# parameter is changed, so ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.