What's up?

Jooho Lee > What’s up?
GraphQL

GraphQL

Source: Link

Is GraphQL a database technology?

No. GraphQL is often confused with being a database technology. This is a misconception, GraphQL is a query language for APIs – not databases. In that sense it’s database agnostic and can be used with any kind of database or even no database at all.Annotate

Is GraphQL only for React/JavaScript Developers?

No. GraphQL is an API technology so it can be used in any context where an API is required.

On the backend, a GraphQL server can be implemented in any programming language that can be used to build a web server. Next to Javascript, there are popular reference implementations for Ruby, Python, Scala, Java, Clojure, Go and .NET.

Since a GraphQL API is usually operated over HTTP, any client that can speak HTTP is able to query data from a GraphQL server.

Note: GraphQL is actually transport layer agnostic, so you could choose protocols other than HTTP to implement your server.

How does server-side caching work with GraphQL?

One common concern with GraphQL, especially when comparing it to REST, are the difficulties to maintain server-side cache. With REST, it’s easy to cache the data for each endpoint, since it’s sure that the structure of the data will not change.

With GraphQL on the other hand, it’s not clear what a client will request next, so putting a caching layer right behind the API doesn’t make a lot of sense.

Server-side caching still is a challenge with GraphQL. More information about caching can be found on the GraphQL website.

How does authentication and authorization work with GraphQL?

Authentication and authorization are often confused. Authentication describes the process of claiming an identity. That’s what you do when you log in to a service with a username and password, you authenticate yourself. Authorization on the other hand describes permission rules that specify the access rights of individual users and user groups to certain parts of the system.

Authentication in GraphQL can be implemented with common patterns such as OAuth.

To implement authorization, it is recommended to delegate any data access logic to the business logic layer and not handle it directly in the GraphQL implementation. If you want to have some inspiration on how to implement authorization, you can take a look to Graphcool’s permission rules.

How does GraphQL handle errors?

A successful GraphQL query is supposed to return a JSON object with a root field called “data”. If the request fails or partially fails (e.g. because the user requesting the data doesn’t have the right access permissions), a second root field called “errors” is added to the response:

{
  “data”: { … },
  “errors”: [ … ]
}

For more details, you can refer to the GraphQL specification.

Does GraphQL support offline usage?

GraphQL is a query language for (web) APIs, and in that sense by definition only works online. However, offline support on the client-side is a valid concern. The caching abilities of Relay and Apollo might already be enough for some use cases, but there isn’t a popular solution for actually persisting stored data yet. You can gain some more insights in the GitHub issues of Relay and Apollo where offline support is discussed.

One interesting approach for offline usage and persistence can be found in the following blog post “Offline GraphQL Queries with Redux Offline and Apollo“.

pyenv on Windows

pyenv on Windows

pyenv-win

https://github.com/pyenv-win/pyenv-win

pyenv-win commands

   commands     List all available pyenv commands
   local        Set or show the local application-specific Python version
   global       Set or show the global Python version
   shell        Set or show the shell-specific Python version
   install      Install 1 or more versions of Python 
   uninstall    Uninstall 1 or more versions of Python
   update       Update the cached version DB
   rehash       Rehash pyenv shims (run this after switching Python versions)
   vname        Show the current Python version
   version      Show the current Python version and its origin
   version-name Show the current Python version
   versions     List all Python versions available to pyenv
   exec         Runs an executable by first preparing PATH so that the selected Python
   which        Display the full path to an executable
   whence       List all Python versions that contain the given executable

Usage

  • Update the list of discoverable Python versions using: pyenv update command for pyenv-win 2.64.x and 2.32.x versions
  • To view a list of python versions supported by pyenv windows: pyenv install -l
  • To install a python version: pyenv install 3.5.2
    • Note: An install wizard may pop up for some non-silent installs. You’ll need to click through the wizard during installation. There’s no need to change any options in it. or you can use -q for quite installation
    • You can also install multiple versions in one command too: pyenv install 2.4.3 3.6.8
  • To set a python version as the global version: pyenv global 3.5.2
    • This is the version of python that will be used by default if a local version (see below) isn’t set.
    • Note: The version must first be installed.
  • To set a python version as the local version: pyenv local 3.5.2.
    • The version given will be used whenever python is called from within this folder. This is different than a virtual env, which needs to be explicitly activated.
    • Note: The version must first be installed.
  • After (un)installing any libraries using pip or modifying the files in a version’s folder, you must run pyenv rehash to update pyenv with new shims for the python and libraries’ executables.
    • Note: This must be run outside of the .pyenv folder.
  • To uninstall a python version: pyenv uninstall 3.5.2
  • To view which python you are using and its path: pyenv version
  • To view all the python versions installed on this system: pyenv versions

Managing virtual environments with pyenv

https://towardsdatascience.com/managing-virtual-environment-with-pyenv-ae6f3fb835f8

Database Clinic: Neo4j @ LinkedIn Learning

Database Clinic: Neo4j @ LinkedIn Learning

Database Clinic: Neo4j is a fine online course. The content is easy to follow but it doesn’t cover enough fundamental concepts and theories on Neo4j. The Neo4J used in the video is not the most current version due to the video is published in 2017. So some lines of the code didn’t work. The Neo4J Desktop made the browsing the database easier than using web browsers. This course is good resource for exploring what graph database can do with flat data.

https://www.linkedin.com/learning/database-clinic-neo4j/welcome?u=76278132

Epidemiology @ Coursera

Epidemiology @ Coursera

Epidemiology: The Basic Science of Public Health is a great fundamental course offered by the University of North Carolina at Chapel Hill. It is a 6-week course covering history of epidemiology, what and how to measure disease frequency, various study designs, measures of association, and causality.

The videos are short and concise. The quizzes are great for catching up with what I just learned from video lectures. The content is quite heavy, but the instruction is well-organized to cover all the fundamental concepts. The definitions of the measures of health outcome are still unclear on my end, but this course was very helpful in learning some basics.

Course information: https://www.coursera.org/learn/epidemiology

Practical Statistics for Data Scientists

Practical Statistics for Data Scientists

This content of this book is extremely useful resource for learning and understand statistical concepts and techniques. It is great to see how Python and R codes are implemented for each concept, but only the snippet of codes are provided on many examples in the book. Fortunately, the publisher provides the whole codes by chapter. The widely used Python packages (pandas, numpy, scipy, statsmodels, sklearn, matplotlib, seaborn, and more) and R libraries can be easily located in each chapter and index.

R libraries used:

library(boot) #Bootstrap Functions
library(ca) #Simple, Multiple and Joint Correspondence Analysis
library(cluster) #”Finding Groups in Data”: Cluster Analysis
library(corrplot) #Visualization of a Correlation Matrix
library(dplyr) #A Grammar of Data Manipulation
library(ellipse) #Functions for Drawing Ellipses and Ellipse-Like Confidence Regions
library(FNN) #Fast Nearest Neighbor Search Algorithms and Applications
library(ggplot2) #Create Elegant Data Visualisations Using the Grammar of Graphics
library(gmodels) #Various R Programming Tools for Model Fitting
library(klaR) #Classification and Visualization
library(lmPerm) #Permutation Tests for Linear Models
library(lubridate) #Make Dealing with Dates a Little Easier
library(MASS) #Support Functions and Datasets for Venables and Ripley’s MASS
library(matrixStats) #Functions that Apply to Rows and Columns of Matrices (and to Vectors)
library(mclust) #Gaussian Mixture Modelling for Model-Based Clustering, Classification, and Density Estimation
library(mgcv) #Mixed GAM Computation Vehicle with Automatic Smoothness Estimation
library(pwr) #Basic Functions for Power Analysis
library(randomForest) #Breiman and Cutler’s Random Forests for Classification and Regression
library(rpart) #Recursive Partitioning and Regression Trees
library(tidyr) #Tidy Messy Data
library(vioplot) #Violin Plot
library(xgboost) #Extreme Gradient Boosting

Learn Python 3 the Hard Way

Learn Python 3 the Hard Way

This book is published in 2017. The fundamentals of Python language is covered in this book. O’Reilly offers companion videos.

This book is a little outdated, but great for the beginners for grasping fundamentals. The companion video uses a text editor and Python on command line environment. It is great for learning how to use command-line arguments, but not much useful anymore since Jupyter notebook became dominant in the market.

Create a blank file

Create a blank file

Unix/Linux

$ touch directory/filename.[extension]

Windows PowerShell

$ new-item -type file directory/filename.[extension]

Usage:

  1. Create a file or multiple files
  2. Create a directory
  3. Create a profile

$ New-Item -Path . -Name “testfile.txt” -ItemType “file” -Value “This is an example string.”

$ New-Item -Path “c:\” -Name “testdir” -ItemType “directory”

Learning resources

Windows PowerShell Documentation; Learning PowerShell @ Microsoft

Theme: Overlay by Kaira 2021 Jooho L.
Close Bitnami banner
Bitnami