Skip to main content

Climate change

Cold are the stars in the frigid dark skies
Distant and chilly and covered with ice
So far and frozen, so lonely and blue
There can’t be warmth in a place without you.

Sunlight would come down if you could be here
It would be warm any time of the year
Rays would be shining, so hot, bright and true.
Amun-Ra loves you and I love you too.

Sofia, 30.10.2011

Purlan

Пуловера на татко аз обичам
и често тайничко си го обличам
но дори да го измърлям
татко няма да се сърди,
мама го изпира със Пурлан!
Ще стана след години аз голям,
любимият пуловер ще е вече мой,
всеки ден ще го нося,
като нов ще е все още,
защото имаме Пурлан!

Бебока от рекламата вече е тийнейджър, а майка му едва ли пере с Пурлан, щото въпросният продукт май изчезна от пазара… но се присетих за това сладурско клипче и много ми е интересно дали някой може да ми помогне да намеря клипа или поне песничката… Обявявам награда от 5 евро 🙂

P.S. Дотук открих, че производителят е Rolco, агенцията, създала оригиналната песничка (на гръцки) е Take 2, а дистрибутор за България е БЕЙТ АД.

Currency conversion in Excel

I have an Excel workbook which calculates money amounts in multiple currencies, and I thought that it would be very nice to make it automatically get the newest exchange rates over the Internet.

I have always been using Google as my favorite currency conversion tool. You can try that yourself – for example, if you insert „100 GBP in USD“, it will show you the value of $100 in pounds sterling.

And so I was happy to learn that the XMLHTTP ActiveX control, which is very popular among web developers, can be accessed from Excel’s VBA macros too. That control is basically used to retrieve data from a HTTP server.

So it actually proved very simple to code an Excel macro that would connect to Google, get currency exchange rate data, parse it and put it in a cell.

Here’s the function that does the actual job:

Function GetCurrencyRate(Currency_1 As String, Currency_2 As String)
    Dim XMLhttp: Set XMLhttp = CreateObject("microsoft.xmlhttp")
    url$ = "http://www.google.com/search?q=1+" + Currency_1 + "+in+" + Currency_2

    XMLhttp.Open "GET", url$, False
    XMLhttp.send ""

    Result$ = XMLhttp.responsetext

    CBegin% = InStr(Result$, "<font size=+1><b>") + 17
    Result$ = Mid$(Result$, CBegin%)

    CBegin% = InStr(Result$, " = ") + 3
    Result$ = Mid$(Result$, CBegin%)

    GetCurrencyRate = Val(Result$)
End Function

As long as Google keeps the same page design, this function will work perfectly. Now any macro can call the currency exchange rate retrieval function and use the results. Here is the solution I chose for my case – an Auto_Open macro, which would automatically fire up when the workbook is opened, get the US Dollar / Euro exchange rate and put it in the F9 cell on Sheet 1:

Sub Auto_Open()
    R = GetCurrencyRate("USD", "EUR")
    Sheets("Sheet1").Range("F9").Formula = Str$(R)
End Sub

WordPress Cyrillic Permalinks transliteration plugin

Note: I first published this plugin 9 years ago. It is very simple, but I still use, update and support it.

If you have been using WordPress for a while, you are probably familiar with its great and flexible URL rewrite functions which let your posts use URLs that are friendly both to users and search engines. For example, I have configured my blog so that this entry can be accessed at http://petko.bossakov.eu/wordpress-cyrillic-slugs-plugin.

Unfortunately, this feature doesn’t work so smoothly with post titles in Cyrillic. They may confuse the code which generates the „Slugs“ included in the friendly URL, resulting in a bunch of meaningless characters, or – even worse – broken URLs.

I have coded a small WordPress plugin to take care of that. It automatically converts your Cyrillic post titles in phonetically equivalent Latin slugs.

Download here:
Cyrillic Permalinks 1.1 (UTF-8)

screenshot-1