Jam - Using a single target in multiple directories
Submitted by moonz on Thu, 2010-07-22 06:55Sometimes, desire to use an object file in multiple directories arises. Assume the following directory structure.
- src/common/tests
- src/unittest
A test in common/tests need only one object in unittest to be linked, but one does not want to make it as a library for that.
Jam - Cross referencing between directories
Submitted by moonz on Thu, 2010-07-22 05:59Assume the following directory structure.
- src
- src/common
- src/common/tests
Of course, common/tests includes common for testing.
Problem is when one wants to include common/tests from common, say,
to make tests runnable from common directory.
Simply SubIncludeing each other result in infinite recursion, and does not work .
Using Jam
Submitted by moonz on Thu, 2010-07-22 03:59Originally, I was willing to write “Introduction to Jam”. But Jam documentation seems to do the job quite well already, so I’ve changed my plan to write some important things as I remember. This document does not cover most syntax and rules and is not for first learners. It contains an overview of very basic concepts and quite detailed problems
Hello, world!
Make Jamfile. In simple case, the following one line is enough.
Run jam.
Counting variadic arguments
Submitted by moonz on Fri, 2010-07-16 19:08The following code is simplified version of a code snippet which I’ve found on stack overflow site.
#define VA_COUNT0(_1, _2, _3, _4, _5, _6, _7, _8, _9, N, …) N
Being able to count at preprocessing stage, means many things.
There’re a bunch of subtle, dirty expressions related to variadic macro or function in C.
Setting subtheme CSS
Submitted by moonz on Fri, 2010-05-21 06:26Font size too big for a title with a link.
It’s because there are 30% increase by both .title and .title a.
So, font size of a title and that of a link in a title differs.
In order not to increase another 30% at a link in a title,
add the following code to CSS.
font-size: 1.0em;
}
Creating subtheme
Submitted by moonz on Fri, 2010-05-21 05:13Until recently I was satisfied with the bluemarine theme, but now a few problems bothers me.
- Font size is too big for book titles in the book outline of the left sidebar menu.
- It’s rather difficult to distinguish h1 and h2 in contents.
- On chrome, font size of inlined code is smaller than on IE. (Block-level codes have the same problem when GeSHi filter is set to GESHI_HEADER_DIV, not GESHI_HEADER_PRE.)
I tried to solve those problems with the previously created module’s CSS. But it can’t override theme’s CSS because it’s placed after other modules’ CSS’s but before theme’s CSS. So, I had to follow the standard procedure by creating subtheme. I was somewhat afraid of spending too much time, but creating subtheme itself was very easy.
Multi-language setting - i18n
Submitted by moonz on Thu, 2010-05-20 02:01Configuring Internationalization
After configuring core modules only, pages like front page (=/node, by default) or blog page (=/blog) show original and translated contents mixed. The i18n module solves this problem. Additionally, you can set up some details like prohibiting language neutral contents.
Multi-language setting - locale, translation
Submitted by moonz on Thu, 2010-05-20 01:07After setting ads, I thought that, being rarely known site, perhaps English content might be (at least slightly more) advantageous for exposure to the search engines. And as I remembered that I’d encountered with related topics in drupal documentations, I decided to set up a multilingual site supporting both Korean and English.
During this process, I’ve spent time longer than expected, and had to see the sources of drupal modules. I succeeded to set up a multilingual site, but failed to adjust a few details because of some bugs. Here I summarize it.
Overriding CSS
Submitted by moonz on Wed, 2010-05-19 14:50(Update) Later, switched to creating a subtheme because of a limitation of this method
Looked around, and it looks fine mostly, except that those double border around codes displayed by GeShi filter.
Using chrome’s “Developer tools” (which actually was my first experience, and
it seems like it’s great and indispensable tool for creating homepage),
I found that it is made up of <div class="geshifilter">, <pre>, in that order, and
- geshifilter defines the border of
div.geshifilter, - drupal theme defines the border of
pre,
so, it become double bordered.
Creating custom module!
Submitted by moonz on Wed, 2010-05-19 13:23Couldn’t resist, so I decided to solve the annoying problems. As I’m newbie to drupal, it took some time, but not long.
Prerequisites:
- Drupal modules basically works by defining hooks.
- Execution order of different modules is determined by their weights.
That is, you can override results of other modules without modifying them by defining a module with bigger weight. Actually, many sites seems to be constructed that way, to minimize inconvenience during upgrade.