Tuesday, March 03, 2009

Mac: Google Chrome on OS X

Yeah, like all Mac users I'm angry too. There is no mac version of Google's Chrome browser. Google has yet to release it for OS X, but here is the good news. Chrome's opens source version known as Chromium's source tree is open. So anyone can download it and try it out for themselves. Its far from finished, but you can at least get your hands dirty with Chromium in OS X.

Here are some links you'll need to get started.

http://code.google.com/p/chromium/wiki/MacBuildInstructionshttp://dev.chromium.org/developers/how-tos/get-the-code

Or if you are lazy like me, download the already built dmg image from this link.

Monday, March 02, 2009

Safari: Checking iPhone Version of Your Site Right from Safari

I must say, I'm greatly impressed at the new public beta release of Apples Safari's version 4. Tons of new features proved that its living up to expectations. Some notable features that caught my eye were, firebug like web inspector, new intuitive tabbed browsing, and some cosmetic features like cover flow like history browsing and opera like top site marker (Check out the screen-shot below)




To enable the debug menu, you need to enable it from the preferences tab.
You'll see a new "Develop" menu has appeared. Now to the thing what this post is all about. From the Develop menu, set your user agent to "Mobile Safari".


Now just go to any site that has special pages for iPhone, my Gmail Looks like this.


And this is my how my Facebook profile looks in iPhone.

And you never had to use an iPhone to check it out.

Friday, January 16, 2009

Tips: Download iPhone SDK with wget

Since its final release, I've been trying to download iPhone's SDK from Apple's website. The whopping 1.6 GB download seems a pretty daunting task in my unstable line, and some of apple's web sites features made it pretty impossible in no time.

My download failed three times after 50-70% completion, each time either I have manually paused the download for some reason or my connection was having some problem. And apples server did not give me any resume feature in any of the download  managers. Downloading 1.6 GB with Firefox's own download manger seemed an option, but what if Firefox crashes?

At last, I thought of giving good ol' wget a try and it didn't fail me. If you are in a similar situation like me, try this.
  1. Downlaod 'Export Cookie' addon for firefox from here
  2. Log into iPhone Developer Site using your apple developer account, if you don't have one, just register, its free.
  3. Export your cookie using the addon to a file named 'cookies.txt'
  4. Run this from the command line

    wget --limit-rate=5k --tries=inf -server-response --continue --load-cookies cookies.txt http://adcdownload.apple.com/iphone/iphone_sdk_for_iphone_os_2.2__9m2621__final/iphone_sdk_for_iphone_os_2.2_9m2621_final.dmg

Now you can pause and resume the download at your will. I have used --limit-rate=5k so that I can also browse without much overhead.

Wednesday, January 14, 2009

Javascript: Getting Current Window Dimension

Javascript function to get current window height and width. Works with most of the browsers.




// function to get the current width of the window
function getWidth(){
var x = 0;
if (self.innerHeight){
x = self.innerWidth;
}else if (document.documentElement && document.documentElement.clientHeight){
x = document.documentElement.clientWidth;
}else if (document.body){
x = document.body.clientWidth;
}
return x;
}

// function to get the current height of the window
function getHeight(){
var y = 0;
if (self.innerHeight){
y = self.innerHeight;
}else if (document.documentElement && document.documentElement.clientHeight){
y = document.documentElement.clientHeight;
}else if (document.body){
y = document.body.clientHeight;
}
return y;
}

Monday, October 06, 2008

System Admin: EDGE/GPRS via Bluetooth in Linux Simplified

This is an update to one of my earlier posts. I was trying to find a more portable way with wvdial and came up with this.

Start with the same command,

$hcitool scan

We get some info
<code>Scanning ...<br /> 00:1D:FD:36:9E:DB 3110c Emerald<br /></code><br />
Here "00:1D:FD:36:9E:DB" is the blue-tooth address of my phone.

Time to put this address into good use. We're going to bind this blue-tooth address with a specific device identifier.

$sudo rfcomm bind 0 00:1D:FD:36:9E:DB 1

Let me put some light into this command, the second argument in this command (in this case 0) is the device identifier, the third is the blue-tooth address (distinct for each device) and the fourth is the channel number which is typically 1.

After executing this command this mobile phone is directly accessible through /dev/rfcomm0

As said earlier, we are going to use wvdial this time. But we need to do another trick.

$sudo ln -s /dev/rfcomm0 /dev/ttyS4

Now we just run

$sudo wvdialconf

You should see some output in the terminal

Editing `/etc/wvdial.conf'.

Scanning your serial ports for a modem.

ttyS0<*1>: ATQ0 V1 E1 -- failed with 2400 baud, next try: 9600 baud
ttyS0<*1>: ATQ0 V1 E1 -- failed with 9600 baud, next try: 115200 baud
ttyS0<*1>: ATQ0 V1 E1 -- and failed too at 115200, giving up.
Modem Port Scan<*1>: S1 S2 S3
WvModem<*1>: Cannot get information for serial port.
ttyS4<*1>: ATQ0 V1 E1 -- OK
ttyS4<*1>: ATQ0 V1 E1 Z -- OK
ttyS4<*1>: ATQ0 V1 E1 S0=0 -- OK
ttyS4<*1>: ATQ0 V1 E1 S0=0 &C1 -- OK
ttyS4<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK
ttyS4<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
ttyS4<*1>: Modem Identifier: ATI -- Nokia
ttyS4<*1>: Speed 4800: AT -- OK
ttyS4<*1>: Speed 9600: AT -- OK
ttyS4<*1>: Speed 19200: AT -- OK
ttyS4<*1>: Speed 38400: AT -- OK
ttyS4<*1>: Speed 57600: AT -- OK
ttyS4<*1>: Speed 115200: AT -- OK
ttyS4<*1>: Speed 230400: AT -- OK
ttyS4<*1>: Speed 460800: AT -- OK
ttyS4<*1>: Max speed is 460800; that should be safe.
ttyS4<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK

Found a modem on /dev/ttyS4.
Modem configuration written to /etc/wvdial.conf.
ttyS4: Speed 460800; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"

Open up /etc/wvdial.conf with your favourite text editor and add this line

Init3 = AT+CGDCONT=1,"IP","gpinternet"

Set phone number to *99***1# and Username and Password to anything you like.

At last run

$sudo wvdial

If you did everything right, you would see samilar output to this

--> WvDial: Internet dialer version 1.60
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Sending: AT+CGDCONT=1,"IP","gpinternet"
AT+CGDCONT=1,"IP","gpinternet"
OK
--> Modem initialized.
--> Sending: ATDT*99***1#
--> Waiting for carrier.
ATDT*99***1#
CONNECT
~[7f]}#@!}!} } }2}#}$@#}!}$}%\}"}&} }*} } g}%~
--> Carrier detected. Waiting for prompt.
~[7f]}#@!}!} } }2}#}$@#}!}$}%\}"}&} }*} } g}%~
--> PPP negotiation detected.
--> Starting pppd at Mon Oct 6 12:22:38 2008
--> Pid of pppd: 17504
--> Using interface ppp0
--> pppd: ا[06][08][08]�[06][08][08]�[06][08]
--> pppd: ا[06][08][08]�[06][08][08]�[06][08]
--> pppd: ا[06][08][08]�[06][08][08]�[06][08]
--> pppd: ا[06][08][08]�[06][08][08]�[06][08]
--> local IP address 10.130.11.226
--> pppd: ا[06][08][08]�[06][08][08]�[06][08]
--> remote IP address 10.6.6.6
--> pppd: ا[06][08][08]�[06][08][08]�[06][08]
--> primary DNS address 202.56.4.120
--> pppd: ا[06][08][08]�[06][08][08]�[06][08]
--> secondary DNS address 202.56.4.121
--> pppd: ا[06][08][08]�[06][08][08]�[06][08]


Fire up your browser and enjoy the net.

[Update: Some have reported that the DNS don't get updated automatically, in that case you might need to update /etc/resolv.conf file manually.]

Friday, September 12, 2008

MacOS X: iSync AppleScript

I wanted to run iSync Priodically everyday so that my mobile and MacBook get synced regularly, this is what I found after some googling:

tell application "System Events" to set isync_running to (name of processes) contains "iSync"
<code><br />tell application "iSync"<br />  activate<br />  if isync_running is not true then<br />      tell application "System Events" to set visible of process "iSync" to false<br />  end if<br />  synchronize<br /><br />  repeat until syncing is false<br />      delay 1<br />  end repeat<br /><br />  if sync status is 2 then<br />      if isync_running is false then<br />          quit<br />      end if<br />  else<br />      activate<br />  end if<br />end tell<br /></code>

save the file with a .scpt extension and add the script in iCal to run every day.

Saturday, July 19, 2008

Tips: Run Linux apps in Mac OSX Seamlessly

I have been using Vmware Fusion to run Ubuntu 8.04 and Windows XP for a while. I really like the idea of Unity while using Windows in Vmware as it seamlessly integrates Windows and Mac OSX apps.


I was a little sad to find out there is no such feature for Linux. Guess what, I was wrong. While I was fiddling with different ssh options, I came across a feature called X11 forwarding. With the use of X11 forwarding, its easy to accomplish the same effect. All you need is just add '-X' option while you ssh and make sure you have a working X11 environment installed in your Leopard.


$ssh -X zaher@172.16.90.128


Its as simple as that. After login, just run any graphical program you want like a native application. You can also disable X11 in your VM since it has the added benefit of using low memory than usual as no X11 us running in your Virtual Machine.


Here is a screenshot of Firefox, Gimp and OpenOffice.Org running from my Ubuntu Hardy Heron in Leopard.



Back to Blogging

After a failed attempt last year to get back to blogging, I'm trying it again this year. I really wanted to get back, but got busy will...