Archive for the ‘English’ Category

Collect PGP keys of all your contacts from keyserver

Juli 19, 2013 2 Kommentare

If you like to start encrypting your Emails you need partners who are also willing to set up the PGP encryption. And then you need to exchange the public keys. For that it’s handy to upload the own public key to a key-server. If you use Thunderbird with Enigmail that’s pretty easy. Go to OpenPGP > Key Management, right klick on your own key and select Upload Keys to Keyserver. Everybody else can now query the server and get your public key.

Wouldn’t it be great to run automatically trough your address book and search for everybody who has uploaded his key to a key-server? That’s quite easy with Thunderbird and Linux:

  1. export your address book
    1. open the Thunderbird address book
    2. select the address book you like to export
    3. go to Tools->Export
    4. select „Comma Separated“ as format in the bottom right corner
    5. choose addresses.csv as name and save the file in a directory you like e.g. /tmp
  2. configure GPG
    1. open the file ~/.gnupg/gpg.conf with a text editor
    2. add this line to the file:
      of course you can use any other keyserver if you like
    3. save the file 🙂
  3. search for keys and import them
    1. open a console
    2. navigate to the directory you saved the file in e.g: cd /tmp
    3. run this command:
      for add in `cat addresses.csv | cut -d“,“ -f5 | grep @`; do gpg -i –search-keys  $add; done
      This command will go through the file addresses.csv line by line, get the 5th element out of it and search if the server has a key for this email.
    4. If a key was found you will be asked to select it and if you like to import it.
    5. After a restart of Thunderbird you should see the newly imported keys in: OpenPGP > Key Management


Kategorien:English Schlagwörter: , ,

How to make Email communication safe?

Juni 23, 2013 1 Kommentar

Emails are not private and not secure! Without special software you cannot verify if the Email is send by the Person it says it is. And your Emails can be read by a lot of people, e.g. Internet Provider, Government, Email Provider. PGP is used to encrypt and to sign Emails.

If you use Outlook get GPG4Win ( for securing your communication.

If you use Thunderbird use Enigmail (

In case you are just using your browser to read Emails check GetFireGPG ( WebPG ( it looks promising and works fine for my webmail.

Here are some more ideas how to insure privacy:


My public keys are availability on the key server:

The fingerprint for my work email address is: 9893 62D2 90F5 970E 4F96 DC08 A676 C738 D0EC 51DC

And for my private one: 9F61 054F AAD0 F32A 273F F7EC 456E 56C0 9223 2E3F

Please double-check the fingerprints if I’ve send you my public key by Email.


bidirectional syncing of MySQL tables with percona pt-table-sync

What need to be done:

For an current project in the organization I work (INF) I want try the bidirectional syncing of a MySQL database. We will run the same application in different offices. Between the servers we have a VPN connections. We don’t need live syncing – once a day should be enough.


The possibilities that I found for syncing are these:

MySQL own replication.
seems to be hard to implement and nobody recommends a master-master replication. But maybe its not recommended to have a read-write access to master-master replication with any solution. But that doesn’t matter – I need a solution.

SQLyog Job Agent (SJA)
from what is part of SQLyog Enterprise and SQLyog Ultimate
This is the solution suggested by the developer of our application
The Linux version should be free
I cannot find the download for Linux, maybe its included in the 30 days trial version.
And the bidirectional sync seems just to be two times a one-way-sync. So first we sync from serverA to serverB and then back.
So this doesn’t help us much. If somebody updates serverB but we syncing first from serverA to serverB, we will overwrite the change again.

pt-table-sync made by percona
the bidirectional syncing is marked as experimental but till now it seems to be the best way – so I will test it first.

user permissions

the sync user needs quite much permissions. I tried to give as less as possible and run several times into problems. pt-table-sync tells you every time it has not enough privileges. I will have to find out what are the minimal privileges are and then (maybe :-} ) update this post. Now I ended up with SUPER and REPLICATION CLIENT as global permissions and SELECT, INSERT, UPDATE, DELETE, REFERENCES, LOCK TABLES for the table I like to sync.

primary key conflict:

In the MySQL default configuration the AUTO_INCREMENT fields are just incremented by 1 if a new row is added to the table. If two servers add a row in a table where the primary key is set to AUTO_INCREMENT (what happens really very often), we would have a conflict that is not resolvable because we have the same PRIMARY KEY double.
So we set two variables in the MySQL configuration file (my.cnf)
auto-increment-increment = 100
auto-increment-offset = 1

auto-increment-increment is on every server set to 100 and auto-increment-offset is set different on every server (1,2,3 etc.)
So now new AUTO_INCREMENT values will incremented by 100 and every server has an own offset, so new rows will get on server1 the ids 101, 201, 301 and on server2 102, 202, 302


Our database structure has a timestamp column in every table, what is very useful so we can use the pt-table-sync options: „–conflict-column timestamp –conflict-comparison newest“ for conflicts.
So in case an item is updated on both servers, the one with the newest timestamp will win.
Just in the case there is a change on the same item, saved in the same seconds we would have an unresolvable conflict, but that is not very likely.
By default pt-table-sync just creates a warning when running in a unresolvable conflict but with the option „–conflict-error die“ it stops the execution in this case.

tables with combined primary keys:

The documentation says that one of the limitations of the bidirectional sync is:
* requires that the table(s) are chunkable with the Chunk algorithm
I didn’t understand that limitation first, but now I think it means that we need a single-column-primary-key. The one way syncing works fine with combined primary key tables, but for bidirectional syncing of tables with combined primary keys I got the message that „No plugin can sync <database.table>„.
This forum post gave me the tip.

We have some tables that have combined primary keys and we need to sync them too.
So I changed the PRIMARY KEY indexes to UNIQUE and add an „id“ column and made it PRIMARY KEY.
This should not affect the application.

not found changes:

In every table our database has a column called „deleted“. This column can be set to 0 or 1. When I changed this value pt-table-sync didn’t recognize the change. I think this must be because of the checksum function, by default it is CRC32. When I set it to MD5 it works fine ( –function MD5 ). SHA1 is probably even more save but also slower.

automatic script:

I’ve wrote a small perl script that has contains a list of tables that need to be sync and the timestamp column name. If the timestamp column names would be the same everywhere we maybe would not need the list – but I cannot change the database design. The list makes also sure that we update / insert data in the correct order, so we don’t run into foreign key problems.
So the script runs through the list of tables and sync them with pt-table-sync.
Conflicts (changes between two sync on different servers) will be recognized with the help of the „change_log“ table. In a conflict the later change wins but both parties gets an email with the information about the conflict.

The script collects some information and prints them. It’s designed to run as cron job and send the syncing information by email to the admin, that’s why the short information is in the head and the verbose at the bottom.
You can find the script here.

But don’t use it as an out-of-the-box solution. It changes your database, so use it just if you understand what it does! I don’t give any guaranty it works. It might destroy your database, server, office. So be careful!

Additionally the script uses unison to sync files on the filesystem

process of the sync:

  1. every server runs a MySQL backup locally at a specific time e.g. every day at 6.00PM
  2. a little bit later e.g. at 6:30PM the main server in the central office starts the sync script
    1. The sync script first sets his own and the remote software to „Maintenance Mode“ (a feature we have in our software, to prevent user to use it while the admin works :-] )
      For this matter I use the preExecutionSQLcommand in the script.
    2. then it runs trough every server the first time and syncs the database and the files
    3. after syncing every server once the script runs a second time to make sure every server gets also the changes from later sync servers.  If I sync server 1,2,3,4 the first time I need to sync 1,2,3 again to make sure the changes from 4 are everywhere.
    4. if the synchronization works the server disable the „Maintenance Mode“ again (postExecutionSQLcommand). If the synchronization fails the „Maintenance Mode“ will be still enabled, so the administrator would have the chance to fix the problem before somebody else have the chance to edit data and make the problem worse.
    5. the results are send by email to the administrators

simulate slow and bad connection:

I’m testing this solution between two virtual machines and for simulating bad and slow connection we can use the Linux „tc“ tool:

For bad or slow connections it might be helpful to increase the net_read_timeout and net_write_timeout settings of MySQL.

Kategorien:English Schlagwörter: , ,

Connect Joomla to SugarSync

Dezember 30, 2010 4 Kommentare

Some time ago I started to code an extension for Joomla to connect Joomla to dropbox. This extension is getting better and better.
But dropbox is not the only sync-service in the Web. Sugarsync is an other big player. Someone give me the idea to connect also SugarSync with Joomla. After some coding we now can inteact with Sugarsync in the same way we interact with Dropbox. With the extension you can:

  • publish files
  • view the pictures in a directory
  • and let users upload files to your account

Download the Extension here: Joomla Extension for Dropbox and Sugarsync
Sugarsync Support Forum

Kategorien:English Schlagwörter: , ,

Trusted Shops Customers Rating in Virtuemart / Joomla

August 20, 2010 1 Kommentar

I created a small modul for showing the cumtomers rating widget from in your Joomla / Virtuemart: Trustedshops Widget for Joomla

Just install the modul as usual in Joomla and then go to extensions->moduls and configure it there. You need to enable the modul and to enter your trustedshops id.

If you would like to have a rating button in the virtuemart confirmation emails first download one of the pics:

and put it on your server to /components/com_virtuemart/themes/default/images/

Now you have to edit the email-template. Open the file: /components/com_virtuemart/themes/<your actual theme>/templates/order_emails/confirmation_email.tpl.php

Search for the line:
echo $footer_html;

and put above it this code (replace the TSID with your own ID and if you use an outher pic, replace the pic-name):

$footer_html .= '<br /><br /><a  href="'.
urlencode(base64_encode($dbst->f('user_email'))) .'&shopOrderID='. urlencode(base64_encode($order_id)).'"
target="_blank" title="Shop-Rating"><img style="border:0 none;" src="" alt="Rate our shop!"/></a>';

Kategorien:English Schlagwörter: , ,

Sexy Bookmarks as a Joomla Modul

Sexy Bookmarks is a very nice Social Bookmark Plugin for Joomla.
But Its just a Plugin and not a Modul. But You can run it a a Modul with „Plugin in Modul„. After installing the modul as usual you have to configure it: Type of Plugin: {plugin CODE} Plugin to execute: sexybookmark

Depending on where you like to show the Sexy Bookmarks you have also to configure the Sexy Bookmark Plugin. I prefer to show the Bookmarks Links on every site at the bottom so I configured it like this:

Display Sexy Bookmarks on Frontpage => No
Display Sexy Bookmarks on article pages => No
Display Sexy Bookmarks on blog layout pages=>No
Display only if manually defined=>Yes

Now there is just a little mistake, there are no titles in the links:
For fixing this we have to change one line in the PHP file of  „Sexy Bookmarks“. The file you need is: plugins/content/sexybookmarks.php
Here we need the line: $title = urlencode($article->title); For me its the No. 182. This line we have to replace by two other:
$doc =& JFactory::getDocument();
$title = urlencode($doc->getTitle());

After this little change the page title should be linked:

Kategorien:English Schlagwörter: , , ,
%d Bloggern gefällt das: