<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title><![CDATA[Steven Sun's Blog]]></title>
  <link href="http://shpeacelover.github.io/atom.xml" rel="self"/>
  <link href="http://shpeacelover.github.io/"/>
  <updated>2014-05-10T12:17:46+08:00</updated>
  <id>http://shpeacelover.github.io/</id>
  <author>
    <name><![CDATA[Steven Sun]]></name>
    
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[Slipover of My Pics]]></title>
    <link href="http://shpeacelover.github.io/blog/2014/04/21/slipover-of-my-pics/"/>
    <updated>2014-04-21T14:34:59+08:00</updated>
    <id>http://shpeacelover.github.io/blog/2014/04/21/slipover-of-my-pics</id>
    <content type="html"><![CDATA[
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Notes on 'Practical Programming']]></title>
    <link href="http://shpeacelover.github.io/blog/2014/02/21/notes-on-practical-programming/"/>
    <updated>2014-02-21T14:30:48+08:00</updated>
    <id>http://shpeacelover.github.io/blog/2014/02/21/notes-on-practical-programming</id>
    <content type="html"><![CDATA[<ol>
<li><p>In Python, print will add a new line automatically.</p></li>
<li><p>Python loads modules only the first time they are imported. Internally, Python keeps track of the modules it has already seen; when it is asked to load one that’s already in that list, it just skips over it. This saves time and will be particularly important when you start writing modules that import other modules, which in turn import other modules—if Python didn’t keep track of what was already in memory, it could wind up loading commonly used modules like math dozens of times.</p></li>
<li>When Python imports a module, it sets that module’s <strong>name</strong> variable to be the name of the module, rather than the special string &ldquo;<strong>main</strong>&rdquo;. This means that a module can tell whether it is the main program:   <br/>
 <code>
if __name__ == "__main__":  print "I am the main program"else:  print "Someone is importing me"    
</code></li>
<li>Lists are mutable;</li>
<li>If we loop through a list, the variable is left holding its last value when the loop finishes.</li>
<li>For Python&rsquo;s built in function open, the result of open is not the contents of the file. Instead, open returns a file object whose methods allow the program to access the contents ofthe file.</li>
<li>Read reads the whole file, readline reads the next line of text from the file.</li>
<li>string.strip, which returns a copy of a string that has leading and trailing whitespace characters (spaces, tabs, and newlines) stripped away.</li>
<li>deadlines will read the lines of the file and store them in a list.</li>
</ol>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Jquery Enlightenment Study Notes 1]]></title>
    <link href="http://shpeacelover.github.io/blog/2014/02/19/jquery-enlightenment-study-notes/"/>
    <updated>2014-02-19T20:14:00+08:00</updated>
    <id>http://shpeacelover.github.io/blog/2014/02/19/jquery-enlightenment-study-notes</id>
    <content type="html"><![CDATA[<ol>
<li>The central concept behind jQuery is, &ldquo;find something, do something.&rdquo; More specifically, select DOM element(s) from an HTML document and then do something with them using jQuery methods.</li>
<li>Also we can extend the concept behind jQuery to include,  first creating something new, selecting it, then doing something with it.</li>
<li>Executing code when the DOM is ready, but before window.onload.</li>
<li>Make sure all stylesheets are included before your jQuery code. Doing so will make sure all the elements in the DOM are correctly rendered before jQuery begins executing code.</li>
<li>Typically we do not want to wait for the window.onload event. That is the point of using a custom event like ready() that will execute code before window loads, but after the DOM is ready to be traversed and manipulated.</li>
<li>In fact, placing all JavaScript code at the bottom of a page is a proven performance strategy.</li>
<li>When attaching events to DOM elements contained in a wrapper set, the keyword this can be used to refer to the current DOM element invoking the event.</li>
<li>$(&lsquo;a&rsquo;).get(0).title = &lsquo;jQuery.com&rsquo;; found become this: $(&lsquo;a&rsquo;)[0].title = &lsquo;jQuery.com&rsquo;; Both allow access to the actual DOM element. For the square bracket notation, it i</li>
<li>s faster because it uses native JavaScript to retrieve the element from an array, instead of passing it to a method.</li>
</ol>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Notes on Effective Perl Programming 2]]></title>
    <link href="http://shpeacelover.github.io/blog/2014/01/24/notes-on-effective-perl-programming-2/"/>
    <updated>2014-01-24T17:09:35+08:00</updated>
    <id>http://shpeacelover.github.io/blog/2014/01/24/notes-on-effective-perl-programming-2</id>
    <content type="html"><![CDATA[<ol>
<li>循环while的条件语句是标量上下文环境， 而foreach的条件语句则是列表上下文环境。</li>
<li>当我们调用某个子程序或使用某个操作符时， 没有提供保存或使用其返回结果的目标时， 就是空上下文（void context）。</li>
<li>在子程序中， shift 操作会默认用@_作为参数。 在子程序之外， shift会把@ARGV作为默认参数。</li>
<li>在标量上下文中， grep返回符合条件的元素个数， 而不是元素列表。</li>
</ol>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Notes on Effective Perl Programming]]></title>
    <link href="http://shpeacelover.github.io/blog/2014/01/23/notes-on-effective-perl-programming/"/>
    <updated>2014-01-23T19:47:56+08:00</updated>
    <id>http://shpeacelover.github.io/blog/2014/01/23/notes-on-effective-perl-programming</id>
    <content type="html"><![CDATA[<ol>
<li>如果担心原先的程序启用strict后运行不正常， 则可以在实际修改代码前， 先在命令行上试着启用strict看看：</li>
</ol>


<figure class='code'><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=''><span class='line'>perl -Mstrict program.pl</span></code></pre></td></tr></table></div></figure>


<p></p>

<ol>
<li><p>所谓列表， 就是一组有序的标量集合。 所谓数组， 就是一个存储着列表的变量. 对于数组， 我们可以将它放在标量上下文中计算， 但对于列表， 则没有相应的概念。而列表永远只是列表， 它没有标量解释。</p></li>
<li><p>逗号操作符在标量上下文中会返回最右边的元素。  所以 my $scalar = (&lsquo;aa&rsquo;, &lsquo;bb&rsquo;, &lsquo;cc&rsquo;) 会将cc赋给$scalar.</p></li>
<li><p>在标量上下文环境中的列表赋值操作， 会返回负值操作符右边的元素个数。</p></li>
<li><p>my $elements = my @array = localtime; 使用这种方法可以计算下某个操作生成的列表中有几个元素。 由于这个规则是右结合的， 所以实际上中间被赋值的列表可以是空列表： <br/>
my $elements = () = local time;  如果要统计全局匹配的个数， 或者split函数返回的结果有多少个元素， 可以利用这个特性。</p></li>
</ol>


<figure class='code'><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=''><span class='line'>my $count = () = m/(...)/g;    
</span><span class='line'>    
</span><span class='line'>my $count = () = split /:/, $line;    
</span><span class='line'>  </span></code></pre></td></tr></table></div></figure>


<p></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Some Random Notes on the Dancer Framework]]></title>
    <link href="http://shpeacelover.github.io/blog/2014/01/23/some-random-notes-on-the-dancer-framework/"/>
    <updated>2014-01-23T11:02:30+08:00</updated>
    <id>http://shpeacelover.github.io/blog/2014/01/23/some-random-notes-on-the-dancer-framework</id>
    <content type="html"><![CDATA[<p>I write this post to keep notes of those little knowledge snippets when I am learning Dancer, the Perl web framework.</p>

<ol>
<li><p>Templates all go into the views/ directory. Optionally, you can create a &ldquo;layout&rdquo; template which provides a consistent look and feel for all of your views.</p></li>
<li><p>If we have some code like &ldquo;&lsquo;msg&rsquo; => get_flash()&rdquo;, this means we have a msg field which displays a message to the user when an event happens like a new entry is posted, or the user logs in or out. It&rsquo;s called a &ldquo;flash&rdquo; message because we only want to display it one time, not every time the / URL is rendered.</p></li>
<li><p>The uri_for directive tells Dancer to provide a URI for that specific route. You might ask why we don&rsquo;t simply hardcode the /add URI in our application or templates. The best reason not to do that is because it removes a layer of flexibility on where to &ldquo;mount&rdquo; the web application. Although the application is coded to use the root URL / it might be better in the future to locate it under its own URL route &ndash; at that point we&rsquo;d have to go through our application and the templates and update the URLs and hope we didn&rsquo;t miss any of them. By using the uri_for Dancer method, we can easily load the application wherever we like and not have to modify the application at all.</p></li>
<li><p>We will use the format like &ldquo;insert into entries (title, text) values (?, ?)&rdquo; to be sure our application won&rsquo;t be vulnerable to SQL injection.</p></li>
<li><p>If we have some like &ldquo;any [&lsquo;get&rsquo;, &lsquo;post&rsquo;] => &lsquo;/login&rsquo; => sub {}&rdquo;, here a GET for a human browsing to the URL and a POST for the browser to submit the user&rsquo;s input to the web application.</p></li>
<li><p>session->destroy; is Dancer&rsquo;s way to remove a stored session.</p></li>
<li><p>If we have some code like &ldquo;set layout => &lsquo;main&rsquo;&rdquo;, what this tells Dancer&rsquo;s template engine is that it should look for a file called main.tt in myapp/views/layouts/ and insert the calls from the template directive into a template parameter called content.</p></li>
<li><p>The &ldquo;before_template_render&rdquo; provides a way to manipulate the template parameters before they&rsquo;re passed to the engine for processing.</p></li>
</ol>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Oh My Love Lyrics]]></title>
    <link href="http://shpeacelover.github.io/blog/2014/01/21/oh-my-love-lyrics/"/>
    <updated>2014-01-21T20:06:52+08:00</updated>
    <id>http://shpeacelover.github.io/blog/2014/01/21/oh-my-love-lyrics</id>
    <content type="html"><![CDATA[<p>听到John Lennon的“Oh my love”， 歌词还有曲调给人一种非常空旷的感觉。现在就把歌词摘抄如下。</p>

<p>Oh my love for the first time in my life, <br/>
my eyes are wide open.</p>

<p>Oh my love for the first time in my life,  <br/>
my eyes can see.</p>

<p>I see the wind, I see the trees, everything is clear in my heart.</p>

<p>I see the clouds, I see the sky, everything is clear in our world.</p>

<p>Oh my lover for the first time in my life, my mind is wide open.</p>

<p>Oh my lover for the first time in my life, my mind can feel.</p>

<p>I feel sorrow, I feel dreams, everything is clear in my heart.</p>

<p>I feel life, I feel love, everything is clear in our world.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Yaml Exception Reading Errors]]></title>
    <link href="http://shpeacelover.github.io/blog/2014/01/15/yaml-exception-reading-errors/"/>
    <updated>2014-01-15T20:50:41+08:00</updated>
    <id>http://shpeacelover.github.io/blog/2014/01/15/yaml-exception-reading-errors</id>
    <content type="html"><![CDATA[<p>When I use the &ldquo;rake generate&rdquo; command, sometimes I will get this error like, &ldquo;YAML Exception reading&rdquo;. We can solve this problem by following the method below.</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>export LC_ALL=en_US.UTF-8    
</span><span class='line'>export LANG=en_US.UTF-8
</span></code></pre></td></tr></table></div></figure>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Catalyst Manual Tutorial Notes]]></title>
    <link href="http://shpeacelover.github.io/blog/2014/01/14/catalyst-manual-tutorial-notes/"/>
    <updated>2014-01-14T17:01:10+08:00</updated>
    <id>http://shpeacelover.github.io/blog/2014/01/14/catalyst-manual-tutorial-notes</id>
    <content type="html"><![CDATA[<ol>
<li><p>Make sure when adding new plugins you also include them as a new dependency within the Makefile.PL file.</p></li>
<li><p>When specifying plugins, you can omit Catalyst::Plugin:: from the name.</p></li>
<li><p>You should refer to &ldquo;Action-types&rdquo; in Catalyst::Manual::Intro for additional information and for coverage of some lesser-used action types not discussed here (Regex and LocalRegex).</p></li>
<li><p>Although DBIx::Class has included support for a create=dynamic mode to automatically read the database structure every time the application starts, its use is no longer recommended.</p></li>
<li><p>lib/MyApp contains a Schema subdirectory, which then has a subdirectory called &ldquo;Result&rdquo;. This &ldquo;Result&rdquo; subdirectory then has files named according to each of the tables in our simple database (Author.pm, BookAuthor.pm, and Book.pm). These three files are called &ldquo;Result Classes&rdquo; (or &ldquo;ResultSource Classes&rdquo;) in DBIx::Class nomenclature. Although the Result Class files are named after tables in our database, the classes correspond to the row-level data that is returned by DBIC.</p></li>
<li><p>Also note the &ldquo;flow&rdquo; of the model information across the various files and directories. Catalyst will initially load the model from lib/MyApp/Model/DB.pm. This file contains a reference to lib/MyApp/Schema.pm, so that file is loaded next. Finally, the call to load_namespaces in Schema.pm will load each of the &ldquo;Result Class&rdquo; files from the lib/MyApp/Schema/Result subdirectory. The final outcome is that Catalyst will dynamically create three table-specific Catalyst models every time the application starts (you can see these three model files listed in the debug output generated when you launch the application).</p></li>
<li><p>The Catalyst stash only lasts for a single HTTP request. If you need to retain information across requests you can use Catalyst::Plugin::Session.</p></li>
<li><p>You cannot define a many_to_many relationship bridge without also having the has_many relationship in place.</p></li>
<li><p>At the end of a given user request, Catalyst will call the most specific end method that&rsquo;s appropriate. For example, if the controller for a request has an end method defined, it will be called. However, if the controller does not define a controller-specific end method, the &ldquo;global&rdquo; end method in Root.pm will be called.</p></li>
<li><p>Catalyst takes &ldquo;extra slash-separated information&rdquo; from the URL and passes it as arguments in @_ (as long as the number of arguments is not &ldquo;fixed&rdquo; using an attribute like :Args(0)).</p></li>
<li><p>Chaining lets you have a single URL automatically dispatch to several controller methods, each of which can have precise control over the number of arguments that it will receive.  A chain can essentially be thought of having three parts &mdash; a beginning, a middle, and an end.</p></li>
<li><p>In practice you should never use a GET request to delete a record &mdash; always use POST for actions that will modify data.</p></li>
<li><p>There are several ways to pass information across a redirect. One option is to use the flash technique.</p></li>
<li><p>It is generally recommended (partly for historical reasons, and partly for code clarity) only to use default in MyApp::Controller::Root, and then mainly to generate the 404 not found page for the application.</p></li>
<li><p>Flash allows you to set variables in a way that is very similar to stash, but it will remain set across multiple requests. Once the value is read, it is cleared (unless reset).</p></li>
<li><p>If you want to keep your existing method, you can create a new copy and comment out the original by making it look like a Pod comment. For example, put something like =begin before sub add : Local { and =end after the closing }.</p></li>
<li><p>For debugging techniques in Catalyst, please visit the page &ldquo;<a href="https://metacpan.org/pod/Catalyst::Manual::Tutorial::07_Debugging">https://metacpan.org/pod/Catalyst::Manual::Tutorial::07_Debugging</a>&rdquo;. We can also find information about how to &ldquo;Check the version of an installed module&rdquo; and how to &ldquo;Check if a modules contains a given method&rdquo;.</p></li>
<li><p>If you want to use MySQL or postgresql in catalyst, please refer to the following url, &ldquo;<a href="https://metacpan.org/pod/Catalyst::Manual::Tutorial::10_Appendices">https://metacpan.org/pod/Catalyst::Manual::Tutorial::10_Appendices</a>&rdquo;.</p></li>
</ol>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Catalyst 5.8 the Perl MVC Framework Notes--Creating a Database Model]]></title>
    <link href="http://shpeacelover.github.io/blog/2014/01/11/catalyst-5-dot-8-the-perl-mvc-framework-notes-creating-a-database-model/"/>
    <updated>2014-01-11T16:24:03+08:00</updated>
    <id>http://shpeacelover.github.io/blog/2014/01/11/catalyst-5-dot-8-the-perl-mvc-framework-notes-creating-a-database-model</id>
    <content type="html"><![CDATA[<ol>
<li>The command for creating a database model is as the following:</li>
</ol>


<figure class='code'><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=''><span class='line'>perl script/myapp_create.pl model TestDatabase DBIC::Schema MyApp::Schema::TestDatabase create=dynamic dbi:SQLite:tmp/database</span></code></pre></td></tr></table></div></figure>


<p></p>

<ol>
<li>The first argument is the name of the Catalyst Model (TestDatabase). DBIC::Schema is what sort of model we&rsquo;re creating. MyApp::Schema::TestDatabase is where the schema definition will be stored (we won&rsquo;t use the Schema in this example, but real applications will). create=dynamic tells DBIC to read the database every time theapplication is started to determine the schema (layout of tables, foreign key relations, and so on.). The final argument is the DBI connect string for the database.</li>
</ol>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Catalyst 5.8 the Perl MVC Framework Notes]]></title>
    <link href="http://shpeacelover.github.io/blog/2014/01/11/catalyst-5-dot-8-the-perl-mvc-framework-notes/"/>
    <updated>2014-01-11T12:33:25+08:00</updated>
    <id>http://shpeacelover.github.io/blog/2014/01/11/catalyst-5-dot-8-the-perl-mvc-framework-notes</id>
    <content type="html"><![CDATA[<ol>
<li><p>catalyst.pl MyApp    (this command will create the app)</p></li>
<li><p>Inside the lib directory, there is a file named MyApp.pm, This file defines the namespace and inheritance that are necessary to make this a Catalyst application. It also contains the list of plugins to load application-­specific configurations. These configurations can also be defined in the myapp.conf file in the MyApp directory. However, if the same configuration is mentioned in both the files, then the configuration mentioned here takes precedence.</p></li>
<li>The file lib/MyApp/Controller/Root.pm will handle all root level (/)URLs. This is where the code that generates the welcome page is located.</li>
<li>The root directory will hold your templates and other non-­code support files. A subdirectory called /root/static is for static content such as images and stylesheets. Catalyst is set up to serve static files from this directory automatically (under the /static path), thanks toCatalyst::Plugin::Static::Simple.</li>
<li>The script directory contains the scripts needed to run, test, and modify your application. To note here, the script myapp_create.pl, which is a version of catalyst.pl that&rsquo;s customized for your application. It can create Models, Views, Controllers, tests, and many other things.</li>
<li><p>The t directory is where your application&rsquo;s automatic tests are stored. By default, you&rsquo;ll have the following three tests:</p>

<ul>
<li>01app.t, which is a test that passes if your application compiles.</li>
<li>02pod.t, which will pass if your Plain Old Documentation (POD)embedded API documentation, inside your application, is valid.</li>
<li>03podcoverage.t, which tests that every public function in your application has some documentation.</li>
</ul>
</li>
<li><p>When a user makes a request using the browser, Catalyst will look for the appropriate method that can handle the request within packages called Controllers.</p></li>
<li><p>In a controller, there are some automatically created stuff. &ldquo;BEGIN {extends &lsquo;Catalyst::Controller&rsquo;; }&rdquo; is to tell Moose/Perl that this module is a Catalyst Controller. &ldquo;<strong>PACKAGE</strong>&ndash;>meta->make_immutable&rdquo; ells Moose that this module will not change at runtime. This statement is necessary for performance gains and is good practice to mention in every Moose module. Modules must return true when they&rsquo;re loaded,otherwise Perl will assume that the loading has failed and will die with an error message. 1 is always true, so it&rsquo;s conventional to use it for this purpose.</p></li>
<li>To create a view, we can issue the following command, &lsquo;perl script/myapp_create.pl view TT TT&rsquo;. The TT TT part of the previous command means to create a View called View/TT.pm (the first TT) based on the standard Catalyst::View::TT (the second TT).  For our example, The next step is to create a template in the root/hello directory.We will name it index.tt. The root directory is the default place where Catalyst::View::TT will look for templates. This can be changed by configuration if you really need to.</li>
<li>Variables that are passed between Controllers and Views are called stash.</li>
<li>For the &ldquo;sub index&rdquo; part in a controller, if we change it to &ldquo;sub index :Path :Args(1)&rdquo;, it will accept the argument after index. The :Path attribute after index tells Catalyst that this method will handle URL requests that do not mention the method name such as /hello. The Args(1) attribute declares that this action expects one argument.</li>
<li>If we specified :Local instead of :Path, then Catalyst would map the index action to handle a URL that looks like /hello/index. So, the URL looks like the following <a href="http://localhost/hello/index/Bonjour!,">http://localhost/hello/index/Bonjour!,</a> where Bonjour! is the argument that is being passed to the Controller. If we omitted the attributes (:Local, :Path, and so on), Catalyst would ignore the action entirely and it would be a normal Perl subroutine in the package. If we want to handle any URL with this method, then we can use the :Global attribute.</li>
<li><p>We also changed the first line of the hello subroutine to receive the parameter within the method. Initially, it looked like  <br/>
my ( $self, $c ) = @<em>;.  <br/>
This gets the first two arguments passed to the action by Catalyst, $self and $c. $self is a MyApp::Controller::Hello object and is not of much use right now. $c is the Catalyst context and contains all the information about our application and the current request (and therefore is very useful). Catalyst passes more than just $self and$c though, so we want to modify that line to read
my ($self, $c, @args)=@</em>;.
This will allow us to access the rest of the arguments via the @args array.</p></li>
<li><p>The template that will be rendered is determined by the private name of your action.</p></li>
<li><p>The stash is a data structure that exists throughout a single Catalyst request. Data you insert into the stash in an action will be available to the View (and other actions). Templates can only access variables that have been explicitly placed here, so it&rsquo;s important to remember to put your useful data in the stash (otherwise it will be gone at the end of the subroutine in the Controller, instead of at the end of the request).</p></li>
<li><p>You can automatically restart the server when necessary by running the server like     <br/>
perl script/myapp_server.pl -r -d.  <br/>
The -r will cause the server to restart when appropriate, and the -d will show debugging information, even if you&rsquo;ve turned it off inside your application. This is especially useful as you will want to deactivate the hardcoded -Debug option in your MyApp.pm, once you are ready to deploy your application.</p></li>
</ol>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Notes on Perl]]></title>
    <link href="http://shpeacelover.github.io/blog/2014/01/09/notes-on-perl/"/>
    <updated>2014-01-09T21:41:24+08:00</updated>
    <id>http://shpeacelover.github.io/blog/2014/01/09/notes-on-perl</id>
    <content type="html"><![CDATA[<ol>
<li>为了查看某一个模块的版本号， 在命令行下输入以下的内容： <br/>
perl -MSome::Module -e &lsquo;print Some::Module->VERSION&rsquo;</li>
</ol>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[New Year's Resolution]]></title>
    <link href="http://shpeacelover.github.io/blog/2014/01/09/new-year-resolution/"/>
    <updated>2014-01-09T20:33:07+08:00</updated>
    <id>http://shpeacelover.github.io/blog/2014/01/09/new-year-resolution</id>
    <content type="html"><![CDATA[<p>好久没有对未来做些规划了。 总觉得日子就这样过吧。 也懒得去做些什么大的改变了。</p>

<p>总是在各种技术间跳来跳去， 没有熟练任何一种技术。 玩过Perl， Python， Ruby， Shell Script， PHP， Lisp。 但是真正在公司的服务器上部署过的代码只有用PHP还有Shell Script写的代码。</p>

<p>在我刚来公司的时候， 是想从事perl的代码的编写的工作。 但是自从进入公司后， 自己在Perl上花的时间实在是微乎其微的。</p>

<p>以至于自己都有点迷失方向了， 不知道该给自己立下什么目标。</p>

<p>在自己入职刚一年的时候， manager跟我说， 以后或许可以从事L2方面的工作， 即专职从事代码编写的工作， 当然也得写rule。 前提肯定是自己能证明有能力去做这件事情了。虽然现在自己也有大把的时候可以进行coding， 但是毕竟还是L1. 自己负责的那些PHP代码只有偶尔需要改动。</p>

<p>学了好几天的Catalyst了。 现在我要下定决心把Perl的两个框架给学好， 一个是Catalyst， 一个是Dancer。 这两个框架公司里都有用到的。但是感觉挺难的， 而我的那个L1的同事竟然说Dancer挺容易的。 我是有多蠢啊！！！！</p>

<p>2014年， 希望自己在工作上能够有如下的进步。
1. 在Perl上能稍微有点成绩。 毕竟从知道有perl这门语言到现在都已经有两年多了。 现在还是这么菜的水平， 完全说不过去的。
2. 彻底掌握Catalyst还有Dancer这两个框架。
3. 对于PHP， 因为基本上公司用的框架就在那里了， 希望在新的一年里能够在扎实下PHP代码编写的技巧。
4. 入职满两年的时候希望能够有底气跟manager说我想转到L2去。
5. 每天写技术博客， 或长或短， 记录下每天学到什么新的技术。 那样或许长进会更快点的。
6. 有不懂的刻苦钻研或者向同事请教。</p>

<p>好吧， 就写这么多了。 希望能好好审视下自己今天写下的这些东西。</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[When Can We Omit the Ampersand While Calling a Subroutine]]></title>
    <link href="http://shpeacelover.github.io/blog/2014/01/07/when-can-we-omit-the-ampersand-while-calling-a-subroutine/"/>
    <updated>2014-01-07T16:39:30+08:00</updated>
    <id>http://shpeacelover.github.io/blog/2014/01/07/when-can-we-omit-the-ampersand-while-calling-a-subroutine</id>
    <content type="html"><![CDATA[<p>If the compiler sees the subroutine definition before invocation, or if Perl can tell from the syntax that it’s a subroutine call, the subroutine can be called without an ampersand, just like a built-in function.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Some Useful Macos Commands]]></title>
    <link href="http://shpeacelover.github.io/blog/2013/09/07/some-useful-macos-commands/"/>
    <updated>2013-09-07T19:51:00+08:00</updated>
    <id>http://shpeacelover.github.io/blog/2013/09/07/some-useful-macos-commands</id>
    <content type="html"><![CDATA[<ol>
<li><p>在iterm2里， 输入“open -a Mou”打开Mou编辑器， 输入open example.md or open -a Mou example.md来打开一个文件。</p></li>
<li><p>在iterm2里， 按住cmd+enter， 将会将iterm2最大化。</p></li>
</ol>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[怎可妄想]]></title>
    <link href="http://shpeacelover.github.io/blog/2013/09/05/zen-ke-wang-xiang/"/>
    <updated>2013-09-05T11:12:00+08:00</updated>
    <id>http://shpeacelover.github.io/blog/2013/09/05/zen-ke-wang-xiang</id>
    <content type="html"><![CDATA[<p>一个人不成熟的标志， 或许就是， 有的东西明知不属于自己， 却还痴心妄想， 可笑， 可悲， 可叹.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[奇技淫巧之vim匹配括号]]></title>
    <link href="http://shpeacelover.github.io/blog/2013/09/04/qi-ji-yin-qiao-zhi-vimpi-pei-gua-hao/"/>
    <updated>2013-09-04T10:52:00+08:00</updated>
    <id>http://shpeacelover.github.io/blog/2013/09/04/qi-ji-yin-qiao-zhi-vimpi-pei-gua-hao</id>
    <content type="html"><![CDATA[<p>今日在和同事交接代码的时候， 因为代码比较长， 所以出现了在看到一个括号的时候， 不知道与它匹配的括号在哪里。 当时使用的是vim， 后来换成了sublime text， 但是还是不知道怎么去找括号的另一半。现在我们就来看看， 怎么在vim中去匹配括号的另一半。</p>

<p>首先把光标定位在一个括号上，在normal模式中, 按shift+5, 亦即%来自动调转到另一个括号上。</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Practical Vim --chap04 Visual Mode]]></title>
    <link href="http://shpeacelover.github.io/blog/2013/08/28/practical-vim-chap04-visual-mode/"/>
    <updated>2013-08-28T15:38:00+08:00</updated>
    <id>http://shpeacelover.github.io/blog/2013/08/28/practical-vim-chap04-visual-mode</id>
    <content type="html"><![CDATA[<ol>
<li><p>Vim’s Visual mode allows us to define a selection of text and then operate upon it.</p></li>
<li><p>ways to enabling visual modes:</p></li>
</ol>


<figure class='code'><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=''><span class='line'>v Enable character-wise Visual mode
</span><span class='line'>V Enable line-wise Visual mode
</span><span class='line'>&lt;C-v&gt; Enable block-wise Visual mode
</span><span class='line'>gv Reselect the last visual selection</span></code></pre></td></tr></table></div></figure>


<ol>
<li><p>the &lsquo;gv&rsquo; command isreselects the range of text that was last selected in Visual mode. No matter whether the previous selection was character-wise, line-wise, or block-wise, the gv command should do the right thing. The only case where it might get confused is if the last selection has since been deleted.</p></li>
<li><p>if there is a html tag, like &ldquo;<a href="#">three</a>&rdquo;, type vit in normal mode, will get you put your cursor into the &lsquo;h&rsquo; character of the word &ldquo;three&rdquo;. vit means &ldquo;visually select inside the tag&rdquo;</p></li>
</ol>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Practical Vim --chap02 Normal Mode]]></title>
    <link href="http://shpeacelover.github.io/blog/2013/08/28/practical-vim-chap02-normal-mode/"/>
    <updated>2013-08-28T14:43:00+08:00</updated>
    <id>http://shpeacelover.github.io/blog/2013/08/28/practical-vim-chap02-normal-mode</id>
    <content type="html"><![CDATA[<ol>
<li><p>if there is a line and it is in normal mode, like &ldquo;hello, everyone, this is steven sun&rdquo;. now if you position your cursor on the &ldquo;s&rdquo; of &ldquo;steven sun&rdquo; and then type &ldquo;c2w&rdquo;, you will enter into the &ldquo;insert mode&rdquo; and will be prompted to enter some text.</p></li>
<li><p>use dap to delete a paragraph, use daw to  delete a  word, use dal to delete a  single character;</p></li>
<li><p>we can type :h operator to find those information about operators in vim.</p></li>
<li><p>an action is composed from an operator followed by a motion.</p></li>
</ol>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Network and Protocol Functions in PHP]]></title>
    <link href="http://shpeacelover.github.io/blog/2013/08/28/network-and-protocol-functions-in-php/"/>
    <updated>2013-08-28T14:08:00+08:00</updated>
    <id>http://shpeacelover.github.io/blog/2013/08/28/network-and-protocol-functions-in-php</id>
    <content type="html"><![CDATA[<ol>
<li><p>file_get_contents($url);</p></li>
<li><p>urlencode() function.This function takes a string and converts it to the proper format for an URL</p></li>
<li><p>parse_url($url)</p></li>
<li><p>gethostbyname</p></li>
<li><p>ftp_fget</p></li>
</ol>

]]></content>
  </entry>
  
</feed>
