Android and .NET - what does the future hold?
Recently Microsoft made a major move and decided to make .NET platform open source as well as compatible with Linux. I personally has always thought, that .NET is much better platform in the long run than Java. Unfortunately, until recently it lacked support on other platforms aside from Windows. However, after the announcement, things will change. I wonder, if among other developments, someone will be kind enough to port the Compact.NET to Android. This will be exceptionally handy, because then we could write code for both Android and Windows Phone using MS Visual Studio - clearly the best graphical development environment so far, despite all efforts by people from Eclipse, Apple, IntelliJ, you name it.
Essay writing spam comments
For the last couple of years I repeatedly see submissions of spam comments to my web site, which advertise “essay writing services” (read - cheating at course assignments for money) for students. I receive at least a couple a day, sometimes tens of them. This is despite having enabled CAPTCHA validation of comments submissions. The spammers’ software manages to circumvent this protection, albeit not always - most of the undesirable content is stopped. What really puzzles me, however, is the extremely poor wording of these spam messages. They are written in extremely broken English and it is hard sometimes to understand exactly what they are trying to say. And they don’t seem to evolve - the same templates are used time and time again. One would think, that when advertising a language-related service, even an illegal one, one should make an effort to describe it accurately and using correct grammar. And their incessant attempts to submit these comments? Not a single one has made it through to the actual Internet on my site, but their software keeps trying. Wouldn’t it be wiser and more time efficient to stop trying to publish after x failed attempts?
Sending Outlook appointments with Python
Python allows you to send calendar appointments (invitations / events) directly from your code. It is quite easy to create a new appointment in the standard iCalendar format (ics). You can do it by hand or use a convenient icalendar open source module. In order to convince Outlook, however, to present the iCalendar events as native calendar appointments, you will need to make some effort. Fortunately, other people have already collected all the necessary pieces. Below is a working example for sending Outlook-friendly invitation from Python. In principle, you could use some of the information here to send similar invitation using different API, for example .NET.
QT 5.1 and Android
You might have heard, that Trolltech has recently released a new version of their famous QT library with preliminary support for Android and iPhone (iOS) support. This is, actually, pretty exiting news, because it means that, at least in theory, one can have a single mobile application code base for two most popular smart phone platforms on today’s markets. And, possibly, for most desktop computers as well, because QT runs pretty well on Windows, Linux and Mac. Throw in support for QNX / BlackBerry 10, which QT also provides, and the prospects become almost irresistible.
boost::variant and lambda functions in C++11
Released some time ago new C++11 standard introduced lambda functions - long anticipated and exciting feature. On the other hand, boost::variant has been around for awhile and is used successfully in many projects. The recommended and type-safe way of applying type-specific logic to values of variant types is using visitor pattern. However, a visitor is a functor, which until now should have been defined separately, in a class of its own. It would be nice if we could use lambda functions to achieve the same functionality. Thanks to some clever folks on StackTrace, we can do exactly that:
Sample .vimrc file for software developers
Vim is a very powerful and convenient text editor for Unix environments. I certainly don’t wish to start any disputes along the lines of the old vim/emacs frontier, especially since I used both of them for long periods of time and find unique features in each. However in recent years I tend to use vim most of the time, mainly because it is quite lightweight. In order to benefit the most from the editor it needs to be configured to suit my specific requirements. Due to nature of my work, that is working as a consultant for different clients, I occasionally find myself recreating my ~/.vimrc configuration file at a new workstation or remote server. Since time spans between these activities are often quite considerable, I forget everything there is to know about the syntax and the inner quirks of this wonderful beast. So in order to save some precious time in the future, I’ll put a sample in my blog, thus helping myself and, hopefully, the public as well. Many of the settings are geared towards software developers.
Clever spammers
There is no doubt - spammers are becoming cleverer every day. I’ve added CAPTCHA verification to my site in order to prevent spam comments from being submitted. It really helped - previously I used to remove about 10-20 of them on daily basis, offering everything from child pornography to grey mortgages. However, even after the new safety measures have been introduced, I still get a couple of comments a week, which were created by spammers. Somehow they manage to break CAPTCHA. In addition, they texts are quite long, compared to the traditional “go-to-this-web-site-and-buy-stuff” ads. They seem vaguely related to the content of the actual article to which they are added. I suspect some graduate or Ph.D. student, involved in Artificial Intelligence (AI) studies, has written a program to both analyse the text and to bypass the filters. Well done, mister hacker.
Google calendar - download all entries with Python
Google provides APIs to access its data using various languages. You can manipulate Google calendars, contacts, documents etc. Most of the time the usage is pretty straightforward, but sometimes it is not clear how to achieve a specific goal. For example, it took me some time to figure out how to download all events for a given calendar. The main reason behind the difficulty is the upper limit Google places on the number of calendar entries returned by a single query. There are API calls, which help you to overcome this constraint. Below is the relevant code for your enjoyment. It is in Python, but it can be very easily ported into Java or C#.
Editing Markdown or txt files in OpenOffice
I have been introduced to Markdown format some time ago and today I find it extremely convenient for most of the writing I need to do. Markdown is essentially “markup without markup” - it requires you to do very little in order to format your text and it can be easily converted in a number of other formats, such as PDF, Word, ODT, LaTeX, HTML, Docbook etc. From experience I found that the most convenient environment to edit Markdown files is OpenOffice (or LibreOffice). Not only is it free and open source, it is actually quite convenient. You don’t need much to get started - just install the latest version of OpenOffice and open your .markdown document in it.
Right-align help menu in a WPF application
If you want to right-align the “Help” (or any other) menu entry in your menu bar in a WPF application, you can use the following example:
Code sample taken from here .