Offline-First: No More Network Connection Error

The Internet seems to be always available nowadays. Thanks to the mobility of phones and tablets, mobile app developers can design their apps with a variety of features that assume the Internet connection is stable and let users experience tithe unleash the power of the convenient and efficient network services. Social media apps such as Facebook, WhatsApp and Instagram are good examples. However, how would theses apps function when there is no stable internet connection?

“No Network” bugs are hard to dig out.

When an app puts cloud services as its major selling point, it would be often running into various Network Connection Errors. You will see a lot of these issues from the bug report from testers.

The problem only scales up with the project size. And – it makes developers headache – it is hard to gid out all “No Network” related bugs. Often, apps are developed at a company that serves ultra-high performance network.

Developers cannot react quick to fix problem will have to receive “1-star rating App Reviews” on App Store or Play Store hopelessly.

Do not assume the Internet is always reachable.

Start building an app with the Online-First pattern does speed up the progress in early stage development, yet it might become a crisis in a later stage. If your apps rely heavily on the Internet connection, you should be more proactively take network instability problems into account earlier. Hence, the concept “offline-first” was introduced.

Continue reading

Ethereum 101: Blockchain as Distributed Computation Platform

Editor’s Note: Chung is an Oursky Intern. After participating in our Smart Contract consulting project, he wrote this introductory article to catalog his learnings about the Ethereum network.

You must have heard of Bitcoin, the distributed currency system.

Bitcoin utilizes a technique called blockchain which stores all the transaction records. Blockchain also ensures that no malicious modifications could be applied to the records.

As a distributed system, Bitcoin utilizes machines on the whole network to compute and verify the changes on the records.

What if we go went beyond storing transaction records into program states? This makes the whole network a computer for general purpose computations with program states that no one can modify illegally. Ethereum does this.

Let me explain below.

What is missing from Bitcoin?

Bitcoin blockchain architecture has several problems for general purpose computations. They include network state dependency, Turing-completeness and block time. 

Program States

Bitcoin only stores the transactions of coins in the blockchain. Therefore, the state of the network (implicitly constructed by transaction records) is just the amount of coins for each account. For general purpose computations, we need general purpose program states.

 

Continue reading

Dissecting Famous Egg Dropping Puzzle

egg dropping puzzle

The egg dropping puzzle was one of the key interview questions in Google

Egg Dropping Puzzle (2-egg, 100-floor version)

“Figure out the highest floor of a 100-floor building an egg can be dropped without breaking,  given two eggs”

The Egg Dropping Puzzle is a mathematical puzzle that has been around the internet for some time now, which is known to be adopted in interviews of major companies like Google, Microsoft, Accenture and even Hewlett Packard.

You are to determine the minimum number of attempts required in the worst case scenario to find the critical floor.

 

Continue reading

Journey Through Agile Test Automation

For QA in an agile development team, SPEED is everything. It is a game on a high-speed roundabout, developers introduce new features and fixes every day, and you better test everything before the next iteration. Besides the new features or fixes, you still need to handle a full UI regression smoke test, how is that possible? Hire more staff? Test automation is a way out for smart teams, and that’s what we do at Oursky.

Preparation

The basic aim of Test Automation is to replace repetitive human work with computers.

So, to get started, all you need to do is no more than wrapping up your existing test plans, and to decide which parts are to be automated. If you already have a comprehensive test plan, with step-by-step test cases and well-defined expected results, congratulations! You are perfectly ready for automation.

Or else, some preparation are needed.

Continue reading

Type Hints – Better type at Python

Python is known as a dynamic, strong-typed language. Most developers love it but some feel mad without type checking or type-hinted auto-completion. In Python3.5, Type Hints is introduced to further delight developers who want those features.

Type Hints offers type checking on function parameters, return values and class attributes, as if it’s static-typed. If you pass something does not match the expected type, a warning will be given.

According to The Theory of Type Hints, here’s an example showing how the rules work out in practice:

Say there is an Employee class, and a subclass Manager:

Let’s say variable e is declared with type Employee:

Now it’s OK to assign a Manager instance to e:

It’s not OK to assign an Employee instance to a variable declared with type Manager:

Now, suppose we have a variable whose type is Any :

It’s OK to assign a to Employee e:

Of course it’s also OK to assign Employee e to a:

Continue reading

Top 10 Mobile App UX Design Mistakes

We’ve been dealing with many many different apps. App quality and usability are always our core values we never settle for less.

There are some common UX mistakes that engineers often overlooked. Getting these discovered and handled, one can build greater apps.


Get ready, here are our top 10:

10. Long text is too long in a text field

You’ve probably met this before. Long text can be really loooooooooooooooooooooooooong.

It’s not the text’s fault.

It’s the text field couldn’t handle that.

Long text handling

Yet, there are ways to deal with that:

  • Truncate the text.
  • Overflow the text field, make it scroll.
  • Expand the text field.
  • Limit the text length!

Continue reading

You’ve been working hard preparing for your launch to AppStore. The final step is getting it submitted to iTunesConnect.

GIFCAM-iTunesConnet

You have to fill in the app details, upload the app icon, localized descriptions and preview imagesupload them one-by-one going through your list of localizations for each supported device in English; one-by-one for each device in French; one-by-one for each device in German, etc, etc.
.
.
.
OK, 13 languages.

You have to upload screenshots one-by-one for each device, for each locale. Oh that’s O(n²)

Let’s say you have built an awesome app for iPhone & iPad and now it’s ready for launch.

Question, how many preview images exactly do you have to add?

The answer is simple. For each locale, there are 3.5-inch, 4-inch, 4.7-inch, 5.5-inch and iPad screenshots (and don’t forget the upcoming iPad Pro). There are 5 images in each set, that gives you 5 x 5 = 25 pcs for each locale.

Needless to say, you will have to organize 25 x 13 = 325 preview images to iTunesConnect. Sounds scary right?

Continue reading

Spentable (Expense Tracker): How we built our first app for watchOS 2

In WWDC2015, Apple announced iOS 9 for iPhone and watchOS 2 for iWatch. It has been a huge revamp for watchOS. Not until now, a watch app finally runs natively on the watch.

That means the code is now executing on your watch instead of the phone. By reducing multiple times of data transfer between devices, this is going to make the app loads a lot quicker and responds in a shorter period of waiting time.

watchOS 1
WatchKit Extension runs on the phone and the Watch App is more like a display console for your app.

watchOS 1

watchOS 1

watchOS 2
WatchKit Extension now runs on the watch, you don’t have to run a watch app with the phone connected actively.

watchOS 2

watchOS 2


 Spentable: our first app on the watch

Spentable Watch FaceOursky has recently built Spentable 2.0 , it’s also available on the Apple Watch.

Spentable is a handy, in-your-pocket app that helps you to track your expenses and make purchasing decisions. Now you can even track you daily expense via the watch App without taking out your phone.

In this post, we will talk about the experience on building an app for watchOS 2.

Since the watch app is now running on the watch as a native extension, there are situation we need to handle data sync between the phone and the watch. For example, we wish expense input via the watch will be reflected on the phone instantly.


wireless

Get connected to the phone: Watch Connectivity Framework

In watchOS 1, the watch app must be connected to the iPhone app (we call it the main app) to work. We often call [openParentApplication:reply:] to send a message to the iPhone app. However, now the connections in watchOS2 are handled by the Watch Connectivity Framework.

The Watch Connectivity Framework provides a seamless background connection between iPhone and iWatch. It helps doing all the synchronization work between the main app and the watch app. When the watch app handles a user input say, a new expense item, it has to notify the main app and get the record updated. The could be easily done via the Watch Connectivity Framework.

This allows Device-to-device communication more freely (such as transferring files, user infos and application context around ). There are serval APIs to transfer particular data for different use cases.

So how do we choose between them?

Continue reading

Better StackTrace for iOS crash report from Sentry on Slack

Get crash reports from Sentry

We have been using Sentry for collecting crash reports and stack traces for our front-end js, Python, and Rails applications. It is reliable with affordable pricing. Simple to setup with it’s open-source SDK.

However, there’s a fundamental problem when it comes to iOS.

What? No symbolized data returned?

Sentry only returns the crash report with a piece of memory address but not a meaningful method name.

As an iOS developers, you should have noticed that it requires a dSYM file to symbolize the stack trace. It helps to identify these addresses with the appropriate dSYM file.

We thought we can upload dsym files and get symbolized information returned when Sentry claims it works on iOS.

Unfortunately, it is not the case:

refs. https://github.com/getsentry/raven-objc/issues/11#issuecomment-84141003

No one can understand the iOS Stack trace with memory address only. Proper support of dSym is needed.

(BTW if you can debug with memory address, please consider joining us.)

Solution

One of the possible solutions is to fork a piece of Sentry code and get our hands on it, but we don’t want to get into the complexity.

Instead, we write a micro service that will reply to a Sentry notification with de-symbolized stack trace on Slack, here is what we did.

Continue reading

Dockerizing our Python stack

… and it didn’t benefit that much.

Everyone in the DevOps community should have already heard about Docker.

There are always sysAdmin coming around and telling you how Docker has made his life easier, how well the automation goes or how lightweight the containers are…

So, what is Docker trying to solve?

Basically, Docker wraps up your application and all the dependencies required into a complete filesystem, that becomes a Docker Image. The next step is all about shipping this container to your production infrastructure, let it be AWS, Heroku or other servcies.

Back in the Pre-Docker age, every SysAdmin implements his own solution to package and deploy applications.

A small scale online shop might use git to deploy code and virtualenv to contain applications in an isolated environment. There were also existing solution providers – Heroku, Elastic Beanstalk, Google AppEngine and others services, having their own proprietary way for packaging and deploying applications.

Now, all the configurations and environment settings are standardized in the Docker Container, which actually saves loads of time for developers dealing with the repetitive setup and maintenance.

docker-2

(ref. https://www.docker.com/whatisdocker)

Continue reading

« Older posts

© 2016 Oursky Code Blog

Theme by Anders NorenUp ↑