Sunday, January 30, 2011

Chrome - Revive Closed Tab

If you closed your chrome tab accidentally, you can restore your last tab wth Ctrl + Shift + T (PC/Linux) or Cmd + Shift + T (Mac)

But, it does not work if you accidentally close your whole browser!!

.Net Framework - How to check the version installed

.Net Framework is needed for Microsoft Application development. Sometime, you may want to find what is the latest version installed in your machine. You can checked it at

\Microsoft.NET\Framework.

is the directory of your Window install path. Most of the time, it is C:\Windows

Inside this folder, it will have sub folders start with vXXXX, ie v3.5. The XXXX is the version installed and supported by your machine.

Thursday, January 6, 2011

RTSP - Basic Authentication

RTSP authentication use the implementation of HTTP authentication specified at RFC2617.

In RFC 2068, HTTP/1.1 section 11, provide details for Basic and Digeste authorization. However, RFC 2068 is obsolete and it will be better to read RFC 2617.

This entry only talks about Basic Authentication for RTSP.

Before understanding Basic RTSP authentication, you have to understand Basic HTTP authentication.

HTTP/1.1 Basic Authorization

When client access an unauthorized page, a Unauthorized 401 should be returned to the client. More importantly, the following header should be returned

WWW-Authenticate: Basic realm=your_realm

You should replace your_realm with your own security realm. Also, for HTTP page, it is recommended to return a HTTP Unauthorized 401 content with simple HTML code

Upon receiving the response, the client should retry with a username and password.

The credential format is username:password and this credential is Base64 encoded. The encoded credential should be placed in the following header

Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==

The server will Base64 decode the encode credential and perform its specific authentication process.

Below is a full example catch of Unauthroized 401 message


Below is a sample of HTTP header with Basic authorization




RTSP/1.0 Basic Authorization

Since RTSP/1.0 uses HTTP/1.1 authorization technique, it is rather simple to implement RTSP authentication.

RTSP authorization should be implement to all commands when it is enabled.

When a client send a RTSP commands, ie OPTION, to the server without authorization information, the server should response with a RTSP 401 unauthorized message with the following header

WWW-Authenticate: Basic realm=your_realm

You should replace your_realm with your own security realm.

Upon receiving the response, the client should retry with a username and password.

The credential format is username:password and this credential is Base64 encoded. The encoded credential should be placed in the following header

Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==

The server will Base64 decode the encode credential and perform its specific authentication process.

You should be feeling that the process is exactly the same as HTTP. The only different is they are communicating in RTSP protocol.

Below is an example of RTSP/1.0 401 Unauthorized response


Below is an example of RTSP/1.0 authorization message for SETUP command



The real trick is that all RTSP command requires a Authorization header.

Just an additional note, for RTSP over HTTP, you have to provide authorization header for authentication during POST and GET socket set up

Monday, January 3, 2011

Postgres - nonstandard use of \\ in a string error

If you see

WARNING: nonstandard use of \\ in a string literal
HINT: Use the escape string syntax for backslashes, e.g., E'\\'.

Changing all '\\' to E'\\' is a good solution.

However, it will be very tedious if you have a bunch of data. Worst case is when this happen to \n in Linux machine.

A faster fix will be as follow

1. Open postgresql.conf
2. Find #standard_conforming_strings=off. By default, it is commented out by # and set to off
3. Change it to standard_conforming_strings=on
4. Restart postgres

This will cause postgres to treat backslashes as normal character.

If you want postgres to treat backslashes as escape character after turning stardard_conforming_string to on, you must put an E in front. IE, E'this is \\n a string'

Oracle - Reclaim disk space

Oracle does not release disk space even if you had delete the data or tablespace. If you have enterprise manager, you should use it to  rec...