It's All Writing.

Writing makes you happy.

How to receive a Big Integer, process it and return it at node


This sample code is also a solution to the problem at the following URL of atcoder. *

The code receive input parameters formatted as below from stdin.

1 2 1 1
3 5 -4 -2
-1000000000 0 -1000000000 0

and so on.

Also, the code can receive very big integer values. If you are using Integer instead of BigInt, you will not receive the exact big integer value.

Also, Integer and BigInt must not be combined in an operation because the result will be inaccurate. Finally, use BigInt.toString() to return or output value.

How to implement exlusive control at node


Do you have such an experience that a bug was entered by neglecting exclusive control during asynchronous process with Promise at node?
If you want to implement exclusive control, you have to use some library which you'll find out in npm.
Because, Promise does not provide syntax like Mutex or synchronized.

You can use await-semaphore library for the purpose.



SRMLogger v2.1.1 release

SRMLogger v2.1.1 release

You can get App which named SRMLogger from below.

What’s New

The following changes have been made in version 2.1.1.

  • Change of stimulation (average) is also plotted on the graph
  • support android 5.0 over

In addition, the following bugs have been fixed.

  • Fixed a bug that error is displayed when registering stimulus empty
  • Fixed a bug that an index error appears when viewing the log screen after deleting a plan

What's SRMLogger

SRMLogger is an app which support to carry out SRM(Social Rhythm Metric). SRM is an effective method of treatment Emotional disorder (Depression and Bipolar disorder).

SRM is a method which notice to keep regular routine makes to keep remission state of Emotional disorder (Depression and Bipolar disorder).

In SRM, you plan the from 5 (simple edition) to 17 (in-depth edition) actions which becomes a daily life's point .
And you record those time and stimulation (0: case of you're alone, +3: case of you had exciting time with many people) you acted.
And you record the day's feeling at the end of one day.

SRMLogger's main function is below.

  • The definition which is planning to action
  • record daily stimulation, feeling and carried out time of each action
  • Graphical representation of a change in feeling and a change in stimulation average

Each data of action plans and a carried out log's record are preserved on the cloud, so even if you change the smart phone, it's possible to continue and keep using it.

If you start app, please define action plans on the Plan screen first.
Next, tap the Log screen and record carried out log - tap each action and input carried out time and stimulation(+3 ~ 0).
At the end of one day, record feeling(-5 ~ +5).
You can change a target date to recording carried out log. You also can confirm the change in feeling by a chart on the Graph screen. Please utilize such as to show your condition to your doctor easily.

How to read config.ini which define configuration values at golang


  • go ( golang )


You have a config.ini file which define configuration values as follows and you want to load it with go.


We can easily do this using package ini. If you have not installed ini, you can install it as follow.

$ go get

The config/config.go and main.go has a structure as follows.

$ tree

├── config
│   └── config.go
├── config.ini
└── main.go

Now let's show to config.go and main.go.

Note that in order to load config.go in main.go, the import statement should say sample/config. sample is directory name which main.go belongs to.


How to sort Objects by multiple fields at Apex


  • Apex


You can sort List of Objects with using sort method as below.

In above example, shops is sorted by name ascending order ( Shop A, Shop B, Shop C). But what if you want to sort by multiple fields in Shop, not just by name?


You can sort by multiple fields with using sort method as below. This example is just only different compareTo method.

The sort condition is prioritized from the top line of the compareTo method ( priority order is category, proceeds, address ). For string type fields, you can switch between ascending and descending order by exchanging A and B with A.compareTo(B). For numeric type fields, you can switch between ascending and descending order by reversing the order of subtraction.