text stringlengths 256 65.5k |
|---|
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... |
pontiac76
[résolu]Google Ok mais pas internet avec Ubuntu 12.04
Bonjour,
J'ai posté hier un message à propos de mon impossibilité d'aller sur internet sauf sur sur google avec mon installation toute neuve d'Ubuntu 12.04 LTS sur un second disque dur de mon pc fixe.
Devant l'absence de réponse, j'ai relu les règles du fo... |
web.py 0.2 tutorial
Starting
Du kennst also Python und willst eine Webseite erstellen. web.py gibt dir die Möglichkeit, das leicht zu bewerkstelligen.
Wenn du das ganze Tutorial durcharbeiten willst, wirst du python, web.py, flup, psycopg2 und postgres brauchen. Weitere Details dazu auf webpy.org.
Wenn du bereits ein w... |
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ô... |
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... |
I'm trying to use multiprocessing's Pool.map() function to divide out work simultaneously. When I use the following code, it works fine:
import multiprocessing
def f(x):
return x*x
def go():
pool = multiprocessing.Pool(processes=4)
#result = pool.apply_async(self.f, [10])
#print result... |
Phoen1x
Re : [HOW TO] adesklets : configuration des desklets
J'ai besoin d'un coup de main, donc j'ai voulu installer les adesklets
Weather forecast et system moniteur
Le problème c'est que j'avais pas vu le tuto pour l'installation de adesklest .
J'ai bigouilller un long moment sur weather car il ne me le lancait pas ... |
I'm using a Python autocomplete plugin from bassistance.de but I'm receiving a 500 error when typing, instead of suggestions.
Firebug states a 500 while Python is reporting a name error at line 200 inside my views.py.
"global name 'HttpResponse' is not defined"
Error copied from Firebug:
GET http://127.0.0.1:8000/ajax/... |
toto2849
Connexion VPN automatique (NetworkManager)
Bonjour,:D
-Actuellement en stage il met demandé de mettre en place une connexion VPN qui se lance automatiquement au démarrage du pc ne laissant juste à l'utilisateur une boite de dialogue demandant login+pass.:rolleyes:
-J'ai déjà installé le plugin "network-manager... |
This is a new markup language that we call markmin designed to produce high quality scientific papers and books and also put them online. We provide serializers for html, latex and pdf. It is implemented in the markmin2html function in the markmin2html.py.
Example of usage:
m = "Hello **world** [[link http://web2py.com... |
joko
Re : Qarte arte.tv browser (ex Qarte+7)
bonjour, grands compliments à VinsS et consors, vraiment épaté. bravo à tous les p'tits fouineurs !
qualité vidéo géniale, rien à voir avec celle du site d'arte +7 !!!
Dernière modification par joko (Le 06/11/2012, à 12:35)
Je suis un homme, quoi de plus naturel en somme ?
l... |
I have created a simple script tool which has a single parameter of type "String". I have written the tool validation to disable the input field (simply trying to learn tool validation). The validator code is as follows:
class ToolValidator:
def __init__(self):
import arcpy
self.params = arcpy.GetParameterInf... |
Introduction
Static analysis unit interface and usability in Visual Studio 2012
Methodology of comparing the analyzers' diagnostic capabilities
Doom 3
Quake 3: Arena
Wolfenstein: Enemy Territory
Total table of comparison results
Conclusions
References
After Visual Studio 2012 was released with a new static analysis uni... |
I'm learning basic algorithms and implementing them in Python. Critiques needed/welcome.
import pudb; pu.db
import random
def selection_sort(list_):
"""Implement selection_sort algorithm: iterate L to R in list, grab value
if greatest and inserting into correct pos. After each loop, decrement
length of iter... |
There are a couple of interesting solutions that don't depend on groupby. The first is really simple:
def apply_to_bins(func, values, bins):
return zip(*((bin, func(values[bins == bin])) for bin in set(bins)))
This uses "fancy indexing" instead of grouping, and performs reasonably well for small inputs; a list-com... |
I know LaTeX is used a lot in academia to format papers and dissertations. How is LaTeX used in industry and what are some examples? I am wondering whether knowing LyX will give me a leverage when applying to jobs.
A very common use of LaTeX is for automatic generation of high quality PDF reports that present the resul... |
kr2sis
configauration de Apache --- help please !!!
bonjour
autre souci que j'ai négligé par nécessité (il a fallu s'occuper du lourd avant de faire le léger...) : apache
je ne sais pas si c'est moi qui comprends rien, mais meme en cherchant partout, je ne trouve pas de tuto qui veuille que je réussisse une bonne confi... |
I have decided that when someone starts a conversation with the words, "I don't mean to bug you, but..." THAT IS EXACTLY WHAT THEY MEAN TO DO. This revelation is not new to me, but still irritates the crap out of me. I would prefer a little honestly, if you want something from me, don't disguise it with fake apologies ... |
I want to pass a request to my forms in formset of StackedInline. Now I have:
from django.contrib import admin
from django.utils.functional import curry
class AlbumInline(admin.StackedInline):
form = AlbumAdminForm
model = Album
extra = 1
def get_formset(self, request, obj=None, **kwargs):
forms... |
A Restless Todo app with EmberJS and Flask: Part 1
The goal of this and subsequent articles will be to build our very own Todo app in EmberJS backed by the wonderful Flask Python-based web framework. This is a living documents which has a home on Github. I know there must be mistakes in here! So please, if you find any... |
rodofr
Re : Voyager 12.04
Ah ! mais voyager n'est pas aussi parfaite que ça !!!:lol: Il y a toujours des erreurs et ainsi va le monde. C'est parfois un problème de droits mais je crois que c'est sur la 32 bits. Je l'ai déjà souligné sur le forum et sur astuces sur mon site.
Hors ligne
Tux35
Re : Voyager 12.04
Hello
Et ... |
I am writting a batch file that pings a website, for example:
Pinging youtube.com [173.194.70.91] with 32 bytes of data:
Reply from 173.194.70.91: bytes=32 time=187ms TTL=44
Ping statistics for 173.194.70.91:
Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Min... |
I'm using Python 2.7 with colorama 0.2.5. I'm calling a method, that prints some coloured text:
from colorama import Fore
from colorama import Style
from colorama import init
def sendData(self):
print("Sending data..."),
sys.stdout.flush()
self.browser.submit()
print(Style.BRIGHT + "... |
Firstly let me mention I'm not a facebook user and that i'm utterly confused on how to implement the simple of task of having page/profile/whatever on Facebook for my Django app. Everything I read either seems to be conflicting or outdated.
Basically I want users to be able to follow/like my page/profile/app, which my ... |
I am trying to have a thread run in the background that loops that I can turn off with a gui button that sets the go property of the Thread object to false. However the thread only runs for a split second.
class MyThread(threading.Thread):
def __init__(self):
threading.Thread.__init__(se... |
When using list_display as described under http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display you can not only display fields but custom callables as well:
def colored_name(self):
return '<span style="color: #%s;">%s %s</span>' % (self.color_code, self.first_name, s... |
#!/usr/bin/env python
# Written by Magnus Lie Hetland
"Everybody's favourite sorting algorithm... :)"
def partition(list, start, end):
pivot = list[end] # Partition around the last value
bottom = start-1 # Start outside the area to be partitioned
top = end... |
Mod_python's PSP: Python Server Pages
by Gregory Trubetskoy
02/26/2004
The new 3.1 version of mod_python introduces several major additions and enhancements over the previous 3.0 version. They are PSP, Cookie, and Session support. This article will introduce the first addition on the list, PSP.
Python Server Pages (PSP... |
Growling bzr commits over the network
All distributed version control systems have their strengths. One of Bazaar’s is that it has an installer for Windows including a Tortoise. It also has an Eclipse plug-in (but don’t forget this other thing that it requires). And it supports ‘checkouts’ that are automatically pushed... |
malbo
[Tuto] Principes (quelques) de Ubuntu en mode UEFI
- Equivalence Bios-UEFI pour les amorceurs de Grub
L'amorceur de Grub dans le système Bios peut se trouver dans le MBR ou dans le secteur de Boot d'une partition. Son équivalent dans le système UEFI est un fichier qui porte l'extension .efi et qui se trouve (dans... |
I recently had some time series analysis to do, and I decided to do this work in Pandas. Particualarly, I had to deal with many timeseries, stretching from different startpoints in time to different endpoints in time. Each timeseries was available as an ASCII file. The data were daily data. The time information was giv... |
For a project that I’m considering I’ve spent a few hours looking into using Python to access GMail. There’s a nice Python library called libgmail, but it’s a bit overkill since all I want is to see how many unread emails I have. After a bit of searching I found ot that there’s an atom feed that can be used to do exact... |
Download
FREE PDF
Groovy is a dynamic language for the Java™ Virtual Machine (JVM). It shines with full object-orientation, scriptability, optional typing, operator customization, lexical declarations for the most common data types, advanced concepts like closures and ranges, compact property syntax and seamless Java™ ... |
Written by Eric Rasmussen on September 25, 2013.
The most generic definition of confidence in your code is “code that does what you think it does”. No easy task. In a codebase of even modest size, there is far too much room for flawed assumptions, edge cases, and other unexpectations. Programmers seem to agree that gai... |
This is a Python wrapper to libcangjie, the library implementing the Cangjie input method.
Below is a trivial example of how to use it:
import cangjie cj = cangjie.Cangjie(cangjie.versions.CANGJIE3, cangjie.filters.BIG5 | cangjie.filters.HKSCS) for c in cj.get_characters("a*y"): print(c)
For more details, refer to the... |
This is possible in python using FeatureClasstoFeatureClass with Fieldmappings. You can also rename fields at the same time.
So if you have a Featureclass with FIELD3,FIELD2,FIELD1 and you want the result to be FIELD1,F2,F3 then the following code should accomplish this.
arcpy.env.overwriteOutput = True
input_fpath = "... |
I'm currently writing a telnet server in Python. It's a content server. People would connect to the server via telnet, and be presented with text-only content.
My problem is that the server would obviously need to support more than one simultaneous connection. The current implementation I have now supports only one.
Th... |
I'm trying to write own pipe-backend for powerdns, but can't get it work properly. I'm starting pdn_server with my backend and try to test it with command:
# nslookup example.com 127.0.0.1
and
# dig @127.0.0.1 example.com
First problem is that first query to backend comes with type 'SOA'(backend abi version 2):
Q examp... |
I have a simple 3d histogram
which I want to import into pgfplots, e.g. using matlab2tikz or by hand.
PGFplots does not offer 3d histograms.
Is there an easy way to do this?
You can use
If you have saved a plot from Matlab as an image called
\addplot3 graphics[points={%
(-4.4449,4.6547,0) => (110.814,167.827)
(-4.633,-... |
JavaScript
shtoom — 2011-06-07T07:23:10-04:00 — #1
OK folks I am just going to fire a question out into cyber space!
How can I display 3 random images with descriptions from a flickr account? I know there are galleries that can handle this but they seem to display one large image with small thumbnails at the bottom lik... |
After studying this page:
I am hoping to find some setup.py files to study so as to make my own (with the goal of making a fedora rpm file).
Could the s.o. community point me towards some good examples?
Complete walkthrough of writing
If you'd like a real-world example, I could point you towards the
These aren't simple... |
This question already has an answer here:
I must be missing something, or under-thinking what goes on with a basic T Test, but I was under the impression that if I do a T-test, and one of my samples was made up of only one observation, the test would fail.
To see if this is indeed the case, I ran some code in Python co... |
kryss
Re : [HOW TO] adesklets : installation sous Ubuntu Dapper et Edgy
ah la galere...
etu tu crois que tu peux savoir pourquoi les desklets de gdesklet marchent pas?
c est quoi un capteur rss grab?
Hors ligne
toma222
Re : [HOW TO] adesklets : installation sous Ubuntu Dapper et Edgy
Non désolé, j'ai laissé tomber gdes... |
After some refactoring of the existing event hookup API, Stephan Richter and I implemented on the fly AJAX field validation. Here is how you would add validation to your form:
class ValidatorForm(layout.FormLayoutSupport,
jsvalidator.MessageValidator, form.Form):
zope.interface.implements(interf... |
bertrand47
[Résolu] Duplicate sources list
J'ai depuis quelques jours une erreur "duplicate sources list", visiblement du à un doublon i386 et amd64. J'ai une installation amd64.
W: Duplicate sources.list entry http://security.ubuntu.com/ubuntu/ precise-security/main amd64 Packages (/var/lib/apt/lists/security.ubuntu.c... |
from blessings import Terminal
import thread
from time import strftime,time,sleep
from twisted.internet import reactor
from twisted.internet.defer import Deferred, DeferredList
from twisted.internet.protocol import Protocol
from twisted.web.client import Agent, HTTPConnectionPool
from twisted.web.http_headers import He... |
Antichoc
[Résolu] Installation en ligne
Bonjour, je souhaites savoir si sous ubuntu il existe une commande qui permette de télécharger un pakage sur le serveur de ubuntu et qui l'installe automatiquement avec les dépendances ?
En bref, je souhaites installer VLC avec ces nombreuses dépendances en puisant directement su... |
ABYSS
Rapport de bogue négatif [RESOLU]
Bonsoir,
Voilà je suis inquiet car la mise à jour d'aujourd'hui concerne , login, passwd et ppp.
Et voilà ce que j'ai dans le rapport de bug.
Les paquets suivants seront mis à jour :
login passwd ppp
3 mis à jour, 0 nouvellement installés, 0 à enlever et 0 non mis à jour.
Il es... |
I wrote this simple code (in python) in test.py. I try to run timeit and I don't have any errors but I don't get any information about the time of run. Can you help me ?
import timeit
def functionsWhile():
"Desc about function"
lic = 0
n = 30000
while lic<= n:
lic += 1
#print "test"
... |
nesthib
[JEU] challenge bash #6
Espaçeur de paragraphes
Imaginons un texte, celui-ci est composé de différents paragraphes. La plupart du temps un paragraphe sera coupé en deux à la fin d'une page. Le but de ce challenge est de réaliser un script qui formate le texte de façon à ce qu'un paragraphe ne soit jamais coupé ... |
SQLITE Vs PICKLE
pywebsite.sqlitepickle is a little module I just made which combines sqlite and pickle for persistence. Useful since it works with python3, and both pickle and sqlite are included with pythons (including pypy).
Import the module.
>>> from pywebsite import sqlitepickle
An in memory db.
>>> db = sqlite... |
I'm using django-social-auth to do Facebook server-side authentication, and I am getting this error that I've been unable to track down: AuthFailed('There was an error authenticating the app').
I do NOT get this error when I test locally and I have the Facebook app site URL pointing to localhost.
However, I do get this... |
I have a 2D numpy array as follows:
import numpy as np
foo = np.array([[(i+1)*(j+1) for i in range(10)] for j in range(5)])
#array([[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
# [ 2, 4, 6, 8, 10, 12, 14, 16, 18, 20],
# [ 3, 6, 9, 12, 15, 18, 21, 24, 27, 30],
# [ 4, 8, 12, 16, 20, 2... |
Feature Request: GUI Menu Editor That Actually Works and is Actively Maintained
Running XFCE4.10 Arch Linux. I've had off and on different GUI menu editors have limited to no functionality to only be later broken by updates.
Is it possible to implement a GUI menu editor that just works with 100% accuracy and stays work... |
I am trying to populate data from some csv files into a numpy array with the following code:
PreExArray=zeros([len(TestIDs),numColumns],float)
for row in reader:
if row[1] =='PreEx10SecondsBEFORE':
PreExArray[(j-1),0]=[row[2]]
However, the last line of code above throws the following error:
ValueError: set... |
I have combined two .txt files using a program i wrote. Now once i combined these two .txt files i was left with an unsorted combination of data.
my data looks like this
Bud Abbott 51 92.3Mary Boyd 52 91.4Hillary Clinton 50 82.1Don Adams 51 90.4Jill Carney 53 76.3Randy Newman 50 41.2
however i want it to look like this... |
mol1
Re : Hortus belli projet de tower defense (finissons le jeu d'helly)
Un lien vers une esquisse de musique :
http://ubuntuone.com/7RqEp9oXkT6K338qog5WlX
Hors ligne
Ypnose
Re : Hortus belli projet de tower defense (finissons le jeu d'helly)
La zike est pas mal.
J'aiderai bien mais je suis pas bon codeur C, donc si v... |
This program has been disqualified.
Author &&&
Submission date 2011-06-20 19:49:55.527945
Rating 7537
Matches played 3
Win rate 100.0
import random
#Weighted random beat previous inputs
KEY=0.930
def weighted_choice(C, p):
x = random.random()
for elmt in range(len(C)):
if x <= p[elmt]:
retur... |
In the following code std::cout does not print the values, but printf does. Why is this?
#include <iostream>
#include <cstdio>
struct bits
{
union
{
unsigned char b;
struct
{
unsigned char b0:1, b1:1, b2:1, b3:1, b4:1, b5:1, b6:1, b7:1;
};
};
};
const union
{
... |
Hizoka
Re : [glade2script-GTK2] Interface graphique pour script bash ou autre.
bah le principe en lui même je le pige.
mais c'est son application où j'ai du mal.
Il va falloir que je me penche bien sur tes exemples.
Hors ligne
frafa
Re : [glade2script-GTK2] Interface graphique pour script bash ou autre.
CouCou !
oulah ... |
I want to create an array with objects, using map function:
class Something:
def __init__( self, number ):
...
def new_object( x ):
return Something(x)
map( new_object, [1,2,3,4] )
Is there default python syntax equivalent to new_object? something like Something.new(x), that I could pass to map?
(I don... |
Suppose that song i has been played fi times but that Zipfâs Law predicts that it wouldhave been played zi times. Then you deï¬ne the quality of song i to be qi = fi/zi.Your software should select the songs with the highest values of qi.
The ï¬rst line of input contains two integers n and m (1 <= n < 50 000, 1 <= m... |
I currently have an API view setup as follows:
class WeatherObservationSerializer(serializers.ModelSerializer):
dew_point = serializers.Field(source='dew_point')
wind_gust = serializers.Field(source='get_wind_gust')
class Meta:
model = WeatherObservation
fields = ('id', 'station', 'temperatu... |
I'm trying to resize images it's okey but my python ImageField which to_field is opening but not closing. So I have an error 'too many open file'. I tried the solutions around but didnt fixed. Above the code:
if( to_field.width != size[0] and to_field.height != size[1] ):
to_field.open()
image = Image.open(String... |
Level3 counters Verizonâs recent post about Netflix traffic.
"In fact, Level 3 has asked Verizon for a long time to add interconnection capacity and to deliver the traffic its customers are requesting from our customers, but Verizon refuses."
More than 90% of Americans believe that the US government is unduly influen... |
MEH-TECH
Re : [Support] Team Fortress 2
Je me disais aussi que c’était du pipo... Je me connecterai dans la soirée alors pour le récupérer
Merci
Hors ligne
MEH-TECH
Re : [Support] Team Fortress 2
C'est bon je l'ai reçu
Hors ligne
kurapika29
Re : [Support] Team Fortress 2
Bien le bonjour, chez moi depuis le début TF2 es... |
I have imported a heap of users and their data to a django project. I need to assign a password to each. Is the such a snippet out there for password generation that will cope with the Django hash and salt?
You can also use the built in function make_random_password
for user in new_users:
password = User.objects.ma... |
At work I spend a lot of time on the command line. Some of that time is spent gathering tabular information into comma separated (CSV) text files.
Since CSV text doesn't paste into spreadsheets properly formatted, when I need to share this information with managers, analysts, or users, this has been my usual workflow
G... |
Motivation
Even though the Hadoop framework is written in Java, programs for Hadoop need not to be coded in Java but can also bedeveloped in other languages like Python or C++ (the latter since version 0.14.1). However,Hadoop’s documentation and the most prominentPython example on the Hadoop website could make you thin... |
tomtom
Re : [HOW TO] adesklets : installation sous Ubuntu Breezy
raaah ! j'ai un probleme d'interpreteur python !
J'ai installé toutes les librairies via synaptic et adesklets aussi.
J'ai DL YAB (Yet Another Bar) et j'ai ca :
[i]tomtom@barad-luin:/mnt/config/programmes/adesklets/yab-0.0.2$ [/i][b]ls -l[/b]
total 56
-rw... |
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... |
galanga
Re : Qarte arte.tv browser (ex Qarte+7)
@Christophe: content de voir que cela a commencé à fonctionner... Pour le second cas qui fait une erreur, c'est parce qu'il manque un back slash sur le guillemets fermant de ...3789-visual-crop-medium.jpg ; essayez avec cela :
items.append("<item>\n <title>Dominique ... |
CSS
scott1964 — 2013-11-18T10:37:06-05:00 — #1
Greetings ... I am developing a site that uses a wordpress theme ... the customer wants it customized to include two login panels for Attorneys and Reporters at the very top of the screen. I've altered the index file to include the correct markup, but for some reason, the ... |
Secure Your Wireless with IPsec
Pages: 1, 2
Racoon Likes to Keep Secrets
Instead of manually changing the shared secrets in your /etc/ipsec.conf file, you can keep one shared secret and use the IKE protocol to negotiate a key. Racoon speaks IKE (ISAKMP/Oakley), which is a key management protocol.
I installed Racoon fro... |
I am interested in using Python to automate certain tasks. Specifically, I would like to use Python to interact with website to perform tasks such as getting specific information from a page, make request (POST data and read the response), and downloading and uploading files. So far, I have only been able to use Python... |
Introducción
web2py[web2py] es un marco de código abierto para el desarrollo ágil de aplicaciones web seguras conectadas a servicios de bases de datos; está programado en Python[python] y es programable en Python. web2py es un marco de desarrollo completamente integrado, es decir, contiene todos los componentes que nec... |
"Real world language" is a difficult measure to gauge objectively, but I'll give it a try since after all I also lack a CS background (EE major here) and am a little self-taught;-)
In many languages, a function "sees" more than one "scope" (group) of variables -- not only its local variables, and that of the module or ... |
Where to get wxPython
The latest version of wxPython can always be found at http://alldunn.com/wxPython/. From this site you can download a self-installer for Win32 systems that includes a prebuilt extension module, documentation in HTML help format, and a set of demos.
Also available from this site is a Linux RPM, wxP... |
This is probably insultingly simple and worthy of a Nelson Muntz laugh, but I'm having a real braindead moment tryng to make many to many connections across various model relationships.
I have the following models (simplified for your enjoyment!):
class Document(models.Model):
title = models.CharField(max_length=20... |
CyrilouGarou
Création de miniatures pour dossiers d'artistes dans librairie amarok
Bonjour à tous,
Nous sommes nombreux à utiliser l'excellent amarok pour écouter notre zic.
Amarok permet de ranger sa collection de la façon suivante
(exemple de chemin pour la chanson hells bells d'ACDC)
/home/cyril/Ma\ Musique/A/AC_DC/... |
This is my fileforms.py
class RegisterForm(forms.ModelForm):
password = forms.CharField(widget=forms.PasswordInput())
password2 = forms.CharField widget=forms.PasswordInput())
username = forms.CharField(max_length=15)
email = forms.CharField(max_length=25)
avatar = forms.ImageField(required=False)
class Meta:
model... |
I'm trying to upload files list to dropbox, but I get various kinds of errors. I tried this, and tried everything on the net. But I still can't get it work.
# Include the Dropbox SDK libraries
from dropbox import rest, session
import webbrowser
import os
import glob
import zipfile
import datetime
from dropbox import cl... |
What is the seven bridges?
"The most incomprehensible thing about the universe is that it is comprehensible." -Albert Einstein
Offline
Hi Amartyanil;
The seven bridges of konigsberg is an amazing problem first investigated and solved by Leonhard Euler.
In mathematics, you don't understand things. You just get used to t... |
I've been trying to get mod_wsgi working on a Mac OS X server, and I'm having absolutely no luck. I've added the LoadModule statement to the httpd.conf, and I've got the following file included:
apache_django_wsgi.conf:
WSGIDaemonProcess django
WSGIProcessGroup django
Alias /plagtest/ "/Users/plagtest/myproject/"
<Dire... |
I'm using this sample code to connect to Facebook Chat over XMPP:
#!/usr/bin/python
import sleekxmpp
import logging
logging.basicConfig(level=logging.DEBUG)
def session_start(event):
chatbot.send_presence()
print('Session started')
chatbot.get_roster()
def message(msg):
if msg['type'] in ('chat','normal... |
Twill is especially good at retrieving and submitting web forms. The form-related feature uses the commands:
showforms
formvalue <form_id> <name> <value>
submit <button_id>
formclear <form_id>
Explaining the commands is pretty straightforward.
showforms shows the forms contained in a web page. For example, try:
>>> go ... |
Initially I installed Python 3.3 from source, but then I removed and deleted the directory /usr/lib/python3.3.
When I am installing it using aptitude, I am getting this error.
Unpacking python3.3 (from .../python3.3_3.3.1-1ubuntu5_i386.deb) ...
Processing triggers for man-db ...
Processing triggers for bamfdaemon ...
R... |
I was doing this exercise from here. I made a solution work but can't help feel it could have been done in fewer lines. I'm quite new to python so I'm not too sure of the little shortcuts.
def shift(S, n):
word = ''
for i in S:
if ord(i) == 32:
word += ' '
elif ord(i)+n > 90:
a = n-(... |
I have the following scenario:
multithreaded application
I am notin control of thread creation. This is managed by the framework (in this case celery)
I have some objects which are expensive to instantiate, and notthread safe. Making them thread safe is not an option.
The objects can be instantiated in multiple places,... |
Python bindings for the megaplan.ru API
This module provides a class that implements Megaplan authentication and request signing and lets you call API methods.
To use a password:
import megaplan
c = megaplan.Client('xyz.megaplan.ru')
c.authenticate(login, password)
To use tokens:
import megaplan
# access_id, secret_ke... |
AuthorPosts
February 6, 2013 at 8:02 am #20109
Hi
Where can I change the copyright text exactly and also, I have newsletter sidebar plug in widget which doesn’t use the content font size but rather media = all is what I get from inspect elements. Can you give me a short code which changes the font size for sidebar widg... |
Okay, so how did I do it?
Getting the data
This part was actually the quickest of all. The city of Seattle releases quite a bit of interesting data, and constantly-updated 911 metadata is one of those data-dumps: it came in CSV and API form (more about this in a second), so as a jumping-off point I downloaded the CSV.
... |
Topic: [HOWTO] Configure Mailman on CentOS/RHEL 5
Follow this configurations after installing iRedMail & Mailman.
* below method was only tested with iRedMail 0.6.1 & 0.7.0
Assumptions:
- Your server's FQDN is mail-server.mydomain.com
- iRedMail & Mailman installed on the same server
/etc/httpd/conf.d/mailman.conf
# Re... |
I'm attempting to write a script that will allow me to upload an image to BayImg, but I can't seem to get it to work right. As far as I can tell, I'm not getting any result. I don't know if it's not submitting the data or what, but when I print the response, I get the URL of the home page, not the page you get when you... |
One solution is to use a numpy (download here) matrix:
>>> from numpy import zeros, matrix
>>> n = 2
>>> mat = matrix(zeros([3*n, 7]))
>>> mat
matrix([[ 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0.... |
Introduction
all(iterable)
any(iterable)
cmp(x,y)
dict([arg])
enumerate(iterable [,start=0])
isinstance(object, classinfo)
pow(x, y [,z])
zip([iterable, ])
Conclusion
Introduction
In this article, we are going to see a couple use-case examples of some of the Python built-in functions. These functions can prove themselv... |
PotatoMasher
Re : Script d'installation pour imprimantes Brother
D'accord, alors j'ai retiré brscan2 de /etc/sane.d/dll.conf. brscan-skey -l donne toujours le même device, "Not Registered".
Après avoir jeté un coup d'oeil aux groupes, je réalise que mon utilisateur n'est pas membre du groupe "scanner" et du groupe "san... |
I trying to play a MPEG4 file using Android VideoView(Media Player). But it gives out the following error. Here is the logs.
VERBOSE/MediaPlayerService(64): setDataSource(), player type = 4
DEBUG/MediaPlayerService(64): setDataSource(), player type = **STAGEFRIGHT_PLAYER**
VERBOSE/MediaPlayerService(64): [17] setVideoS... |
I'm making a game where you're a space shuttle evading oncoming meteors, this is my first Python program and I really struggle with the music part: the idea is to only use wxPython (pyGame is forbidden).
Currently I somehow managed to get the music to play when you click on a button, but then I can't control the space ... |
Edit: How to return/serve a file from a python controller (back end) over a web server, with the file_name? as suggested by @JV
Fully supported in CherryPy using
from cherrypy.lib.static import serve_file
As documented in the CherryPy docs - FileDownload:
import glob
import os.path
import cherrypy
from cherrypy.lib.st... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.