A better bit o’ twitter than the bitter twitter Tommy Titter bought

Just because everyone these days writes a Twitter client:

This was actually a quick hack project to make up for the fact that I missed CocoaHeads tonight (due to a combination of an uninteresting phone call, and a decision to recover from the phone call by using the rest of my petrol tank). Really just an excuse to play with some APIs (the tweets are grabbed by the controller using NSURLConnection, then some NSXML/XPath extracts the useful information (or not, it is Twitter after all) and puts it into the model), there are many things which need to happen before this is at all a useful Twitter client; the ability to write back, nicer formatting are just the starters. Shiny Core Animation twitting ought to happen.

Still, not bad for two hours I think.

Posted in cocoa, leopard, objc, ooa/d, xml | Leave a comment

Fuzzing as a security testing tool

Google have a new browser project, called chrome, and in their introduction they explain perfectly, through the medium of image, how fuzzing works.

Of course, as anyone could tell you, if you take a thousand monkeys and a thousand typewriters and put them all in a room for long enough, you will end up with a thousand broken typewriters, ten fat monkeys and 990 monkey skeletons.

Posted in Google, pictures | Leave a comment

Walking a mile dans ses chausseurs

The word ‘translator’ has an interesting history. In the Anglo-Saxon language, ‘wealhstod’ meant “learned in Welsh” more or less, and described someone who could parlay with the important members of the local British tribes. As is often the case with invasions the British started to use the word, so the Welsh title ‘Gwalstawt’ means “interpreter of tongues”, i.e. the Welsh word for “can speak another language” originally meant “can speak Welsh” (there’s another word more closely related to Breton treiñ or Cornish trélya in Welsh, too; trosi).

Anyway, to see what localisation people go through during the l10n process, I decided the best thing to do was to try it myself. To save the time it would have taken to write an internationalised app, I used someone else’s; namely TextEdit. Here’s the result after about 90 minutes of work:

Trahtendebyrdenne

The first thing to notice is that I haven’t actually got much done yet. I’ve started working on the main menu NIB file (Edit.nib), and I’m about halfway through that. At this rate, it would take me at least a (working) day to finish – granted I’m no expert at the task, so I’m having to make a more heroic effort on otherwise “standard” translations than most localisers would. Although I do have a glossary to help. Even so, TextEdit is a fairly simple app; it’s easy to see that even if the translation became a mechanical process, translating a complex program would take a long time.

The other thing you might have noticed is that Mac OS X doesn’t actually support Old English, and yet that’s the language of my translation. There’s a simple trick here; convince Mac OS X that it does support Old English ;-). Type this command in the Terminal:

$ defaults write NSGlobalDomain AppleLanguages ‘(ang, en, /* other languages */)’

and Robert, as they say, is your father’s brother. Apps will now look for localised resources in ‘ang.lproj’ when they start, so that’s where your Old English resources live.

Posted in cocoa, i18n, l10n | Leave a comment

Next CocoaHeads Swindon meeting

1st September (that’s this coming Monday), in the Glue Pot, Swindon. 8:00pm start. Chris Walters will talk about, well, something, and we’ll be drinking beer, listening and occasionally chipping in. See you there!

Posted in whatevs | Leave a comment

So are Macs uber-pricey?

No, but Sony Vaios are.

Posted in whatevs | Leave a comment

Back from holiday

I went on holiday to Stockholm this week. Of the ~1.5GB I downloaded from the camera, this was the photo I thought most apt to describe the experience on this blog:

Ubuntu

Posted in pictures | 1 Comment

Cocoa#, Mono and Me

My great application:

Currency Converter.net

Yeah, OK, not so great. But this Inverse Hoffman is the result of a couple of hours hacking in Mono, with Cocoa#. My app’s largely based on the Stupid Word Counter tutorial, though it’s a from-scratch implementation of the famous Apple/NeXT sample application in C#.

Firstly, a little history. My first encounter with .NET was back in about 2003 at a Microsoft Developer Roadshow in the car park (and later lecture theatre) in Oxford’s comlab. I was particularly interested in their discussions of cross-platform capability, Project Rotor (I kept in touch with one of the Rotor developers) and so on, but really didn’t see much exciting in .NET. Nonetheless, being a fair man, I took my beta CDs of Windows 2003 and Visual Studio .NET and gave them a whirl. Unfortunately, still not much interesting. Largely due to buggy betas and a lack of beta documentation.

Now accessing Cocoa from non-ObjC languages is nothing new, we’ve been doing it from Perl, Python, Ruby and Java for ages and partcularly old farts might even remember Objective-Tcl. Why should I care about Cocoa#? Well for a start, there are likely to be a lot Windows developers out there with some (language that boils down to MS IL eventually) skills who are wanting to produce Mac applications, and it’d be interesting to see what we’ll end up with when they do. And it’s always fun to learn a new language, anyway ;-)

Good points

  • Real NIB files. No really, that interface is genuinely an IB 3.x NIB based on the Cocoa Application template. The objects inside it are Objective-C objects, and there are good old outlets and actions (I haven’t yet investigated whether Cocoa Bindings would work).
  • macpack. A command-line tool which takes your IL executable and wraps it up in a Cocoa application bundle, ready for drag-deployment.
  • Good inline bridging information. Unlike, say, PyObjC the language bridge isn’t completely dynamic, but unlike the Java bridge or JIGS you don’t have to keep a separate manual mapping of real classes onto ObjC shams. For instance, here’s the controller from Currency Converter.net, complete with class, ivar and method exports:

namespace info.thaesofereode.CurrencyConverter
{
[Cocoa.Register("CurrencyConverterController")]
public partial class CurrencyConverterController : Cocoa.Object
{
public CurrencyConverterController(System.IntPtr native_object) : base(native_object) {}

//Cocoa IBOutlets
[Cocoa.Connect]
private Cocoa.TextField inputCurrency;
[Cocoa.Connect]
private Cocoa.TextField outputCurrency;
[Cocoa.Connect]
private Cocoa.TextField conversionRate;

//Cocoa IBAction
[Cocoa.Export("calculate:")]
public void calculate(Cocoa.Object sender)
{
//get the rate from the view
System.String rate = conversionRate.Value;
CurrencyConverterModel.Rate = System.Convert.ToDouble(rate);
//get the currency
System.String input = inputCurrency.Value;
System.Double output = CurrencyConverterModel.convert(System.Convert.ToDouble(input));
//update the UI
outputCurrency.Value = System.Convert.ToString(output);
}
}
}

Bad points

  • Not very Cocoa-like wrapper classes. I think this is deliberate; they’ve gone for making the Cocoa shim look like a .NET interface because after all, we’re programming from .NET. This is a bit disappointing as I’m more familiar with PyObjC and the Perl-ObjC-Bridge where the APIs are left pointedly alone, but given the target audience of Cocoa# it’s unsurprising.
  • MonoDevelop. Luckily, using it isn’t mandated.

So, overall, one more good point than bad (and a tentative two, if you overlook MonoDevelop); a pretty good initial evaluation and I might give this a deeper scrape.

Posted in cocoa, mono | 1 Comment

Microblogging

For a long time, I deliberately avoided microblogs like twitter. I thought that they were simply an acknowledgement that people want to be published more than they want to have something to say. However, it would be rude of me to completely disavow the medium without actually giving it a go.

To that end, I may indeed be iamleeg on twitter, as soon as twitter actually finishes processing the signup form.

I’d like to point out that one problem I’m going to have is brevity – I have spent 650 characters telling you what my username is. Constraining myself to SMS-sized wibblings will indeed be tricksy.

Posted in crosspost, meta-interwebs | Leave a comment

Common sense writ large

Looking at the bottom of Apple’s Q3 results, as indeed with any similar publication from a US publicly-traded company, we see the following text.

This press release contains forward-looking statements including without limitation those about the Company’s estimated revenue and earnings per share. These statements involve risks and uncertainties, and actual results may differ. Risks and uncertainties include without limitation potential litigation from the matters investigated by the special committee of the board of directors and the restatement of the Company’s consolidated financial statements; unfavorable results of other legal proceedings; the effect of competitive and economic factors, and the Company’s reaction to those factors, on consumer and business buying decisions with respect to the Company’s products; war, terrorism, public health issues, and other circumstances that could disrupt supply, delivery, or demand of products; continued competitive pressures in the marketplace; the Company’s reliance on sole service providers for iPhone in certain countries; the continued availability on acceptable terms of certain components and services essential to the Company’s business currently obtained by the Company from sole or limited sources; the ability of the Company to deliver to the marketplace and stimulate customer demand for new programs, products, and technological innovations on a timely basis; the effect that product transitions, changes in product pricing or mix, and/or increases in component costs could have on the Company’s gross margin; the effect that product quality problems could have on the Company’s sales and operating profits; the inventory risk associated with the Company’s need to order or commit to order product components in advance of customer orders; the effect that the Company’s dependency on manufacturing and logistics services provided by third parties may have on the quality, quantity or cost of products manufactured or services rendered; the Company’s dependency on the performance of distributors and other resellers of the Company’s products; the Company’s reliance on the availability of third-party digital content; and the potential impact of a finding that the Company has infringed on the intellectual property rights of others. More information on potential factors that could affect the Company’s financial results is included from time to time in the Company’s public reports filed with the SEC, including the Company’s Form 10-K for the fiscal year ended September 29, 2007; its Forms 10-Q for the quarters ended December 29, 2007 and March 29, 2008; and its Form 10-Q for the quarter ended June 28, 2008, to be filed with the SEC. The Company assumes no obligation to update any forward-looking statements or information, which speak as of their respective dates.

Erm, like, duh. Stuff which we say might happen in the future, might not actually happen. Really? You’ve got to get out of the financial industry, there’s a lucrative career ahead of you in construction.

Posted in Business | Leave a comment

Designing a secure Cocoa application

That’s the title of next month’s CocoaHeads Swindon, and I’ll be leading the presentation/discussion. So if you want to learn a little about how to ensuring your Cocoa app doesn’t give away the keys to the kingdom, or have some experiences to share with the rest of the group, come along! We’ll be at the Glue Pot, which is nice and near the train station as well as reasonably close to a car park. We’ll be congregating at 7:00 but will wait for everyone to be settled with a beer in their hand before starting ;-).

Posted in cocoa, metadev, security | Leave a comment