text
stringlengths
256
65.5k
If I check with google, I can see my public IP. Is there something on the Ubuntu command-line which will yield me the same answer? If you are behind a router, then your computer will not know about the public IP address as the router does a network address translation. If you are not behind a router, you can find it ou...
Actions Actions are a way to control your browsers, e.g. simulate user interactions like clicking elements, open urls, filling out input fields, etc. .query It can be really cumbersome to repeat selectors all over when performing multiple actions or assertions on the same element(s). When you use the query method (or i...
Can anyone help me out here, I am stuck on the base cases for turning this code into a recursive function... Can't use loops in the recursive function obviously. def diamond(a): assert a > 0, "width must be greater than zero" for i in range(0, a, 2): for c in range(0, a - i, 2): print(" ", end='') if a ...
I'm writing a crawler to download the static html pages using urllib. The get_page function works for 1 cycle but when i try to loop it, it doesn't open the content to the next url i've fed in. How do i makeurllib.urlopencontinuously download HTML pages? If it is not possible, is there any other suggestion to download ...
I've got the following problem. I'm in astrophysics, and trying to make a skymap. The collected data tells me the temperature of the sky at every (x,y)-coordinate. I've been looking for ages on how to plot this, but the best I've come up with so far is using meshgrid. My problem, however, is that this works perfectly i...
Alon Swartz - Mon, 2010/12/13 - 18:26 When settings.DEBUG is set to False, exception tracebacks will be sent to settings.ADMINS. To make it simpler to track down how and why the exception was raised, it's beneficial to know which user caused the exception. settings.py MIDDLEWARE_CLASSES = ( ... 'hubutils.middle...
I'm using gae-sessions with django for writing a gae based app. From here I've added gaesessions.DjangoSessionMiddleware to settings.py. A modification is required in self.wrapped_wsgi_middleware = SessionMiddleware(fake_app, cookie_key='you MUST change this') I have put the cookie_key but what is required in place of...
Can I make a slicing in os.listdir()? To take only a number of elements. I don't see why not: >>> os.listdir(os.getcwd()) ['CVS', 'library.bin', 'man', 'PyLpr-0.2a.zip', 'pylpr.exe', 'python26.dll', 'text'] >>> os.listdir(os.getcwd())[3:] ['PyLpr-0.2a.zip', 'pylpr.exe', 'python26.dll', 'text'] Since >>> import os >>> ...
The divisor function is the sum of divisors of a natural number. Making a little research I found this to be a very good method if you want to find the divisor function of a given natural number N, so I tried to code it in Python: def divisor_function(n): "Returns the sum of divisors of n" checked = [False]*100...
How can I make a "keep alive" HTTP request using Python's urllib2? Use the urlgrabber library. This includes an HTTP handler for urllib2 that supports HTTP 1.1 and keepalive: >>> import urllib2 >>> from urlgrabber.keepalive import HTTPHandler >>> keepalive_handler = HTTPHandler() >>> opener = urllib2.build_opener(keepa...
This step-by-step guide will quickly get you started on Leaflet basics, including setting up a Leaflet map, working with markers, polylines and popups, and dealing with events. Before writing any code for the map, you need to do the following preparation steps on your page: Include Leaflet CSS file in the head section ...
I'm currently using the modified Gram-Schmidt algorithm to compute the QR decomposition of a matrix A (m x n). My current problem is that I need the full decomposition Q (m x m) instead of the thin one Q (m x n). Can somebody help me, what do I have to add to the algorithm to compute the full QR decomposition?. import ...
#2301 Le 28/10/2012, à 16:38 ynad Re : TVDownloader: télécharger les médias du net ! Re @11gjm la liste des correctifs, dans la dernière il y a 4h les deux nouveaux fichiers main.py (v 0.9.3) et PluzzDL.py qui permettent le changement url @+ Hors ligne #2302 Le 28/10/2012, à 16:56 11gjm Re : TVDownloader: télécharger l...
Right off the bat - no, this is NOT homework. I would like to write a prefix notation parser in python (for sums presently)... for example if given: + 2 2 it would return: 4 ideas? def prefix(input): op, num1, num2 = input.split(" ") num1 = int(num1) num2 = int(num2) if op == "+": return num1 + num2 elif ...
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... 461 users here now /r/programming is a reddit for discussion and news about computer programming Guidelines Please t...
I thought I knew everything about encodings and Python, but today I came across a weird problem: although the console is set to code page 850 - and Python reports it correctly - parameters I put on the command line seem to be encoded in code page 1252. If I try to decode them with sys.stdin.encoding, I get the wrong re...
There has got to be a faster way to do in place replacement of values, right? I've got a 2D array representing a grid of elevations/bathymetry. I want to replace anything over 0 with NAN and this way is super slow: for x in range(elevation.shape[0]): for y in range(elevation.shape[1]): if elevation[x,y] > 0...
Gemnoc Re : Logiciel de CAO 2D/3D (Conception Mecanique) Une autre demande pour Ellypsis, pourrais-tu démarrer FreeCAD de cette façon dans le terminal : freecad --write-log Ceci va enregistrer un fichier journal FreeCAD.log dans le dossier ~/.FreeCAD, ouvres-le et postes le contenu ici. J'ai testé rapidement le Sketch...
I have a Tk python program that creates a list of python files in the current directory and generates a button for each of them. When you click a button the corresponding python program is launched via subprocess in a new gnome-terminal. I'd like to switch the button's color to red after the subprocess has finished exe...
More Patterns Because it's so easy and fun, I want to add another pattern: class NthWeekdayPatternTests(unittest.TestCase): def setUp(self): self.pattern = NthWeekdayPattern(1, WEDNESDAY) def testMatches(self): firstWedOfSep2004 = datetime.date(2004, 9, 1) self.failUnless(self.pattern.ma...
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...
This is what I did. The questions will be at the end. 1) I first opened a .txt document using open().read() to run a function as follows: def clean_text_passage(a_text_string): new_passage=[] p=[line+'\n' for line in a_text_string.split('\n')] passage = [w.lower().replace('</b>\n', '\n') for w in p] if ...
Hi, this time I've run into a problem with the rand() function. You see, I am writing a text-based game, which is currently pretty successful (over 3,000 lines!). This is one of those turn-based combat game things, like where you have 4 moves that you can perform to try to kill the enemy. Something that reminds me of w...
I have a list called stock_data which contains this data: ['Date', 'Open', 'High', 'Low', 'Close', 'Volume', 'Adj Close\n2013-06-28', '874.90', '881.84', '874.19', '880.37', '2349300', '880.37\n2013-06-27', '878.80', '884.69', '876.65', '877.07', '1926500', '877.07\n2013-06-26', '873.75', '878.00', '870.57', '873.65', ...
I am trying to create a simple socket server using the new concurrent.futures classes. I can get it to work fine with ThreadPoolExecutor but it just hangs when I use ProcessPoolExecutor and I can't understand why. Given the circumstance, I thought it might have something to do with trying to pass something to the child...
Now that it is needed since web2py exports already in CSV but you can do define def export_xml(rows): idx=range(len(rows.colnames)) colnames=[item.replace('.','_') for item in rows.colnames] records=[] for row in rows.response: records.append(TAG['record'](*[TAG[colnames[i]](row[i]) for i in idx])) ...
Consider the following Python script, which uses SQLAlchemy and the Python multiprocessing module. This is with Python 2.6.6-8+b1(default) and SQLAlchemy 0.6.3-3 (default) on Debian squeeze. This is a simplified version of some actual code. import multiprocessing from sqlalchemy import * from sqlalchemy.orm import * db...
In my pcolor map, I want to mark contours , but for values which dont depend on the Z values of the pcolor ( specified by levels) but on the basis of specific (x,y) indices. How can i do this ? Thanks in advance, Jyotika I am not sure if this is what you are looking for, but you could do something like this to get a co...
I am trying to write dbus server where I want to run some external shell program (grep here) to do the job. when I do: prompt$ server.py then: prompt$ client.py # works fine, ie. runs grep command in child process. prompt$ client.py # ..., but second invocation produces following error message: DBusException: org.freed...
i have put the setting LOGOUT_URL ='http://www.google.fr but when I log out, it still goes to the default url '/accounts/logout/' and what ever other url redirection. I have seeked everywhere and i realy don't know why it is not working # Django settings for clinica project. DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS =...
Testing with Google Music, I realized that it's all about the ID3 tag. Whatever you put there, Google uses it. it doesn't matter what the name of your files are, it's all about the ID3.Even if you have songs where the Artist and Album Artist are different, Google will display both correctly without any confusion.I sugg...
I know a lot of questions have been posted about the intra-package importing. I want to know whether the below is the way for Python 2.7 too. Source/anomalyCheck/ __init__.py DLthput.py ULPowerStats.py ULThput.pyconfig/ __init__.py configure.pyparserTools/ __init__.py logParser.pyutilities/ __init__.py plotLogResults.p...
I'm trying to write a screenlet from scratch following this guide http://www.ibm.com/developerworks/linux/library/l-script-linux-desktop-1/index.html. I have created the Hello World! example but when testing it I can't click on it, like the screenlet is being drawn directly on the desktop and it has no underlying windo...
I'm trying to parse data from a website and cannot print the data. import xml.etree.ElementTree as ET from urllib import urlopen link = urlopen('http://weather.aero/dataserver_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&stationString=KSFO&hoursBeforeNow=1') tree = ET.parse(link) root = tree.getr...
Any real-world, enterprise-scale application requires access to some sort of persistent storage. The Relational Database Management System (RDBMS) is the most widely-used persistence storage mechanism that supports SQL for data query and update. Java DataBase Connectivity (JDBC) is a set of APIs that provide a framewor...
There is a Fourier transform method here. Using the example from belisarius it might be done as below. Caveat: I do not guarantee I made no cut-and-paste errors. Your mileage may vary. Considerably. (* sample data *) g[x_] := x + 1/2 Sin[x] + RandomVariate[NormalDistribution[.2, .05]]; SeedRandom[1111]; xmax = 8*Pi; nH...
A somewhat noobish, best practice question. I dynamically look up object attribute values using object.__dict__[some_key] as a matter of habit. Now I am wondering which is better/faster: my current habit or getattr(object,some_key). If one is better, why? >>> class SomeObject: ... pass ... >>> so = SomeObject() >>...
Paul's answer is a perfectly fine method of doing this. However, if you don't want to make a custom transform, you can just use two subplots to create the same effect. Rather than put together an example from scratch, there's an excellent example of this written by Paul Ivanov in the matplotlib examples (It's only in t...
Hi I'd like to get a table from a database, but include the field names so I can use them from column headings in e.g. Pandas where I don't necessarily know all the field names in advance so if my database looks like table test1 a | b | c ---+---+--- 1 | 2 | 3 1 | 2 | 3 1 | 2 | 3 1 | 2 | 3 1 | 2 | 3 How can I do a impo...
What benefit or implications could we get with Python code like this: class some_class(parent_class): def doOp(self, x, y): def add(x, y): return x + y return add(x, y) I found this in an open-source project, doing something useful inside the nested function, but doing absolutely nothin...
From what I understand from tornado.gen module docs is that tornado.gen.Task comprises of tornado.gen.Callback and tornado.gen.Wait with each Callback/Wait pair associated with unique keys ... @tornado.web.asynchronous @tornado.gen.engine def get(self): http_client = AsyncHTTPClient() http_client.fetch(...
Assuming you're using Python 2.x, remember: there are two types of strings: str and unicode. str are byte strings, whereas unicode are unicode strings. unicode strings can be used to represent text in any language, but to store text in a computer or to send it via email, you need to represent that text using bytes. To ...
In this chapter, we will first use the Spark shell to interactively explore the Wikipedia data. Then, we will give a brief introduction to writing standalone Spark programs. Remember, Spark is an open source computation engine built on top of the popular Hadoop Distributed File System (HDFS). Interactive Analysis Let’s...
I frequently need to start several programs that I use every time I start my computer. How can I make it so that whenever I login the program is automatically launched? To make a program start with Ubuntu: To make Ubuntu remember your running applications on shutdown: (NOTE: this may slow system boot, and has not been ...
How do I catch the output from PyErr_Print() (or anything that prints to stdout/stderr)? In Python code, define an object with a write method that takes a single string argument. Assign this object to sys.stdout and sys.stderr. Then, the output will go wherever your write method sends it. The easiest way to do this is ...
This is the second post in a series on converting recursive algorithms into iterative algorithms. If you haven’t read the previous post, you probably should. It introduces some terms and background that will be helpful. Last time, if you’ll recall, we discussed The Simple Method of converting recursive functions into i...
leYB Re : lexmark x2670 Que dit : ls -l /usr/local/lexmark/lxk08/bin/printdriver -rwxr-xr-x 1 root bin 63851 2008-11-06 09:47 /usr/local/lexmark/lxk08/bin/printdriver Hors ligne leYB Re : lexmark x2670 En changeant le groupe c'est toujours pareil? sudo chgrp root /usr/local/lexmark/lxk08/bin/printdriver Cela donne: ~...
Here’s a post I did for Tate about releasing collections metadata under a Creative Commons licence. There are some great examples of data visualisation and an explanation how we got it on Github using RESTful JSON APIs and whatnot. # Professional Development I’m revisiting an earnest and mercifully short talk I gave at...
I am relatively new to Python, and I am experimenting with writing the following date calc functions find the date that is/was Monday for a specified datetime find the first non-weekend day of the month in a specified datetime find the first non-weekend day of the year in a specified datetime find the Nth [day of week]...
I started the debugging session over by quitting with the (q)uit command, and restarted the debugger by kicking off the script again: (Pdb) q {'1': 2, '0': 1, '3': 4, '2': 3, '5': 6, '4': 5, '7': 8, '6': 7} **************************************** **************************************** line>> 1 2 3 4 {'1': 2, '0': 1,...
In Python 2, Unicode strings may contain both unicode and bytes: a = u'\u0420\u0443\u0441\u0441\u043a\u0438\u0439 \xd0\xb5\xd0\xba' I understand that this is absolutely not something one should write in his own code, but this is a string that I have to deal with. The bytes in the string above are UTF-8 for ек (Unico...
This project is archived and is in readonly mode. Need a way to remove 'bad' connections from a connection pool Reported by Sam Morris | June 30th, 2011 @ 10:45 AM In the following code: c = pool.getconn() try: f(c) finally: pool.putconn() If the database is restarted while f is executing then an OperationalEr...
I have Karmic Koala which has Python 2.6 installed by default. However I can't run any Python App Engine projects because they require Python 2.5 and python ssl. To install ssl I installed python2.5-dev first while following some instructions I found elsewhere. sudo apt-get install libssl-dev sudo apt-get install pytho...
Nimoitu Ubuntu AMD64 ? Bonjour à tous, J'ai récemment acheté une machine basé sur du 64 bits. Je souhaite installer Ubuntu, c'est d'ailleurs pour ça que je me suis inscrit ici ! Seulement voilà, commme beaucoup, j'hésite à prendre la version AMD64. Si ce n'est Flash, Java, Realplayer, etc. Vais-je rencontrer des problè...
Setting The Default Encoding In Python I recently had to force the default encoding for one of our apps, QuoteRobot (Check it out if you write proposals, quotes or invoices). You can check the default encoding by opening the Python terminal and running: import sys sys.getdefaultencoding() My output is ascii. This can...
Hagar de l'Est [How-To] Installer OpenOffice.org avec les RPMs officiels Si vous n'avez pas la patience d'attendre que les dépôts soient mis à jour pour installer la dernière version d'OOo, voici la méthode manuelle à partir des RPMs officiels. NB: avant d'installer, si vous avez modifié la configuration des dictionnai...
There is a socket method for getting the IP of a given network interface: import socket import fcntl import struct def get_ip_address(ifname): s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) return socket.inet_ntoa(fcntl.ioctl( s.fileno(), 0x8915, # SIOCGIFADDR struct.pack('256s', ...
Stability provisional Maintainer Alberto Ruiz Safe Haskell None Basic data processing. vector :: [ℝ] -> Vector ℝ (|>) :: Storable a => Int -> [a] -> Vector a matrix :: Int -> [ℝ] -> Matrix ℝ (><) :: Storable a => Int -> Int -> [a] -> Matrix a tr :: Transposable m mt => m -> mt size :: Container c t => c t -> IndexOf c ...
I've read The Nature of Lisp. The only thing I really got out of that was "code is data." But without defining what these terms mean and why they are usually thought to be separate, I gain no insight. My initial reaction to "code is data" is, so what? Write Lisp code. The only way to really 'get' Lisp (or any language,...
Published on O'Reilly Network (http://www.oreillynet.com/) See this if you're having trouble printing code examples by Cameron Laird and Boudewijn Rempt 07/07/2000 Editor's note -- Seldom do I run across an article on application development that is just plain fun. I have one here. There are four characters in this sto...
Multiple statements found 08 Sep, 2014 Arijjan V writes (excerpted): When I enter code into the compiler I continue to get multiple statement error messages.Even if I copy the code from the book. I use Idle 34 on windows professional 7. This is what I typed into the Idle Shell. found_coins = 20 magic_coins = 70 stolen_...
Today I worked with William on the promising ironclad project which allows you to use CPython extension such as numpy under IronPython. Ironclad needs to setup some import hooks to allow the loading of .pyd files. Here's some findings: ihooks is old One way to do import hooks is to use the ihooks module. However, this ...
The sample you're looking at is not, technically speaking, a valid CSV format file. Basically, whomever provided the file used the text qualifier symbol - the double quote " - in a non-standard way. The traditional way to use it is this: 123,"Sue said, ""Hi, this is a test!""",2012-08-15 This statement should parse as...
JavaScript stevenhu — 2012-09-21T16:02:46-04:00 — #1 I am trying to delete a row in a database via external JS, but don't think the syntax is right. What I have right now is my best guess as to what it should be. The database rows show an ID, filename, and title (context: a bookmarked or favorite page), and when a quer...
FelixP [Résolu] ! Script pour noms de musique Salut à tous ! J'ai une petite question à vous poser… (Eh oui !) Je cherche un script pour me créer un fichier avec la liste des noms des musiques qui sont dans un dossier donné, avec la syntaxe de Wikipédia (histoire de remplir ses serveurs de données !) en sachant que les...
Fredrik Lundh has a stupid googlesuggest hack, which I've tweaked to be a simple command-line program: guin:tmp$ googlesuggest python python (10,600,000 results) python tutorial (2,630,000 results) pythons (460,000 results) python 2.2 (1,840,000 results) python programming (4,380,000 r...
I'm developing a model for web applications. The database that I use is Redis. I created special DbField objects like HashDbField, SortedSetDbField, ScalarDbField and so on, for each data type in Redis. This objects provides a convenient way to work with redis keys. Each of it takes target key name in constructor The s...
Thre are 2 tests: one is testing index page with WebTest, another is testing admin page with Selenium LiveServerTestCase. When i comment one of the tests, another works, but if both are uncommented, test command fails with error after WebTest is finished and Selenium tries to start: $ bin/django-admin.py test myapp--se...
I am trying to generate 2 x509 certificates with the same signature but different values in the common name field, based on md5 collisions, as it was specified in this paper (page 7). Now I have successfully created 2 files with the same md5 value, that are valid certificates, but the public key field doesn't contain v...
Here is what I do to create a new fragment (called AlbumsTrackFragment) and replace the existing one : AlbumsTrackFragment albumstrackfragment = new AlbumsTrackFragment(); FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); fragmentTransaction.replace(R.id.layout_ipod, albumstrackfragmen...
I have a setup.py script that builds an .app file on OS X, however I need to include pyusb which was installed with pip. It's located /Library/Python/2.7/site-packagespyusb-1.0.0a3-py2.7.egg I am able to use it within my application however when I try to build and run it it doesn't include this dependancy. My setup scr...
jibel Re : Hybryde a disparu du DD ext. Si je comprends bien ton raisonnement hydryde qui était sur le DD ext a été remplacé par Voyager 12.10 et pourquoi/comment ? C'est vrai ça fait pas tellement de temps que je suis avec linux , mais jamais , je n'ai eu a faire de MaJ de grub après un nouvelle installation, et j'en ...
Despite competition from the Web and instant messaging, email is still a primary communication medium for most Internet users, and many people have sizable archives of email messages. Sometimes these archived messages reside on an IMAP server, in which case you can use Python's imaplib module for scripted access to ema...
How do I get the strings I can insert instead of 'gtk-execute'? #!/usr/bin/python import gobject import gtk import appindicator if __name__ == "__main__": ind = appindicator.Indicator("example-simple-client", "gtk-execute", appindicator.CATEGORY_APPLICATION_STATUS) ind.set_status (appindicator.STATUS_AC...
is there a builtin function of Python that does on python.array what argsort() does on a numpy.array? I timed the suggestions above and here are my results. First of all, the functions: def f(seq): # http://stackoverflow.com/questions/3382352/equivalent-of-numpy-argsort-in-basic-python/3383106#3383106 #non-lamb...
I see that most programming language tutorial teach recursion by using a simple example which is how to generate fibonacci sequence, my question is, is there another good example other than generating fibonacci sequence to explain how recursion works? The classic is the binary tree search: def findval (node,val): i...
I made a request to authenticate server side into Facebook for my Django application. def authenticateViaFacebook(request): ''' Redirects users to a page that allows for Facebook login. ''' consumer = oauth2.Consumer( key = settings.FACEBOOK_APP_ID, secret = settings.FACEBOOK_APP_...
An important part of integrating with the Ubuntu desktop is ensuring that your application is using all of the appropriate indicators. In this entry, I explain how I added support for the Ubuntu Sound Menu to the sample application "Simple Player." Ubuntu's Sound Menu allows users to access some of a media players func...
I installed vim-latex using pathogen following the very clear instructions proposed in: How to install vim-latex? However, when I open a .tex file using MacVim, I get the following error message: Error detected while processing ~/.vim/bundle/vim-latex-1.8.23-20130116.788-git2ef9956/ftplugin/latex-suite/texviewer.vim: l...
nam1962 [résolu, du coup tuto] Comment nettoyer mauvaise install de langues Comment peut on récupérer un desktop en francais sous 12.04 ou 12.10 ? Je viens d'installer un Airis pour un ami en Xubuntu 12.04 Tout est total ok, mais le desktop est en anglais (tous les fichiers locale indique pourtant fr_Fr ou fr UTF8). Y ...
The proper way to do it is have a self submitting forms that redirect to the destination page. Here are two sample controllers: def page1(): form=FORM('your name:',INPUT(_name="name"),INPUT(_type="submit")) if form.accepts(session.vars,session): session.name=form.vars.name redirect(URL(r=reque...
#2601 Le 29/12/2012, à 21:49 bibichouchou Re : TVDownloader: télécharger les médias du net ! Dans le gestionnaire de paquet, as-tu remarqué s'il y avait une coche en face des lignes http://ppa.launchpad.net/chaoswizard/tvdownloader/ubuntu quantal main Si les lignes ne sont pas cochées, c'est que le dépôt n'est pas act...
doudoulolita Faire une animation sur la création de jeux vidéo libres Dans le topic Création de jeu vidéo libre - Appel à candidatures, j'ai découvert le créateur de jeu de Ultimate Smash Friends, Tshirtman. Voici ce que je lui ai écrit: Je cherche un jeu que notre Espace Public Numérique pourrait proposer aux jeunes s...
How do I install SciPy on my system? Update 1: for the NumPy part (that SciPy depends on) there is actually an installer for 64 bit Windows: numpy-1.3.0.win-amd64-py2.6.msi (is direct download URL, 2310144 bytes). Running the SciPy superpack installer results in this message in a dialog box: "Cannot install. Python ver...
First you need to get each start letter. You can use a list comprehension on your text for this: In [40]: tgt="This is an example text. There are several words starting with letters." In [41]: fl=[word[0] for word in tgt.split()] In [42]: fl Out[42]: ['T', 'i', 'a', 'e', 't', 'T', 'a', 's', 'w', 's', 'w', 'l'] Now cou...
yag00 Matlab et Simulink Bonjour j ai installe Matlab 7 (R14) qui fonctionne tres bien le probleme c est que simulink ne fonctionne pas ; (j ai deja installe cette version a partir du meme fichier image sur une autre distrib et tout fonctionnait tres bien) voici ce que j obtient comme erreur quand je lance simulink dan...
Is there a cross platform way to get the monitor's refresh rate in python (2.6)? I'm using Pygame and PyOpenGL, if that helps. I don't need to change the refresh rate, I just need to know what it is. I am not sure about the platform you use, but on window you can use ctypes or win32api to get details about devices e.g....
Posted May 16, 2012 I like Python, a lot. I'm one of those people who would use it all the time if they could, especially for web development. Which is convenient, since I'm currently working on my own company. One of the drawbacks of using Python, though, has always been getting it to play nicely with web servers. I'v...
I want to import subfolders as modules. Therefore every subfolder contains a __init__.py. My folder structure is like this: src\ main.py dirFoo\ __init__.py foofactory.py dirFoo1\ __init__.py foo1.py dirFoo2\ __init__.py foo2.py In my main script I import from dirFoo.foofactory import FooFactory In this factory file I...
I'm new to Ubuntu (12.04.3). I'm trying to install handbrake and I've tried about 6 different ways non seem to work, so I'm now asking for help. Step 1 sudo add-apt-repository ppa:stebbins/handbrake-releases $ sudo add-apt-repository ppa:stebbins/handbrake-releases Traceback (most recent call last): File "/usr/bin/a...
The LV2 documentation generation tools use RDFLib. It is probably the most popular RDF interface for Python, though does much more than just parse Turtle. It is a good choice if performance is not an issue, but is unfortunately really slow. If you need to actually instantiate and use plugins, you probably want to use a...
How can I split correctly a string containing a sentence with special chars using whitespaces as separator ? Using regex split method I cannot obtain the desired result. Example code: # -*- coding: utf-8 -*- import re s="La felicità è tutto" # "The happiness is everything" in italian l=re.compile("(\W)").split(s) pri...
I would like to move a large number of pictures into picassa. I'm having no trouble uploading using InsertPhotoSimple, but I want to upload metadata too and am having trouble with InsertPhoto. Can anyone point me to a simple example or tell me what I'm doing wrong? Here is what I have now: #!/bin/python import gdata.ph...
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), as you probably guessed already, is a way to inline Python in HTML o...
import xml.dom.minidom document = """\ <parent> <child1>value 1</child1> <child2>value 2</child2> <child3>value 3</child3> </parent> """ def getText(nodelist): rc = [] for node in nodelist: if node.nodeType == node.TEXT_NODE: rc.append(node.data) else: print "...
I am just wondering how the buffers work on a com port.. The code below is a snip of how I am reading a com port. I am wondering if by doing serial_connection.close() and serial_connection.open() I would be losing any data, or would it remain in the buffer? You might ask why I am closing and opening the comport.. The r...
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...
Is there a closed formula to the problem $f(1)=1, f(2n)=f(n), f(2n+1)=f(2n)+1$. So far i have found a solution for $n$, which is the number of power of $2$'s needed to add up to the number starting with the greatest power of $2$. Also $n=$ the number of $1$'s needed to represent $n$ in binary form. So for example $f(12...
Prelude I’ve recently started a new job at an American start-up company. My position in the company is the one of Technical Lead – the person responsible for the selection of technologies around which the projects are being built. Since we’ll be doing mostly web development we’ve had a long kick-off discussion with the...
henry-006 Re : [script] Pixup : Poster une image rapidement sur un forum ah désolé, moi ch'suis allé direct dans la logithèque, comme un bon bourrin, OS: Ubuntu 12.10 (Quetzal quantal ) 64 bits + Windows XP pro SP2 x32 en double boot PC Medion / Processeur: Intel core2 Duo (CPU 2.80GHz) Mémoire vive:3029 MiB Carte Grap...