I have had some problem with Pidgins “Waiting for network connection” (on my Linux-machine). Apparently the problem involved Gnomes NetworkManager. After a lot of searching I found an easy solution that worked for me. I use the -f option when starting Pidgin which tells it to ignore NetworkManager. You can add it in your Shortcut/Launcher if you don’t want to use commandline. If it doesnt work you might found a solution here.
If you are a Windows user I guess that the problem could be related to your networkconnection somehow.
Tags: chat, im client, pidgin
Posted August 24th, 2010 by Mattias Wirf in Other software
No Comments »
Today I needed a fix for pgAdmin on Ubuntu 10.04 Lucis Lynx, which is my workstation (pgAdmin is a graphical ui for PostgreSQL database). To my dispair it just closed down when I tried to start it. Luckily I found a solution in this bugreport. I compiled my own and could continue to work.
This is what I did (note: I don’t garuantee it will work for you, I am not a software developer).
apt-get source pgadmin3
sudo apt-get install debhelper libpq-dev libwxgtk2.8-dev libxml2-dev libxslt1-dev autotools-dev devscripts
cd pgadmin3-1.10.2
dpkg-buildpackage
sudo dpkg -i ../pgadmin3_1.10.2-1_i386.deb
Tags: database, gui, postgresql
Posted August 12th, 2010 by Mattias Wirf in Linux, pgAdmin
No Comments »
Today I made an easy upgrade to WordPress 3.0.1, automatic and thanks to my great webhost (swedish webhost Binero.se) I can get around the FTP-account form in WordPress. I just set some constants for method and permissions in wp-config.php:
1
2
3
| define( 'FS_METHOD', 'direct' );
define( 'FS_CHMOD_DIR', 0755 );
define( 'FS_CHMOD_FILE', 0644 ); |
How easy this made my life, since I tend to lot of Worpress blogs. If you want to learn some great configuration tips for your wordpressblog check out this article on digwp, theres a lot to do then just easy updates.
Tags: php, wp, wp-config.php
Posted July 30th, 2010 by Mattias Wirf in Wordpress
No Comments »
The WordPress Random Post Box plugin is updated to work in WordPress 3.0. You can download the new version 1.0.3 from the plugin directory.
The problem and solution
It was a simple fix but hard to find. As mentioned by Fabian Anderwald (thanks Fabian) files not loaded within wordpress framework now needs to include the file wp-load.php instead of wp-blog-header.php, a change in WordPress that might be a problem for all integrating WordPress in other applications. This also affected my ajax-call in Random Post Box plugin. So, if you are a developer and run in to the same proble change this:
1
| require('./wp-blog-header.php'); |
To this:
1
| require('./wp-load.php'); |
There was also a warning generated from an array, a bug which also had an easy fix.
The original post about the plugin »
Tags: ajax, jquery, php, wordpress-plugin, wp
Posted July 28th, 2010 by Mattias Wirf in PHP, Plugin, Wordpress
No Comments »
Today I really needed to find and replace in many files at once, and found this great feature to exists in Quanta. I have actually not seen it before. The menuitem says “Edit“->”Find in files” so one might think it doesn’t replace. But it does :) It’s a part of KWebDev that is named KFileReplace, and is also included in Quanta. A function that saved my day.

KFileReplace in Quanta
Tags: find, kwebdev, quanta, replace
Posted July 17th, 2010 by Mattias Wirf in Functions, Quanta
No Comments »
A PHP problem that tends to sneak by is the handling of strtolower and encoding. For a while now I have worked on a project that is partially on a Windows-server, with limited control for us. Sometimes there is trouble when you make comparison of textstrings and want to use strtolower. Since “Mattias” and “mattias” is not the same thing you want to make both strings lowercse. But strtolower() don’t want to play with for example swedish chars "å,ä,ö" in UTF-8.
A solution to this problem can be to change the chars to something else, why not htmlentities(). You can for example to this to change the value to lowercase and get around encoding problem:
1
2
3
| $value = htmlentities($value, ENT_COMPAT, 'UTF-8');
$value = trim(strtolower($value));
$value = html_entity_decode($value, ENT_COMPAT, 'UTF-8'); |
Another solutions is to use mb_strtolower() if that function is available (which it isn't on the Windows server in question).
Tags: encoding, php, strtolower, windows
Posted July 10th, 2010 by Mattias Wirf in PHP
No Comments »
In my geek dreams are a world of UTF-8 (or UTF-16 maybe). Wouldn’t it be nice to have no more problems with encoding, weird question-marks and characters gone forever. No more problems where the database output sorts Ö before O (ö is the last letter in the Swedish alphabet). Forget ut8_encode and iconv. Such a great place the world could be…

Tags: encoding, translating, utf-8
Posted July 5th, 2010 by Mattias Wirf in Deep thoughts
No Comments »
The other day I was pulling my hair trying to enable rewrite in Ubuntus Apache2. Everything was installed via apt-get and I guess you get a bit spoiled when so much just works without the need to touch it ;) So when my .htaccess with rewrite had no effect I though I had syntax errors. Turns out it was this simple (in your terminal):
Tags: apache2, ubuntu
Posted June 30th, 2010 by Mattias Wirf in Linux, Server
No Comments »
Is your favorite application possible to translate? If the developers used the GNU gettext library, yes, with poEdit or similar editor. WordPress is an example.
To translate you do not have to be able to code, but of course you have to know the language well. So dont be afraid to try! :)
Step 1, the POT
This is a step which should already have been taken care of by the developer. poEdit scans the files in a catalog for translatable strings to create a file named .pot (Portable Object Template). If there is a .pot-file, use it to create a .po for your language.
Step 2, the PO
The .po-file (Portable Object) is the one you will work with, it contains the strings and values for the translation. The naming of files can be different between projects. For example, a common way to make a swedish translation: choose to open the POT and generate a .po-file, save as sv_SE.po for the swedish language.
Step 3, the MO
When you translate the strings you have the original text to the left, and the translation to the right. Mark the word you want to translate and fill in the form at the bottom. Each time the file is saved, a .mo (Machine Object) file is generated. It is this file the webbapplication will use.
The reason I write this post is to make people understand that to translate applications using this technique, you don’t have to know how to code. Does your favorite application miss translation for your language? If it supports gettext, all you need is poEdit and the .po(t)-file. What are you waiting for? ;)
Some more reading on this subject:
Tags: gnu, language, multilingual, translating
Posted February 18th, 2010 by Mattias Wirf in Editors, poEdit
3 Comments »
I have made the first submit to WordPress plugin database with my Random Post Box plugin. It’s nice to see that they are using Subversion, my favorite versioning-system :)
If you want to see an example of the plugin in use, check out below the first post on Retrocamera.net.
Tags: retrocamera, subversion, svn, woordpress-plugin
Posted February 13th, 2010 by Mattias Wirf in Plugin
No Comments »