RSS .92| RSS 2.0| ATOM 0.3
  • Home
  • Contact Us
  • deviantART
  • Newsletter
  • Online Booking
  • Registration
  • Tell A Friend
  •  

    Javascript String Search

    June 17th, 2008

    object.search(regexp)

    This method is used to search for a match between a regular expression and the specified string. If a match is found, the search method returns the index of the regular expression within the string. If no match is found, a value of -1 is returned.

    The first example of code below uses the search method to look for a match between the regular expression ‘rExp’ and the characters in the ‘myString’ string object and displays the resulting value in the browser. In the second example, removing the ‘i’ (ignore case) flag from the regular expression causes the value of the search to be returned as -1

    Code:
    myString = new String(”Go to DevGuru.com”)
    rExp = /devguru.com/gi;
    results = myString.search(rExp)
    document.write(results)

    Output:
    6

    myString = new String(”Go to DevGuru.com”)
    rExp = /devguru.com/g;
    results = myString.search(rExp)
    document.write(results)

    Output:
    -1


    Fixing ffmpeg on Ubuntu

    June 17th, 2008

    Reference: https://wiki.ubuntu.com/ffmpeg
    For a litany of legal reasons, ffmpeg does not come with all of the necessary things enabled for you to encode video for the iPod Video by default. Therefore, we need to build it from source and install some other libraries and programs, as well. Make sure you have multiverse and universe enabled.

    sudo apt-get remove ffmpeg
    sudo apt-get install liba52-dev libdts-dev libgsm1-dev libvorbis-dev  libxvidcore4 \
    libxvidcore-dev libdc1394-dev libfaac-dev liblame-dev libx264-dev libfaad2-dev libtheora-dev \
    libsdl1.2-dev libmpeg4ip-dev
    wget http://ffmpeg.mplayerhq.hu/ffmpeg-export-snapshot.tar.bz2
    tar jxvf ffmpeg-export-snapshot.tar.bz2
    cd ffmpeg-export-*
    ./configure --prefix=/usr/local --disable-debug --enable-shared --enable-gpl --enable-postproc \
    --enable-swscale --enable-pthreads --enable-x11grab --enable-liba52 --enable-libdc1394 \
    --enable-libfaac --enable-libfaad --enable-libgsm --enable-libmp3lame --enable-libtheora \
    --enable-libvorbis --enable-libx264 --enable-libxvid
    make
    sudo make install

    Trying to compile ffmpeg from svn gives the following error:
    libavcodec/libx264.c: In function ‘X264_init’:
    libavcodec/libx264.c:224: error: ‘X264_ME_TESA’ undeclared (first use in this…

    Solved. Installing these two packages:
    http://www.brloh.eu/ubuntu/libx264-dev_0.svn20080408-0.0ubuntu1_i386.deb
    http://www.brloh.eu/ubuntu/libx264-59_0.svn20080408-0.0ubuntu1_i386.deb


    JW Flash Video Player

    June 17th, 2008

    Reference:
    - Flash Player
    - Example

    <div id=”flvcontainer”>
    <a href=”http://www.macromedia.com/go/getflashplayer”>Get the Flash Player</a> to see this player.</div>
    <script type=”text/javascript” src=”swfobject.js”></script>
    <script type=”text/javascript”>
    var s1 = new SWFObject(”mediaplayer.swf”,”mediaplayer”,”428″,”268″,”8″);
    s1.addParam(”allowfullscreen”,”true”);
    s1.addVariable(”width”,”428″);
    s1.addVariable(”height”,”268″);
    s1.addVariable(”file”,”pele.flv”);
    s1.write(”flvcontainer”);
    </script>


    HTML Meta Http-Equiv Refresh

    June 17th, 2008

    Specifies a delay in seconds before the browser automatically reloads the document. Optionally, specifies an alternative URL to load. E.g.

    <META HTTP-EQUIV="Refresh" CONTENT="3;URL=http://www.some.org/some.html">
    

    or (HTTP header)

    Refresh: 3;URL=http://www.some.org/some.html
    

    In Netscape Navigator, has the same effect as clicking “Reload”; i.e. issues an HTTP GET with Pragma: no-cache (and If-Modified-Since header if a cached copy exists).

    Note: If a script is executed which reloads the current document, the action of the Refresh tag may be undefined. (e.g. <body onLoad= “document.location=’otherdoc.doc’>)


    Rudy Cahayadi is Digg proof thanks to caching by WP Super Cache!