Posts

Showing posts with the label Programming

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.

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...

A Private Mac Mercurial Server with SSH Key Authentication

Image
Now, a private Mac Mercurial server with  SSH key authentication was set up. I already pushed my main project to the server and updated it at the server side, so repository migration has started without a hitch. But I didn't migrate the subprojects of the main project and some lingering/untended/rogue projects to the server, because they have their own choices of VCSs or none at all: I already smells a trouble, a delicious one. I know there are inter-VCS plugins out there for Mecurial, I'm looking forward using them. So, assuming you have an administrative privilege, here are instructions of how to set up a private SSH Mercurial server.

Xcode: Easy Shared & Static Lib Management and Linking

Image
In Xcode, you can add existing frameworks (binary shared/static libraries or Apple's packaged framework) to a target in your project by choosing from the framework list or drag'n'drop from Finder. Several libraries under "Frameworks" group (e.g. libBusted.a) Benefit of doing this is obvious: you can manage and see what libraries your program is linked to. However, after doing that, I noticed one thing. Xcode does not link shared/static libraries in a simple way like: gcc -o qux libfoo.dylib libbar.a buz.o Instead, when libraries are going to be added, Xcode obtains paths to the directories containing these libraries, and appends these to the build setting "Library Search Path" of the target. So that the actual linking looks like: gcc -L/path/to/foobar -o qux -lfoo libbar.a buz.o Compared to the former, even though orthodox, linking in the latter is indirect. I like the former method because it's simple and error-free even though it somewh...

Transition Mayhem: Xcode 4 (and Symbol Visibility Side Note)

P.S. To guys here for " illegal text reloc to vtabl e" or " bad codegen " of Xcode 4 If you enrolled one of Apple Developer Programs, preferably Mac Developer Program, you should visit the exclusive web forum at Apple Developer Connection ( http://developer.apple.com/devforums/ ). I found a thread where one of OGRE library developers mentioning he found info about this "illegal text reloc to vtable" or "bad codegen" things at that forum. Something like Apple tightened up their policy on how to resolve symbols in Xcode 4. Unfortunately, I didn't enroll any of Apple Developer Programs, and don't know the detail. I like Xcode because this is the first IDE I got used to, but I don't like Xcode 4 not working as I want. Let me cut to the point, I have a problem compiling my project in Xcode 4. Compiling goes well in Xcode 3, but in Xcode 4, illegal text reloc to vtable or bad codegen things comes up to slap the back of my head e...