HP Unveils Non-Computer For Those Who Don’t Need A Computer


Perfect.

Though I think HP should put a lot of thought into their End User License Agreement where they talk about tech support. Defining what exactly constitutes “doing nothing” might be harder than defining “something”. There would be no end of users calling complaining that their non-computer “mocked me” or “got dusty”.

HP Unveils Non-Computer For Those Who Dont Need A Computer | The Onion – Americas Finest News Source.

10 curses of the analytical thinker


This is too comically on-target for me not to share. If you’ve ever been curious about some of the how’s and why’s of me, here is a decent primer.

Remember, no stereotype is completely accurate; this one is about 87% accurate for me, but I’m not done analyzing it yet. I’ll get back to you, via email, in 2017 when I come to a decisive answer.

TechRepublic.com – 10 curses of the analytical thinker

Add some silence to the standard HTC Incredible ring tones

I’ve had the HTC Incredible for about six months and really like it. Solid device, good voice quality, and the Sense UI. As my first Android phone (I was a Blackberry user) it’s been great.

HTC Incredible

But one thing I can’t stand is the standard ring tones. I don’t use music ringtones for professional reasons and because they’re just plain annoying. The Incredible’s four Standard ringtones are phone-like enough and generally acceptable except they’re so crazy insistent. With no delay between rings the phone sounded positively pissed that no one could be bothered to answer it before the first ring cycle ended. (And drove my wife crazy, too.)

I don’t know of a way to control the delay between ring cycles, so I just added some silence to the mp3’s. I think the result is so much better that I can’t help but believe this is one of those many areas of Android which Google and HTC left alone with the expectation that “we” would make it ready for primetime.

Note: I think you need to root your phone to do this, at least to do it the way I did. I used adb push to put the modified files on the phone. For that I needed to mount the system as writable. There’s probably an app to do this (and maybe to edit the files too?) but I was already rooted so adb made sense. (adb is part of the Android sdk.) Guides and info on rooting the Incredible here and here.

I wasn’t satisfied with a simple static-length silence so I cast about for some interesting way to determine how long to make each. For no particular reason except that it looked interesting (I first tried π but it seemed too apple-y) I experimented with the Golden Ratio and liked the results. The formula I finally used looks like this:

Total track length = length of sound multiplied by twice the golden ratio.

Or:

total = sound * 2φ

So:

length of silence = sound * 2φ - sound

Here are the numbers.

You’ll find the files in /system/media/audio/ringtones, named Standard_1.mp3, etc.

I’ve never had need to edit mp3’s so I searched SourceForge and found Audacity. It was perfect for this use and simple enough to use quickly. The version current at the time of this writing is Audacity ® 1.3.12-beta (Unicode).

Here are the modified files. Feel free to throw them on your phone or play with them yourself. (You’ll need to loop them to get a feel for the real ring.)
gb_Standard_1
gb_Standard_2
gb_Standard_3
gb_Standard_4
All four zipped here.
Audacity project files here.

Launching VMware remote console from a batch script

For a long time I’ve used this method to deal with starting and stopping the VMware Server 2 services on-demand. My habit was to log into Web Access, start/resume the guest, and launch the Remote Console from there. I recently started using VM shortcuts to launch the Remote Console directly, instead of logging into the VMI Web Access client first. When I’m not making configuation changes, the shortcuts get me to the VM desktop quicker. Naturally, once I saw how simple the shortcut syntax is, I wanted to streamline everything with a script to manage the services the same way I do with the Web Access, and cut out the Web Access piece completely.

The command to launch the Remote Console looks like this.
Linux:
vmware-vmrc -h [<hostname>] [-u <username> -p <password>] [-M <moid> | <datastore path>]

Windows:
vmware-vmrc.exe -h <hostname> [-u <username> -p <password>] -M <moid> | <datastore path>

The user/pass combo is optional. If it’s not passed from the command line you’ll be prompted each time.

You can identify the VM either by the Managed Object ID (MOID) or datastore path, you don’t need both. As I mentioned in that previous post, I can’t get the user/pass to work from the command line unless I use the datastore path. I saw some mention in the forums this might be caused by these guests having been created by the 1.x Server version. Try the MOID and see if it works for you.

You’ll need two bits of info to modify my script to work for you: the path to vmware-vmrc.exe and either the MOID or datastore location.

  • vmware-vmrc.exe: Create a shortcut using the Generate Virtual Machine Shortcut command, then look at the Properties for the shortcut. This is an easy way to confirm the path to vmware-vmrc.exe and find the MOID. You can chuck this shortcut after copying the path.
  • MOID: You can also find the MOID for a VM by looking at vmInventory.xml in /etc/vmware/hostd/ under Linux or %ALLUSERSPROFILE%\Application Data\VMware\VMware Server\hostd under Windows.
  • Datastore path: In the VMware Infrastructure Web Access client, select the VM and click Configure VM. On the General tab, the datastore path will look something like this:
    [standard] <folder>/<name>.vmx

    datastore

Optional

I added a special user to my system and use that user/pass combo on the command line. You don’t have to do this. You can either omit the -u and -p switches from the command line (and enter them at the prompt each time) or use the existing user/pass on the command line. This assumes you’ve been logging into the web client successfully.

I chose to do it this way because I wanted the ease and speed of passing credentials on the command line but did not want to expose my normal account’s password in plaintext.

Add a non-priveleged user to the windows system. This is a Home Premium workstation so I have to make do with the simplified user management and have not added it to a group.
Add that user as an Administrator in VMware:

  1. Select the host object | Permissions tab
  2. Select the User
  3. Change the Role to Administrator
  4. datastore

It makes sense that some reduced permissions level would allow you to launch the remote console but I haven’t experimented yet.

Once you make sure you can log into VMI Web Access with this account, put your info in the script and give it a spin.

My habit, when I’m done with a vm, is to select VMware Remote Console | Troubleshoot | Suspend and Exit (or Power Off and Exit). This tells the vm what to do and exits the console in one step. (Once the console exits, the rest of the script gets evaluated.)

I’ve had no problems using these scripts on the two main systems I work with, both running VMware Server 2.0.2:

  • Win7 Home Prem SP1 x64
  • WinXP Pro SP3 x86

Special bonus, no charge – I added a quick test to the end of the script that simply leaves the VMware server services running if there was more than one guest VM running. This way the services only get stopped when they’re not needed. Be aware it’s not yet smart enough to know if the web client is running.

vmware_merlin.bat

@echo off

REM **** Check if Tomcat is running. If so, assume all VMware server services are running. Otherwise,
REM ** start them.
tasklist /FI "IMAGENAME eq tomcat6.exe" 2&amp;amp;amp;gt;NUL | find /I /N "tomcat6.exe"&amp;amp;amp;gt;NUL
if %ERRORLEVEL%  equ 0  (
    REM ** Tomcat is running, just get on with it.
    echo Tomcat is running, getting on with it.
	) else (
		REM **** Start VMware services ****
		net start VMwareServerWebAccess
		net start vmauthdservice
		net start VMwareHostd
		net start vmnetdhcp
		net start "vmware nat service"

		REM ** Let's wait a couple--ok, alot--of jiffys to let Tomcat get ready
		REM ** x * 1000 is Number of miliseconds to wait
		&amp;amp;amp;gt; "%Temp%.\sleep.vbs" ECHO WScript.Sleep 2 * 1000
		CSCRIPT //NoLogo "%Temp%.\sleep.vbs"
		DEL "%Temp%.\sleep.vbs"
		)

REM **** Start Remote Console ****
REM ** This passes the username/password of a user with login permission in VMI and calls
REM ** the guest by the datastore path. I couldn't get the user/pass to work when calling
REM ** the guest by the Managed Object ID.

"C:\Program Files (x86)\Common Files\VMware\VMware Remote Console Plug-in\vmware-vmrc.exe" -u vm -p test1234 -h zaphod:8333 "[standard] merlin/merlin.vmx"

REM **** Check if any guests are running. If so, leave the VMware server services alone. Otherwise,
REM ** stop them.
tasklist /FI "IMAGENAME eq vmware-vmx.exe" 2&amp;amp;amp;gt;NUL | find /I /N "vmware-vmx.exe"&amp;amp;amp;gt;NUL
if %ERRORLEVEL%  equ 0  (
	REM ** Leave VMware services running and exit **
	echo Another guest is running
	) else (
		REM ** Stop VMware services **
		net stop VMwareHostd
		net stop vmauthdservice
		net stop vmnetdhcp
		net stop "vmware nat service"
		net stop VMwareServerWebAccess
		)

As with the Server script, I call it through this snippet to get rid of the command window.

vmware_merlin_launch.js

var WindowStyle_Hidden = 0
var objShell = WScript.CreateObject("WScript.Shell")
var result = objShell.Run("cmd.exe /c vmware_merlin.bat", WindowStyle_Hidden)

Start and stop VMware Server 2 services automatically

I use the free VMware Server for a few test and dev purposes on my laptop, but I don’t have any VMs that run all the time. So of course it annoys me to have the VMware Server services running the rest of the time, just sitting around twiddling their thumbs. I’m absolutely certain it takes some of my system resources for them to shoot virtual spitballs at each other in their boredom.

At first I simply scripted the starting and stopping of those services so I could manage them easily when I wanted to. As is usually my way, what originated as two separate scripts (one of net start commands and one of net stop commands, run manually), eventually morphed into a thing with little bits of logic that controls everything from the start of my server use through to the end.

A mis-named couple points of interest:

  • When I added the browser launch statement after starting the services, I found I needed to delay a couple seconds to reliably get the login screen. I’ve only used this script on a couple laptop hosts so try it without this delay on your system, in case it’s something weird with mine.
  • The script will sit at the IE launch statement until you close the last instance of the browser. Since I only use IE for the VMware Infrastructure Web Access, and so it’s unlikely there are multiple instances, the logic in the script is simple and reliable. If you use IE for normal browsing you’ll likely need to come up with a cleverer way of telling the script to shove on and stop the services.
  • Once this all worked reliably I eventually wished to get rid of the annoying command window that stays open the whole time the script is active. I found, through the wisdom of the internet, the attached .js launch method to solve that.

Now I have a quick launch shortcut pointed at vmware2_launch.js to keep things simple and clean. This works well on the two systems I use, both running VMware Server 2.0.2:

  • Win7 Home Prem SP1 x64
  • WinXP Pro SP3 x86

Here are the code segments. (I need to find a simpler, less aggravating way to present cleaner code in WordPress posts.)

Edit: updated after installing SyntaxHighlighter Evolved. Very nice.

vmware2.bat

@echo off

REM **** Check if Tomcat is running. If so, assume all VMware server services are running. Otherwise,
REM ** start them.
tasklist /FI "IMAGENAME eq tomcat6.exe" 2>NUL | find /I /N "tomcat6.exe">NUL
if %ERRORLEVEL%  equ 0  ( 
	echo Tomcat is running, just get on with it.
	) else (  
		REM **** Start VMware services ****
		net start VMwareServerWebAccess
		net start vmauthdservice
		net start VMwareHostd
		net start vmnetdhcp
		net start "vmware nat service"
		
		REM echo Let's wait a couple--ok alot--of jiffys to let Tomcat get ready

		REM x is Number of miliseconds to delay
		> "%Temp%.\sleep.vbs" ECHO WScript.Sleep 2 * 1000
		CSCRIPT //NoLogo "%Temp%.\sleep.vbs"
		DEL "%Temp%.\sleep.vbs"  )

REM **** Start web browser ****
REM **Using the <hostname> instead of "127.0.0.1" or "localhost"
REM **avoids the annoying certificte warnings

"C:\Program Files (x86)\Internet Explorer\iexplore.exe" http://zaphod:8308/ui/#


REM ** Stop VMware services **
net stop VMwareHostd
net stop vmauthdservice
net stop vmnetdhcp
net stop "vmware nat service"
net stop VMwareServerWebAccess

vmware2_launch.js

var WindowStyle_Hidden = 0
var objShell = WScript.CreateObject("WScript.Shell")
var result = objShell.Run("cmd.exe /c vmware2.bat", WindowStyle_Hidden)

ssh logins without a password

Setup

To set this up you first need to create an ssh identity on your local machine.

$ ssh-keygen -t dsa

Your user’s home will now have a .ssh subdirectory with the identity file (id_dsa) and the public key file (id_dsa.pub). Copy the contents of id_dsa.pub to <target server>/<username>/.ssh/authorized_hosts

You can automate this with the ssh-copy-id script.

$ ssh-copy-id -i ~/.ssh/id_dsa.pub user@host

Note: If you use a non-standard ssh port on the target–doesn’t everyone?–edit the script (/usr/bin/ssh-copy-id) at line 41:

{ eval "$GET_ID" ; } | ssh -p 12345 $1 "umask 077; test -d .ssh || mkdir .ssh ; cat >> .ssh/authorized_keys" || exit 1

You’re not quite there yet, but close.
If you try to ssh to your target now, you’ll be prompted for the local identity’s passphrase first. That’s a good sign; it means the target machine is accepting your public key authentication. You need to start a local ssh agent and add your identity to it.
(replace bash with your favorite shell)

$ ssh-agent bash
$ ssh-add

You’ll be prompted for the passphrase and the identity will be added to the ssh agent. The agent will use this identity’s authentication until you exit the shell where it’s running. (To avoid even this step, setup keychain.)
You can now ssh to your target machine without being pestered for a password or phrase of any kind.

$ ssh test@remoteMachine

When you can connect without being prompted for a password, you’re ready to go crazy with pssh.

Enjoy!

pssh to manage multiple systems

pssh (Parallel SSH) is a powerful tool if you need to manage multiple boxes. Originally developed by Brent Chun, it’s now maintained by Andrew McNabb.

Installation

Depending on your distro, you probably have pssh available in a repository of some sort. I know there’s a new version in the Fedora 12 yum repository and lots of binaries in RPM format. Since I was playing with a CentOS 5.4 installation, and pssh isn’t in the default repositories, I chose to grab the source from the new project home.

pssh is written in Python. Now, I don’t know the first thing about Python, but using ez_setup.py made the build and install exceedingly painless. (Follow the INSTALL notes in the tar file.)

Install setuptools, extract the source, and then build it:

$ wget 'http://peak.telecommunity.com/dist/ez_setup.py'
$ python ez_setup.py
$ tar -xvf pssh-2.0.tar.gz
$ cd pssh-2.0
$ python setup.py install

This will install the utilities to /usr/bin

Usage

$ pssh --help

usage: pssh [OPTIONS] -h hosts.txt command [...]
options:
--help show this help message and exit
-h HOST_FILES, --hosts=HOST_FILES
hosts file (each line "host[:port] [user]")
-l USER, --user=USER username (OPTIONAL)
-p PAR, --par=PAR max number of parallel threads (OPTIONAL)
-o OUTDIR, --outdir=OUTDIR
output directory for stdout files (OPTIONAL)
-e ERRDIR, --errdir=ERRDIR
output directory for stderr files (OPTIONAL)
-t TIMEOUT, --timeout=TIMEOUT
timeout (secs) (-1 = no timeout) per host (OPTIONAL)
-O OPTIONS, --options=OPTIONS
SSH options (OPTIONAL)
-v, --verbose turn on warning and diagnostic messages (OPTIONAL)
-A, --askpass Ask for a password (OPTIONAL)
-P, --print print output as we get it (OPTIONAL)
-i, --inline inline aggregated output for each server (OPTIONAL)

Configuration

Create a hosts file for pssh to act on.

$ more pssh_hosts.txt
# host[:port] [user]
192.168.5.10:12345 glen
192.168.5.11:12345 glen

Run

$ pssh -h /home/pssh_hosts.txt -P date

192.168.5.10: Wed Dec 30 03:44:40 GMT 2009
[1] 22:44:24 [SUCCESS] 192.168.5.10:12345
192.168.5.11: Wed Dec 30 03:42:22 GMT 2009
[2] 22:44:24 [SUCCESS] 192.168.5.11:12345

I’m not sure if I like the output from -P or -i better. I’ll have to play with both for a while.

To redirect the output to a file, use the -o switch and give it a directory name. In the output directory will be files, named after each of your targets, containing the command results.

There is some old documentation still available at Brent Chun’s original site, but it could be out-dated. I know the binary install location has changed and the --help switch has the newer options.

While playing with the 2.0 version from the Fedora 12 repo, I noticed the pscp command is now pscp.pssh. I couldn’t find any reference to why the change was made. The source I built from has the original pscp command. (Update: I came across this comment referring to a name-clash with PuTTY’s scp utility.)

Note:

pssh assumes you have publickey–no password entry–access to all the machines you’re managing. To set that up, take a look at this.

Enjoy!