Crappy legal java code

JavaThat was hard evening.

After reading some java books, right before I went to sleep, some java code came to my mind…


class ${public void _($ $4){}}
class $<_, $, $_> {$ _;<_> $($ _){}<$> $($ _,$ $_){_=$_;}}

And that’s not the upper bound. You can enchant it the way you want, creating crazy valid useless (or even useful?) POJOs :D

Ecology. Екологія.

Люксембург

Люксембург

Кілька тижнів тому я повернувся з волонтерського табору. Сила-силенна вражень, море спогадів та безцінний заряд енергії. На жаль, табір, як і все хороше, пролетів з блискавичною швидкістю. Кількість позитивних флюїдів, що заполонили моє тіло, незрівнянно велика. Та у європейських подорожей є один неявний мінус. Після повернення починаєш порівнювати. У порівнянні відкриваєш для себе свій рідний, до крихти знайомий, український світ по-новому.
Continue reading ‘Ecology. Екологія.’

wait() and notify()

Thread Synchronization

Excerpt from old “Exploring Java” book.
It clearly states, what wait(), notify(), notifyAll() are used for and what they do.

With the synchronized keyword, we can serialize the execution of complete methods and blocks of code. The wait() and notify() methods of the Object class extend this capability. Every object in Java is a subclass of Object, so every object inherits these methods. By using wait() and notify(), a thread can give up its hold on a lock at an arbitrary point, and then wait for another thread to give it back before continuing. All of the coordinated activity still happens inside of synchronized blocks, and still only one thread is executing at a given time.
Continue reading ‘wait() and notify()’

Rutorrent + rTorrent on Debian Server

ruTorrent logoOnce, I’ve installed it myself.
Yes, in the way, everyone did this: checkout, compile with xml-rpc support, install web-server, bind everything together and enable some security.
It worked great, but after some updates, it broke up. Don’t know what happened exactly, I was a bit busy at that time.

Several weeks ago, I desperately needed torrent client, but in that environment, no applications could be installed. It was a great disappointment to find out, that me own rTorrent is down on the server. So I tried to perform mentioned actions again, but with no luck.

Right at that moment, I found out about an AWESOME!!! script, which does everything you need! It just installs

  • rTorrent
  • ruTorrent
  • your favourite web-server
  • FTP
  • Webmin

It binds everything together, and it just works!

Here’s the MAGIC link to the documentation:
http://forums.rutorrent.org/index.php?topic=608.msg4427
Everything is pretty strait-forward and troubleless.

Hint: run the downloaded script inside screen session. Script, itself, runs several minutes. It configures and compiles everything. So, please, be patient. If you have poor ssh access, it would be much better to reattach to the running screen process, after connection failure or something.

The only thing, I had to modify afterwards, was a web-server’s port, ’cause my ISP blocks port #80.
As I’ve chosen lighttpd, as my webser, I had to modify lighttpd config file
nano /usr/share/lighttpd/lighttpd.conf
and set
server.port = 1234

Apocalipse v0.1-prealpha. changelog

As you know, today is the first apocalypse.
I hope, it’s not the last one :)
Generally, all the info’s got from twitter, as a great news tool, & real life.
I’ll try to keep this list updated with the latest facts :)

  1. My electrical socket burst with flare in the morning. Probably caused by an electrical overload. That looked pretty osum for the first 0.2 sec. Hostel is old, and it’s electrical wires can’t handle current student’s neds.
  2. Moscow people vandalized flower bed in 5 minus
  3. Belorussian dollar situation caused one manager to hang himself in the office.
  4. My ISP, UarNet, suffered some cable problems. So for about an hour everyone was faced with “Warning! Emergency recovery measures are kept! Internet will be back soon!

…updates in progress :)

Enable Nimbus Look-And-Feel

Always forget how to enable it.
So put it in my blog to reference that quickly.

        try {
            for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (UnsupportedLookAndFeelException e) {
        } catch (ClassNotFoundException e) {
        } catch (InstantiationException e) {
        } catch (IllegalAccessException e) {
        }

Nimbus is really a nice and must-use vector look-and-feel.
Just compare it to the old metal:

Here you can get more information about Nimbus Look-And-Feel
http://download.oracle.com/javase/6/docs/technotes/guides/jweb/otherFeatures/nimbus_laf.html

Луцьк – Львів – Луцьк

Часто мені задають питання, як найкраще добратись з Луцька до Львова чи навпаки. Вирішив написати пост, бо переписувати це щоразу мені набридло.

Луцьк – Львів

Поїзди

  1. кажуть в коментах, шо відмінили Електрон в 01-15 з Луцька, 07-40 в Львові. По студаку: ~5-6грн
  2. ходять слухи, що поїзд нерентабельний, і його відмінили Поїзд Ковель-Чернівці 18-20 з Луцька, 23-00 в Львові. Плацкарт по студаку: ~10-11грн

Маршрутки

Всі вони їздять орієнтовно 3год 30хв.
Всі їдуть на Стрийську автостанцію.
Коштують приблизно ~43 грн. Якшо без квитка – 40грн.
вересень, 2011: квиток: 49-53, водій: 45-50.
січень, 2012: квиток: 58-62, водій: ~50.
Відправляються орієнтовно кожні 30-40хв з автостанції, від ранку і аж до 18-00.
Діляться на 2 види:

  1. через центр
  2. по об’їздній

Я люблю їздити через центр, бо звідти легше будь-куди потім добратись. На жаль, такі маршрутки їздять здебільшого зранку.

Перевірені і улюблені:

  1. 06-00 через центр
  2. 06-25 через центр
  3. 17-35 по об’їздній
  4. 18-00 по об’їздній

Є один поганий автобус: 09-10. Луцьк-Ужгород. Їде більше 4-ох годин. Висновки самі робіть :)

Львів – Луцьк

Поїзди

  1. Електрон в 12-00 з Львова, 18-00 в Луцьку. По студаку: ~5-6грн
  2. Електрон в 18-00 з Львова, 00-00 в Луцьку. По студаку: ~5-6грн
  3. Поїзд Чернівці-Ковель 22-37 з Львова, 03-00 в Луцьку. Плацкарт по студаку: ~10-11грн

Маршрутки

Якщо їхати зранку, то краще виїжджати з другої автостанції. Вона знаходиться на півночі Львова, тому з неї їхати завжди швидше.
Всі інші маршрутки відправляються з Стрийської автостанції. Від самого ранку і до пізньої ніченьки.
Коштують приблизно >50 грн. Якшо без квитка – 40-45грн.
вересень, 2011: квиток: 52-55, водій: 45-50.
січень, 2011: квиток: 60-65, водій: ~50.
Чому з Львова до Луцька дорожче – не знаю. Дорога, що в один бік, що в інший, як після бомбьожки.

Перевірені і улюблені:

  1. 17-55
  2. 20-10
  3. 21-45 (тільки в п’ятницю, суботу і неділю)
  4. 22-37 (колись був Автолюкс, зараз відмінили, бо дороги жахливі)

Інформація має властивість постійно змінюватись. Тому додаю контакти довідкових служб Вокзалу і Автостанції. Дзвоніть до тих пір, поки не піднімуть трубку :)

Контакти

Луцьк

  • Вокзал: Привокзальний майдан, 1 Тел: (0332) 79-72-98, 1505
  • Автостанція: вул. Конякіна, 39 Тел: (0332) 24-11-67, 1504

Львів

    • Вокзал: пл. Двірцева, 1 Тел: (032) 226-20-68, 226-15-95, 226-10-06, 226-52-76
    • Автостанція: вул.Стрийська,109 Тел: (032) 234-44-44, 242-45-05

http://bus.com.ua/cgi-bin/tablo.pl?as=460100

Якщо виникатимуть будь-які запитання – з радістю відповім :)
Щасливої дороги ;)

ALT+SHIFT

Recently I took part in an online Battle of the Brands http://thebattleofbrands.com/en

Both of the contestants are familiar to me since my childhood.

To cut the long story short, let me introduce this 2 awesome key combinations:

  • [ALT]+[SHIFT]
  • [CTRL]+[SHIFT]
As you probably guessed both of them are used to switch keyboard layout in PCs.
The heading of the topic yells my choice: [ALT]+[SHIFT]

I’ve been using CTRL+SHIFT barely for 7 years. Since I was introduced to the PC. I can recall in my memory, that second or third lesson during computer courses back in 2001 was how to set up your Windows 98 to use it smoothly. The first issue to fix in the standard Win98 installation was to change ALT+SHIFT into CTRL+SHIFT. I still can’t get it why it was done? CTRL+SHIFT was used everywhere. I can hardly find any reason for this choice nowadays.
Possibly, that’s because people use mouse a lot. This sound a bit unclear, but I’ll make a point.
What do people use to select seldom words in Word/Notepad? Yeap, a mouse! But there’s a better choice: CTRL+SHIFT+(left/right arrows). You don’t have to move your mouse around and precisely click it twice over the word. Moreover, what should you do to select 2 words in a row? double click is a waste of time here. It selects only one word per time.
How do people navigate through all the tabbed interfaces – browsers, preference windows? Again, with a mouse! Mouse is not a choice if you need to get the office job done quickly. Keyboard is much quicker. The main key combination to navigate through tabs is CTRL+TAB (forth ->) and CTRL+SHIFT+TAB (back <-). The second one intersects with our keyboard layout combination. So it was unfairly forgotten. This OS feature often is not used at all! Since I discovered it I forgot about mouse while browsing through tabs. It greatly sped up my navigating.
The crux of the matter is that barely nobody wants to use their keyboard efficiently. They dream of it, but do nothing to improve their keyboard skills. Keyboard has much to offer! So go and get over it!

 

Understanding BlackBerry EventLog

Recently, I’ve been digging deeply into BlackBerry EventLogs.

Every row in EventLog consists of several parts.

The first element is error-level (a,d,E,..) of this log entry.

The next one is application’s name (e.g. net.rim.udp, System…)

And finally here comes the message.I was interested in this tiny letters shown at the begining of every log event:

#BlackBerry Event Log (cpt)
#PVer: 5.1.0.177
#AVer: 5.0.0.938
a net.rim.ippp - RXCd 11 - 9/23 22:31:29
a net.rim.ippp - RXCd 32 - 9/23 22:30:27
W net.rim.ippp - RXnp - 9/23 22:30:15a net.rim.ippp - RXCd 11 - 9/23 22:30:15
d net.rim.ippp - TXSt 0 - 9/23 22:30:15
a net.rim.ippp - TXca - 9/23 22:30:15


Maybe, this knowledge will be usefull for someone.

Letter API name Description
a ALWAYS_LOG Always log event, regardless of severity.
d DEBUG_INFO Debug information level event.
E ERROR Error level event.
I INFORMATION Information level event.
S SEVERE_ERROR Severe level event.
W WARNING Warning level event.

кагбе тесттостпост

Якшо всьо гуд, і нічьо не заглючить, то привіт, тобі, 12те лютого 2011-го року з минулого :)

Цей тест-тост-пост направлений в будущє!

Нехай вам щастить, всі найближчі будуть здорові, і життя буде сповнене неочікуваних неймовірностей!
Щастя в любві і побільше різнобарвних вчинків :)

Чмоке, дарлінг ;)




Hosted by EOMY.NET