On generating UUID

I have been using UUID for several different things now, and I have been using uuidgen program available on Linux.
Since I use Emacs, I wanted to better way of generating UUID right from Emacs.

Ergoemacs has good coverage about it back in 2011 about it.

There is a example that uses the uuidgen program:

(defun insert-random-uuid ()
  (shell-command "uuidgen" t))

The above pretty much solves problems for generating UUID, but I wanted to have a solution that generates UUID inside Emacs, just in case it’s needed.

The example codes, Ergoemacs have posted seems to the job, however, I’ve noticed the original piece of code fixed the first character of the fourth segment character “a” (which actually generates a valid UUID, as this character needs to be either 8, 9, A, or B. I’ve modified this code slightly to generate one of those characters instead of it being always “a” which would be the following.

;; by Christopher Wellons. 2011-11-18. Editted by Xah Lee.
;; Edited by Hideki Saito further to generate all valid variants for "N"
;; in xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx format. 
(defun insert-uuid-internal ()
  "Insert a UUID. This uses a simple hashing of variable data."
  (let ((myStr (md5 (format "%s%s%s%s%s%s%s%s%s%s"
    (insert (format "%s-%s-4%s-%s%s-%s"
                    (substring myStr 0 8)
                    (substring myStr 8 12)
                    (substring myStr 13 16)
            (format "%x" (+ 8 (random 4)))
                    (substring myStr 17 20)
                    (substring myStr 20 32)))))

Also one thing to note is that it’s generally better to use uuidgen where available, as it generates one from /dev/urandom, which tied to various random number sources — although, for the scope of generating uuid, it may not that be critical as likelihood of collision would still be low.

A full code is available on HidekiBin.

How Far Can a $300 Laptop Go?

When my last laptop decided to give up on me, giving me a one blink on caps lock, which apparently means that CPU has failed, I needed to get a replacement quick.

I decided to search for Linux laptops, because that’s what I used on my last machine. I could either shop some specialized vendors for laptop, or as I always do, search Amazon.com.

Then I found this device called Acer Aspire V5-131-2887.

This is a very inexpensive $300 laptop that is pre-installed with a variant of Linux called Linpus. Just because my preference, I’ve reinstalled Ubuntu running KDE desktop.

According to Amazon.com, this device has:

  • Intel Celeron 847 1.1 GHz
  • 4 GB DDR3
  • 320 GB 5400 rpm Hard Drive
  • 11.6-Inch Screen
  • Linux

Usually, when it comes to computing, it’s pretty much you get what you paid for, and this computer is not an exception. For instance, I wouldn’t expect this machine to do heavy computing, such as video editing and 3D modeling.

Yet this Intel HD Graphics GPU built into the CPU is actually not that bad of graphic processor, capable of displaying 3D contents with very surprising speed; I just don’t think I would play cutting edge games on it but nonetheless provides adequate speed for applications like Google Maps in WebGL mode. Another good thing about this particular GPU is that it’s one of most well supported series of graphic card on Linux.

This machine is equipped with 1.1GHz processor, which is not very fast, even at yesterdays standard, but it is very smooth, and in very good thermal profile. (It’s usually around 50C.)

as for connectivity, this computer provides 802.11a/b/g/n and Bluetooth. It is a nice touch, it provides those as even more expensive machines of often lacks 802.11a and Bluetooth. (Amazon’s listing is missing those features, you may want to go to a product page for Acer Aspire V5-131-2887 for more complete information.)

Would I recommend this laptop? Absolutely, but only if you know something about Linux. For example on Ubuntu, it worked, but I had to modify grub setting to make brightness adjustment work. If you don’t know what that means, maybe you want to stay away. But then, if you are considering learning how to deal with Linux, at $300, maybe this is a good start!

Raspberry Pi as VPN Host Point

My work has been used VPN for certain applications that requires static IP. Since the location of my work is pretty much abandoned by pretty much every single broadband companies (other than Clear), I’ve decided to move VPN access point off-site, to ensure I have access to this device at decent speed — even from off-site if needed to be.

At the office, I have connected the VPN router through one of PC running Linux. For taking this functionality off the company network, I wanted more power-efficient, portable solution. I already had one of Raspberry Pi, so I decided to take it a spin for using it as a VPN Host Point.

For providing the conduit to this system, I’ve decided to use recently open sourced SoftEther. The reasons I’ve selected this particular solution is:

  • It’s easy to configure
  • Provides a variety of emulation, including OpenVPN, L2TP/IPSec (since SoftEther lacks client support for Mac, those emulation supports are very useful)

Another factor was the fact that I was already familiar with UT-VPN which has similar configuration styles.

Configuration for SoftEther went fairly smooth, only pitfall was that when kernel mode NAT was used in conjunction with the device, it obtained IP address outside of the VPN, thus, I had to set DisableKernelModeSecureNAT to true.
While vpncmd utility would provide configuration options, configuration options were bit confusing, such as natenable, and securenattable actually switches different part of the NAT system; I had to wonder why NAT was not activated. Once I learned to inspect both of them, it wasn’t too bad after that.

So far, performance seems to be satisfactory, and the next step will be to actually have dedicated Raspberry Pi for this purpose.

4+ Things I don’t Miss About Windows

So now I have transitioned my desktop into Linux, this means I no longer have any system that runs Windows (at least at native capacity.)

1. No more crappy update systems

Apparently, Windows has a defect (that roots from Windows XP) on its Windows Update driver, that can cause very high disk load on every startup/resume, mainly, for parsing datastore.edb file. This actually caused in bit of issues trying to use my system. Essentially, every time I turn on my machine to use, it’d take at least 10 minutes to “stabilize.” This has happened in three of prior systems, and latest machine, which is i7-2600 with 16GB didn’t help solve this issue either.

Besides, I have a lot of complaints of how the update system works on Windows. Unfortunately, Windows pretty much requires restart and just about any updates, perhaps thanks to its locking file system, too.

2. I am no longer underprivileged citizen of the system

Why am I getting “Access denied” when you are using your machine as Administrator? Because on Windows, you are not the man of the house. Windows has layers of the system that prevents people from doing stupid things in their system.

Essentially, on Windows, you are prevented to do a lot of stupid things. This mentality often causes cases where I know what I’m doing, but the system is not letting me do that.

For instance, on Linux and other Unix system, you can cause a bit of damage by doing something like:

sudo rm -rf /*

I am more than willing to take a risk, and if this command does kill my system, that’s my own fault. After all great power comes with great responsibilities.

 3. Exiting out from the blackbox

In any computing, you can’t really escape from error messages. Things happen in many degrees of issues. Some are minor, and some are major. If anything goes crazy on Linux, I can usually just type dmesg to find out what exactly happened in few seconds. Windows also has logging facility, but even after spending a long time trying to boot system event logs, information I can get is extremely limited. Something as simple as a defective thumb drive is a bit hard to investigate under Windows.

4. Locking file system

You can’t delete or move files that are in use. This is somewhat a legacy from old Windows versions. On Linux, you can do these things as executables are mostly preloaded into RAM, hence many system updates don’t require a reboot of the system.  Most of system has more RAM than you ever use, so this is very ridiculous notion that you still can’t do this on Windows.

Ranting continues…

Another thing I want to point out is that Microsoft has been harsh on IT professionals (well, I don’t know if I’d call myself “IT professional” but I do maintain a handful of systems…) lately. TechNet Plus was a useful resource in evaluating softwares, so I can support the platform that I don’t necessarily use. First, they degraded its contents of the subscription, and then they decided to retire it altogether. I was paying my own hard earned money to stay on top of the platforms I have been supporting. An enterprise may be able to move to MSDN, but smaller business, which relies heavily on personal expertise of staff, this won’t be very realistic. Anyways, Microsoft no longer seems to care. So why should I care? That’s pretty much what I will have to tell people from now on.

Vocaloid Songs (Seriously) Need Curation

Playing Project Diva F, it somewhat renewed my feeling that Hatsune Miku (and all Vocaloids) can really use extensive curation.

I might have said this elsewhere, but Vocaloid songs are very diverse, and that’s like a singer having enormous repertly. There are many good songs, but at the same time, they are intimidating to approach.

There are efforts like Karent that collects music for distributions, but let’s face it, discoverability, for instance from Spotify is pretty horrible.

Perhaps it is easier for someone active in Niconico may be able to find songs easier by composer’s name, etc.?

Despite that I use Vocaloid software, I hardly consider myself to be “in the community” and I’m not very sure how much of the mainstream approach from within the community is in consideration, but I can’t help noticing a lot of good content are being literally hidden from outside, and I feel like it can be improved for better!

A Japanese Language Edition of this article is here / この記事の日本語版はこちら

Sushi and RFID

So I was eating Sushi today — the kind that rotates on a belt.
I have already known that these Sushi belt systems have way to track expiration, so that those Sushi plates won’t be circling around on the belt forever making the health department unhappy.


So I ate a few plates of Sushi, and then turned it over to see what’s underneath. It seems like something built inside it.


So I was curious if it is any proprietary RFID system, or perhaps Felica?


It turns out it is using NXP chip SL2ICS20.



Digging it deeper, it doesn’t look like the chip contains so much of information, however there were slight deviation between each plates.



While the display shows each datablock being unlocked, RFID chip itself was still locked (perhaps not permanently locked) so it could be that the system still keeps track of how many times plates has passed through the checkpoint, among other information.

BitTorrent Sync

There are many P2P file sync systems like AeroFS and Tonido. One thing that BitTorrent Sync stands out is that it doesn’t require account registrations. Other services require creating an account prior to use. It almost makes me “why do I need to register to use a P2P system?” With BitTorrent Sync, it is as easy as exchanging a key.

You can try read only key of RBU7XLPET43IWGFSLNJEGREIOZI6V4YE2. It’s a repository of Emacs build for Windows and Mac.

Upgrading Org-mode 8.0

Org-mode 8.0 is out, and overall, it looks like interesting update to already awesome package for Emacs.

This update is dirsruptive updates, which means there are something that can be broken and requires updates.

One of the issue I had was how it handles LaTeX output.

For instance, I had the following in my init.el (I opt to put my config into .emacs.d/init.el instead of .emacs…)

(require 'org-latex)
(add-to-list 'org-export-latex-classes
 ("\\section{%s}" . "\\section*{%s}")
 ("\\subsection{%s}" . "\\subsection*{%s}")
 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
 ("\\paragraph{%s}" . "\\paragraph*{%s}")
 ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))

The above is actually an incompatible for 8.0, and it had to be updated so it is:

(require 'ox-latex)
(add-to-list 'org-latex-classes
 ("\\section{%s}" . "\\section*{%s}")
 ("\\subsection{%s}" . "\\subsection*{%s}")
 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
 ("\\paragraph{%s}" . "\\paragraph*{%s}")
 ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))

The tricky part is that it won’t complain until you try to issue org-export-as-latex, which actually is not supposed to exist in 8.0. (the corresponding function of 8.0 is org-latex-export-to-latex) What happened was that by requiring org-latex, it loaded corresponding functions from 7.9.3 version built into Emacs itself.

So if you have any statements like above, do make sure to update or you will run into problems.

You can see if you have a correct installation of org by M-x org-version. You can also try to get a complete list of org-export- and if you see any more than the following, you may have some issue in your configuration.

Possible completions are:
org-export-dispatch org-export-insert-default-template
org-export-stack org-export-stack-clear
org-export-stack-mode org-export-stack-remove