[PR] カード 比較

bundle update mimemagic

Fetching gem metadata from https://rubygems.org/.......
Your bundle is locked to mimemagic (0.3.3), but that version could not be found
in any of the sources listed in your Gemfile. If you haven't changed sources,
that means the author of mimemagic (0.3.3) has removed it. You'll need to update
your bundle to a version other than mimemagic (0.3.3) that hasn't been removed
in order to install.


bundle update mimemagic

read more

Rails6 select2 導入

$ yarn add tempusdominus-bootstrap-4
$ yarn add jquery
$ yarn add jquery-ui
$ yarn add select2

import 'bootstrap'
import "../stylesheets/application"
import 'jquery-ui/themes/base/core.css';
import 'jquery-ui/themes/base/menu.css';
import 'jquery-ui/themes/base/autocomplete.css';
import 'jquery-ui/themes/base/theme.css';
import 'select2/dist/css/select2.css';

@import 'bootstrap';
@import "~tempusdominus-bootstrap-4/src/sass/tempusdominus-bootstrap-4";

<select id="multiple" class="multiple" multiple="multiple">
<option value="value1">value1</option>
<option value="value2">value2</option>
<option value="value3">value3</option>
<option value="value4">value4</option>
<option value="value5">value5</option>

$(function () {
placeholder: 'Please Select',
allowClear: true,
dropdownAutoWidth: true,
width: 'auto',
multiple: true


read more

Ruby Devise 最終アクティブ時間の記録

Devise モデルじゃなくてもいいかもしれないけど・・・

カラム last_active_at datetime型をテーブルに追加

こんなふうにしてアクティ時間を更新させたいタイミングで touch メソッドを呼ぶ

class ApplicationController
before_filter :record_user_activity


def record_user_activity
if current_user
current_user.touch :last_active_at

read more

Apache Django連携


WSGIScriptAlias / path to project/project/wsgi.py
WSGIPythonPath path to project
WSGIPassAuthorization On

<Directory path to project/project/>
<Files wsgi.py>
Require all granted

Alias /static/ /path to project/app/static/
<Directory path to project/app/static>
Require all granted

read more

Django Basic 認証実装

# pip install wsgi-basic-auth
# pip install django_environ

.env ファイル作成してid, password を記述

wsgi.py 修正

import os
from django.core.wsgi import get_wsgi_application
from wsgi_basic_auth import BasicAuth
import environ
env = environ.Env()
env.read_env('path to .env')

#application = get_wsgi_application()
application = BasicAuth(get_wsgi_application())

Apache 側には WSGIPassAuthorization On をつける

read more

ModuleNotFoundError: No module named 'six'

# firewall-cmd --add-port=8000/tcp --zone=public --permanent
Traceback (most recent call last):
File "/usr/bin/firewall-cmd", line 31, in
from firewall.client import FirewallClient, FirewallClientIPSetSettings, \
File "/usr/lib/python3.6/site-packages/firewall/client.py", line 29, in
import slip.dbus
File "/usr/lib/python3.6/site-packages/slip/dbus/__init__.py", line 8, in
from . import service
File "/usr/lib/python3.6/site-packages/slip/dbus/service.py", line 30, in
from six import with_metaclass

ModuleNotFoundError: No module named 'six'

cp /usr/local/lib/python3.6/site-packages/six.py /usr/lib/python3.6/site-packages/

read more

Python plotlyでのグラフPDF出力 前準備

plotly, psutil, electron, orca が必要

# pip install plotly psutil
# npm install -g electron@1.8.4 orca --unsafe-perm=true --allow-root

Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/electron/.electron'

read more

Python Apache 連携

# dnf -y install python3-mod_wsgi
# pip install mod-wsgi
# pip install mod-wsgi-httpd
# vi /etc/httpd/conf/httpd.conf

AddHandler wsgi-script .py
AddHandler wsgi-script .wsgi

Options +ExecCGI にしておくこと

# systemctl restart httpd.service


def application(environ, start_response):
status = '200 OK'
html = '<html>\n' \
'<body>\n' \
'<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">\n' \
'WSGI テストページ\n' \
'</div>\n' \
'</body>\n' \
response_header = [('Content-type','text/html')]
return [html]

read more

Swift Socket.IO サーバーに接続できない場合

node,js の sockect.io のバージョンが原因であるかもしれない。


npm install express@4.16.3
npm install socket.io@2.1.0


read more

An error occurred while installing mysql2 (0.4.10), and Bundler cannot continue. Make sure that `gem install mysql2 -v '0.4.10' --source 'https://rubygems.org/'` succeeds before bundling.

bundle install できない場合

$ brew info openssl
$ export LDFLAGS="-L/usr/local/opt/openssl/lib"
$ export CPPFLAGS="-I/usr/local/opt/openssl/include"
$ bundle config --local build.mysql2 "--with-cppflags=-I/usr/local/opt/openssl/include"
$ bundle config --local build.mysql2 "--with-ldflags=-L/usr/local/opt/openssl/lib"

$ bundle install --path vendor/bundle

read more

Recent entry


Tag Cloud

Page Top