Wednesday, November 5, 2008

Shared object "libperl.so" not found, required by "plperl.so" in FreeBSD

If you get this error when you execute:

$ createlang plperlu some-database

-- [start: full error message] --
createlang: language installation failed: ERROR: could not load library
"/usr/local/lib/postgresql/plperl.so": dlopen
'/usr/local/lib/postgresql/plperl.so' failed. (Shared object "libperl.so"
not found, required by "plperl.so")
-- [end: full error message] --

You can simply execute:
# ln -s /usr/local/lib/perl5/5.8.8/mach/CORE/libperl.so /usr/lib/libperl.so

Saturday, October 25, 2008

Bluetooth Headset with Web Browsers and etc in MacOSX

It is weird that MacOSX does not have a good support for Bluetooth. I
have just bougth Sony Wireless Stereo Headset (Bluetooth) DR-BT22 from a
Sony Style store. My operating system version is MacOSX 10.5.5. By
default, this headset works well with Skype, X-Lite (an VoIP phone
software), iTunes (both local mp3 files and online radio), Quicktime, and
other standalone applications. However, I cannot listen to any online
music through any web browser (I tried Safari, Opera and Firefox). What
happened is that all the online music stopped working at all.

The problem is that I can't listen to any online music through any web
browser with my Bluetooth headset.

Luckily, I found this article:

http://macosx.com/forums/hardware-peripherals/296416-problems-using-bluetooth-headset-mac-audio.html

Here is the essential part of the article:
--------------------------------------------------------------------
First, 2 files needed,

a. a2dpcastAudioDevice.tgz:
http://www.coolatoola.com/a2dpcastAudioDevice.tgz

b. the updated a2dpcast: http://www.coolatoola.com/a2dpcast-0.3.zip

Then run terminal from Application/Utilities/terminal and install the
kernel extension for the audio device (replace DOWNLOAD_DIR with the path
to where your browser downloads stuff to) - you need your admin password
to do sudo:

1. cd /
2. sudo tar xfzp DOWNLOAD_DIR/a2dpcastAudioDevice.tgz --same-owner
3. sudo kextload /System/Library/Extensions/AudioReflectorDriver.kext


Copy a2dpcast to /usr/local/bin (replace A2DPEXTRACTDIR with the path to
where your extracted the downloaded a2dpcast-0.3.zip) - you need your
admin password to do sudo:

1. sudo cp A2DPEXTRACTDIR/a2dpcast-0.3/a2dpcast /usr/local/bin

Run a2dpcast with your Bluetooth address

1. /usr/local/bin/a2dpcast aa-bb-cc-dd-ee-ff 27

Keep a2dpcast running, leave the terminal open, then run whatever program
that you want, the sound will be streamed automatically to your headset.
Again, do not close the terminal until you have enough enjoying your
bluetooth headset
--------------------------------------------------------------------

To get your mac address of your Bluetooth Headset, you can go to:

Finder > Applications > Utilities > System Profiler > Bluetooth

There you find your headset model and the mac address of your headset is
there.

Hope that help!

Saturday, October 4, 2008

Windows XP Pro and IIS 6 Limitation as a Web Server

Recently, a server of our client was crashed due to an infection.  It is a Window$ 2003 Server.  We had to put the website back to the Internet as fast as possible.  To save time, we decided to set up the temporary website on a Windows XP Pro machine available at that time.  And this was our wrong decision.

After we had finished set up this temporary server on Windows XP Pro.  We made the website went LIVE.  Just a few minutes after, we then tried to browse the website.  What we saw is the website with a number of missing images.  And if we used 2 (or more) browsers to access the website at the same time (or almost the same time), we will get HTTP 403.9 error (Access Forbidden: Too many users are connected Internet Information Services).

This fucked us up (although everything had already been fucked up by the infected server).
Fortunately, we found this article:

http://weblogs.asp.net/cazzu/archive/2003/10/10/31476.aspx

In summary, IIS on Windows XP Pro, by default, it can accept only 10 connections at the same time.  However, there is a trick by running:

c:\inetpub\AdminScripts\adsutil set w3svc/MaxConnections 40

which will make IIS on XP Pro passes its limitation.  It can now accept 40 connections at the same time (but unfortunately 40 is the limit).

This saved us for a few hours and then we set up a new machine with Windows 2003 to solve the problem for real.

Note that a normal web browser when we use it to browse a webpage, it will create multiple connections to get several parts of the webpage in parallel which means 1 browser may create 2 (or more) connections to the webserver.

Window$ Bastards!

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 "61.90.255.132".

Thursday, September 18, 2008

alpine - email client

Looking for a text based email client?
Try alpine:
http://www.washington.edu/alpine/

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);

  $offset++;
  
  $current_page = round($offset / $limit);
  if ($offset % $limit != 0) {
    $current_page++;
  }
  
  $window = 10; # Number of visible pagers per page.
  
  $left_link_count;
  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> ";
        }
        
        $page_no++;
        $counter++;
      }
      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) {
    $number_of_pages++;
  }

  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 - http://mplayerosx.sourceforge.net/
  • Windows and Linux - http://www.mplayerhq.hu/

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>".

It WORKS!

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".

Sunday, August 17, 2008

Internet Explorer does not read my "hosts" file


If you experience this problem, you should try to restart Windows!

how to burn cd image in mac os x

  1. Insert a blank disc.
  2. Start Disk Utility.
  3. From the File menu, choose Open Disk Image and select the ISO to be burned.
  4. In the list of volumes, you will now see an item representing the ISO file. Select it.
  5. Click the Burn button and follow the instructions.

Monday, August 11, 2008

.app downloaded from torrent site does not work in MacOSX


Sometimes you might encounter a problem that you double click .app file in your MacOSX and nothing happens.  Mostly, the .app you download from a torrent site.  Those torrent files sometimes don't have proper file permissions.

Try this:

# cd ActiveState\ License\ Installer\ \[Intel\].app/Contents/MacOS
# chmod +x License

Related Resources:
http://www.demonoid.com/files/details/1529559/6976998/

Sunday, August 10, 2008

house music by dj caffeine

Try it!


this music playlist contains purely music from dj caffeine!

features:
  • Fuck On Cocaine
  • On The Floor
  • Give It To Me Harder
  • ...

Ignore Files and Directories in Subversion

svn propedit svn:ignore ./some_path

It will pop up a text editor for you to enter a list of files or directories you want to tell Subversion to ignore. An example of the list is:
  • *.class
  • access.log
note that the propedit can apply only on directory but not file

Friday, August 8, 2008

software for macosx

If you own a mac, you should try:


There are tons of software for MacOSX.

Download at your own risk!

Wednesday, August 6, 2008

Friday, August 1, 2008

Advanced Bash-Scripting Guide

Advanced Bash-Scripting Guide

by

Mendel Cooper

This is a must! For those who are coming to the *N*X world!

You should know how to write advanced BASH Script!!! No Excuse!

http://tldp.org/LDP/abs/html/

Thanks to The Linux Documentation Project

Apache user in Ubuntu Linux

Apache user (or web user) in Ubuntu Linux is: www-data

Normally, for any system, you can know which user is by:

$ ps aux | grep apache

root 5721 0.0 0.1 23324 1528 ? Ss Aug01 0:00 /usr/sbin/apache2 -k start
www-data 5798 0.0 0.0 23324 444 ? S Aug01 0:00 /usr/sbin/apache2 -k start
www-data 5799 0.0 0.0 23324 444 ? S Aug01 0:00 /usr/sbin/apache2 -k start
www-data 5800 0.0 0.0 23324 444 ? S Aug01 0:00 /usr/sbin/apache2 -k start
www-data 5801 0.0 0.0 23324 444 ? S Aug01 0:00 /usr/sbin/apache2 -k start
www-data 5802 0.0 0.0 23324 444 ? S Aug01 0:00 /usr/sbin/apache2 -k start
unsigned_nerd 15968 0.0 0.0 3008 776 pts/1 R+ 01:37 0:00 grep apache

You see? It is "www-data" in Ubuntu Linux...

What is it in your system?

Sunday, July 27, 2008

VMware Causing Keyboard Issues in Ubuntu

Refer to these threads:
My environments are:
  • Ubuntu Linux 8.04
  • X.org 1.4
  • VMWare 1.0.6 (Windows XP installed)
The problem is when you switch to the guest os and do anything for an undetermined period of time, after you switch back to your host os (i.e. Ubuntu Linux), your keyboard stops working properly.
People in those threads say that it is because the guest os does not release control from the keyboard layout to the host os.
From the threads above, ager-wick described his investigation result which is very useful for us.
By summarizing his test cases, I come to a solution that can solve my problem.
The solution that works for me is:
1. Disable these options inVMWare:
  • grab keyboard and mouse input on mouse click
  • grab keyboard and mouse input on mouse click
  • grab when cursor enters window
  • ungrab when cursor leaves window
2. Do this when switching between host os and guest os:
  • if you want to switch to the guest os, you press: ctrl + alt + enter
  • if you want to switch to the host os, you press: ctrl + alt
This way, we don't use automatic grabbing keyboard and mouse feature of VMWare which contains bugs.