Home

Advertisement

xrgtn of shadow [entries|archive|friends|userinfo]
xrgtn

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

disclaimer [Sep. 9th, 2020|01:45 pm]
In no event unless required by applicable law or agreed to in writing will I be liable to you for damages, including any general, special, incidental or consequential damages arising out of the reading and understanding of or inability to read and/or understand the texts on my pages.

P.S. All characters, punctuation signs, platforms, theories and programming languages appearing in this work are fictitious. Any resemblance to real persons, living or dead, is purely coincidental. %)
linkpost comment

Something about MOTO [Jun. 17th, 2009|11:50 pm]
[Tags|, ]

Переход с Нокии на Моторолу аналогичен переезду с Троещины на Печерск.

naFANia wrote on 17.11.2008, 23:24:
я его допер только на 5-м дне. Как купил - первый день он меня просто бесил, после н73. Теперь пусть идет в жопу н73, это же был не телефон а уебная куйня с ужастным скрипящим корпусом.

P.S. "Эмигрант увидел мир,
Овертайм давно прошёл" :)
linkpost comment

easy parsing of JSON file in Python [May. 24th, 2009|12:33 am]
[Tags|, ]

Yesterday a friend of mine told me that he had a problem trying to make iceweasel restore bookmarks from ~/.mozilla/firefox/xxxxxxxx.default/bookmarkbackups/bookmarks-YYYY-MM-DD.json file. I suggested writing simple JSON => XML converter script in either Perl or Python.

I did look into my own bookmarks-2009-05-14.json file and discovered that it contains one line with ASCII representation of very long dict/list structure, similar to Python's str() output.
First, I tried the most straighforward way:
>>> s = file("/tmp/bookmarks-2009-05-14.json", "r").readline()
>>> eval("x = %s" % s)
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 1
    x = {"title":"","id":1,"dateAdded":1234807466297438,"lastModified":124112686
5065336,"type":"text/x-moz-place-container","root":"placesRoot","children":[{"ti
tle":"Bookmarks Menu","id":2,"parent":1,"dateAdded":1234807466297884,"lastModifi
...
der=UNFILED_BOOKMARKS&expandQueries=0"}]}]}]}
      ^
SyntaxError: invalid syntax
>>> 

After that failure, I deciced to write full-fledged parser and even tried to find a decent Python parser generator. For this, I tried yapps2 first, but didn't like it and was forced to look for something better.

Next thing I tried was standard parser module. Surprisingly, it worked OK with the JSON after I declared JSON's null literal as eponymous variable in Python with value None, and replaced parser.expr() with parser.suite() (former is for expressins like a + 1 while latter accepts statements, e.g. x = a + 1):
>>> s = file("/tmp/bookmarks-2009-05-14.json", "r").readline()
>>> import parser
>>> ast = parser.suite("x = %s" % s)
>>> cod = ast.compile("foo.py")
>>> null = None
>>> eval(cod)
>>> from pprint import pprint
>>> pprint(x)
...
 'lastModified': 1241126865065336L,
 'root': 'placesRoot',
 'title': '',
 'type': 'text/x-moz-place-container'}
>>> 

Next thing to do is to generate XML. Probably, I'll do this tomorrow.
--to be continued--
linkpost comment

marlborough sauvignon blanc 2007: saint clair/vicar's choice vs. babich [Apr. 20th, 2009|10:52 pm]
[Tags|, ]

Given the very close proximity of blood^H^H^H^H^Htaste between the Cloudy Bay, Saint Clair (no matter whether the Vicar's Choice branded or not) and Babich, I regret to find after direct comparison just how far the distance between the latter two really is, and to declare the verdict:

1. the 2007th Babich "tasted like shit and it made me feel ill" (c) Art Brut

2. the Saint Clair is, well, a majestic wine... It's hard to find words that would match its beauty, indeed
link1 comment|post comment

C3PO [Feb. 3rd, 2009|12:07 am]
C3PO is probably tricarbon phosphorus monoxide, putting him among the C2O, CTO, CEO, CIO and other oxocarbons.
linkpost comment

gcc 4.3 vs linux kernel [Feb. 1st, 2009|03:56 pm]
[Tags|, , ]

Yesterday I had an extended chat with ManOwaR regarding apache2 crashes not leaving coredump files. During this I suggested that it would be helpful to see actual RLIMIT_CORE of a running process through /proc/<pid>/status entry.

I made a patch and tried to recompile my old 2.6.21-grsec kernel. This is what I've stumbled upon:
  LD      init/built-in.o
  LD      vmlinux
kernel/built-in.o: In function `getnstimeofday':
(.text+0x13500): undefined reference to `__umoddi3'
kernel/built-in.o: In function `getnstimeofday':
(.text+0x13521): undefined reference to `__udivdi3'
kernel/built-in.o: In function `do_gettimeofday':
(.text+0x13639): undefined reference to `__udivdi3'
kernel/built-in.o: In function `do_gettimeofday':
(.text+0x13656): undefined reference to `__umoddi3'
kernel/built-in.o: In function `do_timer':
(.text+0x141d0): undefined reference to `__umoddi3'
kernel/built-in.o: In function `do_timer':
(.text+0x141ee): undefined reference to `__udivdi3'
make[1]: *** [vmlinux] Error 1
make[1]: Leaving directory `/usr/src/linux-2.6.21-grsec'
make: *** [debian/stamp/build/kernel] Error 2
builder@m2n32:~/kbuild$ 


After WTF^H^H^Hgoogling for a short time I found that gcc-4.3 does not compile older kernels (who'd know?), and I need either to use gcc-4.2 or provide some build time options (-fno-tree-scev-cprop). Probably, they think that last option is supposed to be just plain obvious, isn't it?.
So please our beloved savannah goatlike creatures, when you release new version of gcc, don't forget to stick a big red hairy stinky disclaimer there: THIS BRAND NEW SHINY GCC WON'T COMPILE YOUT KERNEL, YOUR EXULT AND AROUND <insert your number here> OR SO OF OTHER UNIMPORTANT PROGRAMS. This would make me personally a much happier one, indeed. Something to do with "smoking damages your health" disclaimer on cigarettes, I think.

Update (20:53): I've managed to compile and test my patch for 2.6.21-grsec:
xrgtn-q40:~# grep RLIMIT /proc/1/status
RLIMIT_CPU:     -1
RLIMIT_FSIZE:   -1
RLIMIT_DATA:    -1
RLIMIT_STACK:   8388608
RLIMIT_CORE:    0
RLIMIT_NPROC:   10164
RLIMIT_NOFILE:  1024
RLIMIT_MEMLOCK: 32768
RLIMIT_AS:      -1
RLIMIT_LOCKS:   -1
RLIMIT_MSGQUEUE:        819200
RLIMIT_NICE:    0
RLIMIT_RTPRIO:  0
link1 comment|post comment

buzz of the month: uptime [Jan. 26th, 2009|11:42 pm]
[Tags|]

Sony warns of first operating loss in 14 years
Samsung posts first-ever quarterly loss
Philips admits first loss in six years
Resume: Samsung scores the highest uptime among them all, given that it was founded in 1938.
P.S. about restart: sometimes it doesn't help %)
linkpost comment

Barton & Guestier Bordeaux Rouge 2006 vs Sunrise Cabernet Sauvignon 2007 [Jan. 20th, 2009|12:09 am]
[Tags|, ]

Resume: the Barton & Guestier's Bordeaux was the shittiest Bordeaux I ever tasted. I don't think it deserves the right to be called Bordeaux AOC at all. The Concha y Toro's wine is definitely several orders of magnitude better than B&G's. Also, I bought it twice cheaper: 48 UAH for Cabernet Sauvignon vs. 108 UAH for the Bordeaux.
linkpost comment

first F-16's victory [Jan. 18th, 2009|09:43 pm]
[Tags|]

http://en.wikipedia.org/wiki/F-16#First_combat_successes:__Bekaa_Valley_and_Osiraq_raid_.281981.29

The F-16’s first air-to-air combat success was achieved by the Israeli Air Force (IAF) over the Bekaa Valley on 28 April 1981 against a Syrian Mi-8 helicopter, which was downed with cannon fire following an unsuccessful attempt with an AIM-9 Sidewinder air-to-air missile (AAM).

Да, это из серии "первая победа M1A1 Abrams: после неудавшейся попытки застрелить Запорожец, танк переехал его гусеницами"... :)
linkpost comment

(no subject) [Jan. 17th, 2009|06:50 pm]
[Tags|, , ]

Last night, I tried to install FreeDOS and Ultima 7 BG&SI in QEMU. I tried different settings, with XMS and EMS, with XMS and UMB (no EMS), with XMS only etc. With EMS you cannot run ULTIMA7 at all. With/without XMS this varies. Actually, I managed to successfully start ULTIMA7 once, but could not repeat this success later however hard I tried - the game binary always complained about insufficient conventional memory. Looks like the ULTIMA7 is incompatible with both HIMEM and FDXMS (and FDXXMS) of FreeDOS. I tried even HIMEMX from http://www.japheth.de/, with the same outcome...

First I run install.bat:



as it complains about memory, I check the stats with mem /c:



then, to ensure that everything did go really wrong:



S^HUnsurprisingly, in MS-DOS (I did manage to sustain a couple of short-but-acute-vintage-flavour-PITA attacks while trying to setup a bootable MS-DOS image in QEMU :)) everything went OK (partially because I already had matching pair of config.sys and autoexec.bat files with necessary configuration to run U7, StarCon2, Betrayal at Krondor and UFO among other titles):



the real Slim Shady please stand up:



Eyes pop, skin explodes, everybody dead:

link2 comments|post comment

MTS UA vs. odnoklassniki RU [Dec. 20th, 2008|12:42 pm]
[Tags|, ]

MTS Connect в субботу в очередной раз порадовал подземным стуком. apt-get update тоскливо долго устанавливал connect к каждому очередному source, более половины web сайтов страшно тормозили, у жены не открывался odnoklassniki.ru. То есть не открывался вообще. Пришлось ноутом выйти через life:) GPRS, убедиться, что там всё ОК, поднять bnep канал к компьютеру жены, и втоптать (через OSPF) следующие маршруты для одноклассников (JFYI):
xrgtn-q40:~# route add -net 195.222.187.00/24 gw 192.168.100.101
xrgtn-q40:~# route add -net 212.119.208.00/24 gw 192.168.100.101
xrgtn-q40:~# route add -net 195.239.7.0/24 gw 192.168.100.101
xrgtn-q40:~# route add -net 195.222.166.0/24 gw 192.168.100.101
xrgtn-q40:~# route add -net 212.119.216.0/24 gw 192.168.100.101
xrgtn-q40:~# route add -net 81.176.227.0/24 gw 192.168.100.101
xrgtn-q40:~# route add -net 81.177.141.0/24 gw 192.168.100.101
xrgtn-q40:~# route add -net 81.177.140.0/24 gw 192.168.100.101

Да, gateway адрес 192.168.100.101 - это всего-навсего p-t-p адрес лайфовского PPP:
xrgtn-q40:~# ifconfig ppp0
ppp0      Link encap:Point-to-Point Protocol  
          inet addr:...  P-t-P:192.168.100.101  Mask:255.255.255.255
linkpost comment

The linux, the MOTO and the chinese [Dec. 14th, 2008|06:56 pm]
[Tags|, , ]

Status: informational

There are several Motorola linux phones capable of running mplayer: MOTO MING* (A1200, A1200e, A1600 and A1800), RIZR Z6 (and Z6w), ROKR E8, RAZR V8 and ZINE ZN5. Here are some interesting things about them, JFYI:

1. http://smape.com/en/reviews/motorola/Motorola_ZN5-rev.html
MXC275-30 Platform Features
* StarCore SC140e DSP up to 208 MHz
* ARM11 applications processor up to 532 MHz
...
* Hardware encryption of A5/1, A5/2, A5/3 and A5/4
* Hardware acceleration for GPRS ciphering algorithm GEA/1, GEA/2, GEA/3 and GEA/4
* Integrated imaging processing unit (IPU) video accelerator
* A-GPS (network assisted) interface support
* Bluetooth® interface support
* WLAN 802.11a/b/g interface support
... E2, E6, A1200 ... only Java applets were officially supported. It would never let you use a native Linux application. ... On August 7, 2007, Motorola officially announced MOTOMAGX – the next generation platform based on Linux. Unlike the previous Linux-based platforms (e.g. EzX), this system opened a new epoch characterized by vast support for third-party applications. ... The MOTODEV Studio SDK currently allows for Java applet creation; Linux application and WebUI SDKs are planned to appear in this year.

2. http://forum.motofan.ru/index.php?showtopic=125823&hl=SDK&st=10
EZX SDK...
Вот ссылочку к сожалению дать не могу. Переписывался с ним и еще с автором GGLive по QQ. Оба на отрез отказываются общаться на английском, а по китайскому у меня слабая такая троечка. Так что возможно я их, а точнее они меня не очень правильно понимали. В целом результат такой. СДК состоит из двух частей - платформы от МВ и UI которая является продуктом совместного творчества тролев и моторолы. Чтобы его получить надо прийти в chaina-mobile и докаозать им что то ПО которое ты предлагаеш написать повысит продажи телефонов и что у тебя есть опыт написания такого ПО. получаеш сдк и идеш писать. когда прога написана - кажеш её исходники МВ. Они убеждаются, что написанная прога не содержит никакого диструктивного кода и дают тебе цифровую подпись уникальную для каждой проги.
два интересных момента: сдк нет в общем доступе - потому как все приложения в телефоне запускаются в приоритетом рута... ну вобщем большая дырка и второе почемуто они часто пишут "так называемое сдк" и ругаются в адрес "тех людей из моторолы" много и постоянно.

Вот теперь почти правильно ;) За исключением того, что исходники приложения надо показывать не МонтаВисте (МВ-оно, да?), а мотороле или china mobile. Ну не занимается MontaVista телефонными приложениями...
Итого - за SDK дорога в мотороллу или к их китайским друзьям.

3. http://forum.motofan.ru/index.php?showtopic=145617
MOTOMAGX, Z6 SDK

4. http://forum.motofan.ru/index.php?showtopic=156094&st=30
В Е2 проц слабее и в нет IPU, через который в Z6 MPlayer выводит видео. Собственно, благодаря ему всё и работает.
да, mplayer бы не помешал... С функцией TV Out телефон тогда станет портативным MPEG4 проигрывателем. Поехал на отдых, подключил к любому телеку и смотри себе кино

Ошибочка. Под TV-Out нужно будет писать отдельный модуль вывода, скорее всего.

5. http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2007-August/053606.html
尉贤林 weixianlin at gmail.com wrote on Tue Aug 28 11:13:52 CEST 2007:
I encounter a problem in accelerating mplayer. Now I wanna port mplayer to a linux system based on arm11. And there is a ipu(image processing unit) on board which is able to accelerate to some video decode feature, such as image convertion, from yuv 2 rgb. I can't find any yuv2rgb except *libswscale.* For example, mpeg2 video input & fb video out , decode in vd_libmpeg2.c will be invoked, but i can't find any about yuv2rgb. Decoded data type of mpeg2 is yuv, fb datatype is rgb. Am i wrong? I am a newbie of linux.


P.S. not newbie but neverbie in Linux
linkpost comment

Sauvignon Blanc wars: Babich 2007 vs. Villa Maria 2008 vs. Cloudy Bay 2007 [Nov. 10th, 2008|01:40 pm]
[Tags|, ]

Clody Bay takes prise (no surprise ;)). Babich comes second without IMHO significant difference in the taste/flavour to the former wine. Regarding the remaining contester, well, it doesn't look like NZ Sauvignon Blanc at all, it lacks that beautiful distinctive antipodian flavour. Instead, it's closer to the much less expensive moldovan Cricova Acorex Sauvignon Blanc.
linkpost comment

старDOM [Nov. 7th, 2008|10:57 am]
[Tags|]

http://www.theregister.co.uk/2008/11/06/ginger_nuts/

Вот раньше, бывало, гулял Козлодоев,
Глаза его были пусты;
И свистом всех женщин сзывал Козлодоев
Заняться любовью в кусты.

Занятие это любил Козлдоев
И дюжину враз ублажал.
Кумиром народным служил Козлодоев
И всякий его уважал.

А ныне, а ныне, попрятались суки,
В окошки отдельных квартир.
Ползёт Козлодоев, мокры его брюки,
Он star, он желает в сортир.
linkpost comment

The Ultimate Fate of Perl6: The Wreck of the Edmund Fitzgerald [Sep. 21st, 2008|11:04 pm]
[Tags|, , , , , ]

Reading an excellent (IMO) introduction to the topic, I couldn't escape a feeling of reading an obituary.

The problem with Perl6 is that it is essentially no longer a Perl. I mean, it is not a new version of Perl. It's not an increment over Perl5. Instead, it is a completely different language. It dismisses all hopes of backward compatibility, so that huge legacy of old Perl5 scripts (often mission critical ones) have no other means to be run by Perl6 interpreter except being rewritten grounds up. This is a huge disaster, indeed.

Another Perl5's virtue was that is was already available on all f.cking vendor's Unices that I ever got my hands on. It was available on PA-RISC HP-UX, SPARC Solaris, Alpha AXP64 Tru64 Unix and all crap Linuces that we have. Of course, I needed to retrieve, compile and install every single missing CPAN module like e.g. DBD::Oracle to get all those legacy mission critical scripts really doing some mission critical stuff, preferably according to their respective technical specification. The sort of cross-platform portability that Perl5 has, is in fact the highest practical level possible, except maybe ANSI C :). cf. the so very enterprisey Java(TM) "language" is not even close. Not even to Python, or say Ruby, or even to Haskell.

The Perl6 is definitely an improvement over Perl5, but not in form of added value, though. Perl6 resembles a failed attempt to out-Python the Python. For example, Perl6 supports named parameters to functions, default parameter values, "slurpy array" that catches rest-of-positional-parameters, and even "slurpy hash" that catches rest-of-named-parameters like Python do.

O, it offends me to the soul to hear a robustious periwig-pated fellow tear a passion to tatters, to very rags, to split the ears of the groundlings, who for the most part are capable of nothing but inexplicable dumbshows and noise: I would have such a fellow whipped for o'erdoing Termagant; it out-herods Herod: pray you, avoid it. (Hamlet, 3.2.4)

Therefore I see absolutely no reason why should I prefer Perl6 to Python? Given that Python builds on all the abovementioned f.cking Unices and works excellently out-of-box, and you don't need no stinking e.g. libexpat.so and no Expat.so either, because it's just all included in Python indeed, and for industry-standard-DB folks the cx_Oracle does work, and so far it was the only external module that I needed to build along the Python, I really really wonder does Perl6 have any chance of standing up against Python/Ruby/Haskell/insert-your-favourite-language-here?

P.S. The ship was the pride of the American side ... And the church bell chimes till it rings twenty-nine times
linkpost comment

гланды vs. glands [Sep. 21st, 2008|08:37 pm]
В чём разница между русским словом "гланды" и английским словом glands?
Скорее всего в том, что в русском языке данное слово и слово "анус" встречаются вместе разве что только в техническом жаргоне, в то время как в английском языке их соседство не является чем-то неестественным (http://en.wikipedia.org/wiki/Mustela_erminea):

When alarmed, a Ermine can release a powerful musky smell from glands near its anus
linkpost comment

hiddeousness [Aug. 6th, 2008|04:19 pm]
[Tags|, , ]

If you don't know already, there are 2 problems with bluetooth mice and hidd under Linux:

  • 1st, mouse does not connect automatically when it's powered on

  • 2nd, mouse goes into sleep/standby mode at times
    and bluetooth connection with hidd is not restored after that


I've found a solution to the problem:

  • you need to connect your mouse manually for the first time using hidd --connect=aa:bb:cc:dd:ee:ff

  • after that you create a udev rules file named like e.g.
    /etc/udev/rules.d/z83_my_bt_mouse.rules with the next content:
    DEVPATH=="/class/bluetooth/hci0/aclAABBCCDDEEFF",\
            ACTION=="add",RUN+="/usr/bin/hidd --server"


  • you can find out what the DEVPATH for your mouse/platform is
    by running "udevmonitor --env" and powering mouse on

  • on Debian "lenny" there's no "udevmonitor" and you must use
    "udevadm monitor" instead. Also, on this Debian the DEVPATH
    for bluetooth mouse looks like this:

    DEVPATH="/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1:1.0/hci0/aclAABBCCDDEEFF"\
linkpost comment

Fight against corp. proxy [May. 28th, 2008|05:23 pm]
[Tags|, , , ]

Corp. proxy is not necessarily a bad idea. Well, there may be a lot of valid reasons to deploy one.

Dunno how do you feel, dude, but for myself, it's very annoying to manually reconfigure firefox & co. on my notebook each time I enter my lovely reservation corporation. And because I think that proxy and firewall stop only lenient and stupid people, you've got a fight on your hands, my dear employer. Time to prove that/what I'm worthy (Worthiness Precedes Reward (c)).

At start, I've discovered that simple method like using u2nl plus iptables/REDIRECT does not work. First, corp.proxy requires "Proxy-Authorization" and u2nl can't do it (well, couldn't do). I've spent about 15 minutes to teach u2nl this skill. I did not code challenge-based auth, I just added "Proxy-Authorization: %s" header with text taken from cmdline. This works OK after you've sniffed valid hashed(base64-encoded) "Basic" auth string. Second problem is that CONNECT is only permitted to go to port 443, not to port 80 by our corp. admins. How does firefox work then? It uses "GET+Proxy-Authorization", not "CONNECT+Proxy-Authorization". And this is very bad because I need to deploy full-blown proxy daemon (with automatic auth to its parent) or implement one in language of my choice.

After several days passed, many cups of tea been drunk and visits to the john made, working python code is ready and deployed on my desktop and on my notebook. What was thought of as approximately 40 lines of python and 2 hours of work is now 269 lines long (comments included) and don't know how many neuron cells burnt.

First I've developed a code for handling HTTP GET/HEAD/PUT/POST requests using asynchronous select() loop and send()/recv() at the proxy side mixed with buffered blocking readline()/write() calls at the client side. Then I've got rid of buffered I/O and made processing completely event-based. Then I've added SO_ORIGINAL_DST support. Then I've added special handling of HTTPS-like ports (thanks to SO_ORIGINAL_DST, now I could distinguish) through CONNECT method. This worked fine except on notebook. I've found a race condition when client gets his SYN/ACK and sends TLS/SSL hello immediately. transproxy script did not wait for HTTP 200 reply to his first CONNECT command and sent two packets (CONNECT and client's TLS/SSL hello) very fast one after another. After discovering that, I've added an artificial delay until HTTP "200" received.

Then I wanted to publish my code somewhere/somehow. To publish on LJ is tricky. I decided to publish the code on http://savannah.nongnu.org/. I've spent more than 3 hours reading different license/copyright howtos, adding proper statements to all files in project, adding verbatim copy of the GPL license itself, and trying to upload the resulting tarball correctly.

I've made several fixes for the transproxy since initial submission to the savannah. Several days ago, my project has finally been approved, I've got CVS/ssh access to my project's repository and checked in updated version. You can get it from here: https://savannah.nongnu.org/projects/transproxy/
linkpost comment

HP-UX wonders, vol. 3 [May. 27th, 2008|10:11 pm]
[Tags|, , ]

Another compilation to support the statement that HP-UX is a corner case in Unices

p1. Shadows of the Past

Building Python-2.5.2.tar.bz2 with cx_Oracle-4.3.1.tar.gz gives a ... guess what? Exactly the same set of problems as 3 years ago:

http://mail.python.org/pipermail/python-list/2005-May/323347.html
http://mail.python.org/pipermail/python-list/2005-May/323447.html
http://mail.python.org/pipermail/python-list/2005-May/323449.html:
  /usr/lib/dld.sl: Can't shl_load() a library containing Thread Local Storage: /usr/lib/libcl.2
  /usr/lib/dld.sl: Exec format error

Same shit, same smell. Splendid build, astonishing composition and constitution just serve as a proof of authenticity. I do appreciate continuance. No, really. :) Especially when it's demonstrated by two Industry Standard (TM) tools - Python (ask Google) and Oracle (ask everybody else) on one particular UNIX platform. The only things I appreciate more are folklore and traditions - they have all sort of medicine and workarounds for the authentic diseases.

p2. Use the Power, Luke

One day before the Debian SSL Bug was published on El'Reg, I've discovered and reported by e-mail the related bug in the Crypt::SMIME package.

The bug was discovered on HP-UX. Guess why? Every modern UNIX platform has a /dev/urandom device. HP-UX doesn't. Neither /dev/srandom nor /dev/random. What do you think a Luke programmer should do then? Fill Pseudo-Random Number Generator with power random stack garbage, that's it.

I think this multi-touch of authenticity is worth a lot. Could provide enough knowledge for our good Debian fellows (no pun intended, I'm myself part of that) to save everybody else's asses from ssh-vulnkey(1). Just unlike a Random iPhone Thingy (TM).
linkpost comment

64 untru POSIX shells, Part 1: OSF/1 [Apr. 10th, 2008|02:54 pm]
[Tags|, ]

In April one of my scripts was run for the first time in its otherwise successful career on Tru64 (Alpha platform, former DEC OSF/1) and surprisingly have stubmled upon a bug in HP Tru64 shell. Skipping all gory details, here is a proof of concept:
xrgtn@some:~$ /bin/sh
$ uname -a
OSF1 some.host V5.1 2650 alpha
$ rm /tmp/shit* ; D="/tmp" ; touch "$D"/shit1 "$D/"shit2 "$D/shi"t3
rm: /tmp/shit*: No such file or directory
$ ls "$D"/shi*[123]
/tmp/shit1  /tmp/shit2  /tmp/shit3
$ ls "$D/"shi*[123]
ls: /tmp/shi*[123] not found
$ ls "$D/shi"*[123]
ls: /tmp/shi*[123] not found
$ 

Hopefully it's obvious to reader what's the matter of this bug, what I was trying to do in my installer script (actually, something like mv "$TMP/local/lib/libexpat.s"[ol]* "$TMP/local/lib/off/" ;)) and why is variable expansion inside double quotes so important, even if I want to do it together with wildcard expansion.
linkpost comment

dat marvelous HP-UX, revisited [Jan. 4th, 2008|09:54 am]
[Tags|, , ]

JFYI: it looks like there's no flock(2) in HP-UX's libc, thus Perl's flock() is implemented by means of lockf(2) there. What this means in the first place is that a resulting Perl's lock is not fork-persistent.

For example, the next scenario won't work as expected:

  1. open and flock(LOCK_NB|LOCK_EX) some file
  2. if flock fails (already locked), exit
  3. otherwise hold lock and daemonize


This will cause confusion to the next run of the same scenario, because the lock has been dropped after daemonization, and the next run will erroneously think that the daemon's No Longer Shopping The Pig.

A kludgy solution to the problem is to drop lock in parent process just before daemonization and try to re-acquire the lock in child thereafter. This means that we can stumble over the lock file in child process too, and must handle this case appropriately.
linkpost comment

late-for-christmas wishes [Dec. 27th, 2007|04:11 pm]
[Tags|, , , , ]

Dear Santa,

I was a good boy all the year, this was a good year thanks our Lord anyway, I was happy for all the fun it gave me, like the that Led Zeppelin revival project, you know, The White Stripes its name was!

Please, Santa I don't ask anything for myself, please awake the forgotten souls of John Henry Bonham and John Paul Jones in the above mentioned project, please give the good girl Meg White a talent, skill, virtuosity and a good taste of poor old Bonham. Please, help them to find a decent bass-guitar player in their group too, and pass them my many thanks for the wonderful songs like Catch Hell Blues, Bone Broke, You Don't Know What Love Is, 300 M.P.H. Torrential Outpour Blues and others.

--
Long live sex, drugs and rock'n'roll,
WBR, xrgtn
linkpost comment

blood test [Dec. 12th, 2007|11:07 am]
Evidently, blood test of The White Stripes' is positive for a high number of hard rock antigens:

In fact, The White Stripes appear to have the only one very good and mostly original album at the moment - Elefant, with the two others (White Blood Cells and Icky Thump) being quite good but dressed in second hand rhytms and tunes, while the Get Behind Me Satan is the worst of all.

And it still remains uncertain, whether The White Stripes mania deserves to be recognized as a distinct hard rock viral disease, or not...
linkpost comment

Icky Thump [Dec. 7th, 2007|12:36 pm]
[Tags|, ]

Why didn't The White Stripes name the album just A Tribute To Insert Your Favourite Hard Rock Band Name Here, I wonder?

The weakest song in the album IMHO is The Conquest, it's just an icky parody upon flamenco. The best one is Catch Hell Blues, it bears a distinct stigma of Led Zeppelin influence. A Martyr for My Love for You is very touching, but slightly too pathetic.

What's particularly interesting is usage of hammond and bagpipes in several songs, which resembles a number of vintage hard rock experiments.
linkpost comment

population count algorithm [Nov. 30th, 2007|02:16 pm]
[Tags|, ]

Yesterday we ate sushi with a friend of mine in a nice place in the center of Kyiv and discussed his recent interviewing of a let's say one would-be-programmer... Alex asked the guy how would he implement population count routine, and the guy didn't have a clue.

Actually, this post isn't about stupid programmers, but about population count algorithms instead. During the yesterday meeting I remembered one particularly nice parallel bit counting hack and told Alex about it - he caught it almost in no time. Today I've remembered about table-based algo and have finally searched Inet for other solutions. I've found the next:

http://en.wikipedia.org/wiki/Hamming_weight

Most funny algorithm there is the popcount_3, that uses multiplication to calculate sum of all bytes in 64-bit word: "return (x * 0x0101010101010101ULL) >> 56;". In fact, on the wikipedia page the 0x0101010101010101ULL is written as the h01 constant and this is rather counterintuitive. Also, what's not covered there is that the multiplication trick will work for 128-bit words but may fail with 256 bits. IMHO, for even larger widths the next modification of 3rd algorithm is required:
  int popcount_4(uint512 x) {
    x -= (x >> 1) & m1;             //put count of each 2 bits into those 2 bits
    x = (x & m2) + ((x >> 2) & m2); //put count of each 4 bits into those 4 bits
    x = (x + (x >> 4)) & m4;        //put count of each 8 bits into those 8 bits
    x = (x + (x >> 8)) & m8;        //put count of each 16 bits into those 16 bits
    return (x * 0x00010001...0001ULLLL) >> 496;
  }
linkpost comment

navigation
[ viewing | most recent entries ]
[ go | earlier ]

Advertisement