Archive

Author Archive

Star Wars floppy disk

February 10, 2011 Leave a comment

The Force is strong with this floppy:

I found this video in this post (follow this link for more videos).

Categories: fun Tags: , , ,

phpMyAdmin: No activity within 1440 seconds; please log in again

February 10, 2011 12 comments

Problem

phpMyAdmin’s “No activity within 1440 seconds; please log in again” message is slowly but definitely driving you crazy. How to remain sane?

Solution

Increase the time limit. Open the file /etc/phpmyadmin/config.inc.php and add the following line to its end:

$cfg['LoginCookieValidity'] = 60 * 60 * 8;  // in seconds (8 hours)

Here I set 8 hours, but you can change that.

When you log in again in phpMyAdmin, this new value will be taken into account.

Categories: php Tags: , , ,

Command line calculator with Python

February 10, 2011 3 comments

Problem

You use the command line terminal a lot and sometimes you need a simple calculator. Is one available in command line?

Solution

Of course. It’s called Python interpreter :) Python is usually available everywhere and its command line interpreter is a perfect calculator too.

Example:

C:~> python
Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 45 + 98
143
>>> _ + 7
150
>>> _ / 2.0
75.0
>>>

Cannot be any simpler. As you can see, the special variable ‘_‘ (underscore) gets the value of the previous computation. Division between two integers returns the whole part, thus 7 / 2 is 3. What you need is usually 7 / 2.0, which is 3.5.

You can quit with CTRL+D.

Tip

I use this calculator quite often, so I added the following line to my ~/.bashrc:

alias p='python'
Categories: bash, python Tags: ,

Learn GIMP with GIMPtricks

February 10, 2011 Leave a comment

Would you like to learn to use a powerful image editor? Do you find Photoshop too expensive and too complicated? Are you looking for a free alternative? Then you should learn GIMP! If you don’t know how to get started, visit GIMPtricks’s channel at YouTube.

GIMPtrick is a Dutch girl who can explain everything about GIMP in a very clear and understandable way. If you’ve never used GIMP, start with her beginner tutorials.

Categories: gimp Tags: , ,

HTML automatic redirect

February 9, 2011 2 comments

Problem

You have an HTML page and you want to redirect the user to a new page in X seconds, i.e. in X seconds you want to load another page.

Solution

<html>
<head>
<title>Title of the Page</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta HTTP-EQUIV="REFRESH" content="0; url=http://www.example.com">
<link rel="stylesheet" type="text/css" href="assets/style.css" />
</head>
<body>
...
</body>
</html>

What we need here is line 5:

<meta HTTP-EQUIV="REFRESH" content="0; url=http://www.example.com">

Meaning: you will be redirected immediately (in 0 seconds) to http://www.example.com. You can change 0 to X, which means that redirection will be done in X seconds (where X is a positive integer).

Credits

I found this tip here.

Categories: html Tags: ,

Getting started with the Haskell programming language

February 9, 2011 Leave a comment

Some quotes from Wikipedia:

Haskell is a standardized, general-purpose purely functional programming language…
The language continues to evolve rapidly, with the Glasgow Haskell Compiler (GHC) implementation representing the current de facto standard.
It is a purely functional language, which means that in general, functions in Haskell do not have side effects.
There is an active community around the language, and more than 2600 third-party open-source libraries and tools are available in the online package repository Hackage.

Installation

sudo apt-get install haskell-platform

Hello, World! (compiled)

Create the file hello.hs:

main = putStrLn "Hello, World!"

Compile it:

ghc hello.hs -o hello

Run it with ./hello.

Hello, World! (interpreted)

#!/usr/bin/runghc

main = putStrLn "Hello, World!"

Then “chmod u+x hello.hs” and “./hello.hs“.

Tutorials

There are tons of tutorials on the Web.

Links

How good are you in Vim?

February 9, 2011 Leave a comment

If you think you are a Vim power-user and there is nothing new to learn, check out VimGolf. On this site you will find various challenges, and by submitting your own solution, you can earn scores. The goal is to improve your knowledge about Vim. If you are really good, you may get on the leaderboard.

I looked at some solutions and they look like a Perl nightmare :) Even if you don’t want to dive in, you can have a look at the “Resources for learning Vim“. I copy them here too:

(Thanks Fred for the link).

Categories: vim Tags: