The user needs to browse sites through the Java program (not netbeans IDE), it should behave exactly like FireFox browser or IE, any suggestions ? I need to be able to access the DOM so I can manipulate DOM elements.
Also, is there something equivalent to Perl's CPAN but for Java ?
ugh, i've done something like this a while back in ... c++ i think. that must have been in 2002 or something like that. i used a component from Borland's C++ Builder back then (or did i use delphi?) anyways, i did a quick google search and found a rather antique post from '99; if nothing else, it's perhaps a good place to start.
http://www.javaworld.com/javaworld/javatips/jw-javatip66.html
you may also want to look at http://www.velocityreviews.com/forums/t682627-embedding-web-browser-prefer-firefox-in-java-application.html
i hope this helps!
check out http://www.mozilla.org/projects/blackwood/webclient/
Related
I've been having terrible luck trying to get this to work, so I'm hopeful someone can help here.
In Java, I need to be able to take an HTML page with JavaScript within it and detect any JavaScript errors without, preferably without executing the JavaScript code.
I found this article:
Javascript parser for Java
And I've attempted to figure out how I'm supposed to use Caja to do this, but I'm having a difficult time finding any documentation with working examples of anything close to what I'm doing.
As a result I took a look at Nashorn also referenced in that article. I found a few examples which show how to execute JavaScript code from Java, but this doesn't process the whole HTML page. Even then, the execution doesn't seem to include the ability to validate common JavaScript functions (e.g. It hadn't heard of "alert").
Can anyone recommend something that might be able to do what I want, and point me in the right direction for their documentation or give me an example?
jshint as a standalone product seems to be a good fit for this:
it can run in java inside rhino (see https://github.com/jshint/jshint/)
a nodejs package exists (see https://www.npmjs.com/package/jshint)
it works with nashorn but it's quite tricky
I will only cover the technical difficulties around 3rd solution as I finally managed to make it work too...
Spoiler alert: "alert()" is not detected yet... Solution nb 2 will help there...
You first need to grab this specific release of jshint: https://github.com/jshint/jshint/releases/tag/2.4.4
Anything later than v2.7.0 will fail for now and I personally gave up patching intensively prototypes and namespaces... Releases from v2.4.4 until v2.6.3 work without modification but are limited in functionalities.
In the release notes, it's specifically written that "support for the Nashorn JavaScript engine" is working on this release. I'm using JDK8 nashorn 1.8.0_45 for this test.
Next step is to extract from this release this single file jshint-2.4.4/dist/jshint-rhino.js
Now you need to run nashorn/jjs in scripting mode and you need to be specific about the single file you wish to verify. In solution 2 (nodejs based) you can do multiple files or a complete hierarchy below a folder...
Create a simple file file.js:
function(){}
Now run the following command (please note the presence of -- ):
jjs -scripting jshint-rhino.js -- file.js
This will give you the following output:
Missing name in function declaration. (file.js:1:9)
> function(){}
So this covers the how to run jshint in a simple manner with nashorn... With the 3rd solution, at least you can find missing semicolons and several typical errors. But it's not a silver bullet and to me it's not a real alternative.
My personal preference would be to stick to solution 2 only. If you've the possibility to install either nodejs or iojs on your dev platform, go and grab https://www.npmjs.com/package/jshint. Not only will you be able to do more than the 3rd solution, you'll also be able to configure a jshintrc file as described at http://jshint.com/docs/
Eclipse allows to get all references to a function. I'd like to go further and know if anyone knows of a tool or script that would do this recursively ie from a function it would produce the list of different possible function stacks to access to it.
I am looking for this to make sure all the impacts of a change are captured in the spaghetti old legacy code I am looking at the moment. Thanks.
Try eclipse's Call Hierarchy.
It's CTRL-ALT-H on Windows, CTRL-OPTION-H on OS X.
(Hotkeys for eclipse 3.x, I have yet to use eclipse 4)
Its called the Call Hierarchy and you can open it with Ctrl+Alt+H
http://www.javaprogrammingforums.com/java-jdk-ide-tutorials/19-list-shortcuts-key-eclipse.html
Is it possible to edit the content assistance of Eclipse? Sort of add rules or functions for it? I'm aware that Eclipse is open-sourced, but I was there an "easier way" or an interface?
For example, I'm working in Java 1.4.2, so I don't believe I have the magical "autoboxing"(am I correct in thinking that autoboxing would solve this issue?) . So when I'm working with getting parameters from a request, they all return strings when I may need a Long or an Int. I'm always interested in making things more automated (as any computer scientist usually would), so I was wondering if it was possible to have content assist suggest to use the common java parse functions (Integer.parseInt, Long.parseLong, etc) for the passed in parameters.
If you want to actually augment Content Assist in a highly detailed, customized way, you'd have to write a plugin. Eclipse is very well architected such that there are endless extension points via which plugins can extend base functionality, including Content Assist. But, writing one is not a trivial matter (though a skill that could serve you well, if you have the time to learn it).
Another option is to write your own Java editor template, which can emit any pre-defined snippet of code you want (including inserting parameter values), and will be included in Content Assist. Open Eclipse's Preferences and navigate to Java > Editor > Templates. You can use the ? help button on that Preferences page to learn more about them.
I am looking for a CMS that allows me to export the site as static HTML (i.e. the site must be able to work without the CMS itself). I want to be able to create the site on my PC and then upload the exported static HTML to a hosting server.
I must mention that I do not want to use site downloaders to "pull out" the content from a CMS, I want an option in the CMS itself, something like "Export as static content", "Export as HTML" etc.
So far I found Alfresco for Java and Typo3 for PHP but there are so many of CMS tools out there... :(
Can someone share from his experience and point to a good CMS which generates static HTML?
Thank you all!
Check out Wordpress, I think it had an export option that was quite good. Or possibly good ole Google docs?
WebJaxe does that. Actually, it's not even an export: websites created with WebJaxe are always static.
Don't look to recreate the wheel inside a CMS. Choose a CMS because it solves business problems you're facing. To generate a static copy of a site use wget.
So long as you're not doing dynamic JavaScript library loading or css #import declarations, wget is going to grab everything you need and set it up in the correct relatively pathed directory structure so you can stand it up statically somewhere else. Just understand things that are dynamic, like search, will not work no matter what solution you choose.
What you are looking for is a static website generator like PieCrust. There is also a bunch of alternatives listed here.
I want to transform my clauses to conjuctive normal form. Clauses are changed each time i run my program, so i guess i need to built-in a tool in my program to do this for me. Is there any suggestionn how to implement this?? i also found some libraries like:
Orbital library. I am new to logic programming and i have never used them so, its quite difficult to get through them. I also tried to find an example to clear things up, but nothing came up. I am builting my program in java language. Please help...
Thanks in advance!
can you use some of this code?
http://aima-java.googlecode.com/svn/trunk/aima-core/src/main/java/aima/core/logic/fol/CNFConverter.java
# Non-members may check out a read-only working copy anonymously over HTTP.
svn checkout http://aima-java.googlecode.com/svn/trunk/ aima-java-read-only