未熟学生エンジニアのブログ

TetsuFeの個人開発ブログ

TetsuFeはテツエフイー と読みます。FlutterやWeb周り全般、チーム開発について語るブログ

dein.vimのプラグインが動かない(gvim)

gvimrcで設定したdein.vimから入れたプラグインが動かなかったので、teratailで質問したところ、 「gvimrc」は起動時にプラグインを読み込まない。GUI関連の設定以外は_vimrcに書きなさい」とのことでした。

皆さんも、gvimを使うときでも、GUI関連の設定以外は_vimrc に書くようにしましょう。

AddTrustExternalCARoot-2048.pem が not found 。また証明書が更新されたらしい --rails

対象者

windows10
rubyinstallerでruby 2.3.1 64ビットをインストール済み

問題

gem install ***しようとするとssl関連のエラーが出るときの対処法。

qiitaなどでは、 "まずはgithubでAddTrustExternalCARoot-2048.pemをダウンロードしなさい!" という記事が多いが、 実際にダウンロードしようとアクセスすると、

404 not found

と出ます。

原因

どうやら、最近(2016/10/6)証明書が更新されたらしい。 なぜかわからんが、rubygemを更新するといいとのこと。

SSL Certificate Update - RubyGems Guides

このサイトより、 SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed こんなエラーが出る人は、
https://rubygems.org/downloads/rubygems-update-2.6.7.gem
このリンクからrubygemをダウンロードして、Cドライブ直下に置く。その後、
C:>gem install --local C:\rubygems-update-2.6.7.gem
C:>update_rubygems --no-ri --no-rdoc
で、
C:>gem uninstall rubygems-update -x
とすると、こうなる。
Removing update_rubygems
Successfully uninstalled rubygems-update-2.6.7

さて、gem install してみましょう!これで成功するはずです。

ただ、僕はrailsをインストールしようとしたので、 development kitもインストールしてね。 といわれてしまいました。

その場合は、

http://rubyinstaller.org/downloads/

ここで、ちゃんとrubyの バージョンと同じdevkitを インストールしてください。 C:\devkitに保存
C\devkitで、
C:\devkit> ruby dk.rb init
C:\devkit> ruby dk.rb install

これで大丈夫でしょう。

アプリ開発日記〜英単語帳アプリ編〜

英単語帳アプリを開発しています。

特徴! 1.絵と英単語をセットで覚えられるので、イメージが湧きやすく、覚えやすい! 2.物語形式で英文を読めるので、楽しく英文に慣れることができる!

機能 1.単語をリスト表示する 2.単語を自動で順番に表示して記憶できる 3.物語で英文読解に慣れるノベルゲーム 4.4択問題 5.苦手単語リスト

Swift3でObjCBoolとBoolが変換できない件

xcode8にアップデートした際にswift3.0用にコンパイラを変更したのだが、 ObjcBoolをif文で処理しようとするとエラーが出たのでその解決法を書いておく

問題のコード

    let isdir:ObjCBool = false
    if !isdir {
        //if文の処理
    }

上のように書くと、2行目で Cannot convert value of type 'ObjCBool' to expected argument type 'Bool' のエラーが出た。

解決法

if !isdir.boolValue としてやればよい。

    let isdir:ObjCBool = false
    if !isdir.boolValue{
        //if文の処理
    }

javaserverprogramming markdown memo

ここで使うmarkdownの記法

  • コメントアウト: \ (エスケープシーケンス)
  • 見出し(強調): # 増えるほど強調できる
  • 太字:"*"で囲む(または"__")
  • イタリック:"**"で囲む(または"__")
  • リンク:表示名
  • シンタックスハイライト:言語で囲む
  • 改行:
  • 順序付きリスト: (空行) 1.(空白)リスト1 1.(空白)リスト2 (空行)

  • 順序無し(・)リスト: (空行) +(or-or)(空白)リストA +(or-or)(空白)リストB (空行)

  • 一部だけコードハイライト gccの例:gcc hello.c

vimの基本操作・忘れやすいもの

  • e: go to last character of word on cursor
  • b: back to a left word
  • o: go to insert mode at new line
  • gg: go to begining of file
  • G:go to end of file
  • 3G: go to line "3"
  • dw: delete word to right side
  • yy: copy one line
  • p: paste buffer
  • ctrl+r: redo
  • /(スラッシュ)検索したい言葉:検索(まずはenter押す、nで次へ移動)
  • :s/old/new : 置換(oldをnewに)
  • :s/old/new/g : その一行で全部置換
  • :%s/old/new/gc:そのファイル全部で置換(c:一回ずつ確認を求める)

HTMLの基本タグ

link: リンク表示名 ex: リンク表示名 :home directory

java server side programming perfect master memo

chapter 3

3-1 create new project

settings
*java web->webアプリケーション
*GlassFish Server
*java EE 7 web
*コンテキストpathはそのまま

3-2 what occurs when "run"

run means compile and deploy (create .war file and copy this war file to GlassFish server)

3-3 create a servlet file

Do right click on project name and 新規 -> servlet input form, class name: arbitrary class name package: com.example next input form, servlet name; arbitrary servlet name url pattern kind: /arbitrary url pattern(recommend: servlet name)

3-4 what is servlet?

servlet is a java class

?how to use servlet

servlet instance can dynamically create contents (ex.html code)

JSP&servlet container in application server
it has main() method and other useful method
JSP&servlet container create instance of servlet class
through main() method 
servlet instance create contents (ex.html code)

3-5 default servlet

method of default servlet * processReauest(HttpServletRequest, HttpServletResponse) this method create a http page depending on client's request grammer point : out.println("<!DOCTYPE html>"); out.println(""); ... so, this method create html code from below code out.println("html sources")

* doGet(HttpServletRequest, HttpServletResponse)
    it work as HTTP GET method
* doPost(HttpServletRequest, HttpServletResponse)
    it work as HTTP POST method

4-1 modern client/server model is 3 layer system

3 layer system 
    * client , server , middle tier(中間層)
    * middle tier(java EE) 
        * presentation layer: appearence of web page
        * business logic layer: process data
        * datalink layer: save and read data

5-1 MVC on javaEE

  • view : xhtml + backing bean(managed bean) xhtml is similar to html but tag is not same backing beans preserve values from input on view

  • model: connect database

  • controller: jsf(facesServlet)

  • important: Not only controller(FacesServlet) has action method backing beans also has action method(mainly called by jsf to deal with client's input.)

5-2 set jsf(controller) and API and encoding files

reproduced below as 3-1

settings
* java web -> webアプリケーション
* GlassFish Server
* java EE 7 web
* コンテキストpathはそのまま
* frame work -> check on JavaServer Faces
(finish button)
* add API librar
    project window -> (right click)ライブラリ -> ライブラリの追加
    -> check on Java EE 7 APIライブラリ
* set character encoding
    project window -> (right click)project name -> 新規 -> その他
    (category)GlassFish -> GlassFishディスクリプタ
    then, create 構成ファイル/glassfish-web.xml
    add below code at line 2 from bottom of glassfish-web.xml
      <parameter-encoding default-charset="UTF-8"/>  

5-3 make table(list)

use jsf in other words, a xhtml file

  • <h:form> tag : need to input and send message
  • xhtml tags for making table(list) (in <h:form> tag) <h:panelGrid> tag example: <h:panelGrid columns ="number of columns" > </h:panelGrid>

  • set label (in <h:form> tag) <h:outputLabel> tag example: <h:outputLabel value="ISBN : "/>

  • set textfield (in <h:form> tag) <h:inputText> tag example: <h:inputText value="#{book.isbn}"/>

  • set button to send input (in <h:form> tag) <h:commandButton> tag example: <h:commandButton value="送信" actionListener="#{book.dispConsole()}" />

  • draw a line to devide between sections


    tag it is used only "
    " in other words, Dont use
    .

5-4 backing beans, midiator between view and model(database)

  • backing beans is java file role: midiator between view and model(database) preserve values of client's inputs have action (class)method, it will work if jsf call. view and database use this preserved values(class field)

  • automatically make getter/setter method 1.at the first time, you add (private) field, 2.go to editor of backing beans file,if right click and select "insert code" 3.select "取得メソッド及び設定メソッド" 4.select field you want to deal with by getter/setter

  • intantiation of backing beans and CDI CDI(Contexts Dependency Injection) CDI manages instance's relation of dependency and lifecycle of objects

    by anotation, CDI create a instance example: (in backing beans file) //import files for annotation of instantiation import javax.enterprise.context.RequestScoped; import javax.inject.Named; //specify(指定する) a rule of instance's name @Named //it manages to autorelease objects @RequestScoped public class Book { private String isbn; }

5-5 setting of environment of FacesServlet(controller)

python100本ノックのメモ用markdown

vimの基本操作・忘れやすいもの

  • o: go to insert mode at new line
  • gg: go to begining of file
  • dw: delete word to right side
  • yy: copy one line
  • p: paste buffer
  • ctrl+r: redo
  • /(スラッシュ)検索したい言葉:検索(まずはenter押す、nで次へ移動)
  • :s/old/new : 置換(oldをnewに)
  • :s/old/new/g : その一行で全部置換
  • :%s/old/new/gc:そのファイル全部で置換(c:一回ずつ確認を求める)

ここで使うmarkdownの記法

  • 見出し(強調): # 増えるほど強調できる
  • 太字:"**"で囲む(または__)
  • イタリック:"*"で囲む(または_)
  • リンク:表示名
  • シンタックスハイライト:言語で囲む
  • 改行:
  • 順序付きリスト: (空行) 1.(空白)リスト1 1.(空白)リスト2 (空行)

  • 順序無し(・)リスト: (空行) +(or-or)(空白)リストA +(or-or)(空白)リストB (空行)

  • 一部だけコードハイライト gccの例:gcc hello.c

pythonの文法