text stringlengths 256 65.5k |
|---|
How it works
If you haven’t figured it out already - the Webkey mimics a USB Human Interface Device (HID). When you insert it into your USB port, your computer sees the equivalent of a USB keyboard, the Webkey “hits” the keys required to invoke the Windows run dialog box, types the URL, and presses the “enter” key.
Wha... |
It may not be hard to implement your own sortlist on Python. Below is a proof of concept:
import bisect
class sortlist:
def __init__(self, list):
self.list = list
self.sort()
def sort(self):
l = []
for i in range(len(self.list)):
bisect.insort(l, self.list[i])
... |
UPDATE: 2.x support is now mainline! Please read the wiki page for important information about the update.
A warm welcome to you, traveller. You have arrived at the home of Py-StackExchange, the library definitively proven† to be the best library for using the SE API from Python. If you are still interested (and by gol... |
I'm working on a web application in the web.py framework and need a way for web.py/python to check if the result of a sql query is empty.
Here's my current function:
def get_hours():
result = dbconn.query("select * from hours where date < (select max(date) from last_export) order by date DESC")
return result
T... |
What program could I use to get a list of installed software using Python for cross platform or at least Windows or Mac? Please check the code which i googled, but am getting some errors. I am using Python 2.7, win 7 64 bit, eclipse
import StringIO
import traceback
import wmi
from _winreg import (HKEY_LOCAL_MACHINE... |
I released a new version of flipflop that has support for configurable urls. Details are in the readme file, but in short, when you generate a new flipflop blog, part of the config in the blog.json file will now include a section for routes. If you have an existing flipflop blog and want to update to the latest, you ca... |
There is no equivalent of fscanf or Java's Scanner. The simplest solution is to require the user to use newline separeted input instead of space separated input, you can then read line by line and convert the lines to the correct type.
If you want the user to provide more structured input then you probably should creat... |
I'm currently reading "Machine Learning in Action". In the chapter 8 of Regression, p.158 , there are few codes to plot original data point and a fitted line together.
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
ax.scatter(xMat[:,1].flatten().A[0] , yMat.T[:, 0].flatten().A[0])
xCopy = ... |
Django Blog Project #12: Adding Pygments syntax highlighting
I've finally added automatic code highlighting to my blog. It uses Pygments to do the syntax highlighting and Beautiful Soup to find all the <pre> blocks to highlight. I still write my blog posts in HTML, but now add a class attribute to my <pre> tags to spec... |
If abc is a package and xyz is a module, and if abc's __init__.py defines an __all__ that does not include xyz, then you won't be able to do from abc import xyz, but you'll still be able to do import abc.xyz.
Edit: The short answer is: your problem is that your imports are circular. Modules t and d try to import each o... |
How to convert the following hex string to float (single precision 32-bit) in Python?
"41973333" -> 1.88999996185302734375E1"41995C29" -> 1.91700000762939453125E1"470FC614" -> 3.6806078125E4
>>> import struct
>>> struct.unpack('!f', '41973333'.decode('hex'))[0]
18.899999618530273
>>> struct.unpack('!f', '41995C29'.deco... |
I have following files and directories in my project root directory
main.pybar.pyfoo \ __init__.py alice.py bob.py
the files in directory foo are all empty files, and the content of bar.py is
alice = None
bob = None
and main.py is
import foo
import bar
print 'foo:', dir(foo)
print 'bar:', dir(bar)
When execute python... |
JavaScript
newguy99 — 2012-10-06T10:37:52-04:00 — #1
Hello Every one
Im using window.open(URL,name,specs,replace) to open a new page
it works fine with Chrome V22 and Firefox 12
But when i use it with IE9 it gives me a strange behavior
When i click it open a new page but the original page changes to the main root of th... |
My XML looks like:
...<termEntry id="c1"> <langSet xml:lang="de"> ...
And i have the code:
from lxml import etree
...
for term_entry in root.iterfind('.//termEntry'):
print term_entry.attrib['id']
print term_entry.nsmap
for lang_set in term_entry.iterfind('langSet'):
print lang_set.nsmap
pri... |
I have a binary that runs under my default shell.
The binary runs perfectly o.k. with:
./binary input.dat
However, if I put this inside a make file:
SHELL=/bin/bash
runos:
./binary input.dat
The code crashes and leaves me quite helpless. Here is what I tested so far, everything inside my Make file and in the sh... |
In your program, for i in range(len(lists)) - evaluates to 3 as the lists object has 3 element. and in the loop total += sum(i) it would try to do a int + list operation, which results in an error. Hence you need to check for the type and then add the individual elements.
def list_sum(L):
total = 0
for i in L... |
Ok so i'm trying to run Python with Bottle.py, thru Apache and mod_wsgi, and it doesn't work so far...
I'm running it on windows, using a xampp. python v2.7
the code i added to httpd(Apache config):
<VirtualHost *> ServerName example.com WSGIScriptAlias / C:\xampp\htdocs\GetXPathsProject\app.wsgi <Directory C:\xampp\ht... |
Is there any existing tool to strip all the action code from bison grammar files, leaving only the {} around it?
I know the post is old, but I came across the same problem and found a much simpler solution using a small python script.
filename = "in.txt";
b_count = 0;
with open("out.txt", "w") as fout:
with open(fi... |
pylint is the best such tool I've found. Due to Python's nature it's difficult to statically analyze it, but it will catch undefined variables, basic type errors, unused code, etc. You'll want to tweak the configuration file, as by default it outputs many warnings I consider useless or harmful.
Here's part of my .pylin... |
Here is the Valgring report:
==14546== Thread 5:
==14546== Invalid free() / delete / delete[]
==14546== at 0x490555D: free (vg_replace_malloc.c:235)
==14546== by 0x3BF7EFAA8F: free_mem (in /lib64/tls/libc-2.3.4.so)
==14546== by 0x3BF7EFA581: __libc_freeres (in /lib64/tls/libc-2.3.4.so)
==14546== by 0x480267... |
I am attempting to find the best means of checking order confirmation emails. The back story is that when a user creates an order or signups for membership on our site, an email confirmation is sent. I need to verify the delivery and content of that email. Also email addresses must be unique so we generate them on the ... |
Tutorial
Ringkasan
Memulai
Penanganan URL
GET dan POST: perbedaannya
Memulai server
Menggunakan template
Form
Menggunakan database
Selama pengembangan
Berikutnya?
Memulai
Jadi Anda mengerti Python dan ingin membuat sebuah website. web.py menyediakan kode untuk membuatnya mudah.
Apabila Anda ingin mengikuti keseluruhan ... |
I'm really suffering from this problem for so long.
Originally, after plotting something with matplotlib, I could easily save the image.
However, after installing scipy, I couldn't save my image anymore.
(I installed matplot and scipy by using pip.)
I tried to look up some information, but I still can't solve the probl... |
In order to accurately determine whether the application is partially started/stopped, you must first determine the deployment targets against which the application is deployed, and then determine whether or not the application is running on that server:
def isApplicationRunning(applicationName, serverName, nodeName) :... |
I've just created a forms.models.BaseInlineFormSet to override the default formset for a TabularInline model. I need to evaluate the user's group in formset validation (clean) because some groups must write a number inside a range (0,20).
I'm using django admin to autogenerate the interface.
I've tried getting the requ... |
#0 Re : -1 » Restauration du tableau de bord par défaut » Le 09/05/2010, à 11:05
#1 Re : -1 » Restauration du tableau de bord par défaut » Le 10/05/2010, à 21:01
#2 Re : -1 » Compiz , cube bureau virtuel » Le 03/04/2010, à 11:36
remyb
Réponses : 13
Je suis sou 10.4
Compiz > Options générales> taille virtuelle horizonta... |
rmanf30
Re : Test de Qualité des Codecs Libre VS x264 - Septembre 2010
Ma surprise à propos des paramètres été justifiée, apparemment ils ne sont pas corrects.
-sn -vcodec huffyuv -acodec flac %1.mkv
J'ai le message d'erreur suivant : "Peut-être des paramètres incorrects tels que bit_rate , le taux , la largeur ou la h... |
I have a setup in Python where I use the OpenCV library to read the frames of a video in as 2D arrays--these videos are grayscale, so I'm using unsigned 8-bit integers for the pixel values.
In my next step, I'm trying to use pyplot.imshow() from matplotlib to display the frame of the video. Unfortunately, I'm getting s... |
Python in the Cloud
A basic introduction to using the Python boto library to interact with AWS services and resources.
This article explores using the boto library to work with resources in the Amazon Web Services (AWS) cloud. For those wondering, the boto name refers to a species of freshwater dolphin found in the Ama... |
freopen("/my/newstdin", "r", stdin);
freopen("/my/newstdout", "w", stdout);
freopen("/my/newstderr", "w", stderr);
... do your stuff
freopen("/dev/stdin", "r", stdin);
...
...
This peaks the needle on my round-peg-square-hole-o-meter, what are you trying to accomplish?
Edit:
Remember that stdin, stdout and stderr are ... |
quickly.prompts.checklist()
When the developer clicks the "delete keys" button, I wanted to present them with a list of keys they could choose from. And then have all of those get deleted. This seemed like the kind of thing that I'd want to use in other programs, so I decided to solve this problem generically by adding... |
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 (... |
echo '<h1>hello, world</h1>' | firefoxcat index.html | firefox
These commands don't work.
If firefox can read stdin, I can send html to firefox via pipe.
Is it possible to make firefox read stdin?
These commands don't work.
The short answer is, you're better off writing a temporary file and opening that. Getting pipes ... |
lekokeliko
Tictactux jeu en Python
Je tient a vous présenter ma grande réalisation :
le Tictactux en python développé depuis la nuit du 24 decembre 2007
morpion like parametrable a souhait
quelques précisions :
versions antérieures :
-1.07.29 beta test
-1.07.30 détails des modifs plus bas (post 7)
-1.07.31 modification... |
I just started working with Django coming from years of Spring MVC and the forms implementation strikes as being slightly crazy. If you're not familiar, Django forms starts with a form model class that defines your fields. Spring similarly starts with a form-backing object. But where Spring provides a taglib for bindin... |
I want to create computer for the word-game Ghost. However, I'm having problems thinking of a good way to deal with accessing the huge word list. Here's my current implementation (which doesn't work):
import os, random, sys, math, string
def main():
#Contains a huge wordlist-- opened up for reading
dictionary =... |
I am trying to make a regex in python to detect 7-digit numbers and update contacts from a .vcf file. It then modifies the number to 8-digit number (just adding 5 before the number).Thing is the regex does not work.
I am having as error message "EOL while scanning string literal"
regex=re.compile(r'^(25|29|42[1-3]|42[8... |
crivello
ubuntu-one sur 10.04 : aucun lancement
bonjour,
après de multiples tentatives, je n'arrive pas à faire fonctionner ubutu-one sur gnome - ubuntu 10.04 LTS,
le launch ne fait rien, et le preference tourne dans le vide puis s’arrête après 30s,
en ligne de commande cela donne les erreurs suivantes :
jcc@bootes:~$ ... |
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... |
Hizoka
[pyqt4] MKV Extractor Qt
Bonjour,
je poste donc ma 1ere version de MKV Extractor Gui en pyqt4, renommé MKV Extractor Qt pour le coup.
C'est mon 1er logiciel en python, alors n’hésitez pas à me faire des retours.
Pour rappel, le logiciel permet de :
Extraire les pistes contenu dans des fichiers matroska (mkv).
Co... |
My Situation
I have a N rectangles
The rectangles all have the same shape (for example 2 inches wide x 1 inch tall) - Let's refer to this size as Sw and Sh for the width and height
I want to position these rectangles in a grid such that the rects completely on top and next to each other - like what you would see in a s... |
#1 Re : -1 » Ouvrir un nouvel onglet dans firefox » Le 26/08/2014, à 16:00
#2 -1 » RESOLU Clé usb reconnue par gpart mais n'apparait pas dans nautilus » Le 15/08/2014, à 18:32
hardouin48
Réponses : 5
bonjour,
ma clé usb 3.0 sandisk en Fat32 que j'ai utilisé maintes fois sur ubuntu et windows, fonctionne toujours sous w... |
My exam question asks me to take two letters as inputs, and display all letters in the alphabet between the two inputs (inclusively). It also needs to do this in the order the user input them (so GA produces GFEDCBA not ABCDEFG). How would I approach this task?
>>> import string
>>> def letterList (start, end):
... |
Setting up PyCharm for PyQGIS and Qt
10 May 2014
I have been asked a few times how to setup PyCharm so you are able to do PyQGIS development, or even PyQt because that is just as great. Rather then tell each person one at a time I thought I would throw it out as a blog post so everyone gets the benift.
The first thing ... |
How can I change the default filter choice from 'ALL'? I have a field named as status which has three values: activate, pending and rejected. When I use list_filter in Django admin, the filter is by default set to 'All' but I want to set it to pending by default.
How can I change the default filter choice from 'ALL'? I... |
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 ... |
I am working on a twitter oauth login. However, when I do the request_token, the very first step, the response code always return 401 Unauthorized.
I have searched a lot for a week, but I cannot find the solution, please help.
Here is my connection:
URL url = new URL("https://api.twitter.com/oauth/request_token");
Http... |
I have this Python code to do this:
from struct import pack as _pack
def packl(lnum, pad = 1):
if lnum < 0:
raise RangeError("Cannot use packl to convert a negative integer "
"to a string.")
count = 0
l = []
while lnum > 0:
l.append(lnum & 0xffffffffffffffffL)
... |
January 1st, 2010
06:30 pm - Выделяем поля из логов nginx на python
Для анализа логов nginx мне понадобилось регулярное выражение, которое бы корректно разделяло запись на отдельные поля. Немного по-колдовав над логом, я понял, что наилучший способ разобраться в формате лога - это выцепить его из конфигурации сервера.
... |
So every number in the code that we are sending to a method as an argument is considered as a Magic Number? To me, it shouldn't. I think if some number is let's say it is for minimum length of user name and we start using "6" in the code...then yeah we have a maintenance problem and here "6" is a magic number....but if... |
toniovip
Réponses : 1
Salut à tous.
J'ai actuellement un pc avec 2 OS : ubuntu pour le travail, et windows pour tout ce qui est jeux/multimédia.
Je viens d'acquérir un nouveau pc qui ne contient que ubuntu.
J'ai donc voulut supprimer la partition ubuntu sur le premier PC, histoire d'avoir un système par PC.
J'ai lancé ... |
henry-006
Re : [script] Pixup : Poster une image rapidement sur un forum
ah désolé, moi ch'suis allé direct dans la logithèque, comme un bon bourrin,
OS: Ubuntu 12.10 (Quetzal quantal ) 64 bits + Windows XP pro SP2 x32 en double boot
PC Medion / Processeur: Intel core2 Duo (CPU 2.80GHz) Mémoire vive:3029 MiB
Carte Grap... |
I'd like to find the elapsed time since the first time an event was observed. For this I saved each observation in a CSV file. Each event is identified by a unique hash.
Right now I'm doing the following:
from pandas import *
from bz2 import BZ2File
events = DataFrame.from_csv(BZ2File('events.csv.bz2', 'r'), sep='\t', ... |
I have a dropdown in a modelform and the user should not be able to change the selected value.I found that a disabled does exactly do what I need. However there is an oddness to this:
The first time when the form opens (GET) the value is selected and the user can't change the value. which is great:
But as soon as there... |
How can I get a ° character into a string?
Put this line at the top of your source
# -*- coding: utf-8 -*-
If your editor uses a different encoding, substitute for utf-8
Then you can include utf-8 characters directly in the source
This is the most coder-friendly version of specifying a unicode character:
degree_sign=... |
Python Documentation Tips and Tricks
by Cameron Laird
05/17/2001
Traditional thinking judges the merit of a computing language on objective, rather mathematical dimensions: how object-oriented is it? Are its constructs orthogonal? Does the syntax admit ambiguities? While that's appropriate for abstract analysis, when w... |
public class Complex extends Object implements FieldElement<Complex>, Serializable
NaN and infinite values according to the rules for Double, i.e. equals(java.lang.Object) is an equivalence relation for all instances that have a NaN in either real or imaginary part, e.g. the following are considered equal: 1 + NaNiNaN ... |
Answer no longer needed as I changed focus in code. (see my comment in answer) Post answers for future reference...
How do I retrieve results from a one to many backref ordered by a field in the child? I need all somethings for the gid ordered by index. But at this time they are retrieved randomly even though they are ... |
When we discuss ‘scale’ at Twilio, usually the conversation is about a system’s ability to handle growing amounts of work and how we might expand infrastructure to satisfy increasing demand. But, there is much more to 'scale' than adding servers and supporting more users. It's not just our technical infrastructure that... |
When writing a Cython wrapper for a C++ library, I've encountered a case where it's not clear how to correctly decide when to delete certain C++ instances.
The C++ library looks something like this:
#include <stdio.h>
#include <string.h>
class Widget {
char *name;
public:
Widget() : name(strdup("a widge... |
Hmm, bug in iRedAPD-1.3.8. Please find below lines in /opt/iredapd/libs/ldaplib.py (about line 209 to 212):
# Return if recipient account doesn't exist.
if recipientDn is None or recipientLdif is None:
self.logger.debug('Recipient DN or LDIF is None.')
return SMTP... |
#include <iostream>
using namespace std;
int main(){
int values, list[30] = {};
cout << "How many input values[max: 30]?\n";
cin >> values;
cout << "Enter " << values << " numbers.\n";
for (int i = 0; i < values; i++){
cin >> list[i];
}
int biggestNum = list[0], temp;
for (int i = 0; i < values; i++){
temp ... |
Here's my C:\WINDOWS\system32\drivers\etc\hosts file:
127.0.0.1 localhost192.168.100.1 router
testing it:
C:\>ping router
Ping request could not find host router. Please check the name and try again.
C:\>ping 192.168.100.1
Pinging 192.168.100.1 with 32 bytes of data:
Reply from 192.168.100.1: bytes=32 time<1ms TTL=64
R... |
FelixP
[Résolu] Sources de Logiciels ne veut plus démarrer…
Salut ! Je reposte mon problème car il semblerait que mon ancien post soit tombé dans les abîsses…
Lorsque je veux ouvrir la liste des sources de logiciels, j'obtiens une erreur…
Ce problème est apparu, je crois, après ajout du dépot permettant d'installer cam... |
I'm looking for a framework which is appropriate for beginners (in Python and web development).
I already found out about Django and web.py. I think that one of the most important things for me is good documentation.
Thanks for the help, Dan
I think Django has some of the best documentation of any project I've worked o... |
Usei
Arch Linux
para estes testes, mas acredito que funcione em qualquer outra distribuição.
Na verdade deveria ser: "Instalando o LaTeX sem usar o gerenciador de pacotes dadistribuição" :P.
Baixe o arquivo install-tl-unx.tar.gz dehttp://www.tug.org/texlive/acquire-netinstall.html.
Para iniciar a instalação basta extra... |
Maisondouf
Re : Postfix est en train de me rendre fou ...
Pourtant à première vue, ce que tu veux pouvoir gérer n'est pas spécialement complexe mais je ne sais peut-être pas tout.
ASUS M5A88-v EVO avec AMD FX(tm)-8120 Eight-Core Processor, OS principal Precise 12.04.1 LTS 63bits½
Bricoleur, menteur, inculte, inadapté s... |
I have been assigned a web server to administer, and I have to deploy a web application I wrote on it. This application is mostly a single page in JS + HTML, but it has a little form to accept submissions from users, and there is some simple server side code to handle them, written with Python and the Flask web framewo... |
Silly question, but is there a built-in method for converting a date to a datetime in Python, ie. getting the datetime for the midnight of the date? The opposite conversion is easy - datetime has a .date() method. Do I really have to manually call datetime(d.year, d.month, d.day) ?
Silly question, but is there a built-... |
It seems you're trying to run xbot.py from within the creator folder.
This is the output I get with xbot.py containing import util:
C:\Users\Luke\Python stuff\AXBot\creator>xbot.py
Traceback (most recent call last):
File "C:\Users\Luke\Python stuff\AXBot\creator\xbot.py", line 4, in <module>
import util
ImportErr... |
I have a two dimensional list:
def list():
list1 =[1,2,3,4,5]
list2 =[0,0,0,0,0]
list3 =[6,7,8,9,10]
list=[list1,list2,list3]
for i in list:
print(i)
list()
6 will have the coordinates (0,2), right?? I want to move 6 to (0,1) and when I do that, I also want (0,2) to become 0.
How do I do th... |
How can you get the SQL for a Django model's .save(), i.e.
from django.db import models
class MyM(models.Model):
text = models.TextField()
How can you get the SQL that would be created/used in the following scenario:
>>> m = MyM(text="123")
>>> m.save()
# What SQL Django just run?
Thanks! |
I am working on a project where I want to use a C++ library in Python. After a little bit of research I figured out that Swig would be a good way to do it (a small example worked).
So now I am trying to include Swig into cmake to make things more comfortable.
In my case, I have a really small program to test things:
#i... |
I want to either update a row in the database, if it exists, or create it if it doesn't.
I have a class that first sets the instance variable user:
self.user = models.User.query.filter_by(entity=self.entityUrl).first()
# can be None if not found
Then, later on in another class method I do this:
if self.user is not Non... |
Welcome to WebmasterWorld Guest from 54.161.166.171
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
View before Propagation
like we do on PCs
mcjohnson
msg:3754295 10:18 am on Sep 29, 2008 (gmt 0)
Hello all,
on the PC side of thin... |
I have recently changed to ubuntu from windows and am having difficulty with the permissions on my postgresql database which I am trying to recreate.
My problem is as follows: I have a script which imports csv files into the postgresql database. The data is located in multiple csv files and I am using psycopg2 to handl... |
I wrote a little program which downloads the latest daily tide graph from NOAA, adds a text table to the image containing tidal information, and then sets this image as my desktop wallpaper.
from bs4 import BeautifulSoup
import Image, ImageDraw, ImageFont
from urllib import urlretrieve
import urllib2
import time
import... |
According to the documentation page: http://matplotlib.sourceforge.net/api/pyplot_api.html the way to use the axvline is like
axvline(x=0, ymin=0, ymax=1)
However, this does not work in my computer. Nothing is drawn. Rather, simply
axvline(x=0)
without setting the ymin and ymax works.
I am not sure whether this is a ... |
I am having some problems with a QObject that is being deleted when I don't expect it to.
I have this class (note that I don't declare Q_OBJECT)
class MyEntry : public QTreeWidgetItem
{
public:
MyEntry(QTreeWidgetItem* _parent, QString _name = "noname") :
QTreeWidgetItem(_parent, QStringList() << _name) {}
... |
I have a simple word jumble game. I made the jumble already, but now I want to add a 'hint' system. I don't know how to have 1 item from tuples show up. I have 2 tuples, and I want to pull from the 2nd tuple based on the what the first tuple is. I have a WORD=("x", "y", "z") and HINT=("x", "y", "z"). When the user ente... |
In the code below I am trying to get the second 'while' statement (while digit_check) to receive the new date from the earlier while_count statement. But it seems to be picking up the original assignment for the user_date variable from the first assignment line.
How can I get the new variable assignment to pass to the ... |
Posting snippets of my code here. I am trying to get a footing around debugging.
struct dirent *s_dirent;
char path[300];
....
bzero(path,300);
...
fd_dir = opendir(path);
while((s_dirent = readdir(fd_dir))!=NULL)
{
if(s_dirent->d_name[0] == '.')
continue;
else
break;
}
if(s_dirent == NUL... |
I need to allow users edit and print client-related documents (invoices and another).
User fill print form (select clients, month, how much copies of each of 4 types of documents he/she needs) and click to print button.
Next my system should do (algorithm):
result = create new word-friendly file # because user may man... |
krystoo
Comment installer des mises à jour téléchargées ?
Bonsoir, alors je vais faire le tour je crois ^^
après troisième installe sur le pc portable, se coup ci j'avais 197 mises à jour. J'ai fait en plusieurs fois car sinon interminable.
Quand aux 6 dernières màj que j'ai téléchargé, visiblement elles ne se sont pas... |
I'm giving BeautifulSoup an html document and simply by constructing a BeautifulSoup object instance with the full html, it seems to choke on the following line of a jQuery script that's embedded within the html:
var txt = "Logged in as: <a href=\"http://somedomain.com/the-blah/\">" + uname + "</a> <small>(<a href=\"ht... |
As a newbee I am trying to create a basic theme installer using Glade and python. Everything is working fine but i am not able to find anywhere how to use get_filename() method for gtkFileChooserButton. My Glade File Looks Like this.
<?xml version="1.0"?>
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- inter... |
AMAZON SUPPORT
So I ended up talking to the guys at Amazon as well after David Wolever's reply. Just in case any of you come across this post again. Using the internal server IP alone isn't enough, it is however a good start. If you are running Ubuntu for your Postgresql instance (preferably Natty Narwhal), make sure y... |
Short version: What's the best hashing algorithm for a multiset implemented as a dictionary of unordered items?
I'm trying to hash an immutable multiset (which is a bag or multiset in other languages: like a mathematical set except that it can hold more than one of each element) implemented as a dictionary. I've create... |
Python
kylewolfe — 2013-02-22T11:35:25-05:00 — #1
So I've just started playing around with python. My first script was to spool through a pipe deliminated csv.
I noticed this language is slightly more strict than PHP I receive an error when trying to assign a non existant variable to a new list.
#open csv file
ifile =... |
idragus
problème python EOFError
Bonjour j'ai installé hier Ubuntu 12.0.4 LTS sur une virtual Box et aujourd'hui en essayant de programmer (avec sublime Text 2 comme éditeur de texte) j'ai un problème de EOFError mais je ne comprend pas pourquoi car hier j'ai réussi à programmer sans problème et aujourd'hui j'ai ce pro... |
The following functional program factors an integer by trial division. I am not interested in improving the efficiency (but not in decreasing it either), I am interested how it can be made better or neater using functional constructions. I just seem to think there are a few tweaks to make this pattern more consistent a... |
I'm trying to show a jpg image as background for a GUI thing I'm building.
I can get it to work in a single method:
from Tkinter import *
from PIL import Image, ImageTk
class MakeGUI(object):
master = None
w = None
def __init__(self):
self.canvasSizeY = 400 #height
self.canvasSizeX = 640 #wi... |
Shortly after I wrote my news article on the Python wiki program MoinMoin, Jürgen Hermann announced a new version with this notice:
This is a security update, which explains the short release cycle. It replaces someexec()calls by__import__(), which is much safer (or actually, safe in contrast to totally unsafe). IF YOU... |
#1926 Le 06/02/2013, à 18:17
Didier-T
Re : [Conky] Alternative à weather.com (2)
il manquait certaines info
#! /usr/bin/python3
# -*- coding: utf-8 -*-
# Par Didier-T Forum Ubuntu.fr
import urllib.request, os, time, re, sys
from bs4 import BeautifulSoup
homedir = os.path.expanduser('~')
#### initialisation des variable... |
I have a problem with gtk.FileChooserButton in a Python script. If you choose the option âºOther ...â¹ from the button menu, the gtk.FileChooserDialog opens where you can select a new folder. If I select this new folder by double-clicking it and confirm the dialog by clicking on âºOpenâ¹, the selected folder name i... |
I have a folder with hundreds of small PDF files to print.
How can I make a batch job to print them out in alphabetical order?
dir /b | sort > %temp%\files.tmp
for /f %f in (%temp%\files.tmp) do AcroRd32.exe /t %f "\\servername\printername"
del %temp%\files.tmp
Details here about silent print command in Adobe reader.
... |
There is a Fourier transform method here. Using the example from belisarius it might be done as below. Caveat: I do not guarantee I made no cut-and-paste errors. Your mileage may vary. Considerably.
(* sample data *)
g[x_] := x + 1/2 Sin[x] + RandomVariate[NormalDistribution[.2, .05]];
SeedRandom[1111];
xmax = 8*Pi;
nH... |
phiphi076
Re : La mise a jour clamAV et clamtk
@awass
la commande te permet de lancer le programe en mode graphique
avec les droits "root" administrateur (avoir accès au système) .
lorsque tu lance clamav "normalement" sans les droits administrateur
, tu peut pas faire les mises a jour des liste de virus et programe
de... |
I usually use Perl's -c switch to check the syntax of the program and then exit without executing it. Is there an equivalent way to do this for a Python script?
You can check the syntax by compiling it:
import sys
filename = sys.argv[1]
source = open(filename, 'r').read() + '\n'
compile(source, filename, 'exec')
Save ... |
Python Dictionaries
A Python dictionary has the same benefit as a regular paper dictionary. It allows you to quickly locate the value (definition) associated with a key (word). Dictionaries are denoted by curly braces and contain a comma-separated sequence of key:value pairs. Dictionaries are not ordered. Instead, dict... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.