How to debug symfony in Netbeans? I cannot call specific pages - debugging

I've already read posts like Passing PHP arguments into NetBeans into a page that features symfony url-routing
but I cannot make things work.
I would like to run the following page:
http://localhost/s/web/frontend_dev.php/travel
So I tried first the "Local Website Configuration" with Netbeans 6.9.1. As stated in the linked thread there is an issue here since I can point to the project url and to the "web/frontend_dev.php" index file but I am not able to have "/travel" as an argument since Netbeans always prefixes it with ? for parameter passing which I don't want.
I the mentioned thread the solution is supposed to be using the Script Config option. Fine
I can point to php.exe and I can point to the index file again at web/frontend_dev.php but although I can pass arguments like /travel there it still does not work since it creates a whitespace in the call:
php.exe ./web/frontend_dev.php /travel
which does not work either.

It is easier to use the following:
Set the Debug URL to "Do not open Webbrowser" (Project->Properties->Run Configuration->Advanced)
Start the debugging session with Netbeans (Netbeans doesn't start a browser but waits for a XDebug connection)
Use the easy XDebug-Firefox-Plugin to start XDebug for you Symfony App (easy XDebug)
Thats it. This is working perfectly for my Symfony apps

As far as I undersand you, this is a std-situation when there is no 101-path-mapping from file-path to URL-path.
In Eclipse you can either define a completely new path-mapping or make Eclipse request a certain URL-path. In your case you would just define localhost as your server and '/s/web/frontend_dev.php/travel' as the path to attach.
I'm pretty sure there is a similar option in NetBeans as this is in times of mod-rewrite and Zend FW a very common situation.

Related

Play! Framework 2.1.3 pdf problems

so I am working on a school project in which we have designed a web application that takes in much user info and creates a pdf then should display that pdf to the user so they can print it off or save it. We are using Play! Framework 2.1.3 as our framework and server and Java for the server side. I create the pdf with Apache's PDFbox library. Every thing works as it should in development mode ie launching it on a localhost with plays run command. the issue is when we put it up to the server and launch with plays start command I it seems to take a snapshot of the directory (or at least the assets/public folder) which is where I am housing the output.pdf file/s (i have attempted to move the file elsewhere but that still seems to result in a 404 error). Initially I believed this to be something with liunx machine we were deploying to which was creating a caching problem and have tried many of the tricks to defeat the browser from caching the pdf
like using javascript to append on a time stamp to the filename,
using this cache-control directive in the play! documentation,
"assets.cache./public/stylesheets/output.pdf"="max-age=0",
then I tried to just save the pdf as a different filename each time and pass back the name of that file and call it directly through the file structure in the HTML
which also works fine with the run command but not the start.
finally I came to the conclusion that when the start command is issued it balls up the files so only the files that are there when the start command is issued can be seen.
I read the documentation here
http://www.playframework.com/documentation/2.1.x/Production
which then I noticed this part
When you run the start command, Play forks a new JVM and runs the
default Netty HTTP server. The standard output stream is redirected to
the Play console, so you can monitor its status.
so it looks like the fact that it forks a new JVM is what is causing my pain.
so my question really is can this be gotten around in some way that a web app can create and display a pdf form? (if I cannot get this to work my only solution
that I can see is that I will have to simulate the form with HTML and fill it out from there) --which I really think is a bad way to do this.
this seems like something that should have a solution but I cannot seem to find or come up with one please help.
i have looked here:
http://www.playframework.com/documentation/2.1.x/JavaStream
the answer may be in there but Im not getting it to work I am pretty novice with this Play! Framework still
You are trying to deliver the generated PDF file to the user by placing it in the assets directory, and putting a link to it in the HTML. This works in development mode because Play finds the assets in the directory. It won't work in production because the project is wrapped up into a jar file when you do play dist, and the contents of the jar file can't be modified by the Play application. (In dev mode, Play has a classpath entry for the directory. In production, the classpath points to the jar file).
You are on the right lines with JavaStream. The way forward is:
Generate the PDF somewhere in your local filesystem (I recommend the temp directory).
Write a new Action in your Application object that opens the file you generated, and serves it instead of a web page.
Check out the Play docs for serving files. This approach also has the advantage that you can specify the filename that the user sees. There is an overloaded function Controller.ok(File file, String filename) for doing this. (When you generate the file, you should give it a unique name, otherwise each request will overwrite the file from a previous request. But you don't want the user to see the unique name).

Getting parameters from applicationManager

I am basically executing the following luna-send command and trying to get those parameters from applicationManager:
luna-send -n 1 palm://com.palm.power/timeout/set '{"wakeup":true, "key":"myKey",
"uri":"palm://com.palm.applicationManager/launch","params":{"id":"com.my.app",
"params":{"test":true,"test1:true}},"in":"00:00:15"}'
After executing this command, my app gets launched by applicationManager, but I don't know how to get those params in my app. I am using enyo 2.0. I was trying to use onWindowsParamsChange handler, but ApplicationEvents is deprecated for 2.0. Can anyone help me with this?
Thanks
Under Enyo 1.0 it was enyo.windowParams. Under Enyo 2.0 I believe this functionality is gone. These parameters may be available through Cordova, but I'm not positive right now as I don't have the source handy. In any case, this was loaded from PalmSystem.launchParams so you should be able to access that.
If you're handling relaunch then you'll have a little more work to do. I think you'll need to define a Mojo.relaunch on the window object to detect when the launch parameters change.

CakePhp2 defined CAKE_CORE_INCLUDE_PATH, now DS and CORE_PATH undefined in ShellDispatcher

In order to share CakePhp2 core between many sites I edited CAKE_CORE_INCLUDE_PATH in webroot/index.php to point to the cake directory. That works and I can reach my welcome page.
However, when I attempted to run the Cake Console, I ran into issues with ShellDispatcher.php not defining DS and CORE_PATH because they were only defined if CAKE_CORE_INCLUDE_PATH was NOT defined. Once I defined them out of the if statement which checks if CAKE_CORE_INCLUDE_PATH was not defined, I was good to go. However, I would prefer not to "hack" this file because I want to keep the cake core files clean. Are there any better and cleaner options?
I also had to defined CAKE_CORE_INCLUDE_PATH and use it to set $dispatcher in Console/cake.php which is part of the app of course.
Yes there are. As a start never define application-wide variables in Webroot/index.php. As a matter of fact you shouldn't be touching this file at all. You can define variables in
Config/bootstrap.php.
You were getting the error because when in a Shell you're not firing Webroot/index.php at all - you're actually running PHP's CLI and CakePHP fires off in a different manner.
It will go through the bootstrap.php file of course.
You should also use this file to define any global vars, but there is a little bottleneck
here when using PHP's $_SERVER variable's web server related members - e.g. HTTP_HOST and the definition: $myHost = $_SERVER['HTTP_HOST'];. If you start a shell Cake will try to set this variable and it will fail throwing an error. This is because as mentioned before PHP will be running in CLI mode when the CakeShell is envoked. There is a way to detect this of course - you can use $_SERVER['SCRIPT_FILENAME'] or $_SERVER['SCRIPT_NAME'] in bootstrap.php to identify if you're in CLI or not. :)

custom path - selenium not running

I'm trying to run tests with a custom firefox profile.my idea is to
use 2 firefox versions in my machine .one with firefox template &
other without it ,so we used
*custom "C:/Program Files (x86)/UtiluMFC/Mozilla Firefox 3.6/
firefox.exe" in setup from code
if i use custom some extra parameters are passing in url like below in
browser ,
selenium-server/core/RemoteRunner.html?
sessionId=dc91ae43b4754f87a25d4718feeb&multiWindow=true&baseUrl=http%3A
%2F%2Ftest.com&debugMode=false
Note : i have not started the server from command prompt i have used
in java ,but havnt set any firefox template in code.same worked in
linux of i use * firefox instead of * custom
Am i missing some thing?
The question is not that clear - what do you mean by template?
If you want to run with two different Firefox profiles, don't use *custom - rather use *firefox and change the profile as per this post:
Selenium RC : Setting up a Firefox proxy
I think I am strougling with the same and I believe one has to set the proxy settings in the custom firefox to make it work. Did you try that?
Or did you just want to use a profile TEMPLATE in which case you could pass the -firefoxProfileTemplate in your command to start the JAVA server, like so:
java -jar selenium-server.jar -firefoxProfileTemplate "/path/to/profile/"
In the second case, if you use *firefox, your profile will automatically be selected.

Codeigniter App on EC2 - Helpers not loading

I recently just started to migrate over a CI application to Amazon's EC2 service. To test I set up a micro instance of ubuntu and a LAMP stack. PHP, MySQL, HTTPD are all working beautifully. The one issue i'm having now is that when I run my application I receive an error saying that my helpers won't load. The helpers in particular that aren't loading are the ones in subdirectories in the helpers directory ie: /var/www/system/application/helpers/subdirectory/foo_helper.php
The helpers are being autoloaded and in my autoload.php config file they are written like:
$autoload['helper'] = array('subdirectory/foo', 'foo2',...);
Has anyone run into this issue, or have any pointers on where I could go look in my configuration to resolve this?
Thanks for the help!
I'd try debugging the helper function of the Loader class, in particular these lines :
system/libraries/Loader.php
elseif (file_exists(APPPATH.'helpers/'.$helper.EXT))
{
include_once(APPPATH.'helpers/'.$helper.EXT);
}
This is the code that will be hit when including application helpers. Check what path CodeIgniter is trying to include. Double check that the path exists - everyone makes typos now and again ;-)
I think the issue is that when I moved from Windows to Linux I forgot to take into account that linux is case-sensitive. So now I need to go through and rename my files and folders.
But this still doesn't solve the issue where it seems like the page is being cached and I'm not able to refresh and see my changes. Is there any way to force the page to grab a fresh copy from the server on every refresh?

Resources