Posts in category computing

Домены в зоне spb.ru

Начиная с 12 Апреля 2011 года Релком передает все что связано с доменами в RU-CENTER. Соответсвенно домены в зоне spb.ru становятся платными.

Меня не очень огорчает желание очередной русской конторы брать деньги за воздух, но они даже это не в состоянии делать по человечески. Вместо того что бы просто завести account и платить пластиковой карточкой, я должен заключать договор, сообщать им мои паспортные данные и тп.

Оно мне надо в условиях свободной конкуренции и доменов org,net,com которые можно зарегистрировать за 5 минут без всяких проблем?

Вобщем я прекращаю возиться с доменами spb.ru - Good buy!

MITOPENCOURSEWARE

How to restore lost settings item in start menu (WM6.x)

If you ocassionally turn off settings chekbox when tuning Start Menu items in windows mobile you are in big trouble as you can't access control panel anymore.

Trick to restore it is not obvious - you should create an empty folder Windows/StartMenu/Settings

Essential JVM options

/opt/jdk/bin/java -XX:+UnlockDiagnosticVMOptions -XX:+PauseAtStartup ... 
  
3266   diagnostic(bool, PauseAtStartup,      false,                              \
3267           "Causes the VM to pause at startup time and wait for the pause "  \
3268           "file to be removed (default: ./vm.paused.<pid>)")           

Solaris proc tools

  • pflags: Prints the tracing flags, pending and held signals and other /proc status information for each LWP.
  • pcred: Prints credentials (ie, EUID/EGID, RUID/EGID, saved UID/GIDs).
  • pmap: Prints process address space map.
  • pldd: Lists dynamic libraries linked to the process.
  • psig: Lists signal actions.
  • pstack: Prints a stack trace for each LWP in the process.
  • pfiles: Reports fstat, fcntl information for all open files.
  • pwdx: Prints each process's working directory.
  • pstop: Stops process.
  • prun: Starts stopped process.
  • pwait: Wait for specified processes to terminate.
  • ptree: Prints process tree for process.
  • ptime: Times the command using micro-state accounting; does not time children.

Also:

  • showrev -p - list installed solaris patches

Setup thunderbird to launch firefox on click to link

Why firefox installer doesn't set it ?

Edit .thunderbird/xxxx.default/prefs.js

pref("network.protocol-handler.app.http", "/usr/local/firefox/firefox");
pref("network.protocol-handler.app.https", "/usr/local/firefox/firefox");
pref("network.protocol-handler.app.ftp", "/usr/local/firefox/firefox");

How to generate self-signet cert by openssl

openssl req -x509 -newkey rsa:1024 -keyout file.pem -out file.crt  -days 9999 -nodes

or advanced method

openssl genrsa -out server.key 1024
openssl req -new -key server.key -out server.csr \
       -subj '/C=RU/ST=St.Petersburg/L=St.Petersburg/CN=www.4foo.net'
 
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

make sure you enter right value to CN field.

How to cut mp3 file using ffmpeg

ffmpeg  -acodec copy  -ss 00:00:31 [-t 00:01:00 ] -i input.mp3  out.mp3
or
ffmpeg  -acodec mp3 -ab 192 -ss 00:00:31 [-t 00:01:00 ] -i input.mp3  out.mp3 

Using openssl to encrypt/decrypt file

openssl aes-256-cbc  -salt -in secrets.txt -out secrets.txt.enc
    * You will be prompted for a password.

openssl aes-256-cbc -d -in secrets.txt.enc -out secrets.txt.new

add -a if you prefer ascii input/output

samba mount UTF-8 partition

server:

Edit smb.conf

[global]
unix charset = UTF-8

client:

mount -t cifs ... -o username=winusername,password=winpassword,iocharset=utf8

dv => mpeg2

dvgrab capture_20060604.dv
ffmpeg -i capture_20060604.dv  -target pal-dvd capture_20060604.mpeg

more ...  http://womble.decadent.org.uk/talks/dvd-ukuug06/dvd-talk-ukuug06-paper.html

mkv => avi: change container

/opt/mplayer/bin/mencoder infile.mkv -oac copy -ovc copy -o outfile.avi

or using mkvtoolnix

  1. MKV is a container, to see what the file contains:
$ mkvinfo movie.mkv

|+ Segment tracks
| + Track number: 1
^^^^^^^^^^^^^^^
+ Track type: video
^^^^^^^^^^^^^^^^
  1. select the numbers of the trucks you want to extract and type:
    $ mkvextract tracks "/mnt/common/Film/movie.mkv" 1:/mnt/common/Film/video.h264 2:/mnt/common/Film/audio.aac
    
    
  1. Let's put all toghether:
$ mencoder -audiofile video.aac -oac copy -ovc copy audio.h264 [-of mpeg]  -o movie_complete.mpg

or

$ ffmpeg -i video.h264 -i audio.aac -map 0.0:0 -map 1.0:0 -acodec copy -vcodec copy -r 23.976 -f vob video.mpg

see also:  http://juliensimon.blogspot.com/2009/01/howto-converting-mkv-files-to-play-on.html

How to open java coredump in gdb

After dozen of experiments I finally come to next action sequence with gdb as the most universal/reliable one.

  1. Check gdb version. it should be 6.x the later the better. I'm on 6.8 now
  1. Create directory D inside you working one
  1. Create D/gdbrc file with *full* path to your directory
    set solib-absolute-prefix /home/dms/Sept12/12_09_2008_20_00_node4/D 
    

Notice: set substitute-path doesn't work because gdb apply it to source files only

  1. symlink apropriate D/java
  1. run
       gdb -x D/gdbrc D/java core
    
  1. type
        info shared
    

You will see something like:

(gdb) info shared
From        To          Syms Read   Shared Object Library
                        No          /lib/tls/libpthread.so.0
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0x00a05bb0  0x00a068c4  Yes /home/dms/Sept12/D/lib/libdl.so.2
...
0x008c9c00  0x009b9800  Yes /home/dms/Sept12/D/lib/tls/libc.so.6
                        No          /lib/libnsl.so.1
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  1. leave gdb and copy or link missed library under D.

In my case:

D/lib/tls/lib/tls/libpthread.so.0
D/lib/libnsl.so.1

To gather all libraries necessary to open a coredump on other machine run:

 gdb -batch --eval "info shared"  D/java core 2> /dev/null |\
 sed -n -e 's/^.*Yes[^\/]*\//\//p' -e 's/^.*No[^\/]*\//\//p'  > filelist

on your own machine and than:

 cat filelist | zip zipme.zip -@

on client one

How to install Gentoo to WD MyBook World, wight light

Lasy guys see the end of this file for link to all the staff bundled together.

Precaution:

  1. Make sure you make a full (including a spare partitions) backup of virgin MyBook, becuase there is no way to restore original firmware if you will need it. (use partimage to don't store empty sectors)

  1. I strictly suggest to wire com console (personally I use Nokia DKU-5 cable as 3.3v com to USB converter) otherwise you couldn't determine what goes wrong if the system will not boot.

  1. I don't know (yet?) how to deal with LEON copro and turn off it's support in kernel. So you could experience slowdown of your ipsec vpn or something like this.

  1. Below I assume that HDD of MyBook is /dev/sdb, adjust it to fit your actual configuration

  1. if you decide to use files from my installation notice: I use 100Gb XFS sda1 for gentoo, 1Gb sda2 for SWAP, and 900G sda3 is left for rest of the world. No raid support. ext2, ext3, usb etc compiled as modules. eth0 compiled in firmware-less (LEON-less) mode.

  1. Notice link section at the end of this readme.

General information:

WD based on Oxford semiconductors oxnas 810 board. It holds: LEON sprcv8 copro, oxnas SATA interface, Intel EHCI compatible USB host, Synopsis GMAC 1Gb NIC. It doesn't have RT clock chip despite the fact original firmware try to initialize it. Original kernel based on 2.6.24 linux kernel and built with eabi/ulibc. Boot loader consists of two stages - proprietary stage1 and u-boot. u-boot doesn't support Ethernet so tftp boot is not possible. First five cyllinders of hdd is reserved for boot and kernel image so first partition started from cyl 5. COM is 3.3v, console operates on 115200,8N1, xon/xoff and it's UART2

Pre-requirements:

  1. GPL sources from WD site
  2. Precompiled mbr, stage1, u-boot and kernel images, (you can start from blank page, install one of cross development framework and build everything from scratch but this way is not covered here.)
  3. Gentoo stage3 for arm and portage archive

Also you should have the way to access you HDD from host linux machine (e.g. SATA-to-USB adapter)

Installation steps:

  1. Clean your HDD (dd if=/dev/zero of=/dev/sdb bs=512 count=10000)
  2. Install boot images
           dd if=./mbr of=/dev/sdb bs=512 seek=0
           dd if=./stage1 of=/dev/sdb bs=512 seek=1
           dd if=./u-boot.wrapped of=/dev/sdb bs=512 seek=3
    
  3. Install pre-compiled kernel dd if=./uImage of=/dev/sdb bs=512 seek=336
  4. Edit partition table as necessary
  5. Make filesystem. Don't initialize swap. If your whant to use raid (md driver) make sure that version of md on your host much one used on MyBook (0.90)
  6. Mount sdb1 and extract stage3 and portage
  7. Install additional software - you have to install ntpclient and mkimage also you may need vi, lrzsz and sysklogd
  8. Setup console

change /etc/inittab

s0:12345:respawn:/sbin/agetty 115200 ttyS0 vt100

add to your .profile

stty rows 40

  1. Create /sdbin/rc0 to get clock from the network at early boot
     /bin/mount -t proc  proc /proc
     /sbin/ifconfig eth0 inet 192.168.0.57
     /sbin/route add default gw 192.168.0.1
     /bin/ntpclient -s -h ntp0.uk.uu.net
    
    and change /etc/inittab
         i0::sysinit:/sbin/rc0
         i1::sysinit:/sbin/rc sysinit 
    
  2. edit /etc/fstab accroding to your partition layout
  3. Edit /etc/shadow - remove * to have password less root account
  4. Enable sshd i.e. link /etc/init.d/sshd to /etc/runlevels/default/ don't forget to change /etc/sshd_config - say yes to PermitRootLogin and PermitEmptyPasswords
  5. Plug HDD back to MyBook and boot device
  6. ssh to box and setup os as you like.

Kernel re-compilation on device:

  1. Have a good cup of cofee - it takes a while
  2. Unpack kernel source obtained from wdc site
  3. Create symlink /usr/src/linux -> kernel-source/kernel-0.4.6
  4. Get rid of cross compilation, edit /usr/src/linux/Makefile,
            ARCH            ?= $(SUBARCH)
            CROSS_COMPILE   ?=
    
  5. Build the kernel
            cd /usr/src/linux
            make oxnas_810_eabi_wd_prod_defconfig
            make menuconfig
            make
    

Notice: disable LEON support, otherwise eth0 will not work.

don't enable OXNAS i2c protocol - it's broken don't enable USB debugging - it's broken

  1. Install new image:
           mkimage -A arm -a 48008000 -e 48008000 -C none -d /usr/src/linux/arch/arm/boot/zImage uImage
           dd if=./uImage of=/dev/sda bs=512 seek=336
    

You may try new kernel first, before installing it to main location:

   dd if=./uImage of=/dev/sda bs=512 seek=32478 

interrupt u-boot and type

   run load2 boot 

Links:

My MyBook: http://devnull.samersoff.net/pub/MyBook_me
MyBook origin: http://support.wdc.com
Com wiring: http://www.nslu2-linux.org/wiki/HowTo/AddASerialPort
Gentoo Arm: http://distfiles.gentoo.org/releases/arm/autobuilds/current-stage3/armv5tel-softfloat-linux-gnueabi/
Bunch of staff: http://mybookworld.wikidot.com
and  http://zeroone.homeunix.net/~blip/comp/mbwe/

jar like in python

One of common question of python programming is how to do jar equivalent - i.e. run something like python myapp.zip . Below I describe a method producing a close result (hey python team - good place to enhance): unfortunately couple of bugs in python zip handling (e.g. python can't import module from zipfile with comments) make this task a little bit tricky.

  1. Make sure you app is ready to work with zip bundle i.e. file is replaced to ZipFile when necessary.
  1. Prepare the entry point:
    main.py
    def __main__():
         ....
    
  1. create a bundle
    zip -r test.zip *.py *.pyc
    
  1. create a launcher either shell or pure python one
#!/bin/sh
mod="$1"
shift
python -c "import sys; sys.path.insert(0,'${mod}'); import main;main.__main__()" $*
import sys
sys.path.insert(0,sys.argv[1])
import main
main.__main__()
  1. enjoy