Skip to main content

Posts

Showing posts from January, 2020

naming conventions in Javascript

I personally like kebab-case: https://wiki.c2.com/?KebabCase
kebab-case is by far the most common convention today. The only use of underscores is for internal node packages, and this is simply a convention from the early days. https://docs.npmjs.com/files/package.json#name
for Node -  Node Starter https://github.com/rickyrauch/nodejs-starter
From google: https://google.github.io/styleguide/jsguide.html#file-name
From airbnb: https://github.com/airbnb/javascript#naming-conventions

Handwritten Text Recognition with TensorFlow / Python

In order to use wordbeam search: python main.py --train --beamsearch 1. Compile wordbeam search https://github.com/githubharald/CTCWordBeamSearch2. downloadIAM Handwriting Databasehttp://www.fki.inf.unibe.ch/databases/iam-handwriting-database

React way to use D3 - ( Python as API )

The Inspiration
Andmap is trying to build new BI product, the tech stacks would be D3 + ReactJS as data visualization frontend, Web API, and Python provides data. As with most new projects, it didn’t take long to figure out the major roadblocks. D3.js is a JavaScript library for manipulating documents based on data. D3 helps you bring data to life using HTML, SVG, and CSS. D3’s emphasis on web standards gives you the full capabilities of modern browsers without tying yourself to a proprietary framework, combining powerful visualization components and a data-driven approach to DOM manipulation. In one of our initial discovery sessions, we realized that our application needs to be able to adapt D3 library in ReactJS way. More than that, we prefer utilizing new feature of React - Hooks. Finally, we build  component for each chart and Helpers file for drawing each chart. Here is sample for map chart:
index.js:



map.js - map chart container -
using useEffect hook

helpers.js
- to draw charts

useReducer Hook + Context API for Towneley project

To ger rid of Redux!!

A simpler, more straightforward way to handle global state management

library we are using for this project are:
1. Formik
2. Material Design
3. Redux

1. Index.js 2. store.js 3. reducer.js 4. actions.js5. middleware.js6. typeOfActions.js7. profileForm.js=======
Same idea - use hook for Material Design

SVG, and SVG for ReactJS - D3, and other library

Android app publishing

Upload failed You uploaded a debuggable APK or Android App Bundle. For security reasons you need to disable debugging before it can be published in Google Play. Learn more about debuggable APKs or Android App Bundles.

Online tool to remove background of images

Landscaping with Andmap Ultimate Android app

Andmap Ultimate updates

permission for storage: external storage and location
boolean hasWriteExternalStoragePermission = false;if (Build.VERSION.SDK_INT >= 23) { String[] PERMISSIONS = {android.Manifest.permission.WRITE_EXTERNAL_STORAGE}; if (!hasPermissions(MainMapActivity.this, PERMISSIONS)) { ActivityCompat.requestPermissions(MainMapActivity.this, PERMISSIONS, REQUEST );} else { hasWriteExternalStoragePermission = true;} } else { hasWriteExternalStoragePermission = true;}share object with email
https://inthecheesefactory.com/blog/how-to-share-access-to-file-with-fileprovider-on-android-nougat/en
ArrayList<Uri> uris = new ArrayList<Uri>();for (String filePath : files) { //uris.add(Uri.parse("file://"+ file));Uri fileUri = Uri.parse("file://"+ filePath);File file = new File(fileUri.getPath());Uri uri = FileProvider.getUriForFile(activity, BuildConfig.APPLICATION_ID + ".provider",file);uris.add(uri);} sendIntent.putParcelableArr…

Google maps not showing in Android app - sample code

Filter with 'Google Maps' in your logcat.You will see an error message, which contains the correct package name & SHA key which should be present as it is in the API KeyGo to Google Cloud Console -> API -> Credentails, and cross-verify both the above, correct if necessary.
https://console.cloud.google.com/

sample code:
https://github.com/googlemaps/android-samples/tree/master/ApiDemos/java/app/src/main/res/values

Asian

Time: Sunday
Location: Ride home
Son: Mom, do you remember that joke?
Mom: which one?
Son: Asian without As is sin.
Mom: What about it?
Son: We had a math exam.....
Son paused. Mom tilted her head waiting for the bomb dropping ......
Son: let me just say....
After today’s math test
I
Am
Still
Asian!

最有效的解决问题的方式

领导者通过问题看到机遇

领导者看问题不是作为干扰, 而是不断改进和看到原来没有意思到的机会
A leader must never view a problem as a distraction, but rather as a strategic enabler for continuous improvement and opportunities previously unseen.

responding promptly and efficiently  with a comprehensive step-by-step incident report that included our change management efforts.


Effective leaders connect the dots and map-out a realistic plan of action in advance. They have a strategy that serves as the foundation for how the problem will be approached and managed. They anticipate the unexpected and utilize the strengths of their people to assure the strategy leads to a sustainable solution. Never shoot from the hip when problem solving. Avoid guessing. Take enough time to step back and assess the situation and the opportunities that each problem represents. Make the problem solving process more efficient by recognizing that each problem has its own nuances that may require a distinct strategy towards a viable resolution.

They never realize …

push notification with Expo - React Native APP

store expoPushToken in local storage if can't find it,
1. form screen
useEffect => fetchStorage

2. For android, download google-services.json
app.json
"googleServicesFile": "./google-services.json", 3. onSumbmit:constinput = { ...rest, photos:JSON.stringify(photoUrls), type:form, accountId:ACCOUNT_ID, expoPushToken }
4. on api: add notification:
constpushTokens = contacts.map(contact=>contact.expoPushToken) pushNotification(pushTokens, body)
5. admin portal:
add/send notification

Test notification:
https://expo.io/notifications

steps:

getting a user's Expo Push Token calling Expo's Push API with the token when you want to send a notificationresponding to receiving the notification in your app (maybe upon opening, you want to jump to a particular screen that the notification refers to)

Apollo Server:yarn add expo-server-sdkexpo-server-sdk-node

https://docs.expo.io/versions/latest/guides/push-notifications/

import { Expo } from&#…

斯托克代尔悖论

《基业常青》及《从优秀到卓越》的作者吉姆·柯林斯认为,转型成功企业的管理队伍都显示出极大的心理承受能力。一方面,他们平静地接受了残酷的现实;另一方面,他们对自己坚信不移,相信无论道路如何险阻,前途一定是光明的。我们把这种耐力称之为“斯托克代尔悖论”。


他们能够如此,很大程度上是因为他们兼顾斯托克代尔悖论的两个方面,不让任何一方占上风。如果你可以采取这个双重系统,你就可以极大地增加作出正确决策的机会,并最终找到一个简单而又深刻的道理,作出真正了不起的抉择。一旦掌握了这个简单而统一的理念,你就离不断转变取得突破性进展不远了。 此外,在企业早期积累阶段,牢记斯托克代尔悖论同样重要:“我们并未打算在圣诞节之前就实现突破,但是如果我们能够持续不断地朝正确的方向推,我们最终会实现突破的。”勇敢地面对残酷的现实可以帮助你发现飞轮转动所需采取的步骤,这些步骤是显而易见的,虽然不容易做到。对最终的结果充满信心,能帮助你度过数月乃至若干年的积累阶段。 在遭遇困境之后,还能剥离大环境以保持理性且正确的思考问题的方式,对于个人或公司来说都是一件很有意义的事情。总之,当你诚实而努力,想要确定所面临的现实情况,那样的话,在十字路口总能找到前进的方向。 经典小档案: 斯托克代尔悖论:坚持你一定会成功的信念,同时,要面对现实中最残忍的事实,不论有多大的困难,不论它们是什么。 要点:对前途充满信心,但又直面残酷的现实。

2020 New Year's Resolution

1. Earn $100
2. Buy Keeper of the Lost Cities-Legacy
3. Be better at soccer
4. Have fun in life
5. Straight A's
6. Turn in 1 million word challenge
7. Stay fit
8. Try Jack fruit
9. Get high A's on tests
10. 4.0 GPA, or better (which isn't possible in middle school)