Category Archives: IT

「jquery入門」addClass()で要素にクラスを追加する

サンプル1
$(document).ready(function () {
$(“:image”).addClass(“cft-css”);
});

 

サンプル2
$(“button”).click(function(){
$(“p:first”).addClass(“cftintro”);
});

CentOS7にnginx1.13.4をインストールする手順

1.nginxパッケージのダウンロード
#wget http://nginx.org/download/nginx-1.13.4.tar.gz

2.解凍
#tar xzvf nginx-1.13.4.tar.gz

3.コンパイルインストール
#./configure –prefix=/usr/local/nginx-1.13.4 && make && make install

4.設定ファイルをバックアップ
#cd /usr/local/nginx-1.13.4 && cp nginx.conf nginx.conf.bak

5.nginxの操作
起動
/usr/local/nginx-1.13.4/sbin/nginx -c /usr/local/nginx-1.13.4/conf/nginx.conf &リロード
/usr/local/nginx-1.13.4/sbin/nginx -s reload
停止
/usr/local/nginx-1.13.4/sbin/nginx -s stop

CentOS7.3にphp-mcrypt5.4.16をインストールする

# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)

# wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-10.noarch.rpm

# sudo rpm -ivh epel-release-7-10.noarch.rpm
Preparing… ################################# [100%]
Updating / installing…
1:epel-release-7-10 warning: /etc/yum.repos.d/epel-testing.repo created as /etc/yum.repos.d/epel-testing.repo.rpmnew
warning: /etc/yum.repos.d/epel.repo created as /etc/yum.repos.d/epel.repo.rpmnew
################################# [100%]

 

# sudo yum install –enablerepo=epel php-mcrypt
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* epel: ftp.riken.jp
* remi-safe: mirrors.mediatemple.net
Resolving Dependencies
–> Running transaction check
—> Package php-mcrypt.x86_64 0:5.4.16-7.el7 will be installed
–> Processing Dependency: libmcrypt.so.4()(64bit) for package: php-mcrypt-5.4.16-7.el7.x86_64
–> Running transaction check
—> Package libmcrypt.x86_64 0:2.5.8-13.el7 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
php-mcrypt x86_64 5.4.16-7.el7 epel 20 k
Installing for dependencies:
libmcrypt x86_64 2.5.8-13.el7 epel 99 k

Transaction Summary
================================================================================
Install 1 Package (+1 Dependent package)

Total download size: 119 k
Installed size: 331 k
Is this ok [y/d/N]: y
Downloading packages:
(1/2): libmcrypt-2.5.8-13.el7.x86_64.rpm | 99 kB 00:00
(2/2): php-mcrypt-5.4.16-7.el7.x86_64.rpm | 20 kB 00:00
——————————————————————————–
Total 432 kB/s | 119 kB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Installing : libmcrypt-2.5.8-13.el7.x86_64 1/2
Installing : php-mcrypt-5.4.16-7.el7.x86_64 2/2
Verifying : libmcrypt-2.5.8-13.el7.x86_64 1/2
Verifying : php-mcrypt-5.4.16-7.el7.x86_64 2/2

Installed:
php-mcrypt.x86_64 0:5.4.16-7.el7

Dependency Installed:
libmcrypt.x86_64 0:2.5.8-13.el7

php5.6をインストールするメモ

1.古いphpをアンインストール
$ sudo yum remove php-*

2.パッケージをインストール
$ wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
$ rpm -ivh remi-release-6.rpm
phpをインストール
php v5.6
$ sudo yum install –enablerepo=remi-php56 php

Windows10にWifiのプロファイルを削除するメモ

1.Windows10のスタートメニューの「設定」を選択します

2.「ネットワークとインターネット」を選択します

3.Wifiを選択します

4.既知のネットワークの管理を選択します

5.「BUFFALO-XXX-A」を削除

「postfix」ポート465(smtps)を有効にするメモ

#vim /etc/postfix/master.cf

修正前
#smtps inet n – n – – smtpd

修正後
smtps inet n – n – – smtpd

#systemctl restart postfix

CentOS7.2(postfix)にmailコマンドでgmailを送信するメモ

1.cyrus saslインストール
#sudo yum install cyrus-sasl-plain

2.main.cfの設定
#vim /etc/postfix/main.cf
追記
relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
smtp_sasl_mechanism_filter = plain
smtp_use_tls = yes

3.パスワードファイルの設定
#vim /etc/postfix/sasl_passwd
追記
[smtp.gmail.com]:587 xxxxx@gmail.com:PASSWORD
#sudo postmap /etc/postfix/sasl_passwd
#sudo chmod 600 sasl_passwd

 

4.postfix再起動
#systemctl restart postfix

5.送信コマンド
#echo “本文” | mail -s “件名” xxxxx@gmail.com

「Postfix」バージョン確認と設定内容を操作するメモ

1.Postfixのバージョン確認
# postconf | grep mail_version
mail_version = 2.10.1
milter_macro_v = $mail_name $mail_version

2.Postfixの設定表示
# /usr/sbin/postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
html_directory = no
inet_interfaces = all
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
relayhost = [xxxxx]
sample_directory = /usr/share/doc/postfix-2.10.1/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_tls_cert_file = /etc/postfix/server.crt
smtpd_tls_key_file = /etc/postfix/server.key
unknown_local_recipient_reject_code = 550

3.設定ファイル
#cat /etc/postfix/main.cf

4.プロセス確認
# ps -ef | grep postfix
root 104650 1 0 12:43 ? 00:00:00 /usr/libexec/postfix/master -w
postfix 104652 104650 0 12:43 ? 00:00:00 qmgr -l -t unix -u
postfix 104658 104650 0 12:43 ? 00:00:00 tlsmgr -l -t unix -u
postfix 108096 104650 0 19:23 ? 00:00:00 pickup -l -t unix -u
root 108139 107890 0 19:28 pts/0 00:00:00 grep –color=auto postfix

SQLServerでテーブルの作成、データ挿入、PROCEDUREの作成操作方法

1.テーブルを作成(table create)
CREATE TABLE employee(
id INTEGER NOT NULL PRIMARY KEY,
first_name VARCHAR(10),
last_name VARCHAR(10),
salary DECIMAL(10,2),
start_Date DATETIME,
region VARCHAR(10),
city VARCHAR(20),
managerid INTEGER
);
2.データの挿入(insert)
1> INSERT INTO employee VALUES (1, ‘二郎’ , ‘山田’, 20,’2015-03-22′,’関東’,’川崎’,3);
2> GO

(1 rows affected)
1> INSERT INTO employee VALUES (2, ‘太郎’, ‘佐藤’,30,’2013-07-21′,’西日本’,’福岡’,4);
2> GO

(1 rows affected)
1> INSERT INTO employee VALUES (3, ‘太郎’ , ‘金沢’, 40,’2011-12-01′,’関東’,’埼玉’,5);
2> GO

(1 rows affected)
1> INSERT INTO employee VALUES (4, ‘太郎’ , ‘鈴木’, 50,’2016-03-03′,’西日本’,’東京’,6);
2> GO

(1 rows affected)
3.テーブルのクエリー(select)
select * from employee;

4.ストアド プロシージャの作成
CREATE PROCEDURE InstOrUpdateTran
@FirstName nVarChar(50),
@LastName nVarChar(25),
@Salary Money
AS
IF EXISTS(SELECT * From Employee Where First_name = @FirstName)
UPDATE Employee SET Last_NAME = @LastName, Salary = @Salary
WHERE First_name = @FirstName
ELSE
INSERT INTO Employee (ID,First_Name, Last_Name, Salary)
SELECT 99, @FirstName, @LastName, @Salary
5.テーブルの削除
drop table employee;

SQL Serverで日付と時刻をフォーマットする方法

DECLARE @dt datetime
SET @dt=GETDATE()

1.yyyy-m-d
SELECT REPLACE(CONVERT(varchar(10),@dt,120),N’-0′,’-‘)
  
2.yyyy年mm月dd日
方法1
SELECT STUFF(STUFF(CONVERT(char(8),@dt,112),5,0,N’年’),8,0,N’月’)+N’日’

方法2
SELECT DATENAME(Year,@dt)+N’年’+DATENAME(Month,@dt)+N’月’+DATENAME(Day,@dt)+N’日’

3.yyyy年m月d日
SELECT DATENAME(Year,@dt)+N’年’+CAST(DATEPART(Month,@dt) AS varchar)+N’月’+DATENAME(Day,@dt)+N’日’
4.yyyy-mm-dd hh:mi:ss:mmm
SELECT CONVERT(char(11),@dt,120)+CONVERT(char(12),@dt,114)