Archive

Archive for September, 2011

Don’t use Java in a nuclear facility

September 29, 2011 1 comment

From the license of Java, Section 3:

… You acknowledge that Licensed Software is not designed or intended for use in the design, construction, operation or maintenance of any nuclear facility. …

Found here.

Update (20130318)
It seems the original text has changed. The new version says: “You agree that neither the Software nor any direct product thereof will be exported, directly, or indirectly, in violation of these laws, or will be used for any purpose prohibited by these laws including, without limitation, nuclear, chemical, or biological weapons proliferation.

Hmm, I preferred the old one :(

Categories: fun, java Tags: ,

A little help for hyphenating words in LaTeX

September 28, 2011 Leave a comment

Problem
When working with LaTeX, sometimes I’m not sure if a word is correctly hyphenated by LaTeX so I’d like to verify that. As I’m not a native English speaker, it’d be nice to hear the correct pronunciation too.

Solution
I made a little script that addresses the two problems (available here). It’s part of my jabbapylib library. The script relies on dictionary.com.

apt-get: “the following packages have been kept back”

September 27, 2011 9 comments

Problem

You install something with apt-get and it keeps telling you that some “packages have been kept back”. Great! What to do with that?

Solution

After looking at this warning for years, today I got fed up and looked after it on Google. I found the solution here. If you have a package called X kept back, then try to install it with “sudo apt-get install X“. That’s all.

Categories: bash, ubuntu Tags:

Some beautiful conky setups

September 26, 2011 Leave a comment
Categories: ubuntu Tags:

Firefox 7 beta

September 24, 2011 1 comment

Yesterday I tried Firefox 7 beta. After one day of usage I can say that it works well. I could even install my favorite add-ons.

With FF6 I had some problems: from while to while it blocked for several seconds, the CPU was running on 100%, and then everything came back to normal. I tried to clean my ~/.mozilla folder but the problem remained. I think I could have solved it by removing ~/.mozilla completely but then I said to myself: “let’s try FF7 then”. So I closed FF6, renamed ~/.mozilla to ~/.mozilla6.bak and started FF7 that created a new ~/.mozilla folder. No more blockings :)

I’ve never liked the new tab button but there is an easy way to get rid of it. Right click next to it, from the popup choose Customize…, and then drag and drop the new tab button (probably it’ll be on the right side) to the list. Done. This tip is from here.

Powerpoint is dead (HTML5 presentations with landslide)

September 23, 2011 1 comment

Powerpoint is dead. Well, not yet, but for simple presentations you can use the following tool perfectly. This entry is based on Francisco Souza’s excellent post entitled “Creating HTML 5 slide presentations using landslide“. Here I make a short summary.


Landslide is a Python tool for converting marked-up texts to HTML5 slide presentations. The input text can be written in Markdown, reStructuredText, or Textile. A sample slideshow presenting landslide itself is here.

Sample input: 2.md (taken from the landslide project)
Sample output: presentation.html

Installation

sudo pip install landslide

Usage

landslide text.md

If you want to share it on the Internet: “landslide -cr text.md“.

Help: “landslide --help“.

To learn about the customization of the theme, refer to Francisco’s post.

Convert to PDF

landslide file.md -d out.pdf

For this you need Prince XML, which is free for non-commercial use. Unfortunately the output is black and white with additional blank pages for notes. If you know how to have colored PDFs without the extra pages, let me know.

It’d be interesting to replace Prince XML with wkhtmltopdf. I made some tests but the output was not nice. I think it could be tweaked though.

Related stuff

Pandoc is a universal document converter.

If you need to convert files from one markup format into another, pandoc is your swiss-army knife. Need to generate a man page from a markdown file? No problem. LaTeX to Docbook? Sure. HTML to MediaWiki? Yes, that too. Pandoc can read markdown and (subsets of) reStructuredText, textile, HTML, and LaTeX, and it can write plain text, markdown, reStructuredText, HTML, LaTeX, ConTeXt, PDF, RTF, DocBook XML, OpenDocument XML, ODT, GNU Texinfo, MediaWiki markup, textile, groff man pages, Emacs org-mode, EPUB ebooks, and S5 and Slidy HTML slide shows. PDF output (via LaTeX) is also supported with the included markdown2pdf wrapper script.

Zombie.js, PhantomJS

September 23, 2011 1 comment

This is not a real post, just a reminder for me. I should look at these projects in detail in the future.

Zombie.js is a fast, headless full-stack testing using Node.js. Zombie.js is a lightweight framework for testing client-side JavaScript code in a simulated environment. No browser required. Here is a Python driver for it called python-zombie.

PhantomJS is a headless WebKit with JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG. PhantomJS is an optimal solution for headless testing of web-based applications, site scraping, pages capture, SVG renderer, PDF converter and many other use cases.

Node.js

September 23, 2011 Leave a comment

I’ve heard a lot about node.js recently so I looked after it a bit. At the homepage of the project you can find a one-hour long video presentation of the project.

Node.js is a set of libraries on top of Google’s V8 Javascript engine, which is used in Chrome. V8 is a very high performance virtual machine. Node.js uses the greatness of V8 to do networking things. The focus is on doing networking correctly.

Examples

Hello World:

setTimeout(function() {
    console.log('world');
}, 2000)
console.log('hello');

It registers that the first function must be executed in 2 sec. and it goes on. It prints ‘hello’, then ‘world’ 2 sec. later. One very important thing: in node.js there is no blocking (like sleep()). The program exits when there is nothing else left to do.

Simple web server:

var http = require('http');

var s = http.createServer(function(req, res) {
    res.writeHead(200, {'content-type' : 'text/plain'});
    res.write("hello\n");

    setTimeout(function() {
        res.write("world\n");
        res.end();
    }, 2000)
});

s.listen(8000);

All these examples are from the introductory video. In the video there is also a TCP server. He also shows a simple chat server via TCP.

Installation
Under Ubuntu I already had a “node” command. According to “man node” it was something different so I removed it (sudo apt-get remove node).

Download the source from the HQ, extract it, then configure, make, sudo make install.

Start it with the command “node” and you get a prompt. Execute a script with “node file.js”.

Further reading

QR code (square barcode) maker / decoder

September 21, 2011 Leave a comment

Nowadays I see everywhere these stupid square barcodes. Today I looked after what the heck these are.

Update (20130805): here a QR generator, written in pure Python.

Categories: Uncategorized Tags: , ,
Follow

Get every new post delivered to your Inbox.

Join 71 other followers