Posts

Make It Work: Global .gitattributes

Image
Git is the vanguard of distributed VCSs, and as a matter of course, it provide a way to perform diff or merge on certain files while intermediately treating them as documents of a certain other format. By reflecting appropriate changes to configuration and attributes of git as described in " Git - Git Attributes ," you can set up this intermediate conversion for files of your choice while in diff or merge process. This is best described with an example. Say, there exists a file format called "property list" (hereinafter plist) in Mac, and it can come in 3 forms: XML, binary or JSON (it's not exactly JSON, but is similar to it). To perform diff or merge on files of this type in a consistent way, use command plutil  provided by Mac OS X (or an open-source, GPL-licensed alternative libplist ). Then take the following 2 steps.

Hardcoding Data Like Images and Sounds into HTML or CSS

Image
Do you know Data URI scheme ? With this, you can hardcode virtually any kind of digital information media into a document. Okay, "virtually any kind of" was a little bit unreasonable; "almost all browser-supported" is appropriate, such as images, sounds and movies. The format below defines a data URI (we need to use safe URL characters; see also " Recommendations for Delimiting URI in Context " for delimiting a long URI): data:[<MIME-type>][;charset=<encoding>][;base64],<data> URL is used to locate various resources, for example web browsers can't live without these URLs, and URI is a conceptual superset of URL. And protocols defined by data URI scheme provide a standardized way to hardcode certain data, such as JPEG, PNG, MP3, Ogg etc. With this scheme we can hardcode data inside virtually all kinds of source code from interpreted languages like HTML, XML, CSS, JS, Ruby, PHP or even from compiled languages like C, C++,

GCC and Clang: Library Incompatibility Issues in MacPorts

Jumble monolog (or quickly to What to do? ) Currently, I'm using Boost libraries and C++11 features in my Xcode project. But there is a problem. Boost libraries in my development environment was installed using MacPorts, and it seems these Boost libraries could not come along with C++11 features and LLDB in Xcode. Let's make things clear, it is a GCC-Clang compatibility issue. In Xcode build setting, you can choose GNU's libstdc++ for favor to Boost libraries (I'm not sure, but it seems they're built using GCC in my MacPorts environment), but then C++11 features and LLDB are crippled. Seemingly, libstdc++ provided by Apple LLVM is not C++11-ready. Vice versa, you can choose LLVM's libc++ for favor to C++11 features and LLDB, but then Boost libraries are crippled. I think the problem, on the surface, can be distilled to symbol name resolution failure.

You need a .gitignore template? Try gitignore.io, It Rocks!

gitignore.io is hosting a web API for generating a .gitignore template for certain OSs, IDEs or programming languages. And honestly, this is really helpful. If you want a .gitignore template for several OS, IDE and programming language targets, what you need to do is to provide a CSV of these target IDs to the web api. Here, the following URL provides a comprehensive ID list of supported targets: ・  http://gitignore.io/api/list Error: Embedded data could not be displayed. For example, a .gitignore template for Mac OS X, Linux, Windows and C/C++ can be retrieved from the following URL (just putting target ids with delimiting commas after api/ ): ・  http://gitignore.io/api/osx,linux,windows,c,c++ Error: Embedded data could not be displayed. And if you want to download the template as .gitignore, then use the following command: curl http://gitignore.io/api/osx,linux,windows,c,c++ -o .gitignore It's simple and effective, nice!

DDS for GIMP (Mountain Lion, Native, no X11 GUI)

Image
I compiled gimp-dds for GIMP 2.8.6 for Mountain Lion (native). dds (plug-in binary file, 113 KB): https://docs.google.com/file/d/0B5GXgEJZQv74Z1FCbkk0c0VqMkE/edit?usp=sharing GIMP (without extra plug-ins):     http://www.gimp.org/downloads/ GIMP (with extra plug-ins):     http://gimp.lisanet.de/Website/Download.html Well, latter already has this DDS plug-in, but my compiled version is much newer (from gimp-dds-2.2.1). Put the binary file under the following directory (Gimp installation path may differ, so check yours): /Application/Gimp.app/Contents/Resources/lib/gimp/2.0/plug-ins/ Tips: From Finder, Cmd + N to open a new window, Cmd + Shift + G  to pop an input dialog, then put  the path mentioned above; then you can put the binary file. You can do the similar by right clicking Gimp.app to select "Show Package Contents" . Loading option dialog Mipmaps as layers Main surface texture

I want to create Quick Look plug-in for DDS! … And wait, I found one!

Image
These several days, I've been tinkering around game dev library Ogre3D and obtained a huge collection of DirectDraw Surface (DDS) files (about 16,000 files, roughly 5GB in size). I built GIMP plug-in " gimp-dds " for DDS viewing/editing capabilities. But this collection is just too huge: opening a DDS file, finding it not interesting, closing it, opening next… this is too cumbersome for browsing. There should be a convenient way to quickly search through DDS files. Quick Look of JPEG image And here slickness of Mac OS X's Quick Look should come in handy. Quick Look is a preview functionality seamlessly integrated with Finder (a Mac counterpart of File Explorer in Windows), and can preview various kinds of document (plain text, rich text, HTML document, JPEG image, PNG image, PSD image, PDF document, AVI movie, Collada 3D data etc) very quickly. Quick Look supports Collada (.dae) since Mac OS X 10.6, so the same for DDS will be nice.  So I decided to c

LaTeX in Blogger with Google Chart API

Image
Important: The Image Charts portion of Google Chart Tools, including TeX functionality, has been officially deprecated as of April 20, 2012. It will continue to work as per Google's deprecation policy . It's not certain that this will be bye-bye to TeX functionality; as the deprecation policy says, it will be clear at least when it's April 20, 2015. Here is my homework report about eigenfaces in PDF ( Image Recognition and Understanding: Eigenfaces ). This PDF document was written in LaTeX , a well-recognized typesetting language and system. For writing equations beautifully in your document, I can't think anything competitive to LaTeX. And thanks to its popularity, some people decided to create web APIs for LaTeX: one such example is Google Chart API's TeX component. And with a Firefox Add-on ' Greasemonkey ' and this LaTeX-for-Blogger script ( http://userscripts.org/scripts/show/105016 ), you can insert a LaTeX image into your post easily.