Code学習日誌 (石井大輔)

html/CSS/JavaScript/Ruby/Python学習したことを日々つれづれと書きます。Fashion Tech分野で米国での成功目指し頑張っています。Twitter@ishiidまでお気軽にご連絡ください。

CodeCamp.com 無料体験授業

価格:30万円 総授業時間60時間 つまり時間で@5000円

体験授業は大満足だったが、総額が大きいのと、この値段なら知り合いに10万円でオンライン家庭教師お願いしたいと正直思った。

 

ホストサーバー:さくらインターネットがおすすめ

共有サーバー、VPSクラウドを使用

 

ユーザー同士双方向なコミュニケーションができるWebサービスが作りたいと言ったら、それはWebアプリケーションだしバックエンドのデータベースが必要になるので、Ruby on Railsがオススメですと言われた。残念ながらCodeCampにはRubyのコースがない。代案としてPHP+MySQLでも構築できる。WordPressやBootstrapでは双方向サービスは構築無理。

 

サブドメインという言葉を間違って使っていたが、

www.subdomain.google.comと、メインの前に来るドメインサブドメインと呼ぶ

www.google.com/about の様な、後ろにつくものはディレクトリの中という

 

英語のビデオ教材で勉強した為、日本語のIT用語がわからず、帰国子女状態。

これからPGColony.comで初のオンライン勉強会という試み。

熊本、東京、岡山をつなぐので面白そう。

成功したら定期開催したい。

Recursion(帰納)

帰納 Recursion  >> プログラミングでとてもパワフルな考え方

演繹 Deduction

 

Smallest input

base case = starting point

 

factorial (n) = n * (n-1) * (n-2) * ---- * 1

factorial(0) =1

factorial(n)=n*factorial(n-1) n>0

 

def factorial(n):

 in n==0

 return 1 (base case)

elese : return n*factorial(n-1)

 

factorial(3) = 3* factorial(2)

factorial(2)= 2*factorial(1)

 

palindromes=前から読んでも後ろから読んでも同じ言葉

level

a

""

def is_palindrome(s):

 if s  == " ":

 return True

else:

if s[0]==s[-1]:

else return False

The Power of APIs

世の中には無数のAPIがある

PublicAPIs | Directory of public APIs for web and mobile

 

Application Programming Interface = API

hipmunk

urllib in python

urllib2 in python

 

XML - <! DOCTYPExhtml> <br/>

 

Parsing XML

form xml.dom import minidom document object model

minidom: simple and fast

 

Citizen of internet

use a good user agent

rate limit yourself while more: get more ( )

 

Protocols

- SOAP by microsoft

- Protocol Buffers by Google

- thrift by facebook

- plain text , custom format

- XML

-JSON

 

Meet Javascript

.replace( ) 置き換える

.append( ) 一番後ろに加える

.prepend( ) 一番前に加える

.topUpperCase( ) 大文字に変える

.slice( ) 最初の要素を取る

.length( ) 文字列の長さ

.pop( ) Arrayで最後の要素を取る

.push( ) Arrayで最後に要素を足す

.split( ) 切る

.join( ) 結合する

 

*Truthy - Falsy

true- false

non-zero numbers  - 0

"strings" - ""

objects - undefinied

arrays - null

functions - NaN

 

*Object = 人間の手の様な物

no class in JavaScript only object

MyObj.property=someValue

bio.city="MountainView";

MyObj["property"]=someValue

 

*JavaScriptObjectNotation=JSON >>> Validator here

jsonlint.com

 

Database Intro 2

-Select * from links where votes > 10 

-order by votes desc/asc

-append = 添える

-Joins = multiple tables

select link * from link, user where link, user-id=user.id and user.name='spez'

-Indexes

seguential scans(slow with lots of data) : links [link1, link2, link3,    ]

indexes(increase the speed of queries) : index {1:link1, 2:link2, 3:link3,     }

def build_link_index():

index{}

for l in links

index[ l.id]=l return index

-Indexes for sorting

hashtable - not sorted, constant time

tree- sorted, lookups are slower

-Reddit Hotness Algo - hot_idx

-ACID

Atomacity - all parts of transaction succeed or fail together

Consistensy - the database will always be consistent

Isolation - No transaction can interfere with another

Durability - once the transaction is comitted, it won't be lost

 

-Replication Lag

-Google App Engine Datastore 難しすぎて今はパス

Tables - entities / columns are not fixed / all have an ID / parents & ancestors

Using the Datastore - Python — Google Cloud Platform

Database Intro 1

Databaseとは?

多量の構造化されたデータを備蓄・回収すること

データベースを扱う機械そのものも指す

 

Tables : Columns x Rows (like excel)

 

これを読んでおく様に、とのこと。

stackoverflow.com

Tuple=順序付けられた複数の要素で構成される組(データの形式)

e-words.jp

NamedTupleはPythonのClassに似ている

 

*手でDatabaseを作ると悪い点

error prone = エラーが出やすい

tedious = 長ったらしくて退屈

slow = 100万個のデータ処理は手では不可能

 

*4つのDatabase種類

1.Relational Database SQL : tables

-postgresql = reddit

-MySQL = facebook and many

-SQLite

-Oracle=MySQL

2.Google App Engine's Database

3.Dynamo by Amazon(recommended)

4.No SQL

-mango

-couch

 

SQL=structured query language

invented in 1970's

example: select * links where id=5;

select: fetch data

* : all columns

links: tables

id=5; : constraint=強制

 

HTML Template Work Session

以下レベルが高く全然理解できていないので備忘録。

現在の問題:

PythonとHTMLがどう相互作用しているのか100%理解できていない

Pythonのdefが使いこなせない

Using Templates - Python — Google Cloud Platform

Welcome to Jinja2 — Jinja2 Documentation (2.8-dev)

github.com