You are viewing [info]xrgtn's journal

Pressed Rat's collection of dog legs and feet [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

underpants of destiny [Feb. 24th, 2012|10:40 am]
[Tags|]

Business "the gmail way": http://xkcd.com/1021/
linkpost comment

culture shock [Jan. 27th, 2012|03:46 pm]
[Tags|, ]

On NetBSD they use 'swapctl -l' instead of 'swapon -s'...
linkpost comment

title is optional... [Dec. 12th, 2011|04:36 pm]
[Tags|, , ]

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Data Mining and Real Application Testing options

SQL> select 'Larry Ellison sucks' as truth from DUAL where '' is NULL;

TRUTH
-------------------
Larry Ellison sucks

SQL> 
linkpost comment

unicode in perl: DBI/DBD's $@ is raw byte data, not text [Oct. 19th, 2011|05:27 pm]
[Tags|, ]

Just as I said. If you catch exception from e.g. DBD::Oracle and don't bother explicitly converting it from "whichever" _bytes_ to _string_, then the exception message will be silently promoted to "iso8859-1" during the next string operation, e.g. $@ =~ s/\s*\z/\n/;
Don't forget to convert $@ to string before use: $@ = Encode::decode("utf8", $@) unless utf8::is_utf8 $@;
If you have several possible sources of exceptions all using different encodings, then you're in trouble.
linkpost comment

enabling VT on UX380N [Jul. 29th, 2011|12:16 pm]
[Tags|, ]

With BIOS version R0101N2, VT enable/disable flag is at address 0x034E:
xrgtn@ux380n:~$ diff -u /mnt/f/[XY]
--- /mnt/f/X    2011-07-28 09:37:06.000000000 +0300
+++ /mnt/f/Y    2011-07-29 09:47:36.000000000 +0300
@@ -192,7 +192,7 @@
 (033C) [0000]
 (033F) [0005]
 (0345) [0001]
-(034E) [0000]
+(034E) [0001]
 (0351) [0000]
 (0354) [0001]
 (0357) [0000]
xrgtn@ux380n:~$ 
linkpost comment

enabling VT on UX230P [Jul. 5th, 2011|01:13 am]
[Tags|, ]

Using bogart's method (see http://forum.notebookreview.com/sony/189228-how-enable-intel-vt-ahci-napa-santa-rosa-platform-phoenix-bios-vaio-laptop.html), I've managed to find NVRAM entry for VT on Sony VAIO VGN-UX230P, BIOS version R0073N2 -- it's 0x036F:
xrgtn@xrgtn-ux230p:~$ diff -u /mnt/flash/[MN]
--- /mnt/flash/M        2011-07-04 23:50:32.000000000 +0300
+++ /mnt/flash/N        2011-07-05 00:23:22.000000000 +0300
@@ -202,7 +202,7 @@
 (035D) [0000]
 (0360) [0005]
 (0366) [0001]
-(036F) [0000]
+(036F) [0001]
 (0372) [0000]
 (0375) [0000]
 (0378) [0000]
xrgtn@xrgtn-ux230p:~$ 
linkpost comment

random notes on Sony VAIO VGN-UX230P [Jun. 29th, 2011|01:16 pm]
[Tags|, , ]

  • Thing is small, so you need really sharp eyes and small fingers to feel comfortably with it
  • It has at least one (CPU?) fan, so compiling linux kernel produces a lot of ssshhhh
  • It has only 512MB of RAM, thus compiling linux kernel takes a lot of time
  • F1/F2/etc keys are simulated by holding Fn and pressing 1/2/etc -- go try switching to console from Xorg :)
  • headphone output is not very powerful. It's better than Samsung Q40's (louder and has less noise) but quieter and noisier than Acer Aspire One's, so you better forget about listening to music in subway
  • XrandR only works when Xorg's intel video driver is loaded upon "i915.ko modeset=1", but the "i915 modeset=1" switches console from 80x25 to something like 130x50 which makes text barely readable there
  • WiFi adapter/antenna reception is slightly worse than Q40's and Acer Aspire One's
  • BIOS doesn't have an option to turn on Intel VT (needed for virtualisation)
  • BIOS doesn't provide an option to turn off boot logo (but thanks Sony it's possible to turn off boot logo animation (wow!)
  • GUNZE touch panel (or its driver?) comes miscalibrated by approx 6mm by default, so you definitely need xinput-calibrator or similar utility
linkpost comment

linux on sony vaio vgn-ux230p [Jun. 29th, 2011|10:54 am]
[Tags|, , , , , ]

First of all, thanks to Constantinos Pitris for his great Ubuntu on UX50 guide!

There are several problems though with UX230P and Debian squeeze (linux kernel 2.6.32-5-868, but I'm sure ALPS stickpointer problems are same in all kernels from 2.6.32 up to 2.6.39 because the code in alps.c is the same):

  • ALPS stickpointer is too sensitive and keeps selecting stuff all around. Constantinos' recipe for disabling tap-to-click didn't work, so I was forced to hack drivers/input/mouse/alps.c. First I changed alps_tap_mode(true) call during initialization to alps_tap_mode(false), and that didn't help. Then I hacked alps_tap_mode() to operate on both "touchpad" and stickpointer and this did help, although partially: careful fast tapping still produces a click, but to click and drag you now need to do double tap and drag, and this is the same mode as factory-shipped Windows XP exhibited and it's OK for me.
  • I liked stickpoiner scrolling in Windows XP (hold 3rd button and move stickpointer), so I implemented the same behavior using the next xinput set-props:
    xinput set-prop "DualPoint Stick" "Evdev Middle Button Emulation" 1
    xinput set-prop "DualPoint Stick" "Evdev Middle Button Timeout" 150
    xinput set-prop "DualPoint Stick" "Evdev Wheel Emulation" 1
    xinput set-prop "DualPoint Stick" "Evdev Wheel Emulation Timeout" 2
    xinput set-prop "DualPoint Stick" "Evdev Wheel Emulation Button" 2
    xinput set-prop "DualPoint Stick" "Evdev Wheel Emulation Axes" 6 7 4 5
  • GUNZE touch panel wasn't recognized by debian and it was necessary to modprobe gunze for it to work
  • kvm/kvm-intel didn't load, giving the "kvm: disabled by bios" error, and I'm still trying to find a fix. Of course, latest official Sony BIOS for the UX230P doesn't provide an option for enabling/disabling Intel VT. Googleing suggests booting to DOS and using symcmos utility to hack CMOS NVRAM dump, but I don't know offset of the Intel VT Enable flag in UX230P's CMOS NVRAM and wonder whether it's possible to enable VT in GRUB/LILO?
P.S. here is patch for alps.c:
--- ../../../drivers/input/mouse/alps.c	2011-06-25 14:32:07.000000000 +0300
+++ source/drivers/input/mouse/alps.c	2011-06-29 01:08:15.000000000 +0300
@@ -350,6 +568,7 @@ static int alps_tap_mode(struct psmouse
 	struct ps2dev *ps2dev = &psmouse->ps2dev;
 	int cmd = enable ? PSMOUSE_CMD_SETRATE : PSMOUSE_CMD_SETRES;
 	unsigned char tap_arg = enable ? 0x0A : 0x00;
+	unsigned char tap_arg2 = enable ? 0x14 : 0x0A;
 	unsigned char param[4];
 
 	if (ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO) ||
@@ -358,6 +577,12 @@ static int alps_tap_mode(struct psmouse
 	    ps2_command(ps2dev, &tap_arg, cmd))
 		return -1;
 
+	if (ps2_command(ps2dev,  NULL, PSMOUSE_CMD_SETSCALE11) ||
+	    ps2_command(ps2dev,  NULL, PSMOUSE_CMD_SETSCALE11) ||
+	    ps2_command(ps2dev,  NULL, PSMOUSE_CMD_SETSCALE11) ||
+	    ps2_command(ps2dev, &tap_arg2, PSMOUSE_CMD_SETRATE))
+		return -1;
+
 	if (alps_get_status(psmouse, param))
 		return -1;
 
@@ -411,8 +636,9 @@ static int alps_hw_init(struct psmouse *
 		return -1;
 	}
 
-	if (alps_tap_mode(psmouse, true)) {
-		printk(KERN_WARNING "alps.c: Failed to enable hardware tapping\n");
+	dbg("setting tap mode for mouse 0x%p", (void*)psmouse);
+	if (alps_tap_mode(psmouse, false)) {
+		printk(KERN_WARNING "alps.c: Failed to disable hardware tapping\n");
 		return -1;
 	}
 
P.P.S. JFYI here are the hda-verb settings to enable UX230P's speaker:
hda-verb /dev/snd/hwC0D0 0x0E SET_AMP_GAIN_MUTE 0x801F (set volume to 31)
hda-verb /dev/snd/hwC0D0 0x16 SET_AMP_GAIN_MUTE 0x8000 (0x8000 == unmute, 0x8080 == mute)
linkpost comment

what the f.cking beauty is? [Jun. 20th, 2011|10:09 pm]
[Tags|]

http://www.datacenterknowledge.com/wp-content/uploads/2011/06/k-supercomputer-1.jpg
best served with The Cure - Wish (1992) - End
P.S. http://www.theregister.co.uk/2010/09/29/fujitsu_k_super/
...since kei means 1016 in Japanese, a shorthand for 10**16, and soku means speed.
Как она, простая француз^H^H^H^H^H^H^Hяпонская женщина, догадалась, ято я директор кроватной фабрики? :)
linkpost comment

если оторвать таракану ноги, [Jun. 16th, 2011|01:01 pm]
[Tags|, , , ]

то он оглохнет. Примерно так мыcлят программисты MySQL-я, т.к., по их мнению, из ошибки "conftest.c:256: error: `NULL' undeclared (first use in this function)" совершенно очевидным образом следует, что на HP-UX-е у функции pthread_getspecific() -- два аргумента.
linkpost comment

the truth about wchar_t [Nov. 3rd, 2010|05:11 pm]
[Tags|, ]

How do you print a unicode string/char from your C program? Nowadays, the answer is obvious, because any sane system uses one of UTF-8 locales and you can just print UTF-8 strings and string literals with ordinary printf(), puts() and so on:
xrgtn@xrgtn-q40:/tmp$ cat yue.c
#include <stdio.h>
int main(void) {printf("Hello, 龠!\n"); return 0;}
xrgtn@xrgtn-q40:/tmp$ make CFLAGS="-Wall -W" yue
cc -Wall -W    yue.c   -o yue
xrgtn@xrgtn-q40:/tmp$ ./yue 
Hello, 龠!
xrgtn@xrgtn-q40:/tmp$ 

So far, so good. BTW, you can use "Hello, \xe9\xbe\xa0!\n" instead of the "Hello, 龠!\n" with the same effect (if compile time locale is UTF-8, of course). But some programmers are strange. Some of them even use Windows (poor beings). I'm pretty sure they'd be out of luck with the above example, so here enters wchar_t.

With it, you can use unicode string literals, character literals and "universal char" escape sequences, like L"Hello, \u16b9\u16df\u16b1\u16da\u16de!\n", but there are several problems:

  1. it requires specialized functions: wprintf(), wputs() and so on
  2. you cannot mix e.g. printf() and wprintf() in runtime. If printf() is called first, stdout will switch to char mode and wprintf() won't work anymore. If wprintf() is called first, stdout will switch to wide-character mode and printf() will not work thereafter. My experience with Unix/gcc shows that incompatible character output is just discarded, i.e. not printed at all:
    xrgtn@xrgtn-q40:/tmp$ cat out.c 
    #include <stdio.h>
    #include <wchar.h>
    int main(void) {
        int r1, r2;
        r1 = wprintf(L"Hello,\n");
        r2 = printf("world!\n");
        wprintf(L"%d wchars, %d chars written\n", r1, r2);
        return 0;
    };
    xrgtn@xrgtn-q40:/tmp$ make CFLAGS="-Wall -W -std=c99" out
    cc -Wall -W -std=c99    out.c   -o out
    xrgtn@xrgtn-q40:/tmp$ ./out
    Hello,
    7 wchars, -1 chars written
    xrgtn@xrgtn-q40:/tmp$ 

  3. whar_t takes 2 bytes on Windows/vc and 4 bytes on Unix/gcc
  4. whar_t depends on platform endianness, so you'll have a PITA when trying to do cross-platform data or function call exchanges
  5. wprintf(L"%s", ...) format specifier has different meaning on Windows and Unix/gcc
  6. non-ascii wprintf() doesn't work on Unix/gcc - all non-ascii characters will be replaced by question marks.. I.e. wprintf(L"Hello, \u9fa0!\n") will print Hello, ?!. You have to call setlocale() first:
    xrgtn@xrgtn-q40:/tmp$ cat yue_w.c 
    #include <stdio.h>
    #include <wchar.h>
    #include <locale.h>
    int main(void) {
        setlocale(LC_CTYPE, "");
        wprintf(L"Hello, \u9fa0!\n");
        return 0;
    };
    xrgtn@xrgtn-q40:/tmp$ make CFLAGS="-Wall -W -std=c99" yue_w
    cc -Wall -W -std=c99    yue_w.c   -o yue_w
    xrgtn@xrgtn-q40:/tmp$ ./yue_w
    Hello, 龠!
    xrgtn@xrgtn-q40:/tmp$ 
    

linkpost comment

uchar, shmuchar [Nov. 2nd, 2010|03:58 pm]
In a galaxy far, far away, there uses to dwell SAP AG "The Company". It uses to fight with another big and greedy company - Oracle. Life is very bleak and boring in their distant Market Place, so they use to produce all kinds of sick and bothersome ideas like e.g. the char16_t support in C and try to enforce them as International Standards.

What's more they assume everyone to accept their silly proposals and these Technical Report things even for those parts which are not covered or mandated by the Standards metioned earlier (for instance C compiler isn't required to support C++0x syntax), and tend to distribute things based upon these assumptions.

I'm talking specifically of SAPNWRFC (SAP NetWeaver RFC) SDK, which contains 9 examples and none can be compiled using stock gcc on linux. They are broken because they use cU macro, which should convert string literals to 16-bit unicode literals. Because unicode literals are 32-bit in any sane compiler/OS, SAP code doesn't compile. IMNSHO not only char16_t, but even the wchar_t is lame and braindead from the beginning, and the only sane unicode format nowadays is utf-8, but SAP doesn't know this or doesn't care anyway.

The only way to make the SAPNWRFC lbrary work on linux with stock (unpatched) gcc is to use iconv and explicitly convert to and from "utf-16le":
#define SAPwithUNICODE 1
#define RFCSDKwithoutUTF16_LITERALS 1
#include "sapnwrfc.h"
#include <stdio.h>

extern unsigned short *enc16(char *);
extern char *dec16(unsigned short *);

char *CPAR[] = {"ashost", "bob.umc.com.ua",
    "sysnr", "00", "client", "022",
    "user", "foo", "passwd", "bar", "lang", "EN"};

int main(int argc, char *argv[]) {
    RFC_CONNECTION_PARAMETER cpar[6];
    RFC_ERROR_INFO ei;
    RFC_CONNECTION_HANDLE ch;
    int i;

    for (i = 0; i < 6; i++) {
        char *n = CPAR[i*2], *v = (i + 1 < argc) ?
            argv[i + 1] : CPAR[i*2 + 1];
        printf("%s: %s\n", n, (i == 4) ? "********" : v);
        cpar[i].name = enc16(n);
        cpar[i].value = enc16(v);
    };

    ch = RfcOpenConnection(cpar, 6, &ei);
    if (ch == NULL) {
        printf("RfcOpenConnection error: %i/%i - %s, %s\n",
            ei.code, ei.group, dec16(ei.key), dec16(ei.message));
    } else {
        printf("RfcOpenConnection succeeded!\n");
    };

    return 0;
};
linkpost comment

в понедельник [Jun. 21st, 2010|10:41 am]
Что они ни делают, не идут дела. Видно, в понедельник их мама собрала:
10:36:24.669175 CDPv2, ttl: 180s, Device-ID 'kv-nto-4l3s1', length 415
        ...
        0x00f0:  7920 4369 7363 6f20 5379 7374 656d 732c  y.Cisco.Systems,
        0x0100:  2049 6e63 2e0a 436f 6d70 696c 6564 204d  .Inc..Compiled.M
        0x0110:  6f6e 2032 362d 4f63 742d 3039 2031 313a  on.26-Oct-09.11:
        0x0120:  3434 2062 7920 7072 6f64 5f72 656c 5f74  44.by.prod_rel_t
        0x0130:  6561 6d00 0600 1263 6973 636f 2057 532d  eam....cisco.WS-
linkpost comment

scp from remote_src to remote_dst [Jun. 10th, 2010|04:37 pm]
[Tags|, , ]

Today I've found a bug in scp 1:5.1p1-5 - it cannot copy from remote_src to remote_dst, at least not with pubkey authentication (which I use); while download from remote_src and upload to remote_dst both work fine:
xrgtn@xrgtn-q40:~$ rm foo bar baz
xrgtn@xrgtn-q40:~$ echo foofile >foo
xrgtn@xrgtn-q40:~$ scp localhost:foo bar
foo                                           100%    4     0.0KB/s   00:00    
xrgtn@xrgtn-q40:~$ scp localhost:foo localhost:baz
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password).
lost connection
xrgtn@xrgtn-q40:~$ scp bar localhost:baz
bar                                           100%    4     0.0KB/s   00:00    
xrgtn@xrgtn-q40:~$ cat baz
foofile
xrgtn@xrgtn-q40:~$ 
This bug caused me to lock HP-UX account twice on this day ("Account is disabled - see Account Administrator"). As it turned out to be it's not a bug but rather idiosyncrasy of scp remote to remote mode
linkpost comment

gcc: excess elements vs. missing braces around initializer [Mar. 31st, 2010|02:31 pm]
[Tags|, , ]

How do you initialize your complex structs in C? I mean, something like 'struct foo {short bar[2]; int baz}'? There exist 2 styles:
  1. struct foo x = {1, 2, 3} (flat list)
  2. struct foo x = {{1, 2}, 3} (nested braces)
It seems gcc prefers the latter. The former initializer style triggers 'warning: missing braces around initializer' when '-Wall' or '-Wmissing-braces' switch is present.

Of course, it's better to always provide structured initializer instead of flat one for complex structs, but sometimes this is not possible, because you need to use system-provided initializers like e.g. PTHREAD_MUTEX_INITIALIZER and the initializer nesting style they conform to is not known and/or is out of your control. Then, if you use '-Wall -Werror' pair of switches like guile-1.8.7 does, you've got a problem here.

The guile's smart-ass ./configure script works with '-Wall -Werror' switches and checks 'whether PTHREAD_MUTEX_INITIALIZER needs braces...'

On HP-UX this check produces 'yes' because:

  • PTHREAD_MUTEX_INITIALIZER is flat list: '{0x36, 0, 0x81, 1, 1, 1, 1, 1LL, 1, 0, 0, 0, -1, 0, ...}'
  • pthread_mutex_t is complex struct, like '{short __m_short[2]; int __m_int; ...}'
  • '-Wall -Werror' are in effect
  • gcc wants initializer with nested braces for the pthread_mutex_t, but gets flat list
  • gcc dies with 'warning: missing braces around __m_short initializer'
What happens next is very funny: guile places additional pair of braces around PTHREAD_MUTEX_INITIALIZER which results in {{0x36, 0, 0x81, 1, 1, 1, 1, 1LL, 1, 0, 0, 0, -1, 0 ...}} initializer. During compilation this initializer is attempted at pthread_mutex_t variable which triggers 'warning: excess elements in array initializer (near initialization for `async_mutex.__m_short')' and build fails. Here's why:
  • 0x36 goes to .__m_short[0]
  • 0 goes to .__m_short[1]
  • 0x81 wants to go into the .__m_short array too, but there's no more space in that array left
  • all other elements of initializer are also tried to be assigned to the .__m_short and do not fit (warning is repeat several times).

Here you see that ./configure effectively has broken the code completely, because 'excess elements' warning is much more serious than 'missing braces'. I think it's safe to assume that all those excess elements are essential non-default values for struct members that weren't put into correct places but discarded instead. Some important members didn't receive their values. For example, 0x81 wasn't put into __m_int and so on.

P.S. pthread_mutex_t and PTHREAD_MUTEX_INITIALIZER are defined this way on HP-UX 11.31 is64:

#  ifdef __LP64__
#    define __MPOINTER     void    *__m_ptr
#    define __POINTER_SET  ((void *) 1LL)
#  else
#    define __MPOINTER     int     __m_pad; \
                           void    *__m_ptr
#    define __POINTER_SET  0, ((void *) 1L)
#  endif

struct __pthread_mutex {
        short           __m_short[2];
        int             __m_int;
        int             __m_int1[4];
        __MPOINTER;
        int             __m_int2[2];
        int             __m_int3[4];
        short           __m_short2[2];
        int             __m_int4[5];
        int             __m_int5[2];
};

typedef struct __pthread_mutex pthread_mutex_t;

#define __SPNLCK_INITIALIZER \
        1, 1, 1, 1, \
        __POINTER_SET, \
        1, \
        0

#define PTHREAD_MUTEX_INITIALIZER  { \
        __PTHREAD_MUTEX_VALID, 0, \
        (PTHREAD_MUTEX_DEFAULT | PTHREAD_PROCESS_PRIVATE), \
        __SPNLCK_INITIALIZER, \
        0, 0, -1, 0, \
        0, __LWP_MTX_VALID, 0, 1, 1, 1, 1, \
        0, 0 \
        }
linkpost comment

super HP-UX: platform jumping [Mar. 4th, 2010|02:38 pm]
[Tags|, , , ]

We are in process of migrating InstantLink from old PA-RISC HP-UX 11.11 superdome to new itanic 11.31 server -- typical platform jumping game (kudos to vvv). Yesterday I tried to to build gcc on new itanic HP-UX 11.31:

First of all, the old method for PA-RISC HP-UX 11.11 failed on the very first step, with binutils-2.11 complaining that it doesn't know what the 64bit integer type on ia64-hp-hpux11.31 should be.

Second, the bundled HP-UX cc is no more K&R-only, it now understands ANSI function prototypes etc. Maybe it's indeed ANSI compliant, I didn't bother to find out (sorry)

Third, I tried every binutils version from 2.11 to 2.20. Here's the result:

  • 2.11, 2.12, 2.13, 2.18, 2.19 and 2.20 fail to build
  • 2.15 and 2.17 build but fail during "make install"
  • 2.14, 2.16 and 2.16.1 do build and install:
    ...
    checking for bison... /comptel/ilink/src/binutils-2.17/missing bison -y
    checking for flex... /comptel/ilink/src/binutils-2.17/missing flex
    checking for yywrap in -lfl... no
    checking for yywrap in -ll... yes
    checking lex output file root... lex.yy
    checking whether yytext is a pointer... yes
    ...
    
    but attempt to use them during e.g. m4 compilation produces the next error:
            ar cru libm4.a gl_avltree_oset.o c-ctype.o ... vasprintf.o xmalloc.o 
    /usr/lib/hpux32/dld.so: Unsatisfied data symbol 'yylsp' in load module '/usr/lib/hpux32/libl.so.1'.
    /usr/lib/hpux32/dld.so: Unsatisfied data symbol 'yyolsp' in load module '/usr/lib/hpux32/libl.so.1'.
    /usr/lib/hpux32/dld.so: Unsatisfied data symbol 'yyfnd' in load module '/usr/lib/hpux32/libl.so.1'.
    /usr/lib/hpux32/dld.so: Unsatisfied data symbol 'yytextuc' in load module '/usr/lib/hpux32/libl.so.1'.
    /usr/lib/hpux32/dld.so: Unsatisfied data symbol 'yylenguc' in load module '/usr/lib/hpux32/libl.so.1'.
    /usr/lib/hpux32/dld.so: Unsatisfied data symbol 'yytextarr' in load module '/usr/lib/hpux32/libl.so.1'.
    /usr/lib/hpux32/dld.so: Unsatisfied data symbol 'yylstate' in load module '/usr/lib/hpux32/libl.so.1'.
    /usr/lib/hpux32/dld.so: Unsatisfied data symbol 'yyprevious' in load module '/usr/lib/hpux32/libl.so.1'.
    /usr/lib/hpux32/dld.so: Unsatisfied data symbol 'yyextra' in load module '/usr/lib/hpux32/libl.so.1'.
    *** Termination signal 9
    

So, I'm forced to find another bootstrapping sequence from HP-UX bundled compiler/tools to gcc:

  1. build and install binutils 2.14, 2.16 or 2.16.1 (I use the latter in this example). In order to eliminate the abovementioned yywhatever errors you will need to hack "-ll" out of LIBS. Googling suggests to set LEXLIB=" " but this doesn't apparently work. So you'll need to apply more brute force here:
    ilink@tunis:~/src/binutils-2.16.1 > echo 'ac_cv_lib_l_yywrap=${ac_cv_lib_l_yywrap=no}' >> binutils/config.cache
    ilink@tunis:~/src/binutils-2.16.1 > echo 'ac_cv_lib_l_yywrap=${ac_cv_lib_l_yywrap=no}' >> gas/config.cache
    ilink@tunis:~/src/binutils-2.16.1 > ./configure --prefix=/comptel/ilink/xxx
    ilink@tunis:~/src/binutils-2.16.1 > make
    ilink@tunis:~/src/binutils-2.16.1 > make install
    
  2. then you export PATHs to the newly built goodies and compile bison-1.25:
    ilink@tunis:~/src/bison-1.25 > PATH=/comptel/ilink/xxx/bin:$PATH
    ilink@tunis:~/src/bison-1.25 > LD_LIBRARY_PATH=/comptel/ilink/xxx/lib:$LD_LIBRARY_PATH
    ilink@tunis:~/src/bison-1.25 > MANPATH=/comptel/ilink/xxx/man/%L:/comptel/ilink/xxx/man/:$MANPATH
    
  3. after bison, you can compile ancient flex-2.5.4a, 'cause it depends on bison/yacc (the latter is missing on our HP-UX system). JFYI, newer flex-2.5.35 also depends on GNU m4 (configure: error: GNU M4 1.4 is required)
  4. then you can get your hands on m4 (I used 1.4.14):
    ilink@tunis:~/src/m4-1.4.14 > ./configure --prefix=/comptel/ilink/xxx
    
    BTW you can build m4 using HP-UX's tools instead of binutils, it is just me who decided to go in that order
  5. autoconf-2.65
  6. make-3.81
  7. don't start with too recent gcc, not only would it be impossible to build but to extract either:
    ilink@tunis:~/src > gunzip < gcc-4.4.3.tar.gz | tar xf -
    tar: ././@LongLink - cannot create
    tar: ././@LongLink - cannot create
    tar: ././@LongLink - cannot create
    tar: ././@LongLink - cannot create
    tar: ././@LongLink - cannot create
    tar: ././@LongLink - cannot create
    tar: ././@LongLink - cannot create
    tar: ././@LongLink - cannot create
    tar: ././@LongLink - cannot create
    tar: ././@LongLink - cannot create
    directory checksum error
    ilink@tunis:~/src > 
    
  8. I hadn't been able to build any version of gcc together with g++, so I decided to build and install C-only gcc first:
    ilink@tunis:~/src/gcc-3.3.6 > echo 'am_cv_func_iconv=${am_cv_func_iconv=no}' >> config.cache
    ilink@tunis:~/src/gcc-3.3.6 > echo 'am_cv_func_iconv=${am_cv_func_iconv=no}' >> gcc/config.cache
    ilink@tunis:~/src/gcc-3.3.6 > ./configure --prefix=/comptel/ilink/xxx --enable-languages=c
    ilink@tunis:~/src/gcc-3.3.6 > make bootstrap MAKE='make -j 8'
    ilink@tunis:~/src/gcc-3.3.6 > make install
    
  9. then comes the tricky part: building libstdc++, g++ and the rest of compilers. Apparently the key to success is to set -D_INCLUDE__STDC_A1_SOURCE in both CFLAGS and CXXFLAGS:
    ilink@tunis:~/src/gcc-3.3.6 > export CFLAGS=-D_INCLUDE__STDC_A1_SOURCE
    ilink@tunis:~/src/gcc-3.3.6 > export CXXFLAGS=-D_INCLUDE__STDC_A1_SOURCE
    ilink@tunis:~/src/gcc-3.3.6 > ./configure --prefix=/comptel/ilink/xxx --enable-languages=c,c++,fortran,java,objc,obj-c++
    ilink@tunis:~/src/gcc-3.3.6 > make -j 8
    ilink@tunis:~/src/gcc-3.3.6 > cp -pr install-sh ia64-hp-hpux11.31/
    ilink@tunis:~/src/gcc-3.3.6 > make install
    
  10. in fact, while -D_INCLUDE__STDC_A1_SOURCE is enough, -D_XOPEN_SOURCE=600 is probably more correct. I became tired of updating this LJ page after initial large pack of changes to the toolset build process. I created a shell script for getting repeatable build results and managed to build almost everything I need on HP-UX except guile/autogen. While guile itself builds OK, it results in somewhat broken libguile, which prevents autogen from building thereafter. Here is link to my build script: http://github.com/xrgtn/gnuhpux/blob/master/build_gcc.sh You are free to use it to your liking.
linkpost comment

Type xterm-color unknown [Mar. 2nd, 2010|08:39 pm]
[Tags|, ]

I don't even know how is the xterm-color different from regular xterm, I was just testing my brand new .bashrc and .bash_profile vs. colorised PS1 on itanic HP-UX host and stumbled upon the interesting fact that interactive bash starts OK with TERM=xterm-color while login-mode bash (bash -l) generates the "Type xterm-color unknown" warning and resets TERM envvar's value to "unknown".

Appears that the tset util called from default HP-UX's .profile is responsible for this warning:

ilink@tunis:~ > head -n 12 .profile 

# @(#)B.11.31_LR       

# Default user .profile file (/usr/bin/sh initialization).

# Set up the terminal:
        if [ "$TERM" = "" ]
        then
                eval ` tset -s -Q -m ':?hp' `
        else
                eval ` tset -s -Q `
        fi
ilink@tunis:~ > 
linkpost comment

cul-de-sac for Adobe Flash [Feb. 25th, 2010|11:14 pm]
[Tags|]

I sincerely hope there's no place for Flash in brave new world:
http://www.theregister.co.uk/2010/02/19/ipad_wsj/
--
I for one, welcome our new HTML5 overlords.
linkpost comment

. bug in HP-UX /bin/sh & /bin/ksh [Dec. 15th, 2009|11:50 am]
[Tags|]

Today I've found one interesting bug in HP-UX POSIX shell (/bin/sh): when trying to source non-existent file or file with no read permissions, non-interactive /bin/sh just terminates. This means that the next code:
. shit || echo "ERROR: cannot source shit" >&2
will not work. At least, the error handling part won't work, 'cause it won't be executed in the first place

Here is sample session with HP-UX /bib/sh:

$ touch shit; chmod 0333 shit; . shit; echo $?
/bin/sh: shit:  not found.
$ rm -f shit; . shit; echo $?
/bin/sh: shit:  not found.
$ uname -a
HP-UX uran B.11.11 U 9000/800 2727209332 unlimited-user license
$ exec /bin/ksh 
$ rm -f shit; . shit; echo $?
/bin/ksh: shit:  not found
$ 
Notice, that echo $? statement isn't executed at all.

Here is what POSIX mode bash produces on the same HP-UX host (mentioned above), and its behaviour is correct, contrary to the POSIX and Korn shells:

$ exec bash --posix
$ rm -f shit; . shit; echo $?
bash: shit: No such file or directory
1
$ 
linkpost comment

Australian Chardonnay: Carston's bs Quay Landing [Nov. 16th, 2009|06:37 pm]
[Tags|]

For two days (yesterday and today) I tasted these two wines (2008 vintage) and my word is thus: the Quay Landing one is indeed full-bodied and, I'm not afraid to say, a match to most if not all of Petite Chablis wines which are almost ten times more expensive (Quay Landing's 48.25UAH == $5.93). The Carson's one needs much work. It has a smell of immature grape and IMNSHO not worth tasting at all.
linkpost comment

a method for deleting FUBAR github repo [Oct. 10th, 2009|04:10 pm]
[Tags|, ]

Let's say you have foo repo which is badly broken to the point of not providing you with the Administrate menu. I witnessed the next symptoms:
  • github user's page lists the foo repo among others
  • github reports size of foo as zero
  • http://github.com/user/foo page denies its own existence - "That page doesn't exist!"
Possible solutions are:
  1. try to convince github's user support into deleting the broken repo. I tried this, and a week passed without any reaction from their side. YMMV
  2. cry for attention to your problem in support forums, on /. etc
  3. exploit the bug in github's WUI:
    • create another bar repository
    • go to Administrate
    • try to rename bar to foo
    • this won't work - github will say "Name is already taken"
    • press "Delete This Repository…" link
    • voila! github will delete foo instead of bar
linkpost comment

mencoder mf:// blah blah [Sep. 6th, 2009|09:32 pm]
[Tags|]

I wanted to create a DVD slideshow from two and half hundreds of photographs using mencoder. After reading manpage, I wrongly assumed that -mf fps=0.4 mf://path/to/photo/directory/ will be enough. In seconds, I've got the next:
VDec: vo config request - 2362 x 3307 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 3)
Movie-Aspect is 0.71:1 - prescaling to correct movie aspect.
swScaler: Compile time max width is 2048 change VOF/VOFW and recompile
Couldn't init SwScaler for this setup
FATAL: Cannot initialize video driver.
Apparently this error message means that while contemporary cameras can do more than score of megapixels, the mplayer's mf/sws keeps living in 3MP epoch. What's more, the max width is hardcoded into the libswscale/swscale_internal.h header file. So, in order to fix this unfortunate event, one needs to manually change the VOFW's macro value to let's say the 5616 to match the resolution of 1Ds Mark III and rebuild the package:
# apt-get install libcdparanoia-dev libdv4-dev
# apt-get build-dep mencoder
$ apt-get source mencoder
$ cd mplayer-1.0.rc2svn20080706/
$ perl -pi -wse 's/(#define\s+VOFW\s+)\d+/${1}5616/' libswscale/swscale_internal.h
$ dch -l xrgtn 'increase VOFW to 5616'
$ dpkg-buildpackage -rfakeroot -b -uc
After several minutes of comilation, I faced the next error (in truth, I lived my whole life without ever encountering a crap like this):
ccache gcc -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_ISOC9X_SOURCE -I.. -I.. -Wdisabled-optimization -Wno-pointer-sign -Wdeclaration-after-statement -I. -O2 -D_REENTRANT -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -DHAVE_CONFIG_H -I/usr/include/directfb -I/usr/include/  -I/usr/include/SDL  -D_REENTRANT -I/usr/include/kde/artsc -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include  -D_REENTRANT    -I/usr/include/freetype2 -I/usr/include   -c -o h264.o h264.c
cabac.h: In function 'get_cabac_noinline':
cabac.h:529: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'
cabac.h:529: error: 'asm' operand has impossible constraints
make[2]: *** [h264.o] Error 1
make[2]: Leaving directory `/usr/src/deb-src/mplayer-1.0.rc2svn20080706/libavcodec'
make[1]: *** [libavcodec/libavcodec.a] Error 2
make[1]: Leaving directory `/usr/src/deb-src/mplayer-1.0.rc2svn20080706'
make: *** [configure-stamp] Error 2
dpkg-buildpackage: failure: debian/rules build gave error exit status 2
I have spent some minutes googling the error text and found lot of links, but I've followed just two of them: the Blah Blah one by some Singin' Soul:
That tells me that you're using Debian-Multimedia, because mencoder is not in Debian's repositories and mplayer-1.0.rc2svn20080706 is the version of mplayer in Debian-Multimedia's Lenny repositories, so you'll have to report the bug to Christian Marillat (marillat(at)free.fr), the maintainer of Debian-Multimedia.

Oh, and before you report that bug, you might want to learn a little about his reputation. For what it's worth, I've had trouble compiling against his libraries too.

and useful another by Måns Rullgård:
Most likely, adding -fomit-frame-pointer frees up a register, allowing compilation to progress a little further, before failing here due to lack of -O3. GCC is *really* stupid without at least -O2.
[...]
> Is the 7REGS define broken or am I crazy ?
Not really. The problem is that gcc likes to waste registers (and everything else) at -O1 or lower. A simple check, like the ones done in configure, will probably not run out of registers, even though some real code will.
So, I noticed that the -fomit-frame-pointer option was missing when compiling the abovementioned h264.c file and traced the problem through debian/rules script down to the missing DEB_BUILD_OPTIONS=marillat value. So, I re-ran the dpkg-buildpackage the next way:
$ DEB_BUILD_OPTIONS=marillat dpkg-buildpackage -rfakeroot -b -uc
After supplying correct DEB_BUILD_OPTIONS the compilation went fine. The shining brand new mencoder binary happily encoded my collection of uniformly sized Motorola ZN5 images into slideshow, but, well, it constantly crashed during deallocating some thing inside mjpeg_decoder when fed a directory with images of higly variable sizes (mixture of 2048x1536, 3072x2304 and so on up to the 4224x3168 resolution - 26 variants total).

I needed the job to be done ASAP, so I tried to find any tool capable of adaptively resizing (zoom to fit into 720x676 PAL) a batch of images. After some try I decided to install python-imaging library and to write the batch resizer myself. Here is the resulting resize_720x576.py script:

#!/usr/bin/python

import sys
import re
import os.path
from math import floor
from PIL import Image

# monitorpixelaspect:
MPA = 16.0/9*576/720
FN83_RE = re.compile(r'\A[A-Za-z0-9_.-]{5,12}\Z')

if __name__ == '__main__':
    for (n, fn) in enumerate(sys.stdin):
        fn = fn.strip()
        bn = os.path.basename(fn)
        if FN83_RE.match(bn): dst_fn = bn
        else: dst_fn = "shit%04d.jpg" % n
        try:
            i = Image.open(fn)
            w0, h0 = i.size
            # prescale to correct aspect:
            (w1, h1) = (w0, h0 * MPA)
            if w1 > 720 or h1 > 576:
                wc = w1 / 720.0
                hc = h1 / 576.0
                mc = max(wc, hc)
                w2, h2 = int(floor(w1/mc)), int(floor(h1/mc))
            print "%04dx%04d %3s => %04dx%04d RGB: %s" % (w0, h0, i.mode,
                w2, h2, dst_fn)
            j = i.resize((w2, h2), Image.BICUBIC).convert('RGB')
            k = Image.new('RGB', (720, 576), 0xFFFFFF)
            k.paste(j, ((720 - w2)/2, (576 - h2)/2))
            i.verify()
            k.save(dst_fn, 'JPEG')
            i = j = k = None
        except (IOError, AttributeError), ioe:
            sys.stderr.write("ERROR: %s - %s\n" % (bn, ioe))

# vi:set sw=4 et:
This inglorious encoder also performs expand-on-white-background (similar to mencoder's expand=720:576 filter) and changes long/cyrillic names of images to something more comprehensible :). This is how it works:
xrgtn@xrgtn-q40:/tmp/slides$ find /mnt/winxp/tmp/nikita_photo/ -type f | ~/apps/resize_720x576.py
2362x3307 RGB => 0289x0576 RGB: 01.jpg
3307x2362 RGB => 0567x0576 RGB: 05.jpg
0640x0480 RGB => 0539x0576 RGB: shit0002.jpg
2339x3274 RGB => 0289x0576 RGB: 12345678.JPG
3307x2362 RGB => 0567x0576 RGB: 13.jpg
0640x0480 RGB => 0539x0576 RGB: shit0005.jpg
3307x2362 RGB => 0567x0576 RGB: 22.jpg
1985x1418 RGB => 0566x0576 RGB: 25.jpg
2362x3307 RGB => 0289x0576 RGB: 26.jpg
...
link2 comments|post comment

iPhone 1st gen replacement batteries [Aug. 22nd, 2009|01:52 pm]
There are a lot of "genuine", "original" etc replacement batteries for iPhones on the Internet and eBay in particular. Here comes short description of what you can find there:
  1. 01070650025 (also 08070650174): a replacement for P/N 616-0291, made in China by Shenzhen Jingyou Communication Tech. Co., Ltd.
  2. M/N CS-IPH290SL: replacement for P/N 616-0290, 616-0291 & LIS1376APPC/L1S1376APPC, made in Hong Kong by Cameron Sino Technology Ltd.
  3. S/N YH71957098028E: replacement for P/N 616-0290 & LIS1376APPC/L1S1376APPC, produced in Hong Kong by Jack Telecom Company
  4. P/N P11G59-01-S01, PGF564149A 1D11106 15971T1AE-03-219, S/N SD72117120RYW, SD7191707006NF, SD719470500MMK etc: Apple P/N 616-0291, made in China by SunPow Industrial Products (in Shenzhang). This battery can be found in production iPhones, see e.g. Apple iPhone - What's Inside
  5. SKYIB001: replacement for P/N 616-0290 & 616-0291, made in China by Seasky Technology Group Co., Ltd.
  6. M/N A1203: replacement for P/N 616-0290, 616-0291, LIS1376APPC and A1203, made in China
  7. 616-0320: this one is replacement for iPhone 3G battery, probably
  8. 616-0289: replacement for P/N 616-0290 & LIS1376APPC, made in Hong Kong. Probably this one is the same item as Jack Telecom's S/N YH71957098028E, because one eBay seller described the 616-0289 as being S/N YH71957098028E.
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

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