Category Archives: Uncategorized

My Dream Development Enviornment

Many IDEs are very mature on desktop such as Xcode, visual studio and eclipse(I am skeptical about eclipse). In the mobile world , it is still in initial stage. Some argue there is no point of coding on small screen mobile devices ?

There are lot of constraints but not limited to IDE
* Screen size is small
* No physical keyboard
* Slow processor
* Short Battery life
* Small storage

I agree there are limitations, but should these be the reasons of not having coding on mobile device ?

Sreen size is a problem but not fatal. Virtual keyword is even more difficult to solve. Some tried to reinvent virtual keyword without different layouts and typing prediction.
No matter how it is improved we can only use two fingers on virtual keyboard instead of ten fingers on full size physical keyboard.

Another issue is that there are too many lines of codes, if you try to view java source on iPad , it may not be enough for a function. But it could be an entire program in case of lisp.

Advertisements

App store is tough

Bibles” has been released about four weeks, it remains a single digit download count. People say App Store is crowed, and dominated by few major players, it is too hard.

I used to blame those big corps, Apple and even consumer, but I realize it is ridiculous. It is a natural result, resource will be allocated for successful players, because they are more likely to succeed again.

The only way to compete in such a hard enviornment is an unique and focused idea with great implementation. So stop blaming App Store, save energy and build something great enough to let people know.

P.S.

I am ok with the download count, because mass downloads is not my intention.

Rotational transform and edge constraint

When I was working on bible app, auto layout was working fine in portrait mode. However, there was an exception when I switched to landscape mode.

“Autolayout doesn’t support crossing rotational bounds transforms with edge layout constraints, such as right, left, top, bottom”

I had no idea what did it mean. When I dumped the view hiehrary I found that there was a view called “UILayoutContainerView” which was applied a transformation.

The problem was that I tried to add view with edge constraints to self.view’s parent view, which is “UILayoutContainerView”.

In conclusion, we should only put everything on self.view when using autolayout.

Tagged ,

First launch and background import

When I designed bible app, I wanted to provide the beat offline reading experience. Offline app usually needs to face a first launch problem. It needs to download a bunch of data or initialize from local resources.

There are many ways to store scriptures data. I chose core data due to low memory footprint and simplicity of code.

I wanted to implement batch import in background while allows user interface to work responsively . My first idea was separating the scriptures database and user data (note, highlight and history). While scriptures data is on private queue and user data is on main queue.

Everything worked well but I found there was a random bug when fetching from private queue. The execution time just could not be predicted which caused other bugs (the execution order was assumed, so it required much more effort to make it the codes independent).

Finally I decided to give up the non blocking user interface and require user to wait until the whole verses library to be loaded. To avoid unnecessary loading time, only load the specific version when user switches to.

The books that changed my life

 

Bible
My daily bread

Ordering your private world (Gordon MacDonald)
It taught me about time management (self management), what should I pursue, and what was just an illusion of success. Connecting my inner world with god is the most critical part of life.

How to win friends and influence people (Dale Carnegie)
This book asked me to move the focus from myself to other. “Love your neighbor as yourself” is a golden rule.

Thinking fast and slow (Daniel Kahneman)
I used to trust my logical reasoning and intuition, this book changed my view of thinking. I was very impressed by “What you see is all there is”, which told me how naive I was to perceive the world in my own view.

Line height bug of NSAttributed string in UITextView

As mentioned by cocoanetics
http://www.cocoanetics.com/2012/12/radar-uitextview-ignores-minimummaximum-line-height-in-attributed-string/ (I can reproduce it on iPhone 5 with iOS 6.1.2)

Because there is a bug in UITextView, I had no way to adjust the line spacing of text. It should be ok for english, however chinese is not good enough. 

Image

So I had the following trick, 

When user switches to chinese, I set “Euphemia UCAS” as default font, but displays chinese text as normal in UITextView. I found that “line-spacing” will be inherited from “Euphemia UCAS”.

Image

 

Mobile app should be Native or Web or Hybird ?

Recently, I am working on a “Bible app”, want to share some thoughts.

My goal is to build a Bible app which is fast and easy to navigate, also with note taking function in three months. (Please don’t ask me why build another Bible app… I am really not the type of business man who is good at marketing research)

Native or Web or Hybird ?
This should be the last question , too early to talk about it 😛

Offline capable ? (Yes)
We should be able to read Bible anytime anywhere, offline reading should be a reasonable user’s expectation.

Social or Personal ? (Personal)
Almost everything go social, but it increase the complexity and I will lose the laser focus. (Social network for christian should be a big thing )

Flat or skeuomorphism design ? Flat (almost flat or not skeuomorphism)
Many peoples love it and it is trending, it can also present text in clear way.

Core data or SQLite ? (Core data)
There are note, highlight and history. Core data is really good for CRUD, it can save many lines of code.

Textview or Webview? (Textview)
Most blog readers use webview, HTML handles text render in elegant way, but there are some problems
– It is difficult to do highlight in HTML, many dom object operations.
– Javascript bridge with native code is difficult and messy.
– Slow in old device (Not a big concern…)

The problem of “Native or web or hybird” always bothers me. In user point of view, I love native because it is fast and polished with animation. In developer point of view, web can save time and allow us to focus on important things. It seems hybird is the way to go, don’t need to reinvent HTML and take the advantage of native UI experience.

Finally, I chose native, because it is easy to do highlight in textview. Also with the support of attributed string in iOS 6, it make text formating easier. (There is a bug in rendering attributed string with paragraph attribute I will explain in another article later).

Programmer’s fatal mistake

It was a big mistake that I tried my best to learn and build products without writing any meaningful articles and contributing to open source project.

I got many excuses
– Feel shame of my writing/code
– English is not my native language
– Too busy (I have a full time job)
– No audience

After applied an iOS prototyper job from 37 signals, I got a reply “Not sure right fit” from Jason. It was a reminder that I have to face this problem.

No matter how good or bad I achieved on project, I had no way to tell peoples. It was a fatal mistake and it was too risky for employer too. I decided to start blogging about the development process of my works. And I hope I can contribute some useful codes and tips while I am working on it.