DeutschEnglish

Submenu

 - - - By CrazyStat - - -

29. February 2012

Windows: Mount VHD-file (virtual hard disk) via Right-Click

Filed under: Windows — Tags: , , , , , , — Christopher Kramer @ 12:18

You might know .vhd-files from Virtual PC or Windows Backup. In case you need to access a file from such a virtual hard drive, you can easily mount it in Windows.

It is possible via drive manager, but today I found a solution that is even a lot easier: Just right click a vhd-file and select to mount the file via “send to”.

Here is the tutorial including the necessary batch scripts:

How-To Geek: Mount and Unmount a VHD File in Windows Explorer via a Right-Click

Works great on Windows 7 – not tested any other version.

Recommendation

Try my Open Source PHP visitor analytics script CrazyStat.

19. February 2012

CrazyStat 1.71 will be available in Russian

Filed under: CrazyStat — Tags: , , , — Christopher Kramer @ 22:49

Good news: The upcoming CrazyStat version 1.71 will come with a Russian language file.

Thanks a lot to Vladimir for the translation!

He did not only translate CrazyStat (and gave a lot of other feedback – thanks for that as well) but also offered to support Russian users via email. I will offer a mailform at the time CrazyStat 1.71 is released for that. Vladimir also proposed that I should open a forum to improve support and discussion around CrazyStat. I think this is a brilliant idea and I will definitely realize this along with the other ideas to make CrazyStat more open.

Russian is the first language that really benefits from UTF-8 and the Russian language file showed some minor problems in CrazyStat with UTF-8 that will also be fixed in 1.71. Other languages like Chinese will hopefully benefit from this as well one day.

CrazyStat 1.71 is into testing now and will hopefully be released soon. I already blogged that it will also be available in Danish and the other changes.

Translations of CrazyStat are always very welcome. If you speak some language that CrazyStat does not speak already, I would be very happy if you could translate CrazyStat. It is really not much work and I will help you if you have any problems. Languages like Chinese, Spanish, Italian, Japanese, Hindi, Arabic and French are still missing, just to name a few. If you speak any of these languages or some other language, please contact me and help to spread CrazyStat.

17. February 2012

Subversion (SVN): Permanently remove files from repository (history)

Filed under: Linux,Server Administration — Tags: , , , , , , — Christopher Kramer @ 20:02

As I am about to make CrazyStat’s subversion repository public, I checked whether there is anything in there that is not suitable to be made public. I stumbled upon some logfiles which I had once used for testing and accidentally commited to the repo. These logfiles contained private data and therefore, I needed to remove them from the history before making the repository public.

And that is how it can be done:

As SVN has no ‘obliterate’ command yet (see feature request here), you need to perform the following steps:

  1. Make sure nobody else uses the repo at the time
  2. Dump your repository to a dumpfile
  3. Filter the dumpfile (remove the files you do not want to be in there anymore)
  4. Create a new repository
  5. Import the dumpfile in the new repository
  6. Replace the old with the new repository
  7. Check it
  8. Clean up

These steps in detail:

Step 1: Make sure nobody else uses the repo at the time

I think the easiest way would be to remove write-permissions from the repository-folder. E.g. if you access your svn through apache, just chown it from www-data to root and nobody should be able to write anymore:

chown -R root:root /var/svn/REPOSITORY

Step 2: Dump your repository to a dumpfile

svnadmin dump /var/svn/REPOSITORY > dumpfile

Step 3: Filter the dumpfile

svndumpfilter exclude /path/of/file/to/remove < dumpfile > newdumpfile

This will remove the file “/path/of/file/to/remove”. You can remove multiple files at a time like this:

svndumpfilter exclude file1 file2 < dumpfile > newdumpfile

I did not find any way to use wildcards, though. Let me know in case you find anything.

Update: Thanks to the comment by Florian! Here is the way to use wildcards:

svndumpfilter exclude –pattern "*.OLD" < dumpfile > newdumpfile

Florian also pointed us to a documentation of svndumpfilter which might be helpful for some of you.

Step 4: Create a new repository

svnadmin create /var/svn/REPOSITORY_NEW

Familiar, right? 😉

Step 5: Import the dumpfile in the new repository

svnadmin load /var/svn/REPOSITORY_NEW < newdumpfile

Step 6: Replace the old with the new repository

chown -R www-data:www-data /var/svn/REPOSITORY_NEW
mv /var/svn/REPOSITORY /var/svn/REPOSITORY_OLD
mv /var/svn/REPOSITORY_NEW /var/svn/REPOSITORY

In the first line I also changed the file owner and group to www-data to make the new repository accessible for apache. In case you do not use apache (e.g. svnserve), skip the line or change the file owner and group to your needs (see what the owner of the old repo was using “ls -l /var/svn” ).

Step 7: Check it

You update your working copy (shouldn’t change anything). But when you browse your history and want to see one of the files you removed, you will get an error that the file could not be found.
You might want to make a fresh checkout and a commit to see whether everything still works as expected…

Step 8: Clean up

In case everything went well, you can delete a couple of things:

rm -R dumpfile newdumpfile /var/svn/REPOSITORY_OLD

 

Deleting old revisions

I also found a useful blog post on how to delete old revisions and only keep new ones. Some users might prefer this option if it is not a single file they want to get rid of but complete old revisions.

 

By the way, the CrazyStat SVN repository will be publicly available soon…

Hope somebody finds anything of this useful.

15. February 2012

WordPress: Frontend and Backend in different Language

Filed under: Wordpress — Tags: , , , , , — Christopher Kramer @ 23:45

In case you want to use a different language for the wordpress frontend (your blog) and the backend (admin panel), here is a tip how it can be done.

Step 1: Set frontend language

Configure the language of WordPress for the language you want your frontend in. You do this in wp_config.php using the constant WPLANG:

define ('WPLANG', '');

This unsets the language, meaning the frontend will be English. This also works if you use a localized version of wordpress. If you want to set another language, do so:

define ('WPLANG', 'de_DE');

This would set the language to German. You need to have a corresponding .mo-file in wp-content/languages (in this example, wp-content/languages/de_DE.mo).

Step 2: Set the backend language

Step one will also affect the backend. If you want to have the backend in another language, there is a neat little plugin which changes the backend language for you, which I found on this forum.

<?php
/*
Plugin Name: Change backend language
Version: 0.5
Plugin URI: http://forum.wordpress-deutschland.org/konfiguration/32642-frontend-soll-englisch-sein-adminbereich-deutsch-engl-od-deut-download-nehmen.html
Description: Changes the backend language
Author: Oliver Schlöbe
Author URI: http://www.schloebe.de/
*/

function os_setAdminLang($locale) {
    if( WP_ADMIN === true ) {
        $locale = 'de_DE';
        return $locale;
    }
}

add_filter('locale', 'os_setAdminLang', 1, 1);
?>

This changes the backend language to German. In case you want another language, change ‘de_DE’ to the desired language in line 13. You need a corresponding .mo-file just like for the frontend.

Save this as something like wp-content/plugins/change_be_language.php

Then active the plugin in your backend and your backend will turn into the language you set.

Attention: Make sure there are no extra spaces in the plugin-file. Especially at the end, some editors tend to add spaces or line breaks. This will result in problems (headers cannot be sent etc.).

Hope someone finds this useful.

Update: Just found out, that the author wrote a blog post himself about this (English text at the bottom of the page)…

14. February 2012

Horde language selection does not work

Filed under: Linux,Server Administration — Tags: , , , , , , , , — Christopher Kramer @ 13:22

When selecting a language at login, Horde webmailer does not change the language?

Here is what I found out what helps:

On Debian, run the following command:

dpkg-reconfigure locales

Then select the correct languages. I had only selected the UTF8 languages for German, but Horde needs the following ones:

de_DE ISO-8859-1
de_DE@euro ISO-8859-15

If you have the problem with another language, select the corresponding language.

On Ubuntu, the chosen languages are stored here:

/var/lib/locales/supported.d/

I had a file named “de” in there where my chosen languages where listed and I added the ISO-versions above. You can find all supported languages here:

less /usr/share/i18n/SUPPORTED

On Ubuntu, after you included your languages, you have to run the following command:

dpkg-reconfigure locales

Afterwards, you need to restart apache:

apache2ctl -k graceful

That’s the smoothest way. In case it does not work, use one of those:

apache2ctl restart
service apache2 restart
/etc/init.d/apache2 restart

Now refresh Horde and everything should work.

Another problem is the following: if you chose a language in your Horde settings (login, Global Options, Locale and time, Select your preferred language), this overwrites the language you chose on login. So select “default” there to be able to chose language on login.

Hope this helps somebody.