Tuesday, March 17, 2009

The Ari sleeps tonight

Do you use Skype? Me too, but for a long while I refrained from using it because it allows people to call you at any time they want, unless you remember to set it to Do Not Disturb or offline when you go to sleep. As most of my friends and family are in Israel, which is 10 hours ahead, this was even more troublesome. So what can YOU do?

Well, fortunately, Skype has an API – a “Application Programming Interface”, which allows anyone to write a program that will communicate with Skype directly. Many applications have APIs, which are up to the application developers to create. Microsoft, for example, has APIs for almost all of its software.

Skype’s API is not very well documented, so using theirs is not that simple, but I’m here to help. One can use that API using any programming language, but since not everyone has the tools to write and compile programs, I’ll use the built-in scripting engine of Windows to do it. This allows you to easily create the program with no prior knowledge or installation of complicated compilers.

To use this, all you have to do is open Windows’ NOTEPAD program, and copy-paste the following code into it. Then, save the file somewhere on your hard drive and give it the extension VBS. Next, edit the time-table set in the 1st two lines to select when Skype will be online and “Do Not Disturb”. Then, just use the windows scheduler to run this script once every hour. Whenever it runs, it will check the current day and time to determine if this is a weekend or not (assuming you stay up later on a weekend) and if Skype should be set to DND or online, and do it.

Note: The current settings set Skype to be DND from midnight to 9am on a weekday and from 1am to 11am on a weekend. The weekend days are set to Friday and Saturday since most people, I guess, go to sleep late on Fridays and Saturdays because they don’t have to wake up early on a Saturday and Sunday.

Code starts here:

TimeRangesOfflineWeekend = "1,2,3,4,5,6,7,8,9,10"
TimeRangesOfflineWeekday = "0,1,2,3,4,5,6,7,8"
Set oSkype = CreateObject("Skype4COM.Skype")
CurrentStatus = oSkype.CurrentUser.OnlineStatus
DND = 4
Online = 1
CurrentHour = int(timer/60/60)
Dayofweek = weekday(date)
if Dayofweek = 6 or Dayofweek = 7 then 'This is a weekend
if instr(TimeRangesOfflineWeekend,CurrentHour) then
SetSkype = 4 'Going to DND mode
else
SetSkype = 1 'Going ONLINE
end if
else 'This is NOT a weekend
if instr(TimeRangesOfflineWeekday,CurrentHour) then
SetSkype = 4 'Going to DND mode
else
SetSkype = 1 'Going ONLINE
end if
end if
oSkype.ChangeUserStatus(SetSkype)
Set oSkype = nothing


Monday, March 9, 2009

If you build it, I will come

For most people, playing in the snow means building a snow man, but I fancy much more elaborate ideas. How about an Igloo, or even a small house?

The idea is to use a brick-shaped baking pan. These 6-10$ pans are almost exactly the shape and size of a brick, and have diagonal sides designed to facilitate an easy removal of the cake. Get one or two of these, depending on how many kids or adults are in the game.



To make a brick, just throw some snow into the pan, and don’t forget to pack it as tight as you can. Flat-out the top surface with your hand or a knife (hay…why not a chainsaw!!!) and turn-over to remove the brick.





Make as many as you like and use them to build walls. Use an interlocking structure (in which each second brick is up-side-down) to get better stability. If you want a real tight construction, spread a little salt on each row before laying the next one. The salt will melt the top layer of ice, and will make the rows fuse together.