Friday, April 29, 2011

Useful Batch Commands

Sometimes it's useful to have a few batch tricks up your sleeve. Here are two that I've used before but I had to dig around to remember/find.

The first trick is running a script file on Windows like it's executable. This is easy to do on *nix, but on Windows it requires a .bat file. So just create a .bat file the same name as the script, in this case script.php, put the two in the same directory, and then use the cryptic $~dp0 to specify the current directory of the .bat file being run and viola! The script is now an executable.

php %~dp0script.php

The second is I wanted to copy a text file to a network drive but CMD doesn't understand UNC paths. So use pushd and popd. Nothing revolutionary but useful if you need it.

pushd \\computer\volume\
copy %~dp0\filetocopy.txt filetocopy.txt

Thursday, April 28, 2011

Remote Shutdown

Have you ever found yourself using Microsoft Remote Desktop without access to the physical machine and you need to reboot it? Or sometimes you have access to the physical machine but there isn't a keyboard hooked up for some bizarre reason that makes perfect sense to you. If so then you probably already know this and this post is pointless, but every so often I encounter someone that doesn't know the about shutdown.exe. Microsoft has a pretty old article about How To Use the Remote Shutdown Tool to Shut Down and Restart a Computer in Windows 2000. My use of shutdown.exe is to force a restart now:

c:\shutdown -t 00 -f -r

Thursday, April 21, 2011

Installing JDeveloper on Mac

Installing JDeveloper on Mac could be easier, but it's not. I have found many lists of directions but none of them are as simple and straight forward as the ones that can be found

Thursday, April 14, 2011

Remote Desktop to Windows from Mac

I've been doing a lot of remote desktoping lately from my Mac. A lot of remote desktoping. Windows has great support for Remote Desktop, but the Remote Desktop client for Mac leaves some to be desired. And this is where I've been using CoRD.

CoRD is a free open source Windows remote desktop client. It has presets for multiple computers, or the same computer just with different settings such as resolution. I find this handy for when I'm using my laptop with it's built-in display or an external display, or remote when the connection is a bit slower.

The user interface is pretty good but I would change some things if it were up to me. The only lacking feature is audio isn't sent to the client but that isn't a big deal. There's also a bug when entering full screen mode on a second monitor. But other than that, if you remote desktop from a Mac then I highly suggest CoRD.

Thursday, April 7, 2011

Two Suns in China

I read about this when it happened last month but had to blog about it because I find it amazing, still. And I have a story to go along with it. Apparently scientists are puzzled too. It's some sort of atmospheric distortion.

This is a true story. When I was a kid I woke up in the middle of the night and I saw two moons in the sky. I thought aliens were coming to get us. Seriously! I was like 9 years old. What conclusion would you come to? I remember going to the library and researching all kinds of stuff well above my head. When I got to college many years later I did more research. I asked people. I asked professors. I did searches on the internet when it became available. The closest I ever got was that it was Mars coming super close to earth but that wasn't it because the moon was well above setting. It was the freakiest thing I'd ever seen. So My conclusion is it is a super rare occurrence of atmospheric light bending and I got to see it. Lucky me!

I find this sort of thing absolutely amazing!

Wednesday, April 6, 2011

No Insert Key on Mac Keyboard

If you've ever run a Mac as your host computer and used Remote Desktop, VNC or VMWare then chances are you've somehow gotten into Overwrite mode in a text editor by accident and couldn't figure out how to get out. There are quite a few documented cases out there: here and here. The problem is as Apple's documentation suggests this cannot be done with an Apple laptop keyboard. Well I have found the magic incantation! At least it works for me (some of the time):

Fn + Right Command + delete

This will put my cursor in and out of insert/overwrite mode. Hopefully it works for you. If it doesn't work for you and you have a better version please post a comment.

Update: Today I finally figured out the key combination that makes me enter into Overwrite mode: Fn. So if you press Fn again it brings you out of it. Apparently the scan code for the Fn key and the Insert key are quite similar in some cases but not all, very ood.

Friday, April 1, 2011

Google Motion

This is pretty cool. I can't wait for them to add this to mobile devices.