Category: Programming

pivot sql server

SELECTSELECT R.UserID, R.RoleIDFROM User_Role R;
DECLARE @cols AS NVARCHAR(MAX),    @query  AS NVARCHAR(MAX)
select @cols = STUFF((SELECT DISTINCT ‘,’ + QUOTENAME(RoleID)                     from User_Role                    group by UserID,RoleID            FOR XML PATH(”), TYPE            ).value(‘.’, ‘NVARCHAR(MAX)’)         ,1,1,”)
set @query = ‘SELECT ‘ + @cols + ‘ from              (                select UserID,RoleID                from User_Role            ) x            pivot             (                UserID                for RoleID in (‘ + @cols + ‘)            ) p ‘
execute(@query);
select * from yourtable

Advertisements

Centos 7 , php 5.6 , mysql, vagrant

[root@localhost ~]# history
1  yum install httpd
2  yum search php
3  sudo apachectl restart
4  yum install php56w
5  yum install php56u
6  rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
7  rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
8  yum -y install php56w php56w-opcache
9  yum -y install php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mys                                                                                                                ql php56w-intl php56w-mbstring
10  sudo apachectl restart
11  php -v
12  httpd -v
13  exit
14  cd /home
15  cd/Demo
16  cd Demo
17  ls
18  chmod 644 index.php
19  sudo apachectl restart
20  nano /etc/sysconfig/selinux
21  vim /etc/sysconfig/selinux
22  vi /etc/sysconfig/selinux
23  sestatus
24  setenforce 0
25  sudo apachectl restart
26  exit
27  mysql -v
28  yum remove php56w-mysql
29  yum remove php56w-mysqlnd
30  yum remove php5-mysqlnd
31  yum install php-mysqlnd
32  yum remove php-common
33  yum install php-mysqlnd
34  apachectl restart
35  php -v
36  sudo php -v
37  yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd p                                                                                                                hp56w-devel php56w-intl php56w-mbstring
38  yum remove php
39  yum remove php-mysqlnd
40  yum remove php-common
41  yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd p                                                                                                                hp56w-devel php56w-intl php56w-mbstring
42  y
43  apachectl restart
44  php -v
45  mysql -v
46  yum install php56-mysql
47  yum install php56w-mysql
48  yum install php56w-mysqlnd
49  apachectl restart
50  pecl install xdebug
51  yum install pecl
52  yum install php54w-pear
53  yum install php56w-pear
54  yum install gcc gcc-c++ autoconf automake
55  pecl install Xdebug
56  apachectl restart
57  yum install java-1.7.0-openjdk
58  yum remove java-1.7.0-openjdk
59  apachectl stop
60  exit
61  apachectl restart
62  getenforce
63  setenforce 0
64  getenforce
65  yum -y install mysql-community-server
66  rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rp                                                                                                                m
67  yum -y install mysql-community-server
68  /usr/bin/systemctl enable mysqld
69  /usr/bin/systemctl start mysqld
70  service mysqld restart
71  /usr/bin/mysql_secure_installation
72  firewall-cmd  –reload
73  mysql -u root -p root
74  mysql -u root -p mysql
75  service mysqld restart
76  apachectl restart
77  install php5-mysqlnd
78  yum install php5-mysqlnd
79  yum install php56w-mysqlnd
80  yum install php56w-mysqlnd56
81  yum install php-mysqlnd
82  php -m | grep -i php
83  php -i | grep “php”
84  yum info php-fpm
85  yum info php-
86  yum search php
87  yum search php54w
88  yum install php56w-mysqlnd
89  yum install php56w-mysqlnd –skip-broken
90  apachectl restart
91  yum install php-mysqlnd-5.4.16-23.el7_0.3.x86_64
92  yum install php-mysqlnd-5.6.16-23.el7_0.3.x86_64
93  yum install php56w-mysqlnd-5.6.16-23.el7_0.3.x86_64
94  mysql -v
95  su root
96  exit
97  su root
98  exit
99  history

Build Sass in Sublime text 3

  • Install Ruby (nho chọn tuy chon add to PATH variable)
  • restart computer
  • go lenh: gem install sass de cài sass
  • Neu compile bang ruby thi run: sass –watch style.scss:style.css (nho cd vao path sass folder)
  • Cai Libsassbuild
  • Tools-> Libsassbuild -> edit project config:
    •    Pass text:{
      “output”: {
      “dir”: “../../assets/css/”,
      “structure”: “flat”
      },
      “compile”: {
      “line-comments”: false,
      “line-numbers”: true,
      “style”: “nested”
      }
      }
    • Save as lai nhu hinh:
    • untitled
  • Muon build tu dong khi save thi can them plugin: SublimeOnSaveBuild

 

Mac dinh khi sua file partial(file duoc imported) => Build => se sinh ra file partial css tuong ung. Muon ngan chan cai nay thi