Posts Tagged ‘Web’

So a lot of people seem to be taking the latest missteps by Twitter’s management (and the accompanying admission of bad design) as an opportunity to try out some alternatives. Many of them seem to be coming over to FriendFeed (which has been better than Twitter for a long time, but nevermind that) ... so I thought I’d update and release a PowerShell 2.0 script I wrote to create imaginary friends out of your friends that stay on Twitter.

The first part of it is a WatiN script (that automates your browser) called New-ImaginaryFriend which takes three parameters: a name for the imaginary friend, a url for an avatar for the friend, and a HashTable… Of course, we sort-of cheat by using the HashTable … it’s basically a bunch of key-value pairs of remote services and user names. You can use it to add twitter ID’s like twitter="jsnover" or blogs like blog="http://HuddledMasses.org/" etc. You can even add multiple sources (eg: twitter + diigo, two blogs, etc) to a single new imaginary friend 8)...

This script is done using WatiN because the FriendFeed API doesn’t support creating imaginary friends yet, and as a result it’s slow, and requires IE (and doesn’t seem to work very well with IE8 — at least, I couldn’t get it to set the avatars using IE 8 on Windows 7, so I commented out the avatar part of the next-to-last line).

The other part of the script is a pair of functions: the first is Get-FriendFeedFriends which retrieves profile information for all your friends in a slick format that includes all their services and such … you may find other uses for this later ;-) , the second is Get-TwitterFriends … Both have an -Exclude parameter so you can pass it a list of people to ignore.

When you put these three functions together, you can just import the FriendFeed module, and start creating friends (don’t forget this version of the scripts only works with IE6 or IE7 for the purpose of avatars, as WatiN can’t seem to set the file upload value in IE8 yet).


Import-Module FriendFeed
## Get any twitter friends who aren't on friendfeed
## Make sure you use FriendFeed's built in "add all your twitter friends" first
$twits = Get-TwitterFriends `
         -Nickname jaykul
         -Exclude $(Get-FriendFeedFriends jaykul | select -expand twitter)

## Add them to friend feed
foreach($twit in $twits) {
   New-ImaginaryFriend $twit.name @{twitter=$twit.screen_name} $twit.profile_image_url
}

You can download all of the required modules at once (7z), or grab the latest versions of them from PoshCode: FriendFeed, HttpRest, and WatiN … but if you do that, you’ll still need to get the binaries separately :-/

Reblog this post [with Zemanta]

Well, after multiple attempts at a wget PowerShell script (the last one works very well for downloading web pages, files, as long as you don’t need to send post parameters or anything like that) ... I found myself writing a script last week that included a custom HTTP POST function as well as using some prior functionality I wrote (ConvertFrom-Html) to convert HTML files to XML documents — which PowerShell can deal with nicely.

So I’ve taken my Huddled.Html code and worked it in together with a few extra bits … and I’m releasing it under the new name “PoshHttp” (which has the sole benefit of being short, in the case when you need to type the full command names, like: PoshHttp\Get-Web.

In lieu of providing proper documentation for this, there’s a script below which shows off some of the features of the Get-Web cmdlet … but first, you’re going to want to download PoshHttp and I can give you a basic overview.

Get-Web

Downloads a file from the web URI, optionally passing POST or GET parameters which it accepts as a Hashtable. If the resulting file is an xml or html file, it converts it to XML and outputs it as an XmlDocument object. If they are not, it saves them to file, and outputs the FileInfo object.

  • Plain will prevent the conversion to xml
  • Save will force saving to file (either xml or binaries)
  • Path lets you specify the file name/path (normally, it selects a path based on what you’re downloading).
  • Force will prevent it from asking if you want to overwrite files

ConvertFrom-Html

Converts HTML to XML. I’ll eventually tweak this so it supports passing it a file path and even saving the xml in-place on the original file … but for now you can use it on a stream of text, like this: (Get-Content file.html | ConvertFrom-Html).save( "file.xml" ). Note that it outputs an xmldocument object … you can get the xml as text to the console using Get_OuterXml().

ConvertTo-Hashtable

Converts a url-style query string or NameValueCollection into a Hashtable. It’s mainly to make it easier to use the Get-Web in cases where you’re getting the URL or POST data from elsewhere.

Here’s a script with a few example uses of Get-Web: Read the rest of this entry »

This “Web 2.0” nonsense is still ridiculous, and I thought I’d just throw this out there to express my annoyance. The one thing you’ll notice here is that at no point do we get a new version just because you started using the same old tech for different purposes. Water does not become Water 2.0 just because you use it to wash your car instead of drinking it, nor because you put it in bottles and pretend it’s worth it’s weight in gasoline. Neither does the web get a new version just because some corporate muckety-muck discovered blogging, nor even when someone finally notices XmlHttpRequest and dreams up a new acronym for “fetching data from a webservice via a javascript in a web page”. What we can do is change the version number when we make a significant change in the underlying technologies.

  • HTML = 1.0
  • Client-Side Script (Js/Vbs) = 2.0
  • Style Sheets = 2.5
  • Server-Side Scripting (Perl/Php/etc)= 3.0
  • Server-Side Databases = 3.5 (the first real web apps — apps that didn’t just manipulate something you already has)
  • XML and XmlHttpRequest (partial page reloads) = 4.0
  • The single-browser web (Netscape dies and the web becomes a uniform platform of IE5 compatible sites). = 4.1

And at some future point in time …

  • Client-Side Databases = 5.0 (this is in the HTML5 spec released this month)
  • Rise of MicroFormats = 6.0 (this is where microformats emerge as recognized standards)
  • Social Web = 7.0

In the Social Web, browsers become true portals, with integrated identity management, instant messaging, contact management and feed aggregation. Micro-formats are one of the supported standards, and browsers can parse them and store and track their information. When you comment on a website, your OpenID is tracked with a microformat vcard, plus your browser offers to ping your OpenId enabled tracking service so your friends can follow a central feed of all your comments and forum participation across the whole web (based on your anonymous OpenID). All of this happens without third party plugins that nobody installs.

So yeah … Web 2.0? The Social Web? No. I think not.

Search My Content