preprocessor

How can I theme the template for edit or add a node for a specific content type?

给你一囗甜甜゛ 提交于 2019-12-02 18:33:54
I want to theme the template for edit or add a node for a specific content type. For example, to theme all the content type forms I use the file page-node-{add|edit}.tpl.php (depending what I need to do add or edit). But I didn't found the template name for a custom node type, for example Products. I need to theme only for Products, but not for the other content types. I've tried with page-node-edit-product.tpl.php and page-node-product-edit.tpl.php but no luck. easement Hmm. There may be a better way but what about a preprocess function. I'm still really new to Drupal, so I would maybe try

CMake conditional preprocessor define on code

╄→гoц情女王★ 提交于 2019-12-02 15:55:00
I'm migrating a makefile project to CMake. The person who wrote the makefile the first time had done a module for writing certain values in an include file. There's a main config.h file that includes a config_in.h. The config.h file contains something like this: #ifndef USE_FEATURE_A #define USE_FEATURE_A 0 #endif #ifndef USE_FEATURE_B #define USE_FEATURE_B 0 #endif In the makefile there's a fake target like with_feature_a that writes in config_in.h #define USE_FEATURE_A 1 In this way someone can type make with_feature_a make to get the right build. I want to replicate something like this

“Debug only” code that should run only when “turned on”

淺唱寂寞╮ 提交于 2019-12-02 14:47:37
I would like to add some C# "debug only" code that only runs if the person debugging requests it. In C++, I used to do something similar to the following: void foo() { // ... #ifdef DEBUG static bool s_bDoDebugOnlyCode = false; if (s_bDoDebugOnlyCode) { // Debug only code here gets executed when the person debugging // manually sets the bool above to true. It then stays for the rest // of the session until they set it to false. } #endif // ... } I can't do exactly the same in C# since there is no local statics. Question : What is the best way to accomplish this in C#? Should I use a private

Improving performance of preprocessing large set of documents

只愿长相守 提交于 2019-12-02 14:21:15
I am working on a project related to plagiarism detection framework using Java. My document set contains about 100 documents and I have to preprocess them and store in a suitable data structure. I have a big question that how am i going to process the large set of documents efficiently and avoiding bottlenecks . The main focus on my question is how to improve the preprocessing performance. Thanks Regards Nuwan You're a bit lacking on specifics there. Appropriate optimizations are going to depend upon things like the document format, the average document size, how you are processing them, and

Type visibilty for a header Share a header file shared between native and managed clients

牧云@^-^@ 提交于 2019-12-02 11:55:25
I have a header file that is included by both a native cpp file and a managed cpp file(compiled with /clr). It includes only native types, but I want to specify that the native types are visible outside the assembly (see http://msdn.microsoft.com/en-us/library/4dffacbw(VS.80).aspx ). Essentially, I want: public class NativeClass // The public makes this visible outside the assembly. { }; If I include this code from a native cpp, I get the following error: error C3381: 'NativeClass' : assembly access specifiers are only available in code compiled with a /clr option Attempted solution: I'm

C++ __TIME__ is different when called from different files

醉酒当歌 提交于 2019-12-02 07:34:56
I encountered this strange thing while playing around with predefined macros. So basically, when calling __TIME__ from different files, this happens: Is there anyway I can fix this? Or why does this happen? All I am doing is printf("%s\n", __Time__); from different functions in different sources. Or why does this happen? From the docs: This macro expands to a string constant that describes the time at which the preprocessor is being run . If source files are compiled at different times, then the time will be different. Is there anyway I can fix this? You could use a command line tool to

Need a #define for Visual Studio Versions that Include Secure String Functions (to Avoid _CRT_SECURE_NO_DEPRECATE)

大憨熊 提交于 2019-12-02 07:21:12
问题 A while back I tried to use Visual Studio 2010 to compile an MFC program that used a library I had written in Visual Studio 2003. Not surprisingly, I got a bunch of warnings about deprecation and using the secure versions of various string functions. I then updated the relevant functions in the library to use the secure functions and it compiled fine. I later tried to compile it again on the other system with Visual Studio 2003 and got nagged about the secure functions not existing. I decided

Determine C++0x availability

扶醉桌前 提交于 2019-12-02 06:30:36
问题 I'm trying to determine if C++0x features are available when compiling. Is there a common preprocessor macro? I'm using Visual Studio 2010's compiler and Intel's compiler. 回答1: The macro __cplusplus will have a value greater than 199711L . That said, not all compilers will fill this value out. Better to use Roger's solution. 回答2: The usual way to do this is determine it in the build system, and pass "configuration macros", commonly named HAS_*, when compiling. For example: compiler -DHAS

Need a #define for Visual Studio Versions that Include Secure String Functions (to Avoid _CRT_SECURE_NO_DEPRECATE)

戏子无情 提交于 2019-12-02 06:06:36
A while back I tried to use Visual Studio 2010 to compile an MFC program that used a library I had written in Visual Studio 2003. Not surprisingly, I got a bunch of warnings about deprecation and using the secure versions of various string functions. I then updated the relevant functions in the library to use the secure functions and it compiled fine. I later tried to compile it again on the other system with Visual Studio 2003 and got nagged about the secure functions not existing. I decided to create a hybrid approach that would allow me to compile programs that use the library in either

Using XSLT as an XML pre-processor

倾然丶 夕夏残阳落幕 提交于 2019-12-02 03:26:06
问题 This is my first time doing anything with XSLT, or XML really, so please excuse me. I've found XSLT web documentation is really terse. I have an XML file that I want to process to selectively drop content based on an input set of defines. The behavior should be similar to a simple code pre-processor handling ifdef blocks. I've worked out how to do it as below, but some parts such as the "contents" variable didn't seem like the best way to handle this. <xsl:stylesheet version="1.0" xmlns:xsl=