include

What is the difference between include and require in Ruby?

My question is similar to this one over here about include and extend. What's the difference between require and include in Ruby? If I just want to use the methods from a module in my class, should I require it or include it? ...

Purpose of: #define, #include, #undef...

Hi All, What would the purpose of this construct in a c file be?: #define _TIMERC #include "timer.h" #undef _TIMERC I am aware of the guard for preventing multiple inclusion of a header file. This doesn't appear to be whats happening though. thanks! ...

Why #include <stdio.h> is *not* required to use printf()?

Session transcript: >type lookma.c int main() { printf("%s", "no stdio.h"); } >cl lookma.c Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. lookma.c Microsoft (R) Incremental Linker Version 8.00.50727.762 Copyright (C) Microsoft Corporation. ...

Why does the order of including modules make a difference in Ruby?

This question is best summed up with a code example: module TestOne module Foo def foo 42 end end module Bar include Foo end class Quux include Bar end end TestOne::Bar.ancestors # => [TestOne::Bar, TestOne::Foo] TestOne::Quux.ancestors # => [TestOne::Quux, TestOne::Bar, TestOne::Foo, Object, Kernel]...

In Php when is Include/Require evaluated?

With Php when does an included file get included? Is it during a preprocessing stage or is it during script evaluation? Right now I have several scripts that share the same header and footer code, which do input validation and exception handling. Like this: /* validate input */ ... /* process/do task */ ... /* handle exceptions */ ... ...

Visibility of script includes in an IFRAME

For example: script.js: function functionFromScriptJS() { alert('inside functionFromScriptJS'); } iframe.html: <html> <head> <script language="Javascript" src="script.js"></script> </head> <body> <iframe> <body> <script language="JavaScript"> functionFromScriptJS(); </script> </body> </iframe> </body> <h...

How to include sub-directories in Visual Studio?

Hi I have to include many header files, which are in different sub-directories. Is there a way in Visual Studio (I am using 2005 edition) to set one include path that Visual Studio will search also the sub-directories for header files? ...

Adding a directory for the headers in a Makefile

Hello I would like to ask you, If someone knows how can I add a directory for the header files in the Makefile to avoid the error *.h not found, I have tried this option but does not work: INC_PATH := -I /directory/to/add ...

Simple SQL code evades me.. Unionize two mismatched tables.

I'm selecting 1 field from 1 table and storing it into a temp table. Sometimes that table ends up with 0 rows. I want to add that field onto another table that has 20+ fields Regular union won't work for me because of the field # mismatch. Outer wont work for me because there is nothing to compare. NVL doesn't work on the first temp t...

Refactoring a massive function into many files.

I've been trying to refactor a "bit" of code that I'd previously developed. Basically, the project was my response to not knowing how to use XSLT effectively, so I developed an XML transformation system in PHP. The program reads through the tags of an XML file and does something along these lines to convert it to HTML: private function ...

How do I replace this preprocessor macro with a #include?

UPDATE: Obviously, you'd want to do this using templates or a base class rather than macros. Unfortunately for various reasons I can't use templates, or a base class. At the moment I am using a macro to define a bunch of fields and methods on various classes, like this: class Example { // Use FIELDS_AND_METHODS macro to define some...

How do I format a PHP include() absolute (rather than relative) path?

On various pages throughout my PHP web site and in various nested directories I want to include a specific file at a path relative to the root. What single command can I put on both of these pages... http://www.example.com/pageone.php http://www.example.com/somedirectory/pagetwo.php ...to include this page: http://www.example.com/in...

How can I generate multiple classes from xsd's with common includes?

Aloha I received a few nice xsd files which I want to convert to classes (using xsd.exe) All the xsd's have the same includes, like this: <xs:include schemaLocation="kstypes.xsd" /> <xs:include schemaLocation="ksparams.xsd" /> When I generate a class for each xsd the types declared in these files are duplicated for each original xsd....

Is requiring a certain order for #includes in c++ a sign of bad library/header design?

I've used some very large scale systems and never seen a required order, but came across it recently. Does the STL or STD library or even Boost have any cases where certain includes must come in a certain order? ...

C++ namespaces: cross-usage

Consider the following example. It consists of two header files, declaring two different namespaces: // a1.h #pragma once #include "a2.h" namespace a1 { const int x = 10; typedef a2::C B; } and the second one is // a2.h #pragma once #include "a1.h" namespace a2 { class C { public: int say() { return a1::x...

Do you prefer functioning or including within one php file?

Hi, How do you manage your php codes? Do you prefer functioning within one php file or including larger blocks of "raw code"? Edit: In fact, my code is pretty nasty, as I don't use any namespaces and classes - only functions and including. I shall look the classes up ^^. ...

Basic help with include php

Ok I'm at my work this friday setting up a table that will have data in it that will come from a separate file called values.php. When I write it like this, the divs turn up blank. I think I have the "include" written wrong, does an absolute path not work? <?php include('http://www.nextadvisor.com/credit_report_services/values.php'); ...

Classes Including Each Other in C++

Hello! I'm a C++ newbie, but I wasn't able to find the answer to this (most likely trivial) question online. I am having some trouble compiling some code where two classes include each other. To begin, should my #include statements go inside or outside of my macros? In practice, this hasn't seemed to matter. However, in this particu...

PHP - Find URL of script that included current document

I have a template I made that sets variables that rarely change, call my headers, calls my banner and sidebar, loads a variable which shows the individual pages, then calls the footer. In one of my headers, I want the URL of the page in the user's address bar. Is there a way to do this? Currently: <?php $title = "MySite - Contacts"; in...

prevent direct access to a php include file.

I have a php file which I will be using as exclusively as an include. Therefor I would like to throw an error instead of executing it when it's accessed directly by typing in the URL instead of being included. Basically I need to do a check as follows in the php file: if ( $REQUEST_URL == $URL_OF_CURRENT_PAGE ) die ("Direct access not ...