Monday, September 29, 2008

TrueNetTalk and X-Lite on MacOSX

TrueNetTalk is an VoIP software provided by a telephony company in Thailand.  The package comes with a silly support that provides a client software that can be runned only on Windows.
VoIP is a standard protocol that does not depend on the client software.
A famous VoIP client is X-Lite which has a MacOSX version.
The trick is that you have to use "".

Thursday, September 18, 2008

Sunday, September 14, 2008

CASIO: Module Number 1477 - Data Bank 150

This 150-page databank watch makes it easy to keep important information within reach. World time capability gives you the peace of mind that you'll always know what time it is, even if you've travelled halfway around the world. All of this and the 8-digit calculator make you feel like you've taken an assistant with you on the road.

It's a cool watch!  I feel like I am 10 years old with it!

UNIX Command - FIND

There will be a time when you need to execute a command (or commands) for each file that matches a specific criteria.  UNIX has a good tool to accomplish this task by default.

Assume that you want to grant execute permission for group in every *.cgi file in the current directory (recursively).  You use this command:

$ find . -name *.cgi -exec chmod g+x '{}' \;

Pagination in PHP

For every website project, you will have to write a pagination (for navigating to other pages).  You will need to use an algorithm for a pagination.  Here is my algorithm which you can copy and paste into your project:

function get_pagination($offset, $limit, $number_of_all_items, $page_string, $url) {
  $pagination = '';
  $number_of_pages = ceil($number_of_all_items / $limit);

  $current_page = round($offset / $limit);
  if ($offset % $limit != 0) {
  $window = 10; # Number of visible pagers per page.
  if (($current_page - 1) > round($window / 2)) {
    $left_link_count = round($window / 2) - 1;
  else {
    $left_link_count = $current_page - 1;
  $page_no = $current_page - $left_link_count;
  if ($page_no > 1) {
    $pagination .= "<<";
  $counter = 0;
  $break = false;
  if ($number_of_all_items != 0) {
    while (!$break && ($counter < ($window - 1))) {
      if ($page_no <= $number_of_pages) {
        if ($page_no == $current_page) {
          $pagination .= " " . $page_no . " ";
        else {
          $pagination .= " <a class=\"button_link\" href=\"" . $url . "&" . $page_string . "=" . $page_no . "\">" . $page_no . "</a> ";
      else {
        $break = true;
  if ($page_no < $number_of_pages) {
    $pagination .= "&gt;&gt;";
  return $pagination;

# Print "previous page"/"next page" link for pagination.
function print_previous_page_next_page_for_pagination($current_page, $limit, $number_of_all_items, $page_string, $url) {
  $number_of_pages = $number_of_all_items / $limit;
  if ($number_of_all_items % $limit != 0) {

  if ($current_page == 1) {
    echo "<span class=\"previous_page_next_page_arrow_off\">&lt;&lt;</span>";
  else {
    echo "<span class=\"previous_page_next_page_arrow_on\" title=\"" . htmlspecialchars($TEXTS['PAGINATION_PREVIOUS'], ENT_QUOTES) . "\"><a href=\"" . htmlspecialchars($url, ENT_QUOTES) . "&page=" . ($current_page - 1) . "\">&lt;&lt;</a></span>";
  echo "&nbsp;&nbsp;&nbsp;&nbsp;";
  if ($current_page == $number_of_pages) {
    echo "<span class=\"previous_page_next_page_arrow_off\">&gt;&gt;</span>";
  else {
    echo "<span class=\"previous_page_next_page_arrow_on\" title=\"" . htmlspecialchars($TEXTS['PAGINATION_NEXT'], ENT_QUOTES) . "\"><a href=\"" . htmlspecialchars($url, ENT_QUOTES) . "&page=" . ($current_page + 1) . "\">&gt;&gt;</a></span>";

To use it:

$pagination = get_pagination($offset, G_NUMBER_OF_SEARCH_RESULTS_PER_PAGE, $number_of_all_results, 'page', 'article_search.php?action_type=search&article_name=' . urlencode($article_name));

$offset is the offset in your sql select query.
G_NUMBER_OF_SEARCH_RESULTS_PER_PAGE is the maximum number of rows (that is LIMIT) in your sql select query.
$number_of_all_results is the number of all results of your sql select query without LIMIT.
'page' is the name of the variable you want to use as an HTTP GET variable to store the current page the user is in.
The last parameter is the URL you want for each link.

How to Watch Incomplete Downloaded Movie

Many times when you are downloading porn movies from your favorite torrent trackers, you will want to see the movies although they are not completely downloaded.  But with your default movie players, you won't be able to watch.

There is a killer application that you can use to watch those incomplete downloaded movies.  I proudly present "MPlayer" for you guys!

"MPlayer" is ready for several platforms (in pre-compiled versions):

  • MacOSX -
  • Windows and Linux -

Some Linux distributions might already contain MPlayer in their repositories.  For example, Ubuntu Linux has MPlayer in its software repository.

Enjoy your free movies!

Thursday, September 11, 2008

Apple Mail Font Problem with Microsoft Outlook and the Rest of the World

People have a lot of problems when they have to send emails from Apple Mail to the recipients that use Microsoft Outlook as their email client.  The problem is that the font that is shown to the recipients who use Microsoft Outlook will be Times New Roman 12pt regardless of whatever font you set with Apple Mail Preferences.

As I searched from Google, I found 3 interesting threads:

The #1 link says that the Font that we see in Apple Mail is shown correctly in Outlook only the signature part.

The #2 link says that we can use Stationery to accomplish the same result like #1 link but the problem is:

The #3 link says that we can use the Stationery only when we Compose a new email.  This means when we forward or reply the email, we can't use this method.

I have come up to a working solution which is quite easy.   I use Signature to solve this problem.

I created a signature with Verdana font like this:

> Hi _,
> <put content here>
> Thanks,
> unsigned_nerd

Then every time I compose a new email or reply/forward an email, the signature will show up and I put my email message in the "<put content here>".


NOTE THAT we can use only Fonts that don't have a space in their name and exist in Windows.

For example, I can't use "Courier New" but I can use "Courier".