I survived the Batteries.com move

By StrangeWork.com: The Batteries.com warehouse/office move is officially over!

Batteries.com outside signThe warehouse servers were shutdown at 4:30pm on Thursday and back online 4 hours later. The warehouse crew spent the weekend moving over all of our products and we were testing shipments by Saturday.

Overall the warehouse move went amazingly well. I couldn’t have asked for a better outcome. This has been in the planning stages for about 2 months, so it’s very nice to have this done and over with.

I’m looking forward to getting back to my regular blog updates and podcasting. Next up is the BIG move to New Jersey!

One month to go

By StrangeWork.com: Tomorrow marks one month until my move to New Jersey! One month seems like a long time, but in all reality it’s extremely short considering I am picking up my entire life and moving to a new state to start my own company.

Thinks are busy as ever at work as we work on moving Batteries.com to two new buildings. I’m sure you’ve noticed my lack of posts lately, which is due to the Batteries.com move and my Jersey move. After March I will be back to regular posting, but until then it will be sporadic.

The Ultimate CSS Reference from SitePoint

By StrangeWork.com: Today I received my newest book from SitePoint, The Ultimate CSS Reference.

Ultimate CSS Reference from SitePointThe first thing I noticed is the durable hard cover the book is wrapped in. There is something special about a hard cover book, especially when it’s a reference manual!

I’m a huge fan of reference books. Most of us out there know how to use different languages to develop our web sites. What we don’t always know is the correct syntax to make that magic happen. That’s where the reference manual comes in to play.

Of course we all know over time these manuals can take a beating from constant use. That is why I love the hard cover! It’s able to hold together when I launch it across the room in frustration.

Kidding of course! I highly recommend the entire line of SitePoint books for beginner and expert developers alike.

How to: Update Pownce using ASP

By StrangeWork.com: On February 28th, 2008 Pownce released version 2.0 of their API. The major update in this new version is the ability to post messages, links, files, events and even replies via the API directly to a Ponwce.com account.

Pownce LogoBelow is an ASP script I wrote to update your Pownce profile automatically through the new API. I’ve included the complete script for download at the bottom of this post.

Pownce requires the username and password values be encoded using base64. Below is an ASP function that will convert any value over to base64 encode.

const BASE_64_MAP_INIT = “ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/”
dim nl
‘ zero based arrays
dim Base64EncMap(63)
dim Base64DecMap(127)

‘ must be called before using anything else
PUBLIC SUB initCodecs()
‘ init vars
nl = “

” & chr(13) & chr(10)
‘ setup base 64
dim max, idx
max = len(BASE_64_MAP_INIT)
for idx = 0 to max – 1
‘ one based string
Base64EncMap(idx) = mid(BASE_64_MAP_INIT, idx + 1, 1)
next
for idx = 0 to max – 1
Base64DecMap(ASC(Base64EncMap(idx))) = idx
next
END SUB

‘ encode base 64 encoded string
PUBLIC FUNCTION base64Encode(plain)

if len(plain) = 0 then
base64Encode = “”
exit function
end if

dim ret, ndx, by3, first, second, third
by3 = (len(plain) 3) * 3
ndx = 1
do while ndx <= by3
first = asc(mid(plain, ndx+0, 1))
second = asc(mid(plain, ndx+1, 1))
third = asc(mid(plain, ndx+2, 1))
ret = ret & Base64EncMap( (first 4) AND 63 )
ret = ret & Base64EncMap( ((first * 16) AND 48) + ((second 16) AND 15 ) )
ret = ret & Base64EncMap( ((second * 4) AND 60) + ((third 64) AND 3 ) )
ret = ret & Base64EncMap( third AND 63)
ndx = ndx + 3
loop
' check for stragglers
if by3 < len(plain) then
first = asc(mid(plain, ndx+0, 1))
ret = ret & Base64EncMap( (first 4) AND 63 )
if (len(plain) MOD 3 ) = 2 then
second = asc(mid(plain, ndx+1, 1))
ret = ret & Base64EncMap( ((first * 16) AND 48) + ((second 16) AND 15 ) )
ret = ret & Base64EncMap( ((second * 4) AND 60) )
else
ret = ret & Base64EncMap( (first * 16) AND 48)
ret = ret & "="
end if
ret = ret & "="
end if

base64Encode = ret
END FUNCTION

' initialize
call initCodecs

Every site/script that interacts with the Pownce API requires an application key. To get your application key, simply register a new application on Pownce. Just replace {app_key} in the below script with the application key that Pownce provides to you.

In this example we will be posting a LINK to your Pownce profile. Be sure to reference the Pownce 2.0 API documentation for specifications on posting messages, events, files, etc.

‘*** set your Pownce username and password variables
p_username = “username”
p_password = “password”

p_username = p_username & “:” & p_password

‘*** Base64 encode your username and password
p_username = base64Encode(p_username)

‘*** replace {app_key} with YOUR application key
strPownce = “http://api.pownce.com/2.0/send/link.xml?app_key={app_key}”

‘*** the link you want to post to Pownce
pownce_link = “http://snapfoo.com/images/snapfoo_logo.jpg”

‘*** the description you want to post to Pownce
pownce_update = “SnapFoo.com Logo – Foo You!”

Set xml = Server.CreateObject(“Microsoft.XMLHTTP”)
xml.Open “POST”, strPownce, False
xml.setRequestHeader “Content-Type”, “application/x-www-form-urlencoded”
xml.setRequestHeader “Authorization”, “BASIC ” & p_username
xml.Send(“note_to=public&url=” & pownce_link & “&note_body=”&pownce_update)

‘*** view the Pownce response
Response.Write xml.responseText

Set xml = Nothing

That’s it! Using the above method you can easily create scripts to update Pownce with anything you would like.

Download Source File to Update Pownce using ASP