Archive for the ‘How To’ Category

To open a new window using javascript can use the following function. You just have to do is send the link and the window name.

function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == ‘string’)
href=mylink;
else
href=mylink.href;
window.open(href, windowname, ‘width=800,height=800,scrollbars=yes’);
return false;
}

The non-DOM property innerHTML can’t add options to a tag select in Internet Explorer.

Example not working:

document.getElementById("my_select").innerHTML 
= "<option value='1'>not</option> 
<option value='2'>work</option>"; 

The correct way to insert options in a select is using appendChild or addOption functions. But that’s tiring if we are working with Ajax.

Use innerHTML is not the standard but it is very useful.

The function above, will help you to insert options like using innerHTML, in IE, Firefox or Opera.

Updated: now supports option-selected

Using my function:

var inner = 
"<option value='1'>Now</option> 
<option value='2'>work</option>"; 


select_innerHTML(document.getElementById("my_select"),inner);

The function. Add to your lib.

function select_innerHTML(objeto,innerHTML){

    objeto.innerHTML = ""
    var selTemp = document.createElement("micoxselect")
    var opt;
    selTemp.id="micoxselect1"
    document.body.appendChild(selTemp)
    selTemp = document.getElementById("micoxselect1")
    selTemp.style.display="none"
    if(innerHTML.toLowerCase().indexOf("<option")<0){
        innerHTML = "<option>" + innerHTML + "</option>"
    }
    innerHTML = innerHTML.toLowerCase().
replace(/<option/g,"<span").replace(/<\/option/g,"</span")
    selTemp.innerHTML = innerHTML
      
    
    for(var i=0;i<selTemp.childNodes.length;i++){
  var spantemp = selTemp.childNodes[i];
  
        if(spantemp.tagName){     
            opt = document.createElement("OPTION")
    
   if(document.all){ //IE
    objeto.add(opt)
   }else{
    objeto.appendChild(opt)
   }       
    
   //getting attributes
   for(var j=0; j<spantemp.attributes.length ; j++){
    var attrName = spantemp.attributes[j].nodeName;
    var attrVal = spantemp.attributes[j].nodeValue;
    if(attrVal){
     try{
      opt.setAttribute(attrName,attrVal);
opt.setAttributeNode(spantemp.attributes[j]
.cloneNode(true));


     }catch(e){}
    }
   }
   //getting styles
   if(spantemp.style){
    for(var y in spantemp.style){
     try{opt.style[y] = spantemp.style[y];}catch(e){}
    }
   }
   //value and text
   opt.value = spantemp.getAttribute("value")
   opt.text = spantemp.innerHTML
   //IE
   opt.selected = spantemp.getAttribute('selected');
   opt.className = spantemp.className;
  } 
 }    
 document.body.removeChild(selTemp)
 selTemp = null
}

Sometimes you get those errors that just pick at you and you can’t seem to find a solution. It happened to me this morning when testing a JavaScript library I’m writing in IE7. FireFox worked without a hitch, but IE threw an ‘expected identifier, string or number’ error pointing to the last line of the variable declaration. Of course it didn’t help that my copy of MS Script Debugger wanted to lock up my computer.

 

Here’s a very shortened example of the code I was working on.

JavaScript:

  1. var variableName =
  2. {
  3. function1:   function()
  4. {
  5. //  Do something
  6. },
  7. function2:   function()
  8. {
  9. //  Do something else
  10. },
  11. variable1:    ‘Some value’,
  12. variable2:    ‘Another value’,
  13. };

The error was reporting a problem on line 13. So after hacking my way around trying to figure out why it was giving me this error, I went out Googling. About 10 pages into the search results I found the solution.

Look at line 12. See the comma after ‘Another value’? That’s what was causing the error. I had taken out a variable under that one but forgot to remove the comma. FireFox ignored the error, but not IE.

One little misplaced character, so much wasted time. Hopefully y’all will spend less time finding the fix than I did.

Google has just added the ability to drag-and-drop images from the desktop into a Google Docs document.

The new feature works with the latest versions of Google Chrome , Firefox and Safari, and Google says it plans to add support for other browsers soon. The feature works exactly as you would expect. Rather than importing an image using the web uploader, entering in a URL or doing a Google Image Search, you just drag the item from your desktop into your Google Docs document.

Drag-and-drop uploading is actually a pretty big win for a web app like Google Docs. Competitor Zoho supports drag-and-drop for some of its apps, but dragging an image into a Zoho Writer file just ends up inserting a local file address into the document.

The process works pretty well and we had no problem taking images from our Mac desktop and putting them in a Google Doc using both Safari 5.0.2 and the latest release of Google Chrome.

 
(more…)

Internet Browsing is one of the most common activates on computers nowadays and how many of us do spend most of the time searching for the features on menus? We have got a list of shortcuts which were used commonly among the users, which helps you save a lot of time. Learn them and have a faster browsing experience.

Navigation

  • Back – Backspace
  • Forward – Shift+Backspace
  • Home – Alt +Home
  • Open File – Ctrl+O
  • Reload – F5
  • Reload (override cache) – Ctrl+F5
  • Stop – Esc

Current Page

  • Go to Bottom of Page – End
  • Go to Top of Page    – Home
  • Move to Next Frame  –  F6
  • Move to Previous Frame  –  Shift+F6
  • Page Source    Ctrl+U
  • Print    Ctrl+P
  • Save Page As    Ctrl+S
  • Zoom In    Ctrl++
  • Zoom Out    Ctrl+-
  • Zoom Reset    Ctrl+0

Editing

  • Copy    Ctrl+C
  • Cut       Ctrl+X
  • Delete   Delete
  • Paste    Ctrl+V
  • Redo    Ctrl+YShift+Z
  • Select All    Ctrl+A
  • Undo    Ctrl+Z

Search

  • Find    Ctrl+F
  • Find Again    F3
  • Find As You Type Link    ”
  • Find As You Type Text    /
  • Find Previous    Shift+F3
  • Web Search    Ctrl+K

Windows & Tabs

  • Close Tab    Ctrl+F4
  • Close Window    Alt+F4
  • Move Tab Left (when tab is focused)    Ctrl+Left Arrow
  • Move Tab Right (when tab is focused)    Ctrl+Right Arrow
  • Move Tab to Beginning (when tab is focused)    Ctrl+Home
  • Move Tab to End (when tab is focused)    Ctrl+End
  • New Tab    Ctrl+T
  • New Window    Ctrl+N
  • Next Tab    Ctrl+Tab
  • Open Address in New Tab (from Location Bar or Search Bar)    Alt+Enter
  • Previous Tab    Ctrl+Shift+Tab
  • Undo Close Tab    Ctrl+Shift+T
  • Select Tab (1 to 8)    CtrlAltCmd+(1 to 8 )
  • Select Last Tab    Ctrl+Alt+9

Tools

  • Bookmark All Tabs    Ctrl+Shift+D
  • Bookmark This Page    Ctrl+D
  • Bookmarks    Ctrl+B
  • Library window    Ctrl+Shift+BO
  • Caret Browsing    F7
  • Downloads    Ctrl+J
  • History    Ctrl+H
  • Toggle Private Browsing    Ctrl+Shift+P
  • Clear Recent History    Ctrl+Shift+Del
  • Error Console    Ctrl+Shift+J

Miscellaneous

  • Complete .com Address    Ctrl+Enter
  • Complete .net Address    Shift+Enter
  • Complete .org Address    Ctrl+Shift+Enter
  • Delete Selected Auto-complete Entry    Shift+Del
  • Help    F1Cmd+?
  • Select Location Bar    Ctrl+L
  • Select or Manage Search Engines (when Search Bar is focused) F4

Firefox does not provide any method of customizing keyboard shortcuts. But they are all optimized for the best practices and user friendliness. Hope this can give a value addition to your internet browsing experience.

If you are using Ubuntu Karmic, Lucid, or even the newly released Maverick, you should already have Ubuntu One installed in your computer. While Ubuntu One has become an useful tool in syncing your files/folders/music, most of the time, we are left guessing whether the sync is working or not. Wouldn’t it be great if there is an indicator or system tray icon (just like Dropbox) that tells us that the syncing is in progress or completed?

To address this problem, Roman has come up with the UbuntuOne indicator package that show the sync status of Ubuntu One in the system tray.

Note: The package is only meant for Ubuntu Lucid and Maverick.

(more…)

Computer Laptop Battery Care and Usage Tips for getting more from a notebook battery.

1. Turn off Wi-Fi and BlueTooth – Most laptops have shortcut keys to instantly disable wireless networking.

2. Don’t play computer games, music or DVD movies – Multimedia activities drain laptop batteries.

3. Disconnect all external device like PC Card modems, Firewire, USB devices and optical drives. Use the notebook touchpad instead of an external mouse.

4. Adjust your screen brightness – Dimming your display saves battery power.

5. Tweak Windows Power Options – Choose a Laptop power scheme that turns off the notebook monitor and hard disk after 10 minutes of inactivity.
(more…)

This howto explains howto install Google Chrome Web browser on Fedora 12, Fedora 13 and Red Hat 6 (RHEL). Best way to install and keep up-to-date with Google Chrome browser is use Google’s own YUM repository.
(more…)

Would you like to download pictures from your Facebook account and your friend’s Facebook pages? Here’s a nice web app that can help you quickly download your pictures so you can use them anyway you want.

Getting Started

If you’d like to download pictures from your Facebook account and your friends pages, Pick&Zip is a great tool that lets you download as many pictures as you want in a zip or PDF file. Head over to the Pick&Zip site to get started (link below), and click the Login with Facebook button near the bottom of the page.


(more…)

Have you given Google Wave a try, only to find it difficult to keep up with? Here’s how you can integrate Google Wave with your desktop and workflow with some free and simple apps.

Google Wave is an online web app, and unlike many Google services, it’s not easily integrated with standard desktop applications. Instead, you’ll have to keep it open in a browser tab, and since it is one of the most intensive HTML5 webapps available today, you may notice slowdowns in many popular browsers. Plus, it can be hard to stay on top of your Wave conversations and collaborations by just switching back and forth between the website and whatever else you’re working on. Here we’ll look at some tools that can help you integrate Google Wave with your workflow, and make it feel more native in Windows.

Use Google Wave Directly in Windows

What’s one of the best ways to make a web app feel like a native application? By making it into a native application, of course! Waver is a free Air powered app that can make the mobile version of Google Wave feel at home on your Windows, Mac, or Linux desktop. We found it to be a quick and easy way to keep on top of our waves and collaborate with our friends.
(more…)