2017年10月26日木曜日

cloud9でpython3/djangoを設定

django projectの設定(歯車)から、python2->3にしてから以下を実施

sudo rm /usr/bin/python
sudo ln -s /usr/bin/python3.4 /usr/bin/python  ->ここ3.5を設定したら、djangoが認識してくれなかったとりあえず3.4にした
sudo pip3 install django

以下のコマンドでバージョン確認
python -V
python -m django --version

2017年10月6日金曜日

macにphpmyadminをインストール

brew install phpmyadmin

sudo vi /etc/apache2/httpd.conf  で以下の設定を最後に追加

  Alias /phpmyadmin /usr/local/share/phpmyadmin
  <Directory /usr/local/share/phpmyadmin/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    <IfModule mod_authz_core.c>
      Require all granted
    </IfModule>
    <IfModule !mod_authz_core.c>
      Order allow,deny
      Allow from all
    </IfModule>
  </Directory>

sudo apachectl restart

参考:https://soarcode.jp/posts/55

2017年9月26日火曜日

cloud9で.netを使用

cloud9にBlankのworkspaceを作成してから、shellで以下のコマンドを実行。


curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-trusty-prod trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-get update
sudo apt-get install dotnet-sdk-2.0.0

確認するには、dotnetの情報を表示。
dotnet --info

Web APPを作成
dotnet new razor -o app
或いは、
mkdir app
cd app
dotnet new mvc

cloud9にアクセスできるように、Program.csを変更

public static IWebHost BuildWebHost(string[] args) =>
            WebHost.CreateDefaultBuilder(args)
                .UseStartup<Startup>()
                .UseUrls("http://0.0.0.0:8080") //この行を追加
                .Build();

変更後のBuild
cd app
dotnet build
dotnet run

そして、通常のcloud9 app URLにアクセスすればOK

参考:https://www.youtube.com/watch?v=ioSeIpphmAA

2017年8月16日水曜日

Laravelにおけるviewに変数を渡す方法

viewのwelcomeに変数$nameを渡すには、以下の方法がある

1)
Route::get('/', function () {
    return view('welcome', ['name' => 'World',
    ]);
});

2)
Route::get('/', function () {
    return view('welcome')->with('name', 'World');
});

3)
Route::get('/', function () {
 $name = 'World';
    $age = 42;

    return view('welcome', ['name' => $name,
                                           'age' => $age,
    ]);
    //same with, return view('welcome',  compact('name', 'age'));
});

Route::get('/', function () {
    $tasks = [
        'qwe',
        'asd',
        'zxc'
    ];

    return view('welcome', compact('tasks'));
});

shellの$()

tplList.txtに保存するfile listを対象にgrepしたい。

grep -i "href" $(cat tplList.txt)
$()の意味は``と同じ、実行結果をgrepに渡す

valetの使い方

Valet is a Laravel development environment for Mac minimalists. No Vagrant, no /etc/hosts file. 
Laravel Valet configures your Mac to always run Nginx in the background when your machine starts. 
Then, using DnsMasq, Valet proxies all requests on the *.dev domain to point to sites installed on your local machine.


インストールには
composer global require laravel/valet
valet install

valetが正しくインストールされているかどうかを確認するには、任意の.dev domianをpingしてみる
ping foo.dev

valetがサイトを探す時のpathを指定
mkdir lara
cd lara
valet park

larval new blog
blog.dev にアクセスすると、laravelの画面が出る

httpsを有効にする
valet secure blog

httpsを有効から無効にする
valet unsecure blog

2017年6月8日木曜日

remote desktop login in できない件

ADのユーザー設定に「test1」に「Remote Desktop Users」グループを追加したが、domain controllersにremote loginしようとしても入れない。

domain controllersの「Local Security Policy」→「Local Policies」→「User Rights Assignment」→「Allow log on through Remote Desktop Services」を確認したところ、domain controllersにremote loginの場合、デフォルトAdministratorsメンバーのみできる