Categories
401k and Personal Finance Career Life

Working from home amid pandemic and financial crisis

Reading Time: 2 minutes

I have my first experience of working from home amid financial crisis in Nov 2008. I started a new job with Autodesk consulting division at the time, after working for my previous employer for 8+ years. My intention is to get more customer engagement experience, and also if I stayed, I would probably stay for a year or more to go through the financial crisis. So I decided to jump ship.

It was not smooth experience. I probably would not do it if I have to do it again. Couple reasons: 1) I was not familiar with the software I was supporting or consulting with, it’s a new language and new application for me; 2) I was new to working from home. Before that I did some working from home due to doctor appointment, or as integrator doing after hours work, or doing development work on thanksgiving when I am bored (I was single then). I also worked from remote office (Shanghai) for 6 months: I social with my Chinese colleagues there though. Some of the bad memory I had: I wear panamas all day, the work never stops really, from morning say 9 am until 10 pm, because the laptop was always on. There is no colleague to ask for ideas or chitchat, or have an intelligent discussion.

Financial crisis is another source of uncertainty, as the economy is basically in decline or flat for a while. Job security, project renewal etc. I think of things I can control, and things I cannot (this is something I learned from Arch Coal, esp. from David the CIO later on). I have a bit more control on my work, but absolutely no control on the market or economy. I have some control on the project, or best practice or process. At that time my sweet point is actually work from Panera bread, Borders (the book store, not gone), Barnes Noble and Starbucks (not my favorite because it’s a bit crowded). I recall seeing Frank Cusumano couple times at the Borders (maybe Bread Co too).

So slowly I gained some confidence this way, by playing my strength: developer mentality, analytical, source code version control (even for the automation design we were doing). I still switched to a regular office developer job in Feb 2010. But I think I learned some valuable WFH or remote lessons in my 15 months at Autodesk $ADSK

Also read work from home friendly companies.

(Update 05-27-2023) Came across this article – Elon Musk says the ‘laptop class’ needs to ‘get off their moral high horse’ when it comes to remote work” (also the original interview on CNBC with David Faber on video). My quick comment: Elon made his point. My counter point is knowledge workers (teachers and principals included) don’t stopping working when they are off-work: the brain doesn’t working or thinking in off hours. Sometimes I think about work related problem in sleep (dream) too. || Btw, Elon obviously needs more sleep (and chill) looking from the picture in the article. A side point from Elon is more valid though: that is the envy, or jealousy or “comparison with others is the thief of the joy” are very common in our daily thinkings. Or “grass is greener at neighbors yard”. This is more a physiological phenomena though.

Categories
advice and tips

Corona

Reading Time: < 1 minute

It seems things get shitty today. I know it’s coming on last Friday, as WFH and everything seems imminent. One thing though I dislike, is the organization I work for sent out WFH email on Sunday night. I did need to come in anyway as I know I need to onboard a new colleague. Recall last Thursday, I went to West County costco, and I saw a gentleman who pushed a cart with something, and answered to an aquantinee: I came because my wife said so. Today is different, at the Maplewood Sam’s Club around noon, I saw the food court is closed (was going to get the deluxe pizza and soda), some people (mostly African American) wear face masks including the lady in the entrance. The store was busy as it took a while and some intervention to get some help on the online order pickup. My wife wanted a freezer, but Sam’s Club is out of stock (it let me order online initially). Went to home depot, Best Buy and also checked Amazon it seems the decent size ones (5 cu ft or larger) are out. Then listened to the WH guy doing the briefing in the pm, and does not sound encouraging as the stock market had another big drop. Think eventually it will get under control, but right now the US is just trying to avoid be another Italy. Hope Spain and France can get it under control soon. And situation in Italy and Iran don’t get worse. China seems working very hard to control the incoming cases. Another crazy work begun.

Categories
401k and Personal Finance

Market, corona virus, panic

Reading Time: 2 minutes

The US stock market started to feel the heat of corona virus in recent weeks. This week is the worst in term of the percentage loss (8%) and the fear of the market.

Along the same lines, so much fear among the ordinary people due to the news such as Tom Hanks got infected, NBA / NCAA games cancelled, Italy was getting into situation like Wuhan (healthcare system was overwhelmed), and the quarantine / shutdown of the whole country. I can feel the fear of the market as my friends talked much more about the market on wechat.

Last time things were like this, in terms of both the percentage drop (and the speed of the drop), CNBC running extra evening shows, and friends got excited and discussing stocks nonstop (at mitbbs, trader1688, gutone etc websites, no wechat app yet). Then comes the craziness of the stocking things from grocery store or drug stores, from hand sanitizer to toilet paper, from food to drinks. I do understand the situation in Italy and other countries. I also understand the “under-test” of US sick population. It’s improving as time goes, just as the WH made announcement this afternoon. As to the “buying craziness”, I still think it’s unnecessary. When this thing first started in Wuhan, China, friends here asked about buying face masks. I did not listen. I may still a few left in my year 2017 trip. But I am not overly worried. I am cautious though: try to stay away from the crowds, including office. I think we will likely to overcome this.

While for me compared to 2008/9 financial crisis, I am both older and have 2 young kids, I am not overly scared. I do have some savings and lift insurance. I will try my best to keep myself from getting sick. Short term it will be horrible for many people who have less meanings. We should try to help if / when we can.

Last but not least, I maintained a wiki page for the corona virus at github. You may also note I made some changes to this wordpress website recently. Started about a year ago to upgrade the WP to 5.0 (manual) to the upgrade a day ago. I am still trying to figure out things as I made changes, for example, I found out the comments not longer show: I likely did intentionally a while ago to battle the spams, but I could not put it back as the stlplace.com/uudaddy has. Also note uudaddy.com is moved under stlplace.com/uudaddy (site consolidation, I don’t want to pay $18 for the uudaddy.com domain name). I had the domain in 2010 when my first daughter is born, and I think going forward I am ok with the stlplace.com only. A lot has changed since I have the stlplace.com domain, with the virus I think longer term we will use more internet, web, devices and virtual learn / interaction instead of physical. This is a bit unfortunate, but we live in ab “adapt, or die” world.

Categories
Software development Technology

Java thread and interview questions

Reading Time: 2 minutes(Update 2026-04-11) Refer to this coding example at GitHub.

(Update 3 10-28-2020) Link to JoelOnSoftware

(Update 2  10-27-2020)

Java
1) What is the difference between and interface and an abstract class(pre Java 8)?
2) Name a design pattern you have used (or would like to use)?
3) How would you implement the Singleton Design Pattern?
4) Since Java 8, what is the preferred way to avoid an NPE?
5) What goes on the heap and what goes on the stack? What can you tell me about the Garbage Collector in java? Can you have memory leaks in java?

API development
1) Difference between SOAP and REST
2) Difference between REST and RESTful
3) What are the best practices that are to be followed while designing RESTful web services?
4) Some of the methods (verbs) in REST: 1) GET, POST, PUT, DELETE; 2) Is Post idempotent?
5) Describe some of the API management tools you used, for example, Swagger, Apigee etc?

Microservices Cloud environment (Azure, AWS or GCP)
1) What are some features of a Microservices architecture?
2) What is 12 factor application? List some of the factors and explain them.
3) What cloud providers did you use? What are their strength and weakness? Or some pain points?
4) What are some of the frameworks and tools you used for micro-services development?
5) How do you monitor the apps? Do you have any recommendations or best practice for logging and tracing?

Some devops and automation experience as well (i.e. Docker, Kubernetes)
1) Where did you deploy the micro-services you or your team developed? Or what is your deployment environment? Is it IAAS (infrastructure as a service), or PAAS (platform as a service)?
2) How do you deploy apps to the dev, test and production environment? Did you use any CI / CD tools?
3) What are the main steps in a pipeline build / deployment?
4) Have you done any automated testing / validation?
5) For cloud infrastructure build out, do you use the console (UI), command line or some kind of source code (yaml etc) as well as tools such as Terraform?

(Update 09-01-2020) Java 8

(baeldung) Introduction to Java 8 Streams

Lambda Expressions and Functional Interfaces: Tips and Best Practices

New Features in Java 8

GitHub (eugenp) :

Core Java 8

Core Java 8 (part 2)

Also:

Java 8 Features with Examples

Prominent Java 8 Features With Code Examples

(Update 05-19-2020) There are a lot of online code playground or white boarding tools for code testing on the spot.

(Original ) Hibernate map one to many (Vlad Mihalcea)

A collection of the posts I saw recently.

Java World
Introduction to Java threads (need to check the link?)

Java 101: Understanding Java threads, Part 1: Introducing threads and runnables

Others
Java Callable Future Example

Java – Multithreading

Java Thread Tutorial: Creating Threads and Multithreading in Java

Vaadin chat example
It needs multi session (thread) support when we need to use tabs to chat back and forth. The app description is here.

The annotation to support this: @VaadinSessionScope

Java interview questions
Placeholder: I still need to clean up the list below (to incorporate my recent interview experience).

aop
dependency injection
refactor
agile
test driven
code review (what to look)
static vs. final
interface
spring
hibernate

java generics

tree set vs hash set

tree map vs linked hash map
https://dzone.com/articles/hashmap-vs-treemap-vs

.equals() vs ==
https://www.journaldev.com/18302/java-string-equals

Elasticsearch 

Digitalocean installation

Get started

Categories
iPhone app

Dotnet core

Reading Time: < 1 minuteBuild a CRUD App with ASP.NET Core 2.2 and Entity Framework Core

One advantage I see using dotnet core is for .Net shops the transition is relatively smooth in terms of skill set. Second advantage is it’s cross platform (Windows, Mac and Linux): so in away it’s get the same cross platform capability as Java (Spring etc)

also
.NET for Java developers

Migrate your .NET app to Azure

Categories
Software development

Javascript jasmine node.js and Alexa

Reading Time: 2 minutes

(Update 11-23-2023) It’s funny, I found out when I changed the mac input mode from English to Chinese (Pin’yin), and it messed up all the special symbols in the javscript code, double quotes, semi colon, bracket etc. It’s probably due to the difference between Ascii and Unicode.

(Update 10-14-2023) I messed up the folder name AWS lambda – the fix is to correct the folder name. I typed something like “oralce” instead of “oracle” for the folder name. Took me a while to find out. The error message says it could not find the index.mjs file which is usually the entry point for node.js app (including lambda function on AWS).

{
  "errorType": "Runtime.ImportModuleError",
  "errorMessage": "Error: Cannot find module 'index'\nRequire stack:\n- /var/runtime/index.mjs",
  "stack": [
    "Runtime.ImportModuleError: Error: Cannot find module 'index'",
    "Require stack:",
    "- /var/runtime/index.mjs",
    "    at _loadUserApp (file:///var/runtime/index.mjs:997:17)",
    "    at async Object.load (file:///var/runtime/index.mjs:1032:21)",
    "    at async start (file:///var/runtime/index.mjs:1195:23)",
    "    at async file:///var/runtime/index.mjs:1201:1"
  ]
}

I encountered some other error too, and some of which includes traceback to my own code, which gives hints on what went wrong. Another tricky one is whether to include { in the import statement (When should I use curly braces for ES6 import?).

Another error from Oracle DB is it didn’t like the SQL with single quote, and at the same time the sql itself has a condition of =’1’. Put the slash before the single quote to escape the single quote before 1, in cloud 9, and cloud 9 automatically add double quote around the sql, and it seems solve the issue.

{
  "errorType": "Runtime.UserCodeSyntaxError",
  "errorMessage": "SyntaxError: Unexpected number",
  "stack": [
    "Runtime.UserCodeSyntaxError: SyntaxError: Unexpected number",
    "    at _loadUserApp (file:///var/runtime/index.mjs:1058:17)",
    "    at async Object.load (file:///var/runtime/index.mjs:1093:21)",
    "    at async start (file:///var/runtime/index.mjs:1256:23)",
    "    at async file:///var/runtime/index.mjs:1262:1"
  ]
}

(Update 12-22-2022)

The Modern JavaScript Tutorial

w3school

(Original 02-27-2019 below)

Alexa

Alexa Account Linking: 5 Steps to Seamlessly Link Your Alexa Skill to User Systems That Require Authentication (Sebastien Stormacq, done)

User Account Linking in Alexa with ASP.NET Web API (Heather Downing, Okta)

Linking Your Alexa Skill Securely with Okta (Jefferson Haw, Okta)

Account Linking : Amazon Alexa and ForgeRock OpenAM using OAuth2 Authorization grant (karthik, Medium)

How to set up Account Linking for Alexa with Auth0 and Jovo (Kaan Kilic, Jovo)

Build an Alexa Skill in Node.js with Jovo (Jan Konig, Jovo, done) : If a user responds with a name, the MyNameIsIntent is triggered. The code is shown below in index.js

Webhook.listen(port, () => {
console.info(`Local server listening on port ${port}.`);
});

Webhook.post(‘/webhook’, async (req, res) => {
await app.handle(new ExpressJS(req, res));
});

also, how to test the code in AWS Lamda…Click “Test” right next to the “Save” button and select “Alexa Start Session” as the event template…

Interaction-Based Authentication for Alexa Skills with Auth0 (Joao Angelo, Auth0)

Developing Alexa Skills Locally with Node.js: Account Linking Using OAuth (Juan Pablo Claude)

The Alexa Skills Kit SDK for Node.js helps you get a skill up and running quickly, letting you focus on skill logic instead of boilerplate code.

JavaScript
Node.js based testing (npm test)

jasmine official website

commonly used commands:
npm install –save-dev jasmine
npm init
npm test

Sample project can be seen here: (please contact me if the repository is private)

Also from Okta dev blogs:
Learn JavaScript in 2019 (David Neal)

Add Authentication to Your Vanilla JavaScript App in 20 Minutes (work in progress):

With ES6, async/await brings you added control over asynchronous programming by leveraging promises but in a synchronous way. You can use async/await to make your code cleaner while maintaining non-blocking operations. github

Note this post has some examples that uses angular as well.

Categories
iPhone app

Code exercise : linear chamber animation / simulation

Reading Time: < 1 minuteThis is the code that works (my code):

Junit test code is here.

I will add some ReadME as time permits. This is not as straightforward as it sounds. I didn’t get it working initially after spending hours on it 🙁

Categories
Software development

Spring, Spring Boot, React and OAuth

Reading Time: 4 minutesBaeldung : A Comparison Between Spring and Spring Boot

Tutorials from Okta
Working in progress

Identity, Claims, Tokens – An OpenID Connect Primer, Part 1 of 3 (Micah Silverman, below 2 and 3, are also by Micah)

OIDC in Action – An OpenID Connect Primer, Part 2 of 3

What’s in a Token? – An OpenID Connect Primer, Part 3 of 3

Secure Service-to-Service Spring Microservices with HTTPS and OAuth 2.0 (Matt Raible) : some errors due to java certs

Completed

Build a Basic App with Spring Boot and JPA using PostgreSQL (Andrew Hughes): this example uses Springboot, postgres and Okta single page web app, groups / users and authorization server (default). It goes through a basic springboot app using postgres, before adding the auth (token) from okta. It’s a very good example of how we secure an end point as well as authenticating via user group (admin vs normal / everyday user). The OIDC debugger tool created by former Okta engineer Nate Barbettini is very slick too.

Secure a Spring Boot REST API with JSON Web Token Plus references to Angular integration (Nouhoun Y. Diarra) : a small typo: the health check URL should be http://localhost:8080/actuator/healthTutorial:

Develop Apps with Secure WebSockets in Java (Jimena Garbarino): 

Secure Reactive Microservices with Spring Cloud Gateway (Matt Raible) link to my github

A Quick Guide to Spring Boot Login Options (Andrew Hughes)

Easy Single Sign-On with Spring Boot and OAuth 2.0 (Micah Silverman): note the need for JDK 11 (I used Amazon JDK 11), and please remove the double quotes around claim name and re-type (copy paste does not work well from blog post to okta dev console)

Build Spring Microservices and Dockerize Them for Production by Raphael do Vale. As I was finishing up the regular part (the exercise before docker), the service discovery reminded me of Hashicorp Consul tutorial I followed along a while ago. Note this tutorial used Netflix Eureka which is a bit more cool than pure command lines from Consul / Vagrant 🙂 Note this for Docker (quote the tutorial): You must store the file school-ui.properties in the same folder specified on the volume mapping (in the example above, the relative folder ./config-data). This is also my first complete tutorial on Docker container running java web apps (on my local MacBook and Windows 10). In the past I followed tutorial that runs Chef as well as Tomcat / Jenkins on docker (GCP).

Build a Secure Notes Application with Kotlin, TypeScript, and Okta by Matt Raible. Note the last part also talked about how to push code to Pivotal Cloud Foundry and deploy the apps there. This is interesting as I have done the PCF 15 minutes tutorial in the past (and recently).

Bootiful Development with Spring Boot and React (Matt Raible at Okta): I followed this tutorial until the point that I get the basic beer list (in other words, I made both the basics of Spring Boot and React work). This is my very first venture into React, and I had to install “yarn” as well using brew install. In the process I had to upgrade the Xcode via command line.

Also: Use React and Spring Boot to Build a Simple CRUD App (Matt Raible at Okta): I made small mistake when initiating the project with Spring website: I copied / pasted the dependency frameworks, which seems does not have any effect when the pom.xml was created. So I added the dependencies manually.

			org.springframework.boot
			spring-boot-starter-web
		
		
			org.projectlombok
			lombok
			provided
		
		
			com.h2database
			h2
			runtime
		

Also in my Eclipse, I need to install Lombok manually by following instruction here. Note Matt did mentioned the IDE cannot recognize some of the Lombok things if there is no plugin. In the past I used to install Plugin via the menu inside Eclipse. I noticed “Whitelabel error” when I was hitting the end points: http://localhost:8080/api/groups/ (this is working as expected actually, before I add any JUG meeting to the list, as I don’t have access to the default list).

Last but not least: I need to make a small adjustment in GroupEdit.js sample code

'X-XSRF-TOKEN': this.state.csrfToken, (it was just csrfToken and Yarn did not like it)
Categories
iPhone app

h2 database

Reading Time: < 1 minuteH2 Database – Installation

H2 Database – JDBC Connection (the only differs from the docs is we need to add “mem” before the “:~/test”. Otherwise it gives me error.

Mixed mode

Another Java H2 tutorial

Last but not least, how much time should a coding test be? I feel couple hours are probably the way to go (think of Filtered AI, Hacker Rank etc). The other approach is more like open-ended projects: those could take from a few hours to a few days 🙁 In some cases I was suspecting the hiring companies could use this opportunity to get some real work done (if they ask for source code 🙂

Something to keep in mind when doing code test.

Categories
iPhone app

Streaming data, data streaming

Reading Time: < 1 minuteApache flink
SE-Radio Episode 346: Stephan Ewen on Streaming Architecture;
Software Engineering Daily Apache Flink with Stephan Ewen – Nov 2015; Spark and Streaming with Matei Zaharia – Feb 2018

AWS Streaming data