N2N

The easiest VPN thingy I’ve ever seen: http://www.ntop.org/products/n2n/

n2n is a layer-two peer-to-peer virtual private network (VPN) which allows users to exploit features typical of P2P applications at network instead of application level. This means that users can gain native IP visibility (e.g. two PCs belonging to the same n2n network can ping each other) and be reachable with the same network IP address regardless of the network where they currently belong. In a nutshell, as OpenVPN moved SSL from application (e.g. used to implement the https protocol) to network protocol, n2n moves P2P from application to network level.

MailDir maintenance tips

Few tips on maintaining maildirs on the server:

To delete emails that are marked for deleting directly on the server:

find current_maildir_location/ -type f -name ‘*:2,*T*’ -mtime +7 -exec rm -f “‘{}'” ‘;’

This is helpful if users email client are sent to hide deleted messages and are not set to permanently delete them. Point is that maildir format has “T” flag in msg file name, which tells that msg is Trashed.

To archive old emails (something like 2 years old)

(cd current/ && find . -mtime +732 -print0) | rsync -ag –remove-source-files –files-from=- –from0 ./current_maildirs_location/ ./archive_maildirs_location/

The above will for recursively through all dirs in current_maildirs_location, find files older than 2 years and move them in archive_maildirs_location, preserving the directory structures.

Keep in mind that many mail clients do not handle large mailboxes well, so such tips can improve the speed for end-users, as well reduce storage requirements on the server (especially when talking about backups).

Wedding

So, it’s already one month since we got married. I was not in the position to post anything until some time passes in order calm down and rethink everything, so I believe that now it is the right time to share some thoughts and emotions.

First of all, I am happy like I don’t know what… I am happy in general and in every detail. Completely!

Second thing is that nothing really changed that much (as many people expect it to be). I was happy before I got married, I am happy now. We were living together before marriage for some time, so no surprise here as well. The biggest change that I might thing of is that now I have one more reason/excuse to use in tricky situations to tell someone to leave us alone, and probably, most of the people who might bother us with up to that extend already realized I have something to tell them and left us alone… (nothing personal here, just a matter of having more control over situations and less reasons for such things to come up).

Now a bit about the process of getting married.

I would emphasize on three major aspects during preparations to our marriage: bureaucracy,  politics, general arrangments.

Bureaucracy is something I really hate and don’t really understand. People complicated their lives too much. Sometimes one need to get a paper to certify another paper that is, in it’s turn, certifies yet another paper telling something simple and obvious. All this takes a lot of time, nerves, money, efforts and whatever else it might take to get it. In our case it was even more complicated due to the fact that 3 countries were involved with all their laws and traditions: Russia, Ukraine, Cyprus. And the problem here is conflicts. We had cases when one country demands a paper from another one, while the last does not provide that paper anymore. While Russian-Cyprus relations are pretty much OK, and all paper work here took one trip to Nicosia and 10 minutes + EURO 10 in Russian embassy, I can’t tell the same about Ukrainian-Cyprus cooperation. In particular, Cyprus government establishments a requesting a paper from Ukraine, that is not provided by the last since 2007 or so. We made quite a few trips to Nicosia and talked long with Ukrainian council trying to sort out the issue, but at the end, Yana had to travel to Ukraine to get the papers from the government, as well  as a letter from a lawyer, explaining all related changes in the Ukrainian laws, providing all the reasons why the papers demanded by Cyprus government could not be provided anymore, and which types of papers are similar and valid these days. This all really sucks. I know that laws are made to protect everyone and to avoid tricky situations, but sometimes I really think that it would be much easier to live without all this crap. Finally, it is very hard to plan anything as no one cane predict how long which paper will take to be issued and what else would be needed to support that paper.

Politics… Yet another thing I hate and consider as useless bullshit game people often get involved into. We had to plan a lot of things and we had to make sure that most of the people surrounding us will be satisfied. It is impossible to make everyone happy. So to the best effort make most of people satisfied is something we were looking at. On the other hand, we had our own expectations, wishes and so on, which we wanted to come true. The first thing I had to state to almost everyone: It is our wedding, we are having this great event in our life and we are inviting people who are close to us to share all these feelings with us. So as it is our event – we were to organize it the way we want, and this was a priority. If there were something not important to us, but what would make more people to feel better, of-course we would added to the list, but not more than that. Obviously there were many tries from all sides to add something more to the list, or change something, but we managed to do most of the things the way we saw them. On the other side we have changed something in the initial scenario as we realized that initial though would not just work. All over I think we managed to complete this task correctly and we heard a lot of positive feedback afterwards, while we, ourselves, were satisfied with the wedding as well.

Finally, when it came to general arrangements, I want to say that the first thing you do – count on yourself. Of-course, a lot of people want to help and they really do so (great thanks to everyone who helped us in all the ways with our wedding, really appreciated), but the point is that it is always better to count only on ourselves and if any help comes – that great, but if not – it is ok, as it was not planned. Do not think that someone will just take over something and do it from start to end, you need to control the process, have all the things in your mind or better somewhere in a written form. There are to many things that we just didn’t think of, and no one did for us as well, so we had to fix them as all was going on. Normally I never use written notes or plans myself, but this time, especially in the last days before the event, I had to write a lot of things and have someone be nearby to follow the list and remind me every 5 minutes about upcoming planned things. One more advice to anyone who might need it: it is good to have a general scenario about how things might go, but you should assume from the beginning that the end result will be different. Something will definitely go wrong and just in another way. If you expect something to go one way to much, you will end-up upset and messed up when it doesn’t go that one, while when you are pretty flexible, sometimes you enjoy the other way even more that you would think of. Try to stick to original plan, but make life bring alterations to that plan.

So that was about preparations. The event itself was very good and we liked everything a lot. We had quite a number of guests. Some of them were coming to Cyprus days before the event and staying for few days after which gave us even more good time and emotions. A lot of positive stuff, a lot of pictures on my flickr page, a lot of support from friends and relatives. It worth it all.

 

 

Samsung Galaxy Nexus, Sony Xperia, Android

Few weeks ago we decided to change our phones a get something new, nice, proper, expensive and exciting. I went to get my Samsung Galaxy Nexus while Yana decided to choose Sony Xperia S, so we can change our Samsung Galaxy Apollo and Nokia E71 accordingly. As this post is more about Nexus, I will refer to old phones in order to give better feedback from time to time.

First of all, both Nexus and Xperia are of the same high-end grade and approximately same price. Both have big screens, high resolution, lots of storage, dual core CPUs, and so on and so forth, but Nexus comes with Android 4.0!!! That is something really cool. As my Galaxy Apollo was supplied with Android 2.1 and then it was flushed to 2.2 (took a lot of manipulations to do that), I found a lot of new stuff and had to get used to new design of Android 4.0. After few days of playing around I realized that 4.0 is way better and more comfortable to use in many ways. On 2.2 I had to install a lot of different software to replace native ones, like Go Contacts, Go SMS, Go Keyboard and so on, while on 4.0 I like native applications much more.

What I really liked in my new phone is that it is getting system updates directly and updates seamlessly, without any needs to install some software on some Windows PC and do a lot of operations to make it work. It is already 4.0.4 version and runs well. I can’t tell the same about Xperia. Currently it runs Android 2.3.7, while Android 4.0 should come shortly (really waiting for this update, even more that Yana). I had to install System Update utility on a Windows (that I have dual boot on my laptop for games) to run few updates. That pisses me off. Software is getting stuck here and there, no proper logging or feedback and during update I was not sure what is going on and how it will be at the end.

Another good thing in Android 4.0 is how GMail, GTalk, Contacts and other things work. Whenever I am online – I receive updates instantly. For instance I normally notice my new emails faster on the phone than on my laptop. When I alter contact in GMail and check it on the phone strait away – it is already there (matter of 5 seconds). GTalk works perfectly (including voice/video calls). GMap now has cache for offline use and it caches 10miles around a given point, multiple points can be given, so in Cyprus (which is a small island) this is very handy.

One thing that I was confused is MTP for USB connections. This is something new and I don’t really know how to deal with it yet. Android 4.0 allowed be to put USB connections back to old PTP (Camera) mode, so I can mount my phone via USB as a storage device. On Xperia with Android 2.3.7 that was not an option. That caused problems getting photos/videos out of Yana’s phone on to hew laptop. I could see the files, but I couldn’t copy most of them, while I was receiving some unknown error. At the end, being familiar with Android development, I managed to download files by means of ADB (Android Debugger tool). Just use the following command to get the DCIM directory copied over to your laptop (assuming you have android-sdk installed, which contains adb binary):

adb pull /sdcard/DCIM ./

Hopefully, when Android 4.0 update will be rolled out for Xperia, we will have the option to put back PTP mode, otherwise I will have to find a better and easier way to copy over files without installing Windows based PC Companion software or anything of that kind.

Another thing that surprised me is that both of new phones do not have slots of memory cards. Nexus has 16GB and Xperia has 32GB flash cards built-in. This is on top of 1GB RAM and some more internal storage.

Xperia, being a bit newer model and more multimedia kind of phone has much better camera, better display (I was amazed with quality while watching demo movie on it), but on the other size, it has a lot of Sony software with unknown functionality and purpose. I had similar on my Apollo phone and I don’t appreciate the custom software and update logic on such phones. Sometimes vendors want to make things easier for users and they just over do it.

One more reason I am waiting Xperia’s update to Android 4.0 is that I want to see how NFC works. For those unfamiliar with the technology – it allows one to transfer content from mobile to mobile by putting both phones together and touching their back sides one another. Hardware wise – both Nexus and Xperia support the feature, but Android 2.x doesn’t, so I need to wait for 4.0 to test.

So overall I am pretty happy with the upgrade of our phones. Think that things will be even better as Xperia receives new version of Android.

Just few things that still use on Android 4, as I was on 2.x versions are:

– JuiceDefender: optimizes the battery, still applicable
– Go Launcher EX: replacement of standard Android launcher. More flexible. Put it on Xperia for Yana as well and she likes it more as well
– Go Calendar Widget and Go Switch Widget: also nice things to have on your mobile desktop
– Wifi Manger: handy thing, especially when used with it’s 4×1 widget to manage wifi connectivity
– Evernote: this is something I like to use on new phone more due to bigger size of the screen. Very handy
– All kinds of DropBox, Foursquare, GReader, FBReader and so on and so forth.
ImpreStyle Color: obviously run it on our devices as we are developing this lovely piece of software.

Finally I want to say Google and all other guys involved in the process of building Android platform, software and hardware great thanks for their job! It was a dream to have these things and now we have them.

Cutting Image Background with ImageMagick

Here is a small sequence of commands to cut the image of background (given that background is a solid color):

ORIG_IMAGE_NAME=green.jpg;
NEW_IMAGE_NAME=green-trans.png;
TMP_COLOR=`convert $ORIG_IMAGE_NAME -crop 1x1+0+0 txt:- | sed -n 's/.*\(#\S\+\).*/\1/p'`;
convert $ORIG_IMAGE_NAME -bordercolor $TMP_COLOR -border 1x1 -alpha set -channel RGBA -fuzz 30% -fill none -floodfill +0+0 $TMP_COLOR -shave 1x1 $NEW_IMAGE_NAME

Just change the first to vars. You can also adjust the fuzz percentage if needed.