Trac 1.2 裡 datepicker 每個禮拜的第一天改成星期天

Trac 1.0 搭配舊的 DateFieldPlugin 時,預設每週的第一天會是星期一,但這個設定可以在 trac.ini 內用 first_day 參數調整,像是這樣:

[datefield]
format = ymd
separator = -
first_day = 0

但在 Trac 1.2 在 trac.ini 裡就沒有提供設定讓人調整了... 而由於 Trac 是用 jQuery UIDatepicker,在這個套件裡有提供方法讓人調整,所以解決的方向變成在 site.html 內用 JavaScript 處理,把這段程式碼塞到 JavaScript 的區段內就可以了:

// Datepicker
jQuery.datepicker.setDefaults({firstDay: 0});

一整個繼續惡搞中... 然後把 wiki 上的 Trac 條目也更新上去。

如何讓工程師一個禮拜工作 60~80 小時

從「How do you make programmers work 60-80 hours per week?」這邊看到的,出自 Quora 的「How do you make programmers work 60-80 hours per week?」。

看到標題的時候在想「這什麼詐騙集團類型問題 XDDD」,寫 code 的工程師一天可以專注三個小時就很了不起了好嗎,然後年紀愈大就愈難專注。每天可以工作十小時鐵定是一堆時間在看 YouTubeFacebookTwitter 的好嗎 XDDD

仔細看了文章以後,發現其實作者就是在講這個:

No programmers really work 60-80 hours a week, especially in a 5 day span. That is a 12-16 hour day, 5 days a week.

I promise you that any company that has programmers “working” that many hours is really only getting 2-4 hours of real work out of them each day. The rest of the time will be filled with pointless meetings, a fair amount of web browsing, and then a whole lot of looking busy.

真的有寫程式都知道的啦...

前幾天 Twitter 伺服器時間大爆炸的原因...

前幾天 Twitter 伺服器的時間大爆炸,跳到 2015 年:

剛剛在 Hacker News Daily 上看到原因:「If you're using YYYY in your JVM service or %G in anything, fix it now」,原因是這樣:

The single character G instead of Y took down Twitter's API today.
If you're using YYYY in your JVM service or %G in anything, fix it now. You're very likely using the wrong year format.

date
Mon Dec 29 00:44:45 EST 2014
date -u "+%G"
2015

ISO 8601 week numbering has 2015 start this week.

在自己電腦上也可以重製出來:

gslin@home [~] [01:22/W4] date 
Wed Dec 31 01:27:00 CST 2014
gslin@home [~] [01:27/W4] date +%Y
2014
gslin@home [~] [01:27/W4] date +%G
2015

依照說明,%G 的用途是:

year of ISO week number (see %V); normally useful only with %V

用錯好慘啊...