Friday, March 5, 2010

upgrading to the latest version of wine for ubuntu 9.10

heres the link straight from winehq.com's site

http://www.winehq.org/download/deb

show html code on page

to show html code on page, you will need to replace the < with "&lt;" and the > with "&gt;"

that will render the code on the page as just html code

add google site search to your web site

heres the code to add the google search to your site. you will need to change "yoursite.com" to your domain name

<form action="http://www.google.com/search" method="get"> 
<input name="q" size="31" type="text" /> 
 maxlength="255" value="" />
<input type="submit" value="Google Search" /> 
<input name="sitesearch" type="radio" value="" /> 
 The Web
<input name="sitesearch" type="radio" /> 
 value="yoursite.com" checked /> Ask Dave Taylor

</form>

Thursday, March 4, 2010

install adobe flash player 10.1 beta in karmic

here is the link that worked for me: http://tuxarena.blogspot.com/2009/12/how-to-install-flash-player-101-beta-2.html

the instructions are below though:

sudo apt-get remove --purge flashplugin-installer

should remove your current installation of Flash. If Flash was installed manually, the plugin should be located in the ~/.mozilla/plugins directory, where ~ is the home directory. So, to remove it:

rm -f ~/.mozilla/plugins/libflashplayer.so

Next, download the archive for the new Flash player from here (direct link here), or alternately you can type in a terminal:

wget http://download.macromedia.com/pub/labs/flashplayer10/flashplayer10_1_p2_linux_121709.tar.gz

Make sure the current working directory is the one where you saved the archive and uncompress it:

tar -xzf flashplayer10_1_p2_linux_121709.tar.gz

Next, create the ~/.mozilla/plugins directory (if it doesn't already exist):

mkdir -p ~/.mozilla/plugins

And copy the plugin inside it:

cp install_flash_player_10_linux/libflashplayer.so ~/.mozilla/plugins

Now restart Firefox and this should be all.

Tuesday, March 2, 2010

get youtube video id from url

i had a task to show some youtube videos on a site and had problems reading the entire url due to the # and other characters in a youtube channel. so i wrote my function below to get the youtube video id

/**
     * Return video id for a youtube url
     *
     * @param string $url
     * @return string
     */
   
   
    function getYoutubeVideoId( $url ){
       
        $id_param = "v="; //video id starts after the equal sign
        $id_length = 11; //length of video id
        $id_param_pos = strpos( $url, $id_param ); // get position of v from the video param
        $id_param_pos += 2; //add 2 spaces to get actual video id
        $video_id = substr( $url, $id_param_pos, $id_length ); //gets id from entire youtube url
       
        return $video_id;
    }