Tuesday, May 5, 2009

Steak Churrasco

(1:32:59 PM) ch00ch|: hm what to get for lunch
(1:33:05 PM) ch00ch|: its raining, so i aint goin far
(1:51:57 PM) JaygerJ: human flesh?
(1:59:34 PM) sal: i got stop and shop sushi
(2:00:05 PM) JaygerJ: classy
(2:07:02 PM) ch00ch|: well
(2:07:04 PM) ch00ch|: i failed miserably
(2:07:10 PM) sal: how?
(2:07:12 PM) ch00ch|: tried one of those churrascos from au bon pain
(2:07:17 PM) ch00ch|: the steak one
(2:07:22 PM) ch00ch|: and i go to the guy, ask him to make it
(2:07:28 PM) ch00ch|: he doesnt speak english, points me to the warmer
(2:07:35 PM) ch00ch|: its 2 pm so i know anything in that warmer has been there since at least noon
(2:07:39 PM) ch00ch|: so i say, can you make me a fresh one
(2:07:44 PM) ch00ch|: he says no you take the one from the warmer
(2:07:54 PM) ch00ch|: i sit there for a minute, thinking about going with the turkey club that i always get
(2:08:00 PM) ch00ch|: but i was feeling like something different, so i grab it
(2:08:09 PM) ch00ch|: its a tortilla wrap, with 99.9% white rice
(2:08:14 PM) ch00ch|: 3 tiny pieces of steak
(2:08:20 PM) ch00ch|: and like 4 veggies
(2:08:23 PM) ch00ch|: theres nothing in it
(2:08:27 PM) ch00ch|: it couldnt possibly be more bland
(2:08:36 PM) ch00ch|: for $6.17!
(2:08:40 PM) sal: review it
(2:09:05 PM) ch00ch|: i just did

Determing a File Encoding in VB

Ever have to open a file in VBS and its all messed up. The file may be in UTF8 or Unicode.
The is especially annoying for SQL files so I did this:

'**************************************************
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile("C:\UnknownFile.SQL")
'Set this to false so it opens as ascii
Set objTextStream = objFile.OpenAsTextStream(1,False)
'Grab the first line

strTemp = objTextStream.ReadLine

If InStr(strTemp,"") > 0 Then
'UTF8 = depends on the content
'I stripped out the wacky characters and was OK

MsgBox("File is UTF8")
ElseIf InStr(strTemp,"ÿþ/") > 0 Then
'Unicode = just open the file again with
'Set objTextStream = objFile.OpenAsTextStream(1,True)

MsgBox("File is Unicode")
Else
'File is normal
MsgBox("File is ANSI")
End If

'**************************************************

Monday, May 4, 2009

MSBuild VMWare VI Revert Machine

For nightly deploys I thought it would be best to revert our VM testing machine which is hosted on a VirtualInfrastructure server (can be ESX), but it proved to be kind of a bitch. Heres what I did to get it to work:

1. Install PowerShell (http://www.microsoft.com/windowsserver2003/technologies/management/powershell/download.mspx)

2. Install VI Toolkit (http://www.vmware.com/sdk/vitk_win/index.html)

3. Copy Initialize-VIToolkitEnvironment.ps1 located in the VI Toolkits folder, to something like revert_machine.ps1 and put it in a common place, I put mine with the build scripts.

4. Add this garbage to the ps1 file:

connect-viserver restore -Protocol https -User USERNAME -Password "PASSWORD"
stop-vm VMNAME -confirm:$false

set-vm VMNAME -Snapshot (get-snapshot -vm VMNAME -name "IMAGE NAME") -confirm:$false
start-vm VMNAME -confirm:$false
sleep 90
exit

Only put -Protocol https if its https
Username is a user that has rights to revert
Password is their pass, needs quotes I think
VMNAME is the name of the Virtual Machine
IMAGE NAME is the name of the Snapshot to revert to, keep in mind that you should only have one snapshot with this name otherwise it returns a list or something and it all fails.

You can change the sleep or get rid of it, 90 seconds was about how long it took for the machine to start up and auto login plus a little padding.

5. Add this task to a target
<Exec Command='powershell.exe -psc "C:\Program Files\VMware\Infrastructure\VIToolkitForWindows\vim.psc1" -c ". \".\revert_VMMACHINE.ps1\""' />

Just sub in the correct name and path of the ps1 file you created.

I'm sure theres a bunch of ways to do this but this was quick and it works. Only time I had problems was when i didnt specify the User and pass for connecting to the VI server and when I accidently made a snapshot with the same name. Other than that its worked fine. Enjoy.

Swine Flu = Bunch of BS

People need to slow their role about swine flu. Check it...

So far they think about 22 people have died from swine flu, big deal!
The actual flu kills over 30,000 people a year.

More people are killed by lightning than swine flu or Mexican flu or H1N1...

Not that it has anything to do with it but people are even killed during freak bowling accidents.

Point is your gonna die. Deal with it!

If not the swine flu then probably something even more painful.

Saturday, May 2, 2009

Dalai Lama Rocks Gillette

Im not gonna bother trying to relay what he said, since I couldn't possibly do it justice. If your interested you can read his works.

First thing we see pulling up is people tailgating in the parking lot. So you know its gonna be good. I figured there would be tons of monks and people like that but it was more like a rock concert or a sporting event.

Personally I got some nachos. People were up and about, texting on their phones. One lady fell asleep in front of us.

A lot of people left during Q&A to beat the traffic, which I felt was kind of rude. Other than that the speech was great, the Dalai Lama was very funny at times and they mananged to raise over 400k towards a Tibetan Heritage Center in Boston.

Obviously 1.5 hours was not enough to learn much about Buddhism or gain total enlightenment but at least I now know hes a Pat's fan.

GO PATS, FREE TIBET!!!

Friday, May 1, 2009

Increasing Productivity

Often times I am never asked, "Sal how can I be as productive as you on the computer?" If I was asked Id tell them:

1. Get more stinking monitors - If you are using less than 3 monitors you should upgrade, there is no limit but it does usually take time to get used to more monitors.

2. Dont use the mouse - If you can find a keyboard shortcut then use it, this will save you an eternity in moving your hand from the keyboard to the mouse

3. If you must use a mouse get something decent - it makes a huge difference, invest the 50+ dollars and youll be glad you did (my personal recommendation is the Logitech MX series 1000,1100)

4. Get a Macro Program - I use Winkey (http://www.pcworld.com/downloads/file/fid,5506-order,1-page,1-c,alldownloads/description.html)
Anything I do more than once I create a script and bind it to a key. Sure it takes time to write the scripts but youll end up saving time and trouble in the long run.

5. Turn off every notification - Outlook, AIM, anything, turn it off.

6. Get TimeLeft or some other desktop alarm system (http://www.timeleft.info/) I set a counter to 45 minutes. When the alarm goes off I take a break and check email IM etc.

7. Don't start a chatroom with your friends. Pretty self explanatory. Not many people would do it but its a complete waste of 99% of your day.

Set A Vdir property from VBS

Couldn't find a decent sample online for this functions so heres mine:

Set providerObj = GetObject("winmgmts://localhost/root/MicrosoftIISv2")

'Change Report Server to the VDIR your trying to manage
Set IIsWebVirtualDirObj = providerObj.get("IIsWebVirtualDirSetting='W3SVC/1/Root/ReportServer'")

'Set some properties here, notice the _
'Where the hell did that come from? Dunno but it works
' List of properties are here http://msdn.microsoft.com/en-us/library/ms525644.aspx
IIsWebVirtualDirObj.Properties_("AuthFlags").Value =1
IIsWebVirtualDirObj.Properties_("AnonymousUserName").Value= "Domain\User"
IIsWebVirtualDirObj.Properties_("AnonymousUserPass").Value = "Password"

'Put it!!!!!! Set it....
IIsWebVirtualDirObj.Put_()