hit counter

Timeline

My development logbook

Missing Curses Library

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ sudo apt-get install ncurses-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libncurses5-dev' instead of 'ncurses-dev'
The following extra packages will be installed:
  libtinfo-dev
Suggested packages:
  ncurses-doc
The following NEW packages will be installed:
  libncurses5-dev libtinfo-dev
0 upgraded, 2 newly installed, 0 to remove and 107 not upgraded.
Need to get 328 kB of archives.
After this operation, 1,452 kB of additional disk space will be used.
Do you want to continue [Y/n]?

Other dependency

1
$ sudo apt-get install libssl-dev

Do not need them for now

1
2
jinterface     : No Java compiler found
odbc           : ODBC library - link check failed

X in Y in C++

Equivalent to

1
2
   for x in y:
      # do something

in C++ is

1
2
3
4
5
6
7
8
void print_loop() {
    auto y = {0, 1, 2, 3, 4, 5, 6};

    for (auto i : y)
    {
        cout << '.' << i;
    }
}

Bottle and Parameters

Use request.query to retrieve the url parameters

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#coding: utf-8
from bottle import *

@route('/')
@route('/index.html')
def index():
    return '<a href="/hello">Go to Hello page</a>'

@route('/hello')
def hello():
    name = None
    names = request.query.getall('name')
    if names:
        name = names[0]
    return '<h1>Hello %s</h1>' % name

run(host='localhost', port=8000, reloader=True)

NSLog Macro

This is a useful marco for doing debug logging:

1
2
3
4
#define DLog(msg, ...) do { \
  NSString *dLogString = [NSString stringWithFormat:@"%s: %@", __PRETTY_FUNCTION__, msg]; \
  NSLog(@"%@", __VA_ARGS__); \
} while (0)

Note the use of __PRETTY_FUNCTION__

Source

TIL R Is Presinstalled in OSX

I just found out R is pre-installed in OSX!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$ R

R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin10.8.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

>