Documents:
https://developers.google.com/analytics/devguides/reporting/core/dimsmets
https://developers.google.com/analytics/devguides/reporting/embed/v1/devguide
https://ga-dev-tools.appspot.com/embed-api/basic-dashboard/
Test query
https://ga-dev-tools.appspot.com/query-explorer/
https://developers.google.com/apis-explorer/#p/analytics/v3/analytics.data.ga.get
Embedded GA chart in other website
https://developers.google.com/analytics/devguides/reporting/embed/v1/component-reference#datachart-options
Visualization
https://developers.google.com/chart/
Create a new:
https://ga-dev-tools.appspot.com/embed-api/custom-components/
Jul 15, 2015
Jun 29, 2015
PHP strftime
It took me hours to debug why a template return null, only when using Japanese locale.
Finally I found out.
strftime often used to format nicely date in Japanese, but it will easily broken in production.
There is a workaround to solve this:
Finally I found out.
strftime often used to format nicely date in Japanese, but it will easily broken in production.
There is a workaround to solve this:
function ensureUtf8($text) {
return iconv(mb_detect_encoding(
$text, mb_detect_order(), true), "UTF-8", $text
);
}
function _strftime($format, $time = null) {
return ensureUtf8(strftime($format, $time));
}
Jun 19, 2015
New tools
https://github.com/Thibaut/devdocs
I often write code while on commuting train. Local documents are very precious to develop locally without Internet connection.
Days before, I often collect manually by downloading HTML versions (mostly from Readthedocs).
devdocs tool provides much more elegant ways to download and search documents.
I often write code while on commuting train. Local documents are very precious to develop locally without Internet connection.
Days before, I often collect manually by downloading HTML versions (mostly from Readthedocs).
devdocs tool provides much more elegant ways to download and search documents.
May 31, 2015
Interesting Python style
Look before you leap. This coding style explicitly tests for pre-conditions before making calls or lookups. This style contrasts with the EAFPapproach and is characterized by the presence of many if statements.
In a multi-threaded environment, the LBYL approach can risk introducing a race condition between “the looking” and “the leaping”. For example, the code, if key in mapping: return mapping[key] can fail if another thread removes key from mapping after the test, but before the lookup. This issue can be solved with locks or by using the EAFP approach.
These are excerpt from https://docs.python.org/3/glossary.html#term-lbyl
Use EAFP is the best for Python and programming pleasure :D
May 17, 2015
Experience with RiotJS
RiotJS is really nice. Small and do the job!
https://github.com/muut/riotjs
There are some pitfall.
* To mount other tags (defined somewhere outside), I need to put it inside an event:
* If you see "onXYZ" on a rendered tag, it meant the event handler wasn't binded correctly. Most of the time, it might because of unresolved handeler.
I don't know when yourHandler is enough, or I must write parent.yourHandler
https://github.com/muut/riotjs
There are some pitfall.
* To mount other tags (defined somewhere outside), I need to put it inside an event:
this.on('mount', function() { riot.mount('other-tag', ...) }
* If you see "onXYZ" on a rendered tag, it meant the event handler wasn't binded correctly. Most of the time, it might because of unresolved handeler.
I don't know when yourHandler is enough, or I must write parent.yourHandler
<ul each={ items}> <li onclick={ parent.yourHandler } ...* Remember the scope by set self = this first in the script. It's really helpful!
Mar 20, 2015
Better Java experience
- IntellJ IDEA! Easier to write with lot of support for Java
- http://projectlombok.org/features/index.html less boilerplate code
- http://velocity.apache.org/engine/devel/user-guide.html for templating
- http://commons.apache.org/ libraries
- https://github.com/google/guava
Mar 18, 2015
IntelliJ disable clipboard handling
If you use a clipboard manager like ClipMenu, it will be mal-functional in IntelliJ (Idea, PyCharm, ...)
IntelliJ has it own clipboard handling. To disable it, it's tricky.
http://stackoverflow.com/questions/27949064/how-to-disable-android-studio-intellij-idea-clipboard-management-on-osx
To solve this:
- Open *.app/Contents/bin/idea.properties
- Add a line: ide.mac.useNativeClipboard=True
- Enjoy!
IntelliJ has it own clipboard handling. To disable it, it's tricky.
http://stackoverflow.com/questions/27949064/how-to-disable-android-studio-intellij-idea-clipboard-management-on-osx
To solve this:
- Open *.app/Contents/bin/idea.properties
- Add a line: ide.mac.useNativeClipboard=True
- Enjoy!
Subscribe to:
Posts (Atom)