<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>shawzt (shawzt)</title>
    <link>https://ruby-china.org/shawzt</link>
    <description></description>
    <language>en-us</language>
    <item>
      <title>[请教] Atom Slim 缩进问题</title>
      <description>&lt;p&gt;最近在尝试学习和使用&lt;a href="http://slim-lang.com/" rel="nofollow" target="_blank" title=""&gt;Slim&lt;/a&gt;，碰到了社区讨论中的缩进问题，在 Atom 中一直没有解决。请教各位，&lt;strong&gt;如何在书写 slim 代码时，Atom 能够自动缩进？&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;以下是我使用的工具及安装的插件.
&lt;strong&gt;工具：&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Atom&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;插件：&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://atom.io/packages/language-slim" rel="nofollow" target="_blank" title=""&gt;language-slim&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://atom.io/packages/linter-slim" rel="nofollow" target="_blank" title=""&gt;linter-slim&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://atom.io/packages/linter" rel="nofollow" target="_blank" title=""&gt;linter&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;~
谢谢&lt;/p&gt;</description>
      <author>shawzt</author>
      <pubDate>Fri, 25 Dec 2015 13:04:47 +0800</pubDate>
      <link>https://ruby-china.org/topics/28520</link>
      <guid>https://ruby-china.org/topics/28520</guid>
    </item>
    <item>
      <title>PostgreSQL 安装和基本使用</title>
      <description>&lt;p&gt;PostgreSQL 是一个强大的，开源的对象 - 关系型数据库管理系统。由 Berkeley 出品的它，起源可以追溯到 1986 年，近 20 年的发展使它逐渐成为数据库领域新的选择。
越来越多的商业或开源项目已选择 PostgreSQL 作为其数据库管理系统，&lt;a href="http://www.postgresql.org/about/users/" rel="nofollow" target="_blank" title=""&gt;可参考官方说明&lt;/a&gt;，关于 PostgreSQL 的功能及特性请阅读&lt;a href="http://www.postgresql.org/about/" rel="nofollow" target="_blank" title=""&gt;官方介绍&lt;/a&gt;。&lt;/p&gt;

&lt;p&gt;不啰嗦，进入实际操作环节。&lt;/p&gt;
&lt;h4 id="安装指南"&gt;安装指南&lt;/h4&gt;
&lt;p&gt;PostgreSQL 支持*Unix 及 Windows 操作系统，这里以 Mac OSX 为例，其他系统的安装指南见&lt;a href="http://www.postgresql.org/download/" rel="nofollow" target="_blank" title=""&gt;官方说明&lt;/a&gt;。&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Homebrew&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;安装 Homebrew，&lt;a href="http://brew.sh/" rel="nofollow" target="_blank" title=""&gt;移步官网&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;brew update&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;brew install postgresql&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;安装过程:
&lt;img src="https://l.ruby-china.com/photo/2015/67919c6b5846d130a83292fb5d637f7a.png" title="" alt="安装过程:"&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Postgres.app&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;同样简单易操作，具体请&lt;a href="http://postgresapp.com/" rel="nofollow" target="_blank" title=""&gt;参见说明&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="基本操作"&gt;基本操作&lt;/h4&gt;
&lt;p&gt;PostgreSQL 安装好后，其会自动以本机当前登录用户名创建三个数据库 (Schema)，你可以运行以下命令查看：&lt;code&gt;psql -l&lt;/code&gt;。&lt;br&gt;
&lt;strong&gt;psql 是 PostgreSQL 的交互式命令行工具&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;连接数据库&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;psql -d DBname -h Hostname -p Port -U Username&lt;/code&gt; =&amp;gt; 指定参数连接&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;psql postgres&lt;/code&gt; =&amp;gt; 连接当前用户名下的 postgres 数据库&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;创建用户&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;连接数据库 &lt;code&gt;psql postgres&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;创建用户   &lt;code&gt;CREATE USER username [WITH PASSWORD 'password'];&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;创建数据库&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CREATE DATABASE dbname;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;授权&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;授予所有权限 &lt;code&gt;GRANT ALL PRIVILEGES ON DATABASE dbname to username;&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;授予查询权限 &lt;code&gt;GRANT SELECT ON DATABASE dbname to username;&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;权限列表 &lt;code&gt;SELECT&lt;/code&gt; &lt;code&gt;INSERT&lt;/code&gt; &lt;code&gt;UPDATE&lt;/code&gt; &lt;code&gt;DELETE&lt;/code&gt; &lt;code&gt;RULE&lt;/code&gt; &lt;code&gt;REFERENCES&lt;/code&gt; &lt;code&gt;TRIGGER&lt;/code&gt; &lt;code&gt;CREATE&lt;/code&gt; &lt;code&gt;TEMPORARY&lt;/code&gt; &lt;code&gt;EXECUTE&lt;/code&gt; &lt;code&gt;USAGE&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;常用命令&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;连接数据库 &lt;code&gt;psql postgres&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;列出所有数据库 &lt;code&gt;postgres=# \l&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;列出用户 &lt;code&gt;postgres=# \du&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;列出数据表 &lt;code&gt;postgres=# \dt&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;描述数据表 &lt;code&gt;postgres=# \d tablename&lt;/code&gt;&lt;br&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img title=":bell:" alt="🔔" src="https://twemoji.ruby-china.com/2/svg/1f514.svg" class="twemoji"&gt; &lt;strong&gt;postgres=#&lt;/strong&gt; 为命令行提示符 &lt;/p&gt;
&lt;h4 id="GUI工具"&gt;GUI 工具&lt;/h4&gt;
&lt;p&gt;虽然在命令行下我们可以完成几乎所有的操作，但是 GUI 工具也有需要的。
这里给大家推荐两个“颜值”还不错的 Mac APP: &lt;strong&gt;&lt;a href="https://eggerapps.at/postico/" rel="nofollow" target="_blank" title=""&gt;Postico&lt;/a&gt;&lt;/strong&gt; 和 &lt;strong&gt;&lt;a href="http://www.psequel.com/" rel="nofollow" target="_blank" title=""&gt;PSequel&lt;/a&gt;&lt;/strong&gt;。&lt;/p&gt;

&lt;p&gt;&lt;img title=":smile:" alt="😄" src="https://twemoji.ruby-china.com/2/svg/1f604.svg" class="twemoji"&gt; &lt;code&gt;初次发帖，还请多多关照.&lt;/code&gt;&lt;/p&gt;</description>
      <author>shawzt</author>
      <pubDate>Sat, 18 Jul 2015 16:01:31 +0800</pubDate>
      <link>https://ruby-china.org/topics/26551</link>
      <guid>https://ruby-china.org/topics/26551</guid>
    </item>
    <item>
      <title>Ruby 1.8.7 delete_if 抛错 can't modify frozen array</title>
      <description>&lt;p&gt;代码 &lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;features&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;delete_if&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;switch_false&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;include?&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;求解，delete_if 怎么会出现 can't modify frozen array 这样的错误&lt;/p&gt;

&lt;p&gt;求帮助？&lt;/p&gt;</description>
      <author>shawzt</author>
      <pubDate>Wed, 30 Oct 2013 21:28:34 +0800</pubDate>
      <link>https://ruby-china.org/topics/15168</link>
      <guid>https://ruby-china.org/topics/15168</guid>
    </item>
  </channel>
</rss>
