UTF-8 NFD

emacs를 사용하다가, 한글 표현이 다른 것은 잘 되는데, shell에서만은 유독 한글이 풀어서 나와서 불편했었습니다. 그런데, eshell 에서는 한글 조합이 잘 되는 것입니다. 두 Buffer를 검사했었더니, 모두 utf-8-unix를 쓰고 있었습니다. 다음은 조합이 어떻게 안되는지 보여줍니다.

decomposedKorean-Emacs
한글 조합이 제대로 되어 지지 않은 emacs shell 의 모습
composedKorean-Emacs
한글 조합이 제대로 되어 있는 emacs eshell 의 모습

여러가지로 조사를 해 본 결과, file-name-coding-system 이 utf-8-nfd 일 경우에, eshell은 한글 표현이 제대로 되었습니다. file-name-coding-system이 utf-8-unix로 바뀔 경우, eshell도 한글 조합이 M-x shell 과 같이 풀어서 나오는 것이었습니다.

더 조사를 해보니, 이것은 현재 Carbon Emacs ( GNU Emacs 24.5.1 (x86_64-apple-darwin13.4.0, NS apple-appkit-1265.21) of 2015-04-10 on builder10-9.porkrind.org ) 가 UTF-8의 NFC까지 지원하고, NFD를 지원하지 않는 다는 사실을 알았습니다. ( http://www.emacswiki.org/emacs/CarbonEmacsPackage#toc23 )

Emcas Wiki에 따르면, NFC ( Normalization Form C )는 diacritical marks ( 예: ü )등이 두개로 나누어서 표시된다는 것입니다. 즉, ü 이 u” 와 같이 된다는 것이지요. NFD ( Normalization Form D )에 와서야, decomposed 되어 있는 character가 한개의 composed character로 표현이 됩니다. 즉 ü 가 제대로 잘 보이는 것이지요. 이 문제로 다음과 같은 language는 문제가 될 수 있습니다.

  • All characters containing diacritical marks (accents, umlauts, tilde, etc.)
  • Japanese Kana characters with Dakuten/Handakuten signs
  • Korean Hangul characters

한글도 조합으로 이루어져야 하는데, 조합된 한글이 표현이 안되는 것이라는 것으로 저는 이해를 했습니다.

위의 사이트는 위키에서 참고한 문헌입니다.

문제는 다음과 같이 하여 해결을 했습니다.

(prefer-coding-system 'utf-8-nfd)

다른 방법으로 다음과 같이 해결 할 수도 있습니다.

(setq process-coding-system-alist (cons '("bash" . (utf-8-nfd . utf-8-nfd)) process-coding-system-alist))

또는

(setq file-name-coding-system 'utf-8-nfd)

 

Mac: How to repair permissions in the system.

1. In OS X Yosemite and earlier,

When you have a trouble with the disk in your Mac, you may check if it has the right permission in the system files.

You can check easily by

 sudo diskutil repairPermissions /

or Launch Disk Utility ->Select the Disk you want to repair -> Select “First Aid” -> Click “Repair Disk Permissions”

If your “sudo” fails, you can recover it by this

  1. Enable root
    1. System Preference -> User & Groups -> Login Options -> Network Account Server -> Open Directory Utility …
    2. Select “Edit” -> “Enable Root User”
    3. System Preference -> User & Groups -> Select “Show fast user switching menu as “Full Name”
    4. Then, you can switch root easily.
  2. Login as root or switch to root.
  3. Open Terminal
  4. chmod 4755 /usr/bin/sudo
  5. Done.

2. In OS X El Captain or later,

I’ve referred from How to Verify & Repair Permissions in OS X El Capitan

– Verify a permission error

sudo /usr/libexec/repair_packages --verify --standard-pkgs /

– Repair the permission errors

sudo /usr/libexec/repair_packages --repair --standard-pkgs --volume /

Battery: How to Charge and When to Charge?

http://batteryuniversity.com/learn/article/how_to_charge_when_to_charge_table

My Macbook Pro have Lithium-ion (Li-ion, polymer) type battery, and I always wonder what is the best way to charge to prolong the battery life.

In short and based on the webpage, I can charge and discharge in anytime. It doesn’t harm and there is no “memory” if it is Lithium-ion type.

Yes, almost everyone may know it already, but I’m too lazy to check in myself about it, and now, I got it. 🙂

How to make a Podcasts in iTunes via Drupal

– Summary:

  1. Generate RSS 2.0 (XML file) format for iTunes
  2. Test the XML URL in iTunes (Files -> Subscribe to Podcast…)
  3. Submit the XML URL into iTunes: here

– A little bit in detail:

The Podcasts in iTunes reads RSS formatted file (XML formatted) and shows the contents of it. The detailed info is in Apple’s podcast description and FAQ: For Podcast Makers.

When you use Drupal, you can easily generate the XML file by following modules:

1. Prerequisite

Assuming you already know

  • How to install drupal modules
  • About View Module
  • How to Add new Content Type and the concept of Content in Drupal

2. Add a content with file field.

The first thing you need to do is to have proper content with the file field. Check this out.

In “Content Type”, you can either add New Content Type or Edit existing Content type. Anyway, what you have to do is to check if it has “Field type: File” or  similar field type. If not, you need to add “Field type: File” to add attachment recognizable in Drupal.

Add Content Type or Manage Field

  • Add new field and set the “Type of data to store” as “File”

Adding File Field

  • Set “Label”, “File Extensions”, “File Directory”, and Maximum Upload Size.
  • If allowed upload size is not enough, please refer to increase the upload size in php configuration. In general, upload_max_filesize and post_max_size should be modified to limit the file size. Note that upload_max_filesize is less than post_max_size in general.

Field Configuration

3. Create a View

The next thing is adding a view for the RSS Feed (XML file).

Assuming you’ve installed above modules,

View

  • Select Include an RSS feed and put the xml file name
  • Click “Continue & Edit”

create a view

click feed

  • Set the Format as “RSS Feed – Fields” and Add more Fields you want to show and make sure the MP3 Contents as File Field.

setting view

Format Setting

  • In the “Fields: Content: MP3”, Create a label and Set Formatter as “RSS <enclosure> element” (Important!)

mp3 field

  • Rest of them, you can filter how you want to reveal the view to the iTunes. It’s up to you.
  • Note that if you want to get all items having the MP3, you can specify it as (not null).

4. Check the xml with http://feedvalidator.org

It shouldn’t be perfect, but just check if you miss something else.

5. Test with iTunes

In iTunes, you can test your XML as put the XML URL in “File” -> “Subscribe to Podcast…”

6. Submit it into iTunes.

That’s it. You can submit it into iTunes here.