Somewhere in the overlap between software development, process improvement and psychology

Posts tagged “web

Manipulating web content in Excel, or, My Excel can haz ajax?

Yes. Well, kinda. Not really. Er… maybe. Hey look, it works!

There’s not much better than Microsoft Excel for mucking about with big grids of stuff really easily. I’ve often used Excel to “screen scrape” or at least “DOM scrape” web content for various reasons. One of the most common is to get stuff from a web app that doesn’t provide a “download to csv” option or a decent API. Another reason is to grab stuff from an RSS feed to mix in to whatever my spreadsheet is doing, or just to use it as a REST client. So I offer you the following generic solution, I’ll base this one around the RSS example…

Wikipedia, the absolute source of all knowledge and truth, says that for something to be AJAX “the use of JavaScript and XML is not actually required, nor do the requests need to be asynchronous”. Despite this  “AJAX” is generally considered to be an initialism and acronym for “Asynchronous JavaScript and XML”. Taking both of these into consideration I must conclude that AJAX means whatever we want it to mean. For me it’s when I’m using an XMLHttpRequest object in one way or another to yank some xml/html/whatever from a web server.

In Excel I’m not using javascript asynchronously but I am using xml and even a XMLHttpRequest object via com interop so for me that qualifies as doing ajax in Excel.

How to do it:

1. Avoid late binding of com objects and help yourself out by adding a reference (code editor: Tools -> References…) from the Excel app to a library that will provide a XMLHttpRequest object. Happily, “Microsoft XML, v6.0” provides such a beastie for us.

2. Write some Ajaxy code to use the object like this:

Private Sub MMD_DoSomeAjaxyStuff()

'declare some useful vars
Dim req As XMLHTTP
Dim doc As DOMDocument
Dim url As String

'Some things to process the XML
Dim entries As IXMLDOMNodeList
Dim entry As IXMLDOmNode

'The RSS to get, naturally
uri = "https://mikemacd.wordpress.com/feed/"

'make a new XMLHttpRequest object
Set req = new XMLHTTP

'Load the xml
req.Open "GET", uri, , "", ""
req,Send
While req.ReadyState <> 4
  DoEvents 'yeah I know...
Wend

'Read the XML
Set doc = New DOMDocument
doc.loadXML req.responseText

'Do something with the RSS
Set entries = doc.getElementsByTagName("item")
For i = 0 To entries.Length - 1
    'Do something with the RSS like stick it in a cell
    Set entry = entries.Item(i)
    Cells(i + 1, 1).Value = entry.childNodes(1).Text
Next i

End Sub

3. w00t 😀

Advertisements

What is cloud computing?

In any sentence including the word “cloud” if you substitute “network” the sentence still makes sense, and normally makes a lot more sense.*

I’ve recently been doing some stuff with cloud computing and thought I would offer the above insight. It’s slightly flippant however, in that there is a difference  (at least to me) between cloud services and network services and that is in their focus. “Cloud services” tend to be focuses towards consumers whereas “network services” are rendered by businesses to business, although as is normal in business they’re further obfuscated translated to b2b services or, if intended to portray an image of easy-consumption “b2b cloud services”.

You’re currently reading this blog on the cloud or syndicated by a cloud service (like google reader, netvibes (oh yes I see you), bloglines etc.) on a device of your choice.  I’m writing it on a cloud service and other cloud services (like google, bing, whatever) are providing search for curious folks to find this blog.

So what does all this mean? Is cloud pointless or the most important thing since 7 layered network protocols? Or all of the above?

Personally I’m leaning towards the third option. In many ways this is nothing new. I’ve been able to use network based search, hosting, virtual provisioning, remote servers, remote APIs for many years. In another way it’s totally new, I can provision a network based on a topology of my choice based on a collection of OSes for little or no money for whatever purpose suits me, storing data in a federated fashion and integrated with a number of web services after just a few clicks, both as a business or an individual.

There are many excellent cloud services out there, I personally use the Ubuntu One service to transfer files between my main desktop PC and my Android tablet, it’s actually more convenient than using a USB stick (and free) – this for me is the real distinction between “network” services and “cloudn” services (deliberately misspelt for those who do the copy/paste search/replace exercise). They’re so convenient and cheap (or free) you’d use them above anything else. Amazon is really trailblazing in terms of consumer and business cloud services.

I recently setup a website. I entered my credit card details and literally moments later had a linux server with the web server of my choice running. I was able to FTP and SSH to the box and do whatever I wanted as it appeared to be my box. Of course it’s not my box, it’s a virtual box hosted by a (probably virtual) hypervisor or similar on a bunch of racks distributed around a bunch of data centres in various places but that’s not relevant to me as a consumer, I just ask for a “box” and get a “box” in moments, in a convenient and cheap way.

That is what cloud computing is all about.


* Try this trick with this blog, copy and paste the blog to gedit/notepad/whatever and replace “cloud” for “network”


Simple Rules for web site design

  • Frequency of web content change is inversely proportional to publishing control
  • Frequency of web content change is proportional to number of people able to publish
  • Content quality is inversely proportional to frequency of change
  • Engagement is proportional to ability to comment and track replies

Thoughts?


Cuil

A new internet search engine has been launched called Cuil (pronounced “cool”). Cuil has been built by a bunch of people that used to work for google and has a slight philosophical difference:

“Rather than rely on superficial popularity metrics, Cuil searches for and ranks pages based on their content and relevance. When we find a page with your keywords, we stay on that page and analyze the rest of its content, its concepts, their inter-relationships and the page’s coherency.”

Cuil also claims to have an index (over 121 billion pages) three times bigger than googles. Google have stopped publishing their figures but still claim they have a bigger index that Cuil.

I think Cuil has added a lot the page relevance stuff is more intelligent than google’s ranking, the categorised related links are useful and interesting not to mention the refreshing layout. But will people talk to “cuiling” for information in the future…. unlikely.