Wednesday, March 24, 2010

Remove image tags from an html page

On my company's wiki site, there is an internal phone book . I wanted to be able to use it offline, so I saved it to my local computer. The web paged saved with a folder and attached images (normal behavior). But I wanted to remove the images.

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

In the previous post, I tested the usage of Xubuntu on a 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.img
It 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

Starting Ubuntu-Server on KVM Virtual Machine

Next step would be to access the http server from outside the virtual machine. For this I probably need to set a public bridge.

Tuesday, March 16, 2010

Virtual Machine

I installed KVM on my Ubuntu computer.
Following this instruction, I created a raw drive image with the command:
qemu-img create xubuntu.img -f qcow2 2G
I 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.

Screenshot of the starting page of Xubuntu on the virtual machine.

The virtual Machine runing Xubuntu

Now I'm going to install Ubuntu server and try to install a LAMP on it.

Thursday, March 04, 2010

From DOS to Windows NT

In 1981 IBM relesead the Personal Computer with Microsoft's MS DOS as operating system.CP/M-86:
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

Linus (after having been asked about cooperation in writing software): "I never actually though about how the kind of community works at all. Until people started asking me about it later on, like journalists started - how can this ever work? - (in a very doubting way, by the way). [...] these people who asked the questions, they were not exactly convinced that it could work at all. So I kind of had to rationalise, why the Linux kind of development does work. And I don't know if this answers your question, but I actually came to my private conclusion which is that it really is all about evolution. And what you find, whether you like it or not is that [...] you don't design software, you don't even know what it is the user wants. Most cases the user himself doesn't know what he wants [...] If you designing things and you don't know what you're designing for, the design simply cannot work [...] and it turns out that this is a problem that humanity has had forever"

In this video (around 0:36:00) :



Interactive linux kernel map.

Tuesday, March 02, 2010

Richard Stallman comparing proprietary software companies with colonial powers

Richard Stallman speaking at a conference on development. He compares proprietary software companies to the colonial powers of the past: Another feature you might remember from the colonial system was that the colonial power would recruit a local elite, a few local people who would - like maybe the nobles or whoever, or one tribe against another or they would create tribes if they weren't tribes (so they can massacre each other decades later) - and so the local elite, they would get certain privileges and in return they would help keep everybody else down. Well you can see that today, some proprietary software companies actively recruit local elites, they set up a software development centre in your country and the people who work there are part of the local elite or they do some favour either for politicians secretly or for the government openly. But it doesn't make any difference which one, either way they're buying influence in the government, converting that governement - from a sovereign state - into their local overseer, of their empire, who's job is to make sure everybody else becomes dependent on the same non-free software. They say the schools: "we will help you by giving you these gratis copies of our non-free software, so that you can turn your students into addicts of our software. Why do I use the term addicts? Because they develop a dependency, on this software. And then after they graduate, you can be sure they're not going to be offered these gratis copies any more. Because it's only the first dose that's gratis. Once you're addicted, then you're supposed to pay. And then, also of course the companies that these graduates work for,... those companies are not going to be offered gratis copies, so what essentially these companies - these software developers - are doing is: they're recruiting the schools into agents to lead people into permanent life-long dependency. These are things that the open-source movement usually doesn't talk about, that's why I don't support open-source. Open source is a way of promoting software that usually is free, but without mentioning these ideals. These are issues of freedom, they're left in the background, open source people usually talk only about practical values, you know, how do you get powerful convenient software and how much will it cost. Well free software probably allows you to save money too if you're not being forced to pay for permission to use it, you can probably save money. But I think that's a secondary issue, even in poor countries freedom is important. We should never start saying: "Oh they're so poor, freedom for them doesn't matter. All they need is some bread and circuses". Which they had here once upon a time. and then they shouldn't even think about being free. I think freedom is important in every country, in every society, whether its rich or poor. Nonetheless, people who support open-source often contribute to extending the free software community. Many of them develop free software, those are useful contributions. I'm not saying that what they do is bad, I'm saying that by itself it is not enough. Because it's weak, you see. When you say: "the goal is to have powerful, reliable, convenient software and get it cheap", then it becomes possible for the representatives of proprietary software to say: "well we claim that we'll deliver you more powerful reliable software, we claim that our total cost of ownership will be cheaper". And I think it's usually bullshit. When Microsoft says this, it's based on distorted facts, but it's weak, but when we say the goal is to live in freedom and to be allowed to cooperate with other people in a community, they can't say they're going to offer us more of that cheaper. Because they don't offer that at all, they're not even competing with us. They're out of the running! Once you decide you want to live in freedom, they're out of the running. So we are trying to help you reach freedom, in a community, they are trying to subjugate you, but they say that they'll get you there faster! And maybe they would.



Monday, March 01, 2010

Wikibook linuxguide

Linuxguide: "The easiest way to begin using a Linux system may be to use an already running system. For example, some systems may be available in various educational or work environments. In this case you only need to contact the appropriate administrator and obtain a user ID and password. You will only be able to explore the system to a certain extent, but the first steps can be taken without having go through the installation process. Another trouble-free way of obtaining a Linux system is to buy a computer with Linux pre-installed. The number of vendors selling such systems is constantly increasing."

Wednesday, February 24, 2010

Totem python console

Today I learned that you can script Totem Movie Player 2.28.2 with the python language. There is even a python console included as a plugin to Totem.

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

Much like you can link from a table of content in word to the corresponding title in the document, I wanted to link an Excel cell to another cell inside the document (for example to the cell A5). The problem is that if a new cell is inserted above the destination cell (changing it from A5 to A6 for example), the original link doesn't change the destination cell's number (it stays to A5).

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

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

 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

Tuesday, February 16, 2010

Singularity - the opinion of Peter Norving

Interview of Peter Norving: "Do you agree with Kurzweil's forecast regarding the singularity?"
"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

This company is selling a home server. For what it's worth! ;-)
They are based in Anger, how bizarre! And their website is in French and German.

Microsoft's open source license

Microsoft's open source license for Non-Commercial Academic Use Only: "You may create derivative works of the Software source code and distribute the modified Software solely for non-commercial academic purposes, as provided herein.. If you distribute the Software or any derivative works of the Software, you will distribute them under the same terms and conditions as in this license, and you will not grant other rights to the Software or derivative works that are different from those provided by this MSR-LA. Your license rights to the Software (or any Microsoft intellectual property associated therewith) does not include any license, right, power or authority to subject the Software or derivative works thereof in whole or in part to the terms of any license that requires as a condition of use, modification and/or distribution of software subject to such license that the software or other software combined and/or distributed with such software be (A) disclosed or distributed in source code form; (B) licensed for the purpose of making derivative works; or (C) redistributable at no charge."
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

"In Greek mythology Python, serpent, was the earth-dragon of Delphi, always represented in Greek sculpture and vase-paintings as a serpent. She[1] presided at the Delphic oracle, which existed in the cult center for her mother, Gaia, Earth, Pytho being the place name that was substituted for the earlier Krisa.[2] Hellenes considered the site to be the center of the earth, represented by a stone, the omphalos or navel, which Python guarded."

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, January 28, 2010

US department of defence advocates Open Source

US Department of Defence: "To effectively achieve its missions, the Department of Defense must develop and update its software-based capabilities faster than ever, to anticipate new threats and respond to continuously changing requirements. The use of Open Source Software (OSS) can provide advantages in this regard." (pdf on the website of David A. Wheeler)

Basic web server on a microcontroler

Web Xweb32 Lite is a web server that runs on a microcontroler ATMEGA32. With that you can visualise variables within a webbrowser. This is even smaller than any barebone computer.

A PC in the keyboard

A PC that fits in the keyboard for 99 EUR with linux: Northteck Gecko Surboard (article on Linux Devices.com)
Xcore is the manufacturer.

Géolocalisation par wifi

Le service de géolocalisation est assuré par la technologie Wi-Fi Positioning System (WPS). Grâce au Wi-Fi intégré, les cartes Eye-Fi détectent les réseaux Wi-Fi environnants pendant que vous prenez des photos. Une fois que les photos ont été transférées, le service Eye-Fi leur associe des données géographiques.

Wednesday, January 27, 2010

Connect to a SQLite database using python

SQLite is included since python 2.5 I connected to a SQLite database created from zotero that way:

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.