[iPhone|iPad|iOS] Sales Tax & Discount – Zippy Calculator Free 4.1.0 was released.

February 12th, 2016

I’m happy to announce version 4.1.0 of zippy calculator release. It has new feature that is iPad’s layout position. You can select either left or right position of history view. See below.


Zippy Calculator Free – Sales Tax & Discount

Zippy Calculator – Sales Tax & Discount

[iOS] Dynamic Change AutoLayout’s NSConstraint

February 6th, 2016

Zippy Calculator‘s Japanese user wrote review.

It’s more easier to use if calculate buttons and history area position are swapped.

Zippy Calculator’s layout is horizontal layout now.
I added new feature that can swap those position. I submitted new version to App Store. If they approve the app smoothly, it will update next week.


This post is how to implement this feature.

Read the rest of this entry »

[iOS] NSDate Utility Extension in Swift

February 1st, 2016

I would like to make helper class for NSDate in Swift.
I created and pushed to github.

>> KinkumaDesign/SwiftNSDateUtilityExtension – Swift

[Dialy] 2016 Happy New Year

January 4th, 2016

Happy New Year!


I imagined Rio-Carnival. This year will be held The Olympics in Rio de Janeiro, Brazil.
What is monkey? It is one of Eto. Eto is consist of twelve animals. It is Chinese in origin. The year of Eto changes every year. 2016 is monkey year. Bird will be next year’s Eto.

Japanese usually send new year’s card to their friends, relatives, and business clients in the New Year holidays. But recently amount of new year’s cards are reduced. Instead, sending e-mail, SNS messages by mobile phone are increasing.

In Japanese new year’s card is called Nengajo.

[C] Learning Byte and Bit in Language C

February 22nd, 2012

I am learning developing in C now. So I have to understand byte and bit.
As I recognized it, I will write down about these things. I hope to help you to understand it.


A bit represents 0 or 1. It usually used as base-2 number system.
Here is an example table.

Binary Decimal Number of bit
0 0 1
1 1 1
10 2 2
11 3 2
100 4 3
111 7 3
1000 8 4
1010 10 4
1111 15 4

You found that 4 bit can represent from 0 to 15 in decimal.
So it can represents type of 16 number.

By the way hexadecimal is base-16 number system.
In C, it is written with prefix 0x. Let’s add hexadecimal column to above table.

Binary Decimal Hexadecimal Number of bit
0 0 0x0 1
1 1 0x1 1
10 2 0x2 2
11 3 0x3 2
100 4 0x4 3
111 7 0x7 3
1000 8 0x8 4
1010 10 0xA 4
1111 15 0xF 4


Byte usually represents 8 bit.
Can you understand how it can represents decimal range?
I said 4 bit represents from 0 to 15 In previous paragraph.
As 8 bit equals 4 bit add 4 bit, it is calculated by below expression.
16 * 16 = 256
So 8 bit can represent from 0 to 255 in decimal, and type of 256 number.

Let’s expand previous table until 8 bit.

Binary Decimal Hexadecimal Number of bit
0 0 0x00 1
1 1 0x01 1
10 2 0x02 2
11 3 0x03 2
100 4 0x04 3
111 7 0x07 3
1000 8 0x08 4
1010 10 0x0A 4
1111 15 0x0F 4
10000 16 0x10 5
10001 17 0x11 5
11111 31 0x1F 5
100000 32 0x20 6
111111 63 0x3F 6
1000000 64 0x40 7
1111111 127 0x7F 7
10000000 128 0x80 8
11111111 255 0xFF 8

Mmm, it seems difficult at a glance. But it is easy to understand if you read it little by little.
Let’s look into decimal 64.

Binary Decimal Hexadecimal Number of bit
1000000 64 0x40 7

First I split binary to two parts. I make each part 4 bit.
100 – 0000
The left part is 100. It is represented 0x4 in hexadecimal.
The right part is 0000. It is represented 0x0 in hexadecimal.
So in hexadecimal, it is represented 0x40.


ASCII table is character code table.
>> ASCII Table and Description

Let’s add this ASCII code column to previous table we made.

Binary Decimal Hexadecimal ASCII character Number of bit
0 0 0x00 NUL 1
1 1 0x01 SOH 1
10 2 0x02 STX 2
11 3 0x03 ETX 2
100 4 0x04 EOT 3
111 7 0x07 BEL 3
1000 8 0x08 BS 4
1010 10 0x0A LF 4
1111 15 0x0F SI 4
10000 16 0x10 DLE 5
10001 17 0x11 DC1 5
11111 31 0x1F US 5
100000 32 0x20 Space 6
111111 63 0x3F ? 6
1000000 64 0x40 @ 7
1000001 65 0x41 A 7
1010001 97 0x61 a 7
1111111 127 0x7F DEL 7
10000000 128 0x80 8
11111111 255 0xFF 8

Over decimal 127, there seem to be several type of extended ASCII table.
So I didn’t write character.

Let’s look into row of character ‘A’.

Binary Decimal Hexadecimal ASCII character Number of bit
1000001 65 0x41 A 7

Character ‘A’ is equal to decimal 65, and hexadecimal 0x41.

Character and int in language C

Previous paragraph shows you relationship between character code and decimal and hexadecimal.
I show you simple C code.

#include <stdio.h>

int main(int argc, char const *argv[])
	char c, c2;
	int i, j;

	c = 'A';
	printf("c is %c. character code is %d, binary is %x\n", c, c, c);
	//c is A. character code is 65, binary is 41

	i = 97;
	printf("i is %c. character code is %d, binary is %x\n", i, i, i);
	//i is a. character code is 97, binary is 61

	//char to int
	j = c;
	printf("j is %c. character code is %d, binary is %x\n", j, j, j);
	//j is A. character code is 65, binary is 41

	//int to char
	c2 = i;
	printf("c2 is %c. character code is %d, binary is %x\n", c2, c2, c2);
	//c2 is a. character code is 97, binary is 61

	return 0;

Over One Byte

You can understand one byte. But it seems you have to use more than one byte in ordinary programming.
So I am going to write down it on next article.

[SQLite3] SQLite on Mac and compile with gcc

February 8th, 2012

I needed to learn SQLite for my client work and had enjoyed it.

on terminal

Fortunately SQLite is pre installed in mac OS.

So you can create database instantly.
This code creates database named hello.db.
But actual file won’t create if you don’t execute any SQL command.

sqlite3 hello.db

If you finish sqlite, type “.exit” .

You can configure settings of SQLite with using ~/.sqliterc .

.echo ON
.mode column
.headers ON
.nullvalue "NULL"

If you put this file, sqlite start with these settings.

Create table.

sqlite> create table hello (id integer primary key, message text);

Insert row.

sqlite> insert into hello (message) values ('hello');

You have to be careful typing string literal.
In SQLite string literal is recommended to delimite with single quotes.

Select data

sqlite> select * from hello;

OK. Although these are the most basic SQLite command in terminal, these are enough to develop.

Let’s start to develop in C.

SQLite with gcc

I am interested in gcc. Because I wonder if I don’t have to use XCode when I compile C.


#include <stdio.h>
#include <string.h>
#include "/usr/include/sqlite3.h"

int main(){
	sqlite3 *db;
	int result, id;
	sqlite3_stmt *stmt;
	char *sql, *name;

	result = sqlite3_open_v2("hello.db", &db, SQLITE_OPEN_READONLY, NULL);
	if(result != SQLITE_OK){
		printf("database opened\n");
		return 1;

	sql = "select * from hello;";
	result = sqlite3_prepare_v2(db, sql, strlen(sql), &stmt, NULL);

	if(result != SQLITE_OK){
		printf("statement error");
		return 1;

	result = sqlite3_step(stmt);
	while(result == SQLITE_ROW){
		id = sqlite3_column_int(stmt, 0);
		name = (char *)sqlite3_column_text(stmt, 1);
		printf("id = %d, name = %s\n", id, name);
		result = sqlite3_step(stmt);
	return 0;

As mac has sqlite3 library, we can include sqlite’s header file.
#include “/usr/include/sqlite3.h”

Let’s compile it in terminal.
If the compiling succeseed, there is a file named mysqlite1.

gcc -Wall -L/usr/lib/sqlite3 mysqlite1.c -lsqlite3 -o mysqlite1

Test executing.


We can also compile sources with makefile.
Makefile is convenient way to compile multiple sources or link library.

If you make makefile, then it may be this code.


all: mysqlite1

mysqlite1: mysqlite1.o
	$(CC) $(CFLAGS) -L/usr/lib/sqlite3 mysqlite1.o -lsqlite3 -o mysqlite1

mysqlite1.o: mysqlite1.c
	$(CC) $(CFLAGS) -c mysqlite1.c

	rm -f *.o mysqlite1

After you put this file named makefile, execute this command.


If the command execute successfully, mysqlite1 exists in current directory.
And if “clean” command executed, it removes object files( *.o) and mysqlite1.

make clean


This article is based on these books.
>> The Definitive Guide to SQLite
>>An Introduction to GCC: For the GNU Compilers GCC and G++

And these sites.
>> Makefiles by example