Sunday, December 29, 2013
Write and display Batak script on Mac
Batak font used to be just another ASCII font with Batak script rendering. But it got place in Unicode and it is a "real" font now. Download it from Uli Kozok's site.
After you installed the font, you will be able to see this in Batak script: ᯂᯬᯒᯀ᯲
You will also see Batak script on sites like this: http://www.alanwood.net/unicode/batak.html
Now that it is a real font, typing on ASCII keyboard won't work anymore. A special keyboard mapping is necessary. For Mac, get the keyboard mapping from this Michael Everson's site.
Installing a Batak keyboard layout on the Mac OS:
1) Download the Mac OS Batak keyboard layout package. (The files are inside the folder “Batak-Mac-Keylayout”, which is compressed in .zip format.)
2) Install the keyboard layout by dragging it (the .keylayout and the .icns files, not their enclosing folder) to ~/Library/Keyboard Layouts.
3) To use a keyboard layout, activate it at System Preferences > International > Input Menu.
Saturday, April 13, 2013
Using exiftool to rename pictures from digital camera
Lots of pictures taken with digital camera (including the ones in smartphones)... so I need a way to at least easily identify when a particular picture is taken, and exiftool comes in handy.
First, create a file named .ExifTool_config at user's root directory containing something like the following:
%Image::ExifTool::UserDefined = (
'Image::ExifTool::Composite' => {
MyModel => {
Require => 'Model',
# translate spaces to underscores
ValueConv => '$val =~ s/Canon DIGITAL IXUS v2/IXUSV2/; $val =~ s/KODAK DX4330 DIGITAL CAMERA/DX4330/; $val =~ s/C860L,D360L/C860L/; $val =~ s/Canon IXY DIGITAL 320/IXY320/; $val =~ s/ |-//; $val =~ s/(.*)/uc($1)/e; $val',
},
MyMake => {
Require => 'Make',
# translate spaces to underscores
ValueConv => '$val =~ s/EASTMAN KODAK COMPANY/KODAK/; $val =~ s/OLYMPUS OPTICAL CO.,LTD/OLYMPUS/; $val =~ s/CASIO COMPUTER CO.,LTD/CASIO/; $val =~ s/ |-//; $val =~ s/(.*)/uc($1)/e; $val',
},
},
);
1; #end
exiftool -d %Y%m%d-%H%M%S '-FileName<${CreateDate}-${mymake}${mymodel}.%e'
File names of images files on will become like the following:
20040228-133116-CASIOEXS20.jpg
Use "c" to add counter, like below:
exiftool '-FileName<${DateTimeOriginal}_$Model.%e' -d %Y-%m-%d_%H-%M-%S%%-.c
Rerences:
http://www.sno.phy.queensu.ca/~phil/exiftool/
http://www.sno.phy.queensu.ca/~phil/exiftool/faq.html#Q11
First, create a file named .ExifTool_config at user's root directory containing something like the following:
%Image::ExifTool::UserDefined = (
'Image::ExifTool::Composite' => {
MyModel => {
Require => 'Model',
# translate spaces to underscores
ValueConv => '$val =~ s/Canon DIGITAL IXUS v2/IXUSV2/; $val =~ s/KODAK DX4330 DIGITAL CAMERA/DX4330/; $val =~ s/C860L,D360L/C860L/; $val =~ s/Canon IXY DIGITAL 320/IXY320/; $val =~ s/ |-//; $val =~ s/(.*)/uc($1)/e; $val',
},
MyMake => {
Require => 'Make',
# translate spaces to underscores
ValueConv => '$val =~ s/EASTMAN KODAK COMPANY/KODAK/; $val =~ s/OLYMPUS OPTICAL CO.,LTD/OLYMPUS/; $val =~ s/CASIO COMPUTER CO.,LTD/CASIO/; $val =~ s/ |-//; $val =~ s/(.*)/uc($1)/e; $val',
},
},
);
1; #end
Then run the following command:
exiftool -d %Y%m%d-%H%M%S '-FileName<${CreateDate}-${mymake}${mymodel}.%e'
File names of images files on
20040228-133116-CASIOEXS20.jpg
Use "c" to add counter, like below:
exiftool '-FileName<${DateTimeOriginal}_$Model.%e' -d %Y-%m-%d_%H-%M-%S%%-.c
Rerences:
http://www.sno.phy.queensu.ca/~phil/exiftool/
http://www.sno.phy.queensu.ca/~phil/exiftool/faq.html#Q11
Monday, February 18, 2013
Metadata for image file
How many standards are there for embedding metadata into image files?
We usually hear Exif, IPTC and XMP, but when we mean standards related to metadata, it turns out to be more complex. There are Exif, DCF, IPTC-IIM, XMP (a.k.a IPTC Core), and FlashPix. Some standards are not just about metadata, but also among others how to save image files on digital camera.
Here are some standards that I found out so far:
Exif 1 (standardized by JEIDA)
Exif 2 (standardized by JEITA in 1997) *JEIDA changed name to JEITA
Exif 2.1 (standardized by JEITA in 1998)
DCF JEITA in 1999) *This is Exif 2.1+CIFF
Exif 2.2 (standardized by JEITA in 2002)
Exif 2.3 (standardized by JEITA+CIPA in 2010)
FlashPix
IPTC-IIM (standardized by IPTC in 1994) *descriptive metadata only, for JPEG only, largely superseded by XMP
XMP any file 2001 (standardized by Adobe in 2001) *a.k.a. IPTC Core
We usually hear Exif, IPTC and XMP, but when we mean standards related to metadata, it turns out to be more complex. There are Exif, DCF, IPTC-IIM, XMP (a.k.a IPTC Core), and FlashPix. Some standards are not just about metadata, but also among others how to save image files on digital camera.
Here are some standards that I found out so far:
Exif 1 (standardized by JEIDA)
Exif 2 (standardized by JEITA in 1997) *JEIDA changed name to JEITA
Exif 2.1 (standardized by JEITA in 1998)
DCF JEITA in 1999) *This is Exif 2.1+CIFF
Exif 2.2 (standardized by JEITA in 2002)
Exif 2.3 (standardized by JEITA+CIPA in 2010)
FlashPix
IPTC-IIM (standardized by IPTC in 1994) *descriptive metadata only, for JPEG only, largely superseded by XMP
XMP any file 2001 (standardized by Adobe in 2001) *a.k.a. IPTC Core
Links to standards:
IPTC (Information Interchange Model (IIM))
http://en.wikipedia.org/wiki/IPTC_Information_Interchange_Model
XMP
http://en.wikipedia.org/wiki/Extensible_Metadata_Platform
Exif
http://en.wikipedia.org/wiki/Exchangeable_image_file_format
Design rule for Camera File system
http://en.wikipedia.org/wiki/Design_rule_for_Camera_File_system
References:
http://en.wikipedia.org/wiki/Exchangeable_image_file_format#FlashPix_extensions
http://gcoupe.wordpress.com/2011/12/10/picasa-versus-windows-live-photo-gallery/
http://www.controlledvocabulary.com/blog/top-metadata-myths.html
Friday, August 3, 2012
JSON to Google Docs for Trello
I want to have all Trello data into a Google Docs sheet.
So I wrote this (and with copying snippets from here and there):
So I wrote this (and with copying snippets from here and there):
// Arnold P. Siboro
// August 2012
function myFunction() {
//blabla
throw 'Congratulations, you have successfully installed XXX ';
}
function onOpen() {
var sheet = SpreadsheetApp.getActiveSheet();
var lastRow = sheet.getLastRow();
//sheet.setActiveCell()
//var object = getJSONdata();
var object = getTrelloJSONdata();
sheet.clear();
for (var i=0; i
Tuesday, June 12, 2012
Cloud backup solution
Google Drive is released. So which is best, Google Drive, Dropbox, SkyDrive, etc? As I previously wrote, my interest is in having a backup solution that exactly backups files from Mac, including its data forks, extra attributes, finder flags etc.
So, it's time to take bbouncer out of the shelf again. Google Drive is said to be not preserving all of the above nooks and crannies of Mac file system, so I tried with Dropbox first, which was mentiond on Google searchland as faithful to Mac file system. I mounted the Dropbox drive (actually it is not a drive, just a directory), and then ran the following command to copy bbouncer's test files:
sudo rsync -aNHAXxvuPE --fileflags --protect-args --force-change /Volumes/Src/ /Users/asiboro/Downloads/Dst
I then ran bbouncer to do the test:
./bbouncer verify -d /Volumes/Src/ ~asiboro/Downloads/Dst/
The result is as follows:
So, it's time to take bbouncer out of the shelf again. Google Drive is said to be not preserving all of the above nooks and crannies of Mac file system, so I tried with Dropbox first, which was mentiond on Google searchland as faithful to Mac file system. I mounted the Dropbox drive (actually it is not a drive, just a directory), and then ran the following command to copy bbouncer's test files:
sudo rsync -aNHAXxvuPE --fileflags --protect-args --force-change /Volumes/Src/ /Users/asiboro/Downloads/Dst
I then ran bbouncer to do the test:
./bbouncer verify -d /Volumes/Src/ ~asiboro/Downloads/Dst/
The result is as follows:
Verifying: basic-permissions ... ok (Critical)
Verifying: timestamps ... ok (Critical)
Verifying: symlinks ... ok (Critical)
Verifying: symlink-ownership ... ok
Verifying: hardlinks ... ok (Important)
Verifying: resource-forks ...
grep: ./some-file/rsrc: Not a directory
Sub-test: on files ... FAIL (Critical)
cmp: ./hl-rfork1/rsrc: Not a directory
Sub-test: on hardlinked files ... FAIL (Important)
Verifying: finder-flags ... ok (Critical)
Verifying: finder-locks ... ok
Verifying: creation-date ... ok
Verifying: bsd-flags ... ok
Verifying: extended-attrs ...
Sub-test: on files ... ok (Important)
Sub-test: on directories ... ok (Important)
Sub-test: on symlinks ... ok
Verifying: access-control-lists ...
Sub-test: on files ... ok (Important)
Sub-test: on dirs ... ok (Important)
Verifying: fifo ... ok
Verifying: devices ... ok
Verifying: combo-tests ...
Sub-test: xattrs + rsrc forks ... ok
Sub-test: lots of metadata ... ok
Ouch.. resource fork related test failed.
I tried copying not to Dropbox but regular directory on disk, the result is the same. OK, something fishy here. After some searching, I found out that the resource fork is there, only that it is not on /rsrc but /..namedfork/rsrc. I am running Mac OS X Lion, and it seems that /rsrc is deprecated and it won't work anymore.
So, I edited test.d/30-resource-forks.test from bbouncer distribution and change all /rsrc to /..namedfork/rsrc, ran the test again and now here is the result:
Verifying: basic-permissions ... ok (Critical)
Verifying: timestamps ... ok (Critical)
Verifying: symlinks ... ok (Critical)
Verifying: symlink-ownership ... ok
Verifying: hardlinks ... ok (Important)
Verifying: resource-forks ...
Sub-test: on files ... ok (Critical)
Sub-test: on hardlinked filez ... ok (Important)
Verifying: finder-flags ... ok (Critical)
Verifying: finder-locks ... ok
Verifying: creation-date ... ok
Verifying: bsd-flags ... ok
Verifying: extended-attrs ...
Sub-test: on files ... ok (Important)
Sub-test: on directories ... ok (Important)
Sub-test: on symlinks ... ok
Verifying: access-control-lists ...
Sub-test: on files ... ok (Important)
Sub-test: on dirs ... ok (Important)
Verifying: fifo ... ok
Verifying: devices ... ok
Verifying: combo-tests ...
Sub-test: xattrs + rsrc forks ... ok
Sub-test: lots of metadata ... ok
Cool.
But not yet. I just realized that I was just running the test against Dropbox directory on this Mac. It's not a volume, so it is probably just like any regular directory except that Dropbox is syncing it with the server...
Sunday, April 1, 2012
In search of RARP server for MacOS
OK, I did not actually find a working RARP server solution on MacOS X, but I found a solution for setting that Yamaha RTX. It turned out that it does not have an IPv4 by default, but it has an IPv6 by default.
Connect the Mac directly to Yamaha RTX, make sure IPv6 is enabled on the Mac. Then from terminal:
netstat -nr
You will get a IPv6 section like this:
Internet6:
Destination Gateway Flags Netif Expire
::1 ::1 UH lo0
fe80::%lo0/64 fe80::1%lo0 Uc lo0
fe80::1%lo0 link#1 UHL lo0
fe80::2a0:deff:fe32:234d%en0 0:a0:de:32:23:4d UHL en0
fe80::ca2a:14ff:fe0f:4f25%en0 c8:2a:14:f:4f:25 UHL lo0
ff01::/32 ::1 Um lo0
ff02::/32 ::1 UmC lo0
ff02::/32 link#4 UmC en0
Connect the Mac directly to Yamaha RTX, make sure IPv6 is enabled on the Mac. Then from terminal:
netstat -nr
You will get a IPv6 section like this:
Internet6:
Destination Gateway Flags Netif Expire
::1 ::1 UH lo0
fe80::%lo0/64 fe80::1%lo0 Uc lo0
fe80::1%lo0 link#1 UHL lo0
fe80::2a0:deff:fe32:234d%en0 0:a0:de:32:23:4d UHL en0
fe80::ca2a:14ff:fe0f:4f25%en0 c8:2a:14:f:4f:25 UHL lo0
ff01::/32 ::1 Um lo0
ff02::/32 ::1 UmC lo0
ff02::/32 link#4 UmC en0
"0:a0:de:32:23:4d" is the MAC address of the Yamaha RTX, so just telnet to fe80::2a0:deff:fe32:234d%en0
telnet -6 fe80::2a0:deff:fe30:344d%en0
I am relieved I can do away with that rarpd.exe and Windows 2000!
But rarpd on Mac is still a mystery to be solved. On Ubuntu and CentOS it seems to work out of the box.
UPDATE
I forgot why I wrote the above, because it... did not work? I just found out Yamaha RTX's IPv6 address by first pinging to multicast address and see response from an IPv6 address other than the ones belong to my host (check the host's interfaces via the OS, or do "netstat -nr" and see the result, as follows:
ping6 -I en1 ff02::2
PING6(56=40+8+8 bytes) fe80::e2f8:47ff:fe12:d56c%en1 --> ff02::2
16 bytes from fe80::225:dcff:fe14:5a26%en1, icmp_seq=0 hlim=64 time=10.231 ms
^C
--- ff02::2 ping6 statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 10.231/10.231/10.231/0.000 ms
UPDATE
I forgot why I wrote the above, because it... did not work? I just found out Yamaha RTX's IPv6 address by first pinging to multicast address and see response from an IPv6 address other than the ones belong to my host (check the host's interfaces via the OS, or do "netstat -nr" and see the result, as follows:
ping6 -I en1 ff02::2
PING6(56=40+8+8 bytes) fe80::e2f8:47ff:fe12:d56c%en1 --> ff02::2
16 bytes from fe80::225:dcff:fe14:5a26%en1, icmp_seq=0 hlim=64 time=10.231 ms
^C
--- ff02::2 ping6 statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 10.231/10.231/10.231/0.000 ms
Monday, March 26, 2012
In search of RARP server on MacOS
Reverse ARP server seems to be scarce. There is one on Windows, but old, so far I could only run it on Windows 2000. At a glance, it's pretty easy on MacOS, since rarpd is installed by default. However, how to make it actually reply to reverse arp request is tricky. I could not find hands-on info on the net, only rarpd man page which gives very little info on how to actually use it. One hands-on info I found was for an old version of MacOS, while I am on Snow Leopard, where access to NetInfo has been changed to using dscl instead of nicl.
I then tried this dscl version of the above hands-on guide:
I tried various things in order to fulfill the vague requirements set on rarpd manual:
1) IP address and its name must be present in ethers database
2) IP address and its name must be present in hosts database
3) the directory /tftpboot/ipaddr exists, where is the target IP address But to no avail. I gave up, got a Windows 2000 to run rarpd instead :(
I then tried this dscl version of the above hands-on guide:
mkdir -p /private/tftpboot) ln -s /private/tftpboot /tftpboot vi /etc/ethers #/etc/ethers 00:A0:DE:30:34:4D client sudo dscl Entering interactive mode... (type "help" for commands) > -create /Local/Default/Hosts/XX:XX:XX:XX:XX:XX 12.34.56.78 > sudo /usr/sbin/rarpd -d en0 en0: c8:2a:14:d:a3:86But it kept just saying "rarpd: got a packet" but replied not.
I tried various things in order to fulfill the vague requirements set on rarpd manual:
Rarpd services Reverse ARP requests on the Ethernet connected to interface. Upon receiving a request, rarpd maps the target hardware address to an IP address via its name, which must be present in both the ethers(5) and hosts(5) databases. If a host does not exist in both databases, the translation cannot proceed and a reply will not be sent. Additionally, a request is honored only if the server (i.e., the host that rarpd is running on) can "boot" the target; that is, if the directory /tftpboot/ipaddr exists, where is the target IP address. In normal operation, rarpd forks a copy of itself and runs in the background. Anomalies and errors are reported via syslog(3).I.e.,
1) IP address and its name must be present in ethers database
2) IP address and its name must be present in hosts database
3) the directory /tftpboot/ipaddr exists, where is the target IP address But to no avail. I gave up, got a Windows 2000 to run rarpd instead :(
Subscribe to:
Posts (Atom)