Showing posts from April, 2010

NTP Timestamp

NTP timestamp is a 64-bit unsigned fixed-point number with the integer part in the first 32 bits and the fractional part in the last 32 bits. It is in seconds relative to 0h UTC on 1 January 1900

The NTP timescale wraps around every 232 seconds (136 years), so the first rollover will occur in 2036.
To convert second part of NTP to date, you can use normal date calculate such as 60s -> 1 mins, etc...
To convert fractional part of NTP, you need to use NTP fraction * (fraction of seconds) / 2 ^ 32.For example of NTP fraction 1329481807, to convert to microseconds, you perform1329481807 * (10 ^ 6) / 2 ^ 32 = 309544 (roughtly)

Compile Live555 using VS2005 Part 2

Part 1 gives you instruction on how to build Live555 in command. However, you will have to perform debug attached VS2005 with Live555 source code to running Live555MediaServer Process. This can be troublesome.

Part 2 gives you instruction on how to build Live555 as a VS2005 Project. I am assuming that you have some knowledge on VS2005 environment (create solution, add project, etc...)

1. Create an empty VS2005 C++ Solution as Live555
2. Within the Live555 solution, add 4 sub projects to Live555 solution
3. The naming of the sub-project is preferred to follow live555 naming as shown

4. Each sub-project should be a static library project.

5. Now, copy each live555 folder into respective sub-project. From here, I will do an example for BasicUsage Environment project

6. Next, include all the file to BasicUsageEnvironment vcproj. Also, add additional include library.

7. Repeat step 5 and 6 for Groupsock, LiveMedia and UsageEnvironment.
8. For simplicity, compile each sub-project with project only b…

Compile Live555 using VS2005 Part 1

Live555 is a media library that support RTSP and RTP. Below are some instructions to compile Live555 using VS2005. I found them online and it works for me.

1. Modify the line "TOOLS32 = ..." in win32config to point to the VS2005 installed directory in your host machine. For example, "TOOLS32 = C:\Program Files\Microsoft Visual Studio 8\VC" is corresponding to my desktop's configuration.

2. Modify the line "LINK_OPTS_0 = $(linkdebug) msvicrt.lib" in win32config to "LINK_OPTS_0 = $(linkdebug) msvcrt.lib", otherwise VS2005 will report msvicrt.lib cannot be found.

3. Run genWindowsMakefiles.cmd to generate *.mak for VS2005.

4. Modify liveMedia/RTSPOverHTTPServer.cpp to add the following code:
#if defined(__WIN32__) || defined(_WIN32)
#define snprintf _snprintf

5. Modify groupsock/Makefile.head. Change from "INCLUDES = -Iinclude -I../UsageEnvironment/include" to "INCLUDES = -Iinclude -I../UsageEnvironment/include -DNO_ST…

Java - Remote JConsole Connection To Linux

This is most likely a configuration problem on the Linux machine or the management properties specified to run the application.

You should check the following:

Check if the hostname correctly resolves to the host address.
Run "hostname -i" command. If it reports, JConsole would not be able to connect to the JVM running on that Linux machine. To fix this issue, edit /etc/hosts so that the hostname resolves to the host address.

Check if the Linux machine is configured to accept packets from the host where JConsole runs on to connect to the application.
Packet filtering is built in the Linux kernel. You can run "/sbin/iptables --list" to determine if an external client is allowed to connect to the JMX agent created for remote management. You can use the following command to add a rule to allow an external client such as JConsole to connect:

/usr/sbin/iptables -I INPUT -s jconsole-host -p tcp --destination-port jmxremote-port -j ACCEPT

where jconsole-host is either…

Java - Remote JConsole Connection

To perform remote JConsole Conenection, do the following

1. Add the following to JAVA_OPTS (I copied from my tsdebug). It will create RMI port at 8004. It will not ask for authentication"

2. Start JConsole and select remote process with the following connection URL


3. On successful connection, you will see your server IP at the top of the JConsole bar.

Java - Heap Dump

Memory is always an issue for software. Whenever it occurs, you will always find it difficult to track them down. If you are using Java6, you can use the following to as help

1. Include JVM options -XX:+HeapDumpOnOutOfMemoryError

This will create a heap dump whenever a OutOfMemoryException occurs. It will output a .hprof file at your root folder

Then, use jhat .hprof to analyze the heap dump. Jhat will analyze the heap dump file and create a server instance for analysis. Use your browser, http://localhost:7000/ to see heap information such as heap histogram.

2. Include JVM options -XX:+PrintGCDetails

This command will print current GC details on application output. Good to know what is the current status of the GC.

3. JConsole

JConsole is an application that can help you monitor your application real time. You can use JConsole to connect local or remote application for application monitor and analyze.

See the following for more details…

Create/Update/Remove Window Service in XP

To create/update/remove a window service, you can use SC in command prompt.

SC is a command line program used for communicating with the NT Service Controller and service

Type SC /help for more detail

iPhone - Reenable MMS Setting

To re-enable your carrier MMS setting, you need to enable Carrier Bundle Support on iTunes

1. Close your iTunes and go to command prompt
2. Navigate to you iTune installation folder, normally, it will be "C:\Program Files\iTunes\
3. Type iTunes.exe" /setPrefInt carrier-testing 1 and press enter
4. Restart iTune

Now, download your carrier ipcc file. provide good ipcc file for Singapore Carrier

Do the following to restore your carrier ipcc

1. Reset your network setting at Settings/General/Reset/Reset Network Settings
2. Plug in your iPhone and start up your iTunes.
3. Choose your iphone under “Devices”
4. Go to the “Summary” tab.
5. Hold “Shift” on your keyboard then click on “Restore”.
6. Under Pop-up Window, Change File Type to “Carrier configuration(*.ipcc)” and browse to your directory where you stored your downloaded ipcc file and select it.
7. Go to Settings/General/Network/ and see if Cellular Data Network appears
8. Power off and restart you…

Creating iPhone Ringtone

iPhone requires .m4r extension for ringtone. To create a customize ringtone, please do the following

1. Get your mp3 or any other sony file
2. Edit it to your liking. Please note that you have only 40s of ringtone
3. Use program such as Wavepad to edit is good
4. Convert the mp3 file to .m4a file.
5. Use program such as Swtich Sound Converter is good
6. Rename the .m4a to .m4r
7. Sync this .m4r file with iTunes to your iPhone

Check iPhone Bootrom Version

In order to check your IPhone Bootrom version, you must start your iPhone in DFU mode

How to put your iPhone in DFU mode :

1. Connect your iPhone to your computer.
2. Turn iPhone off.
3. Hold power and home together for 10 seconds (exactly).
4. Release power but keep holding home until the computers beeps (observed on a PC) as a USB device is recognized.
5. A few seconds later iTunes should detect your iPhone.
6. If the Restore Logo is present on the screen, you are in Recovery Mode, not DFU.
7. Go to Device Manager, USB Controller -> Apple Mobile Device USB Driver and right click Properties and goes to Details Tab. If it is at DFU mode, Device Description will say Apple Recovery (DFU) USB Driver
8. Now, goes to Device Instance Path USB\VID_05AC&PID_1227\CPID:8920_CPRV:15_CPFM:03_SCEP:03_BDID:00_ECID:000003E92601A3CF_SRTG:[IBOOT-359.3.2]
9. IBOOT-359.3.2 is the bootrom version

Checking IPhone Firmware

Checking IPhone firmware

1. Go to Setting -> General -> About

Entering IPhone field test mode, do the following

1. Enter *3001#12345#* at Phone menu and press Call button. It will enter field test mode