-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathatom.xml
586 lines (491 loc) · 32 KB
/
atom.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><![CDATA[a Code Farmer]]></title>
<link href="http://sabonis.github.io/atom.xml" rel="self"/>
<link href="http://sabonis.github.io/"/>
<updated>2015-05-17T13:30:00+08:00</updated>
<id>http://sabonis.github.io/</id>
<author>
<name><![CDATA[Sabonis]]></name>
</author>
<generator uri="http://octopress.org/">Octopress</generator>
<entry>
<title type="html"><![CDATA[たのしいRuby 第4版 Reading Notes 0]]></title>
<link href="http://sabonis.github.io/blog/2015/05/03/tafalsesiiruby-di-4ban/"/>
<updated>2015-05-03T12:30:48+08:00</updated>
<id>http://sabonis.github.io/blog/2015/05/03/tafalsesiiruby-di-4ban</id>
<content type="html"><![CDATA[<p><img src="http://sabonis.github.io/images/myImage/ruby_v4.jpg" width="300" height="225"></p>
<p>I bought it three months ago, but never read it once since then.
It is a Chinese-translated edition, because the original book is
written in Japanese, which I am totally not familiar with, not
even a word.
I gonna to read it, write some notes and hope finish this
book in not very long time.</p>
<h2>Basics</h2>
<p>“Hello World” is always a best friend of novice.<br/>
I am going to begin my journey of ruby with its basic output functions.</p>
<h3>Standard outputs</h3>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="cm">=begin</span>
</span><span class='line'><span class="cm">ruby style's multi-line comments.</span>
</span><span class='line'><span class="cm">=end</span>
</span><span class='line'>
</span><span class='line'><span class="nb">print</span><span class="p">(</span><span class="s2">"Hello World</span><span class="se">\n</span><span class="s2">"</span><span class="p">);</span> <span class="c1">#=> Hello World</span>
</span><span class='line'><span class="c1"># note: semicolon is not nesessary. ruby is not JAVA</span>
</span><span class='line'>
</span><span class='line'><span class="nb">puts</span><span class="p">(</span><span class="s1">'Hello World'</span><span class="p">)</span> <span class="c1">#=> Hello World</span>
</span><span class='line'><span class="c1"># Same as above except "\n" is automatically added at the end of string.</span>
</span><span class='line'>
</span><span class='line'><span class="nb">p</span><span class="p">(</span><span class="s1">'Hello World'</span><span class="p">)</span> <span class="c1">#=> 'Hello World'</span>
</span><span class='line'><span class="c1"># "p()" is simply output data in its natrual literal form.</span>
</span></code></pre></td></tr></table></div></figure>
<h3>Standard outputs revisited</h3>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="n">a</span> <span class="o">=</span> <span class="s1">'World'</span>
</span><span class='line'>
</span><span class='line'><span class="nb">print</span><span class="p">(</span><span class="s2">"Hello "</span><span class="p">,</span> <span class="n">a</span><span class="p">,</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="p">)</span>
</span><span class='line'><span class="nb">print</span><span class="p">(</span><span class="s2">"Hello </span><span class="si">#{</span><span class="n">a</span><span class="si">}</span><span class="se">\n</span><span class="s2">"</span><span class="p">)</span>
</span><span class='line'><span class="nb">puts</span><span class="p">(</span><span class="s2">"Hello </span><span class="si">#{</span><span class="n">a</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span>
</span><span class='line'><span class="c1">#=> Hello World</span>
</span><span class='line'><span class="c1"># Three of above have no differences.</span>
</span></code></pre></td></tr></table></div></figure>
<h3>Loops</h3>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="p">(</span><span class="mi">10</span><span class="o">.</span><span class="n">times</span> <span class="k">do</span> <span class="o">|</span><span class="n">i</span><span class="o">|</span>
</span><span class='line'> <span class="nb">print</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>
</span><span class='line'><span class="k">end</span><span class="p">)</span><span class="o">.</span><span class="n">times</span> <span class="k">do</span>
</span><span class='line'> <span class="nb">print</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>
</span><span class='line'><span class="k">end</span>
</span><span class='line'><span class="c1">#=> 01234567890123456789</span>
</span></code></pre></td></tr></table></div></figure>
<p>What?<br/>
Yes, that’s a use of chain rule, as <a href="http://ruby-doc.org/core-2.2.2/Integer.html#method-i-times"><code>times</code></a>
is a function that return itself, which is 10.
10 is a instance of <a href="http://ruby-doc.org/core-2.2.2/Fixnum.html"><code>Fixnum</code></a>
, which is also a subclass of <code>Integer</code>.
Let’s take look at the big picture of <code>Numeric</code> class hiearchy in Ruby.<sup id='fninref:1'><a href='#fnin:1' rel='footnote'>1</a></sup></p>
<figure class='code'><figcaption><span>Class Hiearchy</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class='text'><span class='line'>Numeric
</span><span class='line'> -> Integer #-> method "times" lies in.
</span><span class='line'> -> Fixnum #-> where 10 comes from.
</span><span class='line'> -> Bignum
</span></code></pre></td></tr></table></div></figure>
<h3>Everything is object</h3>
<p>That’s ruby, everything is object. Unlike java, there is no primitive type.
You might wondering where <code>print()</code> comes from<sup id='fninref:2'><a href='#fnin:2' rel='footnote'>2</a></sup>.
<code>IO</code> is where it comes from. There are three constant, STDIN, STDOUT and STDERR, which is pointed by
ruby’s global variables, $stdin, $stdout and $sterr respectively.<br/>
<code>print()</code> is a alias of <code>$stdout.print()</code> provided by ruby’s <code>Kernel</code> module.</p>
<figure class='code'><figcaption><span>print() is alias of $stdout.print()</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="vg">$stdout</span><span class="o">.</span><span class="n">print</span><span class="p">(</span><span class="s1">'I am a alias'</span><span class="p">)</span>
</span><span class='line'><span class="c1"># is equivelent to</span>
</span><span class='line'><span class="nb">print</span><span class="p">(</span><span class="s1">'I am a alias'</span><span class="p">)</span>
</span></code></pre></td></tr></table></div></figure>
<h3>Array and Hash</h3>
<p>Beside <code>String</code> and <code>Numeric</code> two basic structure, Ruby has two more advanced data structure -
<code>Array</code> and <code>Hash</code>.
You can think of both as Java’s <code>List</code>and <code>Map</code>.</p>
<figure class='code'><figcaption><span>Array</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="n">names</span> <span class="o">=</span> <span class="o">[</span><span class="s1">'sabonis'</span><span class="p">,</span> <span class="s1">'sprewell'</span><span class="p">,</span> <span class="s1">'shiren'</span><span class="o">]</span>
</span><span class='line'><span class="c1">#=> ['sabonis', 'sprewell', 'shiren']</span>
</span><span class='line'>
</span><span class='line'><span class="n">mix</span> <span class="o">=</span> <span class="o">[</span><span class="s1">'sabonis'</span><span class="p">,</span> <span class="mi">29</span><span class="o">]</span>
</span><span class='line'><span class="c1">#=> Ruby supports different types in one container.</span>
</span><span class='line'>
</span><span class='line'><span class="c1"># Size of array</span>
</span><span class='line'><span class="n">names</span><span class="o">.</span><span class="n">size</span><span class="p">()</span>
</span><span class='line'><span class="c1">#=> 3</span>
</span><span class='line'>
</span><span class='line'><span class="c1"># Iteration</span>
</span><span class='line'><span class="n">names</span><span class="o">.</span><span class="n">each</span> <span class="p">{</span> <span class="o">|</span><span class="n">item</span><span class="o">|</span>
</span><span class='line'> <span class="nb">print</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="s1">''</span><span class="p">)</span>
</span><span class='line'><span class="p">}</span>
</span><span class='line'><span class="c1">#=> sabonis sprewell shiren</span>
</span><span class='line'><span class="c1"># {...} is same as "do ... end" block.</span>
</span></code></pre></td></tr></table></div></figure>
<figure class='code'><figcaption><span>Hash</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="n">address</span> <span class="o">=</span> <span class="p">{</span><span class="ss">:city</span> <span class="o">=></span> <span class="s1">'Taipei'</span><span class="p">,</span> <span class="ss">:country</span> <span class="o">=></span> <span class="s1">'Taiwan'</span><span class="p">}</span>
</span><span class='line'>
</span><span class='line'><span class="c1"># Iteration</span>
</span><span class='line'><span class="n">address</span><span class="o">.</span><span class="n">each</span> <span class="p">{</span><span class="o">|</span><span class="n">key</span><span class="p">,</span> <span class="n">value</span><span class="o">|</span>
</span><span class='line'> <span class="nb">puts</span><span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="s1">' => '</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
</span><span class='line'><span class="p">}</span>
</span><span class='line'><span class="c1">#=> city => Taipei</span>
</span><span class='line'><span class="c1">#=> country => Taiwan</span>
</span></code></pre></td></tr></table></div></figure>
<p><code>:city</code> is a <code>Symbol</code> of ruby, you can think of this as a lightweight
version of <code>String</code>.</p>
<blockquote><p>The same Symbol object will be created for a given name or string for the duration of a program's execution, regardless of the context or meaning of that name.</p><footer><strong>Ruby Reference</strong> <cite><a href='http://ruby-doc.org/core-2.2.0/Symbol.html'>ruby-doc.org/core-2.2.0/…</a></cite></footer></blockquote>
<p>Per doc says, there will be one instance of Symbol with same name till program ended.</p>
<h2>Notes</h2>
<div class="footnotes"><ol><li id='fnin:1'><p>For more information, see <a href="http://ruby-doc.org/core-2.2.2/Numeric.html">Ruby Reference</a> <a href='#fninref:1' rel='reference'>↩</a></p>
</li><li id='fnin:2'><p>See this <a href="https://robots.thoughtbot.com/io-in-ruby">post</a> <a href='#fninref:2' rel='reference'>↩</a></p>
</li></ol></div>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Hello Sinatra]]></title>
<link href="http://sabonis.github.io/blog/2015/04/21/hello-sinatra/"/>
<updated>2015-04-21T23:09:57+08:00</updated>
<id>http://sabonis.github.io/blog/2015/04/21/hello-sinatra</id>
<content type="html"><![CDATA[<h2>The setup</h2>
<p>I choose to take recently most popular technology - Docker as our testing environment.
One of benefit features of docker is that by using Dockerfile we have a descriptive and
vcs-capable system environment, and that makes our life easier when we have migration needs.</p>
<figure class='code'><figcaption><span>Project Structure</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class='sh'><span class='line'>/PROJECT_HOME/
</span><span class='line'>├── Dockerfile
</span><span class='line'>└── myapp.rb
</span><span class='line'>
</span><span class='line'><span class="m">0</span> directories, <span class="m">2</span> files
</span></code></pre></td></tr></table></div></figure>
<p>Easy enough, just two files.</p>
<figure class='code'><figcaption><span>Dockerfile</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
</pre></td><td class='code'><pre><code class='dockerfile'><span class='line'><span class="c"># It’ll need ruby</span>
</span><span class='line'><span class="k">FROM</span> ruby:latest
</span><span class='line'>
</span><span class='line'><span class="k">MAINTAINER</span> sabonis <sabonis.tw@gmail.com>
</span><span class='line'>
</span><span class='line'><span class="c"># The directory our main program` runs on.</span>
</span><span class='line'><span class="k">VOLUME</span> /server
</span><span class='line'>
</span><span class='line'><span class="c"># Relative path in which command executes.</span>
</span><span class='line'><span class="k">WORKDIR</span> /server
</span><span class='line'>
</span><span class='line'><span class="c"># Install sinatra</span>
</span><span class='line'><span class="k">RUN</span> gem install sinatra
</span><span class='line'>
</span><span class='line'><span class="c"># Defaut host of sinatra app is 127.0.0.1,</span>
</span><span class='line'><span class="c"># that is not OK if your server needs port-forwarding.</span>
</span><span class='line'><span class="k">CMD</span> ruby myapp.rb -o 0.0.0.0
</span><span class='line'>
</span><span class='line'><span class="k">EXPOSE</span> <span class="m">4567</span>
</span></code></pre></td></tr></table></div></figure>
<figure class='code'><figcaption><span>myapp.rb</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="c1">#myapp.rb</span>
</span><span class='line'><span class="nb">require</span> <span class="s1">'sinatra'</span>
</span><span class='line'>
</span><span class='line'><span class="n">get</span> <span class="s1">'/'</span> <span class="k">do</span>
</span><span class='line'> <span class="s1">'Hello world!'</span>
</span><span class='line'><span class="k">end</span>
</span></code></pre></td></tr></table></div></figure>
<h2>The Hello</h2>
<figure class='code'><figcaption><span>Console</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="c"># Build dockerfile to docker image.</span>
</span><span class='line'>sudo docker build -t YOUR_NAME/sinatra
</span><span class='line'>
</span><span class='line'><span class="c"># Run the image.</span>
</span><span class='line'>sudo docker run -dp 80:4567 <span class="se">\</span>
</span><span class='line'> -v <span class="sb">`</span><span class="nb">pwd</span><span class="sb">`</span>:/server <span class="se">\</span>
</span><span class='line'> YOUR_NAME/sinatra
</span><span class='line'>
</span><span class='line'><span class="c"># Test whether it works.</span>
</span><span class='line'>curl localhost
</span><span class='line'>Hello world!%
</span><span class='line'><span class="c">#It works.</span>
</span></code></pre></td></tr></table></div></figure>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Octopress on Cygwin]]></title>
<link href="http://sabonis.github.io/blog/2014/04/28/octopress-on-cygwin/"/>
<updated>2014-04-28T13:36:16+08:00</updated>
<id>http://sabonis.github.io/blog/2014/04/28/octopress-on-cygwin</id>
<content type="html"><![CDATA[<p>It is painful when you are forced to use Windows as your programming environment.
But there comes a rescuer Cygwin. With Cygwin, you have almost all tools that Unix
have if install properly.</p>
<p>comment out following these lines</p>
<figure class='code'><figcaption><span>In the Rakefile </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'> <span class="c1">#if (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil</span>
</span><span class='line'> <span class="c1">#puts '## Set the codepage to 65001 for Windows machines'</span>
</span><span class='line'> <span class="c1">#`chcp 65001`</span>
</span><span class='line'> <span class="c1">#end</span>
</span></code></pre></td></tr></table></div></figure>
<p>or you will get failed in the process of <code>rake generate</code></p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[LAMP on ARCH]]></title>
<link href="http://sabonis.github.io/blog/2013/11/30/lamp-on-arch/"/>
<updated>2013-11-30T12:11:00+08:00</updated>
<id>http://sabonis.github.io/blog/2013/11/30/lamp-on-arch</id>
<content type="html"><![CDATA[<p>If you are a web developer, you got to have these packages to be deployed on your ARCH.
Those who use Windows, just keep playing CIVILIZATION V, no bothers.</p>
<p>Here is how</p>
<h2>Installing part</h2>
<figure class='code'><figcaption><span>Console </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="c"># update all packages</span>
</span><span class='line'>pacman -Syu<span class="p">;</span>
</span><span class='line'>pacman -S apache php php-apache mariadb
</span></code></pre></td></tr></table></div></figure>
<h2>Configuring part</h2>
<figure class='code'><figcaption><span>Console </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>vi /etc/httpd/conf/httpd.conf
</span><span class='line'><span class="c"># append following entries</span>
</span><span class='line'>LoadModule php5_module modules/libphp5.so
</span><span class='line'>AddHandler php5-script php
</span><span class='line'>Include conf/extra/php5_module.conf
</span><span class='line'>
</span><span class='line'>vi /etc/php/php.ini
</span><span class='line'><span class="c"># uncomment this line</span>
</span><span class='line'><span class="nv">extension</span><span class="o">=</span>mysqli.so
</span><span class='line'>
</span><span class='line'><span class="c"># setup mariadb, this is a interactive command, just follow the instruction</span>
</span><span class='line'>sudo mysql_secure_installation
</span><span class='line'>
</span><span class='line'><span class="c"># enable httpd at start-up</span>
</span><span class='line'>sudo systemctl <span class="nb">enable </span>httpd <span class="o">&&</span> systemctl restart httpd
</span></code></pre></td></tr></table></div></figure>
<p>and we are done here.</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Sad]]></title>
<link href="http://sabonis.github.io/blog/2013/10/30/sad/"/>
<updated>2013-10-30T01:46:00+08:00</updated>
<id>http://sabonis.github.io/blog/2013/10/30/sad</id>
<content type="html"><![CDATA[<p>shoot,
after <code>yaourt -Syu</code>,
gnome is dead.
I use LXDE now.
but I want try gnome 3.10.
so sad.</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Fingerprint in Arch Linux]]></title>
<link href="http://sabonis.github.io/blog/2013/09/22/fingerprint/"/>
<updated>2013-09-22T03:32:00+08:00</updated>
<id>http://sabonis.github.io/blog/2013/09/22/fingerprint</id>
<content type="html"><![CDATA[<h1>Saddly, it has been sold one day in 2014.</h1>
<p>–edited Sun Apr 19 00:58:58 CST 2015</p>
<p><img src="http://sabonis.github.io/images/myImage/X230.jpg" title="X230" ></p>
<p>X230 is a cool laptop I ever used, not mentioned it backend by Arch Linux. Coolest thing is that it has figerprint device.
You can just use “right-index-finger” to login into the system without any key pressed.</p>
<figure class='code'><figcaption><span>Console </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
</pre></td><td class='code'><pre><code class='sh'><span class='line'><span class="c"># check device status</span>
</span><span class='line'>lsusb
</span><span class='line'>
</span><span class='line'><span class="c"># you would find something like this below</span>
</span><span class='line'>.............
</span><span class='line'> .............
</span><span class='line'>Bus <span class="m">003</span> Device 003: ID 147e:2020 Upek TouchChip Fingerprint Coprocessor <span class="o">(</span>WBF advanced mode<span class="o">)</span>
</span><span class='line'> .............
</span><span class='line'>
</span><span class='line'><span class="c"># install related package</span>
</span><span class='line'> pacman -S fprintd
</span><span class='line'>
</span><span class='line'><span class="c"># scan your fingerprint by this interactive command</span>
</span><span class='line'> fprintd-enroll
</span><span class='line'><span class="c"># follow the instruction, and you are all set</span>
</span></code></pre></td></tr></table></div></figure>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Tmux-Powerline]]></title>
<link href="http://sabonis.github.io/blog/2013/03/17/tmux-powerline/"/>
<updated>2013-03-17T20:45:00+08:00</updated>
<id>http://sabonis.github.io/blog/2013/03/17/tmux-powerline</id>
<content type="html"><![CDATA[<p><img src="http://sabonis.github.io/images/myImage/tmux.png" title="tmux with powerline" ></p>
<p><a href="http://tmux.sourceforge.net/">Tmux</a> is a very powerful terminal tool.
I was once a user of <em>Screen</em>,
but after giving <em>Tmux</em> a try. There is no going back…, at least,
after changing its key binding to <em>Screen</em> and <em>Vim</em> alike.
It is, though, powerful enough, folks just don’t content with what we have now.
So here comes one of my favo plugins - <em>Tmux-Powerline</em>.</p>
<h2>one big problem - <strong>Special Character</strong></h2>
<figure class='code'><figcaption><span>Use fontforge </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class='sh'><span class='line'>sudo apt-get install python-fontforge <span class="c"># install needed package</span>
</span><span class='line'><span class="nb">cd</span> /usr/share/fonts/truetype/ubuntu-font-family/ <span class="c"># my os is Ubuntu 12.04</span>
</span><span class='line'>PATH_TO_FONTFORGE UbuntuMono-R.ttf <span class="c"># no more garbled character</span>
</span></code></pre></td></tr></table></div></figure>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[My Java Note]]></title>
<link href="http://sabonis.github.io/blog/2013/03/09/my-java-note/"/>
<updated>2013-03-09T13:51:00+08:00</updated>
<id>http://sabonis.github.io/blog/2013/03/09/my-java-note</id>
<content type="html"><![CDATA[<blockquote><p>Write once, debug everywhere.</p><footer><strong>John Graham-Cumming</strong> <cite><a href='http://blog.jgc.org/2007/10/write-once-debug-everywhere.html'>blog.jgc.org/2007/10/…</a></cite></footer></blockquote>
<h2> </h2>
<figure class='code'><figcaption><span>String class StringTest.java </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='java'><span class='line'><span class="s">"Jessica"</span><span class="o">.</span><span class="na">subString</span><span class="o">(</span><span class="mi">0</span><span class="o">,</span> <span class="mi">4</span><span class="o">)</span> <span class="c1">// return Jess</span>
</span></code></pre></td></tr></table></div></figure>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[How to Add a New Post on Octopress]]></title>
<link href="http://sabonis.github.io/blog/2013/03/02/how-to-add-a-new-post-on-octopress/"/>
<updated>2013-03-02T09:57:00+08:00</updated>
<id>http://sabonis.github.io/blog/2013/03/02/how-to-add-a-new-post-on-octopress</id>
<content type="html"><![CDATA[<h2>Show me how</h2>
<p>This post is for my memory-limited brain. Basically, three step needed.</p>
<figure class='code'><figcaption><span>Console </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
</pre></td><td class='code'><pre><code class='sh'><span class='line'><span class="c">###1. Create a new post.</span>
</span><span class='line'>rake new_post<span class="se">\[</span><span class="s2">"POST_TITLE"</span><span class="se">\]</span> <span class="c"># notice the backslash before square brackets</span>
</span><span class='line'><span class="c"># new created post file will locate at place like line below. End with *.markdown. </span>
</span><span class='line'>
</span><span class='line'><span class="c">###2. Add markdown format stuff here</span>
</span><span class='line'>vi PATH_TO_OCTOPRESS/source/_posts/DATE-POST_TITLE.markdown
</span><span class='line'>
</span><span class='line'><span class="c">###3. Generate compliled files and push to server you defined before.</span>
</span><span class='line'>rake generate <span class="o">&&</span> rake deploy
</span><span class='line'><span class="c"># or</span>
</span><span class='line'>rake gen_deploy
</span></code></pre></td></tr></table></div></figure>
<p>And we are done here.</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[It Works.]]></title>
<link href="http://sabonis.github.io/blog/2013/03/02/title/"/>
<updated>2013-03-02T05:27:00+08:00</updated>
<id>http://sabonis.github.io/blog/2013/03/02/title</id>
<content type="html"><![CDATA[<h2>Hello world, hello Taeyeon</h2>
<p><img class="right" src="http://sabonis.github.io/images/myImage/taeyeon.jpg">
Wow, this is a awesome blogging frame work.
There are many funny pluggins and themes to play with.
Maybe later.
I just called it a day.</p>
]]></content>
</entry>
</feed>