Categories
iPhone app Software development

Update sqlite database during iOS app update

Reading Time: 2 minutes

We all know updating sqlite database on an existing iOS app could be tricky, esp. with any schema (table) changes. In the good old days when I was developing in-house app, I found out the app would crash when I added a column to the sqlite database, after merely updating the app. The problem was, the old database won’t get updated if we don’t explicitly do it during app start-up (after app update). So what did I tell my user to do? Delete the app, and re-install the app. Not the most user-friendly way, and what if the user has some data on it that he/she wants to keep? What if this app have many users?

I had this updating issue in my mind for a while, because one of my apps needs to refresh its data. There are a few ways to do it: 1) Use a web service to get the data; 2) Just update the sqlite database. The former has some limitations: we could get data via web service, but note we still need to manipulate the database if we need to add a column or table (this is same for both approaches). The latter is faster in terms of development. So I decided to do it. I did some research on stackoverflow and found this post as my reference. Here is my implementation, if you are interested. The following is done in viewDidLoad.

Categories
advice and tips

How much should we tell Facebook, LinkedIn?

Reading Time: 2 minutes

Dos and Don’ts in the social media age

Recently the Facebook “lab rats” testing for its “news feed” is the news (see this one at Guardian). I gave it some more thought and since I’ve thought about this privacy thing before, I’d like to share some of my thoughts.

We all knew (hopefully heard about) a few years ago, people complained employers in the Facebook (or linkedIn), and got fired. So if one does not plan to move on, my suggestion is not to say negative things about employers publicly. Because although Facebook and other social media appears not necessarily public, they are actually public as soon as it’s went up in the air.

The more worrisome thing for me is, though, is with the big data (data scientists) Facebook and LinkedIn got, they have already affected how we interact with friends, reading news, and how to look for new jobs. And in the process they could manipulate how we think (Facebook appears already did this). So there is the danger of intersection of social media, psychology and data science. Should we worry about all this?

I don’t know. I am not a pessimist, but I think to be careful, or use another proverb: trust but verify. The technology usually will brings positive changes to society, but just like iPad, we should be careful don’t let iPad to our baby sitter 🙂

PS, I happened to read some unpleasant reviews on my former employer at glassdoor.com made by some former coworkers. I don’t think that’s a good idea either. I think those can be address at exit interview, or survey, but not at a public places like glassdoor.com. I don’t have personal opinion about this website (for/against), I just felt some of the comments went to extreme: too good to be true, or too bad to be true.

Another reason which I think is more relevant to those kinds of comments, is people felt frustrated (due to various reasons). And they felt relieved when they left for new jobs, and they wanted to say whatever they like. Wrong. Two reasons: 1) We don’t want to comment others purely out of our own frustrations; 2) We don’t want to bad mouth others if all at possible.

Oh, boy, now we are talking about human psychology 🙂

PS 2: came across this article “Facebook – the big tobacco in social media”, thought it’s interesting read.

Categories
kids

Stacy Park vs. Beirne Park

Reading Time: 2 minutes

We go to Berine Park a lot, we meant mostly Serentity and myself, sometimes my wife will also go. The main reason is it’s so close to our home, across the street from Olive blvd, and 2 to 3 minutes driving. It’s across the street from the Spoede Elementary School, if everything works out as we expected, that’s where Serenity will go for Kindergarden next year. Beirne Park has some nice feature, as explained by playstlouis blog here. I don’t have any complaints. The only thing is sometimes, it has very few people, probably due to its location (not exactly next to Spoede, tucked in a bit). It could be an advantage too, as sometimes we joked that’s a private park.

But as Serenity gets older, and more social, she really wants to play with other kids, because she is the only one (so far), she can play with kids mostly in parks besides in her pre-school. That’s Stacy Park comes into play. It’s a much bigger park, and has some nice feature too (playstlouis; yelp). And in addition to that, it has the “social feature”, both for Serenity and my wife, as it got more people. Interestingly enough, the Creve Coeur park website says Berine Park is one of the busy park in Creve Coeur, that is probably compared to other Creve Coeur parks. Stacy park got to another level. A few days ago, I think was July 3 evening, I saw bunch of many kids playing soccer, and play ground.

photo 1

photo 2

photo 3

Categories
Site Info Web

stlplace.com was hacked and restored, plus some thoughts

Reading Time: 2 minutes

I found out this site was hacked yesterday evening, as I saw the loading of site on Safari was slower than usual. It also shows incorrect theme, more like a plain theme. With the admin link redirect to spammer site. I decided to tackle it right away. I recall about one year ago something similar happened to this site, and google webmaster tool told me about it. I was able to remove the offending files/directories, by following the recommendation set out by google and some other wordpress sites.

This time I made an almost fatal mistake, during deleting some of the files in wp-includes, I accidentally deleted all the useful php files there. Panicked, I used both the website restore tool, and the import feature of wordpress (mojo marketplace), to no avail. The symptom of the problem was I could not login, and it shows blank page when I login via the wp-admin or wp-login.php after taking my credential. And I can only see the pages at uudaddy.com (I could not log in there either).

I filed for help at the hosting company. But I still feel helpless as this site has about 9 years of my blogging and uudaddy.com has my last 4 years of blogs. Fortunately I was able to find this wordpress help page about updating wordpress, and fix internal server error by deactivating the plug-ins. The latter comes only after I gained some web dev experience lately, knowing more about error 500 🙂

So long story short, I was able to restore all the blogs (those two plus my wife’s happy mandarin.com) by the following:
1) Restore .htaccess file to avoid the redirect to spammer page;
2) Restoring the wp-includes and wp-admin page: upload zip file, extract; in the wp-content directory, I renamed plugin directory as plugin.SAV (this way it deactivates all the plugins);
3) Run the wordpress update as soon as I can log in.

I also backed up the MySQL databases for stlplace and uudaddy, and backed up those two blogs to wordpress.com (this one and this one). I understand blogging itself is a declining trend, and it’s probably not easy for small web hosting company to defend against hackers like Google/Amazon/Wordpress do. That’s why I am also evaluating whether to move to wordpress.com or Amazon EC2 (self hosting). It’s a bit emotional decision as I have hosted this site for 9 years, but I need to consider both my time, the cost of hosting, etc. I will make a decision on this shortly. Meanwhile check out the new blogging sites I mentioned above, in which I will blog both about software development and raising kids.

Categories
advice and tips Fun

Good news, bad news

Reading Time: < 1 minute

The good news is if one searches “kids St. Louis” in iTunes App Store, my app To Market will show up between six flags and magic house. The bad news is, after spending hours trying to add the feature of “add to calendar”, the app crashes if one tap that button 🙁 🙂

20140620-015032-6632119.jpg

Categories
Software development

Rockstar developer

Reading Time: 2 minutes

I have thought about this topic for a long time. I remember seeing at one place that an exceptional developer can do work usually done by 10 developers. Or in other words, he/she is a rockstar developer.

Besides productivity, I think rockstar developer has the following traits:

1) Willing to share the knowledge with fellow developers, keep in mind we all learn from each other, rockstar can learn from (dare I say) ordinary developer too;

2) Attention to the details and code quality, and other good development practice such as TDD (test driven development), again sharing knowledge is applicable here;

Categories
iPhone app

Developer EQ series : 1

Reading Time: < 1 minute

Dont’s
Beat up people in code review or interview;

Change other developers’ code without proper communication, or reasoning; worse, making the working code no longer work (sometimes to satisfying the “tests” 🙂

Do’s
Learn, learn something everyday;

Acknowledge our own limitations: acknowledge our mistakes if applicable, we all do make mistakes;

In the same token, when we learn something from someone else, show our appreciation;

PS, also came across this piece “assertiveness from developers” by Jeff Atwood (@codinghorror), which I think is excellent. Essentially the point there is be a good developer is not to be a “nice person to everyone”. A good developer uses his/her best judgement, and speaks from his/her own mind, which includes saying something make other stakeholder uncomfortable (as long as it’s fair and honest statement).

And, slightly off topic, this one “Your Company Is Not A Family” from HBR (Harvard Business Review).

Categories
Fun video

Let it go

Reading Time: < 1 minute

and Chinese version.

Categories
Fun

We went to Edwardsville Route 66 Festival

Reading Time: < 1 minute

It was pretty cool. A bit small scale than I thought, but nonetheless liked the family friendly activities, food, and people. Their website is here, and their Facebook page is here. Can’t wait come back next year 🙂

The tour guide (the trolley bus) is really knowledgable about the history of Edwardsville.

10456014_878111818868807_3023293231169718722_n

10481465_878111838868805_1328296623366172662_n

Categories
iPhone app

Working on new app DiscoverSTL

Reading Time: < 1 minute

Alton_Missisispi_River_512x512