The Eric Wroolie Blog

Overpass Experiences

  • Blog
  • Videos
  • Overpass Apps

Powered by Overpass Apps

Expression Superpreview and IE6 transparent PNG images

September 22, 2009 by wroolie Leave a Comment

Up until a few months ago, the best way to ruin a developer pc was to install IE7. 

As much as developers and web designers want the world to move away from IE6, there are still lots of machines that still run it.  These computers are typically in enterprise environments, where staff are prohibited from upgrading their browser and some in-house applications would stop working if they did.  I recently worked in an environment like this.

In the old days (back when all you could see was farmland for miles around), it was easy to load several versions of Netscape and run them concurrently.  I used to be able to code a web page and tell you how it looked in Netscape 3, Netscape 4, Firefox, and . . . whatever version of IE I had installed. 

Because there was no way to install multiple IE versions, you pretty much had to stick with the lowest common denominator—otherwise, there was no way to tell what your site would look like to the luddites.

It was possible to run different browser version in different virtual machines, but this was really tough on a slow pc.  image

Some developers don’t bother checking their code in other browsers at all—especially in a corporate environment, but I encourage it anyway.

A few months ago, Microsoft released the Expressions Superpreview application which renders your pages in  IE6 and IE7 in a side-by-side comparison.  This really makes life a lot easier.  While working on some changes for the Overpass site, I was able to view my site in Firefox, Safari, and IE8 on my workstation—and in IE6 and IE7 with Superpreview.  I found that my transparent PNG files were not transparent in IE6 and was able to correct this.

Superpreview is one of those tools that would have come in handy so many times in the past.  If you do cross-browser design, you should have a look at it.

The Superpreview application can be downloaded here.

And about the transparent png problem I had (in case you found this post while Googling the issue) . . .

I spent most of the morning and part of yesterday trying to get my transparent png files working.  They worked on the local PC, but not from the server.  I spent ages Googling problems with PNG and Ubuntu, PNG and Apache, etc, but couldn’t find the problem.  In the end, I found that the problem I first had was due to the fact that I was uploading the images as ASCII instead of binary. 

To fix the problem with png transparency rendering in IE6, I used a fantastic script written by Drew Diller called DD_belatedPNG which renders PNG files as VML.  That script can be found here.  What a huge help it was.

Filed Under: Software Dev & Productivity Tagged With: IE6, PNG, Superpreview, Transparency

Automate Skype Status with PowerShell

September 18, 2009 by wroolie 16 Comments

One of the big problems I have with Skype is its lack of a scheduling feature.  I have a Skype dual phone which will ring when someone calls me on Skype, but I don’t want the phone ringing in the middle of the night because someone from another time zone sees my status as “Online” decides to call.  I use Skype frequently for work with virtual teams, so I can’t just turn it off because I don’t want to forget to turn it back on.  My status should show as “Away” when I haven’t used my PC for a while, but this isn’t always consistent and it doesn’t cater for insomnia-induced tinkering on the pc.

Wireless Skype Phone
Creative Commons License photo credit: iBjorn

Ideally, Skype would have a feature to set “Opening Hours” on your account—I only want to show up as available between 8am and 8pm.  I bought the Pamela extra which does some scheduling, but you can set only one event per day—ie. I can set it to go offline at 8pm, but not to turn back on at 8am.

Since Skype offers a client API component, it is possible to create a scheduler to set your online status at different times using Windows Scheduler and a scripting tool.  I wrote this before in VBScript, but this being the dawn of Windows 7 with pre-installed PowerShell, I rewrote it as a PowerShell script.

If you are on XP or Vista and haven’t installed PowerShell, you will need to do this before you can run these scripts.  Installation instructions for PowerShell are here.  You will also need to set the execution policy.  You can find instructions for this here.  I am running XP.

I hope this helps . . .

Step 1: Install the Skype4Com component

Skype still uses a COM component called Skype4Com which needs to be downloaded and registered on your local PC.  The component can be found at https://developer.skype.com/Download.  I’m using version 1.0.32, but you can probably use a later version.

Download the component, extract it to a directory (ie. “c:skype”) and type the following into the Run window:

regsvr32  c:skypeSkype4COM-1.0.32Skype4COM.dll

Make sure the directory point to the actual dll file to you downloaded.  You should get a response that it was registered successfully:

image

Step 2: Write the PowerShell script

Now, write the PowerShell script to use the component.  I’ve created two scripts—one sets my status to “Online”, the other sets it to “Offline”.  You can probably create a single script with a parameter passed in if you wish (but I couldn’t be bothered to figure out how to do this).

In the script, you have to create the Skype object, identify the current user, and change the status.

In my first script, I use the following code:

   1: #Create Skype Object

   2: $skype = New-Object -COM "Skype4COM.Skype"

   3:

   4: #Get the logged in user

   5: $currentUser = $skype.CurrentUserProfile

   6:

   7: #Get the Status vars

   8: $onlineStatus = $skype.Convert.TextToUserStatus("ONLINE")

   9:

  10: #Now Change your status

  11: $skype.ChangeUserStatus($onlineStatus)

The main Skype call here is the “ChangeUserStatus” method.  I named the first script “SetSkypeStatus_on.ps1”.

The second script is almost identical, but it sets the status to “Offline”:

   1: #Create Skype Object

   2: $skype = New-Object -COM "Skype4COM.Skype"

   3:

   4: #Get the logged in user

   5: $currentUser = $skype.CurrentUserProfile

   6:

   7: #Get the Status vars

   8: $offlineStatus = $skype.Convert.TextToUserStatus("OFFLINE")

   9:

  10: #Now Change your status

  11: $skype.ChangeUserStatus($offlineStatus)

I named the second script “SetSkypeStatus_off.ps1”.

There are several other parameters you can pass into the “ChangeUserStatus” method.  Here are the values I know about:

Status Code Sample
OFFLINE $skype.Convert.TextToUserStatus(“OFFLINE”)
ONLINE $skype.Convert.TextToUserStatus(“ONLINE”)
RINGING $skype.Convert.TextToUserStatus(“RINGING”)
INPROGRESS $skype.Convert.TextToUserStatus(“INPROGRESS”)
BUSY $skype.Convert.TextToUserStatus(“BUSY”)

Of course, you can automate most actions on the Skype client using the component (not just setting your online status).  You can schedule calls, send text messages, etc.  But I’m only concerned with my online status.

Step 3: Set up Windows Scheduled Tasks

Now you have two scripts to go Offline and Online.  You just need to have something trigger them.  I use Windows Scheduled Tasks.  In Control Panel, go to the Scheduled Tasks window.  You’ll see a list of scheduled tasks for your pc.  Right client and select “Add”—>”Scheduled Task” (Don’t go through the “Add Scheduled Task” wizard).  Name your task “SkypeStatusOn”.  Right-click the task and choose “Properties”.

Now, in the “Run:” box, type the following command:

powershell -command “& ‘c:tempSetSkypeStatus_on.ps1’ “

Make sure the path is pointed to you PowerShell script you’ve created.

image

You can now use the “Schedule” tab to schedule when you want the script to run.  Click “OK”.

Now do the same for the other script.  You can test these scripts by right-clicking the task and selecting “Run”.  You should be able to watch your Skype status go from offline to online.

By the way, the first time you run this, Skype will ask if you want PowerShell to have access to Skype.  Click “Allow”.

If everything works successfully, your pc should set your online status and give you the “Opening Hours” that Skype forgot.

I hope you find this useful.

Filed Under: PowerShell, Software Dev & Productivity Tagged With: Automation, PowerShell, Skype

Line Breaks in Webby

September 18, 2009 by wroolie 2 Comments

For the past few weeks, I’ve been using a tool called Webby for static html pages.  Webby is a Ruby-based tool which produces static html pages based on templates you create.  Think of it as using master pages in ASP.Net, except that the final product is files with a .html extension instead of .aspx (and you don’t get the asp.net processor kicking in each time this static page is called).

It’s a great tool, because most of my sites need to have a consistent look and feel.  I don’t want to copy html from one file to another and I can use a master page-like concept.  And it gives me the chance to toy around with Ruby a little bit (but not much).

In Webby, you create a layout page and the other pages as .txt files with html.  Run the command “webby autobuild” in a command window and each time you make a change to any of the files, it will create a folder called output with all of your processed html pages.

A problem I did have with the tool is that it was adding <br /> tags into my html where the line breaks where in my files.  I absolutely hate it when something tries to inject html into my code.  This is why I didn’t use Frontpage and won’t use tools like Dreamweaver.  I know html is a lost art but . . .

So, in my files, I would type

<p>I would type a paragraph that might be
lengthy, so I use multiple lines in the code
but don't expect the browser to interpret these.
I just want it to look for the tags.</p>

What I got back in return was

<p>I would type a paragraph that might be <br />
lengthy, so I use multiple lines in the code<br />
but don't expect the browser to interpret these.<br />
I just want it to look for the tags.</p><br />

It took me a few hours to figure out why this was happening (I couldn’t find anything on Google with a “BR tags in Webby” search).

The problem is not with Webby, but with a tool called RedCloth, which Webby uses.  Redcloth does the html processing with something called Textile.  This is not a problem, but a feature in Redcloth from very 4 onwards.

After searching for hours (and contemplating whether to just transfer everything to aspx pages), I found that Webby was automatically adding a “- textile” filter to all of the pages:

---
title:      <%= title %>
created_at: <%= Time.now.to_y %>
filter:
  - erb
  - textile
---

The simple solution, was the remove the textfile flag from all pages.  Remove the flag from the “templates/page.erb” file in the project and you should remove it from all pages in the project.  Then you are master of all your html, my son.

I hope this

Filed Under: Software Dev & Productivity Tagged With: BR, Line Break, Redcloth, Ruby, Textile, Webby

  • « Previous Page
  • 1
  • …
  • 11
  • 12
  • 13
  • 14
  • 15
  • …
  • 37
  • Next Page »

Recent Posts

  • My Gig and the Imposter Syndrome
  • Getting Picked Last for Teams in PE
  • One Little Growth Opportunity at a Time
  • I’m sorry if I look like I know what I’m doing
  • New Years Reclamations