Tuesday, November 24, 2009

Quick & Dirty startup script for VM + Internet + sendmail

Someone asked me the other day how to write a script for Windows to automatically start a VM, connect to the internet and send the IP Address out so that they can reconnect to the machine if there's a crash. Without using DynDNS us here in South Africa have dynamic IP Addresses so you cannot rely on it remaining the same.

You'll need to download sendmail for Windows for this.

@echo off
vmrun start c:\path\to\virtual\machine.vmx
rasdial connection_name username password

ECHO From: someone@example.com > %TEMP%\temp.mail
ECHO To: someone-else@example.com. >> %TEMP%\temp.mail
ECHO Subject: this is a test >> %TEMP%\temp.mail
ECHO.>> %TEMP%\temp.mail
ECHO testing. >> %TEMP%\temp.mail
ECHO blah blah.. >> %TEMP%\temp.mail
ECHO. >> %TEMP%\temp.mail
ECHO blah. >> %TEMP%\temp.mail
ipconfig/all >> %TEMP%\temp.mail

sendmail -t < %TEMP%\temp.mail
DEL %TEMP%\temp.mail

And that's it short and sweet. If your VM requires you to press a key to start such as Y you can pipe that in when you start it with
echo Y| vmrun start c:\path\to\virtual\machine.vmx

Thursday, February 19, 2009

ORA-30926: unable to get a stable set of rows in the source tables

Wow, now this was a perplexing situation.
Calling a procedure which executes 2 merge statements, almost identical, yet only the second one was returning the error message. I really have to thank Oracle for their descriptive error messages on this one, took a little bit of searching but managed to get it sorted.

Seems merge statements only like 1:1 or 1:0 matches and doesn't handle 1:many so updating a master record with multiple children (monthly payments) is a no go. Luckily slapping it in a loop that issues a merge for every month does the job and makes me go home happy.

God bless fast fingers and good resources.

Wednesday, February 18, 2009

Commits in your code

Put them in your frakking code, not in the backend PL/SQL Function or Procedure.
What happens when something goes wrong and you need to rollback ?? You can't because you insisted on having the commit/rollback functionality removed from you because you can't use a connection manager correctly.

For the love of all things holy, learn where best to manage from.

/rant off

Tuesday, October 14, 2008

First thoughts

Always enjoying the art of the pen but keeping to myself, I thought maybe it's time to put them on the limitless paper that is the internet.

The beginning of the end starts with the fault of one man and that man decides the fate of the world. His world.

Time to get back to reading I should do...