Expected specifier-qualifier-list before 'NSManagedObjectModel' error and how to fix it

I was putting Core Data into an existing application. I was cutting and pasting a lot from the excellent Apple example, iPhoneCoreDataRecipes. No, this is not a bunch of code examples to show you how to get started with Core Data...but it is a working example of how to get an app up and running with Core Data using SQLite as a back-end persistent store.

So, I was happily cutting and pasting code between iPhoneCoreDataRecipes and my iPhone app (the premium version of FindIt, if you must know) when I ran into the following error everywhere:

Expected specifier-qualifier-list before 'NSManagedObjectModel'


The object changed (i.e. it was not always 'NSManagedObjectModel') but the error was consistent. And yet I was copying everything over from the .m and .h files in the Apple example. Strange.

My first thought was checking that I had included the Core Data framework in the app. Yup. That wasn't it.

Then I realized--it was the global prefix file. I went and checked out the Apple example, and sure enough, Core Data was there. I just needed to through this into my _Prefix.pch file as well, and all the errors went away.

Hope this helps you too!

This year's MacHeist is coming soon / Is Squeeze worth it?

If you are a Mac user, don't miss this year's MacHeist software bundle, due to arrive March 2nd. MacHeist offers great niche software for free or nearly free. I usually find at least one piece of software in the bundle that I end up using regularly. Whatever else, it is cool to get your hands on new, high-quality, low-cost Mac software and take if for a spin.

Right now, MacHeist is offering a free license for LateNiteSoft's Squeeze for Mac. The idea sounds awesome--just like compressing directories on the PC. If you are not aware of the process, file compressors sit in between the OS's file access methods and the file system, and make the files work exactly as they did before, but compressing them on writes and decompressing them on reads on the fly. The amazing part--since physical file access is typically the slowest part of the read or write, compression reduces disk access but increases CPU time. Since CPU is very cheap compared to the physical access, you usually *improve* performance while you are decreasing disk usage. This makes disk compression under most circumstances a no-brainer.

But I had interesting results in using Squeeze. I had a directory of wave files that I tried to compress. The directory was around 200MB. Here is a screen capture of directory information from Path Finder:

Here is what I saw in Squeeze:

Hmmmmm. 22GB saved on a 200MB directory? For some reason, I am skeptical. I am a developer, so I know fairly minor things like this happen--it is no reason to dismiss a piece of software. But this was in addition to the fact that is kept running, and I was not seeing significant compression on any directories. Anybody else have any good or bad stories to relate on Squeeze for Mac?

Windows screen capture utility

You probably run into this situation--you need to take a snapshot of a section of the screen for a million different reasons, either to show someone or document something or include in an email. I probably reach for a tool ten times a day to do this. The Mac and Windows Vista and 7 have this functionality built in; but what about those of us still working on XP at work?

Enter Brian Scott's Cropper. Cropper is a simple, lightweight, and free solution to this problem. Install the app from the download at the like above and launch it. It will place the Cropper icon in your system tray. Then, when needed, you can double click this icon, and pop up a sliding control on the screen to select an area for copying.

I used SnagIt for years and disliked several things--it seemed very bloated and slow to do simple screen captures. Plus, how many times did you highlight the upper left corner and start clicking and dragging only to see you had not gone up high enough or the left far enough? Then, you are pulled into the next screen, to exit out and try again. Painful.

Cropper instead is very cool in that you can use the mouse or keyboard to move the selected area--even performing a "nudge" with the arroe keys. All around great piece of software. Thanks so much, Brian!!!

My concerns with Quattro Wireless

I have several iPhone apps that are using Quattro Wireless as a major part of my ad serving. Quattro is a pretty good provider in that they seem to offer very competitive rates and typically have offered a pretty strong fill ratio.

That is, until lately. I have noticed my fill ratio drop significantly, reaching between 20-30% in recent weeks, and hitting an abysmal 10% average for the last 3 days. I am sure Quattro has a lot of requests, with the huge growth in iPhone apps lately, and the unprecedented downloading that has been going on. But 10%??!?!? These guys are paid to provide a service, and I was not very happy with the previous 20-30% range.

I really hope Apple buying Quattro can turn this kind of marked decline around. But I am not waiting to see what happens. Over the weekend, I converted my apps over to use the MobClix provider, which promises 100% fill rate--presumably caching ads and presenting them when a new one is not available from the provider.

I am actually pretty impressed with MobClix. I used them for one of my apps, and I am slowly starting to convert over to them for other apps as well. Their framework is small, integration was simple, and I have noticed a significant reduction in application errors from users that are running MobClix over other providers. If you get a chance, check them out. If nothing else, the promise of 100% fill rate has really caught my attention!

Great Free HTML Editor for the Mac

Although I have searched several times with no luck for a good HTML editor for the Mac, today I decided I was done using TextEdit.

Here is my criteria for a "good" HTML editor.

1) The editor must provide some semblance of context highlighting. Just displaying the text is not good enough.

2) The editor gets extra points for some of the features I have come to expect from using the Microsoft toolset--automatic completion of closing tags when I type the opening tag, outlining and the ability to collapse sections, and syntactical popups of available tags. Auto-identing would also get high marks.

3) Support for CSS.

4) Also, a huge bonus if there is some easy way to preview the output.

5) The tool MUST be free.


This all seems like a tall order, doesn't it? Especially when you add in #5.

Well, friends, there is a tool that provides all the above and then some. Navigate your browser over to Aptana and download Studio. You can either download the standalone tool (around 85M) or the Eclipse plug-in if you have already downloaded Eclipse to build apps for the Android phone.

Don't wait! Download it now. This is an unbelievable tool. And did I mention it's free?

Using DateTime.ParseExact to load a DB2 timestamp to .NET

It would be nice if the only database you ever needed to access from .NET was SQL Server, or something similar to it, that .NET understood and worked with easily. One of my clients makes extensive use of DB2, though, and not a recent version--a version old enough that there is no LINQ provider. So, part of my job is working around some of the oddities of pulling out of DB2 and sometimes writing the result into .NET.

Recently I had to pull a DB2 timestamp and save out something like a timestamp in SQL Server. As you probably know, the SQL Server timestamp is not a timestamp as all, at least not like DB2's. So when I needed to pull the timestamp from DB2 and get some semblance of a timestamp in SQL Server, I needed to convert to a DateTime in .NET.

Luckily, DateTime.ParseExact was there to save the day. DateTime.ParseExact provides methods to allow you to describe in detail the format of the value you will be passing in, and have the resulting DateTime parse out the string exactly as you describe it.

The solution is pretty simple (assuming dateField is the input string with the DB2 timestamp):


Dim cultureInfo As New CultureInfo("en-US")
Dim dateTime As DateTime = DateTime.ParseExact(dateField, "yyyy-MM-dd-HH.mm.ss.ffffff", cultureInfo)


Note the ".ffffff" at the end of the format string. This allows you to specify fractions of a second, which will be coming in on the input string. Unfortunately, this information will be stripped off, and you will lose the fraction part. But at least you now have a DateTime you can save successfully into SQL Server!

Good luck out there!

Zero to e-commerce in 2 days with CRE Loaded

If you have done any amount of freelance web development, you have probably been asked at some point to put together an e-commerce store front for someone. Most likely, the request also contained some caveats--like, the customer was just getting started, and wanted a store front for cheap, and they wanted it to be up pretty quickly (i.e. no long development cycle, with a minimum to the requirements gathering process), and they wanted some kind of admin tools so they did not have to contact you any time they wanted something simple like a price change.

As a custom build, this would be nothing short of impossible. Hopefully your next thought is to use an existing framework and customize it, to accomplish the goals and get something up quickly and cheaply. Next, you are also thinking about hosting, which can be expensive too, depending the requirements of the tool you buy.

I was presented with a similar request lately, so I started looking at some existing frameworks. My research took to through such disparate tools as DotNetNuke (of course the Microsoft guy would look at DNN) and MamboCharge, but I landed on CRE Loaded. CRE Loaded is a PHP script that has been developed on the popular OSCommerce framework. And the results are amazing.

Some of the best parts of CRE Loaded are the multitude of plug-ins available (including secure credit card processing), the availability of resources (both people and web content that can assist), and the easy and speed of getting a store up and running. CRE Loaded brags about how quickly you can get a Payment Card Industry (PCI) compliant store up and running, which promises secure processing in an industry standard framework. And it is every bit as easy as they say.

I recently got a store up in just a few days. I spent additional time tweaking the product, and learned a lot of the ins and outs. Let me tell you that if you plan to do any serious customization, or even maintain an inventory of even 100 items, you owe it to yourself to learn how to make changes in the SQL tables directly. I am sure CRE Loaded would rather you would either use their front end, or their custom load process--but if you know what you are doing, you can turn a difficult update across your entire inventory into a few minutes work.

Case in point, I was setting up shipping for the store, and discovered that shipping requires product weights. The inventory list that I had gotten from the customer's POS system was missing a lot of things, not the least of which was shipping weights. So I had 3 options--go through the admin screens and add a weight to every item (probably close to an hour's work); extract the database to a spreadsheet, update the spreadsheet, and then reload the spreadsheet, praying that the only thing that would be changed would be the product weight (probably 15 minutes work, plus an undetermined amount of time to fix anything that might have been broken due to a typo, etc); or, write a SQL query to set every product weight to 1 pound (1 minute's work).

If you are PHP person, you can also dig into the entire source, and tweak the application. This is not for those lacking caution, though, because it is a somewhat complex script, so I would not advise hacking into to it to make changes--spend some time first and figure out what it is doing. Another example, I had to make some changes to the shipping module to allow various flat rate shipping types, selectable by the customer. Currently, CRE Loaded expects that you will either use one flat rate, or chose from a number of different available shipping options. The moral of the story, though, is that will a little analysis, even this was a fairly easy change, and I could customize the app to meet the business' requirements.

CRE Loaded offers a free version that is a bit limited, but the pro version does a lot and only costs the equivalent of a few hours' work. In am impressed with the speed, ease, and flexibility. If you need to get a storefront up, make sure you include it in the list of products you research. It is worth every penny!