Categories
Java Software development Technology

Database connection pool

Reading Time: < 1 minute

https://brandur.org/postgres-connections

https://news.ycombinator.com/item?id=18220906

https://github.com/brettwooldridge/HikariCP/wiki/About-Pool-Sizing

Categories
Software development Technology

GCP Data Fusion

Reading Time: < 1 minute

(Update 12-10-2020) Ran the DataFusionQuickstart from Data Fusion Hub. Need to make sure the compute@developer service account have the following roles:

BigQuery Admin
Cloud Data Fusion Runner
Dataproc Worker
Service Account User
Storage Admin

then the datafusion user service account still has “Service Account User” role (this is same as below). The big query and storage roles are needed because the pipeline uses both. When it runs successfully, at the end we will see “Pipeline ‘DataFusionQuickstart’ succeeded.”

(Original 10-26-2020) Tried running couple more pre-set pipelines from google. It took a while to run (don’t know why). More on permissions (IAMs): need to add “Dataproc Worker” role to “Compute Engine default service account”. Continue added Service Account User to “Cloud Data Fusion Service Account / Cloud Data Fusion API Service Agent”

Couple tutorials

Targeting campaign pipeline

Creating a reusable pipeline

Permission issue (note the exact error will depends on the setup of network as well, for example, this DF service account needs to have network access to run the pipeline, and it needs that role if applicable).

Cost: the developer edition for data fusion instance costs 35 cents per hour. The basic edition is 1.80 per hour but comes with first 120 hours free, this is 5 days free usage and recommended. Also, there is ways in GCP to set up budgets and alerts.

Categories
Software development Technology

Terraform

Reading Time: < 1 minute

(Update 12-16-2023)

https://twitter.com/stlplace/status/1736046754615717949

On AWS a competing technology is cloudformation. The nice thing about TerraForm is it supports multi-cloud (AWS, Azure and GCP, and more).

(Original 2020)

Doing

Prepare for Certification

Get Started – AWS : below has some issues, cannot find the image. Note I tried to find correct ami image id too (ami-032930428bf1abbff, via AWS console), but it appears there is another issue when a correct ami image id was used.

resource "aws_instance" "example" {
  ami           = "ami-830c94e3"
  instance_type = "t2.micro"
}

Error: Error launching source instance: VPCResourceNotSpecified: The specified instance type can only be used in a VPC. A subnet ID or network interface ID is required to carry out the request.
	status code: 400, request id: c8d85874-93fb-4e48-b515-97b50172826b

  on example.tf line 15, in resource "aws_instance" "example":
  15: resource "aws_instance" "example" {

*Amazon Linux AMI 2018.03.0 (HVM), SSD Volume Type – ami-032930428bf1abbff (from aws console)

Done

Get Started – Google Cloud

Get Started – Azure : one interesting part is it seems the user name and password for Azure in TF script is not checked (or in other words they are stateless?). Not sure why. Was using admin_username=plankton later while it was setup it was Password1234!

Two more comments on Azure: the Store Remote State part did not work perfectly. I believe Azure free tier has one year limit: it shows 6 cents so far for my infrastructure experiment. Also: the detailed cost.

Get Started – Terraform Cloud

Categories
Life Tips Software development Technology

hosts file for productivity

Reading Time: < 1 minute

Sometimes we need to get something done without the distraction of facebook, twitter or for that matter, linkedin (or some other sites you want to stay away). Here is a tip for how to do it on Mac.

sudo vi /etc/hosts
(note you don’t have to use vi, feel free to use nano or other editor of your choice)


referene entries below
====
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost

127.0.0.1 facebook.com
127.0.0.1 www.facebook.com

#127.0.0.1 linkedin.com
#127.0.0.1 www.linkedin.com

127.0.0.1 twitter.com
127.0.0.1 www.twitter.com
====

Then do this in command line.
sudo dscacheutil -flushcache

Reference articles:

How to Edit the Hosts File in Mac OS X with Terminal

How To Edit Hosts File In Linux, Windows, Or Mac

Categories
Fun Technology

Virtual Learning

Reading Time: < 1 minute

I normally use google calendar for kiddos’ Zoom meetings. My older daughter who is going to be FGC dragon knows get to Zoom via Google classroom. I can train her on the google calendar too. But now I am thinking I will take Monday off for the full time support of virtual learning (I feel I need a break from work too). || A bigger question though, this kind of management tool seems like new normal to all of us. In the past I used Google Calendar for all my personal appointments and all my kids activities, this includes my girl’s basketball (time, location), and my volunteer meeting at kids school etc. || Also, a side note, I have not looked into kiddos iPad yet, but I assume everything is setup including google classroom. But I prefer kids not to watching iPad whole day. So I setup bigger monitor with laptops (MacBooks) and webcams. I will need to provide some support for my 1st grader on this…

Categories
Fun

DNC Convention, MUNY

Reading Time: < 1 minute

There is no relations between those two. It’s just last night I was watching MUNY the online show for a bit, then switched to the DNC online convention: the big ones are Bernie and Michelle’s speeches. The DNC speeches were available via Apple News (ABC), as well as Twitter (PBS, CBS etc).

I used to be political junkie. But over the years especially since 2008, I became more realistic on politicians and US politics. That is until the pandemic hits, and the hell broke loose. I don’t think much of the orange guy in the WH before this, and now it suddenly the incompetency of federal government suddenly made our kids back to school seems impossible. I know many politicians have shortcomings, for example, John Edwards. His “two America” words still resonated with me, but his action during his marriage (extra marital affair when his then wife was having recurring cancer) was callous. Now the 45 is worse, obviously. With 170k people died of Covid in the US and counting, he was still playing golf. Even after his brother died over the weekend. So there is that. I do think Dems will do better. At the same time check and balance is still very important.

Back to MUNY, Serenity asked my phone back when I was watching Bernie last night, on the minivan home from church parking lot (we were playing outdoors in the evenings when possible). She was more interested in the music. Although she watched Michelle’s speech when we got home too. I haven’t asked how she feels about it. She knows my political views. I hope one day she will vote. She did ask me about voting the other day.

Categories
Software development Technology Web

API Gateway

Reading Time: < 1 minute

Kong

Kong is a cloud-native, fast, scalable, and distributed Microservice Abstraction Layer (also known as an API Gateway or API Middleware). Made available as an open-source project in 2015, its core values are high performance and extensibility.

Actively maintained, Kong is widely used in production at companies ranging from startups to Global 5000 as well as government organizations.

CA Layer 7 / API Gateway: was owned by CA Technology, formerly Computer Associates. Sold it to Broadcom the chip company in recent years. It used slightly older technology as Kong, apigee and Okta.

documentation:

architecture:

Categories
advice and tips kids

Where to buy masks

Reading Time: 2 minutes

Masks are much more widely available, and much more widely accepted now, compared to the early days of shutdown, or in February when the US was not directly impacted by COVID. I recall buying masks at Chinese grocery store, also at the Aliexpress.com (a subsidiary of Alibaba that serves customers outside of China). Also friends in China sent in some. All those are one time use “surgical type” or “dusk” masks. The quality was okay but great. Now those are more widely available in large websites or stores as well: Amazon, Costco, Walmart etc. The price came down as well.

But I am not a big fan of one time use masks. I had one cotton mask before the pandemic, and I used it a lot (I do need to wash it more often). Recently I found those Hanes masks are good or decent. They have 50 packs as well. It comes down to $2.50 per piece. I already received it, washed it, and started using it. I think one person can use one mask per day, just like undergarments. Use Code “SAFE20” for Extra 20% Off.

Also, some kids (and their families) in Ladue school, started this stl mask project: the money raised will be donated to operation food search.

I noticed some special purpose masks such as masks for running as well. Those cost a bit more than normal ones (see below), as cotton ones could easily cause sweat.

Last but not least, I think custom made or the name on mask can have some values, especially for teachers or healthcare workers. I found Etsy have some (adult personalized mask, adult custom name mask, and reusable kids mask).

(Update 07-20-2020) Found this deal on surgical masks at ebay. I ordered 300 🙂 Note I am still not big fan of one time use masks, but I plan to donate some and save some. Recently I found out I could misplace masks at home or in the car, so that’s the main use of one use masks.

Categories
advice and tips finance

CAGR compound annual growth rate of one of my IRA account

Reading Time: 2 minutes

This IRA account was a bit unusual, as I took some meaningful losses earlier on. Then from 2017 (maybe a little bit more earlier, but I only have the balance history since Jan 3, 2017), things started to look up. In last 3.5 years, the CAGR is about 54.54%. My bigger winner during this time was $HUN, and more importantly $OKTA. This is the chart.

And the formula to do it via Google chart. Basically I imported the CSV (downloaded form broker website) into google sheet, and used the default chart, and added the formula for CAGR compound annual growth rate. Last but not least, one may adjust the formula a bit (maybe retype it), in my case, I used this formula: power (end value / beginning value, 1.0 / number of periods) . The ^ symbol (at least as I copied and pasted) seems have some issues, so I used the math power function, which is same as the ticker ^ symbol here. The period is year here, as I was looking for the annualized return.

Last but not least, this does not depict the full picture of my personal investments. I made some dumb mistakes here or there, and also, I put most of my 401k money in stock mutual funds (some in S&P 500 funds).

(Update 07-21-2020) The annual return is 13.34%, as shown in the chart. There was two meaningful drops in last 12 months. For comparison, the S&P 500 was up 9.25 % in last 12 months and Berkshire Hathaway was down -6.65% in the same period (yahoo Finance chart here).

In retrospect, I did not do well when I trade too much. One reason for more trading is since last last year, TDAmeritrade stopped the trading fees. Rohinhood was free since its beginning (2015?) and I did decently well in its early days. Then I got into sort of slump. This is similar to my main trading account (IRA at TDAmeritrade), I did well in 2017 and 2018, perhaps early half of 2019 too. But was just so-so in last 12 months (again refer to my chart). Update: actually I did not do very well in 2017 (+25%), but I did exceptional in 2018 (up 100%), then followed by 50% in year 2019. Overall still decent.

Categories
advice and tips finance

Review 401ks II

Reading Time: 2 minutes

Today I started to look at other 401k accounts I have and evaluate whether I need to make any adjustments. This is a continuation of my earlier post.

In the past I do looked at them from time to time, but was not on a fixed schedule or anything. But I did start making some adjustments in last year or so, to my couple portfolios. For example, I got rid of the international funds in my Siemens 401k plan, I believe those will continue to underperform over the US equities in next 10 years or so. Most US companies are international companies too: I looked at the US large cap fund, the top 5 holdings are Microsoft, Apple, Amazon, Alphabet (Google) and Facebook. And its performance in last 1, 3, 5 and 10 years (10.5% vs 10.5% annualized) is fairly comparable to S&P index. Note in my earlier post I mentioned I am mostly keen on 10 years performance. Because we were mostly in a bull market in last 10 years (2010 to 2020). I recall Sept 2008 and March 2009 were two market lows last time around during financial crisis / great recession. So this is a bit confirmation of the market effect.

For this Siemens 401k account, I actually don’t plan to do anything today. I did update the address, since I moved from condo to current single family house in last August. I will still have a few more portfolio to look, as you can see from my linkedin profile, I changed job a bit in last 10 years or so. And I mainly used two choices when I deal with the 401k: leave them alone (for the most part); or move them to IRA (applicable to my 401k when I was in contractor position, as they usually will not let me leave the money there). I end up with 2 IRAs over the years, and a few more 401ks. Maybe at some point, I will consolidate, as management of those can become more tedious. As a minimum I need to have user name / password for them. The only place they have single sign on is the credit card company I worked for. A bit off topic, I recall a gentleman who used to work for Disney, and he said Disney has at least three SSOs. Then my colleague commented then it’s MSSOs 🙂