Android apps with Basic4Android

For the last year or so, I’ve been doing more coding than writing, and a lot of that coding has been in various dialects of BASIC, using first Real Studio (now Xojo) to build cross platform apps for Mac and Windows, and latterly Basic4Android. I wanted to code for Android, but never having bothered with Java (and my degree in computing science, back in the late 80s didn’t cover C), I didn’t really fancy getting into that.

Basic4Android, it turns out, is a great way to get into Android app development; thanks to a huge number of libraries, it’s very easy to build up your app using lots of great looking graphical elements, or things like web services and databases, and it’s both relatively low cost and has no royalties on any of the apps that you create with it.

On sale May 29th

On sale May 29th

Earlier this year, I was commissioned to write a MagBook about it, and that will be on sale on the 29th of May, titled “Build your own Android App.” It starts with an introduction to what you need to know about programming for Android, and a look at Basic4Android, then takes you through various stages from the very simplest to building a complete game and distributing it on the Play Store.

I hope that even those who don’t want to create a game will find it useful – we cover some of the important libraries available, graphics technicals, thinking about user interaction, how to store and retrieve data, and more, most of which are applicable to just about every sort of app.

I’ve created a dedicated website for the magbook, which includes a list of the contents and many of the code samples, plus complete downloadable code for the app we create. And you can find the game, called Type Attack, in the Play Store.

I hope people find it useful.

 
 

Supply and demand

A digression from the usual subject matter here into politics; I’ve seen a lot of near-racist drivel (and some outright racist drivel too) floating around about Subway, and now The Sun is trying to stir up more much with their story about Halal chicken in Pizza Express, which is not news, and not the exclusive they think it to be, considering it’s something the company made clear a long time ago.

Idiots online are bemoaning Subway, claiming that the sandwich chain has “banned pork to avoid offending Muslims.” It’s the usual typical nonsense, that goes hand in hand with the stories about Christmas being banned for the same reason. Making up these stories – and yes, they are made up – helps feed a tide of xenophobia and make divisions in our society. It tries to set aside one group of people as something other than the rest.

The original inflammatory story about Subway was, as far as I can gather, in the Mail, and referred to “Muslim demands” that the store sell only Halal meat. And, of course, using “demands” in a headline makes it sound like there were angry Muslims, and pickets, and threats.

But that’s not what happened. What happened was something the Mail usually quite likes – market forces, or the law of supply and demand. The story talked of 185 branches of Subway selling Halal-only meat. That sounds like quite a lot, doesn’t it? We must be practically taken over by these nasty Muslim-friendly branches (actually, franchises) of Subway. Except we’re not. There are over 1500 outlets across the UK and Ireland (2012 figures, from the Subway website); the company has an intention to increase that to 2,000 by 2015. So we’re talking 10% of branches.

Contrary to what some hysterical people have been claiming, those branches do have window stickers to let people know meat is Halal; if you want to avoid it, you can. If, say, you have a principled objection to the method of slaughter, rather than an unprincipled objection to Muslims, because you think they’re nasty and just not British. But in that case, I’d expect you to avoid Kosher products too, and probably battery hens, and many other things with dubious welfare standards. Unless you just want to pick on one aspect, that happens to fit nicely around your other prejudices, so you can dress up a bit of good old Muslim bashing with a cloak of “but what about the poor animals.”

Let’s try a little thought experiment which, I think, pretty accurately sums up what has happened at Subway:

• Someone buys a bar in a nice sunny part of Spain. It sells all sorts of things, including lovely local tapas

• Lots of English people keep coming to the bar, and instead of wanting tapas, they ask for English food

• Eventually, there are so many people doing that, that the bar owner, realising he can make money, gets lots of it in stock

• Hardly anyone ever goes there for tapas any more

• In the end, the few bits of tapas in the fridge never get used, so the bar owner stops selling it

Not really a big deal, is it? Unless you love tapas. But even if you loved tapas, wouldn’t you think “that’s just supply and demand”? It’s how the market is supposed to work.

Wouldn’t it be a bit of a leap of the imagination to say “Expat demands make bar stop selling tapas” ? Especially if you knew that doing so would give ammunition to plenty of people telling folk that the English should go back home, or learn to eat the same way the Spanish do.

All that’s happened here is that – in around 10% of Subway stores – the franchisee has decided that they’ll do better business by selling Halal meat. (While in other countries, they have Halal stores, and Kosher stores, and some for other dietary rules). And in the other 90% of stores, nothing’s changed. Nothing’s been “banned because of Muslims”, nothing’s being forced on people who don’t want it. Some stores are selling things that their customers have asked for. You want bacon, then why don’t you go into a sandwich shop and ask for it? Don’t just moan that a store you don’t go to, and probably never will, has decided to listen to  requests from customers who do visit.

This isn’t “Sharia law” coming to Britain. It’s not something being banned because of Muslims. It’s a big business tweaking the product lineup in some areas to sell more of the things that make them and their franchisees money.

But that, of course, isn’t anywhere near as good a story.

 
 

Ditching the clutter on Facebook

Facebook’s new look manages to squeeze the stuff I care about into a small central section of the page, with navigation down the left and a stream of promoted junk at the right.

Here’s how you can make it a bit more tolerable, if you’re a Firefox user. First grab the Stylish Add On for the browser. You’ll need to restart when it’s been installed.

Next head to Facebook and your main news feed page. Click the S drop down added by Stylish, and choose “Write new style” followed by “For facebook.com” You’ll see a window like this appear.

Give it a name, like FB Tidyup, and add some custom CSS. This is a quick and dirty fix, but I don’t care about that right hand column, which handily has the ID rightCol, and so can be hidden with this code:

#rightCol {
 display:none;
}

The main part of the page can be widened; I chose 800pixels, as it’s a little nicer, though of course not everything scales perfectly. Use this css

#contentArea {
 width: 800px !important;
}

Put that all in the box and the results should be like this:

Click Preview to check you like the results, and then Save if you’re happy. The end result is your news feed looking something like this:

FBtidied

Like I say, this is quick and dirty, but an improvement, I think.

 
 

Social vs Communal – or why TV makers are wasting time with Twitter

This morning, fellow journo Steve May tweeted about the new range of Sony TV sets; one of the things he asked about was Sony’s new transparent Twitter bar:

I honestly can’t say that I’m a great fan either, and as I said, I think Twitter is very much something people want on a second screen, like a tablet or their mobile phone, rather than on the main screen. The TV companies seem to think because Twitter is popular, and people use it a lot when watching TV, then since their sets have internet connectivity, they should build it in. And honestly, I think they’re really missing the point. What they’re trying to do is to turn a social experience into a communal one. Very often those are different things.

So, I thought I’d try and set down my thoughts on why. This isn’t specifically aimed at Sony; other TV makers have tried to do Twitter too, with some bizarre results – Panasonic’s 2011 Twitter implementation was full screen, so you couldn’t watch a program at the same time!

At least in that respect, the new Sony overlay is an improvement. But what if you’re watching a programme that has subtitles, or a ticker at the bottom of the screen? Perhaps you can move it, I don’t know; but it’s certainly going to be irksome. And unless Sony has figured out a way of composing a tweet easily, that problem too remains to be solved.

I don’t know, either, if you are forced to have your whole timeline scrolling past, or if you can select a specific hash tag to follow – without that, a lot of people will find this pretty annoying. Not just because you won’t be able to focus on the tweets specific to the programme you’re watching, but because you might end up with something spoiled too; what if you’re recording something on another channel, and you don’t want to see twitter spoilers? You might be out of luck.

But for me, I think the biggest problem is this confusion of social and communal. Yes, of course there are a lot of single person households, and they won’t face this issue as much, but a lot of people do still watch TV in groups. Even single people have been known to have parties for the Eurovision Song Contest.

And will everyone watching at the same time want the distraction of an on-screen twitter feed?

In my experience (perhaps I’m just weird), I very probably won’t want someone watching while I laboriously compose a message using the TV remote. I’d far rather my witty repartee appears, fully formed, so that everyone can smile in wry amusement at the same time. Using the TV to do that is a bit like having to stand at a blackboard and write your joke out laboriously, hoping that some smart-alec at the back isn’t going to shout out the punchline before you finish.

I’m also pretty sure that I’m not the only person who may have more than one twitter account, used for different things. In my case, one of them is definitely smuttier than the other, but I might well be using both at the same time. The lewder comments about hotties in the song contest will go to one account, the more innocent to another. And just because I’m in the same room as someone doesn’t necessarily mean that I want them to see everything that I view on twitter.

Putting the feed on the screen like this is like putting it up on a noticeboard; everyone can read it. They can see whom you follow, or interact with. And yes, unless you have a private account, they could go on the web and do the same – but they’d have to make a conscious effort, and they probably won’t actually bother, because they have better things to do.

On the TV, though? The fact you’ve just interacted with a porn star is floating past, right in front of their eyes. It may be a perfectly innocent comment about the Bulgarian entry, but even so… Some things might not be secrets, but that doesn’t automatically mean they’re things you choose to share with everyone in your living room.

Your phone or tablet can manage all this much better; you can easily switch between accounts, follow hash tags, mute particular topics, and tailor the experience in ways that a TV simply isn’t going to offer, unless the interface becomes even more complex. There’s certainly a place for social media in TV – but it’s really about people interacting about or with the shows. Not about using the TV screen to replace your phone or tablet, when it’s already busy with showing you the programme.

Social media isn’t, generally, a private experience. But that doesn’t necessarily mean that it’s a wholly public one, either. It seems to me that by putting it on the TV screen, and making it communal, TV makers are just showing they don’t really understand the difference.

 
 

First generation Freeview kit is on the way out

It’s not really that long since Digital Switchover completed in the UK, but on the 16th of January 2014 we saw the beginning of the end for the first generation of the Freeview platform.

What’s happened? Al Jazeera Arabic. In itself, that might seem fairly unremarkable; it’s not the first non-english service, as there are already channels on the platform that cater to Welsh and Gaelic speakers. But this is the first standard definition broadcast channel that won’t be available to people who have original Freeview kit. And I’m willing to bet that it won’t be the last, either.

When Freeview originally launched, it used the DVB-T transmission standard, and the MPEG2 picture encoding. Both were the obvious choice at the time, and it’s still very easy to buy a TV – even one claiming to be ‘HD Ready’ – that is capable of receiving nothing else. There is a lot of this kit in UK homes, some of it bought specifically because switchover was coming.

Meanwhile, technology marched on, and Freeview HD launched, using the more modern and efficient DVB-T2 for transmission and MPEG4/H.264 for encoding. By and large, unless you wanted HD pictures, you didn’t need to worry about that – and the HD that’s available is a simulcast of existing SD services. By not having equipment that copes with the newer standards, you’re not missing out on any actual programmes, just better picture quality. Or at least, you weren’t, until this month.

The new channel is running on one of the new ‘temporary’ multiplexes that were set up last year. These have so far been used to provide extra HD services, like BBC Four HD, and Al Jazeera’s main news service in HD. I wrote in February last year that these were a stalking horse for, effectively, a second digital switchover.

Ofcom is keen (like the government in general) to sell anything it can. And that includes the spectrum presently used for TV broadcasting. The extra HD channels aren’t just because they’re feeling kind and fluffy. They’re because they want us all to have equipment that is capable of receiving DVB-T2/H.264, because ultimately, when they take away some of the spectrum that’s used for TV now, and sell it to spivs running mobile networks, the only way Freeview can maintain the level of service that it has – let alone add anything more – is by a wholesale switch to those newer standards, including for standard definition channels.

The only people who will be able to watch Al Jazeera Arabic on Freeview are those who have HD capable receivers, with DVB-T2 and H.264, even though it’s an SD only channel. Given the minority interest, most people probably won’t bat an eyelid at this. But make no mistake, this is the beginning of the end for your first generation Freeview kit.

That kit may not be as old as you think, either: a quick look at some online retailers today shows a fair bit of kit, especially at the smaller screen sizes, that still lacks a Freeview HD tuner, which means that it won’t pick up Al Jazeera Arabic, or any later channels using the same technology. More than ever, if you’re buying new kit, if you want to continue to receive terrestrial broadcasts in the UK, it’s essential it’s able to receive Freeview HD, because you’ll increasingly need the same technology for SD channels too.

 
 

Sipgate, Asterisk and OpenWRT

In recent issues of Computer Shopper UK, I’ve been looking at how to use OpenWRT on small routers, like the TP Link TL-WDR3600. Those articles aren’t online, but I thought I’d share one of the more useful tips from them, as it deserves a wider audience.

With OpenWRT, it’s simple to install Asterisk, giving you a software phone system, and the Luci web interface even lets you set up VoIP accounts and extensions very easily. As long as you don’t want anything too complicated, you should do fine. Sipgate is a popular choice of provider for many people; there are no monthly fees, and you can choose from local phone numbers all over the place – a tip I included in the article is to get a Belfast number, so people from the Republic of Ireland can call using their national 048 code, instead of having to make an international call to reach a number in the rest of the UK.

However, if you download the current release of OpenWRT right now, and install Asterisk, there’s a very good chance that simply adding a Sipgate account via the web interface won’t actually work, and you won’t be able to receive calls. This, is seems, is do to a bug in some of the underlying libraries. But after a bit of digging around, I came up with a solution. You’ll first need to set everything else up in the web interface, as making any changes there will overwrite the config files.

When that’s done, you need to edit the sip_peers.conf file. If your Sipgate ID is 1234567, then look for the section that starts

[peer-1234567_sipgate_co_uk]

Within that section, change the type from ‘peer‘ to ‘friend‘, set ‘qualify‘ to ‘yes‘ and add a line for the dtmfmode:

dtmfmode = rfc2833

Now, edit sip_registrations.conf. Look for the line that registers with the provider; if the password is PASSWORD, then it will look something like this

register => 1234567:PASSWORD@peer-1234567_sipgate_co_uk

Since the problem seems to be with a name resolution library, you need to work out the IP address for the VoIP registrar, which in this case is 217.10.79.23.  That ensures the router will find the correct system to register, but it still fails, as it looks like the Sipgate login process wants the domain included. So, you have to include that in the username part.

That’s simple enough, and the resulting line, which certainly made my Sipgate registration work perfectly under OpenWRT and Asterisk, looks like this (obviously, replace the user id and password with your own):

register => 1234567@sipgate.co.uk:PASSWORD@217.10.79.23

And that should be it!

 
 

Gmail – a Christmas Round Robin

Fortunately, no one I know sends those ghastly round-robin emails or letters at Christmas, full of the details of their ghastly children, Jocasta and Tristran, and how they’re doing so well at competitive lute-wielding, and such nonsense.

Yet, through the magic of Gmail, I get to experience much the same effect, with the odd bonus that everyone involved appears to have the same surname as I do, and the same first initial. The Ns Whitfield, as it were.

So, this year, I know that someone has stopped by Norman’s profile on Classmates, while Nicole spent two nights at the Ramada Airport Miami North; I don’t know if she enjoyed her stay, but I’ve been invited to review it on a site called Hotwire. I wonder if this is the same Nicole who lives in Ohio, or maybe there are two of them.

I also know that Nicole has a new Samsung device, which came with 48GB of free Dropbox space. And Dropbox are sending her emails with sad faces, because she hasn’t used it yet. Don’t worry Dropbox – it’s nothing personal. She just never got your email, so I hope she’s not spending money on memory cards or anything silly like that.

Poor Nicholas didn’t get his email, either. Back in November he submitted his resume online for the job of Forklift operator in a town in Indiana; I do hope he got the job, but he probably didn’t even find out if he got an interview.

Meanwhile, Natasha, a Home Mortgage Consultant called Brian Kalwicki is still keen to help you understand all about owning a home, and doubtless the various exciting finance products he can help you with. While you’re thinking about a new home, Natasha, I hope you’re enjoying the T Mobile 4G Mobile HotSpot (Refurbished) that was shipped to your Colorado address back in August. How’s that working out for you? Is the coverage any good?

Nakia, who appears to work for a 3rd Avenue law firm in New York: I do hope the sandwiches turned up. The Chicken Milanese Platter sounded the most tempting, though I see you opted for only a dozen of them, and only the ‘basic’ presentation. Presumably the clients or staff didn’t warrant a better arrangement on the plate.

I mustn’t forget Nita, of course; Craig forwarded you a joke back in February, but why you tried to send it to what you thought was your own Gmail account is a mystery. As is why you found the ‘joke’ funny, frankly.

Who are all these people?

I have no idea who these people are, but Gmail has given me a glimpse of their lives over the past year – and in some cases, information that, in the UK, it would almost certainly be a breach of Data Protection regulations to give out about someone. I’ve been invited to log in to web sites, including the Texas Teacher Retirement System (NC? Are you out there?) and people’s health plans. Norman’s Classmates profile didn’t even ask for a password to have “his story” altered. As a result it now includes the text

Norman also doesn’t know what his own email address is, and a random person in London with the same first initial and last name keeps receiving junk from Classmates

which may at least prompt someone to ask him to check his details. Some companies simply ignore any attempt to correct matters, or send emails from an address that isn’t monitored, and offer no un-subscribe link.

I’ve wished Nicole a merry christmas, because the email from Hotwire included her phone number; I’ve left messages on Brian Kalwicki’s voicemail, but still he sends me the messages for Natasha. There’s a chance Nicholas may get a job, now that I’ve told the website they really should try to contact him another way. But T Mobile can’t change the email address on an account unless I know the account number, which wasn’t in the email they sent me. And, frankly, it’s tedious phoning up companies in the US and trying to sort out this mess, on my own phone bill.

Why don’t these people know their own email address?

Honestly, I have no idea. I’ve had my nwhitfield address at Gmail for a very long time – since you used to have introductions to get on to the service, and Guy Kewney kindly sent me one. So no one else should have been able to sign up and get one like it. Some of them clearly use nwhitfield at other domains, and perhaps just got it wrong. But have they never realised they don’t get the confirmations they expect to?

And what of the companies? People are sending out information that, in many cases, is private. And they do so without, clearly, first verifying that the address works. There’s no “Welcome to Wells Fargo, Natasha. Please click this link to confirm this is your email account,” just the information about mortgages.

Surely, for any web site, let alone ones dealing with things as sensitive as mortgages, tax arrears, job applications and retirement plans, verifying the emails are going to the right person is sensible. Sure, it may add an extra step to the sign up process, but isn’t that worth the wait, before you spray the confidential details of someone else around the internet?

If you are one of the Ns Whitfield mentioned here, I do hope you have a pleasant 2014. But, with the best will in the world, I also hope to hear rather less about you. Check your email addresses, and type them more carefully in future.

Happy New Year.