Categories
fixing your desktop

Adobe’s Updater destroys Mac OS X: trying to remove it, part 1

UPDATE: this technique didn’t work. I’m still trying to find something that does. One friend suggested hard-coding the address of all Adobe websites into your “hosts” file, and blocking them. This would prevent you from visiting Adobe’s sites – but would prevent the evil Adobe Updater trojan from downloading – but it will still keep TRYING to run. I want to kill the damn thing completely.

Adobe just doesn’t seem to get the message: the latest version of Adobe Acrobat Reader puts a NEW virus(*) on your desktop, and all the old methods for removing it … don’t work. I previously used this tip from 2010 to remove the virus, while still using the Adobe software installed on my machine, but it no longer works.

With OS X Lion, I’m now trying again with a new approach (through trial and error this seems it might work – but I’ll update this in a few months if the virus still hasn’t come back)

  1. Open Finder
  2. Search for “Adobe Updater”
  3. Should be in an “Adobe Utilities” folder (if they had the chutzpah to call it “Adobe Viruses” I’d at least give them some credit for humour and outright shamelessness :))
  4. Delete that app – move it to Trash
  5. Empty the Trash (just in case it tries to run while hiding in the Trash – should be impossible, but with the back-door hacks Adobe’s already doing, you never know…)

(*) Adobe’s “Updater” has so far:

  1. crashed my laptop (multiple times)
  2. caused it to overheat to the point of hardware damage (laptop emits a screeching noise – that’s the hardware’s “emergency shutdown” warning)
  3. stolen my internet bandwidth when I’m on 3G modem, costing me money, and preventing me from using my own machine

This app cannot be disabled, the web is full of people complaining and begging Adobe to get rid of it, it’s installed secretly (the user is not informed it exists, let alone asked if they want it), and it has NOTHING TO DO WITH the actual app I installed.

What do you reckon? To me, that sounds closer to a virus than anything else. I don’t for a moment believe that Adobe is unaware of the amount of hatred it instils in their customers…

Categories
fixing your desktop

Warning: before you install OS X lion

… It removes one of the most valuable features of OS X for laptop owners:

OS x lion WILL NOT recharge a plugged-in iPhone when the lid is closed (after 10 seconds of pretending to charge – just long enough to fool you – Apple cuts the power)

At conferences, on sales trips, on plane trips … I have relied on this feature many many times to recharge a phone off the laptop battery.

Now?

Denied.

No user setting for it (that I can find so far) just … Removed :(

Categories
fixing your desktop

Apple laptop overheats when running iOS 5 on iPad or iPhone Simulator

Here’s ANOTHER overheating bug in Apple’s OS X.

This time, it’s the BlueTooth simulator built-in to the iOS Simulator (used every day by iPhone and iPad developers). The iOS5 version of the simulator has this crazy BT demon (process “BTServer”) that will sometimes – for no apparent reason – take up 100% CPU usage and melt your machine.

Solution:

  1. Open terminal
  2. Type: sudo vi “/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/LaunchDaemons/com.apple.BTServer.plist”
    • NOTE: the inverted commas are required, it seems
  3. Enter your admin password for the machine (the file is locked to all except admin)
  4. Use vi to change the 8th line to: <true/>
    • NOTE: the line immediately above should be: <key>Disabled</key>
Categories
fixing your desktop PHP programming

Fixing Suffusion: List posts from a single WordPress category

UPDATE: So … it seems Suffusion has (buried deep inside the config) a way of displaying category pages with a higher-level workaround to the WP “missing feature”. Although so far I can’t find a way to set the settings on individual pages (which is what you generally need). So, I’ll leave this post up – it’s a good starting point for customizing Suffusion’s page-of-pages (which is also, it seems, how you would customize its Category pages.

Just to be clear, this is not a bug in Suffision, although it’s an oversight and I hope it’ll be included in a future version. The core problem is in WordPress: people have been requesting/expecting this feature for the past 5+ years, it’s pretty basic, but for now the WP folks haven’t added it.

Problem: List all the posts in a single category

This is VERY frequently requested by WP users: you want to have a Page on your site which lists the posts that are in a single Category.

WP has a very low-level way of doing this – which is very error-prone, hard to maintain (it’s hard-coded to database ID’s!), and requires you to break every single theme you own. Every time the theme is updated, you have to manually re-implement the fix!

Fortunately, there’s a minimal workaround (which is documented in the WP docs now (scroll to bottom)) which still (!) requires some theme editing.

Fortunately, Suffusion already has most of this workaround implemented, so we can make the fix without screwing around with the theme so much. The source code in Suffusion is almost identical to the sample provided by WP – but unfortunately it’s missing a key part. In Suffusion, you CAN list posts on a Page, but you CANNOT filter those posts by category.

Solution: Combine WP’s source with Suffusion, with a bit of safety improvement

So, edit the file “posts.php”, titled (in Suffusion): “Page of Posts”.

Where it has these lines:

$args = array(
	'orderby' => 'date',
	'order' => 'DESC',
	'paged' => $paged,
);

…instead copy/paste the following:

$category_exclusive = get_post_meta($posts[0]->ID, 'category', true );

if( $category_exclusive )
{
$cat = get_cat_ID($category_exclusive);
$args = array(
	'category__in' => array( $cat ),
	'orderby' => 'date',
	'order' => 'DESC',
	'paged' => $paged,
);
}
else
{
$args = array(
	'orderby' => 'date',
	'order' => 'DESC',
	'paged' => $paged,
);
}

Usage

As per WP’s official suggestion … if you want a page to filter by category:

  1. Edit the page
  2. Select the “Page of Posts” template (this is Suffusion specific; in other themes, it might not exist)
  3. Add a “custom field” (scroll down on the edit screen), called “category”, with a value of the NAME of the category you want to be included

Explanation

One major thing here: We are being SAFE and non-destructive to the Suffusion theme.

Critically important is that we ONLY do a “filter by category” if the Page itself requests it. WP’s sample code does NOT have this protection (which is why the code above is slightly different).

This means that the rest of Suffusion (which doesn’t know about our new feature) is unaffected, and works as normal

Categories
fixing your desktop

Did Google+ break gmail?

One of the features of Gmail that I’ve long relied upon is the:

“Default: Reply to all, instead of Reply”

In 95% of cases, this is correct – it’s only rarely that you want to actively remove everyone else from the conversation.

…but this stopped working shortly after Google+ came out. Coincidence? I’m not sure.

Certainly, it’s caused MASSES of problems – people being dropped from email conversations, with associated obvious problems e.g. not hearing that a meeting’s been re-arranged.

I’ve bug-reported it to Google, but going on previous experience, there will be just silence.

Categories
android fixing your desktop funny Google? Doh! iphone

Google Street-View on iPhone: a lesson in UX design

Today I finally discovered that the iPhone has StreetView.

That means it’s only taken me THREE YEARS to find this secret feature that Google has worked very hard to make sure no-one ever uses.

The best bit? The top two Google results for “iPhone Streetview” were both incorrect, and useless – but claimed to “solve” the problem (one of them was a Yahoo answer, the other a blog).

Eventually, courtesy of this amusingly-titled (yet poor in terms of Google hits) blog post, I found the solution:

  1. There MUST be a pin on screen – either because:
    1. you did a search for a place, and Google has found it and created a pin
    2. you tapped the curled paper in bottom right, then pressed the “drop a pin” button (incidentally: instead of letting you “drop a pin”, that button arbitrarily sticks a non-moveable pin in the center of the (now-hidden) screen. Terrible UX and GUI design. Google’s designers: what were you thinking?)
  2. The popup that’s attached to the pin has a standard button, and a standard icon – BUT THAT ICON IS NOT AN ICON
    1. …it’s an invisible button…

When we’re building iPhone apps for clients, this comes up typically once on every project: if you want to do custom user-interfaces, do NOT make them look like Apple standard interfaces. Apple has trained 200 million (total number of i* devices) to expect that (in this case: ) “a map-popup has exactly one button”. You are fighting against the work of one of the richest companies on the planet, a company famous for its marketing, interface-design, and visual-obsessions.

Worse is if you then go and break all the standards on what a “button” should look like, so that (in Google’s case), they:

  1. Put something in the place that is reserved for a non-clickable icon
  2. Used an icon-image instead of a button-image
  3. Provided no other ways of triggering the feature…even though this is usually NOT the place the user would want to click to get that feature

I laughed out loud when I discovered this – 3 years it’s taken me to get this to work, and me a professional iPhone developer too! How long is it taking the average “normal” user? If nothing else had convinced me Google is fundamentally f***ed by their refusal to design for anything other than “engineers who are exactly like us (and the rest of you plebs don’t matter)”, this would have nailed it for me.

Categories
fixing your desktop

Fix Eclipse’s fonts on OS X

Eclipse current version (3.7?) randomly chooses some of the fonts from the System Font settings – this strikes me as rather stupid: you are only “allowed” to customize 90% of the fonts.

Since OS X (10.6.7) still can’t render fonts correctly, when Eclipse grabs the system fonts, they’re often “wrong”.

In Eclipse, you can choose most of your fonts by hand, and choose the font size etc. Combining this with the fixes (1, 1) that force Apple to stop “blurring” every font, you can almost get a useable Eclipse on OS X.

Almost.

Because of the stupid design mistake I mentioned above, the Package Explorer font in Eclipse is “non-configurable”. You want to change it? Give up. Eclipse won’t allow you.

Options

If you’ve used my other fixes for OS X, you’ll have fonts rendering nicely – as long as they don’t get too small.

Eclipse is hard-coded to make the Package Explorer use a stupidly small font. You cannot fix this. It’s a bug in Eclipse that’s been around for a long long time.

On most platforms, this is fine – your system fonts can be resized.

Except on OS X, where the OS has such terrible font-support.

Because of these two bugs (OS X has bad fonts … Eclipse is hard-coded to use small fonts), if you “fix” your OS X fonts to work for most apps, they’ll be broken in Eclipse.

Disabling system-fonts in OS X

The nearest I’ve found is that you can force Eclipse to ignore the *some* of the system fonts, by editing this file:

[eclipse install folder]/configuration/config.ini

and adding the lines:

# Use system small fonts (Mac OS X only)
org.eclipse.swt.internal.carbon.smallFonts=false

Fixing the Log Output window

This one is relatively easy when you spot it: the ADT plugin ignores all the existing fonts in Eclipse, and sets it’s own unique font, for literally one panel only (the coloured log / console pane).

The official name for that pane is LogCat (incidentally, by default, Eclipse hides this pane – even though you absolutely need it while working with Android – you need to go to the Window/Show Perspectives menu and manually add it).

In the main settings for Eclipse … Android, there’s a section LogCat, where you can set the font. This doesn’t actually work – it’s got a bug, and will crash itself – but if you ignore the crash, and restart Eclipse, your changes will be honoured.

What would really be nice

…is if Eclipse added literally one option to their fonts dialog: an option to manually choose the “missing” hardcoded font. Then all would work great.

…or (much more unlikely), if Apple would fix their entire font-rendering system. Over the years, they’ve fiddled with it a few times. They *know* that it’s “technically correct for print-designers, but completely incorrect for many normal users” they *know* that users find it impossible to work with – but their solution so far is to keep removing features and options, and forcing all users to get a mediocre (or plain bad) experience. Hubris, I think.

Categories
android fixing your desktop programming

August 2011: Google’s install process for Android is still terrible

Following my own install-guide from Jan 2011 (because Google didn’t provide one at the time)…

  1. Google still doesn’t provide an install guide
  2. Eclipse is a *little* clearer on what to download – but only slightly
  3. Eclipse.app on Mac OS X is *still* broken
  4. ADT is still “hidden” by Google for no good reason (my install guide still works)
  5. Google still blocks you from downloading any “Android OS platform” (this is a core part of the SDK that is *not* included in the SDK – you need it to make Android apps)

(also, in passing, I updated the instructions to be a lot clearer / a bit more idiot-proof. I just used them to do a fresh install, and it went smoothly – with fewer problems than trying to use Google’s auto-installer)

EDIT: On the plus side:

  1. My install guide spared me waiting for an extra 0.5Gb of Android OS platforms to download (I was able to copy/paste them on the hard-drive, no extra install work needed. Just don’t use the installer!)
  2. ADT v 12 is noticeably more stable and better-integrated with the Android emulator – auto-starting smoothly where previous versions needed you to lead them through baby steps on first-run

Which means the key problem from a year ago still holds today:

Google is still effectively blocking you from using Source Control on Android projects

And they wonder why people still prefer the pain of working with Apple…

Categories
computer games fixing your desktop games design

Fix for Master of Mana Fay/Faerie suicides

Typical. Just as I finally brave the source code to Master of Mana (neé Fall From Heaven; the most popular / succesful mod for Civilization 4), and fix a major bug that’s bothered me for ages … the main server at masterofmana.com goes offline :(.

Anyway, if you’re playing the Fey, and you’re tired of the fact it becomes impossible after a certain point – when you put Faeries onto ships, they self-explode, turning the tile into land (usually Never-Never), here’s the fix. It’s especially bad for True White Faeries – which means “all of your top units” beyond a certain point in the game.

Edit the file:

[C:\ … path to your Civ4 folder]\Beyond the Sword\Mods\Master of Mana\Assets\Python\Wildmana\Civs\CvFaeries.py

Find the following lines (very near the top):

		if pUnit.isHasPromotion(iPromWhite):
			iSnowChance=20
			if pUnit.plot().getOwner()==-1:
				iSnowChance+=-10
			if pUnit.plot().getOwner()==pUnit.getOwner():
				iSnowChance=-100
			if iSnowChance>CyGame().getSorenRandNum(100, "snow fall"):
				pUnit.plot().setTerrainType(iSnow,True,True)
			if pUnit.isHasPromotion(iPromGreen):
				if pUnit.plot().getFeatureType()==-1:
					if CyGame().getSorenRandNum(100, "Faerie plant trees") <= 75:
						pUnit.plot().setFeatureType(iForest, 1)
			if pUnit.isHasPromotion(iPromTrueWhite):
				pUnit.plot().setTerrainType(iNever,True,True)
	
		if pUnit.isHasPromotion(iPromTrueGreen):
			pUnit.plot().setFeatureType(iEternal, 0)
	

and replace them with this: (NB: because Civ4 is scripted in the horrid Python, you're going to have to be careful to get the indentation correct manually; Python is wonderful, except for this one feature - it makes sharing code changes like this much harder than it should be :( IMHO)

		if pUnit.plot().isLand():
			if pUnit.isHasPromotion(iPromWhite):
				iSnowChance=20
				if pUnit.plot().getOwner()==-1:
					iSnowChance+=-10
				if pUnit.plot().getOwner()==pUnit.getOwner():
					iSnowChance=-100
				if iSnowChance>CyGame().getSorenRandNum(100, "snow fall"):
					pUnit.plot().setTerrainType(iSnow,True,True)

			if pUnit.isHasPromotion(iPromGreen):
				if pUnit.plot().getFeatureType()==-1:
					if CyGame().getSorenRandNum(100, "Faerie plant trees") <= 75:
						pUnit.plot().setFeatureType(iForest, 1)

			if pUnit.isHasPromotion(iPromTrueWhite):
				pUnit.plot().setTerrainType(iNever,True,True)
		
			if pUnit.isHasPromotion(iPromTrueGreen):
				pUnit.plot().setFeatureType(iEternal, 0)

Yep - it's really that simple (insert one line, and re-indent the ones below):

"if you're at sea, don't turn the ground your ship is on into land. Because that will destroy the ship, you, and everyone else nearby"

I'm pretty sure it wasn't intended to do that - it would be an ultra-powerful ability to create land - automatically - instantly for the cost of a cheap ship and a level-1 faerie. If you really want to play that way (if you can be bothered), it's easy to create a Giant's Causeway like that in the current build of the game, making land out of the dead bodies of the Fey. But it's a very dull way to play, and it feels more like an innocent oversight...

PS...

If you're not playing Master of Mana, and wondering why anyone would care about a Mod for a game that originally shipped *almost 6 years ago*, then I strongly suggest you buy yourself a copy of Civ4 + Beyond the Sword expansion (usually bundled together for $30 or less), download MoM, and find out what you're missing.

The modded game is IMHO highly illegal - they stole art liberally from many many copyrighted sources - but the bulk of the content is their game-design, and that's fantastic. Many times better than many games released today - and (partly thanks to the lack of legal assets) the authors charge nothing for it.

The saddest / greatest thing about this IMHO is that 2KGames / Take Two did so little with this modding community. Beyond a few token steps (the dev team made the sensible decision to hire some of the leading mod authors, IIRC) they pretty much ignored it. They're making substantial money out of the mod authors - Civ4 should not still be selling as expensively as it does, and I'm sure this mod is the main reason it does - but they could have made a lot more. Look to Valve, and imagine what might have happened with a little more visionary leadership at Firaxis and Take Two...

Categories
fixing your desktop

Firefox 5: Very fast, but unusable on Mac OS X

Mozilla has “pulled a Microsoft” and put in place a font renderer that makes all text horrible on anything except low-quality monitors. On Windows, you have to “disable hardware acceleration” in the preferences menu (what? you get to choose “slow browser” or “readable fonts”? That sucks).

On OS X … you’re just screwed. Everything is blurry. Some idiot decided to give the world a migraine… The only add-ons I’ve found that let you disable this madness are Windows-only.

I’ll update this post if I find a solution.

UPDATE: using TinkerTool, I’ve been able to globally change some of the OS X fonts, but not the ones that Firefox 5 is using. Still blurry. c.f. Finder, where I can change half the fonts (the time font on the right is Gill Sans, looks great; the font on left is the crappy Apple font that seems unchangeable)

Categories
fixing your desktop

Firefox4: Still doesn’t work on OS X

Even with version 4, the epic 5-year-old bug that makes Firefox unusable on Mac with any page that uses fancy forms like TinyMCE (these days: an awful lot of them) is still unfixed:

“We’re going to have to back out the core fix to this bug because of bug 620906.”

Sob. And, of course, the main workaround that everyone used to use doesn’t work any more either, since the author of keyconfig stopped updating it – and, as far as I can tell, Firefox still doesn’t let you remove this stupid, broken keybinding manually.

EDIT: yes, I’m annoyed – I just lost a load of data because of this bug *again*.

Categories
fixing your desktop

Apple’s iPad “Notes” app deleted all your documents?

If that’s what you *think* just happened, then check this:

  1. Settings App
  2. ..Mail, Calendar, etc
  3. ….your Gmail account
  4. ……the “Notes” slider; is is set to “off”?

If so, flip it to ON, find a working wifi / 3G signal, and your documents will miraculously re-appear.

For most people, there is no way they want Gmail ripping all their private documents off the iPad – but this is apprently how Apple stupidly coded the Notes app.

You don’t get a choice; if that slider is “ON”, all your private stuff is deleted locally and saved to Gmail. There’s no warning, no user-interface to tell you it’s doing this – everything is silent. There’s also – so far as I can tell – no way to “reclaim” your documents and get them put back on the iPad, where they belong. Where Apple pretended they were in the first place.

If you ever accidentally hit that switch, all your documents just vanish.

What happens if you have no network connectivity, or lose 3G signal? Again, it seems you lose your documents.

Moral of the story: never, ever trust software written by a hardware company that refuses software engineering standard practices.

Categories
fixing your desktop iphone

Apple UK Contact Email Address

…because Apple hates giving customer support, and buried this address deep in their website, in a tiny font where it’s almost impossible to find:

contactus.uk@euro.apple.com

…and they just screwed-up an order we’d made, but all their emails were sent from fake Apple email addresses (“You have replied to a confirmation-only address that cannot accept incoming email.”).

The only alternative they offered was an expensive pay-per-minute phone number. I’m obviously not one of the True Mac Faithful: I don’t agree that *I* should pay Apple to fix *their* mistakes :).

Categories
fixing your desktop

Mac users: Regular Expressions app temporarily @ $0.99

I use regexp a lot, very useful, but OS X has weak support for them – Apple’s products rarely support regexp for search/replace.

In particular, the latest version of Xcode (Xcode 4) has no support, which is tragic. So … I wrote an app that makes it fast and easy to do a search/replace with full regexp support.

http://itunes.apple.com/us/app/regular-expressions-helper/id429461864

BONUS: it does it all in realtime – so you can see the results as you type (useful if you’re not 100% sure of the syntax you’re using).

It just went live on the App Store, and it’s temporarily at $1 – grab it now, I’ll be putting the price up after the weekend. Here’s a teaser screenshot from the v1.1 that will go up soon:

Categories
fixing your desktop

OS X: if your laptop grinds to a halt, and it’s the OS, not the app…

OS X still has some fragility (or bugs?) in kernel-related code, it would seem. I just had my laptop go to 150% CPU usage … with no apps running. “top” showed that the rogue process was the core kernel process (PID 0) – i.e. only way to stop it is to reboot.

But I’ve noticed that some bugs related to the kernel can be “fixed” simply by hibernating and de-hibernating. e.g. with Wacom tablets, early versions of OS X 10.6 would often get “stuck” with the right-mouse-button permanently clicked. (IIRC, that got fixed around 10.6.3 – either by Apple or by Wacom)

So, I tried it today: close laptop lid, wait 1 second, re-open.

Magic! Kernel process un-f***ed itself, and system went back to normal. Many times simpler and quicker than rebooting :).

(EDIT: although … a few minutes later, I’m now seeing 0.5 second delays on keyboard interaction and mouse movement, every few seconds. Seems the OS X kernel is still FUBAR. Gah.)

Categories
fixing your desktop

OS X 10.6.6 breaks Macbook laptops? – beware upgrading…

Short story: if you try to do *any* iPhone development with a 1st/2nd/3rd gen Pro or Air right now, you may screw-up your laptop – massive overheating. I did. My Air is now almost unusable – thanks, Apple!

Apple is currently:

  1. Forcing all iOS developers to use Xcode 4, even though it only went live 1 week ago
  2. Forcing all Xcode 4 users to run OS X 10.6.6., even though it only went live a couple of months ago
  3. …and 10.6.6 appears to have an overheating bug

For me, I installed the 10.6.6 update, and immediately my laptop went into massive overheat. Nothing brings the temperature down. Multiple processes are being run on high (up to 100%) CPU that normally do not show up, the load factor is enormous. CPU temperature over 80 celsius, with nothing but a single firefox window open. Sigh.

I believe this is a bug with the much-praised “make OS X use your dual-core CPU to Da Max” that came in recently. Only, that’s a really stupid idea on laptops, especially when running on battery, with no apps that need the CPU)

(NB: that was the same window, with the same tabs, as before I upgraded to 10.6.6 – I saved / restored the session. Whatever’s broken, the 10.6.6. upgrade currently seems the most likely cause)

Sadly, there’s no way out (can’t downgrade) and no way forward (no patches available yet).

i.e. the bad-old-days of Microsoft’s “auto-updates” and the critical bugs they often caused. At least Microsoft had the excuse they couldn’t test all 100,000,000 combinations of hardware – Apple doesn’t. They’ve only got a few hundred to worry about :(.

Categories
fixing your desktop

Mac OSX Autosave bug: “sometimes, Apple deletes everything”

Sob. I just lost about a dozen incomplete/unsaved documents due to a bug in OS X.

Seems that sometimes, for no particular reason, OS X just deletes all your autosave information. (and … there’s plenty of threads about this on Apple.com and elsewhere. No response from Apple so far. Sigh)

No need to comment on this, really; everything that needs saying about an Autosave that doesn’t Auto-save is pretty self-evident.

Only one extra thought: you might as well disable Autosave on any Mac you have access to, at least until Apple fixes the bugs – it seems you *must* use a 3rd party solution instead, so why deceive yourself with the illusion that it’s safe otherwise? :). I wish I’d known this beforehand :(.

Categories
fixing your desktop programming

How to start Firefox fast on OS X

When you switch on your Mac…

Click on the network icon (e.g. the wifi icon for most people) and click “Turn Airport off”.

Then start Firefox.

Click on the network icon and select “Turn Airport on”.

You will find that Firefox starts up 10-100 times faster, with fewer crashes, and OS X will run faster, with fewer delays for the next couple of minutes.

Why? Firefox caching ain’t doing what it should be doing…although in some cases, I’m still not sure why

(rest snipped while I check in more detail what’s happening)

Categories
fixing your desktop

Editing Adobe Photoshop files on OS X / linux / Windows (free)

Most professional artists don’t pay for their software (their employers do), and PSD files are the main interchange format for high-end graphics.

But PSD isn’t always possible to open or edit. Adobe’s crappy copy-protection refuses to run on some of my computers, and CS is far too damn expensive for mere mortals, so I can’t always use Photoshop to edit files.

OS X makes this a little easier – it has an excellent built-in image-and-PDF viewer (Preview) which effortlessly (and VERY fast) opens PSD files. It will even export those images to flat PNG, with a 100% success rate. But that’s no use when you’re doing complex graphics (e.g. designing GUIs for mobile-apps) and need to do layer-by-layer manipulation.

Free editors

I’ve tried many editors, both free and commercial, and I’ve found Inkscape (free) and Adobe’s Illustrator/Photoshop (expensive) to be the only ones worth mentioning. Inkscape works great on all major OS’s, too.

BUT … Inkscape still doesn’t support PSD files. This is pretty bizarre – except that Inkscape development has stalled / slowed to a crawl over the last 12 months, and I think they’re suffering the open-source problem of a temporary (long) drout in volunteers.

(interestingly, Firefox is about to release a new version of the browser that displays SVG files natively. SVG is the file format that Inkscape was “invented” for editing – so I suspect Inkscape will see a surge in interest during 2011)

NB: please don’t mention the GIMP. Even the latest version can’t handle simple PSD files – despite that being a “feature” of the app for almost a decade now, it still *doesn’t work*.

OpenOffice: world’s best image-file converter (!)

There are “conversion” programs out there, but they mostly all just use the same open-source backend (ImageMagick), which has long had problems with anything non-bitmap.

Then someone mentioned OpenOffice.

Huh? OO is a word process / excel spreadsheet / powerpoint replacement – why would I use that for a PSD?

Well … it turns out that OO has an excellent PSD importer built in – and, being OO, it happily exports to all major formats.

I tried some simple and complex PSD files, and where GIMP could open them all, but corrupted most of them … and conversion apps converted some, and for others just went blank … OpenOffice opened them all perfectly, and allowed me to save-out to the image-format of my choice.

EDIT: …this isn’t so perfect after all. OO has been collapsing the PSD layers on import for some of the files (maybe all). ARGH! But at least it’s opening files that the supposedly built-for-purpose software (like GIMP) fails on entirely.

Tis a bizarre and strange world – but at least I have a good, relatively quick, way of working with PSD files now, in those few situations where Photoshop isn’t available. And props to OpenOffice for being the one app that makes file import/export do what the *user* wants it to do, rather than propping-up anti-competitive business models and political ideals (which it often feels like the other apps are trying to do).

Categories
dev-process fixing your desktop iphone programming

Installing/Developing Android (especially on OS X)

UPDATE: updated August 2011, with more detailed / idiot-proof instructions – and a couple of shortcuts. NB: when you’ve done this install once, and checked the relevant bits into your Source Control, it becomes *very* fast/easy to re-install – it’s only long-winded the first time.

I thought I’d blogged this before – the install process from Google is appalling, and I wrote up detailed instructions for colleagues about a year ago. Sadly, looks like I never published the post. I just did a fresh install on OS X (January 2011) and the process *still* is riddled with flaws. I get the impression Google won’t fix it anytime soon.

NB: the biggest single problem here is: Version Control. Someone at Google appears to believe that version control is “unimportant” and that developers should “not be expected to make reproducible builds of their software”.

But … even if you’re a sloppy programmer who doesn’t do proper version control, you probably STILL don’t want to use Google’s auto-installer. It can’t cope with basic stuff like “internet connection drops for a few seconds while ADSL re-dials” – things that your web-browser deals with perfectly. e.g. as of Jan 2011, the Android auto-installer managed to crash Eclipse just because of a blip in net connection. Pathetic, really.

(not to mention the hassle of re-downloading hundreds of meg of data over and over again for every PC in your office … this document will let you download most of it once only, and install it multiple times)

I don’t have a perfect solution, but here’s a guide for how to (mostly) un-**** the installation process for Android development.

Developing for Android: Essentials

The main IDE for Android is the (mostly excellent) Eclipse – with some custom plugins built by Google/Android folks. Once it’s up and running, it’s definitely the best free solution. To make this work, you need:

  1. Eclipse IDE … *any* flavour
  2. Android plugin for Eclipse (called “ADT”)
  3. The version-independent Android SDK (called “android-sdk”)
  4. A specific OS-version of Android (e.g. current latest is v2.3)
    • NB: plus you need a “platform tools”, which you download/install in the same way, but is an extra file/feature

FYI: the first item is from Eclipse, the last 3 are all from Google. Although Google keeps trying to kick you in the teeth, you can workaround their foolishness relatively easily for the middle two items. The big problem is the last item. More on that later.

Installing Eclipse on OS X

What follows comes mostly from: http://eclipse.org

Once a year, I call-out Eclipse.org for the appalling user-experience of downloading and installing their software. They’ve had a decade to get this right, and they still get it so wrong.

As of Jan 2011: there’s been a big improvement recently – you can now find the download link quite easily. At http://eclipse.org/ there is an enormous “DOWNLOAD ECLIPSE” button in the top right of the page, in bright yellow. This is excellent.

Sadly, the download link DOES NOT DOWNLOAD ECLIPSE … instead it takes you to a screen that demands you choose the “correct” version out of 12 offered to you, with literally no help at all. The majority of users want one of only 3 versions from that screen. In fact, I suspect 99% of people that come via the front page only want one version.

Furthermore, there is *still* no download for OS X. There is *part of* a version for OS X, but no-one has done the 5-10 minutes of setup that would make it install correctly on OS X forever more. Instead, you have to manually muck about with your computer, your administrator account etc. FAIL.

1 of 4: download the “Eclipse IDE for Java Developers” file.

Unzip it. Unzip it *again*, because they decided to use archaic Unix compression instead of ZIP.

Now you have a new folder, called “eclipse”. You have to put this somewhere. There is (officially) no official location for this … good luck getting support if you put it in a “bad” place.

Most people drag/drop this folder to their Applications folder in Finder. This kind-of works, but again because the Eclipse team haven’t spent a few minutes making an OS X manifest (could have done this any time in the past few years!), the “Eclipse.app” file is broken. If you drag/drop that file to anywhere, it will stop working.

Instead, you have to manually create a shell script to run Eclipse. I’m not even going to go into it – if you want an Eclipse.app icon in the right place on OS X, Google for tutorials on how to make a working Alias specifically for this app (working around the broken one from Eclipse.org). Or … just live with the fact you have to navigate to the “eclipse” folder before you can start the application.

Download the necessary plugins for Android

What follows comes mostly from: http://developer.android.com

Immediate FAIL from Google: the download page lists *ONE* download file, out of the *FOUR* that are absolutely required in order to do Android development. There is no mention of the others :(. How am I supposed to install the software if you won’t give me the links? Your crummy auto-installer is no subsitute.

2 of 4: At least it will get you the SDK, so download that directly

… from the main download page

If you dig around the site, read through 3 sets of instructions that all tell you not to download anything, and keep bullying you into using the crappy auto-downloader instead, you’ll eventually find a file something like:

3 of 4: ADT ZIP file

(Jan 2011:) ADT-8.0.1.zip (if you google for “ADT-8” or “ADT-9” you might find future versions on the site, since Google refuses to put them in a sensible place anywhere). Alternatively, the latest version should always appear at the “magic URL”: http://dl-ssl.google.com/android/eclipse/site.xml.

(Aug 2011:) currently it’s on version 12 …

(usually, this download link is hidden in the section “Troubleshooting ADT Installation”. The Magic URL … I’ve never seen anywhere. You have to know how Eclipse works in order to deduce it. For the record, other companies (including Eclipse’s maintainers) put a webpage at the parent of that URL, to help normal users. This one just does a 404 Not Found)

Finally, you need the bit that Google *really* doesn’t want to give you: a specific version of Android OS to develop against. You need to find the URL for a “repository.xml”. In this case, you can see it flash up briefly when the auto-installer is refreshing the repository (the part that does this is called “the Android SDK and AVD Managers”). You can try that URL:

4 of 4: http://dl-ssl.google.com/android/repository/repository.xml

Google could easily have provided this URL in the docs, since it is the “official” index for downloading the other files you need, but for some reason they chose not to.

There’s 2 ways to avoid Google’s broken auto-installer (which you shouldn’t be using anyway, unless you don’t care about updating your own Android apps in future).

1. Create a local “fake” repository by manually reading an XML file and downloading each file by hand.

This used to work – in 2010, I used this successfully. In 2011, it refused to work. Something critical has changed in Eclipse so that it doesn’t recognize fake repositories – or I just couldn’t reverse-engineer the format correctly any more

2. OR: … download the files you want, and later manually copy them into the folder where Google requires them to be copied.

NB: the auto-installer often fails / timesout / dies when trying to do this. This is all it needs to do, but it’s rubbish. I’ve found that doing it by hand is usually less error-prone, tragically.

To download the files, you need the URL’s of each version of Android you want to support. Google refuses to put these in a webpage (why? Who knows?), but it’s not hard: open the XML link above – your browser should be able to view it directly:

http://dl-ssl.google.com/android/repository/repository.xml (opens fine in Firefox)

Scroll down – it’s a human-readable file – skipping the huge license. You’ll see a lot of “sdk-platform” sections – each of these is a single verison of Android, and contains one URL for you. e.g.:

<sdk:platform>
<sdk:version>1.1</sdk:version>
<sdk:api-level>2</sdk:api-level>
<sdk:revision>1</sdk:revision>
<sdk:description>Android SDK Platform 1.1_r1</sdk:description>
<sdk:desc-url>http://developer.android.com/sdk/android-1.1.html</sdk:desc-url>
<sdk:obsolete/>
<sdk:archives>
<sdk:archive os="windows" arch="any">
<sdk:size>46828615</sdk:size>
<sdk:checksum type="sha1">a4060f29ed39fc929c302836d488998c53c3002e</sdk:checksum>
<sdk:url>android-1.1_r1-windows.zip</sdk:url></sdk:archive>
<sdk:archive os="macosx" arch="any"><sdk:size>45584305</sdk:size>
<sdk:checksum type="sha1">e21dbcff45b7356657449ebb3c7e941be2bb5ebe</sdk:checksum>
<sdk:url>android-1.1_r1-macosx.zip</sdk:url>
</sdk:archive>
<sdk:archive os="linux" arch="any">
<sdk:size>45476658</sdk:size>
<sdk:checksum type="sha1">c054d25c9b4c6251fa49c2f9c54336998679d3fe</sdk:checksum>
<sdk:url>android-1.1_r1-linux.zip</sdk:url>
</sdk:archive>
</sdk:archives>

</sdk:platform>

For each one you want to download, look for the highlighted bit above. That gives you a filename – if there’s no OS X section, take the linux section instead.

You then append that filename to the URL you used to get the repository, i.e.:

“http://dl-ssl.google.com/android/repository/” + “[filename you picked above]”

I’m afraid you have to do this for each version of Android you want to build against – but for most people, that means “just the most recent few versions”.

5 of 4: another ZIP you need: “Platform tools”

You will *ALSO* need – while you’re at it – to grab an “Android SDK Platform-tools”. Google doesn’t mention this as a separate stage, because their auto-installer treats it as part of the 4-of-4 items above.

It’s another file with the URL stored in the same repository.xml from the above step.

However, it lives right at the bottom of the XML file, in a section that looks like this (there’s only one of them – no choices to make – just grab it):

<sdk:platform-tool>
<sdk:revision>06</sdk:revision>
<sdk:description>Android SDK Platform-tools, revision 6</sdk:description>
<sdk:desc-url>http://developer.android.com/sdk/</sdk:desc-url>
<sdk:archives>
<sdk:archive os="linux" arch="any">
<sdk:size>15398275</sdk:size>
<sdk:checksum type="sha1">292732c6a86971b95ca61ba8bf84cd9d6c2285c3</sdk:checksum>
<sdk:url>platform-tools_r06-linux.zip</sdk:url>
</sdk:archive>
<sdk:archive os="macosx" arch="any"><sdk:size>15127727</sdk:size>
<sdk:checksum type="sha1">86c958b461b6244e74b4e0489ea7cef9a681d882</sdk:checksum>
<sdk:url>platform-tools_r06-macosx.zip</sdk:url>
</sdk:archive>

<sdk:archive os="windows" arch="any">
<sdk:size>16589948</sdk:size>
<sdk:checksum type="sha1">14acb6271c71dce94bba879496cd66e09ae144af</sdk:checksum>
<sdk:url>platform-tools_r06-windows.zip</sdk:url>
</sdk:archive>
</sdk:archives>
</sdk:platform-tool>

Installing ADT (the “eclipse plugin for Android”)

If you downloaded this directly, as detailed above, then Google’s post-install instructions are weak. The download ZIP also has no install instructions with it. Here’s a short version:

  1. Unzip the ADT file (Google is happy with ZIP, unlike Eclipse)
  2. Create a “magic” folder for Eclipse somewhere, which is where you’ll store all your Android SDK’s, ADT plugins, etc. Create a sub-folder “local repositories”
  3. Move the ADT folder into “local repositories” (you will probably want to upgrade this later, so you need to be able to find it easily)
  4. (NB: sad design flaw of the auto-updater – it’s hardcoded that you MUST give each repository a unique “name”, even when this makes no sense to the developer)
  5. … NB: as of August 2011 … what follows is pieced together from Google’s incoherent documentation – you won’t find these steps written clearly + correctly anywhere on the developer.android.com website :(
  6. [aug 2011]: “Start Eclipse, then select Help > Install New Software….”
  7. [aug 2011]: “Click Add, in the top-right corner.”
  8. [aug 2011]: In the Add Site dialog, click Local (not “Archive”, as per Google’s instructions – Archive causes other problems later on)
  9. [aug 2011]: Browse and select the folder you unzipped/created/moved in step 3
  10. [aug 2011]: “Enter a name for the local update site (e.g., “ADT Plugin”) in the “Name” field.”
  11. [aug 2011]: “Click OK”
  12. [aug 2011]: “In the Available Software dialog, select the checkbox next to Developer Tools and click Next.”
  13. [aug 2011]: “In the next window, you’ll see a list of the tools to be downloaded. Click Next.”
  14. [aug 2011]: “Read and accept the license agreements, then click Finish. ”
  15. [aug 2011]: …Google doesn’t admit this, but some of the ADT components aren’t signed, which is a security hole. Eclipse rightly says: “Dude, are you sure you want to install unsafe software?”. You have no alternative, though – until Google re-builds the plugin to be properly signed, you just have to accept it.
  16. [aug 2011]: “When the installation completes, restart Eclipse.”

Jan 2011: Bizarrely, at this point the auto-updater hangs for a few minutes, randomly contacting internet sites for stuff that I expressly did NOT attempt to install. I’m not sure if this is a bug in the current Eclipse, that it “hi-jacks” the plugin-install process and tries to update the rest of Eclipse, or if it’s a “feature” of the Android plugin – that it secretly triggers additional installs from the internet.

Installing the SDK

In Google’s docs, there’s a whole page for installing the SDK.

It does not – at any point – tell you how to install the SDK.

Instead, that information is inside the page for installing the ADT plugin for Eclipse.

Genius!

To save you navigating their bizarre instructions, I’ll copy/paste them here. First, however, you need to create a local install directory for the SDK (they forget this step, of course). Put it somewhere that you’ll never accidentally modify or delete – if you do, Android apps will stop building in Eclipse until you manually fix everything again. Given how tortuous the main instructions are, I’ve seen smart people diagnose the problem but have massive trouble figuring out exactly how to rectify it.

Anyway, once you’ve picked a location, unzip your SDK zip file into that folder, and proceed with Google’s instructions:

1. Select Window > Preferences… to open the Preferences panel (Mac OS X: Eclipse > Preferences).
2. Select Android from the left panel.
3. For the SDK Location in the main panel, click Browse… and locate the directory that was created when you unzipped (Google words this badly – it MUST be the folder that came out of the ZIP – Eclipse will check the contents of the folder, and reject if you select its parent folder, or one of its children)

4. Click Apply, then OK.

Installing the “Android Platform versions”

This is the install part that matches the “4 of 4” download part above.

Take each ZIP file you downloaded, and unzip it.

e.g.:

  • android-3.2_r01-linux.zip

This will give you an *incorrectly named* folder, e.g:

  • android-3.2_r01/

…you *may* need to manually rename this using the “<sdk:api-level>13</sdk:api-level>” tag that was in the original repository.xml where you got the download URL from. Each downloadable ZIP file had a different – unique – api-level tag.

The new format (I’m not sure this is required, but it’s what the installer does, so I recommend doing it):

  • android-13/

Finally (!) … find the folder where you unzipped the SDK earlier. That will have files/folders very similar to the following:

  • add-ons/
  • platforms/
  • tools/
  • SDK Readme.txt

Take your (possibly renamed) folder – in my case “android-13/” – and move it into the “platforms” subfolder.

The ADT Eclipse plugin will automatically discover this when you restart.

…go through the same process for each Android Platform version you downloaded.

Shortcut: if you’ve done this before, with a previous version of Eclipse / ADT / Android … you can just take the sub-folders of “platforms/” from your previous install, and copy/paste them into the “platforms/” sub-folder of your nw SDK version. Easy.

Installing the “Android Platform Tools”

…this works in exactly the same way as the “Android Platform versions” above, except it goes in a different folder.

In this case, you need to take the zip file, unzip it, and rename the output folder to precisely:

  • platform-tools/

…then copy/paste it directly into the SDK folder. There shouldn’t be a “platform-tools/” folder to start with – this is how Eclipse/ADT knows whether or not you’ve “installed” it: it just looks for a folder with that name.

OPTIONAL: Downloading + Installing the Android SDK documentation

UPDATE: sorry, I missed this out originally.

Again, just like with the “Android Platform Tools”, you have to manually grab the URL for this from the repository.xml

The piece of XML in the repository.xml you need is:

<sdk:doc>
<sdk:api-level>13</sdk:api-level>
<sdk:codename/>
<sdk:revision>01</sdk:revision>
<sdk:description>Android SDK Docs for Android API 13, revision 1</sdk:description>
<sdk:desc-url>http://developer.android.com/sdk/</sdk:desc-url>
<sdk:archives>
<sdk:archive os="any" arch="any">
<sdk:size>103791308</sdk:size>
<sdk:checksum type="sha1">5dadb3b30e1f837716f8a5ef840e31abddf69b38</sdk:checksum>
<sdk:url>docs-3.2_r01-linux.zip</sdk:url>
</sdk:archive>

</sdk:archives>
</sdk:doc>

…then take the zip file, unzip it, and rename the output folder to precisely:

  • docs/

…then copy/paste it directly into the SDK folder.

Done!

Phew! Finally! You should now be set for Android development!