text stringlengths 256 65.5k |
|---|
Numerical Python
For the past few months, I've been covering different software packages for scientific computations. For my next several articles, I'm going to be focusing on using Python to come up with your own algorithms for your scientific problems. Python seems to be completely taking over the scientific communit... |
mariodessuti
Problème de redémarrage système
Bonjours,
Lorsque je clic sur REDÉMARRER mon PC s'éteint complètement.
Comment résoudre le soucis?
PC : DELL Latitude E6320 / Distribution : Xubuntu 14.04 LTS (64 bits) / Bureau : Xfce 4 / Navigateur : Firefox 30.0 & Google Chrome 35.0.1916.153 /
Kernel : Linux 3.13.0-30-gen... |
Emails and SMS
Setting up email
Web2py provides the gluon.tools.Mail class to make it easy to send emails using web2py. One can define a mailer with
from gluon.tools import Mail
mail = Mail()
mail.settings.server = 'smtp.example.com:25'
mail.settings.sender = 'you@example.com'
mail.settings.login = 'username:password'
... |
This tutorial will walk you through instrumenting your application to send custom metrics to Datadog. If you need some help as you go, pop by #datadog on freenode, where we'll be happy to answer any questions you might have. (There's a web chat client, too.)
The easiest way to get your custom metrics into Datadog is to... |
Claude LENDREVIE
Re : [Résolu] Libérer de la place sur le disque
Voici le résultat :
root@claude-System-Name:~# sudo add-apt-repository ppa:tualatrix/ppa
You are about to add the following PPA to your system:
The official Ubuntu Tweak stable repository
More info: https://launchpad.net/~tualatrix/+archive/ppa
Press [E... |
What would be faster ? Query mysql to see if the piece of information i need is there, OR load a python dictionary with all the information then just check if the id is there
If python is faster, then whats the best what to check if the id exists?
Im using python 2.4.3
Im searching for data which is tagged to a square ... |
A través del cliente vSphere podemos hacer un seguimiento de distintos parámetros de la máquina (CPU, memoria, disco, etc.) durante la última hora, situación que generalmente es insuficiente si se necesita mantener registrados dichos valores de cara a la posible resolución de una incidencia. Además a través de dicho cl... |
The issue I am running into is part of using os.stat on a path (Take C:\myfile1.txt for example). When I run os.stat on this file and take the 9th element in the resulting list I get the modified time in the form of some numbers (ex. 1348167977).
NOTE: I'm not sure how these numbers are calculated.
When I create C:\myf... |
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... |
I want to delete a database row which contains a file name when the user clicks on cancel button. Problem is that it is not deleting the database row. What am I doing wrong that the database row is not being cancelled?
Below is the relevant code of the form:
var $fileImage = $("<form action='imageupload.php' method='po... |
I want to give my graph a title in big 18pt font, then a subtitle below it in smaller 10pt font. How can I do this in matplotlib? It appears the title() function only takes one single string with a single fontsize attribute. There has to be a way to do this, but how?
I want to give my graph a title in big 18pt font, th... |
Using the iPython console, I built a pandas dataframe called df.
for (k1,k2), group in df.groupby(['II','time']):
print k1,k2
print group
df['II'] stores integers between: [-10,10].
'time' can be either 930 or 1620
My goal is to save the output (of this loop) to a single .csv file. (Not great, but I copied and... |
ctypes has a memset function already, so you don't have to make a function pointer for the libc/msvcrt function. Also, 20 bytes is for common 32-bit platforms. On 64-bit systems it's probably 36 bytes. Here's the layout of a PyStringObject:
typedef struct {
Py_ssize_t ob_refcnt; // 4|8 bytes
struct _typ... |
Asynchronous Programming in Python
Twisted is pretty good. It sits as one of the top networking libraries in Python, and with good reason. It is properly asynchronous, flexible, and mature. But it also has some pretty serious flaws that make it harder than necessary for programmers to use.
This hinders adoption of Twis... |
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... |
Suppose we have website that use MD5 hash in URL like this:
http://somewebsite.com/XXX/
where XXX is MD5 hash.
Content of this website may have sensitive information like transaction details with personal data.
There is no other authorization to this website, so if you have URL you can access it.
How safe is it? I mea... |
alex2423
Plus d'accès à la TV de SFR via VLC sur le PC
Hello tout le monde,
Je fais partie de ceux qui n'ont pas de TV. J'ai juste un bel écran Dell 24" que j'utilise comme TV. Je regardais la TV avec VLC via le flux SFR.
Depuis 1 mois à peu près, je n'ai plus d'image. J'ai encore le son.
Est ce que vous avez ce meme s... |
I've got a setup where Tornado is used as kind of a pass-through for workers. Request is received by Tornado, which sends this request to N workers, aggregates results and sends it back to client. Which works fine, except when for some reason timeout occurs — then I've got memory leak.
I've got a setup which similar to... |
I've seen some elegant python snippets using list comprehension and map reduce. Can you share some of these code or a web site.
Thanks.
Python is not lisp. Please don't try to make it look that way. It only reduces one of python's biggest strengths, which is its readability and understandability later on.
There are som... |
Instead of
cat $$dir/part* | ./testgen.py
I would like to glob the files and then use stdin for ./testgen.py while inside of my python script. How would i do this.
You could let the shell do it for you:
./testgen.py $$dir/part*
This passes every matching filename as a separate argument to your program. Then, you just... |
I am using url tag in my template for a view, that is used by two different urls. I am getting the wrong url in one place. Is there any way to force django to retrieve different url? Why it doesn't notify my, that such conflict occured and it doesn't know what to do (since python zen says, that is should refuse temptat... |
I have a very simple python routine that involves cycling through a list of roughly 20,000 latitude,longitude coordinates and calculating the distance of each point to a reference point.
def compute_nearest_points( lat, lon, nPoints=5 ):
"""Find the nearest N points, given the input coordinates."""
points = ses... |
Manipulating sys.modules
You can manipulate the modules cache directly, making modules available or unavailable as you wish:
>>> import sys
>>> import ham
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named ham
# Make the 'ham' module available -- as a non-module object... |
This article highlights and answers some of the most frequently asked questions about HTML. HTML is the foundation of the Web, and both developers and designers need to understand it.
1. What is HTML?
HTML, or Hypertext Markup Language, is a markup language that’s primarily used for Web documents. Any document that’s w... |
The first function is a naive binary search implementation to find the square root of a number:
def sqrt1(x):
if x < 0:
raise ValueError(x)
if x > 0:
if x < 1:
root = 1
while root ** 2 > x:
root /= 2
half = root
while root ** 2 != x... |
Any idea what I am doing wrong here? There are no error messages and the script runs fine, but no record is inserted into the db. Running the insert query on the database works fine.
Even if i put in a bogus IP or password no error is generated.
This is on windows with python 2.7 and the mysqldb 2.7 windows binaries.
i... |
plasticgoat
[Résolu] message d'erreur au lancement de synaptic
Voilà le message d'erreur :
W: Impossible de localiser la liste des paquets sources http://fr.archive.ubuntu.com breezy/universe Packages (/var/lib/apt/lists/fr.archive.ubuntu.com_ubuntu_dists_breezy_universe_binary-i386_Packages) - stat (2 Aucun fichier ou... |
I have been trying to figure this out from other posts here, but couldn't.
I have a Python dictionary
old_dict = { (1,'a') : [2],
(2,'b') : [3,4],
(3,'x') : [5],
(4,'y') : [5],
(5,'b') : [3,4],
(5,'c') : [6],
}
I need to reverse this so that as a result I wo... |
I'm inseting many rows with sqlalchemy:
connection = engine.connect()
topic_res = connection.execute(message_topics.insert(),[
{
'mt_date': time.time(),
'mt_title': title,
'mt_hasattach':u'0',
'mt_starter_id':member.member_id,
'mt_start_time': time.time(),
'mt_las... |
Python 3.4 introduces new provisional API for asynchronous IO -- asyncio module.
The approach is similar to twisted-based answer by @Bryan Ward -- define a protocol and its methods are called as soon as data is ready:
#!/usr/bin/env python3.4
import asyncio
import os
class SubprocessProtocol(asyncio.SubprocessProtocol)... |
I am using Python 3.2 and would like to sort a list of tuples based on a configuration file:
formats=CCC;aaa;BBB
providers=yy;QQ;TT
Each tuple contains this information:
( title, size, format, provider )
I would like this group of tuples to first be sorted by the providers list. All yy's come before QQ's and TT's.
The... |
If I do the following:
import subprocess
from cStringIO import StringIO
subprocess.Popen(['grep','f'],stdout=subprocess.PIPE,stdin=StringIO('one\ntwo\nthree\nfour\nfive\nsix\n')).communicate()[0]
I get:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/build/toolchain/mac32/python-2.4.3/lib/py... |
WP7 working with XML: reading, filtering and databinding
published on: 2/21/2011 | Views: N/A | Tags: Binding windows-phone
by WindowsPhoneGeek
In this mini tutorial I am going to demonstrate how to data bind ListBox to a XML data in Windows Phone 7. I will use Linq to XML in order to load and read the data and also I ... |
It's slow, but you can automatically teleport yourself across all the chunks in a specific area of the map to have them generated using Python and the pexpect module (which I've used to send the teleport commands).
First, make a copy of your game data for testing purposes, then open a command prompt at that directory a... |
Maybe using cookielib.CookieJar can help you. For instance when posting to a page containing a form:
import urllib2
import urllib
from cookielib import CookieJar
cj = CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
# input-type values from the html form
formdata = { "username" : username, "pa... |
Is there any algorithm to compute the nth fibonacci number in sub linear time?
The
f(n) = Floor(phi^n / sqrt(5) + 1/2)
where
phi = (1 + sqrt(5)) / 2
Assuming that the primitive mathematical operations (
In C#:
static double inverseSqrt5 = 1 / Math.Sqrt(5);
static double phi = (1 + Math.Sqrt(5)) / 2;
/* should use
... |
vince06fr
Re : Nettoyage dans les noyaux (kernel)
Umuntu : Si tu veux prendre le temps de traduire ce script, surtout ne te gêne pas comme tout est "hardcodé" dans le script, la seule chose à faire est... De modifier l'ensemble des textes en français présents dans le script pour les mettre en anglais.
Une fois le scrip... |
I have a system where I will have Products (classes) that can be taught by one or more Instructors. These Instructors can also create Products in which case they should be accessible via the Product as its Developer. However, I also want to be able to access all of the Instructors who are available for that product.
I ... |
wlourf
Postez vos scripts Lua pour Conky !
Bonsoir à tous ceux pour qui chaque pixel du bureau compte,
J'ouvre ce topic suite aux discussions sur le topic des conky pour discuter des scripts Lua dans conky.
Lua est un langage de script léger et facile a utiliser qui permet d'ajouter de nouvelles fonctionnalités à nos c... |
I am pulling rows from a MySQL database as dictionaries (using SSDictCursor) and doing some processing, using the following approach:
from collections import namedtuple
class Foo(namedtuple('Foo', ['id', 'name', 'age'])):
__slots__ = ()
def __init__(self, *args):
super(Foo, self).__init__(self, *args)
... |
I am playing in Python a bit again, and I found a neat book with examples. One of the examples is to plot some data. I have a .txt file with two columns and I have the data. I plotted the data just fine, but in the exercise it says: Modify your program further to calculate and plot the running average of the data, defi... |
/projects/mymath$ ls
__init__.py __init__.pyc mymath.py mymath.pyc tests
and under the directory tests I have
/projects/mymath/tests/features$ ls
steps.py steps.pyc zero.feature
I tried to import my factorial function
sys.path.insert(0,"../../")
#import mymath
from mymath.MyMath import factorial
But it said No... |
QUESTION
I have written many Python scripts using arcpy in ArcGIS 10, and so far my only means of debugging is restricted to printing messages to the geoprocessing results window using arcpy.AddMessage(). Are there any other options out there, such as setting break points? This would save a lot of time and frustration.... |
I am creating a laboratory database which analyzes a variety of samples from a variety of locations. Some locations want their own reference number (or other attributes) kept with the sample.
How should I represent the columns which only apply to a subset of my samples?
Option 1:Create a separate table for each unique ... |
i have just made crossover cable, and connected my desktop computer with laptop to test it, but i am experiencing high ping on laptop > desktop
desktop 10.10.10.1, laptop 10.10.10.2
pinging laptop from desktop
Reply from 10.10.10.2: bytes=32 time<1ms TTL=128
Reply from 10.10.10.2: bytes=32 time<1ms TTL=128
Reply from 1... |
While surfing through Wikipedia one day, I came across the page for Ulysses, and in my quest to better my favorite source of knowledge, I decided to provide a citation for the word statistics of the novel.
The article claims that
Ulysses totals 250,000 words from a vocabulary of 30,000 words
. It’s not a bad estimate. ... |
Understanding Network I/O: From Spectator to Participant
by George Belotsky
11/06/2003
This series of two articles will show you how to participate in the global Internet. The architects of this greatest advance in communications since the printing press have strived to make such participation possible. The Internet is... |
Thanks to Ubuntu sites I no longer thought it was just me even though I reported this around almost a year ago. Just right-clicking for desktop not only kills the conceptual menu but hikes the cpu wild & hot, forget even activating the fixed desktop slideshow feature which locks the cpu to run high and hot even if you ... |
I'm current working on a C++ that I edit locally on my Mac but run on an Ubuntu server. I always make sure that the code compiles on my mac before uploading it to the server to compile it there, where I have to use a makefile to link with libraries that are installed in my local directory. Basically, I had edited a sig... |
This doesn't answer your question. However. It seems necessary.
class Person:
name = None
age = None
Doesn't do what you're suggesting.
Those are two class-level attributes. They're emphatically not instance variables.
Also. You don't "declare" attributes at all. You don't declare them like that.
Person p is... |
#1476 Le 27/06/2013, à 20:53
The Uploader
Re : /* Topic des codeurs [8] */
Je ne suis pas sûr de comprendre la question pour le coup.
En fait, je rajoute ceci :
position: relative;
À ce code de app/assets/stylesheets/application.css :
#preview {
float:left;
width: 46%;
height: 100%;
border-left:5px solid gray;... |
Most model "strings" appear as the form "appname.modelname" so you might want to use this variation on get_model
from django.db.models.loading import get_model
your_model = get_model ( *your_string.split('.',1) )
The part of the django code that usually turns such strings into a model is a little more complex This fro... |
Use Scrapy.
It is a twisted-based web crawler framework. Still under heavy development but it works already. Has many goodies:
Built-in support for parsing HTML, XML, CSV, and Javascript
A media pipeline for scraping items with images (or any other media) and download the image files as well
Support for extending Scrap... |
in an attempt to learn sqlalchemy (and python), i am trying to duplicate an already existing project, but am having trouble figuring out sqlalchemy and inheritance with postgres.
here is an example of what our postgres database does (obviously, this is simplified):
CREATE TABLE system (system_id SERIAL PRIMARY KEY,
... |
一般来说我们在编程中,对象定义都是预先定义好的。一些 OOP 语言(包括 Python/Java)允许对象是 自省的(也称为 反射)。即,自省对象能够描述自己:实例属于哪个类?类有哪些祖先?对象可以用哪些方法和属性?自省让处理对象的函数或方法根据传递给函数或方法的对象类型来做决定。即允许对象在运行时动态改变方法成员等属性。
得益于OpenERP ORM 模型的精巧设计,实际上 OpenERP 运行时也是动态读取模块信息并动态构建对象的。如在模块开发中,继承了 ‘res.users’, 新增一个方法或新增一个字段。在OpenERP 导入该模块后, OpenERP 会马上重构 ‘res.users’ 对象并将新增的方法或字段添加到该对象... |
yo folks, I have an issue with clearing lists. In the current program which I'm coding, I have a method that clears a certain number of lists. This is rather inconvenient since during one part of the program where this method is used, it would be a lot more helpful if it only deleted the last element from the lists. Is... |
An Introduction to Haskell, Part 1: Why Haskell
Pages: 1, 2
Writing this function in a more modern language like Java, C++ or C# isn't as odious, because automatic memory management takes care of the first half of this function. Writing the expression 'filter even [1..10]' in dynamic languages like Perl, Python and Rub... |
babibelle13
[ RESOLU ] re epson stylus sx230
bonjour,, toujours néophyte, j'essaie de comprendre, j'ai pu installer l'imprimant mais pas le scaner de la SX230, je n'arrive pas meme avec epson, les discussion sont en anglais et la encore, je ne suis pas tres douée, Quelqu'un pourrait il m'aider? merci par avance
Dernièr... |
So i'm making a little app here, and I have try blocks (because I need to see if a file already exists or should be created). Although... my try block is repeating for some reason! I have ABSOLUTELY no idea why this is happening. Please help?Also, the file is created fine :)Code:
import sys
import time
Version = "V0.1"... |
i certainly missed something basic here, but i just want to see who can help me out here. on this website: www.hedenstugan.se i have a little booking form. when you change the dates in the upper select field, an ajax script is called and returns an updated lower date select field.
so far so good.
When however clicking ... |
You need to subclass Django's ModelChoiceField and modify it's render_options() and render_option() methods to display the object's attributes you need. I guess you also need your own subclass of ModelChoiceIterator so that it not only spits out id/label tuples but all the data you need.
Example
I just found an impleme... |
I just took a glance at the introduction of libnet,
seems it mentioned support for udp,*ip*,but not tcp?
Does it support tcp at all?
Looking here, there seems to be a function related to tcp, so I guess yes, you can inject tcp segments with libnet.
int libnet_build_tcp(u_short sport, u_short dport, u_long seq,
... |
does anyone know how i would go about using a tkinter window as an output from a videosink/pipeline from within python? i have found methods for lots of other GUI systems, but i dont want to have to use tkinter and something else together xxx thanks in advance x
This works for me on Windows 32-bit. I get a seg fault on... |
You could keep a histogram in a dictionary (mapping element type -> int). And then you iterate over your row or column or diagonal, and increment histogram[element], and either check at the end to see if you have any 5s in the histogram, or if you can allow more than 5 copies, you can just stop once you've reached 5 fo... |
In my last article on the “How to build a large, single-page javascript application” series we used the JavascriptMVC framework to build Rebecca Murphey’s javascript’s community challenge application - srchr. In this article we’ll follow the same coding pattern to show how to do the same using Backbone.js as the base j... |
HELP!
I'm trying to make a Mafiya game in Python, but have run into problems. Here's what I'm worried about:
import random
def Start():
day = 0 #This variable definition should work...
DayTime()
...
Here's what I get when I run it:
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
... |
ljere
Re : Live Voyager 12.10
merci pour les précisions c'est vraiment cool je plains rodofr si il veut intégrer tout ça
Hors ligne
metalux
Re : Live Voyager 12.10
Le repos aura été de courte durée, qu'est-ce qu'on peut dire des C.....quand on a un coup de barre!
Quelqu'un a testé ce que j'ai exposé au post #314? De mo... |
I am not sure whether i understand your questions correctly. But if you are looking for a sample of matching SURF keypoints, a very simple and basic one is below, which is similar to template matching:
import cv2
import numpy as np
# Load the images
img =cv2.imread('messi4.jpg')
# Convert them to grayscale
imgg =cv2.cv... |
I'm writing some tests for my django app.In my view,it redirects to some other url using 'HttpResponseRedirect'.So how can I test that?
from django.http import HttpResponsePermanentRedirect
from django.test.client import Client
class MyTestClass(unittest.TestCase):
def test_my_method(self):
client = Client(... |
In my edit I described that CherryPy catches the errors. In the config throw_errors can be set to True. For me, setting cherrypy._cprequest.Request.throw_errors = True did this. The whole code is:
import cherrypy
from cherrypy import wsgiserver
from werkzeug.debug import DebuggedApplication
class Root(object):
@che... |
Is there any special behavior when decrementing a variable in the except clause?sid keeps incrementing until it first gets into the exception clause, then it just keeps the same value for the rest duration of the for loop.
7 out of 105 tries throw an exception
there is no printout "Fehlercode:", errorcode
Here's my cod... |
I am a beginner at Python. Below is the testing code for Python's command line args. If executing from command line with different parameter formats, I get different results, but it feels strange, can anyone help me understand why?
1, $test.py d:\ --> this seems ok for os.walk call
2, $test.py 'd:\' --> this will... |
I have a very long portlet edit screen so I'd like to group its fields using fieldsets (and then probably layouting those into native form tabs, like those used in content's edit view).
Is this possible with zope.formlib?
To conclude, the answer for Plone 4 really is to use z3c.form based portlets and create fieldsets ... |
I have two variables (x and y) that have a somewhat sigmoidal relationship with each other, and I need to find some sort of prediction equation that will enable me to predict the value of y, given any value of x. My prediction equation needs to show the somewhat sigmoidal relationship between the two variables. Therefo... |
Hi I have an algorithm for which I would like to provide the total runtime:
def foo(x):
s = []
if(len(x)%2 != 0):
return false
else:
for i in range(len(x)/2):
//some more operations
return true
The loop is in O(n/2) but what is O() of the modulus operation? I guess it is d... |
For the life of me I am finding me python transition to be extremely frustrating. One of the things I am attempting at doing is to initialize a single instance of a class from a configuration dictionary, then access that class in other modules.
The problems I am facing / the approaches I have taken are not working out ... |
Otras Recetas
Upgrade
En la página de la interfaz administrativa "site" existe un botón "upgrade now" (actualice la versión ahora). En caso de que no esté disponible o no funcione (por ejemplo por un problema de bloqueo de un archivo), actualizar web2py manualmente es muy fácil.
Simplemente descomprime la última versió... |
I'm trying to import just a variable inside a class from another module:
import module.class.variable
# ImportError: No module named class.variable
from module.class import variable
# ImportError: No module named class
from module import class.variable
# SyntaxError: invalid syntax (the . is highlighted)
I can do th... |
JavaScript
paul_wilkins — 2013-04-26T23:39:48-04:00 — #1
While watching Nicholas Zakas' Maintainable JavaScript talk at the Fluent 2012 conference, there was a very informative section in there about keeping JavaScript separate from the HTML, and other similar concerns of separation.
You can see it from the 25:40 secti... |
Audiofeeline
Modifier GRUB avec GRUB CUSTOMIZER
Bonjour à tous,
alors que je surfais paisiblement, je suis tombé sur un article de Tux-Planet qui présente GRUB CUSTOMIZER : http://www.tux-planet.fr/grub-customizer/
Je tenais à vous en faire part car ça faisait un petit moment que je cherchais une telle solution.
Bien à... |
To solve this in Basemap for specific cases you can check the differences of the x vertices in the resulting path. From there, we can cut the bad path into two sections. I have thrown together my own example of doing this with basemap:
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot... |
I am programming in python using the pygame library.
I have created a class called "terrain" and have placed in it "terrainClass.py"
When I run the code, it will create instances of the terrain class, but will not run the __init__ method. This is causing me an error as when the terrain.__init__ method is called, it can... |
I’ve been playing around with Publish/Subscribe queues (or pub-sub queues) for the last few months, which has led me through some research that has been very interesting for me personally. I’ve wanted to write about my experiences for a while now, but unfortunately this post continues to unwrite itself over time, as I ... |
The idea of recursion is not very common in real world. So, it seems a bit confusing to the novice programmers. Though, I guess, they become used to the concept gradually. So, what can be a nice explanation for them to grasp the idea easily?
To explain recursion, I use a combination of different explanation, usually to... |
Aegyptos
[En cours] Installation Dual Boot W7 : OS non reconnu
Bonjour,
Pour des besoins pro j'ai besoin d'installer Ubuntu, mais je dois également garder une session window, j'ai donc cherché à installer ubuntu, mais j'ai rencontrer quelques soucis. J'ai cherché à droite et à gauche des réponses, mais je n'y arrive to... |
I was trying to process several web pages with BeautifulSoup4 in python 2.7.3 but after every parse the memory usage goes up and up.
This simplified code produces the same behavior:
from bs4 import BeautifulSoup
def parse():
f = open("index.html", "r")
page = BeautifulSoup(f.read(), "lxml")
f.close()
while ... |
What is the most lightweight way to create a random string of 30 characters like the following?
ufhy3skj5nca0d2dfh9hwd2tbk9sw1
And an hexadecimal number of 30 digits like the followin?
8c6f78ac23b4a7b8c0182d7a89e9b1
What is the most lightweight way to create a random string of 30 characters like the following?
And an h... |
useR! 2014
Author: Martin Morgan (mtmorgan@fhcrc.org), Sonali Arora
Date: 30 June, 2014
Input & manipulation: Biostrings
>NM_078863_up_2000_chr2L_16764737_f chr2L:16764737-16766736
gttggtggcccaccagtgccaaaatacacaagaagaagaaacagcatctt
gacactaaaatgcaaaaattgctttgcgtcaatgactcaaaacgaaaatg
...
atgggtatcaagttgccccgtataaaaggcaag... |
Module bounce
source code
Bounce analysis module for Lamson. It uses an algorithm that tries to simply collect the headers that are most likely found in a bounce message, and then determine a probability based on what it finds.
BounceAnalyzer
BounceAnalyzer collects up the score and the headers and gives moremeaningful... |
I am using Play 1.2.4 and I need to call a third party web service. When I get response I can't parse it properly via XPath as it contains invalid XML format.
Response has > and < instead of < and >. I've tried to decode the response with no luck. I've also checked response content which seems fine "application/s... |
I need to lock a file for writing in Python. It will be accessed from multiple Python processes at once. I have found some solutions online, but most fail for my purposes as they are often only Unix based or Windows based.
from filelock import FileLock
with FileLock("myfile.txt"):
# work with the file as it is now ... |
Winkleson here! I am currently learning Python when I got stuck on a problem. I've gotten to the point where I'm dizzy just thinking about it :P Anyways any help would be greatly appreciated! Thanks in advance!
Question:
Interlock
Create a function that takes two strings that are the same length or within one character... |
If I have a certain week number (eg 51) and a given year (eg 2008), how do I find the date of the first Monday of that same week?
Many thanks
>>> import time
>>> time.asctime(time.strptime('2008 50 1', '%Y %W %w'))
'Mon Dec 15 00:00:00 2008'
Assuming the first day of your week is Monday, use
PEZ's and Gerald Kaszuba's... |
Ras'
Re : Topic des lève-tôt… Faisons manger leurs caleçons aux couche-tard! [4]
Hors ligne
ljere
Re : Topic des lève-tôt… Faisons manger leurs caleçons aux couche-tard! [4]
voici le code
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# auteur Gabriel Pettier
# license GPL V3 or later
# sert uniquement a compter le... |
I am in dire need of a classification task example using LibSVM in python. I don't know how the Input should look like and which function is responsible for training and which one for testing Thanks
LIBSVM reads the data from a tuple containing two lists. The first list contains the classes and the second list contains... |
When using the Python string function split(), does anybody have a nifty trick to treat items surrounded by double-quotes as a non-splitting word?
Say I want to split only on white space and I have this:
>>> myStr = 'A B\t"C" DE "FE"\t\t"GH I JK L" "" ""\t"O P Q" R'
>>> myStr.split()
['A', 'B', '"C"', 'DE', '"FE"', '... |
I am trying to calculate the relative entropy given two collections and have a question regarding some issues.
Supposed we have two sets, $Real$ and $Calculated$, and their respective probability mass functions, $P$, and $Q$.
Relative Entropy, or Kullback Leibler Divergence is defined as the following:
$$\sum_{i=0}^{n}... |
Code:
>>> mylist = ['abc','def','ghi']
>>> mylist
['abc', 'def', 'ghi']
>>> for i,v in enumerate(mylist):
... if v=='abc':
... mylist[i] = 'XXX'
...
>>> mylist
['XXX', 'def', 'ghi']
>>>
Here, I try to replace all the occurrences of 'abc' with 'XXX'. Is there a shorter way to do this? |
How do i set the source IP/interface with Python and urllib2?
Unfortunately the stack of standard library modules in use (urllib2, httplib, socket) is somewhat badly designed for the purpose -- at the key point in the operation,
When you're facing such problems you only have two not-so-good solutions: either copy, past... |
What does "orthogonality" mean when talking about programming languages?
What are some examples of Orthogonality?
Orthogonality is the property that means "Changing A does not change B". An example of an orthogonal system would be a radio, where changing the station does not change the volume and vice-versa.
A non-orth... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.