Saturday, 18 May 2013

Using the Blogger iPad App

If you compose your post in an app that supports rich text, for example, Textilus, you can paste the text in to the blogger app. Will it retain boldunderlineitalics and news.bbc.co.uk web links?  Apparently, yes.


And you can paste from web page selections too:

Fiat 500 Hatchback 1.4 Sport 3dr

Fiat 500 Hatchback 1.4 Sport 3dr
(2008-2009)

Cost new £9,474

A car's value is directly affected by its mileage and condition

Wednesday, 19 September 2012

Facebook Android App - not fit for purpose

Here is my review for the Facebook app in Google Play.
On my Galaxy S3 it takes over a minute to populate the news feed and can take even longer to load a photo. Using m.facebook.com is instantaneous through any of the browsers installed on my phone, so why would I want to use this piece of junk?
Just persuade your friends to use Google+, then none of us would have to be bothered with this intrusive, irritating, ad-riddled, cumbersome piece of bloatware.
It really has absolutely nothing to recommend it.

Thursday, 13 September 2012

Galaxy S3 - still bigger than the iPhone



Despite the brouhaha over the iPhone 5, I'm still pretty satisfied with my Samsung Galaxy S3. No doubt the iPhone 5 is a nice device and it will delight millions but it's not going to kill off Android or Samsung just yet.

Sir Jonathan Ive, Senior Vice President of Industrial Design at Apple Inc. is on video having a snipe at the size of some larger phones like the S3: "you can still operate the iPhone 5 with one hand".

He made the iPhone 5 taller, accommodating a 4" screen, but not wider. So you can hold it in one hand and type with your thumb. Or at least you could if the Apple keyboard wasn't so nasty. Personally, I think the native Android keyboard is no better but on an Android phone you can load up   SwiftKey, which actually makes typing easy on a phone. I can type even long documents faster on my S3 faster than on a real keyboard, thanks to SwiftKey's uncanny ability to predict what I'm going to say.

That said, I'm typing this on an iPad with the Blogger app. But the iPad won't fit in my pocket. The Galaxy S3 will and its bigger screen, better keyboard and ability to handle real files still make me glad I didn't wait for the iPhone 5.

Monday, 20 February 2012

Word count in Javascript

I notice the (current at time of writing) top Google results for word count in Javascript all offer something like:
function countWrong(textarea){
 var words=textarea.split(" ");
 alert(words.length+" words");
}
This is Wrong!


Why? Because  a space isn't the only thing that can separate words. If the user hits Return at the end of the word, this inserts a newline, which won't be counted as a word separator by the above code. And if the user adds commas or other punctuation  that is not followed by a space - or adds a comma with a space either side of it - then this will also result in an incorrect count.


Even worse, if the user has more than one space between words, or extra space at the end of the input, then this will up the word count making it even more inaccurate.


Fortunately there's an easy way to count words using regular expressions. A pattern of '\w+' will match a string of characters that can be in a word. With this technique, there's no need to worry about trimming the string to remove excess space, either.

So try this instead:


function wordCount(textarea){
 var chars=textarea.value.length,
 words=textarea.value.match(/\w+/g).length;
 alert(words+" words\n"+chars+" characters");
}


for a much more accurate result.

Friday, 13 January 2012

Search Engine Submission - only 2 required

"We will submit your website to hundreds of search engines!" sounds like a scam. It is. According to NetMarketShare, Google has 79% of the search market. In some countries it's a lot higher. Second is the Chinese search engine, Baidu on 11%. Then we have Yahoo on 6% and Bing on 3%. That adds up to 99% of the search engine market. The biggest player in the tiny bit remaining is Ask.

So, whilst it is true that there are hundreds of other search engines, virtually nobody is using them. OK, there's a few that may be be important in specific geographies - like Yandex in Russia, for example.

Yahoo search results are now supplied by Bing: if you can get listed in Bing, you will be listed in Yahoo. So to get 88% coverage - or more if you ignore the huge Chinese market - you just need to submit to Google and Bing.

If you don't want to ignore the huge Chinese market, Baidu has a submit page but when I recently created a brand new site the Baidu spider came to index it without any invitation from me, even though there were no other sites linking to it. I'm guessing it's somehow monitoring domain name registrations or DNS changes. All my older sites are listed, even though I've never done anything to submit pages to Baidu.

So how to get listed in Google? Sign up for Google Webmaster Tools and click the big red Add a Site link. To take full advantage of all the useful information that Webmaster Tools offers you will need to verify that you own the site. Google supplies a tiny XML file that you upload to your website and then you just tell Google it's there. It's all explained once you're registered.

To do the same for Bing (and therefore Yahoo) the process is virtually identical.  Sign up for Bing Webmaster Tools - name sound familiar? The Bing Add Site button is blue and Bing supplies a tiny XML file that you upload to your website and then you just tell Bing it's there. It's all explained once you're registered.

Now you should get spidered by the world's largest search engines and your fortune is made. Well maybe not, but you've certainly saved some money by not signing up for some "We will submit your website to thousands of search engines!" program.


Wednesday, 4 January 2012

Whizzywing has landed

Whizzywing is a new WYSIWYG editor, descended from Whizzywig but written anew in the age of HTML5. It has rethought the interface, putting the most common formatting in two dropdowns so that almost every format change can be done with a single click. It is very small - just 7k gzipped - but you can activate it without installing a single thing on your server as the code can be served from whizzywing.com. Just add
<script src="http://whizzywing.com/whizzywing.js"></script>
in the head section of your HTML and any element with a class="WYSIWYG" will be turned into a rich text editor. It's not limited to textareas. It's rich in features, too: correct me if I'm wrong but no other editor this small provides table editing. That's if there is another editor this small. With just 9 items on the toolbar you can do most of the formatting that you could do with CKEditor or TinyMCE but using a fraction of the bandwidth and without the installation headaches. It is easy to pick up and is more than powerful enough to use in a CMS.

Look carefully and you will see that network traffic is minimised by using no images on the toolbar - those little icons are all drawn using standard entities and CSS. It's faster even than using an image sprite. But everything is tailorable, so if you want to design your own icons, or use a a fancy set from elsewhere, you can add your own. Simple changes like excluding unwanted items from the toolbar can be done without using any javascript at all.

There has been a lot work under the bonnet to keep the generated HTML sane, no matter what browser you are using. There won't be a load of browser specific classes or deprecated font tags. Hit enter after a paragraph or a heading and you will get another paragraph - not a div, or orphaned text separated off with extra break tags. That means there won't be problems if you come back and edit the same text in a different browser.

The code is licenced under MIT and LGPL. You can download it, or create your own fork, at github. Try it at Whizzywing.


Friday, 16 December 2011

IOS5 now supports contenteditable. Come on Android!

Users who love or need their WYSIWYG editor (Whizzywig, TinyMCE, CKEditor etc.)  have been complaining for years that they would not work on on their mobile device. They could edit their blog or update their favourite site with rich text on their desktop machine but no joy on their iPad or smartphone.

They would not work because no mobile browser would support the contentEditable attribute despite the fact that all the major browsers support it in their desktop versions - Internet Explorer since 5.5. Well it seems Apple have been listening and now these things will work in IOS5. Great if you have an iPad 2.

Not so great with Android though, which not only still fails to support it, but actually lies if you test for support:


document.getElementById("test").isContentEditable


returns "true" but the onscreen keyboard will not appear so you cannot type into the edit area. This is Issue 8253 for Android. No sign of a fix yet.