Monthly Archives: December 2011

Flex : Started

Started learning flex 🙂

Tagged

Troubleshoot : Wireshark NPF

I haven’t chosen the option which will start the NPF automatically.

The NPF driver isn’t running. You may have trouble capturing or listing interfaces.

Wireshark Dialogbox

  • Go to device manager
  • From the view menu choose show hidden devices
  • Collapse the Non-plug and play devices
  • Right click on the NetGroup Packet Filter Driver and select properties
  • Select the Driver tab and click on Start

LINUX : Installing Erlang

Create directories for Erlang

~]# mkdir /usr/local/erlang
~]# mkdir /usr/local/erlang/<version:otp_r15b>

Untar the archive into the directory you just created

otp_r15b]# tar -zxvf otp_src_<version:R15B>.tar.gz  

Configure.

otp_src_R15B]# ./configure

make and make install

otp_src_R15B]# make
otp_src_R15B]# make install

Set Path

otp_src_R15B]# vim /etc/profile

Add following lines to the end of the file.

# ERLANG
ERL_TOP=/usr/local/lib/erlang; export ERL_TOP
PATH=$ERL_TOP/bin:$PATH; export PATH

Linux : Installing GCC from RHEL disk

~]# mount -t auto /dev/dvd /mnt/dvdrom/
~]# cd /mnt/dvdrom/Server/
Server]# rpm -ivh gcc-4.1.2-46.el5.i386.rpm

Dependencies

Server]# rpm -ivh glib-1.2.10-20.el5.i386.rpm
Server]# rpm -ivh libgomp-4.4.0-6.el5.i386.rpm
Server]# rpm -ivh glib-devel-1.2.10-20.el5.i386.rpm
Server]# rpm -ivh kernel-headers-2.6.18-164.el5.i386.rpm
Server]# rpm -ivh glibc-headers-2.5-42.i386.rpm 
Server]# rpm -ivh glibc-devel-2.5-42.i386.rpm 
Server]# rpm -ivh gcc-4.1.2-46.el5.i386.rpm

Unmount

~]# umount /mnt/dvdrom

Check gcc

~]# which gcc

rpm

-i – install
-v – verbose
-h – show hash
-U – update

Linux : Mounting DVD rom

~]# mkdir /mnt/dvdrom
~]# mount -t auto /dev/dvd /mnt/dvdrom/
~]# ls /mnt/dvdrom
~]# umount /mnt/dvdrom

Linux : Installing Flex SDK

Create a directory for flex

~]# mkdir /opt/flex

Copy the SDK to that directory and unzip.

flex]# unzip flex_sdk_4.6.zip 

Set PATH

~]# vim /etc/profile

Add following lines to the end of the file

FLEX_HOME=/opt/flex; export FLEX_HOME
PATH=$FLEX_HOME/bin:$PATH; export PATH

LINUX : Installing debug version of Flash player

Download flash player debug version (flashplayer_11_plugin_debug.i386.tar.gz).

Untar it to a convenient place (/usr/sw)

sw]# tar -zxvf flashplayer_11_plugin_debug.i386.tar.gz

Copy the .so file to /usr/lib/mozilla/plugins directory

sw]# mv libflashplayer.so /usr/lib/mozilla/plugins/

Workaround for SELinux

sw]# chcon -t textrel_shlib_t /usr/lib/mozilla/plugins/libflashplayer.so 

Open Firefox, type about:plugins on the address bar and hit Enter.

LINUX : Installing Ant

Create a directory for ant

~]# mkdir /usr/ant

Copy and extract the .tar.gz archive to /usr/ant directory

ant]# tar -zxvf apache-ant-<version>-bin.tar.gz 

Set PATH

ant]# vim /usr/ant

Add following lines to the end of the file

ANT_HOME=/usr/ant/apache-ant-1.8.2; export ANT_HOME
PATH=$ANT_HOME/bin:$PATH; export PATH

Linux : Installing JDK rpm

Create /usr/java

~]# mkdir /usr/java

Copy the rpm file to /usr/java directory
Change the permission of the rpm

java]# chmod a+x jdk-<version>-linux-i586-rpm.bin 

Install the JDK

java]# ./jdk-<version>-linux-i586-rpm.bin

Install packages

java]# rpm -iv  <package>

Set PATH

~]# vim /etc/profile

Add the following lines to the end of the file

JAVA_HOME=/usr/java/default; export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH; export PATH

Erlang : Test Module 3


-module(test_b).
-export([test/2]).
	
insert(N, BeginFrom) ->
	case N of
		0 ->
			done;
		Else ->
			insert_many(N, BeginFrom)
	end.

tsact(N, CS, BeginFrom) ->
	case N of
		0 ->
			done;
		Else ->
			io:fwrite("begin N = ~p~n", [N]),
			LastNum = insert(CS, BeginFrom),
			io:fwrite("end~n"),
			tsact(N-1, CS, LastNum)
	end.

test(NumRecords, ChunkSize) ->
	TSacts = NumRecords / ChunkSize,
	%io:fwrite("TSacts ~p~n", [round(TSacts)]).
	tsact(round(TSacts), ChunkSize, 999).

	
%==============================================

insert_many(0, Number) ->
	Number;
insert_many(N, Number) ->
	Record = [{dst, Number},{msg, <<"test msg">>}],
	io:fwrite("~p~n", [Record]),
	%sqlite3:write(?DB_NAME, ?TBL_NAME, Record),
	insert_many(N-1, Number+1).
	

Sample Output


3> test_b:test(12, 2).
begin N = 6
[{dst,94770000000},{msg,<<"test msg">>}]
[{dst,94770000001},{msg,<<"test msg">>}]
end
begin N = 5
[{dst,94770000002},{msg,<<"test msg">>}]
[{dst,94770000003},{msg,<<"test msg">>}]
end
begin N = 4
[{dst,94770000004},{msg,<<"test msg">>}]
[{dst,94770000005},{msg,<<"test msg">>}]
end
begin N = 3
[{dst,94770000006},{msg,<<"test msg">>}]
[{dst,94770000007},{msg,<<"test msg">>}]
end
begin N = 2
[{dst,94770000008},{msg,<<"test msg">>}]
[{dst,94770000009},{msg,<<"test msg">>}]
end
begin N = 1
[{dst,94770000010},{msg,<<"test msg">>}]
[{dst,94770000011},{msg,<<"test msg">>}]
end
done
4>