Search This Blog

Tuesday, June 28, 2011

Latex insert chapter without chapter heading; latex chapter without preceding “chapter” heading; latex chapter without “chapter” phrase

To insert a chapter in Latex without the chapter heading (next page will be preserved, as well as font size etc) you can use \chapter*. Unfortunately chapter* is not added to table of contents automatically so you need to do it manually.

Source code:


Friday, June 24, 2011

MySQL Insert statement with nested CASE and SELECT

The MySQL manual is a little bit confusing so I just wanted to give an example of MySQL’s insert statement with nested CASE and SELECT.

INSERT INTO TEST (startdate, testname, ipaddress, hostname, customerid, application)
  CASE count(id)
      WHEN 1 THEN id
      ELSE (SELECT id FROM customer where customername like '%OTHER%')
  FROM customer WHERE CUSTOMERNAME like '%XXX%';

Thursday, June 16, 2011

Flex add Buttons to an array; Flex add spark.components.TextInput to an mx.collections.ArrayCollection;

Whether you add buttons or textInput does not really matter. I had a couple of text inputs and wanted to change their properties all at once so I added them to an array.


<s:TextInput x="10" y="6" width="287" fontWeight="bold" id="TestNameInput" />
<s:TextInput x="10" y="42" width="287" fontWeight="bold" id="IPInput" />
<s:TextInput x="10" y="74" width="287" fontWeight="bold" id="HostInput" />
<s:TextInput x="9" y="111" width="287" fontWeight="bold" id="CustomerInput" />
<s:TextInput x="10" y="150" width="287" fontWeight="bold" id="AppInput" />
<s:TextInput x="10" y="186" width="287" fontWeight="bold" id="MemoInput" />

Declare an array collection:

public var inputFieldsArray:ArrayCollection = new ArrayCollection(null);

Add text inputs to an array in the creation event:

protected function group1_creationCompleteHandler(event:FlexEvent):void
     //adding input fields to the array

Wednesday, June 15, 2011

Import database in mysql from *.sql file; execute sql file under mysql on windows; Import exported database in mysql

You can use mysql.exe from c:\wamp\bin\mysql\mysql5.5.8\bin\


C:\>mysql -h -u root -p wirtlab < c:\public\localhost.sql
Enter password: ***

wirtlab is the database name.

-p should be used WITHOUT giving the password
(as you can see mysql asks you for password after executing the command)

Flex Esc key should close opened pop-up window; How to close pop-up windows with Esc key Flex

To make Esc key close the current window you need to bind events:

<s:Group  xmlns:fx=""
         width="1216" height="562" keyDown="group1_keyDownHandler(event)" creationComplete="titlewindow1_creationCompleteHandler(event)">


group1_keyDownHandler function is an event handler for user clicks:

protected function group1_keyDownHandler(event:KeyboardEvent):void
                if (event.keyCode == Keyboard.ESCAPE) {

You need to bind event listener to this function manually as well (don’t really know why because you did it earlier):

protected function titlewindow1_creationCompleteHandler(event:FlexEvent):void
                stage.addEventListener(KeyboardEvent.KEY_DOWN, group1_keyDownHandler);

I have added some imports to enable events. These are:

      import flash.display.*;
      import flash.text.*;
      import flash.ui.Keyboard;

Friday, June 10, 2011

Sample configuration file for ddclient connecting to

Sample configuration file that works for me:
(The file is located in: /etc/ddclient.conf or /etc/ddclient/ddclient.conf)


# Configuration file for ddclient generated by debconf
# /etc/ddclient.conf

use=web,, web-skip='IP Address'

Install vncserver on pogoplug device with fluxbox gdm; intstall tightvncserver on pogoplug;

Pogoplug is most commonly flashed with ArchLinux and its repositories are:$repo 

To install tightvncserver type:

pacman -S tightvnc
(at the time of writing this was: extra/tightvnc 1.3.10-5)

Install X-org fonts. These are packages:

extra/xorg-fonts-misc 1.0.1-1
extra/xorg-fonts-type1 7.4-1
extra/xorg-font-util 1.2.0-1
extra/xorg-mkfontscale 1.0.8-1
extra/xorg-fonts-encodings 1.0.4-1
extra/xorg-fonts-alias 1.0.2-1
extra/font-bh-ttf 1.0.1-1
extra/fontsproto 2.1.1-1 

Install fluxbox and xterm to have a graphical console:
extra/fluxbox 1.3.1-1,   extra/xterm 269-1

Start vnc with:
vncserver :0

Stop vnc server with:
vncserver -kill :0
My fonts were installed to:

Error: “tightvnc could not open default font 'fixed'” was resolved after installing fonts –> list is given above.

Tightvncserver gets its info from the ~/.vnc/xstartup which is created the first time tightvncserver runs.

You can get help from:

Sunday, June 5, 2011

Converting from MTS to h264 avi using ffmpeg; convert from MTS (Panasonic DMC-TZ10) to AVI; Converting from MTS to XVID avi using ffmpeg

I do not cover here the installation process of ffmpeg under ubuntu. (You need to either install it by apt-get/aptitude or download the sources, configure and compile it. Configuration includes enabling modules/libraries: e.g. ./configure --enable-faac --enable-x264 --enable-gpl --enable-xvid).

To convert to XVID use:

ffmpeg -i 00000.MTS -threads 4 -deinterlace -f avi-r 25 -vcodec libxvid -vtag XVID  -s 1920×1080  -aspect 16:9 -maxrate 1800k -b 1500k -qmin 3 -qmax 5 -bufsize 4096 -mbd 2 -bf 2 -flags +4mv -trellis -aic -cmp 2 -subcmp 2 -g 300 -acodec libmp3lame -ar 48000 -ab 128k -ac 2 out.avi


To convert to h264 use:

ffmpeg -threads 2 -i 00000.MTS -vcodec libx264 -deinterlace -b 3000k -cmp +chroma -g 250 -partitions +parti4x4+partp8x8+partb8x8 -i_qfactor 0.71 -keyint_min 25 -b_strategy 1 -flags +loop -vpre hq -acodec libmp3lame -ar 48000 -ab 128k -ac 2  outputfile.avi


Help on automating several MTS files creation can be found here.