symfony 1.0 won't return a proper instance on local machine - symfony1

I recently had to start making small changes to an existing site so I downloaded it and tried to run it but get an error:
Call to undefined method sfContext::getController() in
/home/user/www/site.com/web/index.php on line 16
I tried to figure out which file is being loaded by inserting these lines with this command in index.php right before the dispatch call.
$reflection = new ReflectionClass('sfContext');
$classFile = $reflection->getFileName();
die($classFile);
sfContext::getInstance()->getController()->dispatch();
And it looks like file loaded is:
/home/user/www/site.com/lib/vendor/symfony1.0/test/unit/sfContextMock.class.php
This symfony1.0 site works fine on original server but not on my local machine.
I checked php version and php.ini and they are identical. I cant figure out why wrong class is being loaded or what the problem is.
Here is the index.php file
<?php
define('SF_ROOT_DIR', realpath(dirname(__FILE__).'/..'));
define('SF_APP', 'front');
define('SF_ENVIRONMENT', 'prod');
define('SF_DEBUG', true);
require_once(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.SF_APP.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php');
sfContext::getInstance()->getController()->dispatch();

You should update to the lastest one available (1.0.22).

Related

All of a sudden R does not read my excel files

So today all of a sudden R does not read my excel files. I made absolutely no change on my computer.
My working directory is "C:/Users/Ilias Iliadis/OneDrive/Documents" (i got this with getwd() ).
This is the error message that is displayed: Error in read.xlsx.default("GerBiogas") : File does not exist.
GerBiogas is the file i am trying to load. I am absolutely sure it is in the correct folder and i spell it properly. The file is also in xlsx form. I unistalled and reinstalled R but the problem remains.
Do you have any idea was is going on? All of a sudden i cannot load any of my files.
I am trying to load it with this:
read.xlsx("GerBiogas")
i also tried to specify the path: DT <- read.xlsx("C:\Users\Ilias Iliadis\OneDrive\Documents\GerBiogas.xlsx")
Again it does not work. I am using R version 4.2.2.

cordova-plugin-file: files not accessible after app update (iOS)

I am experiencing a funny problem: I am developing an ionic app, using cordova-plugin-file to store images. The resulting paths (URIs in form file:///...) are stored in a SQLite DB along with more information. When I install the app and use it, all works perfect. But if I update (or reinstall) the app, the old images are not found anymore, while newly added images work perfect.
I first suspected that the image files were being deleted on update, but I checked the content of the directory and the files are still there. (FYI: I am using file.dataDirectory/scans/ to place my files).
Then I thought that maybe I could go around the problem loading into img src a base64 blob loaded with cordova.file.readAsUrl(), but cordova.file does not find the file as well (I insist, the files are there, I checked with XCode).
So I checked further with cordova.file and it only finds files that are added after last app install, but the older files are still present in the directory.
Here my code:
private getImgSrcFromDocument(doc: Document): any {
const uri = doc.fileName;
const src = this.webView.convertFileSrc(uri);
const sanitized = this.sanitizer.bypassSecurityTrustUrl(src);
console.log({uri, src, sanitized});
return sanitized;
}
<img class="document_thumbnail" [src]="getImgSrcFromDocument(doc)">
I have already checked this, but is not my case.
By the way, the same code works perfect on Android.
Any idea what could be the problem?
Thanks in advance!
I found the reason why and the solution (very obvious when you know the problem):
Reason
On every new install, iOS renames the data directory for the app. The directory path has this form:
file:///var/mobile/Containers/Data/Application/ABC0000-1234-99DD-00FA-E835FEA/Library/NoCloud/
The hash in the middle is renewed on every install, so the stored full paths in DB are not valid anymore.
Solution
If you still can do it (no deploy yet, no real users), store only the relative path and complete it every time with this.file.dataDirectory (or wherever you wanted to store your files).
If you already have real users and want your update to 'find the files', just ignore the first part of the stored path and build it like before:
const ValidUri = this.file.dataDirectory + // The injected cordova-plugin-file
'relativeSubDirectories/' + // If you store your files in some subdirectory
this.document.storedFullPath.substr( // Take from fullPath only the filename
this.document.storedFullPath.lastIndexOf('/') + 1
);
Where storedFullPath is the string file:///var/mobile/....
After that, you still have to do the webView conversion and the sanitizing, like in the question above.
Hope this helps someone.

Errors on System.IO.FileStream CSV file creation and System.IO.File.Delete

In an old VB.NET code (VS 2008) I use this code:
If System.IO.File.Exists(sFilePath) Then
System.IO.File.Delete(sFilePath)
End If
Dim Fs As New System.IO.FileStream(sFilePath, System.IO.FileMode.CreateNew, System.IO.FileAccess.Write)
Fs.Close()
If the file exists then on this line:
System.IO.File.Delete(sFilePath)
I get this error:
The process cannot access the file because it is being used by another process.
When I manually remove the file, then on this line:
Dim Fs As New System.IO.FileStream(sFilePath, System.IO.FileMode.CreateNew, System.IO.FileAccess.Write)
I get the error:
The file already exists
Although it doesn't.
The code always (for 8 years now) worked perfectly. Nothing in this part of the code has been changed.
So what is going on here?

How do you display errors by editing the php.ini file in HHVM?

I am using CentOS 7 and I have tried to edit the php.ini file located /etc/hhvm/php.ini.
I added the line
display_errors=On
The only two other lines in php.ini are
date.timezone="America/New_York"
hhvm.dynamic_extension_path = /usr/local/lib64/hhvm/extensions
When I try to run a page it shows a blank page (because of fatal error). But when I run the same file from the command line with
$ hhvm filename.php
Then the fatal error is displayed. How can I make errors show up while I develop? In regular PHP I can edit this in php.ini, or even just add lines like these
ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
error_reporting(E_ALL);
I have no idea how to do this in HHVM.
display_errors may or may not work in HHVM. There have been some issues with it, and I'm not sure what the current status is. You should check your log file.
Make sure you use a numeric value for error_reporting if you set it in the INI file. (Setting it with a constant in code is fine.) This bug prevents constants from working in INI files.

system.io.directorynotfound -> But it works in Console

My files are referenced like so (it's all relative):
// WHERE YOU KEEP THE PAGE TITLE XML
public static string myPageTitleXML = "xml/pagetitles.xml";
and
using (StreamReader r = new StreamReader(myPageTitleXML))
{ //etc.. . .etc....etc..
}
I get system.io.directorynotfound, and "this problem needs to be shut down", when I double click the executable. But running it from the console works like a charm. What's wrong here?
I played around with attempting to set Environment.CurrentDirectory but couldn't get anything to work. Why should I have to do that anyway? It defeats the purpose of a relative path no?
responding.. .
"application" does not exist in the current context, i'll keep trying what people have mentioned, this is not a windows.form
testing
Path.GetDirectoryName(Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), myPageTitleXML); gives error URI formats are not supported, as does Path.GetFullPath(). Server.MapPath results in an error as well, this is currently offline
Well assuming this directory is somewhere under the directory in which your code is executing, it sounds like you can use ..
Application.ExecutablePath()
or
Application.StartUpPath()
.. to get an idea as to what your application is seeing when it goes in search of an 'xml' directory with the 'pagetitles.xml' file in it.
If the directory returned by one of these methods does not point where you thought it did, you'll need to move the location of your application or the location of this folder so that it is within the same directory as the app.
Hope this gets you on the right path.
So, when you run it from double clicking the executable, is there a file named pagetitles.xml in a folder named xml, where xml is a folder in the same location as the executable?
It's certainly possible to use relative paths like this, but I wouldn't really recommend it. Instead, maybe use something like:
string fileToOpen = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), myPageTitleXML);
using (StreamReader r = new StreamReader(fileToOpen))
{
//etc.. . .etc....etc..
}
Is this ASP.NET code? If so then you probably need to do MapPath("xml/pagetitles.xml")

Resources