Clean up double line spacing in Dreamweaver code

Adobe_Dreamweaver_CS6_Icon

I work across Mac and Windows, with Dreamweaver running on my Mac, and code that sometimes will be hosted on Windows Servers and sometimes not. So I often run into the problem of erratic line spacing. If I have code saved on my Mac HDD (as opposed to my Windows VM), push it up to a Windows Server, then pull it down again, I sometimes wind up with the code double spaced when I open the file again in Dreamweaver.

I finally tracked down a quick solution to clean up these pages, with grateful thanks to this page: Permanently Remove Double Space in Dreamweaver Code View.

Do a search and replace:

  • Search for: [\r\n]{2,}
  • Replace with: \n

Make sure you have the Use Regular Expressions option checked.

Of course, it’s also good to make sure you have the Line Beak Type set correctly under Dreamweaver’s Preferences, but I’ve found that doesn’t really help when you are working cross-platform.

Create Twitter-like REST API endpoints with IIS URL rewrite

Twitter’s REST API uses endpoints that look like this:

http://www.domain.com/[object]/method.json

In addition for GET request you can append parameters like this:

http://www.domain.com/[object]/[method].json?param1=a&param2=b

So for example a call to the Twitter REST might look like this:

https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=davideedle&count=2

I wanted to try and reproduce this format with a REST API I’ve been playing with, so I spent some time figuring out how to configure IIS URL rewrite to handle these URLs and deliver the parameters to an ASP page.

You’ll need IIS rewrite installed, in IIS Manager you should see the ULR rewrite icon if you click on a website, for example:

Screen Shot 2013-09-23 at 11.30.31 AM

If the icon is not there download and install URL rewrite extension from the Microsoft website, then open URL Rewrite and add a new Inbound Rule.

Here’s the regular expression pattern I came up with:

^rest/v1/([^/]*)/([^/]*)\.json$

With the Rewrite URL of:

rest/v1/?objectTypeName={R:1}&objectMethod={R:2}

This means that a URL like this:

http://www.domain.com/myObject/myMethod.json?param1=a&param2=b

Will pass the parameters into my ASP page like this:

objectTypeName = myObject
objectMethod = myMethod
param1 = a
param2 = b

You need to make sure you have the “Append query string” option checked for the Rule so the additional parameters (eg param1 and param2) are passed through the rewrite.

Support medical research – have more helium balloons at birthday parties

up_movie_balloons_house-wide

I was listening to a radio program the other day about threats to the world’s helium suppliers, and was fascinated at the story. Like many people we love having helium balloons for our childrens’ birthday parties but it seemed, at least from the radio report, that this might be rather remarkably going to become a party favourite of the past.

A third of the world’s helium comes from a US Government stockpile in Texas, originally founded in the 1920s as a reserve for airships, and sited near gas fields that have some particularly high percentages of helium in the gas extracted.

It turns out that when natural gas is mined, it  contains traces of helium. However this is often at such a low rate that it is not commercially viable to extract, as a consequence there are only a dozen or so places around the world where helium is mined.

The big commercial problem is that the selling off of the USA’s helium reserves has artificially lowered the price of helium for decades – the price we pay is not a true reflection of the cost of the product. And now the reserve is running out, the world will have to turn to the other sources of helium – and pay the commercially viable cost.

Helium is key to many high tech machines and processes, for example it’s used in the production of semiconductors (those tiny things that make everything from your iPhone to your car work); the production of optic fibre, and the operation of Magnetic resonance imaging machines (MRI) in medicine.

At least one person, an academic in the UK, has suggested banning helium balloons from kids birthday parties, however someone with a better grounding in economics points out the flaw:

Even if the helium reserve does stay open for a few more years, its helium will be sold at much higher prices than before. As a result, average market prices could rise by about 30% in 2014, estimates Richard Clarke, a resources consultant in Oxford, UK. That comes on top of major price rises that have already squeezed research budgets. In 2000, the market price of high-quality helium was roughly £1/m3 (enough to make about 1.35 litres of liquid helium); today it hovers around £4/m3.
So what can be done? Some researchers have suggested banning frivolous uses of helium, such as party balloons. But this accounts for only 8% of global demand, and offers some of the highest profit margins in the market – without birthday balloons, researchers’ helium would likely cost even more.
So there you go, the more helium balloons at your birthday parties, the more you are supporting medical research.

If Kim Kardashian’s baby with Kanye West is called North West I’d improve my search engine rankings

If Kim Kardashian's baby with Kanye West is called North West I'd improve my search engine rankings

My random thought for the day was, if I stuff my blog post title with lots of interesting words and terms, just how many people would turn up. Sadly (perhaps promisingly) I did then have to go and check several key facts:

  • How to spell Kim Kardashian
  • Who her boyfriend is today
  • The name of Kim Kardashian’s baby (who calls their child North West? All that pops into my head is North By North West, a really rather good film from the late 1950s directed by Alfred Hitchcock).

Finally I had a quick look at the Google Trends site which gives you an idea of what lots of people are searching for at the moment. Today it turns out the top of the hit parade is:

  • NFL
  • Julius Thomas (had to look him up as well)
  • Anthony Weiner (will that man never give up?)

Which means I probably should write something like how I went to watch an NFL game with Anthony Weiner and Julius Thomas scored a goal/basket/point. Yes, just realised Thomas plays basketball and the NFL is American Football, but hey, who cares when you’re just a search engine traffic moll.

 

 

A blast from the past, apparently Peter Beattie is repeating the same online mistakes as 2004

iforgot

Out of idle curiosity, because I have no better way to spend my days and it’s hard to avoid the ‘e’ word this week, I searched my blog for any mention of the word ‘election’. The earliest post I’ve written containing that word is from 15 January 2004 (yes, I’ve been writing stuff for way too long), and was a quick note that Peter Beattie, then Queensland Premier, had called a snap election ‘Queensland Labor Online‘.

This is the main part of the post:

“There was a minor hiccup this week when an enterprising activist registered peterbeattie.com and directed it to the rival Liberal web site, but this seems to have been altered and it now goes to the teambeattie, so someone has had a word to someone. Fascinating how the media blew it up as a hack attack. Nothing of the sort of course, just a piece of online activism, and serves Beattie for not spending the few extra bucks to register the domain in the first place.”

Again, because I have nothing else to do in my long idle days, I checked both the domains peterbeattie.com and teambeattie.com.

The former leads you to site of Peter Beattie “…internet entrepreneur, motorcycle junkie and world famous hardcore porn star. (one of those might be fake)”

The latter is now sitting on a domain park, and available for purchase from whoever owns it – which I can’t tell because WHOIS shows it’s registered behind one of the domain privacy companies.

Pretty surprised some enterprising Liberal hasn’t picked up on this and taken action. And even more surprised that ‘Team Beattie’ couldn’t be bothered to pay a few bucks to renew the domain. Then again Mr Beattie did say he’d never run for political office again after stepping down as Premier in 2007, so guess wasn’t top of his mind at the time.

Time Machine: The problem may be temporary. Try again later to back up. If the problem persists, use Disk Utility to repair your backup disk

timemachine_logo

Yesterday Time Machine on my MacBook started to fail with the message:

“The problem may be temporary. Try again later to back up. If the problem persists, use Disk Utility to repair your backup disk”

It kept erroring after each hourly backup attempt. So I tried the obvious and unmounted the external HDD, turned off/on, remounted, ran backup again, no dice.

I ran Disk Utility to repair the disk, no dice.

I then found this forum post , which led me to the absolutely fantastic Pondini site (the link on the forum post is old, you need to go here) and smacked my head because I’m an idiot, I already have the Time Machine Buddy widget on my Desktop, just been so long I had forgotten.

That showed me:

“Starting standard backup
Backing up to: /Volumes/2TB/Backups.backupdb
Waiting for index to be ready (101)
2.52 GB required (including padding), 1.18 TB available
Indexing a file failed. Returned 1 for: /Library/Spotlight, /Volumes/2TB/Backups.backupdb/Apple’s MacBook Pro (2)/2013-09-03-071009.inProgress/C981E713-FC42-4A7D-BDD5-C83709DF0D5B/Macintosh HD/Library/Spotlight
Aborting backup”

Which shows that Time Machine has been choking on a Spotlight search file, which in turn led me to notice that my Spotlight seemed to be taking forever to complete an index (you can tell Spotlight is indexing, there’ll be a tiny black dot in the circle of the Spotlight magnifying glass top right of your screen).

Screen Shot 2013-09-04 at 11.01.28 AM

In fact, the hours remaining at one point said “About 11 MONTHS” remaining. Not encouraging. I know there’s a way to force Spotlight to reindex your Mac:

  • Open System Preferences
  • Click Spotlight icon
  • Click the Privacy button
  • Add your HDD to the list “Prevent Spotlight from searching these locations”
  • Close System Preferences
  • Re-open, click Spotlight icon, click Privacy button, remove your HDD from the list, close System Preferences

This should kick off a fresh index, it’s much easier than one method I figured out a while ago where you manually delete the Spotlight index file (at one stage my Spotlight decided it didn’t want to index my local hard drive, just my external drives).

So far so good. Time Machine successfully completed its last backup. Spotlight has been sporadically re-indexing, but appears to be returning correct search results when I try a few tests.

Power up the trenching tool, we’re going to lay our own optic fibre for fast internet to our homes and businesses

Screen Shot 2013-08-26 at 5.23.41 PM

I heard about B4RN on the radio last night, a fascinating story how a group of residents in rural England became weary waiting for the phone companies to make fast broadband available. Their solution? Lay their own optic fibre to their properties, offering 1Gb download speeds.

The success of the project is completely in the hands of the participants, who can subscribe for the service, and even buy shares to increase the capital available to invest in growing the network.

The purpose of the project is to take a new approach to the ownership, financial and deployment models used traditionally, and still proposed by, telecommunications companies. These models invariably leave rural areas outside of the scope of economic viability for the telecoms companies, and have helped to create the Digital Divide between rural and urban Britain.

You can even sponsor a metre of optic fibre for £5. Apparently when the phone company lays fibre it costs £140 a metre, when you use volunteer community labor, the cost plummets. Plus you can have fibre wherever you darn well like, as opposed to the phone company which uses profit/loss calculations to determine whether the investment is commercially viable. As the CEO of B4RN said in an interview with the BBC:

“…fast broadband is not a luxury now, whether in the town or the country. ‘Farmers are being told they have to fill in forms online,” he says. “If you haven’t got broadband you are severely disadvantaged.'”

If you ever needed any affirmation of the value a community places on proper high speed broadband, B4RN is the model, continuing to undermine the ridiculous politics played with the National Broadband Network in Australia, especially by the Liberal Party with their neutered model of fibre to the node.

If Tony Abbott wins power I suspect you’ll find me out on my street powering up the trenching machine and encouraging my neighbours to come help me lay our own fibre as well.

Source Control Window disappears in Visual Studio 2012

2844.VS_tm_Purp526_rgb

A little weirdness with Visual Studio 2012 – the Source Control Window disappeared and nothing seemed to bring it back. I could open a solution from the Recent list, and open a file from the Solution, but still no Source Control Window would launch or display. And View -> Other Windows -> Source Control Window did nothing.

All until a colleague pointed out that, if you watched closely, it seemed like the window was loading, just not visible. So we tried Window > Reset Window Layout and all was well.

Drove me crazy for 15 minutes – and the simplest solution turned out the right one.

If I have both internet and wifi enabled on my Apple Mac which connection is used?

I’ve long pondered this – if I have my MacBook connected both to ethernet and WiFi, which internet connection is it actually using?

In general sitting at my desk I want my Mac on ethernet, because speed-wise I see anything up to 100Mb down our cable connection. But I like having the WiFi on because then my iPhone and iPad are syncing in the background, and I don’t have to remember to turn the WiFi on and off as I move to and fro. However, the connection speed over the WiFi is slower, and I tend to see disconnects from my company’s VPNs although I could probably solve that with a bit of fiddling with the cable router configuration.

Finally I’ve tracked down the answer, and it’s simple.

Open System Preferences > Network. You’ll see a list of your connections on the left hand side. The active ones are green.

Screen Shot 2013-08-06 at 3.13.10 PM

The answer is, your Mac will use the connections in order – so if Ethernet is active and top of the list, that’s the connection used.

By default the order looks good to me – but you can change. Click the little ‘gear’ icon at the bottom of the list, there’s an option to change the order.

Screen Shot 2013-08-06 at 3.19.31 PM

Online media outlets seem to have thrown content quality out the window

omg_news

A while back the idea of lists hit social media marketing – apparently people luuuurve lists of things, so the marketing ‘experts’ told us all to compile lists of ‘stuff’ for our blog posts, because this would generate lots of traffic.

I’ve been watching the next twist – extending the social engineering by publishing a list, promoting it on social media and insisting that number so and so is the ‘best’.

Screen Shot 2013-07-26 at 9.13.07 AM

Of course the most interesting one is not the first one you’ll see:

Screen Shot 2013-07-26 at 9.48.30 AM

There are 15 items, one per page, and so you’ll need to click through 15 to 5 before you find the mistake that is soooo common. The clue of course lies with all the ads on the page – 10 clicks means those ads have all been served 10 times, making the web site statistics look good and improving the chance a visitor will click an ad.

I’ll save you the bother, #5 was:

Creating a Facebook or Twitter account and expecting this to be enough is a common mistake. Social media efforts don’t drive themselves, and it’s not enough just to create a fan page without following through with creative content.

The blog publisher is not even creating the content, it’s all lifted from other places.

There was an interesting piece by Ryan Holiday on betabeat.com a few weeks ago, where he set out to illustrate the lows the blog publishing world has plumbed in order to boost page views.

Ryan demonstrates techniques commonly used by the major online media outlets to artificially increase their traffic, and concludes that online media today is a racket:

A racket where investors and media moguls make millions, where individual bloggers driven by pageview bonuses exaggerate and distort the news for their share of the bounty, where promoters using tactics like mine can generate massive publicity for free, and readers–having no idea that this is occurring–click away, think they are receiving “news.”

I vividly recall establishing our online news content company in 2000, and being told by the pundits of the day that nobody would pay for online content – advice we promptly disproved. Our customers *did* pay us to provide them with highly relevant, good quality content. They voted with their feet, and flocked to our web site.  We were successful because at the time we were pretty much the only media outlet providing our type of content to our audience.

There is a new reality today I think – there’s only so much news, and only so many potential customers, and an over-crowded publisher market. The maths don’t work.

The competition for eyeballs is so fierce, many online media outlets seem to have thrown any notion of content quality out the window as they chase a finite audience in competition with a million other media businesses.