Search This Blog

Monday, March 28, 2011

Flex force DataGrid refresh from source; Flex refresh datagrid after update

The problem is that DataGrid is bound to the ArrayList and in most cases this ArrayList is stored locally, so just calling  invalidateList() on DataGrid is not enough. I had my DataGrid bound to a MySQL data table and that’s how I succeeded:


FlexGlobals.topLevelApplication.getRunningTestsResult.token = FlexGlobals.topLevelApplication.testService.getRunningTests();


getRunningTestsResult() is my function in bounded service in PHP that downloads running tests. I had to “update” the array (i.e. fill it with data once more). Then I used invalidateList() that moved data from the Array to DataGrid.

You can you a [Bindable] Array to make changes “in real time”. So this is a half-solution.


I used FlexGlobals.topLevelApplication just because I updated DataGrid from ItemRunderer. If you do this locally there is no need to use global vars.

Flex access dataGrid from ItemRenderer

If you have a buttonClickCall in your DataGrid and you want to access the whole DataGrid from your ItemRenderer call do the following:

add imports:

import mx.controls.DataGrid;
import mx.core.Application;
import mx.core.FlexGlobals;

access DataGrid in the following way:

var dataProvider = FlexGlobals.topLevelApplication.dataGrid.dataProvider;
var dataProvider = Application.application.dataGrid.dataProvider;


It will work despite the fact that these DataGrid variable is defined in a different mxml file.

ItemRenderer – ItemRendererXXX.mxml
Application – Name_Of_Your_App.mxml


You can that access all items in the following way:

for (var i:int = 0; i < dataProvider.length; i++)
    item = dataProvider.getItemAt(i);

Thursday, March 24, 2011

SQLite GUI; SQLite executing commands

I’ve found a nice GUI for SQLite. It’s from ‘tksqlite’ project located here. You can download a working version here.

From console (sqlite3.exe) you can do the following:

.read FILENAME – execute a file with sql commands;
.databases – list databases
.tables – list tables
.headers ON – display table headers while executing (SELECT * …)
.schema – display database schema

Remember to open sqlite3.exe with a database argument:

sqlite3.exe database.db

Thursday, March 17, 2011

Ubuntu 10.10 using GRUB 2.0 command prompt; Reconfigure GRUB after changing hard drive

When you see the grub splash boot menu press ‘c’ or ‘control-c’ to enter command prompt.

To successfully boot the system when something fails do the following:

grub> root
(to see what partition is to be booted)

grub> set root=(hd0,0)
(to set the root partition)

grub> kernel /vmlinuz root=/dev/sda1 ro Single
(or whatever other options you’d like at the end – these are passed as arguments to the kernel)
(you can use ‘linux’ command alternatively if there is no kernel command)

grub> initrd /initrd.img

grub> boot


Reconfigure GRUB after changing hard drive:

GRUB 2.0 config files are kept in: /etc/grub.d/

00_header        05_debian_theme  10_linux         20_linux_xen     20_memtest86+    30_os-prober     40_custom        41_custom        README

and in /etc/default/grub

?> update-grub
(generates grub.cfg from the above files) and updates UUIDs

?> grub-install /dev/sda1


Reconfigure GRUB 1.0 after changing hard drive:

run grub (usually in /boot/grub)

grub> root(hd0,0)

grub> setup(hd0)
(generates config from menu.lst)

Ubuntu check UUID of the installed hard drives

To check what UUID your drives have type:

?> blkid

This is helpful while configuring GRUB & LILO.

Allow remote access to apache on WAMP server on Windows; allow remote access to MySQL on WAMP server on Windows;


To allow remote access to apache on Windows change the file: c:\wamp\bin\apache\Apache2.2.17\conf\httpd.conf

You need to allow remote access to directory C:\wamp\www like this:

<Directory "c:/wamp/www/">
    ExecCGI MultiViews
    Options Indexes FollowSymLinks
    AllowOverride all

    Order allow,deny
    Allow from all



To grant remote access to MySQL:

use mysql;


flush privileges;


To see what is already allowed do this:

use mysql;

select user,host from user;

| user | host      |
| root |           |
| root | %         |
|        | localhost |
| root | localhost |
4 rows in set (0.00 sec)

“empty” places are nulls here. ‘%’ means from any host.

Wednesday, March 16, 2011

Export installed packages and import them on another machine

If you don’t have any specific settings and you just want to “copy” your linux working environment like running services and so on you can install a machine with identical packages installed by exporting the list of packages and importing it on another machine.

Backup installed package list on current machine
dpkg --get-selections > selections.txt

On new machine install packages like this:
dpkg --set-selections < selections.txt
apt-get update
apt-get upgrade


To see what packages are installed on the system, fire up:

aptitude search '~i'

Change partition label in Ubuntu

To change partition label on various file systems use:


mlabel -i /dev/sdb1 ::my_external
ntfslabel /dev/sdb1 my_external
e2label /dev/sdb1 my_external
For BTRFS you can set label while creating the partition with:
mkfs.btrfs –-label LABEL_LABEL
mkfs.btrfs –L LABEL_LABEL

Make PATH variable permanent on SSH login attempt/ Make PATH variable permanent on Ubuntu Linux


If you just want to have PATH variable available on a simple SSH login add the following like to your .profile:
export PATH=$PATH:/usr/local/lib/jdk1.6.0_24/bin

If you want to have PATH variable to be available after “su” login  change ENV_SUPATH & ENV_PATH
in file: /etc/login.defs

add this line:
export PATH=$PATH:/usr/local/lib/jdk1.6.0_24/bin
to all your users .bashrc files

You can always make symbolic links to /usr/local/bin.

Go to: /usr/local/bin
Execute: ln -s /usr/local/lib/jdk1.6.0_24/bin/* .
(don’t forget the dot at the end)

Monday, March 14, 2011

Windows 7 debug windows kernel; get information from Windows 7 *.dmp file; Dumpchk.exe; WinDbg.exe


When you experience a BOD (Blue Screen of Death) you’ll most likely get a memory dump from Windows from the time of the crush.

There are three things we want to do:

  • check the consistency of the dump
  • analyze the dump
  • check what program/driver is causing BOD


Debugging Tools for Windows

Windows XP Service Pack 2 Support Tools
(contains Dumpchk.exe and WinDbg)

Dumpchk.exe –> Dumpchk.exe displays some basic information from the memory dump file, then verifies all the virtual and physical addresses in the file

WinDbg.exe –> gathers information from a dump file


Look for *.sys file in the report that is causing BOD!

Instructions from ehow on how to use WinDbg.exe:


  1. Go to the Microsoft website to download and install the Windows Debugging Tool (see Resources). Choose the correct version of the tool: 32- or 64-bit.

  2. Click "Start" and choose "All Programs".

  3. Locate the "Debugging Tools for Windows" folder.

  4. Double-click the "WinDBG" icon to launch the debugging tool.

  5. Click "File" and choose "Symbol File Path". A window with a text box will open.

  6. Type "SRV*c:\symbols*" in the text box and press the "OK" button.

  7. Close the WinDBG tool and click "Yes" when the tool prompts you to save the workspace.

  8. Launch the WinDBG tool from the "Start" menu again. It should now be ready to debug your memory dump.

  9. Click "File" and choose "Open Crash Dump" from the drop-down menu.

  10. Browse to find the folder where your memory dump file is saved, click on it and press the "Open" button. Memory dumps are saved in the "C:\WINDOWS\" folder by default.

  11. Click the "! analyze -v" link under "Bugcheck Analysis".

  12. Allow the debugger to analyze the memory dump. It will gather information from the memory dump and provide troubleshooting feedback on the screen.

Read more: How to Gather Information After a Memory Dump in Windows XP |

Friday, March 11, 2011

Export data from Firebird into pure SQL inserts/ export data from Firebird to MySQL

When you need to export data from firebird into mySQL the easiest way is to use fbexport program. It’s manual is located here:

$> FBExport.exe -D "c:\DB\WL.FDB" -U user –P password -Si -V TEST -F test.out

Si – means “export to SQL inserts” format
V – table name to export
F – output filename

Be careful with dates in mysql. Export in the correct format. To export db in custom date format use:

$> FBExport.exe -D "c:\DB\WL.FDB" -U user –P password -Si -V TEST -F test.out -J "Y-M-D" -K "H:M:S"

J  - date format
K – time format


To import date to mySQL use SOURCE command:

$> mysql --user=root --password=password

$> use  database_name

$> SOURCE  c:\export\table_name.out


SOURCE command imports the whole file (executes SQL statements in it)

Flex/Flashbuilder Security error accessing url; crossdomain.xml

There’re new security rules applied in Flash Builder 4. Everything works fine when you debug your application from localhost. However if you try to access your page from remote host you’ll come across an error: “Security error accessing url”. To resolve the situation you’ll have to create a file named: crossdomain.xml at the root of your domain. Sample crossdomain.xml can be found here.

That’s not all. If you want to access the site from remote hosts, just export the project from FlashBuilder! (Project->Export release build). In debug releases Flash forces browser to download crossdomain.xml from “localhost”. In release builds crossdomain.xml will be downloaded from the server.


<?xml version="1.0"?>
   <!DOCTYPE cross-domain-policy SYSTEM "/xml/dtds/cross-domain-policy.dtd">
   <site-control permitted-cross-domain-policies="all"/>
   <allow-access-from domain="*" to-ports="*" />
   <allow-http-request-headers-from domain="*" headers="*"/>

Tuesday, March 8, 2011

Force Firefox not to use any cache while developing in Flex/Flash Builder

If you use Firefox for Flex development, you may have had problems with a SWF caching problem.  Even though a Flex compile updates the SWF file on the file system, Firefox doesn’t pull the new SWF from the server, but rather uses its internal already cached SWF file.  This can cause headaches when trying to guess why the code change doesn’t appear in the browser.  To solution has been to clear the cache in Firefox and reload the page.  I turned my browser cache size limit down to 0MB.  This doesn’t seem to fix the problem either.  There is another setting that can’t be found in the Firefox interface.

  1. Open a new tab in Firefox.
  2. Type about:config in the url.
  3. Agree to the warning.
  4. Change the property browser.cache.disk.enable and set it to false.

Thus far this solution seems to keep my SWF file from being cached by Firefox.


Windows 7 SP1/Service Pack 1–make permanent

To make Windows 7 Service Pack 1 permanent and by implication reclaim used space/remove backup files use these commands:

Online installation (from Windows Update):

dism /online /cleanup-image /spsuperseded

Offline installation:

DISM.exe /Image:C:\test\offline /Cleanup-Image /spsuperseded /hidesp

Monday, March 7, 2011

STAF – call remote command

To call a command on a remote computer, use STAF

To restart computer remotely e.g.:


Breakthrough game in Java3d

The game was developed to present Alfa-Beta algorithm.
It's goal is to reach opponent's last (nearest to him) row. Breakthrough is similar to checkers. You beat pieces crosswise (aslant) if you're near opponent's piece.
After knocking other player's piece you place your piece in the same place. You cannot beat pieces in backward "backward" direction (i.e. you cannot go back).

Jacek Dalkowski
Bartosz Kosarzycki

Game purpose:
Get to the opponent's last row first.

Game modes:
Computer vs. Computer
Computer vs. Human
Human    vs. Human








Game (Java):

To run the game you need Java3d:

Java 3d developer’s docs:

Game’s documentation/report (Polish):

Friday, March 4, 2011

Starting services at boot time

During start up or when changing runlevel, scripts are run from /etc/rcX.d/ where X is the runlevel number.

To execute your script at boot:

  • Write a script.
  • Put it in the /etc/init.d/ directory.
  • $> update-rc.d SCRIPT_NAME defaults
  • $> chmod +x SCRIPT_NAME

Change main tty resolution to vga in Ubuntu Server 10.10

The problem is that standard resolution in Ubuntu Server is too high in the main tty. I t should be 640x480 (vga).

Just set in /etc/default/grub:
But also change:

$> update-grub2; reboot

‘nomodeset’ was preventing it from switching to highest resolution.

When you remove ‘quiet’ it will say what it does at boot time. Well I would remove quiet as well – who doesn’t want to know what is going on?!

Thursday, March 3, 2011

Some more ubuntu tricks

  • remove users from group; edit the file:
  • can’t start VNC with XServer; add pemissions to:
  • mount ntfs that had unclean shutdown:
    ntfsmount /dev/sdb1 /bbb –o force
  • remount root filesystem readonly:
    mount –o ro,remount –f /
  • change ubuntu server start resolution:
    add vga=786 parameter in:
  • exclude certain directories while tarring:
    tar -cvzpP --file=/distr/backup.tar.gz --exclude={/dev/*,/proc/*,/sys/*,/srv/*,/distr/*,/tmp/*} /

Configuring moblock on ubuntu


$> blockcontrol reload
(reloading IP lists)

$> blockcontrol restart

$> blockcontrol stop | start | restart | reload

FILE: /etc/blockcontrol/blockcontrol.conf – configuring ports


/etc/blockcontrol/blocklists.list  - configuring blocking lists

/etc/blockcontrol/allow.p2p – ranges to allow

company1 IP1:
company1 IP2:
company1 IP3:
company1 IP4:

Check logs in:




$> gpg --keyserver --recv 9C0042C8
$> gpg --export --armor 9C0042C8 | sudo apt-key add -
$> gksu gedit /etc/apt/sources.list
For Ubuntu 10.10 add:
deb maverick main
deb-src maverick main
$> sudo aptitude update
$> sudo aptitude install moblock blockcontrol mobloquer

Start an already detached screen

screen -d –m 'command_to_run'

update-rc.d make script start at boot

  • Write the script and place it in /etc/init.d
  • change it to executable type
    chmod 755 /etc/init.d/your_script
  • add it to runlevels:
    update-rc.d your_script defaults
  • if you ever wanted to remove the script from boot, run:
    update-rc.d -f  your_script remove

Ubuntu 10.10 & vnc4server pressing ‘D’ minimizes all windows

There's a bug in vnc4server. When you have gnome installed and you install vnc4server you'll experience it. Pressing 'D' wherever & whenever inside gnome will cause all the windows to minimize.

Change System->Preferences->Keyboard shortcuts; find the shortcut:

"Hide all normal windows and set focus to the desktop"

and change ‘D’ to something else.

Running VNC Server without XServer on Ubuntu

What we want to do is to install VNC Server (which is about 45MB) without install the whole gnome environment. Such a vnc server can be started at boot time and serve as a XFCE or Fluxbox desktop with single user.

Install basic gnome environment (or any other lightweight):

?> apt-get install gnome-core

install vnc server:

?> apt-get install vnc4server

run the server to set password:

?> vncserver -geometry 1280x1024 -depth 24 :0

kill the server:

?> vncserver -kill :0

edit ~/.vnc/xstartup file:

change x-window-manager & in the end to:

gnome-session &

start the server:

?> vncserver -geometry 1280x1024 -depth 24 :0

Configuring WebInterface for rtorrent


Install rtorrent:

$> aptitude install rtorrent

$> apt-get install libapache2-mod-scgi

let’s configure apache to setup a scgi socket to a local process.
# nano /etc/apache2/httpd.conf

add a line:


Then do the following:

$> a2enmod scgi

$> /etc/init.d/apache2 restart

install php support:

$>  aptitude install libapache2-mod-php5

$> a2enmod php5

$> wget
(or from
Unpack these files and place in apache’s www directory.

$> aptitude install screen
$> aptitude install gcc libncurses-dev libncurses5 libsigc++-2.0-dev libsigc++-2.0-0c2a libssl-dev libssl-dev
$> aptitude install php5-xmlrpc coreutils


remember that you need to give rights to your rutorrent files. You can do this with chmod 666 for example.

mine rutorrent files were placed in:

To use WebGUI you need to configure rtorrent and run it in background (e.g. in screen)
$> screen rtorrent

Rtorrent configuration has to be placed in home directory:

configure port settings in .rtorrent.rc:
port_range = 10000-10000
port_random = no

Running step-by-step:
a) you need Apache running (configured in SCGI mode)
b) you need rtorrent running (with SCGI enabled)
c) access RuTorrent (GUI) via browser

look for errors in:

Wrong version of xmlrpc-c.
Ubuntu has old version (only stable) of xmlrpc. Until they update their packages you'll experience an error in rutorrent:

“rtorrent is compiled with incorrect version of xmlrpc - without i8 support.”

I use this old library and everything works more or less ok. Torrent size is invalid (it shows –2343444) and rtorrent settings do not work. But the main functionality remains intact.

You can download unstable xmlrpc-c release from:
to remove this error.

Wednesday, March 2, 2011

Ubuntu – change Message Of The Day (MOTD)

The usual problem MOTD is that you want to change it in /etc/motd and it keeps reverting to the default value.

Try different approach.

Install package  update-motd

aptitude install update-motd

Now you can control motd via editing files:


If you just want to add something in the bottom, create & edit the file:


Setting samba share

install samba:

aptitude install samba smbfs smbclient

In the ####authentication#### section find the line that says security, uncomment it and change it to:

security = share

Define new share in this way:

writable = yes
path = /public
public = yes
guest ok = yes
guest only = yes
guest account = nobody
browsable = yes

Tuesday, March 1, 2011

udev: eth0 stopped working - renamed to eth2


After putting new ethernet cards my ubuntu renamed eth0 to eth2 and eth1 to eth3. I wanted to have my old names back.

in dmesg there was:

eth0 –> renamed to eth2.

All you have to do is delete all old entries in:

and you’ll have eth0 and eth1 names back.

VirtualBox can't operate in VMX root mode. Please disable the KVM kernel extension, recompile your kernel and reboot (VERR_VMX_IN_VMX_ROOT_MODE).

This error is caused by having kernel module kvm and VirtualBox at the same time. KVM is a full virtualization solution for Linux on x86 hardware containing virtualization extensions (Intel VT or AMD-V).

To remove kvm module enter:

sudo modprobe -r kvm-intel
sudo modprobe -r kvm-amd

remove kvm from modules that are loaded at boot time. These are stored in file: