Categories
iPhone app

Firebase – second take

Reading Time: < 1 minute

Two years ago, I was trying to migrate an app back-end from now defunct Parse.com to Firebase, I was not successful. I was able to make it work last night, after reading more about the data structure in Firebase realtime database. I was able to do it by following the examples in this tutorial page.

I submitted the iOS app myNestEgg retirement calculator, and the update was approved this afternoon.

Categories
iPhone app Software development Technology

Docker – second take

Reading Time: 3 minutes

(Update 08-26-2020) Technically 3rd take. I was following along with the Google Cloud Storage ClamAV tutorial, and had an issue of not being able to connect to port 3310 on GCP. (Update 08-29-2020) It was solved. Some tips:

====

1) There were some typos: such as the directory related to the git project, as well as environment variable for the bucket (in couple places);

2) Need to run the below command before deploy: Assign bucket permissions before “gcloud app deploy” (as in section Create the malware-scanner service: step 5)

3) https://github.com/GoogleCloudPlatform/docker-clamav-malware-scanner/issues/1 (move the local variable out of the large bracket {})

4) https://github.com/GoogleCloudPlatform/docker-clamav-malware-scanner/pull/4 (the solution is to increase the memory footprint in the app.yaml file)

====

Last but not least, one does not have to delete the project, the quick way to save the money is just to turn off the app via app engine => settings => disable application.

I also looked around and found another ClamAV tutorial using Java. The second one worked for me locally. I was also able to put an image to the docker hub (using the code from the spring boot docker tutorial). I was able to push the docker image to pcf too. The one thing remaining is I had a 502 gateway issue when I test the end point (local was working fine; postman tip here). Actually later I was be able to make the GCP example (the node js example) work locally too. Now the next step is to make them work in a PCF or a GCP cloud environment (not just local).

(Update 02-04-2019) What Is Container Orchestration? (by Isaac Eldridge at New Relic).

I also followed along the Exploring Docker [1] – Getting Started by Traversy Media. I did make the node.js and MongoDB work on my local MacBook, but I could not make them working on my DigitalOcean droplet due to mismatch of Docker versions of “Docker Compose”, the root cause was the Ubuntu on my Droplet was a a bit old (14.0.4). I need to upgrade it to make the versions compatible.

Some more links for the Traversy Media docker-node-mongo example. Youtube video here. Github repo here.

Two more (TBD, or for references): Dockerize a Node.js app connected to MongoDb

Containerizing a Node.js Application for Development With Docker Compose

(Update 02-13-2018) So I found out today I have AWS bill of

$2.62 (mostly due to EC2 instances) today. This is due to the fact that I did fire up the VM as well as the docker swarm instances (total 9? maybe due to I ran the deploy script multiple times?) Anyway I fired up the instance last night, this evening I looked at the “instances” and looked at the bill, I know what happened. I still did not make the connection from outside to ec2 working though. For the time being, I “terminated” the docker swarm, and stopped AWS VM.

(Update 02-12-2018) I am also following the tutorial at Docker’s official website. I am at step 6 here. And right now, I am stuck in connecting to the AWS vm (was following this Docker guide): step 6 “docker node ls”. I did follow the steps to create docker credentials for AWS.

error during connect: Get https://192.168.99.102:32768/v1.35/nodes: http: server gave HTTP response to HTTPS client

Note this IP address looks like the local default machine: one thing I am not quite sure is how the local connects AWS

(Original 01-31-2018) I installed docker on my mac a while ago and did a simple tutorial. But I never had much chance to play with it until recently. After the training, esp. after I saw use docker container to host Tomcat, and then use Jenkins to startup Tomcat (build and deployment), this whole thing got me interested in docker again. Note I have been learning about docker contain and they seem to be the future deployment model for scalable mobile apps backend: e.g., I know the Robinhood app (the free stock trading app) is container based in the back.

Some resources I used to get started:
1) Youtube docker tutorials (11-18-2018: such as this one Demystify Docker; also noticed this one Docker for GCP. I will see if I can do the training exercise again I mentioned above).
2) Install docker or docker.io on Ubuntu (I have a digitalocean droplet / VM, and its OS is Utuntu);
3) Overcome the error message:
FATA[0000] Get http:///var/run/docker.sock/v1.17/version: dial unix /var/run/docker.sock

The answer is this:

The problem is that your user has not been added to the docker group.

Try:

sudo usermod -a -G docker
If you don’t want to log in/out from your current shell, run:

newgrp docker

Last but not least, install Jenkins on Ubuntu 14.04.

Other error messages (note I am on a Mac)
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? (when I tried to run some docker command)

It seems the solution is
eval “$(docker-machine env default)”

References:

How To Remove Docker Images, Containers, and Volumes

Docker Usage

Part 1 — Virus Detection Service using ClamAV and Java

Part2 — Dockerized File Virus Detection Service using ClamAV and Spring Boot

Categories
Business China iPhone app

Alipay wechat Pay

Reading Time: 2 minutes

IMG_8760

I was travelling in China for 9, 10 days recently, and I can see those two payments method everywhere. From the small food stall to KFC, one of those two methods are widely accepted, and in many cases cash transactions are very rare. I noticed this trend about 1.5 years ago during my China trip too, at that time I saw some promotions around those new payment methods. This time I saw many promotions too, such as discount to points (reward) system.

Just use my own shopping experience as an example. I purposefully did not get a local mobile phone number this time, which in other words, this disqualified me from using those new payment methods. I did not want the hassle of getting a new mobile phone number, with or without data plan, and then have to give up the number later. Because my trip is really a 9 day trip. I noticed in most “free” or public wifi hotspots, the setup is such that they send a validation code to the mobile phone. For me I can live without because my phone has international data roaming, in other words, I still get to wechat on the go. But I cannot get to those free public wifi hotspots, at a bookstore when I tried to sign up to be their member via wechat, I realized my lack of local phone number is preventing me from doing that, or getting the discount. Same thing in KFC. I did noticed some China Unionpay (flash pay, or its own contactless payment methods, like masterpass or visa checkout, if you will) promotion along with Apple Pay and Samsung Pay, but it’s very obvious they are not in the same magnitude as Alipay or wechat pay. There is news saying that China central bank is regulating Alipay and wechat pay, such as limit the amount of transaction. It will be interesting to observe though, we know Unionpay is very much state owned, while the other 2 are in theory private owned. But all in all, this is a very difficult market for Mastercard and Visa to crack.

Fully disclosure: as of this writing, yours truly works for Mastercard. And this article is just my personal opinion, not my employer’s.

PS, in order to get a local mobile phone number, one usually needs a local identification card. I am not sure how foreigners can get one, via their passport. I assume there is a legal/legit way to get that.

Last but not least, my friend in Ningbo, used Alipay app to rent a car (I assume it’s similar to Uber), to pick me up at Ningbo railway station. He said he even sold his car recently, due to the convenience of car-rent app, public transportation, and the desire to walk/cycle (again bike sharing here, needs a phone and app) more instead of trying to finding a parking spot for his car (and the cost of maintain a car). When we got off the car, the payment is automatic just like Uber.

Categories
401k and Personal Finance

Personal finance quiz

Reading Time: < 1 minute

Saw some good personal finance quiz recently.

70 percent of Americans can’t answer these 3 basic money questions

Pop Quiz: Test Your Knowledge of Personal Finance

Rutgers personal health and finance quiz

Categories
401k and Personal Finance

Change of job: what to do with the savings in the 401k plan

Reading Time: 2 minutes

(Update 17-Apr-2019) I recently changed job again and also did some adjustments on old 401k, after leaving much of them alone since 2009. I did moved some money from small 401k to an IRA account (those employers asked me to move the money out). I made some mistakes during the IRA investing, and was reluctant to move the money if an employer would let me leave the money there. But recently I found out this “overly passive approach” is not helping me for long run.

(Original 01-Jul-2017) I talked a bit on this topic in the past (see a post here). The one thing I may add is: I didn’t do very well in most the IRA (self management, mostly buy / sell stocks in the small scottrade IRA account). The value mostly bounced back since I bought the Huntsman (NYSE:HUN) in last couple years, but I lost quite a bit trading the coal stocks (and Palm stock) back in those days. So I decided to put money into Vanguard funds (and IRA account) in 2014 when the old 401 plan asked me to move my money (I worked on a contractor job in part of 2013, for 7 months).

Today I received a letter from my old employer Arch Coal, the director of benefits about change of the asset manager for the 401k plan. Note Arch Coal went through a bankruptcy in last few years, also note bankruptcy alone has no effect on employee’s 401k plan (the money is separate). But I did compare arch coal’s 401k plan performance vs the Mercy plan (managed by Fidelity, the No. 1 or 2 asset manager), and Arch’s performance is not as good. So this is something I will think about: 1) roll it over to my current employer; 2) roll it over to Vanguard; 3) leave it as is (the new manager is transamerica).

I have not decided it yet. Still thinking…

Categories
iPhone app

Stay away from work over weekend

Reading Time: 2 minutes

My older daughter just finish 1st grade. One thing I learned is first graders do have some homework, at the same time they usually don’t have homework over the weekend (Friday, Saturday and Sunday). In other words, homework usually won’t be assigned out on Friday and due to Monday. This is something I like to talk about it today. Over the years I worked professionally, mostly for employers, I did encounter tight deadlines or last minute assignment which means I have to work or “hinted to work” over weekend and holidays. I recall in some scenarios we need to come into office and work. There is the line I want to draw: don’t commit to it if all at possible. In fact this is mostly a sign of bad management or planning when at Friday afternoon, the boss (project manager, someone who manages our work) came in, and say something needs to be done that urgently, and we need to work non-stop over Friday evening or Saturday, or even Sunday. This is both non-sense and counter productive.

We as knowledge workers usually don’t completely stop working even after normal work hours, sometimes we will (I know I do) think about the technical issues on the way from work to home, and sometimes we recall something like “ah, I may have done something wrong there, I will go back and fix it”. In fact I did something like that in my early career. Some other times, we monitor a long run job at home, or we test out new ideas coding on a company laptop. But we need break as human beings. Force us to work over weekend basically took away that, not to mention people who have families.

The downside of mandatory “overtime” in weekend (esp. coming to office) is that the workers never get rest in a normal weekend, thus hurting the productivity in the following week. In the example I gave earlier (the supervisor asked us to show up for work), looking back I think even him did not believe by coming in work on Saturday we will complete the project on time. This is mostly a show from management side, to let the upper management know that we are working hard. One of the dumbest thing I saw in my 17 years professional life.

On the positive side, I do have a few successful stories where I worked or thinking hard on a problem, and was able to solve a critical problems, all on a voluntary bases (nobody told me to come to office, I understand the urgency of the issue).

Categories
iPhone app

Apple TV 4th gen – initial impression

Reading Time: < 1 minute

I finally decided to upgrade to the 4th gen Apple TV, which I had it as a developer kit about 2 years ago. I had not used it as the gen 2 Apple TV worked out fine mostly of the time, until recently it appears “play on Apple TV” feature did not work well on my old iPad mini (it could be caused by the old router too, oh well, I will replace it one at a time). I recall last time (a year ago) when I tried to use it, the TV comes as dev kit was locked, so I went ahead and did the “restore” in iTunes first. After that the setup was fairly smooth, it seems the main improvement over gen 2 was the voice recognition (Siri) and touch control (the touch control is not as precise as the four way control in the old remote in one case though).

Installed PBS kids app, and the screen saver looks new! Over the weekend I bought some TV from iTunes store (peppa pig, for younger daughter). It showed up fairly quickly on Apple TV.

Now the next step is for me to find the box for the old gen 2 and post it on eBay.

Categories
iPhone app

Some thoughts on United Airlines and the industry in general

Reading Time: 2 minutes

Over the years I have rode quite a few United Air on my trips from US to China. Amid the most recent incident on the UA (warning: the video may not be suitable for little kids), I am thinking of a few UA trips I took, such as this one on March 2007, which worked out ok. Another trip (Summer 2002), which is also my first UA flight, was also eventful. The UA857 (from SFO to PVG) was spotted some fire (presumably under the wing, per some passenger) during the take-off. The plane had to drop most of the fuel above the sea, and turn back to SFO. And we had to reboard another plan to PVG. Here are some of the pictures of the plane releasing the fuel. I recall one flight attendant specially mentioned how much weight was the fuel, and the unit price of fuel, I calculated it was about $350,000 worth of the fuel.

UA867_July2002_4

UA867_July2002_1

plane2

Fast forward, the industry had another meltdown during the financial crisis, and has since come back. The regional carriers, such as the one had the incident on Sunday night, was never the money maker. In fact, I recall in year 2009 (Colgan 3407) there was an fatal accident on a flight from NYC to Buffalo NY. And I learned from that accident that those regional carrier’s pilots are not really well paid or trained. This combined with my observations of over the years, when the airlines tries to charge the baggage fees, and on those regional flights, people would just check in the baggages at the gate (to save the money). Then at the destination, esp. when during winter time, you will see a long line of people picking up the luggages. It just feels America is a 3rd world country at that time.

Last but not the least, my friend Wang Jianshuo wrote on similar topic almost 10 years ago.

Categories
iPhone app

Replacing iAd with admob etc.

Reading Time: < 1 minute

(update 02-18-2019) Came across this blog post by Jonathan Li, which has more comprehensive steps.

(Original 03-11-2017) Recently I picked up my old iOS app as the framework it replied on Parse was going sunset (the date was Jan 28, 2017). I picked up Google firebase after reading a few posts including the one at Raywenderlich.com. In the process I also upgraded CocoaPods, and replacing the ads from iAd to admob. About 3 months passed by since the initial launch of admob, it seems the performance of admob is much better than the iAd. Note I only used the banner ads for now: this is similar to the iAd banner ads it replaces with. Per Matthijs Hollemans (the famous iOS dev, also raywenderlich.com tutorial writer), interstitial ads is more powerful when possible, but I have not successfully made it work yet.

Going forward, I am thinking learn about the Swift language, as David Smith and Marco Arment mentioned in recent Under the Radar podcast (State of Swift), this is increasingly urgent now, for iOS native app dev.

Back to ads, for me I have seen the steady declining of my blog website viewership, and the income from google ads. This admob thing gave me some hope. This also confirms the trend of people increasingly switching from desktop to mobile, esp. smart phone.

Categories
iPhone app

Many roads to Rome

Reading Time: < 1 minute

I mentioned sometime ago that LaunchCode is a great way to get into programming / software development world for a grown-up whose background is not computer science or information science.

But that’s not the only way. More recently I noticed some friends made the transition from research position at Washington University to industry. Again there is more than one way. One friend took a lot of statistical courses from coursera, combined with the background in statistics, R and computer at Wash. U., that particular friend is a senior data scientist on healthcare. A couple more friends made transition earlier, from research technician to statistical analysts after getting a MS degree (all at Wash U.), then transition to industry.

So there is really no single approach to Rome. 🙂

There is one thing in common though: one has to learn, either via nontraditional degree programs, such as online sources coursera, or launch code, or a degree program. So in other words there is no free lunch, or no pain no gain 🙂