Thursday, November 25, 2010
Keyboard shorcuts on google
Tuesday, November 16, 2010
Chararcter set detection python script
I tried it and it works.
Tuesday, October 19, 2010
Re-creating user 0 fixes inaccessible Drupal site
If you find yourself having trouble accessing cotent or using your site as an anonymous user, you can safely run the following queries against your Drupal DB (4.6/4.7):
INSERT INTO users (uid, name, mail) VALUES ('0', '', '');
INSERT INTO users_roles (uid, rid) VALUES (0, 1);
INSERT INTO node_access VALUES (0, 0, 'all', 1, 0, 0);If any of the queries above returns a "duplicate entry" error, that means a row already exists, and that table is already OK.
Wednesday, October 13, 2010
Googlification
But I have a different worry. The worry’s called Google and I have a great fear that we are being "googlified". The great simplicity and the enormous quantitative search results that Google produces are being seen uncritically. This might result in a tendency to no longer use documents, articles and books, but to solve all our information problems using Google. There, information is not really indexed deeply enough and the algorithms behind the ranking are unclear. "Googlification" should create great concern for everybody in the information as well as education sector, including parents of children.
Thursday, October 07, 2010
Nice way to insert a stylesheet in an HTML doc
like this:
<STYLE>
<!--
BODY,DIV,TABLE,THEAD,TBODY,TFOOT,TR,TH,TD,P { font-family:"Arial"; font-size:x-small }
-->
</STYLE>
I used this tool to convert the html code in HTML entities.
Monday, September 27, 2010
World map with users in real time
Thursday, September 16, 2010
MD5 checksum utility
I just pasted the md5.exe in my download folder. And from a DOS command prompt, the command "md5.exe filetoanalyse" will return the checksum. For example:
C:\user\Downloads>md5.exe py2exe-0.6.9.win32-py2.6.exe
Returns
F05FD1F17B1473A13E1919D6D7FA0B08 py2exe-0.6.9.win32-py2.6.exe
Tuesday, September 07, 2010
Virtual Python
virtualenv is a tool to create isolated Python environments.
The basic problem being addressed is one of dependencies and versions, and indirectly permissions. Imagine you have an application that needs version 1 of LibFoo, but another application requires version 2. How can you use both these applications? If you install everything into /usr/lib/python2.4/site-packages (or whatever your platform's standard location is), it's easy to end up in a situation where you unintentionally upgrade an application that shouldn't be upgraded.
Or more generally, what if you want to install an application and leave it be? If an application works, any change in its libraries or the versions of those libraries can break the application.
Also, what if you can't install packages into the global site-packages directory? For instance, on a shared host.
In all these cases, virtualenv can help you. It creates an environment that has its own installation directories, that doesn't share libraries with other virtualenv environments (and optionally doesn't use the globally installed libraries either).
Monday, September 06, 2010
Google Map competitor
The same company also has a different interface on the website Navteq.com in my region it shows traffic data for a lot more roads than google map does. I wonder how this is possible.
Wednesday, August 25, 2010
Make the Tab bar visible in FIrefox full screen mode
Pour afficher la barre des tabs en mode plein écran, d'après Tweak Firefox 3 full screen mode, vous devez changer un réglage en entrant about:config dans la barre d'adresse, puis modifier la valeur de browser.fullscreen.autohide à "False".
Tuesday, August 17, 2010
When software patents become conter-productive
The way the US patent system is currently set up, it’s difficult if not impossible to write a sizable body of code without unknowingly infringing on somebody’s patent. Your best hope seems to be to waste a lot of time filing as many patents as you can of your own, and hoping that anybody who sues you is unknowingly infringing on one of yours. That gives you a bargaining chip so you can do some kind of cross licensing deal. It’s a stupid, wasteful, unproductive government-created system that achieves the exact opposite of what was intended when it was first started. But, what can you do.
Friday, August 06, 2010
Python CGI scripts under wamp
C:\wamp\bin\apache\Apache2.2.11\conf>notepad httpd.conf
Then search for the line containing "addhandler" and write:
AddHandler cgi-script .pyFor python scripts (for any other scripting language, just use the relevant extension).
Then the first line of your script should contain the path to the python program:
#!c:/Python26/python.exe -uAccording to python cgi on windows.
Place your script in C:\wamp\bin\apache\Apache2.2.11\cgi-bin\myscript.py and you're done.
The output of the script can be accessed at
http://localhost/cgi-bin/myscript.py
The script works but there are restrictions on the modules I can import. I can import native python modules, but not the module I made myself in other places outside the cgi-bin folder. I don't know how to solve that yet. (This is probably a security restriction)
pyodbcs connection strings
The Excel driver does not support transactions, so you will need to use the autocommit keyword:
cnxn = pyodbc.connect('DSN=test', autocommit=True)
DSN (Data Source Names) are defined in the ODBC data source administrator of the control pannel in windows (in the section administrative tools).
I wasn't able to establish a DSN-less connection.
Tuesday, August 03, 2010
Link to a specific part of a YouTube video
If you want to link to a specific part of a video on YouTube, you can. For example, http://www.youtube.com/watch?v=PjDw3azfZWI#t=31m08s
Notice the “#t=31m08s” on the end of the url? That link will take you 31 minutes and 8 seconds into that video.
Monday, August 02, 2010
Write tests in programming
Thursday, July 22, 2010
Creating icons with Irfanview
Tuesday, July 20, 2010
To model or not to model?
[...]
"Evolutionary robotics (ER) is still proving a useful and open-ended method for exploring this increasingly less constraining role of the designer that may be required to achieve strong artificial autonomy. ER hands in the task of filling in design specifications pertaining to mechanisms, morphology, structural and functional organization to an automatic process of artificial evolution (Harvey et al. 1997, Nolfi & Floreano, 2000). Thus, instead of designing a robot that must explore the environment but should go to the green light when the battery is down, one can attempt to design a robot that more generally must keep the battery up during its explorations, or more implicitly, a robot that explores indefinitely."
Monday, July 19, 2010
The command line as administrator
Wednesday, July 14, 2010
Django running
Now I'd like to know how I can use it to show the extracts of a table of metadata ! :-)
I don't know weather this was a stand-alone server or not. It's also possible to use Django on a standalone server. django-wsgiserver installs a web server for Django using CherryPy's WSGI server.
Python scripts as CGI on a web server
I dropped a python script (called rubbish.py) at /usr/lib/cgi-bin/rubbish.py But I couldn't see the output in my browser at: localhost/cgi-bin/rubbish.py (there was an error).
So I looked for help from the python cgi-script documentation. And their sample script works, it gives an html output that I can see in my browser. The main thing I had forgotten seems to be the need for the comment #!/usr/bin/env python as a first line of the file.
Here is what I see at the address http://localhost/cgi-bin/rubbish.py :
I wanted to run the script without cgi-bin, so i installed modwsgi.
Then restarted the Apache with sudo /etc/init.d/apache2 restart
I added a little python script into the /var/www/ folder. But it doesn't execute. Instead it loads the file. I saw somewhere that I have to change the .htaccess file. To tell the server that this is not just a file but a script the line AddHandler python-program .py does this. Well somehow it doesn't word. And the Apache doc says: "In general, you should never use
.htaccess
files unless you don't have access to the main server configuration file." I should change the httpd.conf file located at /etc/apache2/ on my computer. Pffffiou, :-) I'll do this another time, I already spent the whole afternoon on it.
- I got inspiration from this forum (first result on google for "LAMP server python"), but then needed more help to get to the correct cgi script formatting (the first line with #!/usr/bin/env python).
- I plan to check those web frameworks for python actually, I have already installed one to try it out (see next post). There are heaps of frameworks and there seems to be an effort at standardization.
Thursday, June 17, 2010
Wooden keyboard
Friday, June 11, 2010
Crop pages in a PDF
Undo close tab in Firefox
But a comment on the page says: " Useless Press Ctrl. Shift T instead of installing an add on for it." And that's quite true! :)
You can also view the recently closed tabs in the history menu.
Thursday, June 03, 2010
Turn off auto notifiers to increase your productivity
A simple way to increase your productivity is to turn off auto notifiers. It’s simply not necessary to check email constantly throughout the day, and doing so will regularly interrupt more important tasks. After receiving thousands of emails I can safely say that I’ve never received one that couldn’t wait 12 hours or so.
Process your inbox in batches. Make it once or twice a day, and try to get your inbox down to zero. This will allow you to plow through the rest of your productive tasks without constant interruption.
I'm sad to say I use outlook at work. Turning off auto notification is called: "Turn Desktop Alerts on or off" in the outlook help page:
On the Tools menu, click Options.
On the Preferences tab, click E-mail Options, and then click Advanced E-mail Options.
Under When new items arrive in my Inbox, clear the Display a New Mail Desktop Alert (default Inbox only) check box.
Tuesday, June 01, 2010
Why Python
Matthew: """Python syntax encourages programmers to write easy-to-read programs . [...] A well-written python program reads like a book. """The homogenization of scientific computing, or why Python is steadily eating other languages’ lunch
Tad: """A few years ago, you couldn’t really do statistics in Python unless you wanted to spend most of your time pulling your hair out and wishing Python were more like R (which, is a pretty remarkable confession considering what R is like)."""Paypal engineering: 10 myths of enterprise python:
Myth #7: Python does not scale
"""Scale has many definitions, but by any definition, YouTube is a web site at scale. More than 1 billion unique visitors per month, over 100 hours of uploaded video per minute, and going on 20 pecent of peak Internet bandwidth, all with Python as a core technology. Dropbox, Disqus, Eventbrite, Reddit, Twilio, Instagram, Yelp, EVE Online, Second Life, and, yes, eBay and PayPal all have Python scaling stories that prove scale is more than just possible: it’s a pattern."""Astronomers switch from IDL to Python. IDL is a vector oriented programming language. A wiki version of the IDL vs Python comparison, comment from the blog IDL vs. Python:
"Lately I’ve gotten increasingly frustrated with programming in IDL: [...] I find myself spending more and more time on “stupid stuff” like wrestling with the ancient and limited plotting system, building very ugly GUIs which nonetheless take vast amounts of cumbersome code to build, and dealing with namespace conflicts between routines with identical names in different libraries. Python is not perfect, but it’s a heck of a lot better than IDL in all of these aspects. Like I said, I’m only halfway switched (and certain collaborations are going to keep me in IDL for years, as will all my legacy code) but for new stuff Python seems like it’s got the wind behind its sails."
Interesting modules
- Ipython Notebook, now called Jupyter
xlrd and xlwt
Maybe have a look at this discussion group: python-excel.
Friday, May 21, 2010
Battery sizes
Thursday, May 13, 2010
Using synaptic on the eeePC
OK, it turns out there's an easy way to install Audacity[...]. I showed you the hard way already. Now let's take a look at the easy way.
- Go ahead and open a terminal by starting the file manager (located under the Work tab) and selecting "Open Console Window" from the Tools menu.
- Now type "konqueror" to bring up the KDE file manager/web browser. If you want to avoid entering your password down the line, try typing "sudo konqueror."
- Select Applications
- Select System
- Select Synaptic Package Manager
- Under Settings, select Repositories
- Click add and enter "deb http://http.us.debian.org/debian/ stable main"
- Click the Search button and enter Audacity, GIMP, or any other program you're looking for.
- Click on the check box next to the program you want to install and select Mark for installation
- Click Apply and you're all set.
Thursday, April 29, 2010
Wednesday, April 28, 2010
Monday, April 19, 2010
Annoying line in word
Wednesday, March 24, 2010
Remove image tags from an html page
I used Scite's replace function with regular expressions, I first removed all line breaks, then I used the simple regular expression
<img[^>]*>to match for all images and replace them with no text.
Wednesday, March 17, 2010
Installing Ubuntu server on KVM virtual machine
Today I installed Ubuntu server edition on a virtual machine. The 64 bit edition won't install on the virtual machine. By dowloading the 32 bit version , I could install a server on the virtual machine. Command:
kvm -m 750 -cdrom ../Downloads/ubuntu-9.10-server-i386.iso -boot d ubuntu-server.imgIt installed fine, and I added the 2 options to install a LAMP server and a Postgreesql database.
After installation, I restarted the new system with the command:
kvm -no-acpi -m 700 ubuntu-server.img[edit] The -no-acpi flag is to disable acpi. I used the command from a how-to done by a guy who wanted to avoid a kernel panic on an Ubuntu 7.10, but in ubuntu 9.10 acpi works well. So I can start the server with:
kvm -m 700 ubuntu-server.img
Tuesday, March 16, 2010
Virtual Machine
Following this instruction, I created a raw drive image with the command:
qemu-img create xubuntu.img -f qcow2 2GI used the option -m 750 to start the virtual machine (VM) with 750 Mb of RAM. Then I used the option -cdrom to use a file as a cdrom image and the option -boot d to say that the VM shall boot on a cdrom drive. The command:
kvm -m 750 -cdrom ../xubuntu-9.10-desktop-i386.iso -boot d xubuntu.img...starts the installation of Xubuntu on the virtual machine.
Thursday, March 04, 2010
From DOS to Windows NT
When IBM contacted other companies to obtain components for the IBM PC, the as-yet unreleased CP/M-86 was its first choice for an operating system because CP/M had the most applications at the time. Negotiations between Digital Research and IBM quickly deteriorated over IBM's non-disclosure agreement and its insistence on a one-time fee rather than DRI's usual royalty licensing plan.[1] After discussions with Microsoft, IBM decided to use 86-DOS (QDOS), a CP/M-like operating system that a Seattle area computer company had made for its own hardware. Microsoft adapted 86-DOS for the PC hardware and IBM shipped it as PC-DOS.
After learning about the deal, Digital Research founder Gary Kildall threatened to sue IBM for infringing DRI's intellectual property, and IBM agreed to offer CP/M-86 on the PC to settle the claim. CP/M-86 was released a few months after the PC and was one of three operating systems a customer could buy from IBM. At $240 per copy it sold poorly compared to the $40 PC-DOS. Kildall would later accuse IBM of setting the prices to marginalize him, but the accounts of Microsoft, IBM, and other DRI executives indicate that Kildall had demanded a substantial royalty for CP/M-86 while Microsoft had accepted a fixed sum. Customers rapidly adopted the PC platform with PC-DOS as the new industry standard, and opportunities for DRI to license CP/M-86 to other customers dwindled.
Windows NT:
Microsoft decided to create a portable operating system, compatible with OS/2 and POSIX support and with multiprocessing in October 1988.[10] When development started in November 1989, Windows NT was to be known as OS/2 3.0,[11] the third version of the operating system developed jointly by Microsoft and IBM. In addition to working on three versions of OS/2, Microsoft continued parallel development of the DOS-based and less resource-demanding Windows environment. When Windows 3.0 was released in May 1990, it was eventually so successful that Microsoft decided to change the primary application programming interface for the still unreleased NT OS/2 (as it was then known) from an extended OS/2 API to an extended Windows API. This decision caused tension between Microsoft and IBM and the collaboration ultimately fell apart. IBM continued OS/2 development alone while Microsoft continued work on the newly renamed Windows NT. Though neither operating system would immediately be as popular as Microsoft's MS-DOS or Windows products, Windows NT would eventually be far more successful than OS/2.
Windows NT was intended to complement consumer versions of Windows that were based on MS-DOS. NT was the first fully 32-bit version of Windows, whereas its consumer-oriented counterparts, Windows 3.1x and Windows 9x, were 16-bit/32-bit hybrids. Windows 2000, Windows XP, Windows Server 2003, Windows Vista, Windows Home Server, Windows Server 2008 and Windows 7 are based on Windows NT, although they are not branded as Windows NT.
Wednesday, March 03, 2010
Linus: Software evolves over time
In this video (around 0:36:00) :
Interactive linux kernel map.
Tuesday, March 02, 2010
Richard Stallman comparing proprietary software companies with colonial powers
Monday, March 01, 2010
Wikibook linuxguide
Wednesday, February 24, 2010
Totem python console
On the screenshot you can see a few commands in the console to play, pause and seek on a video or a sound file.
Friday, February 19, 2010
Linking to places in Excel
So I decided to use the "name range" possibility. But as explained here, "If the cell or range already has a name you may type a new name in the name box and it will be accepted as a name for that cell or range as long as it is not a name that is currently used elsewhere. However, the first name given will still exist and will still be the one shown in the name box when you select the cell or range. In formulas etc. You will still be able to use both the new name and the old name. "
Here (in 2004) they proposed to use a VBA function, but that is actually not nessecary.
The solution is to use the "Name Manager" dialog box. From Excel help: "Use the Name Manager dialog box to work with all of the defined names and table names in the workbook. For example, you may want to find names with errors, confirm the value and reference of a name, view or edit descriptive comments, or determine the scope. You can also sort and filter the list of names, and easily add, change, or delete names from one location.
To open the Name Manager dialog box, on the Formula tab, in the Defined Names group, click Name Manager."
And the way I solved my problem was by using the "create from selection" dialog in the "defined names" area of the formula tab.
Thursday, February 18, 2010
Setup of programs I use daily
Research Software
- LyX to write articles and structured documents including citations, Check my blog post on LyX
- JabRef to manage a bibliography
- LaTeX to typeset publications, exported in PDF format
- R statistical software and the R-Studio application
- Several packages: plyr, ggplot2, FAOSTAT, testthat
- Knitr and R Markdown to produce work reports in html. Knitr and LaTeX to produce more elaborate reports in PDF
- xlsx to write data frames to Excel
OS
- Debian GNU-Linux at work
- Ubuntu and Lubuntu at home
- Until 2014 windows XP and windows 7 at work
Office Software
- I use Firefox (renamed iceweasel on Debian) for web browsing, with the following extensions:
- Adblock to block annoying ads
- Delicious bookmarks to have mobile bookmarks across many browsers
- Mindthetime to keep track of time usage. This extension is not working any more.
- For simple image editing I use Irfanview. I crop scanned pictures or screenshots and I redimension them for web use or use in documents. Very occasionally, I use the "sharpen" function or the brightness, contrast, gamma corrections.
- I use Microsoft word and Excel at work. I use Google documents when writing something at home.
- To work collaboratively I use media wiki with the extension Semantic Mediawiki
- Based in this review, I installed spacesniffer it helps analyse disk space usage on windows. Like Disk space analyser on GNU-Linux systems. You can use filters such as this one: "*.jpg;>100kb;>2weeks" to filter only certain type of files, sizes and dates.
Command line tools on GNU-Linux
- du to analyse disk usage. I created an alias duh for du -h.
- grep to search inside text files
- pdfgrep to search inside pdf documents
- git see programming below
Thesis writting
- Writing documents in Lyx
- Keeping track of versions with git
- Managing a bibliography with Jabref.
Programming software
- Scite to edit code
- Git to track versions of code. See also git commands and posts tagged with git.
I want to test
- hubic remote for git annex
- Etherpad (within a company)
- Kaban (within a company)
- Sage mathematics software
- Panda data analysis because it brings data frame structures to python
- Montage Video sur ubuntu and Ubuntu video tools
I stopped using
- QuickWiki Quick search of definitions
- Zotero to share search results with colleagues
- Mendeley to insert citations in Microsoft Word and to manage a bibliography (can import bibtex files form Jabref)
Links
- On this blog, linux users describe their setup
- usethis.com another site where users such as Yihui Xie describe their setup.
Tuesday, February 16, 2010
Singularity - the opinion of Peter Norving
"So Ray is great and I appreciate all that he's done, I appreciate all the advances in AI that he has done in reading, in music and so on, so he's a great technologist. I think in terms of these predictions, euh, I think he's doing the best he can by saying, I wanna nail down this prediction, I'm gonna look at the data that we have, I'm gonna extrapolate from that data and come up with an answer, euh, I think the only problem is that the data is not conclusive, right. So you look at, Moore's law, yes, you can say computers are going at this particular rate, but I don't think you can necessarily say that when we pass a certain number of transistors, that corresponds to a certain number of neurons and therefore the 2 are equivalent, I think that's where the analogy breaks down."
What are your thoughts on molecular manufacturing and Bio-Engineering?
"So it's fascinating to me, euh, I'm trying to learn something about it. I'm educating myself, I gotta long way to go. I think it does tie-in because it is a mix between the physical world and the world of information. Euh, I think it is likely that in the coming century a large part of manufacturing will be done with cells or with atoms. I kind of think it'll be more done with cells than with atoms just because they're bigger, they're easy to manipulate, they've already got this 3 Giga bite computer on board, we just gotta figure out how to program it."Peter Norving is director of research at google.
Home server
They are based in Anger, how bizarre! And their website is in French and German.
Microsoft's open source license
Bla bla bla. :-) You're allowed to modify it but you're not allowed to licensie it under another license that would allow the distribution in source code form or distribution at no charge.
Monday, February 15, 2010
Python, Delphi and oracle
From the wikipedia article Python (pythology) (nice typo! :).
In computer fields
python is a programmin language and Delphi too. Oracle is a software company and you wonder where their inspiration came from.
Thursday, February 04, 2010
Thursday, January 28, 2010
US department of defence advocates Open Source
Basic web server on a microcontroler
A PC in the keyboard
Xcore is the manufacturer.
Géolocalisation par wifi
Wednesday, January 27, 2010
Connect to a SQLite database using python
import sqlite3 as sqlite
con = sqlite.connect('zotero.sqlite')
cur = con.cursor()
cur.execute('CREATE TABLE foo (o_id INTEGER PRIMARY KEY, fruit VARCHAR(20), veges VARCHAR(30))')
con.commit()
cur.execute('INSERT INTO foo (o_id, fruit, veges) VALUES(NULL, "apple", "broccoli")')
con.commit()
print cur.lastrowid
cur.execute('SELECT * FROM foo')
print cur.fetchall()
Here is the output:
>pythonw -u "test_sqlite.py"
1
[(1, u'apple', u'broccoli')]
2
With help from DZone snippets and devshed. However devsched's information about downloading and building the sqlite library is outdated as it is now included in python.
Edit:
In a later post, I explain how to connect do an SQLite database with the R statistical software and a package called dplyr.
Visualise the history of python development
First plot with python (x,y)
from pylab import *
test_list = [1,2,6,123,51,32]
plot(test_list)
title('Test plot of a list of numbers')
show()
Monday, January 25, 2010
Metaprogramming
Python at google, quotes
On the same blog there is another quote from Guido Van Rossum: "Guido uses print statements for 90% of his debugging and a debugger for the times when his brain stops working or he has to debug some wierd code that someone else wrote. "