Dependent Origination

Archive for January 2013

ERROR: The certificate of `certain_url’ is not trusted.
ERROR: The certificate of `certain_url’ hasn’t got a known issuer.

First of all, I am accessing an URL of http but wget is still complaining about their certificate. Second of all, I do have a certificate from the other party and i thought i should be making wget aware of the certificate.

Turned out to be a wrong approach.

One test, paste the http link to browser, it complains about an unsafe certificate, but if you click Proceed anyway, the xml file shows up in browser fine.

So turns out wget has an option –no-check-certificate and everything is fine after using the option now πŸ™‚

Let’s say we have two libraries A and B. They both need library C, which is a header file only library since there are only two simple functions in the header file. Now I am building D, which needs both A and B. The linker is complaining multiple definitions of functions of C since both .o files have them.

Solution: make the functions in the header file (of C) inline. This way, it won’t be compiled as a separate function into the object files. Even if the compiler couldn’t make it inline, compiler will find an anonymous namespace and put the function there.

The other solution we can separate out a .cc file from the header that way we would have a third .o file and that solves everything too. But I find the inline solution better in this case, and it increases my knowledge about compiler too πŸ™‚

So you finally built your app and it is copying over to the device all the files — and “cannot change executable permission for the application”??

You can check the console output in the Organizer window for your device — but the log looks quite mystic to me — most useful information is it says “installation failed”.

Here comes the solution: remove all the apps with the same bundle identifier from your device. And it will run. On my phone, I have installed our production version so once I removed that app, everything is cool. Well not exactly running. But running without any xcode/phonegap/development certificates/code signing/provisioning profile problems πŸ˜€

This usually involves rebuilding your third-party libraries with the correct architecture targets (like adding armv7s to it in earlier version of xcode) — not sure if it is still the case now since armv7 and armv7s are one single target inside xcode.

My setup is a bit different. I am trying to make an old app work with the newer libraries. Making the app work on simulator solved the problem with libraries such as jquery and jqtouch. Now when I tried to build and run on my actual device, it is PhoneGap 0.9.0 that might need fixing (the current version is 2.2.x).

I want to avoid pulling in a new PhoneGap library — besides, PhoneGap core library is renamed Cordova and I see name changes all over in the source files. So with a leaden heart, I tried one thing: in the project file of PhoneGap (one above your own project), I changed the value for Valid Architecture to “armv6 armv7 armv7s” from “armv6 armv7”.

It worked. My app is built.

My mobile site is not writing into syslog about warnings, errors, log statements I want to see.

Add this to your VirtualHost definition:

<VirtualHost *:port>

php_value error_log syslog


Bingo! debugging a lot easier~~~

This is an epic bug that needs to go to some history of sorts πŸ˜€ We have this HTML5 app I wrote and launched two years ago (March 2011 to be exact). That was for fast iteration and getting user feedback quickly, which was the most important thing for a company of five people (at the time). We have since hired a contractor company to rewrite the app in native Objective C and launched it too. The contractor company put four people on the project, and we had one product manger and one engineer and it took four (? or five? or six?) months to launch it. The complexity of the app increased a lot (which i actually am not sure whether it is a good thing or not since i hardly used it after the upgrade, i felt overwhelmed every time i opened the app :). But you can still see the difference (the first version was me and only me).

Anyway, here we are again to explore our mobile strategy. Namely, hiring contractors isn’t working out that great, mind you. There is a difference in working attitude (that is whether you would put in efforts in making something better, or you just do what you are told, in the minimum way). There is also management involved. Lots of teleconferencing, Lots of back and forth etc. So we are again revisiting the problem if we do it in-house or out-source.

Before answering that question, also because good mobile developers are hard to come by, boss wants me to re-incarnate my old app and see how it is working out with the new jqtouch, phonegap, jquery libraries. See how good they are doing now, especially with the problems we used to have with these free libraries, for example, scrolling speed.

Hence I have been spending the past week and a half trying to make the app work again. Mind you I finally reached the third screen, with the third screen fully working on both Chrome and iOS simulator. It is tremendous amount of torture: everyday time was spent from morning to evening in frustration (about things that should work but didn’t) and haze (why?). So I will write about this epic bug I figured out using a day and a half. I am feeling better in fact after this bug: finally this feeling that I can do this. So that is happy ending, sort of πŸ™‚

The bug is like this, we have these lists on the app. You tap (click) on one of the list items and then it goes to the next page. Just like hyperlink. However, nothing happened on the iOS simulator. Well at first nothing happened on Chrome either. But I figured out that if you include a <a href=’#’></a> inside a <li></li> the clicking will work on Chrome.

It took hours (and lots of console.log, and lots of simplifying code to have a minimum case to work with) to figure out the reason why navigation doesn’t work is because the touchStartHandler inside the jqtouch-jquery bridge file isn’t fired. The jqtouch.js registers a handler for touchstart which practically does nothing. The clickHandler gets called but in the end it concludes the current device supports touch so it doesn’t need to fire ‘tap’ event.

Upon further inspection, it turns out the jqtouch-jquery.js file registers the touchStartHandler this way:

$(document).bind(‘ready’, function () { $(‘#jqt’).bind(‘touchstart’, touchStartHandler())});

If you change it to

$(document).ready(function () {….});

Everything will work. I am feeling great now πŸ™‚

if you find your app fetches the same html page every time it is running, despite the fact that you have edited the html with lots of ‘hello’s, it turns out the simulator is cacheing its images and related files and not fetching fresh.

go to dropdown menu in iOS Simulator (the app menu), choose ‘reset content and settings’

re-run the app and you will see the html page returns as the version you want

unfortunately you have to reset every time before you try out a new change — it is atrocious that the user experience of the developer for a company known for great UI/UX is THIS BAD. you can obviously tell that they are products from two different groups, in terms of UX.

January 2013
« Dec   Feb »


Flickr Photos