Parsing C and Java for displaying code on my website - java

I have hosted my web-application on google appengine. I had to put up some java code on my website.So I am looking for a java parser for the website. Please suggest some.
Actually I wanted to put up a project that used C and Java so I am looking for a parser that can parse both the languages.Are there available parser or I will have to write my own ?
Edit : My sole purpose 'now' is code highlighting

If you just need code highlighting, there are tons of stuff out there. You could, for instance, use highlight.js, or even Google's own code prettifier.
At this moment, that is what I can get from your question, so until further clarification, I won't be able to give a more precise answer.

Related

Is there any way I can try to read files with suffix like '.sas7bdat', '.dta', '.sav' and '.xpt' by using JAVA?

I am working on a module, which can import different kinds of files(currently those file types are SAS output format). Of course, this module is written by java, springboot. The main logic is that when user upload a file, the controller will pass the file inputstream to this module, and call the corresponding method by the file's suffix.
I have done some investigation and found that R-language and python could do this. Can anybody tell me whether there is another way, I mean, can do this job only by JAVA. Thanks.
The sas7bdat is a binary, proprietary format. Its layout has never been made public. Some people have figured it out (like the parso mentioned in the comment). If you really want to go down this path, use the python library as a guide. It will help with sas7bdat and sas7bcat. For the old SAS transport format, see my library on GitHub which is in C#. The new transport format appears to have some incorrect information in its description on the SAS website which I couldn't get around. I have put my code on GitHub in case you want to try.
All that said, let me offer a few words of wisdom: don't do it. Use the python library vs doing it in Java. Also, these libraries read the format vs having read/write. Keep that in mind (it sounds like it doesn't matter but FYI).

Translate English to some other Language in RAD or Eclipse

I have written comments in English in my Java files but now my client wants it in Spanish, So is there any tool/Plugin available in RAD or ECLIPSE IDE to convert all the comments in other language. I am using google translator to convert comments manually.
I'm not aware of any plugin like that. First, I would make sure the client really really wants this. Doing an automatic translate of highly technical text will not give a very good quality. I question if they will be usable at all, do a test translate of a couple of comments first to get approval.
If they really want something that is usable someone with language and technical skill would have to manually translate everything, which would take time/money.
But, if I had to do it, I would take the idea from this answer to automatically launch a web browser from Eclipse, and use the URL to google translate, https://translate.google.se/#en/es/${selected_text}, should work.
If the codebase is large and the comments can be easily found, such as a javadoc, I would write some script to automatically handle this. Google translate has an API you can use. See REST API doc
Every now and then a developer has to work on a code base that is in a language that is unknown to him. In this case, he would need to copy variable, class, method names to Google Translate to see what they actually mean.
The Source Code Translation in Eclipse tries to help such developers, by providing a popup with the translated words, when hovering the mouse over them. The plugin is able to handle compound words or phrases that use camelCase or underscore "_" as separation methods.
For the plugin to work, a properties file containing the word to be translated, and the translation needs to be created and added from the Preferences section of the plugin.
Add this URL to your Eclipse Installation to reach this solution's update site.
https://github.com/Testehan/TranslationPluginInstall/raw/master
In External Tools Configurations
Location : ${system_path:cmd.exe}
Arguments : /C start "" "https://translate.google.com/#en/fr/${selected_text}"

Generic HighCharts (Javascript\Java)

I have searched for ages but couldn't find what I am looking for.
I'm using highCharts.
Is there a method or project or something that creates generic highcharts charts for me? Currently I must make a javascript chart function for every chart I want. I want to make this generic.
So that I only have to ask the method getChart('line','etc'); something like this.
This way i dont have to code everything over and over again for each chart that I want.
(its for a Dashboard )
If this doesn't exists at all I will make it myself.
There are several libraries out there for producing highcharts. Many are listed on the highcharts download page here: http://www.highcharts.com/download under 'API Wrappers:'.
If you are most confortable working in Java, maybe you should check out GWT and the GWT Highcharts wrapper. GWT lets you write Java code, which compiles down into javascript.
Those ones are the bests http://www.highcharts.com/ i tried them and they work absolutely fine with great design just download them and make us know if you get problemes using them.

How to interact with a .aspx using Java?

I'd like to write a java program that has the ability to input information onto an asp, and then read back the data that is returned from the asp.
Does anyone have any suggestions on how to go about doing this?
Is there an easier/more elegant solution than web scraping?
In order for Java code to work in ASP, it has to be compiled byte-code that can be read by the CLR. A quick Google search of "Java" + ".NET" yielded this: http://www.janetdev.org/
Another thing you could do is just learn C#. If you already know Java, there hardly is a learning curve.

How can I implement similar to the web query feature in Excel in java?

I'm new here and I hope I'm not asking something which has already been answered. I have searched everywhere but am yet to discover an adequate answer.
My objective is fairly simple: I want to create a program which will stream the live gold and silver rates from: this website
How would I be able to pinpoint the values that I want to download? Currently, I have managed to implement this using Microsoft Excel's web query feature wherein I am able to select a table from the webpage. However, I want to make it a standalone application.
By the way, I need to retrieve the rates to perform a calculation which is then displayed to the user.
I would greatly appreciate any ideas on how this can be achieved.
I think you need to scrape or parse the data from your website. For that take a look at htmlcleaner, JSoup html parsers.
You can use XPath with htmlcleaner to pinpoint the data.Here is a nice example Xpath Example.
You can use firefox's firebug extension to get the xpath of an element. But your xpath is going to be very huge, by the look of the website you mentioned.
Than you have to execute the code at specified interval of your choice.
And if there is javascript in play than you have to execute the javascript running behind the page using your java code.
Try using Rhino from Mozilla and using its integration libraries or by using the JDK 1.6 ScriptEngine facility.
For ScriptEngine Example take a look here- http://metoojava.wordpress.com/2010/06/20/execute-javascript-from-java/
In, short take a look at html parsers to parse the content of your page.

Categories

Resources