Friday, August 29, 2008

Setting column width, not minimum column width

I've been working on a web page formatted for iPhone, and in this context the width of the page and the content on the page, is very important. First of all you don't want the page to be too wide, because then the text might be too small to read. But you also want the entire page to fit within the width of the screen, because no-one wants to have to scroll from side to side when reading lines of text.

So, of course, you can use a table and specify the width of cells and table, but this actually sets the minimum width - if the content is wider than the specified width, then the cell or table will expand to suit. In my case it is a long string of continuous text without spaces in, specifically a long URL.

I'm sure the wiser ones of you reading this will already be thinking CSS. Indeed, it gave me the answer. Specifically, CSS version 3, which is not supported on all browsers. Luckily iPhone's Safari browser is one of the few browsers that does support CSS3.

The answer came from searching for how to force text to wrap to a specific width, i.e. <p style="width: 900px; word-wrap: break-word"> which I found from this page:

Sunday, August 24, 2008

Just bold

So, now that that's working, the next question is what is the minimum? Can you get away with just having the first 5 words in your posting being in bold, or do you really need to have a mixture of italics in there too? This one just has the first 5 words in bold. We will see...

This time I'll include italics

Well, something seems to have inserted unintended carriage-returns into my last post, so that proves, I guess, something. Maybe if I include some italics in this post, and some bold, then the richness of this text will prevail...?

Rich text or not rich text, that is the question

So, that is good news. Sending a rich text email from gMail does not
prompt those spurious carriage-returns to be added. So, what about
Apple's Mail program on the Mac? I have just set up my gMail account
on my Mac's Mail program, just so I can test this, and the email I am
writing is rich text, in the sense that if I go to the Format menu at
the top of the screen it gives me the option to "Make Plain Text" --
which implies that it must already be in rich text form. But so far I
have not included any italics or bold or any other formatting, so
maybe it will make an executive decision when I hit 'Send' and will
unilaterally send it in plain text form only...

More spurious carriage-returns

Well, there we are, the plain text email from gMail seems to have put in those unwanted carriage-returns. Annoying. Okay, well this time I am going to try with a Rich Text email within gMail. This sentence should be in italics. All the text so far is all on one line, so we'll see what happens this time...

Spurious carriage-returns

What is it with spurious carriage-returns, or line-feeds, or whatever
is the correct name for them? First we had some problems at work
because some Javascript Include files were being exported from our
repository on a Windows PC and therefore included Windows-friendly
line-feed characters at the end of every line, and therefore made the
file itself slightly larger than it was in Unix format, and this then
caused the Javascript compilation limit to be reached, breaking the
page. Not good. Just goes to show another reason why Unix is better
than Windows.
And then with this email posting to Blogger shenanigans! It seems that
somehow in the email to blog post process, some additional line-feeds
or carriage-returns appear. Why is that?
Anyway, this is a plain text email written in gMail. I wonder whether
it will be affected...

Saturday, August 23, 2008

How to post to Blogger from your iPhone via email

So, my starting point was the old problem of the lack of copy and paste functionality on the iPhone. How on earth would one be able to post links to interesting web pages on one's iPhone without memorizing and typing back in the URLs? The answer comes via the use of email. So when you're on an interesting web page you can hit the plus button and there's a choice of 'Mail link to this page'. You can then craft an email that includes a link to that URL, along with any commentary, and send that off somewhere to an email address.

And blogging services such as iBloggin and Blogger have facilities that allow you to publish blog post via email. Here's the help page from Blogger:

Well, I set this up for this blog, but I had some confusing teething troubles. It seems this help page was not as helpful as it could have been...

1. When it tells you to keep the email address secret as anyone could post on your blog, that would lead one to believe one could send the email from any email address, wouldn't it? Well, I found that it only posts my email contents if I send the email from the email account belonging to the Google Account for that blogger identity. CORRECTION (24/Aug/08): It now seems like possibly it posts email contents from gMail addresses only, and maybe from any gMail address. As I learn more I will update this post... CORRECTION (29/Aug/08): It seems like all those .Mac emails I sent before eventually were accepted and started turning up as blog posts after a few days of delay. Now I'm very confused.

2. If you allow other authors to post on that blog, they will have to set up their own destination email address if they want to post to the blog via email.

I hope those two lessons will be useful to someone reading this and they will waste less time than I did in setting this up. Still, it was worth it for me in the end!

Sent from my iPhone