digit
はintで0開始桁数。
int resNum = (number / ((int)Mathf.Pow(10, digit))) % 10;
digit
はintで0開始桁数。
int resNum = (number / ((int)Mathf.Pow(10, digit))) % 10;
Go言語WebフレームワークGinのスキャフォルディングがない。
https://github.com/dcu/gin-scaffold
インストールする。
go get github.com/dcu/gin-scaffold
git-scaffold init プロジェクト名
でプロジェクト生成。
僕は~/bin/
の下にあるので・・。
~/bin/gin-scaffold init scatest
中身はこうなってた。
> ls scatest config controllers helpers models scatest.go
起動するのはscatest.go
だ。
go run scatest.go
そのままでは、パスがフルパスだったので
import( //"/Users/shinriyo/scatest/controllers" "scatest/controllers"
を修正した。
デフォルトでは、4000番ポートでアクセス。
http://localhost:4000/
にアクセスする。
他のフレームワークとかぶったりするので、
変えたい時はscatest.go
のport = "4001"
を変える。
github.com/Sirupsen/logrus
~/bin/gin-scaffold scaffold user name:int
controllers/users.go:6:2: cannot find package "models" in any of: /usr/local/opt/go/libexec/src/models (from $GOROOT) /Users/shinriyo/src/models (from $GOPATH)
さもなくばエラー。
~/bin/gin-scaffold scaffold User name:int
models/user.go
がおかしい。
// User is a model type User struct { ID bson.ObjectId `bson:"_id,omitempty"` // name int `bson:"name"` name string `bson:"name"` CreatedAt int64 `bson:"created_at"` UpdatedAt int64 `bson:"updated_at"` Errors helpers.Errors `bson:"-"` }
int
ではなくてstring
に。
この辺を見て起動しておく
アクセス
http://localhost:4000/users
{"count":0,"items":[],"success":true}
// This is the main entry point of the application. static void Main(string[] args) { // if you want to use a different Application Delegate class from "AppDelegate" // you can specify it here. UIApplication.Main(args, null, "AppDelegate"); }
No RealmObjects. Has linker stripped them? See https://realm.io/docs/xamarin/latest/#linker-stripped-schema
このエラー。
Xamarinを起動するとアップデートを促されてた。 そしてアップデートをすると以下の Visual Studio for MacはXamarinの機能以上あるからもうあなたのマシンからXamarin消していいよー。
って・・・。それなら最初からアップデートじゃなくていいのにー。
すでにPreview版のを入れてたので、それを起動したらこれがでた。