Tuesday, June 23, 2009

How to pass variables between HTML documents

The most common way is using the HTTP GET method, which is the default method when you just link to a page using (a href). The disadvantage is that your variables end up visible in the URL such as in www.google.com/search?oq=variable which can be messy and poses some security issues. Also it is sometimes difficult to dynamically change your established (a href) links with user input without a LOT of javascript code. Whatever you pass ends up in receiving document in the PHP $_GET[] array.

The next most common way is by using the HTTP POST method. However, this automaticaly POSTS all of the data in all of the input fields at once, without allowing you to specify priority based on client actions. Results end up in the $_POST[] array.

My preferred method is to set up a bunch of hidden input fields, like (input type="hidden" /) and then use JavaScript events such as onFocus, onBlur, or onClick to modify the contents and the priority of these fields. Then use the standard POST method and the contents of all these fields pops up in the next document in the PHP $_POST[] array. And you can easily debug by temporarily making these fields visible (type="text") and you can see how the javascript events modify your variables as you go in real time.

Monday, June 15, 2009

Assorted Useful Discoveries in No Particular Order

Here are a few helpful discoveries that took a lot of time to find but have saved me even more time in the end:

1. There is a PHP function that passes PHP arrays to javascript variable arrays: json_encode($array) It puts the PHP array elements in dble quotes, comma delimits them, surrounds the whole array with brackets, and puts sub-arrays into dot-delimited child elements. If only I had known a few weeks ago...

2. The current state of the art for printing web content wirelessly from an iTouch or iPhone is an app called "Print n Share" from EuroSmartz in New Zealand. I am testing it on an iTouch and it works extremely well.

3. The browser within Print n Share is a watered down Safari-Mini browser that Apple provides third party developers. As such, it lacks certain features, such as the ability to prompt users for their userid and password on secure sites. The workaround is: https://userid:password@www.website.com (I didn't know you could do that!! Actually, you can't do that with IE, for security reasons, unless you tweak your registry).

4. Apple does things in "obvious" ways that sometimes are so "obvious" they take me hours and hours to figure out. Some classic examples: How to eject a CD from a MAC. Where is the damn button?? Oh, there it is. There is an actual eject key on the keyboard !! Or here's another one: how to download an iTouch app? You generally don't do it on your computer!! That solves two hours of fruitless research. You use the "App Store" app right on your iTouch. Or, if you are installing an app that you bought yourself for another person's iTouch, how do you install it (there's the owner's password in the way)? You plug it into your USB port, go open iTunes, find the device, click on it, and then you are presented with an option to install/sync. And finally, my favorite: How to use the AC adaptor to charge it up? It wasn't obvious to me, but I guess it is intuitive to someone: you plug your USB cable directly into the AC adaptor, as if your wall socket was a USB port. Who knows? Isuppose there's data in there somewhere....

Tuesday, June 9, 2009

Networking Information

My router at work is set up as a wireless access point, with no physical connection to a PC. It is just hooked to the ethernet cable. It is configured with an encryptation key for security, and it connects to my work domain which I thought was inaccessible to XP home or Vista, until today.

I connected to the domain (yes, domain, not workgroup!) with XP home and with Vista (yes, not XP Pro) wirelessly with the following three simple steps:

1. Connect to the router using the encryptation key and verify internet connectivity.

2. While holding the "Windows Key" on the keyboard down, type the letter "R". This is the "shortcut to 'RUN' ".

3. Enter \\kap-02.companyname.phy (That's just the path to one of the domain computers).

This brings up the domain login which for me is companyname\myfirstinitialmylastname plus domain password. That's it. Then you can surf to the shared folder you need and view files. You can do this with multiple computers on the domain. I did it with a second computer with a shared laser printer. Surfed to the printer, opened it, connected, and selected it a my default printer just as if it was connected to my laptop.

If I find out the router settings I will post that. I did see that one can right click on my computer to bring up "map network drive" to assign say drive Z: to \\mydomaincomputerpath.

Sunday, June 7, 2009

iRotate from EnTech in Taiwan

Fantastic discovery! A simple application that rotates the display of any XP/Vista computer, including light-weight netbooks, to tablet-style orientation. Combine this with a Targus 2.4 GHz wireless optical mouse, and you can view documents in portrait orientation and navigate around very intuitively. You can hold the netbook sideways, like an open book, with the keyboard on the left and the screen on the right. The smaller netbooks are very light-weight and can be held very comfortably in one hand while open in this sideways orientation, like an open pamphlet. But unlike a tablet PC, you still have use of a full size real keyboard with no obstruction of the view of the document. If needed, the wireless optical mouse can be used to navigate and click even if still in your coat pocket with your free hand; or, you can take the mouse out of your pocket and move it on a desk.

So far I have just tested this with XP. The default settings work great. You end -up with hotkeys CTRL-ALT-leftarrow for rotation and CTRL_ALT-uparrow to restore, and on the MSI netbook the three keys are located conveniently together on the bottom right side of the keyboard. You can also toggle from the DOS command line as follow:

c:\Program Files\iRotate>irotate.exe /rotate=90

which got me out of a jam. (At first I had combined this application with the MSI netbook toggle for an external monitor (FN-F3) and my netbook was stuck in portrait mode). The documentation says you can control multiple moniters by editing the irotate.ini file and you can also assign the hotkeys to alternatives.
Documentation: c:\Program Files\iRotate\irotate.htm
Forum: http://forums.entechtaiwan.com

The cost: FREE.