Digitimes report that iPad will have a 4K resolution panel

Digitimes are reporting that Apple will release a “4K resolution panel” with the iPad in March, citing “Taiwan-based supply chain makers”:

The new 9.7-inch device will reportedly come equipped with a 4K resolution panel and up to 4GB in RAM, in addition to improved battery life.

While possible, it’s highly unlikely. Consider that the only 4K tablet on the market is made by Panasonic for $6,000, and it ships with 8GB of RAM. The amount of battery and weight added by a 4K panel, as well as the added cost and marginal benefit to consumers, makes this report incredulous.

Safari Crashing and Google Chrome's new implementation

Safari on iOS and OS X has been crashing for many people this morning, MacRumors reports. Serendipitously, Google have pushed an update to Chrome on iOS which switches UIWebView for WKWebView, and they posted on their blog today that it’s reduced crashing by 70%. Epic burn aside, it seems to not matter if you’ve got the resources of Apple or Google, or if you’re a one-person shop: code breaks.

Apple Insider: Apple car project hiring frozen

The speculated Apple car project’s hiring has been frozen, Sam Oliver reports for Apple Insider:

Apple has placed a hiring freeze on the team responsible for the company’s nascent automotive ambitions after executives became unhappy with the project’s direction and progress, AppleInsider has learned.

The change was precipitated by a post-holiday progress review conducted by Apple design chief Jony Ive, according to a previously reliable source with knowledge of the team’s activities. Ive is said to have “expressed his displeasure” with the group’s headway.

In all, Apple is believed to have more than 1,000 people working on Project Titan at sites both inside and outside of Cupertino. Hiring was so aggressive that Apple’s poaching of engineering talent from Tesla is thought to have had a “big impact” on the Elon Musk-led company’s ability to keep up with development of future vehicles.

I would love to know the Apple leadership’s reasoning behind entering the car market. As I’ve speculated before, it wouldn’t be enough to just make a car, or an electric car, or a beautiful car … Apple is either hiding something big or making a big mistake, and they’re no fools in Cupertino.

I’m also curious how the Apple car project is affecting Apple’s existing products. For instance, the iPhone launch is said to have taken top engineers away from the Mac, resulting in a lackluster release one year. I certainly think that software quality on Mac has withered, and it could be in part because of the iPhone’s popularity, and in part because of the brain-drain from the Apple car.

Speculation on the new MacBook Pros coming in March

Seth Weintraub quotes KGI’s Ming-Chi Kuo in a report for MacRumors:

We see MacBook as a stronger candidate for becoming a theme given solid growth in the business segment, as well as a potential upgrade to hit the market in 1H16.

I don’t know about whether we’ve hit “peak iPhone” or how this affects Apple’s stock price, but I do know that the Mac as a platform has been neglected in recent years (in comparison to its younger, cooler sibling). To cite a few examples, the Mac App Store is a disgrace, Photos.app is a bit of mess that was ported from iOS, and the filesystem desperately needs upgrading. If market speculation regarding the potential growth of Macs allows Apple to focus on it, I’d jump for joy. The specs I’d like to see this March are:

  • Skylake processors,
  • faster PCIE storage,
  • an upgraded (and perhaps default) graphics chip,
  • a 32GB RAM option,
  • Force Touch trackpads on the 15-inch models,
  • and the new butterfly keyboard.

I’ve read rumors that we’re going to see a re-design as well, and that I could take or leave, I find the present models plenty beautiful and utilitarian.

WSJ: Apple car project lead is leaving

Daisuke Wakabayashi writing for the WSJ:

Steve Zadesky, a 16-year Apple veteran who has been overseeing its electric-car project for the last two years, has told people he is leaving the company. The timing of his departure isn’t clear. He is still at Apple for now.

Joe Rossignol writing for MacRumors:

Apple’s electric vehicle could be approved for production by 2020, but some employees reportedly believe it “might take several more years” for the iPhone maker to develop a truly differentiated electric vehicle. The project has encountered some challenges internally due to a lack of clear goals, according to the report.

Jordan Golson writing for The Verge:

“While the departure of Apple’s head of automobile efforts may seem like a blow, the reality is Apple has enough money and potential to bring in almost anyone they desire,” says Akshay Anand, analyst with Kelley Blue Book. “This shouldn’t railroad Apple’s efforts and the rumors that they are indeed focused on becoming a player in the automotive space.”

I still struggle to picture, both visually and conceptually, the rumored Apple Car. The car does seem to be the ultimate product in the sense that almost everyone could use one, it’s expensive, and it takes huge amounts of manufacturing and technical expertise to create. However, cars have got many aspects that Apple eschew: it’s highly regulated, it’s highly competitive, and the margins are low (compared to the iPhone).

If Apple truly are entering the car market and they behave the same way they did with the iPhone, they must have an innovation which will allow them to be truly different from the competition and command a high-margin. Because Apple don’t make commodity PCs or phones, it’s safe to assume they won’t make commodity cars, so the high-margin won’t be because of low-cost, it’ll be because of a high-price.

Should this be the case, I think this innovation will be so extreme as to make the cars that Apple make resemble little the cars we know. It won’t be enough that they’re electric, because Tesla do that, or that they’re slickly designed, because many high-end cars are. To me, it seems “personal transport” may be a better label than “car”, because I’d be underwhelmed by an Apple that enters a commodity market with a commodity (or near) product.

Let's Build – A shared economy app – Wireframing

In this series of posts, I’m going to learn how to plan and build a shared economy web app. This is an opportunity to learn and document the process of wireframing, designing, and developing an application from nothing, which (crucially) is usable by real people. I’ll be drawing from Michael Hartl’s Ruby on Rails Tutorial to learn how to build the application. The idea that I’m going to be building out is simple. AirBnb lets you monetize your extra room, Uber lets you monetize your time and car, but what about that pool you have? Or your trampoline? Or your basketball net? So that’s it, a shared economy app for use of your extra amenities.

This post is dedicated to wireframing. In programming and in life, I’ve always found that coming up with a plan before doing something greatly increases the chances of success. When the luxury of a plan can be afforded, it’s advisable to indulge. In the case of building a web app with Rails, the plan should come in the form of a wireframe. A wireframe is a technical document which contains no color, font, or even layout decisions, but rather the structure of information and the architecture of how a user navigates an app.

In order to accomplish this, I purchased the Omni Group’s well-known and quite renowned OmniGraffle software. There were cheaper options out there, with the standard variant of OmniGraffle costing $99.99. Many people I trust use it and I enjoy high-quality Mac apps, so I took the plunge. You can likely accomplish this task with many other tools out there, free or otherwise, just search Google for “wire framing software” and do your research. Honestly, I find many things frustrating about OmniGraffle, but it’s treating me pretty well (I’ll perhaps write a review).

The next tool I’ll need to start wire framing is a good stencil (template) for OmniGraffle. To make my life easier in development, I’m going to use the Bootstrap front-end UI framework, so I found a stencil which has Bootstrap’s elements and grid. With these tools, you can drag-and-drop UI elements into you canvas to mock how your application will work. First, I created what my application will look like to the general public, for those customers who are seeking a pool (as opposed to listing one).

user-facing

Here, I tried to come up with the absolute minimum number of pages for users to have the core experience of this app – going online, inputing what they want to do, finding results of people who are offering to share their stuff, and checking out on it. I also tried to structure the information in a way that would make designing the application easy, in the sense that I avoided forms and used pictures liberally. Also, note that I’ve made a number of simplifications for the sake of this demonstration, for instance real users would want to refine by their location, I feel it’s just more than I’d like to get into for this learning experience.

After I finished these wireframes I realized I was missing something crucial. Users could easily find something they want to do, but it was impossible for them to post something they wanted to do. In wireframing this, I kept in mind that this user will tolerate something that doesn’t look too pretty, as long as it was efficient at getting their item up on the service. Furthermore, they are going to want a way to tracking how much money they’ve made. This differs from the customer-facing wireframe because it will not make liberal use of pictures and might be quite form-heavy, considering it’s data input. Here’s what I came up with:

admin-facing

With a quick idea, a good wire framing app, and a couple sessions at a coffee shop, I have a plan to take to the terminal. In the next post, I’ll either design the application by giving it some nice fonts and colors, or I’ll just jump into development (depending on my mood and level of impatience).

New Years in Zurich

This New Years I had the tremendous good fortune to visit Zurich, Switzerland with my family. We flew from London, Heathrow to Zurich International Airport arrived on the day before New Years Day. Here’s a shot of our arrival in Zurich HB train station (right on time, of course):

Zurich train station

My family and I stayed at an AirBnb in a quieter part of town, Dubstrasse Street in Werd. We spotted another prominent tech company on our way, with a major Google campus located nearby. Here’s a shot of Zurichsee in the day:

DSC_0065Walking along the river, every corner of the city is packed with history, character, and luxury retailers. In particular, there are four major churches in one part of town, here are two of them:

DSC_0073

It got dark pretty fast, but the weather stayed pleasant and the streets stayed safe. It was unusual to see neither an officer of the law nor a homeless person while walking around, which I’m very accustomed to seeing in NYC.

DSC_0084

Zurich became more beautiful as night fell, and the water in one of the two nearby rivers was pristine. While rambling about, my family and I noticed that swans made a home in the river, and there were a great many of them. Another unusual sight for a New Jersey native:

DSC_0120

As midnight drew closer, we began to head down to the Bahnhofstrasse, where a fireworks display is being held. Before the official celebration, citizens took it upon themselves to ignore the no warnings against setting of fireworks in a rare and magnificent display of law-breaking:

DSC_0130

But this was little compared to the official display. The fireworks were especially extraordinary for the unexpected reason of the seemingly constant fog above Zurichsee, where every firework light up the entire night sky in its own shade as it refracted through the fog:

DSC_0141

It was a delight to get three days in Switzerland with my family and a pleasure experiencing Swiss culture.

Apple's stance on encryption and tracking

Rich Mogull writing for TidBITS,

We are in the midst of fundamentally redefining the relationship between governments and citizens in the face of technological upheavals in human communications. Other [non-Apple] technology leaders are relatively quiet on the issue because they lack the ground to stand on. Not due to personal preferences or business compromises, but because of their business models, and lack of demand from us, their customers.

Apple surely has their customers in mind with their defense of encryption and privacy, but it is also convenient that many of their competitors’ businesses rely on tracking. This has to be one of the reasons iAd was so unceremoniously swept under the rug, why Apple allowed content-blockers on iOS, and why they are such stalwarts about privacy: it’s good for users and it’s good for business.

How does NBC know Netflix's viewership?

John Gruber has been investigating how NBC president Alan Wurtzel had an idea of how many people watched Netflix shows, it turns out he’s using figures drawn from Palo Alto-based Symphony Advanced Media’s “Media Insider” app. It works like so:

It turns on the microphone to listen to what you’re doing “intermittently throughout the day”, requires permission to see and track all of the apps you use on the device, and they want you to turn on their “M-Connect” “feature”, which is a VPN that intercepts all of your network traffic.

Oh wow. They get people to sign up for this by marketing and offering gift cards.

The ugly overlap of government and technology

Information in the digital age is free. Sharing the words or code or images you make on the Internet cannot really be controlled. In the past, governments and other organizations have limited the spread of information by physically blocking, destroying, or otherwise hampering its spread. But with the Internet this is not so easy.

For instance, England wants to ban end-to-end encryption. China has built a digital version of the Great Wall, censoring anything that they deem counter to their efforts. The White House refuses to strong stance in favor of encryption. But because information is so easily duplicated and shared, because it so badly wants to be free, and because prime factoring is so difficult with current processors, all of these efforts to control and censor people face a constant uphill battle.

And then there’s this:

We’re going to get Apple to build their damn computers in this country instead of other countries.

Flux calls on Apple to allow them to release in the App Store

Today we call on Apple to allow us to release f.lux on iOS, to open up access to the features announced this week, and to support our goal of furthering research in sleep and chronobiology.

The makers of the dimming Flux application want access to private APIs to release in the App Store. In my opinion, they shouldn’t be granted it. Not because they haven’t got a good app, but because these screen whiteness APIs should either be released to everyone or not at all. If they’re released to everyone, we will see as many screen dimming apps as there are farting apps.

Furthermore, the stunt that Flux pulled to distribute their app via GitHub without actually open-sourcing the codebase, by adding an executable binary blob to an empty Xcode project and having user’s side load that, was a terrible move. It made the project look open-source, but was actually executing arbitrary code which no one but Flux knows what does. A bad precedent, and Apple were paying attention, and that is why they’ve drew Apple’s ire and swift sherlocking.

I find Flux’s response poised and classy, but they shouldn’t be allowed to access the private APIs on iOS. They will continue to have tremendous success as a Mac app, and I will continue to use their app. I hope they get their patent approved and Apple license the technology from them. If I were them, however, I would release the code, for iOS and for the Mac, as free and open source. If they’re mission is really “to enable f.lux to advance the science, while providing customized solutions for each person”, then they should go open source. If they had done that in the first place, I bet Apple wouldn’t have minded that they were using private APIs.

And Apple’s ire extends beyond Flux, in the release notes of the Xcode 7.3 beta, it says that they’ve removed all private frameworks from the SDK.

Elon Musk: "It’s an open secret that Apple is working on an electric car"

Dave Mark, writing for The Loop:

Elon Musk, in a BBC interview, talks about the Tesla Model 3, in production next year, designed to be affordable for the masses. When asked about Apple’s plans, he (almost reluctantly, it seems) makes the point that it is an open secret that Apple is working on a car of their own.

I’m in two minds about this. Firstly, quite selfish: I, and many of my city-dwelling peers, am not buying a car. Even low-end, second-hand cars are too expensive for the value it would deliver back to me (as far as I can tell). So I’m quite apathetic about the Apple Car.

But! As a developer, I am curious about the potential for 3rd party apps in the car. It’s a place where consumers spend tons of time, commuting, road-tripping, Sunday-driving, all of which are moments that an app, maybe my app, could deliver value. But I’m also highly skeptical that I want code from any ol’ developer running my (very hypothetical) car.

Apple News app under-reporting usage

From the WSJ:

Eddy Cue, Apple’s senior vice president of Internet Software and Services, said the company missed the error as it focused on other aspects of the product. The company didn’t explain how the problem occurred or say exactly when it might be rectified.

“We’re in the process of fixing that now, but our numbers are lower than reality,” he said. “We don’t know what the right number is,” but he added that it was better to undercount than overcount traffic.

Graham Spencer from MacStories writes:

A curious admission from Apple, particularly given that the issue has not been fixed yet. No details are given about the scale of the miscalculation, so it’s unclear as to whether this will result in a minor adjustment or significant adjustment in reader statistics.

Dave Mark for LoopInsight:

… [T]his is an embarrassing hiccough that Apple News did not need.

Eddy Cue has had a number of missteps in the last year: the Apple Music launch at WWDC was poorly executed, the MAS exodus under his leadership, and now a fairly minor analytics bug making front-page headlines.

Twitter is removing the 140 character constraint

From the WSJ:

The company is planning to extend its 140-character limit to as many as 10,000, according to a person familiar with the matter.

Seems to me that Twitter is expanding to be more like Medium and Tumblr, becoming less of a micro-blog and more of just a blog. Admittedly, I rather dislike reading Twitter conversations, and this change will likely make them more difficult to read. I recognize not everyone wants to go through the effort of starting and maintain a blog, and I also understand that a big part of Twitter’s appeal (like all good social networks) is it’s ubiquity, but I still don’t get why people are willing to surrender their content to corporations, man.

Hi-Res audio and the 3.5mm jack on the iPhone 7

There’s major cognitive dissonance in the Apple rumor-mill right now. The claim that Apple is developing “Hi-Res Audio streaming up to 96kHz/24bit” contradicts the claim that Apple will “switch away from the common TRRS 3.5mm jack” because high resolution audio is going to be limited to the quality provided by Bluetooth without the 3.5mm jack. And that’s because I will not buy Lightning headphones, because those are headphones for exclusive use with iOS devices. But maybe there’s hope for Bluetooth.

Star Wars: The Force Awakens Review

There has been a great disturbance in the nerd Universe, coming from a a long time ago in a galaxy far, far away; Star Wars: The Force Awakens has come out and it has shattered all previous records and been met with great acclaim. The run up to the release was one of the most relentless marketing campaigns I have ever experienced: it seemed like Star Wars, now owned by Disney, found a way to insert itself into every conceivable market, from make-up to fast-food to toys. Anecdotally, there hasn’t been such hype around the franchise since the first release in the prequel trilogy, and considering that film was panned by critics and fans alike, the obvious question is, how does the 7th episode fare?

This weekend I had the tremendous pleasure of experiencing the film in IMAX 3D, and I’m happy to report that like his Star Trek adaptation before this film, J.J. Abrams and co. did excellent work with the latest episode. The film is very aware of its history, and sufficiently forward looking. In this compliment is a thinly veiled criticism however: part of the magic of Star Wars originally was that it offered a vision of the future (well, the past, but you know, spaceships) which was unprecendently exciting. It’s no longer 1977, however, and the future of today is very different from the future of yesterday, to put it obscurantly. For instance, we are today conducting automated warfare, and yet a future society which has seemingly sentient robots still places ace pilots physically in space craft to conduct war. Seems unlikely.

But we could likely bracket this concern in the same way that we suspend our disbelief in the Force, the magical power which permeates through all like of the Star Wars universe. And while we’re being as charitable as we can, it’s worth noting that the action and swash-buckling and the snappy comebacks, all cornerstones of the Star Wars tone, are present and stronger than ever. The CGI in The Force Awakens is masterful and tasteful, BB-8 has the personality and presence of Wall-E, the Millenium Falcon has never looked as believable or exciting (even if it struggled to be as nimble after all these years), and I could feel the savage, uncontrolled power of Kylo Ren’s red light saber. The mechanics of what makes a Star Wars film were present in as full a force as ever: the spaceships and lightsabers, the blowing up of spherical super-weapons, and the unlikely tales of supreme heroism against all odds are bigger and better than they’ve ever been.

Yet again in complimenting the film I’ve stumbled across a thinly veiled criticism: if this film didn’t carry the Star Wars moniker, it would be a copy that was better funded than the original, taking what was good about its predecessors and increasing the size 100 times, quite literally in the case of Starkiller Base. Not only that, but its demise of Starkiller is quickly met by the standard old way of sending your ace pilot to shoot it in its soft spot. I emphasize quickly because the terrible destructive nature of Starkiller Base is difficult to take seriously when it’s destroyed in a dozen scenes after it was introduced: it would have been much more imposing and compelling had it been looming in the collective fandom’s psyche for destruction in an upcoming film. Han Solo himself seems to recognize in a moment of prescient self-awareness, asking where Stakiller’s soft spot is and that “they always have one.” And while we’re at it, it seems Jakku is rather like Tattooine, Starkiller rather like Hoth, and Takodana rather like Endor (I recognize that I maybe just be pointing out that it’s desert, snow, and forest biomes but this is an entire Universe we’re talking about).

These are the ways in which the film draws on the previous installments, but the film does have a lot of new ideas that excite me. For instance, Star Wars has always been about the father-son dynamic, being principally about the struggle between Luke and Vader née Anakin. The Force Awakens brings something that no Star Wars film has seen before: a strong female lead, with the brilliantly casted and written Rey. I only presume that Rey is the daughter of Luke, the principal evidence being that Star Wars is the story of the Skywalkers, and I’m excited to learn how Rey will grow to defeat her clear adversary: Kylo Ren née Ben Solo. Similarly, I’m excited to learn what the killing of his father does to Kylo Ren, because while he desperately tries to emulate his grandfather, little does he know of Vader’s struggle with the Light, setting him up to strive for version of the Dark Side which never really existed.

I don’t know why Kylo does what he does: it seems he is a Good Guy who desperately wants to be the Bad Guy, and this uncertainty makes me like his story. With the mask on, he plays the Bad Buy perfectly, executing entire villages, successfully torturing and extracting information, and capturing important rebels. But when his mask is off, so does his evil falter: Rey manages to push back his Force mind-reading, he need’s his father’s help in his father’s execution, and Rey manages to keep him at bay in a lightsaber duel even as a total amateur. I look forward to learning what about Luke’s training caused Kylo to fall to the Dark Side, how Kylo’s failure will be internalized, and why Snoke has such control over the clearly powerful Kylo. In this film, Kylo seems to be a childish poseur, exercising his evil in futile ways like destroying things and relying on physical pain for Dark Side strength. For these reasons, Kylo Ren is my favorite new character, because even though he’s cowardly and undisciplined, he’s also the most complicated and has the most potential for growth, even if it is into the series worst villain.

A reason that I find Kylo more exciting than Rey or Finn could also be that Kylo’s story is more singular, while Rey and Finn tell a disjointed, stop-and-go story. Finn is much more important to the narrative early in the story, delivering Po from the certain continued torture and interrogation of Kylo back to Jakku and safely delivering Rey and BB-8 to the rebel base. When he’s knocked unconscious however, Rey takes the Light Side’s narrative flag, and continues the struggle against Kylo. I hope that in the next film, Rey and Finn get their own distinct stories as opposed to sharing one. The Light Side’s story is made even more confusing by the myriad throwback appearances, which while I throughly enjoyed, I only enjoyed them because of how good previous movies were, not necessarily because of their performance in this film.

Finally, Snoke has really captured my attention. He’s not complex like Ren because we simply do not know enough about him, but I desperately want to know his backstory and what motivates him.

The Force Awakens is an excellent entry into the Star Wars franchise, and it makes the sequel trilogies proud with its tasteful effects and operatic conflict. While it may seem I’m being very harsh on the film, it’s only because I hold the franchise to such a high standard, and J.J. Abrams and co. have done a better job than anyone else could have today.

Apple's executive mix-up: Schiller responsible for App Store

Rene Ritchie of iMore on Apple’s executive mixup:

What this means for developers in general and indie developers in specific remains to be seen. Historically there have been issues in both orgs. App review has generated complaints about capriciousness and lack of responsiveness pretty much since launch, and that has always been under Schiller. iTunes infrastructure, resources, and tools—or the lack thereof—has been under Cue but now move at least partially under Schiller. In the past, long-requested features like upgrades, trials, and Mac App Store parity have been nebulous in terms of who and how they could be lobbied. Now Schiller’s name is officially on the top and it’s absolutely clear—the buck stops with Schiller.

John Gruber on Daring Fireball:

Treating the App Stores as part of developer relations instead of “media content” is clearly the right way to go. The stores are built on the iTunes Server platform (WebObjects, still!), but running an App Store is nothing like distributing movies, TV shows, books, and music. There are far more improvements that need to be made on the developer relations side of things than the technical side of things (although better search would be welcome).

And Dave Mark on The Loop:

Bottom line, Phil Schiller has a tremendous opportunity for foundational change. He has the chance to make things better for developers in all the App Stores (Mac, iOS, tvOS). Key to this is understanding exactly what the problems are. What is driving some developers to release their apps outside the safety of the official Mac App Store? Why is it so hard to make a living building apps? Are these things fixable? Can Apple make app discovery on the various App Stores easier for users and better for developers?

Apple’s present success is almost entirely (or roughly 56%) due to the iPhone, and its success is almost entirely (perhaps more than 56%) because of wealth of apps found on the App Store. Because there are so many consumers on Apple’s iPhone and because the platform is such a pleasure to develop for, developers have flocked to the iPhone. Arguably, in the early days of the first few iPhones with App Stores, it was for the love of the platform: Mac developers who saw a chance to develop something new and cool. It such a surprise to me that considering this, and considering the resources that must have gone into the latest iTunes Connect update, that something as fundamental as the App Store on iOS and on the Mac has gone from bad to worse.

Worse how? I offer only anecdotes. Sketch has left the MAS after becoming one of its biggest hits. I can reliably freeze the iOS app by spam-hitting the elements in the bottom bar. I have app updates that don’t complete and require a restart or a delete and re-install. I hope that putting Schiller’s alone as responsible for the App Store along with placing his good reputation with developers on the line will solve the App Store’s problems.

Mastering the iOS Technical Interview

General Questions

  • Can you describe your workflow when you work on creating an iOS app? Sure. iOS is like any other platform or programming environment, and at the beginning, you need to collect a complete or good initial set of program requirements. After you and your coworkers or clients are happy with the requirements, it’s time to start translating the program requirements into your software architecture. If dynamically updating content is a requirement, you’re going to need a backend. If caching or manipulation of content is required, you’re going to need a database, which will determine the structure and nature of your model. If a GUI is required, you’re going to need to define your views. You wrap these components together with a controller, and assure that your naming convention is semantically similar to your problem domain, downloadBusinessInformationFromBackend,storeBusinessInformationInBackground,updateViewForNewBusinessInformation, etc.

Continue reading “Mastering the iOS Technical Interview”

C and C++ Callbacks with SQLite

Everything is data. Occasionally, when programming day-to-day objects and functions, you get a reminder that everything from the keys you press to the code it makes to the bits it reads is data.

But enough, say you want to use C++ with SQLite in a sane, object-oriented way. More specifically, you want to use sqlite3_exec to execute a SQL query. Here’s an example:

int rc = sqlite3_exec(db, sql, callback, data, &errMsg);

What is each one of these parameters? The first, db, is your opened database, sql is a const char * query you want to run, callback is a static function pointer, data is a peice of data you want to send to callback, and errMsg is what it sounds like. Okay, all’s well, lets define that callback.

static int callback(void *param, int argc, char **argv, char **azColName)
{
    return 0;
}

Damnit. This is going to be called once for every row, I don’t know when it’s going to end, and it’s static, throwing any hope for object-orientation out the window.

Or does it? Switch gears for a moment: What’s one of the hallmarks of object-oriented programming? I’m talking about the keyword this or self. What this is is difficult to describe to others because you’ll often find yourself saying something like, “this is this, like you know, this is this”. But this can be thought of as a hidden parameter passed along with every message sent to an object which can access the object that the message was sent to.

Well if this is what we’re after, this is a hidden parameter, and we’ve got a void * we can put whatever we want in, how about we just reconstruct our instance of an object using C++ casting?

First, make your request:

char* customer::getPerson(int id)
{
    ...
    rc = sqlite3_exec(db, sql, callback, this, &errMsg);
    ...
}

Then, define your C callback with C++ casting to turn person into this:

static int callback(void *param, int argc, char **argv, char **azColName)
{
    Person * person = reinterpret_cast<Person *>(param);
    return person->cppCallback(argc, argv, azColName);
}

Finally, profit:

int Person::cppCallback(int argc, char **argv, char **azColName)
{
    ...
}

Thanks to this StackOverflow post for the insight.