Get full html code from wicket - wicket

I am trying to parse html code from wicket application to Java. My application uses wicket and I found a method
tester.getLastResponse().getDocument()
which does just that. However not all html code gets included there. When I saved this output I can see that there are places like
< MARKUP FOR
com. ... .form.PlainCheckBoxPanel END
>
How can I make it parse the full html code?

It seems you run your application in DEVELOPMENT mode and org.apache.wicket.settings.DebugSettings#isOutputMarkupContainerClassName() returns true.
Change it to PRODUCTION mode or call org.apache.wicket.settings.DebugSettings#setOutputMarkupContainerClassName(false).

Related

Using codemirror to execute code on server

Novice to Codemirror.
I have codemirror running on my server I have it set to Python mode. Can someone please suggest how I go about executing the code and showing the result on the page where I have written the python code
Thanks
Without knowing much about your setup, here's a general idea:
Use the getValue() method to get the code from your CodeMirror instance.
Assuming the code is a run-able Python script, you can either
(1) send the code to your back end with AJAX or a POST request and run it there. Or (2) you could run the Python script in the browser with a library like one discussed here.
If you ran it on the back end, you can send the result of running the code back as text or JSON with your preferred protocol. If you ran it on the browser, you should probably follow the guidelines for the specific library you used.

How to append html in Nuxt with universal mode

I try to append HTML in js file. It was OK for SPA mode.
But when I change to universal mode, the HTML can't be appended.
Then I try to set the timeout for append function and it's Ok. The HTML is appended successfully.
I don't understand the reason why?
I just a new member in nuxt, so please help me explain the reason why, and how can I append HTML without set timeout?
Thanks so much!
Without seeing the code you are using to try and implement appending html I can't be certain, but I suspect the process where the appending is to happen is taking place on the server, before it is rendered to the client.
To get around this you could implement the use of process.client to delay the appending.
if (process.client) {
//do what needs to be done
}
The other option would be to use the mounted hook to call to append the html.
As I say, if you post the code you are trying to use it would be possible to show a more detailed answer.

JBehave results displayed on a webpage

I have been working on a project that lets me test the behaviours of my companies webpage.
I have written an API and the testcase I am working on runs through JUnitRunner and the test passes.
The next step is to get the results displayed on a webpage, oes anyone know what plugin I need to get the JBehave results in HTML format or as a file.
I know I should be posting my code but there is no problems with the code, I just need the output in a different formatt.
Thanks
To get the HTML output you need to make sure that you are generating the views with STATS and HTML output.
In MostUsefulConfiguration, add
.useStoryReporterBuilder(
new StoryReporterBuilder()
.withReporters(new MyStoryReporter())
.withFormats(Format.CONSOLE, Format.HTML, Format.STATS)
In the Embedder method add
embedder = configuredEmbedder();
embedder
.embedderControls()
.doGenerateViewAfterStories(true)
This should be all you need to do to get HTML output.
We wanted more information than is provided in the default output so we created a new StoryReporter class to capture the additional data and '#Override' the existing methods where appropriate. The new reporter class also needs to be added to the mostUseFulConfiguration
.useStoryReporterBuilder(
new StoryReporterBuilder()
.withReporters(new MyStoryReporter())
We also needed to amend or create a new Freemarker template (jbehave-reports-with-totals.ftl) to actually get it to write out the new data from the new story reporter class into an HTML file. I am not going to provide an example here. Please read the Freemarker documentation which is very good.
check the reporting setup at JBehave's site.
and check the examples source code here. almost all examples is reporting to html and others.

Standalone GWT Deployment

So, this is a pretty trivial thing to accomplish apparently, but for some reason it just will not work for me. I created a VERY SIMPLE GWT app. It uses UIBinder just to display a label and a button, no actual processing or handling takes place. I did this to test deploying the app using strictly JS and html that is not hosted by Eclipse and Jetty or whatever.
I compile my app, run it in eclipse, and it works fine. However, when I try to run the html page directly from the WAR directory, it does not work.
Do I need this running on a webserver for it to work? It is just html and js, so I shouldn't? I've been to the GWT site about deploying, and surfed quite a few forums. They seem to always mention the necessity of a server, but it seems like it should not be necessary?
Since it is a pure JavaScript and HTML it should work properly without server. Checkout this link: Compile and run in Production Mode with Eclipse
In your EntryPoint class, in onModuleLoad() there's a RootPanel.get("someDivId") call somewhere. Make sure your html page (=the host page) contains a div with that id.
Also make sure your host page calls the right java script file. It's easy to forget to edit the host page after you renamed your GWT module (see rename-to in your .gwt.xml), as the generated JavaScript file matches your module name.
This will work locally on all browsers except Chrome for security reasons.
See http://code.google.com/p/chromium/issues/detail?id=31068
and http://code.google.com/p/chromium/issues/detail?id=70088

symfony/zend integration - blank screen

I need to use ZendAMF on a symfony project and I'm currently working on integrating the two.
I have a frontend app with two modules, one of which is 'gateway' - the AMF gateway. In my frontend app config, I have the following in the configure function:
// load symfony autoloading first
parent::initialize();
// Integrate Zend Framework
require_once('[MY PATH TO ZEND]\Loader.php');
spl_autoload_register(array('Zend_Loader', 'autoload'));
The executeIndex function my the gateway actions.class.php looks like this
// No Layout
$this->setLayout(false);
// Set MIME Type
$this->getResponse()->setContentType('application/x-amf; charset='.sfConfig::get('sf_charset'));
// Disable cause this is a non-html page
sfConfig::set('sf_web_debug', false);
// Create AMF Server
$server = new Zend_Amf_Server();
$server->setClass('MYCLASS');
echo $server->handle();
return sfView::NONE;
Now when I try to visit the url for the gateway module, or even the other module which was working perfectly fine until this attempt, I only see a blank screen, with not even the symfony dev bar loaded. Oddly enough, my symfony logs are not being updated as well, which suggests that Synfony is not even being 'reached'.
So presumably the error has something to do with Zend, but I have no idea how to figure out what the error could be. One thing I do know for sure is that this is not a file path error, because if I change the path in the following line (a part of frontendConfiguration as shown above), I get a Zend_Amf_Server not found error. So the path must be correct. Also if I comment out this very same line, the second module resumes to normality, and my gateway broadcasts a blank x-amf stream.
spl_autoload_register(array('Zend_Loader', 'autoload'));
Does anyone have any tips on how I could attach this problem?
Thanks
P.S. I'm currently running an older version of Zend, which is why I am using Zend_Loader instead of Zend_autoLoader (I think). But I've tried switching to the new lib, but the error still remains. So it's not a version problem as well.
got it...
I was not using
set_include_path()
while loading Zend. It's still odd that it would give such a cryptic error, but this was the missing piece indeed.