Directory_map works only on C: harddisk.
I want to use it on a server "P:" or "Q:" but that's not working currently.
I have full permission so I guess the problem is not about it.
$path = "C:\Users\Public\Documents\";
$map = directory_map(realpath($path), TRUE);
var_dump($map);
// WORKS
$path = "P:\INTRANET";
// DOESN'T WORKS
And the same things happend with get_filenames function ...
Ok so, I found a pretty nice solution here :
http://www.dynamicdrive.com/forums/showthread.php?27880-Using-function-opendir-on-a-network-drive #DaveRandom comment.
You can also see his contribution about that in php manual http://php.net//manual/fr/function.opendir.php
In fact, to use function (in codeigniter or php ) in a network drive, you had to map it.
Related
I'm building a small HR management system for my company, and am facing a weird issue with GoDaddy hosting. As if the pain that comes with figuring out the index.php? part was not enough, now I'm not able to log in as an HR. The error I get is that:
Parse error: syntax error, unexpected '[' in /home/content/37/11019837/html/hrms/application/controllers/hr.php on line 58
Now the line it refers to is part of a file upload function, and goes like this:
$path = $this->upload->data()['full_path'];
. . . which is simply saving the uploaded file path to $path. BUT, this is part of the uploading function and shouldn't even be accessed while logging in. Once I hit "Log in", the URL says http://www.example.com/hrms/index.php?/hr/dashboard which means the following function will be called:
public function dashboard()
{
$data['page_title'] = 'HR Area';
$this->load->view('hr/header.php', $data);
$this->load->view('hr/navigation.php');
$this->load->view('hr/footer.php');
}
A parting note: The app is working without hiccups on the local server, so I'm not sure why it's hopping functions on GoDaddy servers. Can someone throw some light?
Try this:
$path = $this->upload->data();
$path1 = $path['full_path'];
I work on Mac OS X 10.7.3 with R version 2.14.0 (2011-10-31). My ~/.Rprofile is
options(repos=c(CRAN="http://cran.ch.r-project.org",
BioC="http://www.bioconductor.org",
Omegahat="http://www.omegahat.org/R"),
pdfviewer=path.expand("~/R/misc/shell_scripts/skim"),
browser="mybrowser")
where mybrowser is a file in /bin/ which contains open -a "/Applications/Google Chrome.app". When I open R and type help.start(), all I obtain is that Chrome becomes active, but no real output from help.start(). How can I properly set up browser in options so that help.start() works as expected?
I originally just had browser="Chrome", but R couldn't find the browser. I tried several kinds of things to solve this (e.g., browser="/Applications/Google Chrome.app" [and various variants to escape the blank]), but none worked. I guess that's because sh /Applications/Google\ Chrome.app just does not work. On the Mac, applications are opened via open -a ..., that's why I created mybrowser. That finally opened the browser, but I couldn't figure out how to get help.start to work properly.
Create a Renviron file in your home (i.e ~/.Renviron) and add this line.
R_BROWSER=google-chrome
I'm not sure about "chrome" part, i use conkeror and my setup is :
R_BROWSER=conkeror
But this should do the tricks
In the meantime, Hans-Joerg Bibiko helped out: the solution is to set browser to browser="/usr/bin/open -a 'Google Chrome'"
If you look in utils:::print.help_files_with_topic (the function that actually issues the call to browseURL()), there is this really annoying line:
if (.Platform$GUI == "AQUA" && type == "html")
browser <- get("aqua.browser", envir = as.environment("tools:RGUI"))
And since .Platform$GUI == "AQUA" on OSX, this means that you have to do some trickery to browse help files in your favorite browser. Hence, in my .Rprofile (located here path.expand('~/.Rprofile'), of course), I included these lines.
options(help_type='html')
options(browser="/usr/bin/open -a '/applications/Google Chrome.app'")
p <- .Platform
p$GUI = 'unknown'
unlockBinding('.Platform', as.environment('package:base'))
assign('.Platform', p , envir=as.environment('package:base'))
lockBinding('.Platform', as.environment('package:base'))
rm(p)
So far it doesn't seem to have any effect other than enabling use of an alternate browser, but you may want to read the section labeled "Aqua" in ?.Profile if you're worried about messing around with base.
I am using the build in Codeigniter Agent detection library and that outputs
the browser version. The only problem is that it outputs the complete version number.
For example this for Chrome:
16.0.912.77
I only need this:
16
How can I trim away everything after 16? It must work for other browser versions too.
Like 7.44.3.
Thankful for all help!
What about this:
$version = '16.0.912.77';
$shortVersion = explode('.', $version);
$shortVersion = $shortVersion[0];
echo $shortVersion; // will output <16>
I need to get the current encoding according to the system local settings. I'm looking for such function working this way:
my $sysEncoding = getSystemEncoding();
#and now $sysEncoding equals e.g. 'windows-1250'
I looked everywhere on the internet. I've found just the module PerlIO::locale. But I thing that the system encoding should be recognized easier without additional modules.
Encode::Locale provides the means to handle this.
use Win32::API;
if (Win32::API->Import('kernel32', 'int GetACP()')) {
$enc = GetACP();
print "Current local encoding is '$enc'\n";
}
Thanks for hint to Ikegami.
Hey all. I am writing a program that will transform some data in our database, and then call Doctrine to build YAML files from said Mysql Database structure. I have Doctrine working from within PHP. However I can't figure out how to call the CLI commands from within PHP. Following is the Doctrine 2 CLI command that does what I need.
php ./doctrine orm:convert-mapping --filter="users" --from-database yml ./test
This command works from the Linux command line, but how to I do this same thing via Doctrine objects? I don't want to just use the PHP exec statement to send a command to the shell. I wish to use the Doctrine object model.
Don!:
Apparently this is not a very common programming method. However, I have used Doctrine from PHP by calling it via the PHP EXEC command. I know you said that you would not like to do it this way. However, it actually works quite well. Below is an example of such a solution.
$cmd_string = "php ./doctrine orm:generate-entities --generate-annotations=1 --regenerate-entities=1 $this->entity_file_dir";
$result = array();
exec($cmd_string, &$result);
Hope this helps,
-Don!
I stumbled upon this question when trying to execute a command directly from a PHP script, without using the CLI.
Particularly, I was needing to call orm:ensure-production-settings.
Each Doctrine command has its own class: http://www.doctrine-project.org/api/orm/2.4/namespace-Doctrine.ORM.Tools.Console.Command.html
I solved it the following way:
$entityManager = ...; // Get the entity manager somehow in your application
// Creates the helper set
$helperSet = \Doctrine\ORM\Tools\Console\ConsoleRunner::createHelperSet($entityManager);
// Initializes the desired command and sets the helper set
// In your case it should be ConvertMappingCommand instead
$command = new \Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand();
$command->setHelperSet($helperSet);
// Initializes the input
// Alternatives: http://api.symfony.com/2.0/Symfony/Component/Console/Input.html
$input = new \Symfony\Component\Console\Input\ArgvInput(); // Input coming from the CLI arguments
// Initializes the output
// Alternatives: http://api.symfony.com/2.0/Symfony/Component/Console/Output.html
$output = new \Symfony\Component\Console\Output\ConsoleOutput(); // Prints the output in the console
// Runs the command
$command->run($input, $output);
I'm new to Doctrine so I'm not exactly sure how this works, but it does. Any comment is appreciated.