text stringlengths 256 65.5k |
|---|
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... |
McPeter
Re : Un 'autre' générateur de sources.list en ligne
Je viens de rectifier le soucis sur le nom du fichier bash.
Par contre je ne vois aucun soucis à l'exécution :\
pourrais tu me dire quel navigateur tu as utilisé et quel message d'erreur ça te renvoit ? (un copié/collé du message)
le chmod +x est inutile là pu... |
I've got a numpy array of custom objects. How can I get a new array containing the values of specific attributes of those objects?
Example:
import numpy as np
class Pos():
def __init__(self, x, y):
self.x = x
self.y = y
arr = np.array( [ Pos(0,1), Pos(2,3), Pos(4,5) ] )
# Magic line
xy_arr = .... # arr[ ... |
I bumped into this link found here, which answers my problem.
It seems that after turning on interactive mode through plt.ion(), pyplot needs to be paused temporarily for it to update/redraw itself through plt.pause(0.0001). Here is what I did and it works!
>>> import matplotlib.pyplot as plt
>>> import numpy as np
>>>... |
I'm trying to find a way to select a row in sqlite from Python. Say I have a table soft drinks with columns drink and price, with the primary key being drink name. I want to select coke out of drink name. How would I do this without looping through every single entry?
Here's my code:
conn = sqlite3.Connection("database... |
I want to stream some random bytes to Gstreamer and display it as follows:
[Rand Bytes]--[Video source=appsrc]--[Video sink=ximagesink]
The following Python code I found in this SO post works
source = gst.element_factory_make("appsrc", "source")
caps = gst.Caps("video/x-raw-gray,bpp=16,endianness=1234,width=320,height... |
I am trying to write script that searches an inchikey (ex: OBSSCZVQJAGPOE-KMKNQKDISA-N) to get a chemical structure from this website: http://www.chemspider.com/inchi-resolver/Resolver.aspx
From the documentation my code looks like it should work, but instead it just returns the original search page.
Thanks for the hel... |
The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com
Keep your Puppet manifests under version control¶
It’s a good idea to keep your Puppet manifests and other configuration files under version control, for example Subversion or CVS. To do this, just set up the Puppet Master the way you want, and the... |
n3o51
Liste des onglets
Bonsoir y a t'il un moyen de copier directement dans un fichier txt la liste des onglets ouverts dans opera et firefox ?
ligne par ligne ?
Merci d'avance
Edit modérateur : si vous n'avez pas de réponses à donner, ne sortez pas le sujet des "Sujets sans réponses".
Dernière modification par xabilo... |
Wizner had to jump on a phone call during a meeting with his whistleblower client. When he got off the phone, he found that Snowden had rolled the bot into civil liberties lawyer Jameel Jafferâs office and was discussing the 702 provision of the Foreign Intelligence Surveillance Act. âIt was kind of cool,â Wizner... |
Leo 7
Re : A quoi ressemble votre environnement - printemps/été 2012
J'adore ton unity Mario_26
Est-ce que tu peux me donner le lien du wall STP, je le touve très zoli.
Merci d'avance
A+
hp 625: Ubuntu LTS xfce / Mac Mini ppc G4: Debian stable xfce / Les choses les plus simples sont les meilleures !
Hors ligne
Major Gr... |
Author momo
Submission date 2012-05-28 12:39:46.484898
Rating 6165
Matches played 411
Win rate 65.21
Use rpsrunner.py to play unranked matches on your computer.
import random
def highest(v):
return random.choice([i for i in range(len(v)) if max(v) == v[i]])
def best(c):
return highest([c[1]-c[2], c[2]-c[0], c[0... |
Usually, we define classes for this.
class XClass( object ):
def __init__( self ):
self.myAttr= None
x= XClass()
x.myAttr= 'magic'
x.myAttr
However, you can, to an extent, do this with the setattr and getattr built-in functions. However, they don't work on instances of object directly.
>>> a= object()
>>> se... |
I have been working on generating all possible submodels for a biological problem. I have a working recursion for generating a big list of all the submodels I want. However, the lists get unmanageably large pretty fast (N=12 is just possible in the example below, N>12 uses too much memory). So I wanted to convert it to... |
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... |
senjy
Erreur fatal postfix sur email en spam ou pas
Bonjour,
J'ai installé un serveur postfix et j'utilise un script php maison qui marche, mais le résultat est un peu étrange.
1. Certains mails envoyés partent dans la boite spam de l'utilisateur
2. D'autres envoyés fonctionnent
Dans /var/log tout semble tres bien se p... |
Oni
Re : [How-to] Desktop Screenlets
Salut.
Je viens de réinstaller screenlets.
Lorsque je lance une musique avec Listen (mon lecteur par défaut), le module "Now Playing" me renvoie une erreur comme vous pouvez le voir sur la capture ci-dessous.
J'ai installé le paquet "python-dcop" au cas où... mais même problème.
Si ... |
What is the simplest way of copying symbolic links on the Mac?
A python or perl solution would be preferred, but any solution would be a help.
I am copying frameworks for an installation package, and need the links to be maintained
What is the simplest way of copying symbolic links on the Mac?
A python or perl solution... |
I want to send a datetime.datetime object in serialized form from Python using JSON and de-serialize in JavaScript using JSON. What is the best way to do this?
You can add the 'default' parameter to json.dumps to handle this:
>>> dthandler = lambda obj: (
... obj.isoformat()
... if isinstance(obj, datetime.date... |
So it seems I'm misunderstanding some basic stuff about Python. Passing an instance variable into a function should only pass a reference to the object itself, so in case the object is immutable doing something like self.var = "something"; foo(self.var) shouldn't change self.var if foo assigned a new value to the varia... |
Phoenamandre
Re : Suivi des bogues d'Ubuntu 12.10
j'ai le même problème que toi avec mon dell xps !
autre bogue, si vous êtes touchés par un problème de maya qui ne veut pas démarrer
https://bugs.launchpad.net/maya/+bug/1047599
Hors ligne
vlotho
Re : Suivi des bogues d'Ubuntu 12.10
Salut j'ai une ribembelle de warning ... |
I have an Atom feed generator for my blog, which runs on AppEngine/Python. I use the Django 1.2 template engine to construct the feed. My template looks like this:
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"
xml:lang="en"
xml:base="http://www.example.org">
<id>urn:uuid... |
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... |
You cannot use 2008 CRT, but you can prevent the new functions DecodePointer/EncodePointer to be linked from the kernel. It is quite easy to replace the new functions with stubs.
One might attempt following: Place code like this in your main.cpp source:
extern "C" {
void *__stdcall _imp__DecodePointer(void *x) {retur... |
loopx
Réponses : 4
Bonjour,
J'ai installé un petit Lubuntu sur un portable. Merveilleux et mieux que Xubuntu car plus léger.
Mais, il y a un truc que je n'ai pas encore réussi à faire : comment faut-il procéder pour modifier le comportement du clavier afin qu'un appui sur CAPS LOCK (blocage majuscule ...) permette l'ut... |
I think your best option is to modify the authentication pipeline and create your own version of this function, which is in social_auth/backend/pipelines/associate.py:
def associate_by_email(details, *args, **kwargs): """Return user entry with same email address as one returned on details.""" email = details.get('email... |
I wrote the sample program. It creates 8 threads and spawns process in each one
import threading
from multiprocessing import Process
def fast_function():
pass
def thread_function():
process_number = 1
print 'start %s processes' % process_number
for i in range(process_number):
p = Process(target=... |
From the Python 3.4 documentation:
So you use the function namedtuple to create an object similar to a tuple in usage and performance but with more flexibility. For me, this has eliminated the need for using overly complex data structures (dictionary of tuples, tuple of dictionaries, etc.) or writing an overly simple c... |
Virtualici
Re : [Tuto] - Ma personnalisation Xubuntu (et autres variantes)
j'ai tout tenté ! au mieux j'ai ça : ):
[sudo] password for boubou:
Sorry, try again.
sudo: 3 incorrect password attempts
boubou@boubou-M51SE:~$ *******
******* : commande introuvable
boubou@boubou-M51SE:~$
les : ******* c'est mon pass.
Hors l... |
bowmore
Re : Qarte arte.tv browser (ex Qarte+7)
Si je lance
python /usr/bin/qarte
J'obtiens
python /usr/bin/qarte
(qarte:23575): Gtk-WARNING **: Impossible de trouver le moteur de thème dans module_path : « pixmap »
Affiché une quinzaine de fois, puis Qarte-1 démarre bien. Dans le terminal, il y a ça:
15:33:40: INFO ... |
smo
Re : Gmediafinder : Youtube/dailymotion/vimeo.. sans flash et bien plus....
ola
ok cool je vais regarder ca apres, la j en fais un "normalement" c est un peu (beaucoup...) plus complique pour les ppa
j vous tiens au jus !
et whoue si vous avez des idees, hesitez pas hein ... j aimerais bien avoir des visualisations... |
Does anyone know how I can make it so my code only fires a bullet if the space bar is pressed? Right now any key makes my character shoot a bullet but I want to change it if possible, heres my code so far:
import pygame, sys, random
pygame.init()
screen_width = 800
screen_height = 600
screen = pygame.display.set_mode([... |
I'm very new to Neo4j/Graph databases and trying to replicate tutorial from Cypher cookbook: http://docs.neo4j.org/chunked/stable/cypher-cookbook-similarity-calc.html
Random data set with 100 foods and 1500 persons, all persons are related to food through ATE relationship with "times" integer property. Food and Person ... |
One way is to call A's constructor and pass self as an argument, like so:
class B(A):
def __init__(self):
A.__init__(self)
print "hello"
The advantage of this style is that it's very clear. It call A's constructor. The downside is that it doesn't handle diamond-shaped inheritance very well, since y... |
What is WSGI, and why should you care? WSGI, or the Web Server Gateway Interface, is a Python Enhancement Proposal (#333) authored by Philip Eby in an attempt to address the lack of standardization among Python web frameworks. Think of it as the servlet spec for the Python world, only simpler. Although the WSGI specifi... |
I'm trying to put together a logger using Python. I'm working in 2.6 so I can't use the new dictionary style method and instead am going with the good old fashioned config file. The problem is, stuff outputs twice to the console and I can't understand why. Here's my test script:
import logging
import logging.config
if ... |
Lonewolf
Re : [IMPORTANT] Vieilles cartes ATI et pilote proprio
L'installation des Catalyst 10.9 sur le noyau 2.6.32-23 ne fonctionne pas mieux : toujours pas de 3D.
J'ai tenté avec les 10.7 qui tournaient bien sur mon PC jusqu'à la semaine dernière ----> erreurs diverses et démarrage en mode très, très, très dégradé (... |
Is there a UI library to create a message box or input box in python?
Your best bet is the tkMessageBox module, which should work on all systems (as Python will typically come with Tkinter).
If you can restrict yourself to a specific operating system, better choices might be available.
Simple message boxes and input bo... |
gtk.TreeModel — the tree interface used by gtk.TreeView
class gtk.TreeModel(gobject.GInterface):
def get_flags()
def get_n_columns()
def get_column_type(index)
def get_iter(path)
def get_iter_from_string(path_string)
def get_string_from_iter(iter)
def get_iter_root()
def get_iter_first()... |
AnsuzPeorth
Re : [Gm9diaCenter] Interface graphique pour mediacenter neuf/sfr
Re,
La suppression des logs se fait au démarrage de l'appli, pas du mediacenter ! (en tout cas chez moi ça marche).
Pour le systray, je t'ai ajouté une petit image clicable gnome
J'ai ajouté la possibilité de créer/supprimer les lanceurs depu... |
The %attacker% approach can be extended to include some information other than just the names of the objects:
The verb may be singular or plural. This depends on the subject. "You attack X" (singular 2nd person subject) vs. "Extrakun attacks X" (singular 3rd person subject) vs. "The goblins attack X" (plural 3rd person... |
I'm having an issues with bottle python where I have the following code
import glob
import os
from bottle import run, route, error, template
from Find_Posts import hyperlink_postnames
currentdir = os.getcwd()
def hyperlink_postnames():
hyperlink_filelist = []
os.chdir(currentdir + "\\Blog_Posts\\")
for file... |
I am new in python and I am trying to scrape a data from yellow pages. I was able to scrape it but I get a messed result.
This was the result i got:
2013-03-24 20:26:47+0800 [scrapy] INFO: Scrapy 0.14.4 started (bot: eyp)
2013-03-24 20:26:47+0800 [scrapy] DEBUG: Enabled extensions: LogStats, TelnetConsole, CloseSpider,... |
According to django documentation, for ajax post request in 1.3 (at least with Jquery), we just need to add this snippet to main js file. This snippet get csrftoken from cookies, and then set up it for all ajax request. That's work, but what if csrftoken don't exist in cookies? I thought render_to_response and render b... |
In Ruby, what does it mean for a String or Array (etc) object to be 'Frozen'? How/where is this property set or modified?
It means you cannot modify it. You set it by
s.concat("b")
# => "ab"
When you freeze the string:
then, you cannot apply
s.concat("c")
# => RuntimeError: can't modify frozen String
However, you can... |
Now that you know what the debugger is, how to get it to run your code, and what the basic commands do, it's time to walk through a meatier example. The following code reads in a text file a line at a time, splits the line on white space, and converts the line to a dictionary with stringified word positions as its keys... |
Het is tegenwoordig nauwelijks voorstelbaar dat een computer geen netwerkverbinding heeft. Het toevoegen en instellen van een netwerkkaart is een gebruikelijke taak voor een FreeBSD-beheerder.
Voor het zoeken begint, moet duidelijk zijn om welke kaart het gaat, welke chip erop zit en of het een PCI- of ISA-kaart is. Fr... |
You can use .split() to split up the string of numbers and then turn each one into an integer:
nums = [int(num) for num in raw_input('Enter some numbers: ').split(',')]
Or you can use ast.literal_eval() and input a Python object:
from ast import literal_eval
nums = literal_eval(raw_input('Enter some numbers: ')) # Ty... |
I've got a class that wraps some file handling functionality I need. Another class creates an instance of the filehandler and uses it for an indeterminate amount of time. Eventually, the caller is destroyed, which destroys the only reference to the filehandler.
What is the best way to have the filehandler close the fil... |
Since yesterday, I've been facing a compiling error for my C project. The project itself consists on creating a service that will make some tasks.
I don't what has changed since yesterday, but this morning, my code can't compile anymore.
Here are the errors I have :
c:\path\main.c(56): error C2275: 'SERVICE_TABLE_ENTRY... |
Again, I am still learning python, so please bare with me. What I would like to do is
1) Allow the user select an image 2) get the image and add it to a canvas 3) allow manipulation (re-sizing) inside of the canavs 4) Push "Upload" 5) Take the canvas and generate a data URI off of it
This all works dandy in JS leaving ... |
xmltramp and pxdom
In this article I cover two XML processing libraries with very disjoint goals. xmltramp, developed by Aaron Swartz, is a tool for parsing XML documents into a data structure very friendly to Python. Recently many of the tools I've been covering with this primary goal of Python-friendliness have been ... |
i want to convert my input Excel file into the Output XML file.
If anybody has any solution in java for how to take input Excel file and how to write to XML as output,please give any code or any URL or any other solution.
Thanks,
Mishal Shah
Look into the jexcel or Apache POI libraries for reading in the Excel file.
Cr... |
A Primer on Python Metaclass Programming
Pages: 1, 2
Solving Problems with Magic
So far, we have seen the basics of metaclasses. Putting them to work is more subtle. The challenge of using metaclasses is that in typical OOP design, classes do not really do much. Class inheritance structures encapsulate and package data... |
I think the main problem here is that the browser settings don't actually affect the navigator.language property that is obtained via javascript.
What they do affect is the HTTP 'Accept-Language' header, but it appears this value is not available through javascript at all. (Probably why @anddoutoi states he can't find ... |
3rd updated version with a lot of input from the GAE group. Thanks to everyone!
ER-Modeling with Google App Engine is somewhat different to "normal" modeling for a relational database.
Here is a small tutorial on how to create well-known relationship models One-to-One (1:1), One-to-Many (1:n), Many-to-Many (m:n) and a ... |
I encounter the a problem:
I have a view controller like this.
TO make tool bar up when the keyboard appear, I move the self.view to up.
[self.view setFrame:CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y + keyboardFrame.size.height * (up ? -1 : 1), self.view.frame.size.width, self.view.frame.size.height)... |
With my recent release of a new version of this site, I finally made the jump from using mod_python to using mod_wsgi. This change had been a long time coming, but was made slightly less than straight forward by my desire to deploy to virtualenv environments.
This desire is borne of convenience and necessity. One of th... |
sheep
Xubuntu moitié en français moitié en anglais
Bien le bonjour à tous
J'ai remonté un vieux pc pour que mes gosses puissent jouer à leurs jeux sans me piquer le mien
Comme il est vieux j'ai donc installé une xubuntu 12.04, elle fonctionne bien, cependant certains menus ne sont pas traduits en français.
Au début tou... |
I have a number of Python generators, which I want to combine into a new generator. I can easily do this by a hand-written generator using a bunch of yield statements.
On the other hand, the itertools module is made for things like this and to me it seems as if the pythonic way to create the generator I need is to plug... |
This is a follow-up question to an answer I gave a few days back. Edit: it seems that the OP of that question already used the code I posted to him to ask the same question, but I was unaware of it. Apologies. The answers provided are different though!
Substantially I observed that:
>>> def without_else(param=False):
.... |
Arguments are passed by assignment. The rationale behind this is twofold:
the parameter passed in is actually a reference to an object (but the reference is passed by value)
some data types are mutable, but others aren't
So:
If you pass a mutable object into a method, the method gets a reference to that same object and... |
While logging in with the Facebook on my site all the likes of the new user are stored in the DB. But while storing the unique characters (characters from the other languages and all) are not getting stored and I get a error like this:
Warning at /facebook/connect/
**Incorrect string value: '\xE2\x99\xA5 Lo...' for col... |
Issuing Twitter updates from the command line was once a simple affair: you could just use curl or its equivalent. Things changed when basic authentication was removed from the Twitter API in August 2010, and now all Twitter clients are required to use secure authentication based on OAuth.
Configuring an app to use OAu... |
In a figure with matplotlib I would like to make the font size for the tick labels using
ax1.set_xticklabels(
smaller. How can I?
And last part, how can one rotate it from horizontal to vertical ?
Please note that newer versions of MPL have a shortcut for this task. An example is shown in the other answer to this quest... |
link5192
Re : [How-to] Desktop Screenlets
Bonjour à tous,
Je me permet aussi de remonter ce topic, j'ai voulu lancer le screenlets terminal (http://gnome-look.org/content/show.php/ … tent=74844) mais impossible celui-ci ne veut pas demarrer ... quelq'un aurait-il une solution ?
Ubuntu 12.04 (Precise) sur Dell Inspiron ... |
This article shows how to use Ajax techniques to make web apps with REST APIs.
Everyone's talking about REST these days. Lots of people are still struggling with it, and there's good reason for that--REST is actually quite difficult to fit into the browser-based HTML Web, for two reasons:
GET and POST, not PUT or DELET... |
use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
~18 users here now
News and links for Django developers.
Add Logged in User to ModelForm (self.django)
submitted 10 ... |
I have a class that I wish to expose as a remote service using pythons SimpleXMLRPCServer. The server startup looks like this:
server = SimpleXMLRPCServer((serverSettings.LISTEN_IP,serverSettings.LISTEN_PORT))
service = Service()
server.register_instance(service)
server.serve_forever()
I then have a ServiceRemote clas... |
I've been working on one of the coding challenges on InterviewStreet.com and I've run into a bit of an efficiency problem. Can anyone suggest where I might change the code to make it faster and more efficient?
If your question is about optimising python code generally (which I think it should be ;) then there are all s... |
Wondering if Base in sqlalchemy inherits from Object. See detail below.
Currently using Python3 and SQLAlchemy 0.8
In my Project, I'd declared a new style class with (object) and I'd gone ahead and used "Property" to define properties in my class. The class was working okay "Sample code below"
class LoadFile(object):
... |
My laptop unplugged stands 1 minute. Previous week my laptop cable, started not connecting good with the laptop.
I would like to play a certain sound everytime it gets's unplugged so I can hurry and connect them good.. Anyone?
You can use 'cuttlefish' and 'vlc' (for example) from the Ubuntu-Software-Centre. With this f... |
Is it common in Python to keep testing for type values when working in a OOP fashion?
class Foo():
def __init__(self,barObject):
self.bar = setBarObject(barObject)
def setBarObject(barObject);
if (isInstance(barObject,Bar):
self.bar = barObject
else:
# throw excep... |
I'm having a module import issue.
using python 2.6 on ubuntu 10.10
I have a class that subclasses the daemon at http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/ . I created a python package with a module containing code that imports some models from a django project. The code works when used ... |
Thanks for taking a look at this.
I started a beginner's tutorial on RoR through lynda.com. I followed the instructions to the letter. Everything was working so far until I got to accessing Webrick. When I typed in "rails server" to begin work, I got this error message below.
/Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/li... |
Resizing a LUKS-encrypted partition
Since gparted does not support encryption, the resizing process for LUKS-encrypted partitions has to be completely manual. It looks scarier than it is, since the sizes of the partition, the encrypted container, and the file-system will be mismatched during the resize. I’ll assume the... |
I hate that Python canât distinguish between declaration and usage of a variable. You donât need static typing to make that happen. It would just be nice to have a way to say âthis is a variable that I deliberately declare, and I intend to introduce a new name, this is not a typoâ.
Furthermore, I usually use Py... |
I see some question about how to do specific things with Suggester in Solr, but how about how to actually use it? I'm stuck in how to simply query the suggest api to get the results in Java, maybe using Solrj? I just cannot find any simple tutorial that would explain it.
All I have is the SuggesterTest class that even ... |
I recently took the latest version of twill for a ride and I'll report here some of my experiences. My application testing scenario was to test a freshly installed instance of Bugzilla. I wanted to see that I can correctly post bugs and retrieve bugs by bug number. Using twill, all this proved to be a snap.
First, a fe... |
This document shows how to capture traffic directly at the Cisco PIX/ASA Firewall. Thats a very powerful tool for troubleshooting.
All traffic for the bastionhost (172.16.1.2) has to be captured for further analysis, the IP of the insidehost (10.0.1.12) is source-NATed to 172.16.1.20 when connecting to the DMZ.
If we w... |
Appengine and handle_entity
Jun 17 2009, 12:52AM
Just spent a frustrating evening with Google AppEngine - and I want to document the problem I had in case it helps others.
I wanted to upload data to AppEngine from a CSV file - however the values in said file needed some adjustments (they don't directly correspond to th... |
k3c
Re : TVDownloader: télécharger les médias du net ! [2]
Merci Julien
J'ai testé avec succès pour plusieurs vidéos comme
par contre le --resume devrait être optionnel
python d8_julien.py http://www.d8.tv/d8-art-de-vivre/pid5205-d8-a-vos-regions.html
rtmpdump -r "rtmp://geo2-vod-fms.canalplus.fr/ondemand/geo2/1304/A_V... |
I'm having issues with redrawing the figure here. I allow the user to specify the units in the time scale (x-axis) and then I recalculate and call this function plots(). I want the plot to simply update, not append another plot to the figure.
def plots():
global vlgaBuffSorted
cntr()
result = collections.de... |
first time posting in stack - always found previous questions capable enough of solving my prob! Main problem I have is the logic... even a pseudo code answer would be great.
I'm using python to read in data from each line of a text file, in the format:
This is a tweet captured from the twitter api #hashtag http://url.... |
This article continues a review of advanced object-orientedprogramming concepts. In this installment I examine multipledispatch, which is also called multimethods. Most objectoriented languages--including Python, Perl, Ruby, C++, and Java--areintellectually descended from Smalltalk's idea of message passing, albeitwith... |
Last time I talked about the creation of Robaccia I got to the point of a working framework and just waved my hands and said you could keep going and "just" add conventions. I have pointed out that "just" is a dangerous word, so let's walk through the rest of the steps to building a Rails/Django-like web framework.
Upd... |
In class I am learning about value iteration and markov decision problems, we are doing through the UC Berkley pac-man project, so I am trying to write the value iterator for it and as I understand it, value iteration is that for each iteration you are visiting every state, and then tracking to a terminal state to get ... |
I have read this answer potentially as the best way to randomize a list of strings in Python. I'm just wondering then if that's the most efficient way to do it because I have a list of about 30 million elements via the following code:
import json
from sets import Set
from random import shuffle
a = []
for i in range(0,1... |
(Original spanish below)
how can you change the size of a form field?
For example, see the following code:
class MyModelAdmin(admin.ModelAdmin):
def formfield_for_dbfield(self, db_field, **kwargs):
field = super(ContentAdmin, delf).formfield_for_dbfield(db_field, **kwargs)
if db_field.name == 'somefield':
... |
Consider the following piece of Markdown code:
The is some regular text.
>>> def factorial(n):
... return 1 if n < 2 else n * factorial(n - 1)
...
* This is a list item.
>>> def factorial(n):
... return 1 if n < 2 else n * factorial(n - 1)
...
Notice that the second code block is prece... |
For completeness sake, here is how you'd generate that exact SQL with using sqlalchemy.sql.func:
from sqlalchemy.sql import func
from sqlalchemy.sql.expression import bindparam
from sqlalchemy import Interval
tomorrow = func.dateadd(func.now(), bindparam('tomorrow', timedelta(days=1), Interval()))
which results in:
>>... |
ive been working on two spiders. They share the same filesystem and before I started doing heavy work on the second spider the first one was working. Now that I am done with the second one I am looking to give each spider a test run before I try and splice them together. When I try to run the first one it tries to exec... |
I'm misunderstanding something! If my model is not saved, it does not have an id associated with it. So if I have something like this:
views.py (inserting or editing existing info uses the same modelform)
def insert_or_modify(request, id=None):
if id is not None:
book = BookModel.objects.get(pk=id)
els... |
Gaara
barre de progression sur notification en root [finalisé]
Bonjour,
J'essaie de me faire un petit script qui me prévient avec une notification quand mes mises à jours sont effectuées, en utilisant unattended-upgrades.
J'ai réussi à le faire fonctionner avec yad, mais c'est pas très joli. Je voudrais donc utiliser n... |
I'd give all collidable objects a rectangle data member to provide a boundary for it.
Suppose we have a box class with a
Rect rect;// declare a suitable type if it doesn't exist
data member.
Let box objects also have a function member hit() for collision testing against other boxes.
Box objects shall be visible, hence ... |
Slightly technical question for my friends on Planet GNOME. I have been hunting around for some help online with no luck, so I figured I would post here and hopefully this blog entry can be a solution for those who have similar questions.
I am in the process of porting App Of Jaq to to async. To do this I am using gio ... |
Epigenomics 2014
Author: Martin Morgan (mtmorgan@fhcrc.org)
Date: 24 August, 2014
Input & manipulation: Biostrings
>NM_078863_up_2000_chr2L_16764737_f chr2L:16764737-16766736
gttggtggcccaccagtgccaaaatacacaagaagaagaaacagcatctt
gacactaaaatgcaaaaattgctttgcgtcaatgactcaaaacgaaaatg
...
atgggtatcaagttgccccgtataaaaggcaagtttacc... |
Adding the pwd command to xv6
Xv6 is a fairly popular clone of Version 6 UNIX. It was made by MIT as a base for students to work off of, as the original V6 UNIX was showing it's age, and only ran on the outdated PDP11 architecture. Xv6 runs natively on x86, and supports modern features like SMP, while still being only ... |
The button is working but the threading is not working at all. What is causing it to fail?thread.start_new_thread(task1) statement is not executed.
/var/tmp/p.py:
import sys,os
import pygtk, gtk, gobject
import socket, datetime, threading
import ConfigParser
import urllib2
import subprocess
import threading
import thre... |
In my application I have implemented a very crude workflow made up by 5 different "processing units". The code at the moment is structured like this:
def run(self, result_first_step=None, result_second_step=None):
config = read_workflow_config("config.ini")
if config.first_step:
result_first_step = run_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.