Simple example how-to extend JavaScript built-in methods

Let say you want to replace all spaces in string by dashes,
of course you can implement distinct function that does it:



 function ReplaceByDashes(string){
    return string.replace(/\s/g,'-');
 }

 // run it
 var string = "Hello my beautiful world!";
 string=ReplaceByDashes(string);
 alert(string); 



However, we can add our custom method to string object that already built-in in JavaScript:



  if(typeof String.prototype.rbd==='undefined'){ // we have to check if someone hasn't added it already
     String.prototype.rbd = function(){
        return this.replace(/\s/g,'-');
     }
  }

 // run it

 var string = "Hello my beautiful world!";
 string=string.rbd();
 alert(string); 



Some useful example, capitalize first letter of string



String.prototype.ucFirst = function () {
  return (this.substr(0,1).toUpperCase() + this.substr(1,this.length));
}

How to align window's control buttons in Ubuntu 10.4 to left


gconftool-2 --set "/apps/metacity/general/button_layout" --type string "menu:minimize,maximize,close"

Opera 10.51 — The fastest browser on Earth

According to the last Peacekeeper bulletin new version of Opera Web Browser has reached an awesome record in their browser benchmark.
New score it is a result of polishing their new Java Script engine called «Carakan».

Full comparison table of different browser's scores:
http://service.futuremark.com/peacekeeper/results.action?key=3BYq

Opera's test record on Peacekeeper

Congratulations to Opera Desktop Team, that succeed to boost their browser for a such huge leap!
Don't wait and download a new world fastest browser right now.

iPhone SDK 3.2 showing first hints of multitasking for third-party apps?

Naturally, we need to first disclaim this noise by saying that rumors of third-party multitasking capability in the iPhone are as old as the iPhone SDK itself. That said, it's hard to ignore a new reference to a «multitasking dialog box» buried deep within the iPhone SDK 3.2 beta that — while not new to beta 4 specifically — we're told didn't exist in 3.1.3. Now, the wildest possible speculation would have us believing that this is the very first by-product of a new multitasking system for developers that's being developed for the platform, presumably destined for an appearance in OS 4.0 when it's introduced along with new hardware this summer — but it's just as likely that Apple will continue to keep the iPhone's multitasking capability to itself, a function it uses liberally among the phone and music apps, just to name a couple. For what it's worth, AppleInsider is citing a tipster claiming that Apple's got a «full-on solution» to multitasking that would properly address its main concern — battery life issues — for release this year, so maybe we'll be able to chuck those awful push notifications before we know it. Now if you'll excuse us, we'll be over here in the corner running a few dozen apps on our Pre Plus.
TUAW
9 to 5 Mac

After downgrade from Vista/win7 to WinXP you may see your HDD labeled as GPT

After downgrade from Vista/win7 to WinXP you may get your HDD inaccessible, if it's labeled as GPT
here is solution:

Start>Run>«cmd»>«diskpart»>«list disk»>«select disk x»>«clean»

Go back to disk management and you will then be able to format the hard drive and re-select NTFS partition

How to Remove (Hide) Users list at login Screen in Ubuntu 9.10 (Karmic)


sudo -u gdm gconftool-2 --set --type boolean /apps/gdm/simple-greeter/disable_user_list true

Java + Httpd + Tomcat + Sakai installation (step-by-step)

Please change paths according to your failsystem layout ;)

JAVA INSTALLATION:
— 1.
# cp jdk-1_5_0_22-linux-amd64.bin /srv
# cd /srv
# sh jdk-1_5_0_22-linux-amd64.bin
# ln -s jdk1.5.0_22 jdk

# updatedb;locate javac |grep bin
/srv/jdk1.5.0_22/bin/javac



( Continue )

How to Tunnel Remote Desktop Through SSH on a Windows Computer

What you need



Setting up PuTTY


  1. Start PuTTY (double-click on putty.exe). You will see a window similar to this one:
    "

  2. Next, enable compression. Select SSH protocol level 2 as the default in the SSH subcategory for better security:"


( Read more )

From web to PDF

Some of you who use eBook gadgets may be interested to meet service who let you generate a real PDF-file from any web page with one click only.

So, to receive PDF-version of your web-site all what you need is go to pdfmyurl.com, type URL and click «OK».
  • +1
  • January 20, 2010, 11:24am
  • touki
  • 1+1

Multiple tables deletion in Mysql using wildcards

I've found some solution on mysql website, how to delete multiple tables according to some condition, you will need it when you will want delete specific tables from your DB.



( Read more )