Friday, August 7, 2009

Translations and Xcode

Chris Hanson has a really handy post today. In the localization chapter of Beginning iPhone Development, we mentioned that Apple recommended using the ISO two letter language code for your localizations, but that Xcode used the older style language codes for your development base language. Chris shows how to work around this inconsistency.

Wednesday, August 5, 2009

Multi-Row Delete in 3.0

The networkpx Project Blog has an interesting post on doing multi-row delete under SDK 3.0. It's a good post, even if they do credit the excellent Cocoa with Love blog for "introducing" a technique that I demonstrated three months earlier.

Anyway, the ability to do multi-row delete is now built-into UITableView starting with SDK 3.0, meaning you can now implement multi-row delete it with just few lines of code. Yay.

Or, perhaps not.

Unfortunately, using this functionality requires you to return an undocumented UITableViewCellEditingStyle value from tableView:editingStyleForRowAtIndexPath: in order to turn this feature on. To fully utilize the functionality, you have to use and override other undocumented, private methods.

Technically, doing that in an application submitted to the App Store violates your SDK agreement and is grounds for having your application rejected.

Will your apps be rejected if you do it? Who knows? Maybe yes, maybe no. It's even possible that people using the older, manual technique will get their apps rejected for using private methods even though that technique doesn't, similar to the Coverflow debacle from last year.

Now, I'm not going to advise you whether to use this functionality in your apps. It's a risk, and you have to decide how risk tolerant you are. I am going to advise that if you have any desire to use this functionality at all, go now and open a bug report with Apple requesting that they make the multi-row delete functionality available to developers.

Tuesday, August 4, 2009

NinjaWords

John Gruber says pretty much all that needs to be said on this. Not a sign that things are heading in the right direction, I"m afraid.

Monday, August 3, 2009

A Mac App Store

Back before WWDC, one of my long-shot predictions was the creation of a Mac App Store following the same business model as the iPhone App Store. It didn't come true, and now with the various issues surrounding the App Store, I've changed my mind that it would be a good idea. I've come to the conclusion that I like not having Apple as the gatekeeper for what Apps can do.

But, it's nearly impossible to argue that the App Store isn't convenient. It has its issues, but its a great idea, which is why the App Store is flourishing despite all the negative press.

Now, a third-party called Bodega is extending the idea to Mac applications, and it's a snazzy little application.



In some ways, Bodega outdoes Apple's iTunes Store. The interface is clean and easy to use, and it's filled with lots of little touches reminiscent of the Delicious Generation. For example, when you move the window around when the "Featured" option is selected, the little hanging signs you can see in the picture above swing with gravity and creak as they move. It's an unnecessary, yet completely satisfying little touch.

This project is still in its infancy, but it shows a lot of promise and it's one I'm definitely going to keep an eye on.

Me, the Hypocrite Apparently

Today, I saw somebody tweeting about signing a petition to get DRM off of the Kindle. I tweeted that the best way to "vote" on something like that is with your dollars. If you buy a Kindle and then sign a petition about the DRM on it, you haven't really given Amazon much motivation to stop using DRM. Since you bought it, you obviously didn't care enough about DRM to not purchase it, so if Amazon doesn't stop using DRM… well, they've already got your money and probably will continue getting your money in the future. At least from the point of view of an MBA, such a petition is essentially meaningless; it has about as much significance as the mewling of kittens. Money talks more loudly than petitions.

Now, I consider what I tweeted to be a truism. I wasn't particularly intending to take a stand on DRM by posting it. I was just stating a simple fact: If you feel strongly about DRM (or anything else), you shouldn't buy a product that uses it because your dollars are the only meaningful way of voting when it comes to for-profit corporations. If you want a DRM-free Kindle, you should refuse to buy a Kindle until Amazon stops using DRM.

Generally speaking, I'm not a big fan of DRM, but I'm not much of an ideologue, either. I'm practical about the whole thing. With some products, the benefits outweigh the potential harm of DRM, with others, they don't. With the iPhone, for example, the convenience and benefits outweigh the negatives by a long shot. Sure, I would rather the iPhone didn't have DRM, but I'm not going to stop using it because it has it (although it is almost certainly true that I buy less music and movies as a result of the fact that they are delivered with DRM). And, yes, the threat of having purchased apps deleted by an un-appealable decision by some unnamed person at Apple is a fear but, in reality, it's not enough of a threat to make me give up my iPhone. Maybe someday it will be, but today it's not even close.

There are other products, like the Kindle where, for me, the DRM tips the scales enough in the other direction that I don't buy the product. They don't offer enough of a benefit for me personally to offset the threat of having my books deleted behind my back, for example. Obviously, based on how well the Kindle has sold, the value proposition of the Kindle is different for me than it is for a lot of other people.

The long and short of it is that DRM is just one factor among many that I consider when making a purchase decision. Or, in other words, I'm pretty standard geek consumer.

Anyway… a little while after I tweeted that, I was basically called out as a hypocrite for making that statement because my publisher puts DRM on the electronic versions of my book. The implication being, it would seem, that you can't say anything about DRM unless you give away all of your creative output for free? Yeah, that makes sense.

Frankly, I do not like being called a hypocrite. Over the last two years, I have probably given away the equivalent of at least a thousand hours worth of my time (and probably much more) writing tutorials and sample code for my blog. Additionally, I spend at least an hour a day helping other people with programming problems over e-mail, IM and Twitter, none of which I get paid for. Now, I enjoy doing all that, but idiots like this "John Doe" sometimes make me really regret the time I've spent in that way. If I had used all that time doing contracting work or writing an additional book, I would be considerably wealthier right now.

Here's the simple truth of the matter: I have no input into how Apress delivers their eBooks. I have no contractual right to control that part of the process. I wouldn't be tempted to do so, but if if I did decide to make some ideological stand on DRM by, say, refusing to finish my current writing obligations unless Apress stopped using DRM, Apress would likely (and rightly) hold me in breach of contract. It's unlikely to the point of being ridiculous that they would stop using DRM as a result of one author being an asshole.

To state it simply, I'm an author, not a publisher, and just one of literally dozens (maybe hundreds) of Apress authors. Heck, I'm not even the only author on the books I work on! I have a great relationship with Apress and I very much like the people there that I interact with there. But I'm not them. And yet I still have opinions. Fancy that.

iSimulate

One of the difficult aspects of making an iPhone program is marketing it. One thing that helps is a professional quality video of the program in action. This is especially true for games. However, since the iPhone Simulator doesn't have access to the accelerometer, camera, or the full capabilities of the multi-touch screen, it can be difficult to get a professional looking video.

iSimulate (App Store Link) is a great option for developers. It's a standalone program that runs on your iPhone that will send the inputs from the iPhone to the simulator. This means you can run a program in your simulator and control it by touching or tilting your actual phone. This allows you to use a screen capture program to capture flawless video, even if your program uses features not available on the simulator.

Right now, you can get iSimulate for $3.99, but only for today. Tomorrow, the prices rises to $7.99 until August 8, then increases to $15.99, until August 16 when it reaches its full price of $31.99. Although $32 is still a small price to pay to get a professional quality video, if you're interested in the program, you can save yourself some money by buying now.

Sunday, August 2, 2009

This Concerns Me Greatly

Yes, I'm a little behind. I've been gone for a week, so this is probably not news to any of you, but this really upsets me, so I'm writing about it. I try to give Apple the benefit of the doubt when they make decisions that seem unfair or arbitrary, fully cognizant of the fact that I'm not privy to all the factors that went into the decision.

But, this... Well..., if this is true, it would seem to indicate that maybe I've been wrong in giving Apple the benefit of the doubt. That maybe those who have let out a hue and cry over every little Apple decision they didn't like had a more accurate picture of the situation.

If it's true that Apple won't even give more than a boilerplate reason for pulling an application that had been on the App Store for four months and won't tell the developers what the specific conflicts are so they can fix them, then I think there is more than a little cause for concern. Especially troubling is that now RiverTurn, since they are unable to support or update their app thanks to Apple's decision to pull their application, would like to give refunds, but will have to pay not just their share of the income, but Apple's as well, even though they are only trying to do what's right after Apple put them in a tough situation. This means they not only lose whatever income they might have made in the last four months, but they also have pay out additional money on top of what they invested to develop and market their application.

The FCC has decided to investigate the situation. I'll be interested to see if anything comes of it. I don't have much faith in the FCC, that's for sure, but maybe they can do something good for a change.

Lately I've been bashing Microsoft a lot for making poor decisions and failing to recognize the reality of their situation. In most respects, Apple has been on a roll, making good decisions and making elegant products that people are clamoring to buy even in a poor economy. But, Apple has to realize that a large part of the success of the iPhone has been the App Store. Given that they've based much of their advertising around that single point, it's clear that they do recognize it.

From the start, third party developers have had to live with an arbitrary review process that potentially meant they could spend lots of time and money and end up completely unable to sell their application for failing to comply with some unwritten rule. That was bad enough, and certainly has had a chilling effect on third party application development. The App Store was so hot, though, that most developers accepted the risk, figuring the potential reward outweighed the risk.

This decision by Apple adds a new aspect that is almost certain to drive away some of the most innovative developers. Not only do we have to worry about whether our apps will be approved by the somewhat arbitrary review process, but now we have to worry about having their approved applications removed.

I don't have enough evidence to be able to say I know for sure why Apple did this or why they handled it in this way, but if they don't take steps to fix this and to communicate that they're aware of the problem, it will leave a black stain on their reputation in the eyes of even the most ardent fanboys.

It really concerns me and I hope Apple fixes it, quickly. Apple should, at very least, pay their own share of the refunds. If the people making the decisions have a soul, though, they should offer to pay the full amount of the refund and probably do even more. Riverturn expended time and resources to create a program that any reasonable person would believe complied with the App Store policies and SDK agreement. There are several other apps on the store that haven't been pulled that allow voice communications over wi-fi, including the iPhone Skype App. Heck, Apple's own reviewers must have felt the same way, since they approved the application and it was on sale for four months before somebody said "hey, let's pull this".

Apple, please make this situation right and then fix whatever internal policies allowed it such an injustice to happen.

Thursday, July 23, 2009

Interesting Contrast

Definitely a sign of the times: Two days ago, Apple announced another best non-holiday quarter ever, handily beating analysts' predictions. Today, the once-unstoppable Microsoft reported a 17% drop in revenue, marking the first full-year decline in revenue in Microsoft's history and missing analysts predictions by a wide margin.

It's obviously a good time to be a Mac user. It's been a long time since I've heard anyone predict the death of Apple (a favorite pasttime of analysts and pundits for years) and ignorant comments about Macs being "toys" or "not for serious work" are almost non-existent except for a few bitter and lonely commenters on Reddit and Digg.

The problems Microsoft is having, no they are not Microsoft's fault. It's the global slowdown and other things that they have no control over and couldn't have possibly predicted.

Let's face it, Microsoft has "Victim Syndrome". They're not fixing their problems because they haven't truly accepted that they're doing anything wrong. They go so far as to pat themselves on the back for cutting costs and laying people off, saying
In light of that environment, it was an excellent achievement to deliver over $750 million of operational savings compared to the prior year quarter.
Seriously? Operational savings? That's a pussy way of putting it, but I guess "layoffs" sounds too negative. And how does the word "excellent" even get worked into reporting a substantial decline in revenue? And how do they title their release?
The company delivered operational efficiency and innovation in a difficult environment
Now, compare that with Apple's post-Jobs earnings statement from December 2000 where they had some similar problems. Right in the title, they called their results "disappointing". Although Apple pointed out the global PC slump as a contributing factor, the reasons they gave for the loss were that they didn't plan well enough. Apple's approach was, when you cut through the anaylst-speak, to say "we fucked up, we know it, and we're going to fix it". They acknowledged the problem.

Microsoft, on the other hand, is trying to convince everyone (themselves included, perhaps) that they are still headed in the right direction and are doing just great, despite overwhelming evidence to the contrary. What they should be telling us is that they've got problems and they know it, and they've got a plan for fixing those problems.

Microsoft needs an intervention, badly. They need somebody to be a real friend and tell them the harsh truth: that they've got a problem and they need help.

I've said it before, but I think Microsoft is desperately overdue for a change of leadership. It takes a long time to turn a big ship around, so the sooner Microsoft can get someone with vision at the helm, the better it will be for Microsoft.

Waving the Red Flag

Microsoft's Ads Redux

A while back, I took Microsoft's new Laptop Hunter series of television advertisements to task for being ill-advised. This line pretty much summed up my point:
Price is the competitive advantage of generic brands and sweatshop-backed superstores.
and this was the crux of my argument:
Now, this [approach] will resonate with some people. There are always people who take a certain pride in buying things cheaply under the assumption that anytime you pay less you get a better value and it's a waste of time comparing the actual products. I doubt that people who think like that are a particularly large percentage of the population. Maybe they are, and maybe this is a brilliant ad, and I'm simply overestimating people. Only time will tell, but I suspect that these ads will help Apple as much as they help Microsoft and, if they have any effect at all, it will simply be to polarize the consumer market even further, giving Apple more of the higher-end, higher-profit sales, and cementing Windows as the operating system of the "cheap" computer. Most people will interpret "just as good" as meaning "not as good".
To the extent that I predicted that Microsoft's ads would not have an impact, I was completely 100% wrong. These ads have almost definitely impacted computer purchasing decisions over the last several months. However, unfortunately for Microsoft, the effect the ads seem to have had is exactly what I predicted. The PC market is getting polarized, with Apple becoming the OS of choice for high-end, high-margin computers.

Microsoft still has overall market share probably in the 80-90% range, which is more than substantial. In fact, it can't be described in any other way than "dominant". There are very few industries where any player has that kind of market share.

But, the bulk of the new computers being sold with Windows on them are sub-$1,000 systems. If you look at the systems being sold in that price range, they are mostly computers with outdated components like slower (and less) RAM and older integrated graphics chips. Now, there are plenty of consumers in this price range, and Microsoft is still making a lot of money from their OEM sales.

But, Apple is now dominating the more lucrative, higher-margin computers, and that dominance has been trending up fairly rapidly.

This is bad for Microsoft in a number of ways. First, the higher the percentage of low-end, basically obsolete computers that there are running Windows, the smaller the potential market for cool new OS-level features in future versions of Windows is. That means that the opportunities for selling higher-margin retail copies of Windows 7 to existing customers (as opposed to those being sold with a new computer) will be considerably less than the installed base. It's also bad for Microsoft's dominance in the PC game industry. One of the most commonly leveled (and perfectly true) accusations against the Mac is that there aren't many games for it. Cutting edge games, however, usually want to leverage the power of the latest and greatest hardware. If 91% of the systems costing $1,000 or more being sold are Macs, don't think game companies aren't going to take notice.

But, the biggest and worst problem for Microsoft is just what I stated above. They're setting themselves up as a generic brand. By competing only on price, and touting only price in their advertisements, rather than the actual technological advantages they do have (and they definitely do have some), their current marketing campaigns are instilling and reinforcing the idea that Microsoft creates bland, mediocre, but affordable and serviceable products. They are basically saying the same thing in their ads as Apple is.

You can argue all day long that your product is better, but if that runs contrary to what you're telling consumers with your marketing, then you're just pissing in the wind. In terms of future sales, it doesn't matter whether Windows is better, it matters whether consumers believe it is better, and Microsoft has stopped telling consumers that.

Wednesday, July 22, 2009

August 14 Workshop Update


The August 14 workshop, for which I am one of the two instructors is filling up fast. I'll be teaching the second part of the workshop on iPhone development; Steve Kochan, author of Programming in Objective-C 2.0, will be teaching the first part on Objective-C. You can sign up for either the 3-day iPhone session, the 3-day Objective-C session, or do the combined 6-day workshop.

Tuesday, July 21, 2009

To VBO or Not to VBO...

Daniel Pasco of Black Pixel Luminance has an interesting blog post today on the comparative performance between using VBOs and not using VBOs.

Surprising results, to say the least, and it really makes you wonder why Apple is recommending VBOs for the iPhone.

Improved Blender Export

Thanks to some help from some readers, I've got a new and improved version of the Blender Export Script for Objective-C. This new version works correctly regardless of whether there's a texture. If you've used vertex paint, it will export the vertex colors. If you have neither vertex colors or a mapped texture, then it will just export the vertices and normals. It will also update the drawing code as appropriate to the data that's been exported.

Also, new with this version, you don't need to triangulate the faces, nor do you need to apply modifiers. Those will happen automatically in the export without affecting your original model. That should make it easier to update and maintain the models you use in your iPhone apps.

You can download the new script from the link above. I'm including the script here for the curious:

Note of warning: I have not tested this script very thoroughly, so caveat emptor! Fixes and improvement suggestions welcome, as always.

#!BPY

"""
Name: 'Objective-C Header (.h)'
Blender: 244
Group: 'Export'
Tooltip: 'Exports header file for use with the OpenGL ES template for iPhone available from http://iphonedevelopment.blogspot.com/'
"""

import Blender
from Blender import *
import bpy
import bpy
import os


def write_obj(filepath):
out = file(filepath, 'w')
sce = bpy.data.scenes.active
ob = sce.objects.active
mesh = Mesh.New()
mesh.getFromObject(ob.name)

editmode = Window.EditMode()
if editmode: Window.EditMode(0)
has_quads = False
for f in mesh.faces:
if len(f) == 4:
has_quads = True
break

if has_quads:
oldmode = Mesh.Mode()
Mesh.Mode(Mesh.SelectModes['FACE'])

mesh.sel = True
tempob = sce.objects.new(mesh)
mesh.quadToTriangle(0) # more=0 shortest length
oldmode = Mesh.Mode(oldmode)
sce.objects.unlink(tempob)

Mesh.Mode(oldmode)

objectname = ob.getData(True)
basename = objectname.capitalize()

out.write('#import "OpenGLCommon.h"\n\n\n')

if (mesh.faceUV):
out.write('static const TexturedVertexData3D %sVertexData[] = {\n' % basename)
for face in mesh.faces:
for (vert, uvert) in zip(face.verts, face.uv):
out.write('\t{/*v:*/{%f, %f, %f}, ' % (vert.co.x, vert.co.y, vert.co.z) )
out.write('/*n:*/{%f, %f, %f}, ' % (vert.no.x, vert.no.y, vert.no.z))
out.write('/*t:*/{%f, %f}' % ( uvert.x, uvert.y ) )
out.write('},\n')
out.write('};\n\n')
elif (mesh.vertexColors):
out.write('static const ColoredVertexData3D %sVertexData[] = {\n' % basename)
for face in mesh.faces:
for (vert, color) in zip(face.verts, face.col):
out.write('\t{/*v:*/{%f, %f, %f}, ' % (vert.co.x, vert.co.y, vert.co.z) )
out.write('/*n:*/{%f, %f, %f}, ' % (vert.no.x, vert.no.y, vert.no.z))
out.write('/*c:*/{%f, %f, %f, %f}' % ( color.r / 255.0, color.g / 255.0, color.b / 255.0, color.a / 255.0) )
out.write('},\n')
out.write('};\n\n')
else:
out.write
out.write('static const VertexData3D %sVertexData[] = {\n' % basename)
for face in mesh.faces:
for vert in face.verts:
out.write('\t{/*v:*/{%f, %f, %f}, ' % (vert.co.x, vert.co.y, vert.co.z) )
out.write('/*n:*/{%f, %f, %f} ' % (vert.no.x, vert.no.y, vert.no.z))
out.write('},\n')
out.write('};\n\n')

if editmode: Window.EditMode(1)
out.write('#define k%sNumberOfVertices\t%i\n' % (basename, len(mesh.faces) * 3) )

out.write('// Drawing Code:\n')
out.write('// glEnableClientState(GL_VERTEX_ARRAY);\n')
if (mesh.faceUV):
out.write('// glEnableClientState(GL_TEXTURE_COORD_ARRAY);\n')
elif (mesh.vertexColors):
out.write('// glEnableClientState(GL_COLOR_ARRAY);\n')
out.write('// glEnable(GL_COLOR_MATERIAL)\n')
out.write('// glEnableClientState(GL_NORMAL_ARRAY);\n')
out.write('// glVertexPointer(3, GL_FLOAT, sizeof(TexturedVertexData3D), &%sVertexData[0].vertex);\n' % basename)
out.write('// glNormalPointer(GL_FLOAT, sizeof(TexturedVertexData3D), &%sVertexData[0].normal);\n' % basename)
if (mesh.faceUV):
out.write('// glTexCoordPointer(2, GL_FLOAT, sizeof(TexturedVertexData3D), &%sVertexData[0].texCoord);\n' % basename)
elif (mesh.vertexColors):
out.write('// glColorPointer(4, GL_FLOAT, sizeof(ColoredVertexData3D), &%sVertexData[0].color);\n' % basename)
out.write('// glDrawArrays(GL_TRIANGLES, 0, k%sNumberOfVertices);\n' % basename)
out.write('// glDisableClientState(GL_VERTEX_ARRAY);\n')
if (mesh.faceUV):
out.write('// glDisableClientState(GL_TEXTURE_COORD_ARRAY);\n')
elif (mesh.vertexColors):
out.write('// glDisableClientState(GL_NORMAL_ARRAY);\n')
out.write('// glDisable(GL_COLOR_MATERIAL);\n')
out.write('// glDisableClientState(GL_NORMAL_ARRAY);\n\n\n')

out.close()


filename = os.path.splitext(Blender.Get('filename'))[0]
Blender.Window.FileSelector(write_obj, "Export", '%s.h' % filename)


Thanks to Scott Lyons and Dennis Ippel for their Python and Blender API smarts. I couldn't have gotten this far without their help.

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | coupon codes