include

Ruby on Rails: Instantiate associated models with find_by_sql?

Apparently, include and select can't be used simultaneously on a Rails find query, and this has been repeatedly marked as wontfix: http://dev.rubyonrails.org/ticket/7147 http://dev.rubyonrails.org/ticket/5371 This strikes me as very inconvenient, because the times I'd want to use include are exactly the same times I'd want to use select...

PHP includes and subfolder

Hi, I've create an application which uses PHP includes which works great if you don't mind having the PHP include files in the same place as the other files. But I would like to split my code up as neatly as possible. Please see the below file structure: As you can, I would like all ?.php files to be in the document root and for al...

When I include only the jQuery 1.4 Library, I get an exception, why?

I keep getting this error all over the place where I only have jquery 1.3 or 1.4 included. "setting a property that has only a getter" and a long list of warnings in the Firefox Error Console. What's going on? I can't find any information on this issue =/ <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/...

Ruby on Rails: Nested named scopes

Is there any way to nest named scopes inside of each other from different models? Example: class Company has_many :employees named_scope :with_employees, :include => :employees end class Employee belongs_to :company belongs_to :spouse named_scope :with_spouse, :include => :spouse end class Spouse has_one :employee end Is ...

Ruby on Rails: :include on a polymorphic association with submodels

When working with a polymorphic association, is it possible to run an include on submodels that are only present in some types? Example: class Container belongs_to :contents, :polymorphic => true end class Food has_one :container belongs_to :expiration end class Things has_one :container end In the view I'm going to want to d...

Using "includes" in an OO PHP Class

I have a class that inserts information into a MySQL database. I have the connection variables set as fields at the top of the class. When I run the class it works perfectly. I would like to simply store the class fields in a separate file (not a class but just the fields saved in a file) and include it inside my class. when I do this ...

PHP: Check if file is loaded directly instead of including?

Hello Is there a way to prevent user viewing an file but still use it as included to another file in php? Hope you understood! Martti ...

PHP.ini overriding/not allowing set_ini or set_include_path directives

I'm not exactly sure why this is happening. I'm running MAMP on my local machine. And I decided to install PEAR locally. So I edited the PHP.ini file and uncommented the include_path directive. Now for some reason none of my ini_set or set_include path directives work: // trying to different methods ini_set( 'include_path', ini_get( 'in...

How many javascript link I can have in Facebook?

Is there a limit of how many js file I can include () in facebook? I include 5 files. no problem.. the 6th one not loaded. Then I have to put the code in the 6th one into the 5th file. then works. so, is it 5 files in max? BY THE WAY, I'm developing the apps now, not in production. so it is not in the stage of compressing JS / minizin...

PHP Path Problem

Hy everyone i have a problem with my path say i have a PHPfile in /home/bla/www/dev/source/test.php in this test.php i want to include a file in /home/bla/www/config/conf.php <?php include_once(""); ?> i dont want to include it like include /home/bla/www/config/conf.php How can i do it? PS. this fails include_once("../.....

How many PHP includes are too many?

Each page on my website is rendered using PHP. Each PHP file uses around 10 includes. So for every page that is displayed, the server needs to fetch 10 files, in addition to the rest of it's functions (MySQL etc). Should I combine them into a single include file? Will that make ANY difference to real world speed? It's not a trivial tas...

How can get a list of the functions in a javascript file?

I'm trying to cobble together a php style include function for javascript. The route I'm taking is through a XMLHttpRequest. The included file will load, but the functions in that file aren't available as their scope is limited to the function that is calling them. I came across this article which achieves a similar goal, but requires ...

newbie: php how to read in file names in order of filename

I want to "include" the last 2 files in my php file based on their names. So the names are: 01-blahbla.php 02-sdfsdff.php 03-aaaaaaa.php 04-bbbbbbb.php 05-wwwwwwi.php and I only want to include 05 and 04 since their name starts with the biggest number. How do I go on about doing this? ...

PHP include file problem

Hi there again. I have a problem with including files on remote server (but on my local Windows PHP+Apache configuration it works fine...). Problem occurs when I try to include file from included file like this: Contents of index.php: <?php include("Dir1/File1.php"); ?> Contents of Dir1/File1.php: <?php include("File2.php"); inc...

How can I force Doxygen to show full include path?

How can I force Doxygen to show full include path? What do I mean: I have a class foo::bar::bee defined in bee.hpp in following directory structure: foo foo/bar foo/bar/bee.hpp Doxygen, when it documents foo::bar::bee class tells that you need to include <bee.hpp>, but for my software I need <foo/bar/bee.hpp> How can I cause Doxyge...

SystemParametersInfo parameter definitions for C#

I want to make a call to SystemParametersInfo from C#. The first argument to this function is one of a large collection of possible values like SPI_GETACCESSTIMEOUT, which are listed in the documentation, but don't seem to be defined anywhere. I can go find the actual values of these things on the web, and make up an enum with the right...

Where do I put all these function-like #defines, in C?

I'm working with an embedded system, and I'm ending up with a ton of HW-interfacing #define functions. I want to put all of these into a separate file (for OOP-ness), but I don't know the best way to #include that. Do I just put them all into a .c file, then include that? Seems silly to put these in a .h file. ...

How can I include an external JavaScript file exactly once per partial view?

I have a partial view (UserControl) that implements a simple pager in my Asp.Net MVC project. This pager needs access to a .js file that needs to be included exactly once, regardless of how many instances of the pager control are present on the parent page. I've tried to use Page.ClientScript.RegisterClientScriptInclude, but it had no e...

php custom forum error

i have a form, and i want to have it be limited at 10 characters minimum. that is no problem, but what i want to do is echo the error at the top of the page, which is being included, so i cant just do: echo '<div class="error">Error</div>'; i want to have a designated div that is empty (will be on the included header page), but when t...

How to auto-include all headers in directory

I'm going through exercises of a C++ book. For each exercise I want to minimize the boilerplate code I have to write. I've set up my project a certain way but it doesn't seem right, and requires too many changes. Right now I have a single main.cpp file with the following: #include "e0614.h" int main() { E0614 ex; ex.solve(); } ...