Spreadsheets vs. Command Line Utilities vs. SQL (for Pivot Tables)

When processing text files on Linux, you have a lot of choice. Sed, Awk, Perl, or just coreutils, or perhaps a spreadsheet application? I’m a reasonably educated spreadsheet application user, but I’m also a reasonably educated command line user and a reasonably educated SQL user. This article pits the three against each other.

In this article, I’ll show different ways to process a large CSV file: one solution using a spreadsheet application, one solution using standard CLI utilities (GNU coreutils GNU datamash), and one solution using q (http://harelba.github.io/q – Run SQL directly on CSV files) (and one solution using sqlite3, which is almost the same).

Conclusions

Yes, I’m putting my conclusions first. If you need to create a Pivot Table from CSV files, I believe SQL is the best solution. The q utility makes using SQL very comfortable.

The data

The dataset used in this article describes export statistics, i.e., trade from Japan to other countries. We would like to do a simple Pivot Table-like task that would be really easy in Excel: find the total export volume (in JPY) from Japan to a specific country for every HS “section”. Here are some examples of HS sections and their corresponding HS chapters:

Chapters 01-05: LIVE ANIMALS; ANIMAL PRODUCTS
Chapters 06-14: VEGETABLE PRODUCTS
Chapter 15: ANIMAL OR VEGETABLE FATS AND OILS AND THEIR CLEAVAGE PRODUCTS; PREPARED EDIBLE FATS; ANIMAL OR VEGETABLE WAXES

The following links are for import, but that doesn’t matter in our case I think. Here’s the whole table: http://www.customs.go.jp/english/tariff/2018_4/index.htm This table contains links to tables further describing the HS codes in each HS chapter. For example, here’s the table for section I, “LIVE ANIMALS; ANIMAL PRODUCTS”, chapter 01: “Live animals”: http://www.customs.go.jp/english/tariff/2018_4/data/e_01.htm.

The HS codes in our dataset look like this: ‘010121000’; the first two digits correspond to the HS chapter, which is all we are going to look at for now. We have to group by these two digits.

The files

I downloaded all the CSV files on this page: https://www.e-stat.go.jp/stat-search/files?page=1&layout=datalist&toukei=00350300&tstat=000001013141&cycle=1&year=20170&month=24101212&tclass1=000001013180&tclass2=000001013181&result_back=1 (English) and merged them into a single file, data.csv like this:

head -n 1 ik-100h2017e001.csv > header
tail -q -n +2 ik-100h2017e0*csv >> header

The HS chapters/sections are described here: http://www.customs.go.jp/english/tariff/2018_4/index.htm (English. A Japanese page is available too, of course.)

The country codes are listed here: http://www.customs.go.jp/toukei/sankou/code/country_e.htm (English. Japanese is available.)

data.csv.gz
countries.csv
hs_sections.csv
hs_chapters_to_sections.csv
hs_sections_no_to_descriptions.csv

The spreadsheet solution

I won’t go into much detail here. First of all, we add worksheets for all of the above files (or reference external files). Then we add a column to compute the first two digits in the HS codes, using a function like MID(C2,2,2). We use VLOOKUP() to look up the HS section. (Perhaps we use another VLOOKUP() for the country codes.) Then we create a pivot table. (It would be more efficient to VLOOKUP() from the pivot table, but while I believe that to be possible in Excel, I’m not sure it’s possible in OpenOffice/LibreOffice.)

Anyway, using spreadsheets is rather user-friendly, but large files take quite a while to process. Adding extra columns to the original data is very inconvenient too. (Using calculated fields in Excel may help with this.)

The CLI/GNU(?) solution

We are going to make use of GNU datamash here. GNU datamash is capable of grouping and summing, which is already halfway there. For the lookups, we use the join command(!), which is part of coreutils.

We need to do some minor pre-processing, as we do not want the header rows in this solution:

tail -n +1 data.csv > data_nh.csv
tail -n +1 countries.csv > countries_nh.csv
tail -n +1 hs_sections.csv > hs_sections_nh.csv

The other files do not have any headers. So far so good, but using common CLI tools gets a bit awkward in the next step, cutting off characters in the middle of the HS code field. Let’s isolate that field:

$ cut -d, -f3 data_nh.csv | head -n3
'010121000'
'010121000'
'010121000'

Then we cut off the unneeded characters:

$ cut -d, -f3 data_nh.csv | cut -c 2-3 | head -n3
01
01
01

Then we need to re-add the other columns. This is one of the slightly awkward steps when doing this using CLI tools. Let’s isolate the other relevant columns first though:

$ cut -d, -f4,9 data_nh.csv | head -n3
103,2100
105,1800
205,84220

To paste these two columns back onto the first isolated columns, we use the aptly(?) named paste command. The -d option allows use to combine fields using the comma operator. (Default is tab.) We’ll pass the HS section as standard input, and the other two relevant columns using bash’s <().

$ cut -d, -f3 data_nh.csv | cut -c 2-3 | paste -d, - <(cut -d, -f4,9 data_nh.csv) | head -n3
01,103,2100
01,105,1800
01,205,84220

What we have now is a trimmed CSV that goes “HS section”,”Country Code”,”Amount”.

The “VLOOKUP” part is slightly tricky. We are going to use the little-known join command, which is included in coreutils. Some HS sections and some country names have commas in them, which are a bit inconvenient, but not a huge problem as the result of the “VLOOKUP” is attached to the right of the entire original data.

Here’s a quick demonstration of the join command. (Note: countries_nh.csv is pre-sorted. Everything passed to join must be sorted.)

$ echo 222 | join -t, - countries_nh.csv
222,"Finland"

In Excel, we are able to safely group by cells that may contain commas, but not so in datamash. I left out something above: We’ve got the HS chapter code above, but from this chapter code, we wanted to look up the HS section, and group by that section. So let’s go back one step and use join to get us the HS section number from the HS chapter number. Note that all join input must be sorted, so before we add a pipe to sort on the newly created fourth field:

$ cut -d, -f3 data_nh.csv | cut -c 2-3 | paste -d, - <(cut -d, -f4,9 data_nh.csv) | sort -n -t, -k1,1 | join -t, - hs_chapters_to_sections.csv | head -n3
00,103,276850736,0
00,105,721488020,0
00,106,258320777,0

Getting the sort command to sort correctly by a single field isn’t very easy. If it weren’t for the –debug option that is! In this case we want to sort by the first field, so the command becomes ‘sort -n -t, -k1,1’. (Start field == end field == 1, so -k1,1.) Debug output looks like this:

$ cut -d, -f3 data_nh.csv | cut -c 2-3 | paste -d, - <(cut -d, -f4,9 data_nh.csv) | sort -n -t, -k1,1 --debug | head
sort: using ‘en_US.UTF-8’ sorting rules
00,103,276850736
__
________________
00,105,721488020
__
________________
00,106,258320777
__
________________

The field that has been sorted gets underlined. Great! Now let’s do the pivoting part using datamash:

$ cut -d, -f3 data_nh.csv | cut -c 2-3 | paste -d, - <(cut -d, -f4,9 data_nh.csv) | sort -n -t, -k1,1 | join -t, - hs_chapters_to_sections.csv | datamash -s -t, groupby 2,1,4 sum 3
103,00,276850736
103,01,418085
103,03,14476769

The -s option sorts, which is required when using groupby. The -t option selects ‘,’ as the delimiter. This command groups by column 2 (country), and then by column 4 (our HS section number), and computes a sum of column 3 for this grouping. So this is it! If we know the country codes and HS sections by heart, that is.

Well, our above output from datamash starts with the country code, and things are nice and sorted, so we just have to join again:

$ cut -d, -f3 data_nh.csv | cut -c 2-3 | paste -d, - <(cut -d, -f4,9 data_nh.csv) | sort -n -t, -k1,1 | join -t, - hs_chapters_to_sections.csv | datamash -s -t, groupby 2,4 sum 3 | join -t, - countries_nh.csv | head -n3
103,0,276850736,"Republic of Korea"
103,1,15325799,"Republic of Korea"
103,10,50079044,"Republic of Korea"

Next we would like to look up the HS section number to get the HS section description. In the above commands, we joined on the first field, but fortunately join supports joining on different fields. We need to sort on the second field and then tell join to join on the second field, which can be accomplished by using the -1 option and specifying 2 . (So -1 2 or simply -12, though that may look confusing.)

$ cut -d, -f3 data_nh.csv | cut -c 2-3 | paste -d, - <(cut -d, -f4,9 data_nh.csv) | sort -n -t, -k1,1 | join -t, - hs_chapters_to_sections.csv | datamash -s -t, groupby 2,4 sum 3 | join -t, - countries_nh.csv | sort -n -t, -k2,2 | join -12 -t, - hs_sections_no_to_descriptions.csv | head -n3
00,103,276850736,"Republic of Korea","Unknown"
00,105,721488020,"People's Republic of China","Unknown"
00,106,258320777,"Taiwan","Unknown"

That’s it! To get e.g. Finland, we’ll make it easy for ourselves and just grep for Finland:

$ cut -d, -f3 data_nh.csv | cut -c 2-3 | paste -d, - <(cut -d, -f4,9 data_nh.csv) | sort -n -t, -k1,1 | join -t, - hs_chapters_to_sections.csv | datamash -s -t, groupby 2,4 sum 3 | join -t, - countries_nh.csv | sort -n -t, -k2,2 | join -12 -t, - hs_sections_no_to_descriptions.csv | grep Finland
0,222,1758315,"Finland","Unknown"
2,222,10613,"Finland","VEGETABLE PRODUCTS"
3,222,654,"Finland","ANIMAL OR VEGETABLE FATS AND OILS AND THEIR CLEAVAGE PRODUCTS; PREPARED EDIBLE FATS; ANIMAL OR VEGETABLE WAXES"
4,222,45021,"Finland","PREPARED FOODSTUFFS; BEVERAGES, SPIRITS AND VINEGAR; TOBACCO AND MANUFACTURED TOBACCO SUBSTITUTES"
5,222,33611,"Finland","MINERAL PRODUCTS"
6,222,2624353,"Finland","PRODUCTS OF THE CHEMICAL OR ALLIED INDUSTRIES"
7,222,4880410,"Finland","PLASTICS AND ARTICLES THEREOF; RUBBER AND ARTICLES THEREOF"
8,222,12557,"Finland","RAW HIDES AND SKINS, LEATHER, FURSKINS AND ARTICLES THEREOF; ADDLERY AND HARNESS; TRAVEL GOODS, HANDBAGS AND SIMILAR CONTAINERS; ARTICLES OF ANIMAL GUT (OTHER THAN SILK-WORM GUT)"
9,222,3766,"Finland","WOOD AND ARTICLES OF WOOD; WOOD CHARCOAL; CORK AND ARTICLES OF CORK; MANUFACTURES OF STRAW, OF ESPARTO OR OF OTHER PLAITING MATERIALS; BASKETWARE AND WICKERWORK"
10,222,38476,"Finland","PULP OF WOOD OR OF OTHER FIBROUS CELLULOSIC MATERIAL; RECOVERED (WASTE AND SCRAP) PAPER OR PAPERBOARD; PAPER AND PAPERBOARD AND ARTICLES THEREOF"
11,222,527084,"Finland","TEXTILES AND TEXTILE ARTICLES"
12,222,1541,"Finland","FOOTWEAR, HEADGEAR, UMBRELLAS, SUN UMBRELLAS, WALKING-STICKS, SEAT-STICKS, WHIPS, RIDING-CROPS AND PARTS THEREOF; PREPARED FEATHERS AND ARTICLES MADE THEREWITH; ARTIFICIAL FLOWERS; ARTICLES OF HUMAN HAIR"
13,222,991508,"Finland","ARTICLES OF STONE, PLASTER, CEMENT, ASBESTOS, MICA OR SIMILAR MATERIALS; CERAMIC PRODUCTS; GLASS AND GLASSWARE"
14,222,5757,"Finland","NATURAL OR CULTURED PEARLS, PRECIOUS OR SEMI-PRECIOUS STONES, PRECIOUS METALS, METALS CLAD WITH PRECIOUS METAL AND ARTICLES THEREOF; IMITATION JEWELLERY; COIN"
15,222,971561,"Finland","BASE METALS AND ARTICLES OF BASE METAL"
16,222,14614308,"Finland","MACHINERY AND MECHANICAL APPLIANCES; ELECTRICAL EQUIPMENT; PARTS THEREOF; SOUND RECORDERS AND REPRODUCERS, TELEVISION IMAGE AND SOUND RECORDERS AND REPRODUCERS, AND PARTS AND ACCESSORIES OF SUCH ARTICLES"
17,222,13427653,"Finland","VEHICLES, AIRCRAFT, VESSELS AND ASSOCIATED TRANSPORT EQUIPMENT"
18,222,4062385,"Finland","OPTICAL, PHOTOGRAPHIC, CINEMATOGRAPHIC, MEASURING, CHECKING, PRECISION, MEDICAL OR SURGICAL INSTRUMENTS AND APPARATUS; CLOCKS AND WATCHES; MUSICAL INSTRUMENTS; PARTS AND ACCESSORIES THEREOF"
19,222,4550,"Finland","ARMS AND AMMUNITION; PARTS AND ACCESSORIES THEREOF"
20,222,399367,"Finland","MISCELLANEOUS MANUFACTURED ARTICLES"
21,222,20539,"Finland","WORKS OF ART, COLLECTORS' PIECES AND ANTIQUES"

If you need to match column names exactly, you could replace the above grep by something like this:

... | grep -P '^.*?,.*?,.*?,"Finland"

Though personally I’d maybe use awk for that. On my machine, executing this takes 0.675 seconds. That’s pretty fast!

The q solution

q is a tool that allows you to perform SQL queries on CSV files from the comfort of the command line. If you know SQL, that should be pretty cool!

We’ve got some issues with digits and hyphens in the column names, so we first pre-process to get rid of those:

$ head -n 1 data.csv | tr '1-9' 'A-I' | sed 's/-//g'; tail -n +2 data.csv

This uses tr to replace the digits 1-9 with corresponding letters and sed to get rid of hyphens. We pipe this into q. The q command itself looks like this:

$ q -d, -H 'select Description, sum(ValueYear) from - JOIN hs_sections.csv ON substr(HS,2,2)=Number JOIN countries.csv ON Country=CountryID where CountryName="Finland" group by Description'

-d specifies the delimiter, -H specifies the presence of a header row (and we can use these header names in the query!) and the rest is just SQL.

$ time (head -n 1 data.csv | tr '1-9' 'A-I' | sed 's/-//g'; tail -n +2 data.csv) | q -d, -H 'select Description, sum(ValueYear) from - JOIN hs_sections.csv ON substr(HS,2,2)=Number JOIN countries.csv ON Country=CountryID where CountryName="Finland" group by Description'
ANIMAL OR VEGETABLE FATS AND OILS AND THEIR CLEAVAGE PRODUCTS; PREPARED EDIBLE FATS; ANIMAL OR VEGETABLE WAXES,654
ARMS AND AMMUNITION; PARTS AND ACCESSORIES THEREOF,4550
"ARTICLES OF STONE, PLASTER, CEMENT, ASBESTOS, MICA OR SIMILAR MATERIALS; CERAMIC PRODUCTS; GLASS AND GLASSWARE",991508
...
real    0m12.590s
user    0m12.364s
sys     0m0.236s

Wow, this was pretty pleasant, but it took my machine 12.59 seconds to get here. q uses sqlite, and we can use the -S option to save the resulting sqlite database to a file. Here’s an sqlite3 command that executes the same query on a saved database:

time sqlite3 data.sqlite 'select Description, sum(QuantityAYear) from `-` JOIN `hs_sections.csv` ON substr(HS,2,2)=Number JOIN `countries.csv` ON Country=CountryID where CountryName="Finland" group by Description;' 
ANIMAL OR VEGETABLE FATS AND OILS AND THEIR CLEAVAGE PRODUCTS; PREPARED EDIBLE FATS; ANIMAL OR VEGETABLE WAXES|0
ARMS AND AMMUNITION; PARTS AND ACCESSORIES THEREOF|0
ARTICLES OF STONE, PLASTER, CEMENT, ASBESTOS, MICA OR SIMILAR MATERIALS; CERAMIC PRODUCTS; GLASS AND GLASSWARE|7436
...
real    0m0.218s
user    0m0.192s
sys     0m0.024s

As you can see, that is pretty fast. So it spends quite a bit of time importing the CSV file. Well, as it turns out, sqlite3 supports importing from CSV files as well. Here’s a command that creates a database in test.sqlite, imports the three required CSV files, and runs the query:

$ time (sqlite3 -csv test.sqlite '.import data.csv data'; sqlite3 -csv test.sqlite '.import hs_sections.csv hs_sections'; sqlite3 -csv test.sqlite '.import countries.csv countries'; sqlite3 -csv test.sqlite 'select Description, sum(`Quantity1-Year`) from data JOIN hs_sections ON substr(HS,2,2)=Number JOIN countries ON Country=CountryID where CountryName="Finland" group by Description; ')
"ANIMAL OR VEGETABLE FATS AND OILS AND THEIR CLEAVAGE PRODUCTS; PREPARED EDIBLE FATS; ANIMAL OR VEGETABLE WAXES",0
"ARMS AND AMMUNITION; PARTS AND ACCESSORIES THEREOF",0
"ARTICLES OF STONE, PLASTER, CEMENT, ASBESTOS, MICA OR SIMILAR MATERIALS; CERAMIC PRODUCTS; GLASS AND GLASSWARE",267696
...
real    0m2.581s
user    0m2.372s
sys     0m0.120s

This is much faster than using q, but may have various limitations. Note that if you feed sqlite3 commands through standard input, you can do all this in a single sqlite3 session, and the database can be entirely in-memory.

海外発行のクレジットカードで Amazon.co.jp で音楽を購入する方法

日本のクレジットカードを入手するのはなかなか困難なので、海外のクレジットカードをずっとそのまま使い続ける方、結構いらっしゃるではないでしょうか?少なくとも私はそうです。国際送金での返済など、不便は多いですね。

今回は、Amazon.co.jp のデジタルミュージックストアにて西野カナ氏の「abracadabra」という曲を購入しようとしたら、「 現在登録されているお支払い情報では、お客様のご購入を処理することができませんでした。日本国内で発行されたクレジットカードをご使用ください。」というエラーメッセージが表示され、購入できませんでした。(ちなみに、普段聞いている音楽は結構違うのですが、この曲のノリとかバックグラウンドのピアノとか、なかなか良かったです。)

でも実は、ギフトカード払いもできるのです。なお、ギフトカードを買うためにわざわざコンビニまで足を運ぶ必要もありません。なぜなら、Amazon のギフトカードは直接 Amazon で購入し、ギフトコードをメールで受け取ることができるからです: Amazonギフトカード(Eメールタイプ)。自分のメールアドレスを入力し、海外のクレジットカードで支払います。

デジタルミュージックストアに戻り再度購入しようとすると!あれ、同じエラーメッセージが表示されています。話を長くしても面白くないですよね。続いて、Amazon の支払い設定で、クレジットカード情報を消してみたら、見事、先程購入したギフトカードでの支払が可能になりました!

(実は、西野カナの「ダーリン」という曲も好きです。)

Beach Cleaning in Matsue, Japan

Ocean trash
Ocean trash

Now that I’m living in Matsue, I often find myself not having much to do. Which means I’m usually sitting at my computer or sitting on my bicycle. One of my first destinations was the sea, which is about 10 km north from where I live.

The spot marked “須々海海岸” on Google Maps is overwhelmingly beautiful and saddening at the same time. While the pictures shared on Google Maps may show you that this is indeed a very beautiful spot, most of these pictures do not show that there is a lot of plastic trash on the beach.

So not having much to do, being somewhat young (28 back then) and being reasonably environmentally minded, I one day decided to see if I could maybe help clean this place up. Unfortunately, my Google queries for beach cleanup activities in Matsue didn’t yield any results, so I just decided to buy a pair of (gardening) gloves and a pack of large trash bags and get some cleaning done.

It turned out to be a great way to pass the time (in late spring, when it isn’t crazy hot and mostly not raining), so I kept coming back, and decided to continue until the tsuyu (rainy season) would kick in.

Ocean garbage collection application form
Ocean garbage collection application form

Just gathering the trash is of course not quite enough. You need to get it to the waste processing facilities. So I just went to the town hall and asked the person at the entrance what to do. I was told to go to the “volunteer” department at the 松江市環境センター (Matsue Environmental Office), where I had to fill out a form (pictured) with the following information: personal information, pick-up address (no house means no address, so this is a bit hard, but the guy at the counter really knew his way around town, and showing him the place on Google StreetView helped a bit too), the number of trash bags, cleanup date, next date in case rains gets in the way. After filling out the form, I got the number of Matsue-branded trash bags that I’d put on the form, at which point I had to explain that I’d actually already started cleaning, unfortunately using regular unlabeled trash bags. That was fine, but he told me to use the right bags next time. The form allows you to tick 自己搬入 (bringing in the trash yourself), but you’d probably have to explain yourself if you want to do that. I opted to have a truck pick up the trash I’d pile up at the side of the road, which usually takes place within one week after your cleanup date.

Some collected ocean trash
Some collected ocean trash

Not knowing much about the  recycling facilities here, I generally sorted the trash by type: plastic bottles (of which there are many, many), plastic bottle labels, plastic bottle caps, styrofoam, hard plastic (probably mostly originating from buoys), soft plastic (think polyester), random other plastic. I had no intention of taking care of tree branches/logs, and was in fact told not to pick those up, as they wouldn’t fit into the plastic bags anyway.

Random thoughts

  • Japanese beaches may have a lot of ugly フナムシ (sea roaches). They will definitely crawl all over your bags, so make sure to close them properly. :p
  • This place doesn’t have a lot of people come by, but the people I did meet were quite eager to talk. Mostly older guys who have come out to do some fishing.
  • Carrying the trash bags from the beach up to the road (which is probably a 20 m altitude difference) was pretty tough, but very, um, good exercise. Combined with the 10 km (very much non-flat) ride on the bicycle… it was pretty intense. :p
  • I’ll probably re-commence my cleaning activities when it gets a bit cooler, perhaps in September. Hoping the place won’t be infested by spiders.
  • One day, I found that someone had helped during my absence \o/

Cooking Western-Style in Japan

If you’re finding yourself longing for some western dish that is generally not available in Japanese restaurants, perhaps something your mom made when you were child, your only option may be to cook the dish yourself. Maybe this article will help you find the necessary ingredients? If you don’t find your answer here, feel free to leave a comment.

Supermarkets

First of all, if you can’t find what you’re looking for, try a bigger supermarket. If you are in Tokyo, you may have some trouble finding a big one, so here’s a list of supermarket chains that tend to have bigger stores:

  • イトーヨーカドー (Ito Yokado)
  • マルエツ (Maruetsu)
  • ライフ (Life)
  • ダイエー (Daiei)
  • マックスバリュー (Max Value)

In addition, these two places have a strong selection of imported goods and are partially geared towards people buying in bulk:

  • 肉のハナマサ (Niku no Hanamasa)
  • 業務スーパー (Gyoumu Suupaa / Super / Supermarket)

Here are some well-equipped import stores:

  • 成城石井 (Seijou-Ishii)
  • Kaldi Coffee Farm (Weird name, but just a normal store)
  • Lapin (local chain in Matsue, Shimane) has a good selection of imported goods

Stocks

This is a very popular stock for western foods: Ajinomoto Consomme. According to the ingredients it includes both chicken and beef extracts. There are other stocks available, including chicken, beef, and vegetable stocks, but not all supermarkets have all of these. Beef stock feels a bit less common, and vegetable stock almost rare.

Milk products

Milk products are quite pricy in Japan. You can get milk, yoghurt, cream, sour cream, and various types of cheese at most supermarkets. Butter is available, but often sold out. (Reportedly, especially before February 14.) The types of cheese available at supermarkets are as follows:

  • Shredded cheese (practically everywhere — usually imported and consisting of cheddar, gouda, mozzarella) (unless you buy in bulk, expect to pay 100-200 JPY per 100 g)
  • Those wrapped square processed cheese slices (practically everywhere) (about 200 yen for a pack of ~10 slices)
  • Cream cheese:
    • Philadelphia (available at most supermarkets) (about 400 yen for a 200 g pack) (you’ll sometimes find a cheaper, very similar product by メグミルク (Meg-Milk))
    • Camembert* (available at most supermarkets)
    • Cottage cheese (available at some supermarkets)
    • Mascarpone* (available at some supermarkets)
      * Not sure if these count as cream cheeses
  • Mozzarella (round balls) (available at many supermarkets, but about 300 JPY per 100 g)
  • Parmesan cheese (available at most supermarkets in powder form)
  • Cheese in tiny portions to be eaten as a tsumami (can be quite high-quality)
  • Cheese in small portions to be eaten as a snack (I recommend さけるチーズ (sakeru chiizu))

Bigger supermarkets may sell packets of non-sliced gouda and/or cheddar. For other kinds of cheese, you may have to try an import store or the basement floor of an expensive department store. (Note: you’ll pay about 1000 JPY per 100 g of cheese at the department store.)

By the way, here are the reasons butter is often hard to get (from what I’ve gathered):

  • Milk products are made according to a priority production system:
    milk, cream > cheese, yoghurt > butter
  • Low-fat milk isn’t very popular in Japan

Condiments

Ketchup, mayonnaise and mustard are available, but Japanese mayonnaise is made differently and tastes a bit different. You can get western-style mayonnaise at import shops like 成城石井 (Seijou-Ishii). There are three types of mustard that are widely available in Japan: Japanese mustard (からし, karashi), French Dijon mustard, American yellow mustard. Karashi is similar to wasabi or horseradish in pungency. Ketchup appears to be about the same as everywhere else.

As for vinegar, you will find at least wine vinegar (red and white) and balsamic vinegar. I’ve never seen malt vinegar in shops, but it appears to be available on Amazon.
The most common types of vinegar are 穀物酢 (kokumotsu-su, grain vinegar) and rice vinegar. Grain vinegar is pretty cheap, but I wouldn’t recommend buying it over the slightly more expensive rice vinegar if you intend to use it in food. (Of course, our mileage may vary.)

Oil

  • Olive oil is widely available
  • Vegetable oil is widely available (often rapeseed or sunflower)
  • Flaxseed oil (亜麻仁油) is usually available in bigger supermarkets (very pricy though)

Aromatic vegetables

Onions, scallions, leek, garlic, green peppers, and carrots are all widely available. Celery stalks and leaves are often available, but I’ve never seen celery root. Shallots are rare.

Other vegetables

  • Widely available: broccoli, spinach, cabbage (red cabbage isn’t that widely available), lettuce, tomatoes, eggplant, cucumbers, bell peppers, radish (daikon)
  • If you’re into pumpkins/squashes, Japan has kabocha: green outside, orange inside, both parts being edible. That’s the only type of squash that I’ve seen, but very widely available.
  • Slightly less common: cauliflower (expensive (300 JPY for a small head) in Tokyo, cheap (150+ JPY for a larger head) in Shimane), zucchini (usually not available in winter)
  • Usually not available in supermarkets: Brussels sprout, kale (I’ve seen both though)

Everything else may be difficult to find.

Canned vegetables

The Gyoumu Supermarket generally shines in the canned goods category.

  • Canned tomatoes are widely available, usually for less than 100 JPY
  • Canned corn is widely available (also the only item in this category that has a good chance of not being imported)
  • Canned/glass-jarred olives are often available at supermarkets. You can get them cheapest at the Gyoumu Supermarket.
  • Canned (white) asparagus is often available in supermarkets. Green asparagus is often available fresh, especially in spring. Fresh white asparagus is available sometimes, but a bit pricey
  • Canned/glass-jarred pickled cucumbers (gherkin) are available at many supermarkets, but pretty pricey. Try the Gyoumu Supermarket

Legumes (Beans)

The Gyoumu Supermarket shines here, too.

  • Canned kidney beans are available in most supermarkets. Some supermarkets may have dried beans. Definitely available at the Gyoumu Supermarket
  • Canned chickpeas are slightly less common than kidney beans, but still reasonably available. Definitely available at the Gyoumu Supermarket
  • Lentils are pretty rare. Try Seijou-Ishii and similar supermarkets. Not available at the Gyoumu Supermarket, as far as I know
  • Broad beans are sometimes used in Japanese cooking, and thus sometimes available fresh. Otherwise they may be available dried
  • Normal green beans (いんげん, the long ones) are available frozen at the Gyoumu Supermarket, and sometimes fresh
  • Regular peas are available frozen

Fresh herbs

Most supermarkets with a non-tiny vegetable section will have parsley. If it’s a bigger supermarket, they will probably have other fresh herbs. Basil is the most common. You’ll often find rosemary and sage.

  • Parsley (commonly available)
  • Basil (reasonably commonly available)
  • Mint (if basil is available, mint is probably available too)
  • Rosemary, sage, chervil (available in some stores)

Everything else may be difficult to find, but have a look at SB’s lineup of fresh herbs.

Non-fresh herbs and spices

Most herbs and spices that I’m familiar with are mostly available.
Here are some herbs that might be hard to find in stores: caraway, non-generic varieties of paprika, marjoram. (Try Amazon if you can’t find your favorite herb or spice in the stores.)
Most stores sell herbs and spices in tiny bottles containing 3-10 g of actual product. In the case of paprika, you’re likely to use up the entire bottle for a single meal. If you regularly use a certain herb or spice a lot, you may be better off buying in bulk from Amazon.
For curry mixes, you usually have two choices: Garam Masala and a typical mix that produces the flavor of Japanese curry.

Mushrooms

  • Common mushroom (commonly available, but expensive, though much cheaper here in Shimane)
  • Oyster mushroom (ヒラタケ, hiratake) (commonly available, and not quite as expensive) (also used in Japanese cooking) (never used it)
  • Hen-of-the-woods (舞茸, maitake) (commonly used in Japanese cooking and therefore commonly available and cheap; works well in many western dishes)
  • Porcini are only available in dried packs, and most supermarkets don’t seem to have them

Meat

  • Beef is expensive, and often imported from the US or Australia
  • Pork feels neither expensive nor cheap, and is usually Japanese produce
  • Chicken feels very cheap, and is usually Japanese produce

You can get minced meat of all of the above. Occasionally, you’ll find a supermarket that doesn’t have minced beef. (This seems to be a more common occurrence in Shimane.) The most common type of minced meat is a mix between beef and pork.
Most supermarkets will also sell steaks, but you’ll probably pay 1000 JPY or more for a decent-sized one.
Wiener sausages are available at virtually all supermarkets. Most supermarkets will have a small selection of non-wiener sausages. If you want to eat decent sausages, I recommend the こだわり生フランク (kodawari nama-furanku) from the Gyoumu Supermarket. I think these are probably among the best sausages you can buy in Japan.
Other types of meat may be hard to find, but some supermarkets have mutton now.

Fish

Lots of fish in Japan.
Smoked salmon, canned tuna and canned anchovy are available. Herring is available, but soused herring isn’t. (Justification for this factoid: I know a Japanese guy who loves soused herring.)

Nuts

All nuts that I’m familiar with, except hazelnuts, are available at most supermarkets, though (unless they’re peanuts) usually quite expensive.

Flour

Most supermarkets have only two types of flour: 薄力粉 (hakurikiko) and 強力粉 (kyourikiko). Hakurikiko is cheaper, and is usually used for cakes, cookies, okonomiyaki, and tenpura. Kyourikiko is used for bread. Both are non-whole-wheat. To get whole-wheat, rye, and other types of flour, go to Seijou-Ishii or similar import stores.

Carbs

  • Japanese rice works just fine in western dishes (including risotto)
  • Potatoes are expensive. They’re more used as a vegetable, rather than a source of carbs in Japanese cooking
  • Frozen french fries are available. You can get them much cheaper at the Gyoumu Supermarket than at most other places
  • Pasta is available, but I have a feeling that the cheap stuff tastes a bit odd. ~100 yen per 250 g seems to get you good quality. (I kind of have a feeling that low-quality pasta tends to get some unwanted flavor from its packaging.) Small supermarkets often only have spaghetti or fast-cooking pasta
  • Cornflakes are widely available
  • Oatmeal is starting to appear in store shelves
  • I’ve seen couscous at Kaldi Coffee Farm and Lapin in Matsue
  • Bread is explained in the next section

Bread

Perhaps we’ve come to the most disappointing part of this article. (Note that I’m not trying to be objective in this paragraph.)
White bread that you would toast before eating is ubiquitous. Other kinds of bread will be harder to find. Bread that contains a small percentage of rye is becoming more common these days, but bread with a significant ratio of rye, let alone pure rye bread, is exceedingly rare. There are bakeries in Japan, but if you go into one, you’ll often find that filled bread is way more common than “naked” bread. If you’re lucky, you’ll find something without any fillings, but most will be white bread: baguettes, croissants. Many bakeries will sell something called パン・ド・カンパーニュ (Pain de campagne), which may be quite passable. (It uses sourdough.) If you don’t have an obvious bakery in your vicinity, try some of the chains:

  • Anderson http://www.andersen.co.jp/ is quite okay.
  • Linde (http://www.lindtraud.com/) in Tokyo has pretty good bread.
  • The best bread I’ve had in Japan was from Maison Kayser in Sunshine City in Ikebukuro, Tokyo. However, when I went to check them out (on May 28, 2017), they didn’t have any dark bread for some reason. :(
  • High-quality supermarkets like Seijou-Ishii usually have decent bread too.

By the way, this raisin and walnut stone oven bread tastes very nice and is possibly available at many Aeon stores.

So what to put on your bread? Japan doesn’t have a large selection of spreads, but peanut butter, nutella, (at least) strawberry jam, cheese (see above), and some types of meat are available at most supermarkets. In supermarkets, you’ll often see small Real salami is pretty expensive. Seijou-Ishii and the Gyoumu Supermarket usually sell bruschetta spreads.

You’ll often see peanut butter and strawberry jam being sold in small containers for about 120 JPY that look like in the image pictured here on the right. This stuff, especially the peanut butter, tastes pretty bad, in my opinion. The cheap price may entice you to buy this, but don’t say I didn’t warn you. :p

CVE (Description) Generator / CVEジェネレーター

https://blog.qiqitori.com/cve_generator/ ← Newest CVE Generator version
https://github.com/qiqitori/cve-generator ← GitHub

I’ve been thinking of creating a small tool that is capable of creating CVE descriptions. The benefit of having such a tool would be:

  • Generating perfect descriptions in other languages without translating manually
  • Predictable (==theoretically, parseable) descriptions
  • High-quality output for people submitting a vulnerability description for the first time

CVE descriptions usually look like this:

Heap-based buffer overflow in the jpc_dec_decodepkt function in jpc_t2dec.c in JasPer 2.0.10 allows remote attackers to have unspecified impact via a crafted image.

This has the following pieces of information:

  • Locality (function and file name) (jpc_t2dec.c, jpc_dec_decodepkt())
  • Software name (JasPer)
  • Software version (2.0.10)
  • Attacker type (remote)
  • Impact (unspecified)
  • Using what? (specially crafted image)

Most CVE descriptions appear to contain no more and no less information than this.

One picture is worth a thousand words, so here’s a screenshot to give you an idea of how this could work:

screenshot_v1

The whole thing works entirely in JavaScript and doesn’t send any data anywhere. The code is currently pretty easy to grok, and probably anything but over-engineered.

To add a language, one would copy one of the existing .js files to create a base. The file name scheme is: cve_generator_VERSION_LANGUAGECODE.js. In these files, you have a large dictionary to translate option values to actual text, which looks like this:

 var tl = {
     "generic_vulnerability": "脆弱性",
     "generic_vulnerabilities": "複数の脆弱性",
     "memory_leak": "メモリリーク",
...

Then you have a couple of functions that are each responsible for creating a small sentence fragment, and one function that adds all these fragments together. These functions differ a bit depending on the grammar of the language in question.

Anyway, this thing probably lacks a lot of features. If you need anything, feel free to leave a comment here or on GitHub, or even send a pull request.

(License: GPLv3, but feel free to copy and paste the base and/or any minor bits for use in entirely unrelated projects (without any restrictions and under any license of your choosing)

 

以下同じ内容を日本語で書きます。

https://blog.qiqitori.com/cve_generator/ ← 最新のバージョン
https://github.com/qiqitori/cve-generator ← GitHub
スクリーンショットは上記の英文に貼ってあります。

CVE の説明文を「生成」してくれるツールみたいなのほしいと思って、何もあまり考えないで早速作ってみました。
ツール化するメリット:

  • 英語版と日本語版を一気に作れる。もちろん、他の言語も(未実現ですが)
  • 微妙な違いはないため、理論上パースもできるはず
  • 初めて CVE 文章を作る人の役に立つ

さて、CVE の説明文は大体みんなこんな感じです:

Heap-based buffer overflow in the jpc_dec_decodepkt function in jpc_t2dec.c in JasPer 2.0.10 allows remote attackers to have unspecified impact via a crafted image.

この文章に含まれている情報は以下の通りです:

  • ソフトウェア名 (JasPer)
  • ソフトウェアバージョン (2.0.10)
  • 攻撃者の種類 (リモート)
  • 影響 (不特定)
  • 入力方法など (巧妙に細工された画像ファイル)

作成したツールのコードは JavaScript で書かれていて、実行環境はブラウザーで、外部ネットワークアクセスは発生しません。まだ、オーバースペックから程遠いコードだと思います。笑

現在は、新しい言語を追加するのには、既存の .js ファイルを丸ごとコピーして要編集のところを編集するというイメージです。ファイル名は適当に cve_generator_VERSION_言語コード.js に決まっています。これらのファイルの中に、以下のようなオブジェクトを使って翻訳を入れます。

var tl = {
    "generic_vulnerability": "脆弱性",
    "generic_vulnerabilities": "複数の脆弱性",
    "memory_leak": "メモリリーク",
...

そのほかに、小さい文断片を返してくれる短い関数と、これらの関数が返す文断片をつないでちゃんとした文章を作る関数があります。言語によってやるべきことが違っていて、関数の構造もみんな微妙に違うので、あまりにも膨大化しすぎたら管理しづらくなりそうですが、まぁそのかわり開発時間は数時間で済みました。笑

とにかく機能はまだあまりありません。何か欲しいロジックなどありましたらご連絡ください~

ライセンスは、一応 GPLv3 ですが、ぜんぜん違うソフトを作るのに役に立ちそうなものがあったら、ぜひ GPLv3 と関係なく、著作権がないと考えて好きなように摘み取ってください。

Living in Matsue (And/Or: Living in the Japanese Countryside, Living at Leopalace, Moving in Japan on the Cheap)

About 2.5 months ago, I moved away from Tokyo (Kawasaki actually). I now live in Matsue, Shimane prefecture. Matsue is the prefecture capital of Shimane, and is known for being the city that Matsumoto Yukihiro (the creator of the Ruby programming language) lives in, and for the sunset on Lake Shinjiko (宍道湖).

Update 2017-05-11: Matsumoto Yukihiro published an article on Medium (Japanese) shortly after I posted this one explaining his reasons for moving here.

Leopalace

Back in Kawasaki, I lived in a shared house. Now, I live in a Leopalace apartment. Leopalace apartments are (usually?) furnished and almost ready to live in. There’s an AC, a fridge, microwave, small desk, various closets (I like the one under my bed, real room saver). You will still need a futon, kitchenware, clothes, towels, toilet paper.

In Kawasaki, my rent was about 63,000 JPY per month. Now it’s around 53,000 JPY, and I have a lot more space, plus my own kitchen and bathroom. (I also have to pay for electricity, water, and gas however.) Leopalace in Matsue has much cheaper places too, but I prefer newer buildings with heat insulation and soundproofing. (Also, if you do not necessarily need a furnished apartment, you can find much cheaper places.) My building is from 2002, and seems to have pretty decent insulation. (I haven’t had to use my air conditioner in over a month.) You may have heard that Leopalace buildings have poor soundproofing, but that’s not really the case for my apartment at least. I can sort of hear my upstairs neighbor’s washing machine and (sometimes) phone vibrations, but no music or talking.

Working in Shimane

So how do you get a job in Shimane? Well, it turns out that Shimane has a lot of IT companies, and the prefectural government is pretty proactive about recruiting new people. I went to this event: GO島根!ITエンジニア転職フェア (held in Tokyo), talked to a dozen companies, and ended up applying at a handful, getting offered a job at two, and (obviously) taking only one. The event organizers use the label “UI-turn” (presumably from “UI” and “U-turn”) for the act of going (back in many cases) from Tokyo to Shimane for work. (Update 2017-06-20: it doesn’t appear to have anything to do with “UI” as in “user interface”. It’s just U-turn and inbound? turn.)

There’s a small problem with these companies: they’re mostly headquartered in Tokyo, so it’ll often feel like working remotely and you’ll probably be talking to people you’ve (almost) never met before, every day. Remember: communication can be pretty tough at the office, even when nobody’s working remotely. Having remote workers makes communication even more challenging. As with all things in life: don’t expect anyone to be an expert at handling remote workers, even if they seem like they should have a lot of experience.

Cycling around Matsue

I really like climbing mountains and riding bikes, and Matsue is pretty good for that. There’s a train line (Ichibata Line) here that allows you to bring your bicycle on the train without taking it apart and packing it in a bag, like you have to do at other train lines. Let me just quickly go off on a tangent: if you need a cheap bicycle that performs pretty well, I recommend giving ドンキホーテ (Don Quijote) a… shot. (Originally no pun intended.) Mine weighs about 12 kg and I bought it at Don Quijote for about 35,000 JPY. (Also the most expensive (non-electric) bicycle they had on offer.) Perhaps you don’t get super-high-quality components, but nothing too shabby, either. I had to replace my brake pads a bit sooner than expected, and my rear tire after about two years (which may be a bit out of the ordinary), but everything else is holding up pretty well. Note: I weigh about 65 kg, so your mileage (originally no pun intended) may vary.

Anyway, I take the bicycle to work, and my commute is about 2.2 km, and there’s an altitude difference of about 60 m. And that’s still a hundred times nicer than taking a Tokyo train during rush-hour. :P

Moving from Kawasaki to Matsue

When moving, your bicycle could cost you a lot. However, if you go to a local bike shop, ask if they have any boxes left that might fit your bicycle, and then pay them (I paid 1,000 yen) to take your bicycle apart and put it in the box (they just had to take off the front wheel in my case), you will probably save money. You’ll be able to send it using ヤマト便 (Yamato-bin), and it probably won’t cost a lot. I had several boxes, plus the boxed bicycle, and a boxed Clavinova digital piano (two boxes), and paid just a bit more than 20,000 JPY in total, which isn’t much for a distance over 800 km. (Note: The prefectural government is likely to reimburse your relocation costs, up to (currently) 100,000 JPY.)

Some friends at the shared house helped me pack the Clavinova. Separating the actual piano from the stand wasn’t that hard actually. Packing involved building two huge boxes out of smaller boxes to fit in the piano and the stand, and putting in a lot of cushioning. (We put my futon in there, and several blankets.) Don’t let anything poke out, such as the pedals, the feet, or the headphone holder. Take everything off and put these things in a separate bag. Putting the thing back together alone is pretty tough, so I contacted a local 便利屋 (benriya), and had a guy come over for a bit more than an hour for about 4,000 JPY. These things don’t have fixed prices, so if you like negotiating you can probably get a better deal. Make sure you put your screws in separate (labeled) plastic bags! Put effort into remembering how you disassembled everything.

Living in Matsue

Matsue has great soba (Izumo is right next to Matsue, and is famous for Izumo soba). Matsue also has Shimane University, and university towns generally, including Matsue, have lots of places to eat and karaoke. (I’ll probably post an article about the restaurants I’ve sampled here sometime in the near future.)

The only thing that doesn’t work out so well is the fact that it’s pretty lonely. There are only four people at my company’s Matsue office, and I’m perhaps a bit too old to have fun with university students, and there don’t really seem to be a lot of people my age (28). There seem to be Ruby-themed events, so maybe I’ll try joining one of those at some point. Also, Osaka and especially Hiroshima are a lot closer than from Tokyo. Unfortunately there is no Shinkansen, and the train system is a bit… useless? (Think one train per hour. Also Hiroshima is just ~180 km away, but the direct train takes about seven hours. Going to Okayama and then taking the Shinkansen is a lot faster but much more expensive.) All this means that people take cars and/or highway buses. From Matsue to Hiroshima the bus is about 3800 JPY, and takes only about three hours. I’ve even taken the highway bus to Tokyo a couple of times. (The normal way to get to Tokyo would involve taking a plane from the nearby airports (Izumo or Yonago).)

Izumo has a very famous shrine, the 出雲大社 (Izumo Taisha), and the neighboring prefecture (Tottori; the border is about 20 km to the east of Matsue), has several interesting spots worth visiting too: a port that harbors a lot of fishing vessels and even a regular connection to Korea and Russia: 境港 (Sakaiminato), the Tottori sand dunes (鳥取砂丘, Tottori Sakyuu), and a famous mountain called 大山 (Daisen). (Japan has a lot of mountains called 大山. The one in Kanagawa is a nice day trip from Tokyo, but the kanji reading is Ooyama.)

Getting a Driver’s License in Japan With 合宿免許 (Gasshuku Menkyo)

I’ve often felt a bit silly for not having a driver’s license, and since I don’t really have much to do at the moment, I decided to get one. In Japan, they have something called 合宿免許, which meansLawson 運転免許 something like “boarding school for driver’s license” or maybe “driver’s license camp”. Long story short, I decided to go to one of these. You can find schools just by googling for 合宿免許, or by going to a convenience store (at least Lawson or Family Mart) and picking up a free brochure (pictured). There is a lot of choice… Some websites show you the ratio between female and male students, some schools offer free onsen (mine had this) or sightseeing trips, some ban alcohol and smoking on the premises, etc.

Some schools maybe don’t have their housing directly on the premises. I would recommend against staying at a hotel or anywhere too far from the actual school, or else you might either be commuting a lot or be trapped at the school between lessons. (I sometimes had three hours between lessons.)

You should also check if the school will make you pay more if for whatever reason you do not manage to graduate within the standard time frame of ~two weeks. My school guaranteed no extra charges for a maximum of five days. Most people manage to get by with zero or one extra day, but one of us used six days, who then had to pay about 12,000 JPY (IIRC) for one extra day. There may also be an age limit (30 or so), after which you do not get any free extra days.

Driving courseI ended up going to the 柿崎自動車学校 (Kakizaki Jidousha Gakkou / Kakizaki Driving School) in Jouetsu, Niigata prefecture, mostly based on the fact that it was the cheapest and that my first choice (in Tottori prefecture) didn’t have any availability on the day I wanted to enrol and also only pays for the night-time bus (rather than the train) for students fruntenmenkyo_no_tabiom Tokyo. The train wouldn’t get you there by 11 am anyway, which appears to be the time enrolment usually starts. (All schools that I looked at “pay” for your traveling expenses.) By the way, I booked this whole thing only two days before my enrolment day. During peak months, this might be a bit difficult, but it worked for me in November. (Payment was via convenience store.)

Here is an important bit: You do not get your license from the school. After graduation, you have to take a theoretical exam at your local 免許センター (menkyo center / licensing center), and this costs ~1,750 JPY for the exam itself and another ~2,050 JPY to get your license issued if you pass the exam. (If you do not pass the exam right away, you have to pay the 1,750 JPY multiple times. Also: ドンマイ!)

The price depends on the season. I went from November 7 to November 22, which is in the cheapest season as far as I know. During peak seasons, the total price could be 50% more expensive. There are a lot of students doing this in the summer and winter vacation weeks/months. I paid 226,800 JPY for an MT license program, single room, three (delicious) meals included every day (two meals on the first and last days). The only thing not included was the examination fee for the 仮免許 (karimenkyo / learner’s permit), but that was maybe 2,000 JPY. There is no fee for the practical exam that you have to take to graduate from the driving school. Also, you shouldn’t attempt to do this if you don’t speak and understand written and spoken Japanese pretty well.

kakizaki_practice_carsThe room included a shower and bath tub, a toilet, a desk, a TV, a fridge, and a well-performing air conditioner. Hair driers were available, but maybe not enough for everyone during the peak seasons. Internet access was via wireless LAN, which got a bit wonky at one point (for everyone). (They fixed it when I reported this at the reception.) Here are a few problems with the room:

  • Cigarette smoke from the neighboring room may enter your room from underneath the connecting door. If this happens, get some tape from the staff and tape it off.
  • Similarly, the connecting door isn’t very sound-proof, so better bring headphones if you want to listen to music
  • The pillow is really thick, hard, and heavy. I’d guess it weighs about 2 kg or so? I doubt it’s very good for you. I ended up using an unused section of my blanket as my pillow.

Textbooks were included in the price. There were four books: one explaining all the rules of driving, one explaining how to actually drive, a short booklet explaining CPR and how to use AEDs, and a booklet with lots of practice exam questions. By the way, all the books (and the exam at the 免許センター) had furigana. (They don’t use particularly complicated language though.) The practice cars were Toyota Corollas.

SchedulesThe learning program is split into two sections: the one before you get the 仮免許 and the one after. Both are about the same length, one week. Both sections have theoretical lessons and practical driving lessons. However, without the 仮免許, you are not allowed on the streets, so you will be practicing on the driving course. My second week was much busier than the first week. If you want to do sightseeing, the first week might be better, but I guess this might depend on the school.

The 仮免許 exam consists of a driving part and a written test. The driving part will be done on the driving course. You’ll just be driving around the course, following directions to turn here and there, going over a (fake, of course) railroad crossing, stop near the top of a slope, and drive over a narrow, S-shaped road. The written test has fifty true-or-false questions. You are allowed to make five mistakes. You are forced to take a few practice exams in the lead-up to this, so you’ll likely be fine. If you don’t manage on the first attempt: ドンマイ!

Most instructors are nice, but some can sometimes be a bit scary when they point out your mistakes. At least at my school, it felt like I got a different instructor every time in the first week, with a few repeats in the second week. There were two instructors who I thought were a bit scary, and the scarier of these two (despite the fact that I only had him once, sometime in the first week) ended up being the examiner on my last day. And he was totally fine during the exam and even praised me a bit.

Side note: I’d managed to lift his (and others’) spirits a bit by wearing this shirt. (Edit: looks like it’s no longer available. It had 仮免ライダー printed on it.) Expensive for something that can only be worn a couple times, but worth it. :D I wore it at the 免許センター as well, but it actually snowed on that November 24, in Yokohama! So it was pretty cold and I couldn’t show it off much.

Most people in the program were in their twenties, but there were some 17/18-year-olds and some over-30s and some over-40s. Many aren’t from Tokyo, but I managed to add some new people to my LINE contacts list. The whole experience is also very 寂しい in some ways: You get to like someone, they graduate before you, and you’re left all alone. :(

I don’t want to spoil too much in case you are planning on doing this, so I’m going to leave it at this for now. But if you have any questions, feel free to post a comment and I’ll get back to you.

If you decide to go to the 柿崎自動車学校, I could in theory hand you a “referral” card that would get both of us? (IIRC) 5,000 JPY, but 5,000 JPY is a pretty small sum compared to the cost of this kind of thing. If you live in or near Tokyo, you might want to consider it though!

One more thing: when you pass the test at the 免許センター, you and the others will probably be ushered into a hall and be asked if you want to support your prefecture’s 交通安全協会 (kōtsū anzen kyōkai / traffic safety association) for a fee of 1,500 JPY (or was it 2,500 JPY?) (your 会員証 will have the same validity as your license for that amount, so no yearly fees). I would have liked to know this beforehand, because you don’t really have much time to decide. (I decided to join in the last moment.) However, it seems that this is a rather inefficient organization, with only 20% of the money being used to actually promote traffic safety, and the rest to pay employees’ salaries, according to this article. There are some other merits beside helping them set up traffic safety booths (this is what I’m imagining anyway):

  • Child safety seat rentals (don’t know how that works)
  • If you get into an accident and have to stay hospitalized for longer than 30 days, you will be paid 300,000 JPY (IIRC)

By the way, I managed the whole thing without owning an 印鑑 (inkan / signature stamp). The written instructions say that you will need a stamp, but on the phone they said that a signature will do. I was a bit worried about that when I arrived at the driving school without a stamp, but it turned out all right.

On living in a shared house (シェアハウス) in Japan

At the time of writing, I’ve lived in two different shared houses, one in Nishi-Nippori (http://nippori.backpackers-guesthouse.com/), and one in Kawasaki (which I’m still living at right now and thus choose not to disclose the location or name of at the moment). Maybe this article will help you figure out if shared houses are a good fit for you.

The first one isn’t really a true shared house. It’s more akin to a capsule hotel that you book for at least one month, except that there is a shared kitchen. Perhaps “dorm” is a better word. It’s quite bad. I wouldn’t recommend staying there for more than maybe a month. (I stayed for about three months and then came back and stayed another five months… Ugh.)

Pros

  • Mostly clean
  • Cheap (36000 JPY per month)
  • You can socialize with people (however: it will be tough if you ever don’t want to do this)
  • It’s on the Yamanote line
  • Obviously you won’t have to buy any furniture (or be able to)

Cons

  • Your “room” isn’t a room at all, but a capsule in a cluster of capsules made of wood. The “door” to your room is a curtain. You won’t be able to stand in the bottom capsules, and only maybe in the top ones.
  • You’ll hear every snore around you.
  • You don’t have any mail privacy either; all mail goes into a single box and everyone goes through it to find their own mail.
  • The neighborhood seems a bit peculiar, having a lot of love hotels.
  • There are only three showers for a maximum of ~60? or ~70? people, so you will most likely have to wait in the mornings.
  • Using the shower costs 100 JPY per 15? minutes.
  • The number of washing machines is pretty low too: two or three if I remember correctly.
  • The kitchen is tiny too.
  • Some of the other people around you might seem depressed.
  • Somebody there stole my wallet when I accidentally left it in the shower room for (I think) less than one hour. (However, I never had anything stolen from my capsule.)

I bet it’s an okay place if you’re a young budget traveler looking to explore Tokyo and socialize for a month. If you’re young, please don’t let people convince you that drinking and smoking are good habits! In any other case you should try to avoid the place.

Now the one I’ve been living in for more than two years! This is one of many shared houses operated by Oak House (https://www.oakhouse.jp/). (Most of them are in Tokyo or nearby.) The one I picked was the second shared house that I wanted to take a look at, and I was mostly convinced when I saw the kitchen having an oven! Most Japanese households don’t have a proper oven. The first one I looked at only had a few rooms and seemed a bit depressing with fluorescent lighting and a rather sad neighborhood (Shin-Koiwa).
Oak House’s website often doesn’t say when a particular property was built, so maybe search for the property’s address and find it listed on other websites, which will often include the year. (This place was built in the 1970s. If possible, maybe try for something newer to get better insulation. :p).

Random facts about the current place

  • I’m paying 63,000 JPY per month.
  • My room is about 10 square meters.
  • Bathrooms, laundry rooms, shower rooms, and kitchen are shared.
  • There’s even a small (big for Japanese standards I guess?) garden (which is mostly used for bicycle and car parking and letting the laundry/futons dry.
  • There are about 25 rooms in total, and they’re occupied most of the time.
  • The rooms come with a bed, reasonably nice desk, fridge, air conditioner, and a closet (押入れ). My closet is divided into three sections – the floor section, where I keep my suit cases and bags, the main section, where I keep my clothes, and the top section (which is pretty hard to reach), which I use for boxes and seasonally useful stuff.
  • The inner walls are reasonably thick — I can listen to music and play on my digital piano without having to use head phones all the time. (I don’t play very noisy pieces in general.)
  • The outer walls are either thin or have bad insulation (as does the ceiling), so it’s pretty cold in winter and pretty hot in summer.
  • You have to pay extra (think about 10,000 JPY) if you decide to let someone stay for longer than three nights in a single month. 10 square meters isn’t that much, so I wouldn’t really recommend roomsharing, though I’ve seen two (petite) sisters share a room for about half a year. I once had my mom over for about three weeks though, which was okay.
  • There aren’t many people around during the day. You’ll probably get to occupy the living room and kitchen all by yourself.
  • With approximately 25 people sharing three showers, I have had to wait in front of the shower rooms only maybe five times so far in these two years.
  • The kitchen tends to be used in the evenings, so you sometimes might have to wait a bit. (It’s big enough for two to three people to do stuff at the same time though.)
  • There are four washing machines, so I’ve never had to wait there.
  • If something breaks, it gets replaced pretty quick — so far, this included at least washing machines, microwave ovens, the shared vacuum cleaners, and frying pans.
  • Wireless internet is included. (We recently got decent routers/access points — Buffalo AirStation Pros, which are quite capable of taking care of the many devices belonging to the 25 people here. The hardware we had before was pretty bad.)
  • You can use up to 100 kWh of electricity per month without being asked to pay extra. However, they only check the meters every six months, so don’t worry if you use more in the winter or summer months, as you won’t be using much in October and April. I’ve never had to pay extra, and I generally try to maintain a comfortable temperature when I’m in.
  • The shared space (kitchen, corridors, shower room, laundry room, toilets) is cleaned by a professional cleaning crew every Saturday from around 1 pm to 2:30 pm. During this time you may not be able to use the showers and kitchen for a while.
  • Another nice thing: If you have a lot of money, you can lend it to Oak House and get a 1,000 JPY discount for every 100,000 JPY that you lend.
  • You can choose to socialize with others, or you can totally stay in your room if you don’t want to. We maybe get some party atmosphere once a month.
  • Oak House’s website allows you to view statistics on gender, age, and nationalities. Most of the people at my shared house are Japanese, most are in their 20s. 36% XX, 64% XY.

I’d say that choosing a nice neighborhood is pretty important. This one is mostly residential, and new. Lots of supermarkets nearby too. It’s about ten minutes to the station, which is pretty good. (By the way, don’t expect to be able to park your bicycle at popular stations.)

When you choose an apartment, shared house or not, pay attention to insulation, what floor you’re on, and what direction your room is facing. If your roof has poor insulation, it’ll be really hot on the top floor in summer and really cold in winter. If you have poor insulation and your room faces west, summer mornings will be okay and afternoons will be brutal, and your AC probably won’t help all that much.

Oak House is the one I’m at right now.
SAKURA HOUSE
is another company that operates shared houses.

If you have any questions, feel free to leave a comment.

クックパッドで見つけた美味しいレシピ、和風&洋風のミックスの編

今年(2016年)の1月から、クックパッドのプレミアム会員です!
今まで見つけた美味しいレシピを共有してもいいのでは?と思って〜
並び順はおすすめ順かな?適当な場合もあるかもしれませんが…
今回は、和風&洋風のミックスの編です!一番わくわくするカテゴリじゃありませんか?^^
和風編はこちらへ
中華編はこちらへ
カレー編はこちらへ

洋風編はこちらへ

http://cookpad.com/recipe/3432724 自宅で作る基本のミートソース
神レシピ!
味噌、料理酒、かつおだし、豚肉が主人公。
パスタよりも、カレーと同じように、ご飯にかけて食べた方が美味しいと思います!
さっきも食べました。これを食べて、この記事を書こう!と思いつきました!
2017年1月30日追記: ほうれん草とかも合います。

http://cookpad.com/recipe/3678114 簡単すぎるトマトクリームうどん
マイルドな味わいで美味しかったです。
作った時のメモによると、うどん400 g、ウインナー 90 gを使用していました。
他のパスタものもうどんで作ってみたいなぁと思います!

http://cookpad.com/recipe/2814803 簡単☆ピザ生地(照り焼きチキン)
美味しいです^^

クックパッドで見つけた美味しいレシピ、洋風編

今年(2016年)の1月から、クックパッドのプレミアム会員です!
今まで見つけた美味しいレシピを共有してもいいのでは?と思って〜
並び順はおすすめ順かな?適当な場合もあるかもしれませんが…
今回は洋風編です。
和風編はこちらへ
中華編はこちらへ
カレー編はこちらへ

http://cookpad.com/recipe/1192653 スウェーデン・レンズ豆のスープ
ヨーロッパでよく食べました!

http://cookpad.com/recipe/2105902 我家の定番ツナベーコントマトパスタソース
そんなに特別なものではないですが、美味しいです^^
塩を減らしてコンソメを入れる時もありますが、意外となくてもいけます!

http://cookpad.com/recipe/1753696 *アボカドとツナのレモン醤油サラダ*
サンドイッチに挟んで食べました。