【Ubuntu】sshの設定(鍵認証ログイン)
sshの設定(鍵認証ログイン) ローカルマシンでキー生成 $ mkdir ~/.ssh $ ssh-keygen -t rsa -v > Enter file in which to save the key
sshの設定(鍵認証ログイン) ローカルマシンでキー生成 $ mkdir ~/.ssh $ ssh-keygen -t rsa -v > Enter file in which to save the key
雨量計を利用するとき、雨が降っている時だけカウントして、あとはスリープしていたい。 雨量計はシーソーが傾き、真ん中になった時にスイッチがONされる。 その地点を越えればまたOFFされるという仕様。 スイッチをpull-upしておき外部割り込みのPIN2に繋ぎその立ち上がり時の 割り込みをハンドルする。 また、スイッチであるためチャタリング除去のプログラムが必要。 省電力のためスリープを優先し今回の実装とします。 #define BOUNCE 200 int pin = 13; int start_time; volatile int state =
hex string to int value. def hexStringToInt(hex_str): return int(hex_str.encode(“hex”), 16)
Http/POST import urllib import urllib2 query = {“mail”:”a@mknod.jp”, “password”:”123″} query = urllib.urlencode(query) resp = urllib2.urlopen(“http://localhost:3000/api/login/”, query) resp.msg, resp.code resp.geturl() resp.info()
important ! http://json-ld.org/ Linked Data empowers people that publish and use information on the Web. It is a way
URI インターネット上のリソースを一意に特定するための文字列。URLとURNに分類できる。 URL スキーム名(HTTP、FTPなど)、ホスト名、パス名などを適切な順序で組み合わせることでインターネット上にあるリソースを一意に特定 URN スキーム名、名前空間識別子、名前空間固有文字列を組み合わせてインターネット上のリソースを一意に特定 ISBN番号のようなもの
https://www.dronecode.org/ やっぱpixhawk買ってみるか
区切り線設定 <ListView android:id=”@+id/ListView1″ android:layout_width=”match_parent” android:layout_height=”match_parent” android:divider=”#80000000″ android:dividerHeight=”1px” > 区切り線なし <ListView android:id=”@+id/ListView1″ android:layout_width=”match_parent” android:layout_height=”match_parent” android:divider=”@null” > </ListView>
<activity android:name=”jp.mknod.app.sn.LoginActivity” android:theme=”@android:style/Theme.Holo.NoActionBar” android:screenOrientation=”portrait” android:label=”@string/app_name” >
画面の回転を固定する <activity android:screenOrientation=”landscape”> <activity android:screenOrientation=”portrait”>
volley is new network lib. ・apache antをinstallする brew install ant または、 https://ant.apache.org/bindownload.cgi volleyをclone git clone https://android.googlesource.com/platform/frameworks/volley ・cd volleyで下記をantを実行 android
UTC現在時刻 Time.now.utc format = “%Y-%m-%d %H:%M:%S” from = DateTime.strptime(“2014-10-08 12:51:23”, format) to = Time.now.utc Data.where(created_at: from…to)
distribute for packaging pip for easy installation/removal of packages virtualenv for nice isolated environments sudo apt-get install python-dev curl -O
【OS X】sudo easy_install -U pyserial 【Linux】apt-get instal python-serial import serial import pytz def initSerial(): com = serial.Serial( port=’/dev/ttyAMA0′, baudrate=9600, parity
def function begin ・・・ rescue => ex ・・・ end end
rails g model project name:string rails g model group name:string rails g migration AddProjectIdToGroup project_id:integer 【model】に追記 class Group < ActiveRecord::Base
準備 rails g model User auth_token rails g controller Episodes model class User < ActiveRecord::Base before_create :set_auth_token private def
n:mのmodel定義 has_many through:を使う モデル定義 rails g model User name:string rails g model Project name:string rails g model UserProjectGroup user_id:integer project_id:integer rake
真偽メソッド メソッド末尾に?をつける。 finished? 破壊的メソッド(結果を自分に入れ替えていく) 末尾に!をつける。
JSON出力について。 jbuilderを使う。 ルーティング(config/routes.rb) get ‘show’ => ‘sessions#show’ コントローラー(app/controllers/sessions_controller.rb) class SessionsController < ApplicationController protect_from_forgery with: :null_session def show @status