Category Archives: Programming

Question Mark? in Rust

In Rust, we have Result, which is pretty much like Either in Haskell. The typical usage of Result/Either is to represent a possible failure result of a function. Such as opening file, if success returning file handle, otherwise some io … Continue reading

Posted in Programming | Tagged | Leave a comment

SKI

I have been working on Sure, but can you SKI?(I) recently. It is somehow about representing lambda as SKI combinators. SKI Roughly, SKI are I = id K = const S = \xyz.xz(yz) S is defined in a very wierd … Continue reading

Posted in Programming | Leave a comment

C++ Const Styling

I read about Google C++ Style Guide yesterday, I found an unexpected styling about constant. I thought it would be like ALL_UPPER_CASE, but it suggests const int kDaysInAWeek = 7. What is the k about anyway? It sounds like /k/ … Continue reading

Posted in Programming | Leave a comment

Named Return Value

Definition NRV = Named Return Value Example compile with g++ -fno-elide-constructors, this disables RVO (Return Value Optimization). Output was like: main() { f() { 0x7fffe5a0617f::ctor 0x7fffe5a0628f::cptor 0x7fffe5a0617f::dtor } 0x7fffe5a0621f::cptor 0x7fffe5a0628f::dtor 0x7fffe5a0621f::dtor } But after enable elide-constructors, it outputs main() { … Continue reading

Posted in Programming | Tagged | Leave a comment

Trello Beyond

I discovered a site called ProductHunt recently, as the name itself suggests, it hunts the products. I am obsessing with productive apps, and sometimes I spent even more time researching apps than using, which is completely obey what I initially … Continue reading

Posted in Braindump, Programming | Leave a comment

Python Decorator At First Sight

Definition In the Python Wiki, the decorator is defined as: A decorator is the name used for a software design pattern. Decorators dynamically alter the functionality of a function, method, or class without having to directly use subclasses or change … Continue reading

Posted in Programming | Tagged | Leave a comment

Oni

Recently I found an excellent neovim-powered editor, onivim. And this is a quick guide from neovim. open oni Ctrl-Shift-p type oni config, hit Enter type the following contents Ctrl-Shift-p, type neovim config put your old familiar init.vim contents here that’s … Continue reading

Posted in Programming | Tagged | Leave a comment

Setup Redmine

I setup redmine in my archlinux vagrant box. I follow the normal rails setup flow: install mysql start mysql service. $ systemctl start mysqld git clone https://github.com/redmine/redmine && cd redmine rake db:create rake db:migrate rails server If there are some … Continue reading

Posted in Programming | Tagged , | Leave a comment

Jupyter Code Folding

This needs jupyter extensions. $ pip install jupyter_contrib_nbextensions $ jupyter contrib nbextension install –user $ pip install jupyter_nbextensions_configurator $ jupyter nbextensions_configurator enable –user https://github.com/ipython-contrib/jupyter_contrib_nbextensions https://github.com/Jupyter-contrib/jupyter_nbextensions_configurator  

Posted in Programming | Tagged | Leave a comment

Magical Do-Nothing Function in Rust

In file src/libcore/mem.rs, there is a magical function called drop, there’s only one line: This is like explicitly calling destructor in C++. What is magic then? This is due to the special owership rule in Rust. When calling drop(x), x … Continue reading

Posted in Programming | Tagged | Leave a comment