Posted on 23-02-2014
Filed Under (Technology) by bigbang

I am using Clojure & Compojure to write my webpages, and I am trying to use Selmer as template system for Clojure.

Here is my template file structure: there is a basic template file base.tpl which defines basic header, footer or something else. And some other files like index.tpl, search.tpl to do the real job by including base.tpl template. The base.tpl file defines the common part of my site and changes few times during my project lifetime.

In some suitations, we need to modify base.tpl. But after modification of base.tpl, Clojure & Selmer don’t re-render base.tpl when I visit and render index.tpl file. So I need to restart lein ring server every time after I modify base.tpl.

It is too troublesome and forgettable to restart lein ring server every time after modified base.tpl. Finally I find the reason on Selmer official doc site:

Note that changes in files referenced by the template will not trigger a recompile. This means that if your template extends or includes other templates you must touch the file that’s being rendered for changes to take effect.

Alternatively you can turn caching on and off using

(selmer.parser/cache-on!)

and

(selmer.parser/cache-off!)

respectively.

(0) Comments    Read More   
Posted on 13-02-2014
Filed Under (Technology) by bigbang

While I am using Visual Studio 2008, there is an warning of this content:

warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

There is also this kind of warnings when you are using sprintf etc.. We can use preprocessor _CRT_SECURE_NO_WARNINGS to shutdown this warning.

(0) Comments    Read More