The latest changesets to Ruby 1.9.2 no longer make the current directory . part of your LOAD_PATH. I have a non-trivial number of Rakefiles that assume that . is part of the LOAD_PATH, so this broke them. Was there a particular justification for doing this?
As for a fix, adding $: << "." everywhere works, but seems incredibly hacky and ...
I want to create a header file in lua (header.lua), then do the "require" function to load it.
How do I do require a file that I have created?
Thanks
...
I'm trying to access the RAILS_ROOT constant in a file residing in the /lib directory, but I'm not able to (uninitialized constant error). Is there something that I need to require to be able to do this? Sorry if this is a dumb question..
...
Hi there.
Today I've tried to include file that returns object. I always use require_once, however now I've noticed weird behavior of it.
File main.php
$lang = false;
$lang->name = "eng";
$lang->author = "Misiur";
$lang->text = "Text is test";
$lang->undefined = "Undefined";
return $lang;
File index.php
$lang = include('langs/eng/m...
I'm trying to load in predefined email messages to send out -- my question is, should I memcache all the email messages rather than just including the file that contains the variables with the email messages, and only call it once a day or something?
...
include("somefile.php");
include_once("somefile.php");
require("somefile.php");
require_once("somefile.php");
What is the difference between these?
...
My script runs fine when I execute it from outside the application (terminal), but when its called from inside the C++ application it shuts down in the require("luasql.mysql") call.
Can anyone help?
...
I have a cron job that needs to include this file:
require '../includes/common.php';
however, when it is run via the cron job (and not my local testing), the relative path does not work.
the cron job runs the following file (on the live server):
/home/username123/public_html/cron/mycronjob.php
and here's the error:
Fatal error: re...
Hi. I hava a function that looks something like this:
require("config.php");
function displayGta()
{
(... lots of code...)
$car = $car_park[3];
}
and a config.php that look something like this:
<?php
$car_park = array ("Mercedes 540 K.", "Chevrolet Coupe.", "Chrysler Imperial.", "Ford Model T.", "Hudson Super.", "Packard ...
Hi. I have this code `
require("db_connect.php");
function xx()
{
$conn = db_connect(); //here it works
(...)
date_default_timezone_set('Europe/Paris');
if(time() <= $x[0]){
(...)
}else
{
(...)
for...
I'm new to rails and making some sort of noob mistake: I frequently need to count the number of lines in a file, so I'm trying to monkey patch class File like this:
class File
def self.line_count( filename )
%x{wc -l #{filename}}.split.first.to_i
end
end
I saved this to /lib/file_util.rb. I thought that this was supposed to...
@required_admin
def get(self):
i want to use this method to make user must be admin.
thanks
...
Hi, I'm trying to require a file upload in a form, but cannot get it to work. Any ideas? I'd rather echo the php error on the page vs. a javascript popup. Thanks for taking a look:
<?php
// initialize $file1
$file1 = $_POST['file1'];
// check upload of $file1
if ($file1 == '' ) {
$error = "Please upload an image";
}
?>
...
In Ruby, instead of repeating the "require" (the "import" in Python) word lots of times, I do
%w{lib1 lib2 lib3 lib4 lib5}.each { |x| require x }
So it iterates over the set of "libs" and "require" (import) each one of them. Now I'm writing a Python script and I would like to do something like that. Is there a way to, or do I need to ...
How do you retrieve the name of the script that included or required it?
Example:
script login.php has a require_once('validate.php') ... validate.php is also called by a number of other scripts. Other than manually setting a flag, is there a way to have validate.php know which script is including/requiring it?
...
I have menu.php, and in the <head> section of menu.php, I have menu.css as a link rel tag of course, both of which work perfectly fine.
Since menu.php is a 'menu', I've required it on pages that need a 'menu' in order to navigate around the website. However, whenever I require menu.php on a page that has its own CSS stylesheet, menu.php...
I use rails-3.0.0.beta3 and ruby-1.9.2-preview3.
I have defined some new methods in the application_controller.rb, and need to test them in the console.
If I changed some codes in the application_controller.rb.
I have to restart the console.
I have tried to use 'reload!' command, just dosen't work.
And then I use "require 'applicati...
Hello
I have main site to which i put code using require function, but when i add php functions into it, they appear as plain text. The php code is rather long so i won't paste it here. Could anyone help me with that?
Thanks
ok i am adding some code:
require part with only one function:
<?php
$content=<<<EOF
echo 'hello';
EOF;
requ...
For required/included files in PHP, is it better to use .inc extensions vs .inc.php vs .php extensions?
...
fileA.php: requires function.inc.php and uses x() from that include file
fileB.php: requires fileA.php User invokes fileB.php to get fileA.php
function.inc.php: function x() - returns filename that invoked it
What is the PHP server variable or whatever that gets the name of fileA.php from within function.inc.php?
Usecase - function ...