Showing posts with label 日本. Show all posts
Showing posts with label 日本. Show all posts

Jul 31, 2016

住宅

マイホーム投資は勝つのがとても難しくなっています。まさに、「マイホーム購入は人生最大のギャンブル」と言っていいでしょう
http://toyokeizai.net/articles/-/33609?page=3

35年ローンだと35年後に老朽化で改築でまたローンですか? そうすると、一生資産でなく負債という現実

http://oshiete.goo.ne.jp/qa/5092417.html

自己資金比率が10%未満の場合におけるデフォルト率は、20%以上30%未満の場合に比べて2倍近くに達している。自己資金比率が高まるほどデフォルト率が下がることはいうまでもないだろう。


こんな理由で家を買ってはいけない!
その4「家賃がもったいないから」
http://diamond.jp/articles/-/35405?page=2


日本の問題はこの20年間でほとんど全ての所得階層で年間100万円くらい所得が減少している「1億総貧乏化」の方がより深刻な問題となっており、これが消費を抑圧するデフレの原因にもなっている

http://matome.naver.jp/odai/2139527800338666101

Sep 10, 2014

Japanese form - confirm - complete flow in Perl

I use the same view as both form and validation.
The trick here is to use multiple submit buttons to determine whether the form is confirmed or not.

The sample is written in Perl with module HTML::Template, however, the idea is open for all server side languages (Java, PHP, Python, ...)

Processing Perl script:
my $query = CGI->new;

    # Flag to display form inputs or not
    my $input = 1;
    if ($ENV{'REQUEST_METHOD'} eq 'POST') {
        if (validate_form()) {
            if ($query->param('submit_confirm') || $query->param('submit_confirm.x')) {
                # Confirmed, end here
                send_email();
                print $query->redirect('complete.pl');
                exit 0;
            }
            if ($query->param('submit_edit') || $query->param('submit_edit.x')) {
                $input = 1;
            } else {
                $input = 0;
            }
        } else {
            # Go back, display form to correct
            $input = 1;
        }
    }
    if ($input) {
        $query->param('step_input', 1);
    }
HTML views/form.html (Supposed to use HTML::Template)
Note that submit buttons should have two separate names. Some browsers like Firefox need this to distinguish. We can determine which button chosen by checking if field submit_confirm.x is existed.
It's tricky. Browser sends along a coordinate...
{% input family %}

         <tmpl_if name="step_input">
            <input type="image" src="confirm.gif" alt="確認">
        <tmpl_else>
            <input name="submit_edit" value="edit" type="image" src="edit.gif" alt="戻る">
            <input name="submit_confirm" value="confirmed" type="image" src="complete.gif" alt="登録する">
        </tmpl_if>
A little trick to writing view for both, by customised filter for HTML::Template
Having this, new shiny sugar syntax {% input family %} will render the input box, as well as validation message if found $message_family
sub custom_filter {
    my $text_ref = shift;
    
    # Define a new syntax {% input family %}
    $$text_ref =~ s/\{%\s*input\s+(.*?)\s*\%}
        /<tmpl_if name="step_input">
            <tmpl_if name="message_$1">
                <span class="message">
                    <tmpl_var escape=html name=message_$1>
                <\/span>
            <\/tmpl_if>
            <input 
        <tmpl_else>
            <tmpl_var escape=html name=$1>
            <input type="hidden"
        <\/tmpl_if>
        name="$1"
        value="<tmpl_var escape=html name=$1>">
        /gx;
}
Then register it:
    my $template = HTML::Template->new(
        filename => 'views/form.html',
        associate => $query,
        filter => \&custom_filter,
    );

Sep 1, 2014

Cẩm nang đi tàu ở Nhật

Mục lục:

1. Tàu và tàu điện
只見線 Tuyến tàu với phong cảnh hùng vĩ của miền Tohoku
  (Nguồn: marumine.co.jp)
2. Ga tàu
3. Cấu trúc ga tàu
4. Cửa soát vé
5. Tìm thông tin, tờ rơi, bảng điện tử
6. Tuyến tàu
7. Giờ giấc và sự cố
8. Đi tàu
9. Tra cứu
10. Vé thường, vé tháng, vé đặc biệt
11. Sử dụng máy bán vé
12. Leo lên tàu
13. Làm thế nào biết mình đi đúng hướng?
14. Chuyển tiếp tàu
15. Văn hoá trên tàu
16. Quên đồ trên tàu
17. Tản mạn: tàu điện ngầm, shinkansen.

Chọn nơi sống ở Nhật

Đến một nơi xa lạ, chọn được nơi sống ưng ý đôi khi là may rủi hơn là lựa chọn. Tuy nhiên nếu tìm hiểu kỹ trước khi quyết định sẽ giúp tránh phải chuyển nhà (khá đắt đỏ), chịu đựng (với không gian chưa ưng ý).