Showing posts with label twitter. Show all posts
Showing posts with label twitter. Show all posts

Sunday, September 11, 2011

Changes

In keeping with my promise to streamline my expulsion of thoughts via "social" outlets, I am going to start focusing more on the blog and less on the other stuff.  That means I'm also not going to post any more blog announcements on Twitter or Google+.  Blog posts will be on the blog and shared via my Google Reader stream only.  Time to get serious about quality rather than quantity.  This will also be the last blog post I link on Twitter or Google+.

It also means I'm going to tone down the sharing of weird events that occur around me, and the salty language that goes/went with it all.  Weirdness continues to happen all around me, for whatever reason, I seem to be a magnet for strange things and strange people, but I'm tired of sharing the weirdness.  Go find your own.  I have enough to keep me busy already.

Also, if you have anything you'd like me to include as a topic or theme in upcoming blog posts, please e-mail me at ds0934 (at) gmail (dot) com. Put "blog feedback" in the subject line or it will get shit-canned immediately.  Here's your chance to drop a quarter and make the monkey dance.  Use it wisely. :)

Friday, September 9, 2011

By The Numbers

Updated stats for my feeble social nutwork activities over the past 30 days.

Activity Blog Google+ Twitter Facebook
Posts by Me 38 92 4,482 0
Replies / Responses 15 73 116 0
Unsolicited Contacts 0 0 4 0
Followers / Friends 7 98 79 71
Site Visits 2,673 ? ? ?
Reposts / Retweets        

As you can see, I do a LOT more talking than I get talked to.  That says a lot.  Sometimes seeing numbers in plain view has an impact like nothing else.  Heck, ask any MBA what kind of hard-on they get over Excel pivot tables and 3D color graphs.  It's like talking about Heroin in the company of Keith Richards.  Like my momma always said: if you don't have something important to say, enter politics.  No, she said something to the effect of "If you don't have something meaningful and important to say, it's probably noise."  I need to shut up and reserved my blabbering for when it really matters.

This kind of jibes with my stated plan to retire this blog at the end of this year.  I haven't really missed Facebook at all.  I get tired of Twitter and walk away from it, but as soon as I see something stupid in public, I want to tweet about it.  G+ started out really cool and has a nice mature feeling to it, but it seems a lot of the people I converse with are visiting it less often every week.  I'm no Dr. Phill, but I can diagnose my condition as trying to reconcile a lack of "real" social interaction with online interaction, and it obviously ain't working like my subconcious idiot brain assumed it would.  The problem for me is that I like to talk and write, and write about talking.  I write a lot of code and a lot of email messages, so it kind of carries through I suppose.  I'll have to figure out a way to let off steam without boring people to death or wearing out my welcome.

In the meantime, between now and December, 24, 2011, I am going to strive to post less often and practice the art of shutting the hell up.  Maybe I'll divert my energy towards more reading.

Wednesday, August 31, 2011

My Favorite Tweeters

No, I'm not talking about stereo speakers.  I'm talking about my top list of most interesting or funniest Twitter folks:

Funny

Educational

I would have posted a longer list, but a lot of the folks I follow have locked accounts so you wouldn't be able to read their stuff anyway.  If I follow you and left your name off please don't hate me.  Well, go ahead and hate me, but that's a longer list so you'll be standing in a longer line.

Saturday, January 15, 2011

Shifting Gears: From Twitter to Gmail

I posted some articles in the past on how to leverage Twitter for sending and receiving systems alerts using Direct Messaging (DM). That was using Basic Authentication, not the newer (current) OAuth model.  But regardless, the biggest annoyance with that approach was Twitter's downtime and backlog.  Some alerts wouldn't show up for almost a half hour.  Some never showed up.  Even the inverse approach of sending DM tweets to an account monitored by my server suffered the same hinderances.

The better approach?  GMail.  Yes.  GMail.  Using standard SMTP commands with CDO and pretty much ANY SCRIPT language you prefer, you can get and send e-mail, and it is infinitely more reliable and prompt.

Here's a sample chunk of VBscript code to try for yourself…

strSubject = "Test Message"
strMessage = "This is a test message"
sender = "YOUR NAME <your_address@GMAIL.COM>"
recipient = "someone@somewhere.com" ' or put in a SMS address like "8005551212@vtext.com"

On Error Resume Next
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")

If err.Number <> 0 Then
wscript.Echo "error: unable to invoke CDO interface"
wscript.Quit(1)
End If

Set Flds = iConf.Fields

schema = "http://schemas.microsoft.com/cdo/configuration/"

Flds.Item(schema & "sendusing") = 2
Flds.Item(schema & "smtpserver") = "smtp.gmail.com"
Flds.Item(schema & "smtpserverport") = 465
Flds.Item(schema & "smtpauthenticate") = 1
Flds.Item(schema & "sendusername") = "UserName"
Flds.Item(schema & "sendpassword") = "Password"
Flds.Item(schema & "smtpusessl") = 1
Flds.Update

wscript.echo "info: sending smtp message..."

With iMsg
.To = recipient
.From = sender
.Subject = strSubject
.HTMLBody = strMessage
.Sender = " "
.Organization = " "
.ReplyTo = " "
Set .Configuration = iConf
SendEmailGmail = .Send
End With

Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing

wscript.echo "info: message was sent"


This is easy enough for outbound work: sending alerts.  For doing the opposite, you'll need to set up a dedicated Gmail account for your server to monitor the Inbox and parse what it finds.  Same basic concept as the Twitter DM approach, but using SMTP (and/or SMS) instead.



In case you don't feel like digging back and reading old blog posts, some of the things you can do on the inbound side are rather interesting (and empowering):




  • Enable or Disable AD (or local) user accounts


  • Unlock user accounts


  • Add or Remove user accounts within AD security Groups


  • Move accounts around


  • Start and Stop services


  • Initiate secondary automation processes (manual kick-off)



And so on.  Since all this does is set your server up to read specially-formatted Inbox messages and take action on them, you can make it do whatever you want.  The world (or at least your data center) is your oyster.

Tuesday, November 2, 2010

Twitter

I’m back on Twitter again.  Not that I really ever left.  But I did go into hibernation for a while.  I started out like a drunk sailor at first, posting totally random stupidity, which was fun, but then I realized it wasn’t winning any friends over, so I donned the suit and tie approach, but that didn’t help either.

Then I put on the propeller beanie cap and thick-rimmed glasses, but that didn’t help either.  Come to think of it, nothing helps.  I’m just Mr. Bland.  It’s been three years since my first tweet.  So if you’re confused by just what exactly I’m trying to say (or tweet) well, don’t feel bad.  I don’t know either.

Tuesday, June 8, 2010

I'm So Tired of Half-Assed Work Passing as "Good"

Whether it's Facebook's constant gyrations that keep leaving bugs and quirks in every nook and cranny, or the CSS model, or Apple's iTunes and iPod devices, or Ford and GM automobiles, I'm just sick to death of everyone giving them a passing grade when there's so much bullshit.  We've become so accustomed to the bullshit level that we think it's normal now.  Cheap, thin, plastic dashboards with flimsy fixtures and awkward anti-ergonomic controls and indicators.  Inconsistent API models.  Devices that have predictable problems.  All of this shit we're just getting used to as being "OK".

It's NOT OK.

Folks: Hold these dipshit’s feet to the fire and DEMAND better results.  Our grandparents sure did.  They didn't buy cheap shit.  They wouldn’t stand for it.  That's why their stuff lasted.  You think anything you purchased in the past 5 years will last long enough to pass down to your kids or their kids?!  Hell no!  Maybe SOME furniture could qualify.  But none of the electronic junk we have now will last that long, and it's not even supposed to.  We know that.  Everyone knows that cellphones have a limited lifespan.  Cars have a limited lifespan.

Look, my grandfather drove his old Ford Galaxy to over 250,000 miles by just "taking care of it" rigorously.  He NEVER overhauled the engine or transmission.  It was built to last.  Same goes for one of my old neighbors and his 1953 Oldsmobile.  Some of those cars ended up in backyards with weeds growing around them, but they didn't rust out to nothing.

Yes, there have been some improvements like air bags, GPS, crumple zones, collapsable steering columns, radial tires, and so on.  But the overall product doesn't last as long.  It's disposable.  We're a disposable culture.  Everything is throw-away and we’re just fine with that.  But the unintended side-effect is that we’re also just fine with shoddy quality.  No, wait a minute, let me qualify that quantification gyration a bit:

It’s not that things are just shoddy.  They’re designed to be sufficient for a specific lifetime.  After that they fall apart.  You have to baby the hell out of most products to keep them in top shape even up to their expected point of death.  Beyond that and you have to adopt a whole new religious practice to keep it looking and working good.  Engineering is getting that granular folks.  Engineered lifespan is a valuable commodity in today’s industrialized markets.  This is especially true if the lifespan plays into a revenue model that ties in with some sort of overarching service (think cell phone features, iPod, digital cameras).

But getting back to my original thought, which is that in some respects there is shoddiness throughout the products and we’re just blind to it from overexposure.

Cases in point:

Facebook – The Notes feature is quirky as hell.  Create a “Draft” and save it, but don’t publish it.  Then leave it and try to get back to it.  You can’t.  Not unless you start another Note and cancel it, and THEN you get a link to “Drafts”.  How many ways can you get to parts of your personal profile?  Shouldn’t one be enough?

Twitter – I think it should just make the stupid whale image with the “oops, sorry, our shitty-ass crap-app is overloaded again – try later” as the default home page.  Everytime some lame-ass code-nerd tries to snob me with some bullshit pitch about Ruby being superior, I just point to Twitter and scream like Sam Kinison.

iPod Nano – PIECE OF SHIT.  Period.  I somehow ended up with five (5) of these f-ing pieces of trash.  All from different sources (two direct from Apple.com), and at different times.  They lock up constantly. The “shuffle” is as predictable as a political speech.  Apple gets a free handjob pass from the fanboy crowd because it’s hep to have anything with a Cupertino fruit symbol on it.

Live Messenger – Oh my God.  Forget the chat aspect, IF you can find the chat space behind all the cluttery over-bloated buttons and ads.  Move that shit out of the way and let me chat gd-it!

Apple Update – NO – I DO NOT WANT SAFARI ON MY WINDOWS DESKTOP!!!!!!  Stop shoving it in my face!!!

Symantec – Just please, put down the crack pipe and stop bloating out your code to death.  Soon it will require a Cray SMP with 40 terabytes of memory just to load your “Security” product suite.  The only way it makes a computer secure is by rendering it unresponsive, so even bad code can’t get a slice of that CPU.

Autodesk – Please, I beg you, listen to me for one second: there are many of us (you know, those people called “customers”) that (a) do not want to wait for WsCommCntrl.exe to stop hogging the CPU in order to get working in AutoCAD and get the boss off our backs, and (b) don’t have time or company policy allowance to participate in your Customer Improvement Program.  Let us TURN THAT SHIT OFF PERMANENTLY!  Stop burying it in places intended only to make it difficult to disable it.  It aggravates the shit out of us and it’s really tiresome.  If you want to know what we think, pick up the phone and call us.

Adobe – Really?  Seriously?!  Are you kidding?!  You charge HOW MUCH for Acrobat Professional?  Holy f-ing cow!  To make fancy PDF files.  I suppose you’re ok with charging $100 per square of toilet paper in your company restrooms too?  And why is PhotoShop so expensive?  Do you read?  People are actively looking for cheaper alternatives and they’re actually finding them.  I’d be worried if I were you.  Get real.  Drop your ridiculous pricing.

Google – Can you please put a consistent interface on your vast array of web products?  I mean, seriously.  How many engineers do you employ?  How much do you spend on the infamous cafeterias and daycares? Can you spare a few bucks to clean it up a bit?  Maybe get things out of “beta” in less than 5 years.

Microsoft – R2?  What’s that?  Windows 7, Windows Server 2008, IE9, Expression 4.  Hey, how about forming a committee to tackle the problem with version numbering?  Which is it: a number or a year?  And does every product really need 11 syllables?  System Center Operations Manager?  System Center Virtual Machine Manager?  Can we dispense with the “System Center” prefix?  And while you’re at it, how about cleaning up the mess your developers have made with things like MSXML service packs, and .NET updates?  IT folks are struggling to package and push that stuff to thousands of computers.  You could help us out a little.

Mobile Apps – Don’t tell me how “mobile” is going to overtake the desktop when your stinky mobile apps still don’t have all the features or options I have with the crusty old web desktop version. Facebook and Twitter for mobile devices still cuts your hands off when you need to do certain things.  Shouldn’t a mobile app be AT LEAST equal to it’s web counterpart?

And, speaking of AT LEAST: what happened to the idea that an “upgrade” should never take a step backwards?  Why do so many upgrades seem to quietly remove something we had in the previous version?

Let’s go back to making QUALITY code, ok?

Saturday, March 6, 2010

Putting Technology to Everyday Use: Twitter

I’ve already discussed Twitter on this blog and on my other other blog (Scriptzilla), but I wanted to describe a process I’ve been using to keep control over my home network even while I’m out and about.  The Twitter API provides a robust set of tools for reading, composing and managing tweets and direct messages (aka “DM’s”).  The meat of this is in their API Documentation and can be leveraged with almost any existing scripting or programming language.

I posted a few examples for how to read and send Twitter DM’s for Windows computers using VBscript.  You can just as easily do this with KiXtart or PowerShell (but not as directly), and tie your processes to events such as logons, startups or event-triggers or whatever. I use UberTwitter to manage my home network from afar by having it send me event DM’s and listening for my commands.  You can use any mobile Twitter client or web/desktop Twitter client however, even the Twitter web site itself.  How you get there is irrelevant.  A mobile client on your smartphone is the ideal way though.

For example, I can tweet (DM) my server’s Twitter account to do a “hand-in-the-face” for one of my kids when they step out of line (skip chores, skip homework, act disrespectful, letter sent home from school, etc.).  The workflow is something like the following…

tdm_flowchart 

The third block in this flowchart is actually multiple steps.  They are described more thoroughly in my other blog posts.  Basically that “block” involves a scheduled task that keeps a watch on the Twitter DM inbox, looks for specifically formatted messages, parses the message for specific phrases that indicate coded instructions (you make that up as you see fit), and executes a corresponding script action to do the work.  Then the computer deletes the DM (so that it doesn’t keep reading it every scheduled cycle), and (optionally, but recommended) the computer sends a DM confirmation back to my other Twitter account, letting me know it got the instruction and processed it.

The key to this process is careful planning, setting up, testing, testing and more testing and then making sure everything is locked down securely.  Make sure you set your computer’s Twitter account as private (locked) and it only follows your regular (human) Twitter account.  You have to follow your computer’s Twitter account also (and have it accept the request), so you can exchange DM’s.  If you use “tweets” instead of DM’s, you’ll be leaving yourself wide open to hacks and accidental catastrophes.

If you find this stuff interesting or useful, post a comment and share your thoughts.

Sunday, January 17, 2010

Run Silent. Run Deep

I haven’t made a New Year’s resolution since I turned 21.  I’ve always thought they were the dumbest things in the world.  I put them in the same category as the “Christmas Spirit” which defies logic.  Mainly: why is it considered “ok” to get in a loving spirit once a year?   Anyhow, I made a resolution this year, of which I have been slow to implement.  And that is to start shutting up.  Less Facebook.  Less Twitter.  Less blog.  Less Google Reader Shared items.  Less me. 

People who know me, and who want to know how I’m doing, really, can pick up a phone and call me.  The old fashion way works best.  I feel Facebook is a cop-out for those who don’t want to really bother with “staying in touch” as much as keeping tabs on people.  There is a difference. 

Facebook makes it too easy for casual friends to open the door into your inner circle and daily events.  People who you’d probably never call or expect to call you, especially on the weekend.  To me that makes it disingenuous.  And above all that low-level irritation is the fact that I’m not Brad Pitt, or Steve Jobs, or anyone that really matters in this world as far as broadcasting an opinion.  What I think about politics, movies, games, computers and so on really doesn’t matter.  It just seems to be a matter of ego and promoting self-worth.  I don’t need either of those.  I’m just me.  Maybe if I win a big award or star in a movie someday I’ll have a reason to blabber more, and then I’d probably more interesting things to say.

Happy 2010

Saturday, December 19, 2009

Twitter Quitter – Or Bitter Shitter? – or just STFU

I decided to stop posting to Twitter, but I’m not deleting my account.  At least not yet.  I prefer to keep it active so I can watch my Twitter feeds and keep up with fast-moving information.  From what I’ve seen over the past year, breaking news and industry trend topics tend to leak out on Twitter much sooner than to web sites, TV news and so on.  Sometimes it’s too fast and things get bent out of shape, but for things like technological announcements, research and development, product updates, and event schedules it’s simply superior to anything on the traditional “web”.

Twitter is not perfect.  It’s not “for everyone” either, obviously.  But I find it disturbing how emotional people get when voicing their opinion about technical subjects.  It’s the same with Operating Systems, CAD products, ERP products, web browsers, media players, and now it’s infecting Social Networking services.  The masses are brainwashing themselves, which I’m sure makes the suits more than happy (saves them the effort).

What I’m talking about is how people knee-jerk into saying things like “___ sucks!” or “___ is stupid!” and so on.  Typical ignorant comments that scream out loud: “I haven’t got a God-damned fucking clue what I’m talking about so I’m going to mask my ignorance with brash adjectives and expletives and things like ‘stupid’, ‘dumb’ and ‘worthless’”.

I hear it when people bash Twitter, Facebook, LinkedIn, MySpace and so on.  All the time.  It seems no one is capable of just saying: “I have tried it but it doesn’t fit my needs” and just leave it at that.  Trying to impress upon others that something is useless is disingenuous and misleading.  It’s trying to force an opinion upon someone else when you should instead recommend they just give it a try.  What the fuck ever happened to seeing things first hand?!  Remember those days?  The days of trying something yourself and making up your own mind.  (sigh) good days those were.  Ok, maybe not.  But regardless, it seems when people don’t like Facebook or Twitter, they can’t restrain themselves from prosthelytizing the pagans into repenting and giving up on them before they’ve even tried it themselves.  Sad.

So, you hate Twitter.  Who cares?  You hate Facebook.  Who cares?  You hate blogs like this one.  Who cares?  Those are rhetorical questions of course.

You cannot accurately, honestly, say to anyone “Twitter is stupid” or “Facebook is stupid” because you can’t know for sure what will (a) turn out to be useful or (b) turn out to be appealing to someone else.  Let them make up their own mind and just STFU.

Thanks.  Oh, and Merry Christmas!  Happy Hannukah!  Happy Kwanzaa!  Happy Ramadan!  and whatever else floats your boat.

Peace

Saturday, November 7, 2009

What Was “New” for Me This Past Week

  • Paint.NET 3.5 was finally released (download) – I really love it!
  • Testing SkyDriveExplorer.  Some (very) minor quirks, but nice (http://www.skydriveexplorer.com/)
  • Updated my AppleTV to 3.0.  Finally!
  • Updated my Blackberry 8830 to firmware 4.5.  Finally!
  • Adjusted my Twitter-Admin setup (control my home computers via Twitter from the Blackberry, and monitor events as well)
  • Posted updates to ASP and VBScript syntax definitions for TextPad (download)
  • Installed Tigo-Tago to manage IDv3 tags on my AVI library (download)
  • Got the family (only) van repaired.  Power steering pump and hoses, and water pump both failed.  Runs great now.
  • Caught up on podcasts: Adam Carolla Show, No Agenda, CarCast, and Tech5
  • Rode the bike for only 5 miles though.  Sucky.

Saturday, October 17, 2009

Twitter and Windows Automation Contemplation

I decided to break out the coffee on a cold, gray, rainy Saturday, and post a couple of tutorials on using Twitter as a means for communicating with your computer from afar.  First post is on getting your computer to send to Twitter.  The next post will be on controlling your computer from Twitter.  It’s really not that difficult, if you really want to do this.  It’s all a matter of how much you want to do this.  In fact, if you can control a computer, you can control almost anything.  That’s because you can already rig your surroundings to your computer, so…    Anyway, I hope this helps spark some imagination gyration out there.  Have fun!

Sunday, October 4, 2009

FAQ: What Happened to Skatterbrainz on Twitter?

Skatterbrainz had to go into witless protective custody.  Hiding out in a barn in the frigid coastal region of sub-Saharan Africa, but only Tuesdays.  The rest of the week he sleeps under a tent in the Antarctic.  Actually, I have another Twitter account now.  If you really want to know what it is, drop me a comment or send an email to ds0934 at hotmail dot com.  I can't publish it in the open or Martian solders will seek me out and try to destroy me.

Tuesday, August 18, 2009

The Perils of Using Twitter for SysAdmin Automation

In the simplest terms:  Twitter is just too unreliable.  It suffers from performance problems and periodic outages and hiccups which make it risky to rely on for use as a system events notification tool.  The examples I posted on this blog for Sending Direct Messages, Fetching Direct Messages , and incorporating EventTriggers via VBscript and KiXtart were meant to show that this idea is indeed possible and feasible.  However, it is not very practical.  I’m sure many Twitter users would agree with this view, while others may not, but my experiences support this view as far as I’m concerned.  I love Twitter and use it heavily, and the API is impressive and surprisingly good.  But this falls into the old saying: Never confuse “could” with “should”.

Wednesday, August 12, 2009

Fetching Twitter Direct Messages Using VBScript or KiXtart

Thanks to the Twitter API documentation (which is lacking examples) and the MSDN reference library on using MSXML/XMLHTTP methods, I’ve put together a simple script to query your Twitter DM inbox and fetch the 20 most recent items (that’s the built-in default of the Twitter API, by the way).  Enjoy!

VBscript Example:
Const username = "MyTwitterUserName"
Const password = "MyTwitterPassword"

Function Twitter_Get_Direct(strUser,strPass)
Dim oXml, strTwitterURL : strTwitterURL = "http://twitter.com/direct_messages.xml"
Set oXml = CreateObject("MSXML2.ServerXMLHTTP.3.0")
oXml.Open "GET", strTwitterURL, False, strUser, strPass
oXml.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
oXml.Send()
Twitter_Get_Direct = oXml.responseText
Set oXml = Nothing
End Function

result = Twitter_Get_Direct(username, password)
wscript.echo result


KiXtart Example:



$username = "MyTwitterUserName"
$password = "MyTwitterPassword"

Function Twitter_Get_Direct($strUser,$strPass)
Dim $oXml, $strTwitterURL
$strTwitterURL = "http://twitter.com/direct_messages.xml"
$oXml = CreateObject("MSXML2.ServerXMLHTTP.3.0")
$oXml.Open("GET", $strTwitterURL, 0, $strUser, $strPass)
$oXml.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
$oXml.Send
$Twitter_Get_Direct = $oXml.responseText
$oXml = 0
EndFunction

$result = Twitter_Get_Direct($username, $password)
? $result


I could probably post this in PowerShell also, but nobody seems to care, so unless someone asks I won’t bother.  Anyhow: putting this together with the previous examples and blog rants, using a little duct tape and glue, you can assemble a nifty little system for monitoring remote servers using Twitter, as well as sending control commands to the remote server to execute.  That’s right.  You can use the above script on a server to fetch DM messages and process them.  I’ll leave that to your imagination, but it does work and is pretty simple to do.  The only caveate is Twitter availability (not very good) and how robust you want to make the contraption.  Cheers!

Monday, August 10, 2009

Setting up EventTriggers to send alerts via Twitter DM

I mentioned in a previous post how you can send Direct Messages on Twitter using VBScript or KiXtart scripting.  Prior to that, I described how you can setup a twitter account for your server(s) to use so you can pass confidential messages between you and your server(s).  That opens up a TON of possibilities for monitoring as well as sending control requests to the remote computer(s) using a locked-down Twitter account.  As with everything like this, exercise extreme caution and perform a lot of testing before sitting back and getting too comfortable.  There are risks involved you cannot ignore, but they can be mitigated.

One way to employ Twitter for remote systems management is to have your servers/computers use the built-in EVENTTRIGGERS command.  This command is available with various Windows platforms and version and allows you to respond to specific events.  One of those is to have the action call on a script. That script can do anything you want to do, including sending Twitter messages.  I recommend a Direct Message, rather than a general timeline status update.  You probably don’t want to share your system events with your followers, and I’m pretty sure they wouldn’t want to read them anyway.

The syntax for EVENTTRIGGERS is documented on Microsoft TechNet.  An example for creating an event trigger to respond to a “low disk space” warning event is as follows:

eventtriggers /create /s Server1 /u domain\userid /p password /tr "Low Disk Space" /eid 4133 /t warning /tk \\server2\scripts\tweet.vbs


In this example, the server being monitored is Server1.  The event id is 4133 and the event type is “warning”.  The action being taken is to call a script, “tweet.vbs” which is a vbscript file.  You can call any script you like, but if there is no default script engine handler (e.g. wscript.exe) then you would probably want to put the execution statement into a .BAT file and call the .BAT file instead.  So, in this example, if I wanted to invoke cscript.exe…



@echo off
cscript.exe /nologo \\server2\scripts\tweet.vbs "low disk space on server1"

The net result would be something like this...

eventtriggers /create /s Server1 /u domain\userid /p password /tr "Low Disk Space" /eid 4133 /t warning /tk \\server2\scripts\tweetalert.bat


This would call the .BAT file, which would invoke cscript.exe and execute tweet.vbs. This also makes it easier and cleaner to add optional arguments to your script execution to give you more flexibility while keeping your EVENTTRIGGERS setup less cluttered.



Now, before you start scoffing at this whole preposterous concept, I will admit this isn’t foolproof.  It’s just an example of something you COULD do.  As an old mentor often said to me years ago: “never confuse COULD and SHOULD”.  The most likely weak spot in this idea is the availability aspect (let’s face it: Twitter is very unreliable at times).  It is possible to respond to an error result from the Twitter API by entering a timed-loop until the response indicates success, but that’s cumbersome and also unreliable.  The takeaway here is that you COULD do this.  I’m not saying you SHOULD.  Charlie would be proud of me.

Sunday, August 9, 2009

Sending a Twitter Direct Message using VBScript and KiXtart

There are quite a few examples on the web for sending Tweets to your own timeline using scripting and Curl, etc. However, I didn't find a lot of helpful examples on sending direct messages via Twitter using VBscript or KiXtart, so here's what I figured out and it seems to work. For more information on using the Direct_Messages.New API methods, refer to the Twitter API.  Enjoy!

VBScript Version

Const username = "MyTwitterUserName"
Const password = "MyTwitterPassword"
Const recipient = "skatterbrainz"

Function Twitter_Send_Direct(strMsg, recipient)
Dim oXml, strTwitterURL
strTwitterURL = "http://twitter.com/direct_messages/new.xml"
Set oXml = CreateObject("MSXML2.ServerXMLHTTP.3.0")
oXml.Open "POST", strTwitterURL, False, username, password
oXml.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
oXml.Send "text=" & strMsg & "&user=" & recipient
Twitter_Send_Direct = oXml.responseText
Set oXml = Nothing
End Function

msg = "Test Message (sent from vbscript)"

result = Twitter_Send_Direct(msg, recipient)
wscript.echo result

KiXtart Version

break ON
$username = "MyTwitterUserName"
$password = "MyTwitterPassword"
$recipient = "skatterbrainz"

Function Twitter_Send_Direct($strMsg, $recipient)
Dim $oXml, $strTwitterURL
$strTwitterURL = "http://twitter.com/direct_messages/new.xml"
$oXml = CreateObject("MSXML2.ServerXMLHTTP.3.0")
$oXml.Open("POST", $strTwitterURL, 0, $username, $password)
$oXml.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
$oXml.Send("text=$strMsg&user=$recipient")
$Twitter_Send_Direct = $oXml.responseText
$oXml = 0
EndFunction

$msg = "Test Update (sent from kixtart script)"

$result = Twitter_Send_Direct($msg, $recipient)
? $result


Note the wrapping of arguments with matching parenthesis (…) when using KiXtart.  This is not required for VBScript.  A small but important thing to keep in mind if you use both languages (as I do quite often).  Another “feature” which I have mentioned in previous posts, is that KiXtart supports inline string/variable expansion, so you can bury variables within strings and they work fine, which is nice.  PowerShell and some other languages can do that, but not VBScript.

Using Twitter to Control A Remote Computer

This is going to be general and vague. Not because I can't tell you the details, but because I shouldn't need to. Why? Because (A) if you find this topic interesting, then you should fit the demographic of those that are intelligent enough to know what the generalities imply as far as the details are concerned. There. I said it. Now let's move on...

1. Create a new Twitter account and lock it down
2. Login to your "regular" Twitter account.
3. Submit a request to follow your new account
4. Login to your other account and accept the request

That lays the foundation on which you can build the house, which is discussed below...

1. Create a script that reads your Twitter DM inbox

That script should be written to look for specific content in order to perform specific actions. Do not make it blindless accept commands and execute them. You "can" do that, but it's a very bad idea. Murphy's Law will show up and ruin everything. Start simple. make your script look for "reboot" and just do a reboot of the computer.

2. Schedule your script to run on a regular interval, such as hourly.

3. Make sure your script deletes the DM inbox item after it's been processed.

Enjoy!

Sunday, January 11, 2009

Sunday Morning Bike Ride, more Scattered Thoughts

It drizzled all night, but is now clearing up. The sky is still cloudy and light gray, breezy and around 58 F outside. Temps are supposed to drop throughout the day. I got up late, which for me now is 7:00 am, stretched, and went on a quick (15 minute) 3 mile bike ride to stretch out a bit. It was like riding through a dream. iPod blasting Paramore. It felt good. I miss working from home. I used to do this every day, either biking or walking/jogging. Summer of 2006 I was averaging two rides per week at 22 miles each trek. I used to ride my bike to work back then also. Last Summer I barely got out. Oh well, it was nice to get out again, even for such a brief moment.

I saw Marley & Me again last night. Great movie, but sad ending. Sorry for the spoiler. I got home and had to bond with my baby dog "Lucky" for a few hours. I think the movie was produced by a secret group of dogs.

Twitter

Twitter has become a minor obsession for me. I'm finding that short quips are ideal for Twitter rather than blogging. I'm probably going to be using Twitter much more than Blogger from now on. I'll use the blog for times when I have something elaborate or significant to say. Follow me on Twitter at http://twitter.com/skatterbrainz if you care.

I will be posting more stupid scripting stuff here over the next week or two. So, if that's your cup of tea, hopefully it's something you find helpful. Let me know if there's something you'd like to see? You can also check out Don Hite's scripting blog. He has tons of goodies of all sorts.

Windows 7

Windows 7 is pretty nice. Not as drastic of a change as going from Win2k to XP or NT4 to WS03, but it's a very noticable improvement over Vista. It's always easier to point at things we don't like than what we do like, it seems. I don't like the Win7 task bar, but only because of the way it combines quick-launch shortcuts with running (minimized) shortcuts. You can't tell which are actually running without moving the cursor over them to see if they produce a preview popup. Very confusing. I also don't care for the odd mix of icon motifs. Some are 3D-ish, while others are 2D and boxy, like the new Explorer icon. The WMP shortcut is flat-out ugly. I'm really surprised Microsoft couldn't concoct some prettier icons.

On the plus side, there are many. Faster performance for installation, configuration, and startup/shutdown operations. Some UI changes are nice, like the new desktop properties popup, control panel and network and sharing center. The new Action Center is a nice touch as well. The new tree-panel behavior for folder selection is better but it takes a little getting used to. It no longer automatically expands folder trees when you select a folder (you have to explicitly click on the "[+]" icon). There's a lot more, but I'll leave that to others who get paid to review things.

Blogs of Note

I have amassed a crapload (that's a technical term) of blog feed links over the past two years. I follow most of them very closely. I really don't know why. I suppose it gives me something to do that distracts me from the drudgery life can deliver. Adam Schefter's NFL.com blog is really good and he posts like a madman. Matt Raible has a great slice-of-life blog. John C. Dvorak has a fun blog. Some others I follow: Rod Trent, Mini-Microsoft, The GPO Guy, Andy Wibbels, and about four dozen more.

Anyhow, it's Winter now, which in southeastern Virginia means cold, clouds, and rain. We're not allowed to have snow unless we've been bad, which is rare. And nobody here can drive in snow. Even flurries send drivers here immediately into the nearest guardrail or utility pole. I can't understand it. I'm hunkering down for Spring, which can't get here soon enough. I like warm weather. If it's going to get cold, it should snow. Nothing in between. Virginia is in between. Maybe when the housing market turns around I will think about moving somewhere else. This got me thinking about what I would do if I won a HUGE lottery payout. I'd probably build a house in each place I'd like to spend time. That would probably be somewhere in Colorado (where my parents were from), somewhere in southwest Michigan (where my wife's family is), somewhere near a beach (Florida or California), and maybe a private jet to get around. That would be cool.

Thursday, January 8, 2009

Twitter is Really Struggling This Week

It seems to have flared up again with Macworld and again with CES, but holy crap: Twitter is crapping out a lot lately.  Doesn't matter what angle you hit it from: phone apps, web, SMS, etc. it's just choking and crawling.  I'm still curious why no one like Google has stepped up with something to compete with it like Facebook and others have done with MySpace.  FriendFeed is one of several, but Twitter is a good idea with poor execution.

Tuesday, January 6, 2009

MacWorld on Twitter

Twitter was the bomb today.  I'm really loving it now.  I guess it took a second try for me to get hooked.  It also helps to have TwitterBerry on my Blackberry. :)

Some interesting tweets today:

Paul Thurrot: "Final recap on Macworld.  Mostly "eh".  Exception: Battery on new 17-in MBP is interesting, unless they start catching on fire 2 mos from now"

Jason Calcanis: "#mwsf09 yawn so far"

Ryan Block: "Sun's not quiet up yet, getting prepped.  Should be an interesting morning for the gadget world"

Scott Lowe: "I'm highly upset with Apple right now. Apparently, they disabled Kerberos support for SMB shares from the Finder in Leopard...why? Stupid!"

Alex Albrecht: "seems like most people are underwhelmed by the Apple Keynote at MacWorld. What do you guys think?"

Me:  Well, my view is somewhat limited by the fact that I had to work and get my information secondhand.  In general I didn't see anything that looked "amazing".  The battery stuff isn't really new, but to Apple fans I suppose it is.  Freeform polymer battery with intercell logic has been kicked around for at least a year or two.  I've seen several patents applied for it from universities to corporations (mostly in Japan).  I've always thought Apple does a better job of putting on a show than anyone else except maybe Hollywood, from a marketing perspective.  If only Microsoft could figure out how to do that.