React Native

Building a mobile app just got easier. With React Native, no longer do we need to code in Swift. Moreover with tools like Expo.io, the development process just got a lot easier because it manages the react native projects

React Native is an open source cross platform (ios, android) npm based javascript framework. It provides the ability to use the Camera Roll, Async Storage, GeoLocation, etc.

The tricky thing about React Native is that it does not use CSS, but instead uses Style Sheet Objects.

To get started with Expo, follow these steps:

  1. Run sudo npm install expo-cli -global
  2. Create first application: expo init rn-first-app
  3. Choose a template
https://www.dropbox.com/s/87nl3ecnn1ifnmi/Screenshot%202019-12-15%2021.30.25.png?dl=0
  1. Enter a few initial configuration values
https://www.dropbox.com/s/87nl3ecnn1ifnmi/Screenshot%202019-12-15%2021.30.25.png?dl=0
  1. Cd into the directory of the project
  2. Run the expo app: npm start

  • React Native is an open-source cross-platform (ios, android) npm-based javascript framework library.
  • It includes features like Camera Roll, Async Storage, Geolocation. Components include TextInput, Picker, Switch, Slider, Alerts, Modals, ProgressBars.
  • It does not use CSS, but instead Inline Styles or Style Sheet Objects
  • Expo apps can be published as standalone apps so pushed to the app store and sent to other people there
  • expo.io is where to get started to cover the basics
  • nodejs is a javascript run time and includes npm (node package manager) which needs to be downloaded from nodejs
  • the third step after installing node is to run the following code: sudo npm install expo-cli –global
  • expo cli is a tool that helps manage react native projects and makes it easy to use from any machine
  • the fourth step is to create a project under expo with teh following command, which will install al required dependencies: expo init rn-first-app and then choose blank and not bare minum since that doesnt include expo
  • the fifth step is to cd into the folder and run npm start, which needs to be kept running
  • expo dev tool??
  • the easiest way is to connect to a device with the expo app contained within ios
  • Two options to run are either React Native CLI (needs xcode and simulator) or Expo Cli.
  • Expo Cli can be published to app store and can be installed by running ‘sudo npm install expo-cli –global’
  • IOS Simulators (needs xCode) and Andriod Simulator (Android Stdio)

Expo Cli Steps to Create React Native Application (launch expo.io )
1) Run sudo npm install expo-cli –global
2) Create First App: expo init rn-first-app
3) Choose blank (not bare minimum)
4) CD into directory and run npm start
5) expo dev tools runs in the broswer
6) Run I for Iphone and A for Android

Launching an emulator (56min)
1) Install XCode from App Store, since it is an apple developer tools
2) Launch XCode and click on XCode Preference to ensure XCode 10.2.1 is installed in Command Line Tools
3) Click on XCode App -> Open Developer Tools -> Simulator, which will launch ios simulator
4) Type I into command line which was started with npm start

Course Outline

  • Getting Started
  • React Native Basics
  • Debugging
  • Real Apps, Styling, Components
  • Responsive and Adaptive Apps
  • Navigation
  • Managing State (redux)
  • Time to Practice (Shop App)
  • Handling User Input
  • Http Requests
  • User Authentication
  • Native Device Features
  • Different Workflows
  • How to Publish App

Core Components

  • View – Apply styles and great container component and where put styles on it
  • Text – output text and must be used for showing text
  • StyleSheet
  • Button – onPress
  • Touchable
  • TextInput
  • Image

Features

  • add navigation
  • managing state
  • device camera
  • google maps
  • send data to web server
  • React Native uses flexbox
  • flexDirection controls the flow of the elements
  • flexDirection: ‘row’ instead of column
  • how items are distributed, justifyContent will allow.
  • justify-Content, alignItems
  • align

Flexbox

  • flex – numbers are relative to each other
  • flexDirection: row or colum
  • width:’80%’
  • height: 300
    = justifyContent: ‘space-around’
  • alignItems: ‘stretch’
  • align
  • padding

Code Snippets

import {StyleSheet, Text, View,Button,TextInput} from ‘react-native’



Text

const styles = StyleSheet.create(

)

Discipline Development

The problem of QuantifiedSelf is that I don’t pay attention to it when I’m low on Ps. The lack of discipline needs to be resolved. 

  • Examples include: 
    • TechFest day when my whole day was captured and then there was a happy hour. 

The solution is to do one p every other day. 
There are a lot of problems to resolve

  • QuantifiedSelf when Ps amount is low or when I’m off the pill
    • The issue is that I don’t look at the QuantifiedSelf tracker when I’m off of it, because I’m doing something else or its a hectic day. 
    • For example, TechFest took up my whole day and then doing my taxes took up my whole day and then there was a social engagement afterwards and then smoked with Cornelius and Omar too
    • The lack of discipline is real and needs to be resolved
    • On Friday, December 13th, I could have done it more my QuantifiedSelf when I was at work. It seems like the only solution really is to do one every two days because there is some dependence on it until I completely get off of it and can do more with less. 
    • The importance of doing it is that it has built in controls to keep my life in order such as checking the calendar of events that I have. 
    • What else can I do to make sure I do the QuantifiedSelf and cause that behavioral shift? If I plan and schedule that may be another thing. 
    • Ive said this many many times before to get more on top of what I’m doing 
    • The problem is the whole range of events that need to be done and the more long term strategy that I need to do 
  • Doing Ps when there are social events going on and doing it less overall 

Hypothesis Testing

It is far better to test your hypothesis using minimal means than to build an entire application out only to find out it wasnt needed. The goal is to learn rapidly at a low cost so you can find a direction to expand in.

Hypothesis testing can be broken down into five major categories:

  • Customer Usability – will they use it
  • Marketability – how will you get the word out
  • Buildability – can you build it and is it possible
  • Pricability – can you charge for it?
  • why is this solution better than other options in the market?

https://docs.google.com/document/d/1yjdla8o-MDURwFFqhm0nmXKAEM8BD6iPfIo4osdZLaY/edit

Planning is for fools, or is it

They say God laughs at man’s plans. But planning is an essential part of success to ensure that you can reach your goals and have taken everything into account.

Planning should be broken up until three phases:

  • account for all the things you need to do and cant get out of to leave the remaining be the free time
  • prioritize the tasks that need to be done and estimate the amount of time that it will take to get it to the state of done
  • re-plan as you go through the entire day

How to Apply for a China Visa

  1. Chinese embassy or consulate or Chinese Visa Application Center (CVASC) which is in charge of your residence area needs to process documents (color photo, passport)
  2. Tourists need L Visa
  3. Visa Application Form is needed
  4. China Visa Fee for U.S is 140

China Visa for US Citizens

  1. Takes 5 to 7 business days
  2. personally submit to the appropriate chinese embassy
  3. China Visa Service can be an aleternative to going in person: China visa service like Passport Visa Express
  4. a letter of invitation makes it easier but not necessary

Visa Site

  1. Locate the Visa Officeof the Embassy / Consulate General which holds consular jurisdiction over the state in which you reside. You may either submit your application in person, or you may entrust someone else or a travel/visa agent to submit your application at the visa office.
  2. Address: https://www.google.com/maps/place/Consulate+General+of+the+People’s+Republic+of+China+in+New+York/@40.7488464,-73.996236,13.05z/data=!4m5!3m4!1s0x0:0xf2eb09ed5064eb4e!8m2!3d40.7620042!4d-74.0006396

FAQ

Odoo.Sh

Odoo.sh provies the best of both worlds between on-premise and the online solution, because it offers the best features of both worlds. This includes custom modules (before only available on-premise), no need to maintain server (only benefit of odoo online before).

It not only integrates with Github, but with Jupyter as well. It even has its own terminal online.

Odoo Online Editor Documentation

  1. Odoo.sh online editor provides the following: Edit Source Code from browser, open terminals, open Python Consoles, open Odoo Shell consoles, open Notebooks
  2. The branches tab provides access to the editor (editor picture)
  3. There are four primary folders at the root: src (contains community/enterprise source code, as well as repository branch source code), repositories, data, logs (Working Directory Folder Structure Picture)
  4. Source code is only writable in Staging & Development
  5. A change within the Odoo server addons path will reflect changes immediately without having to restart the server

Odoo Tutorials Made Easy

  1. Odoo.sh can test code automatically
  2. Odoo.sh is dependent on Github read/write authorization
  3. Odoo.sh gives you the ability to choose an existing repository or create a new repository
  4. Odoo.sh provides three different statuses on the left hand side menu (Production, Staging, Development)
  5. Odoo.sh provies four different tabs at the top: Branches (e.g. mails, shell access, logs), Builds (test instances), Status (statistics), Settings (add collaborators, project name, sub modules, etc.)
  6. After making a commit, Odoo.sh will start up a test environment because of the commit and you will see a new test instance ready to build within Odoo.
  7. The test that Odoo.sh runs after making a commit will show you whether the test has failed
  8. Under the builds tab, you can see all test instances and even connect to that instance to see why it has failed

Odoo Tutorials Made Easy (Part 2)

Odoo FAQ

  1. Other Git Projects can be integrated via git submodules (removing the need to copy and paste code)
  2. There is a difference between Github Private Repositories and Github Public Repositories
  3. XML-RPC interface allows for interaction with an external application (i.e. API)
  4. Odoo.sh API needs port number 443, database url (e.g. mydatabase.dev.odoo.com), database name
  5. Within the Odoo.sh shell, type psql in order to get the database name
  6. The manifest file (__manifest__.py) determines which addons are detected, which is how submodules work
  7. Odoo.sh caters to four different audiences: Developers, Testers, Project Managers, System Administrators

Odoo External API

Odoo – Become a Partner

  1. Odoo Certification Test is required for Odoo Partner
  2. Odoo Partner Dashboard is available to be utilized
  3. Odoo Partner Application asks for Name of Business, Number of Employees, Skype ID, Business Activity (CRM/ERP Specialist), What can you bring to Odoo as an official partner
https://www.odoo.com/documentation/user/12.0/odoo_sh/getting_started/online-editor.html

Odoo

Odoo strives to provide businesses with all the online tools and application it needs as an ERP system. It was founded in 2005.

There are four different ways to integrate and utilize it:

  1. Online
  2. Packaged Installers
  3. Source Install
  4. Docker

You can download Odoo Community or Enterprise from their Odoo Download Page as a few different versions: Windows, Ubutno/Debian, RPM, Sources

PostgresSQL is utilized as the database management system.

When PostGres is installed, the default usr is postgres, but Odoo forbits it so need to create anew PostgreSQL usr

To launch Odoo locally, the following steps need to be done:

  1. Install PostgreSQL
  2. Update to Python 3.5
  3. Download/install HomeBrew or MacPorts
  4. Download/Install Command Line Tools
  5. Install wkhtmltopdf manually

“Usability is qualitatively measured as a software’s ability to anticipate what a user might need to do. “

https://www.odoo.com/documentation/12.0/setup/install.html#setup-install

Connecting Lambda with S3

Whatever Lambda executes needs to be saved somewhere. Since lambda functions expire, we need to save the result somewhere. In this case, we will save the result of lambda to an S3 bucket

import boto3

with open(‘/tmp/log.txt’,’w’) as f:

import json
import boto3

s3 = boto3.client('s3')
with open('/tmp/log.txt','w') as f: 
     json.dump({'dummy':'status'},f)
s3.upload_file('/tmp/log.txt','layer-release-test','logs.txt')

Make sure that the role associated with the Lambda Function has S3 Access