Run Apache Sling's samples - java

I want to run simple-demo from samples but I don't have success. What is its URL and how to reach its content?
The internationalization of usermanager-ui also doesn't work, although I installed the org.apache.sling.i18n bundle. If someone can give me a guidance I will be very happy.
In general why everything is so poor explained? The motto of Sling is "Bringing Back the Fun!", but in the last few days I didn't have so much fun! It's really painful to try to test or make something. Is there any good tutorial or book about this framework?
P.S. If I run all samples without any problems, I would create a detailed tutorial.

My personal opinion is that simple-demo is not a very current sample, I'd rather recommend hat you look at the slingbucks or espblog samples, as mentioned at http://sling.apache.org/documentation/getting-started/discover-sling-in-15-minutes.html
We might need to cleanup the Sling samples at some point, and concentrate on a few representative ones - I've put that on my way-too-long-list-of-things-to-do.

Just go through the readme.txt of the respective samples.

Related

Java Swing for Web Development by converting to Javascript

Good day!
With regards to my previous question about Java Swing being used for web development, I have a job interview today and they told me that their company uses Swing then convert it to javascript then deploy it on the web.
Can anyone explain this to me better? What books / websites should I study so that I could understand how this is done. Is this a good / common practice?
Thank you very much.
You can take a look at CreamTec's AjaxSwing. I've played around with it several times and it's the only product I know so far that takes your existing Swing GUI and converts it into something displayable in your browser.
Whether this is good practice or not is not really easy to answer. This solution works well as long as your application does not need to scale largely. CreamTec states that their solution is suited for about 50 clients IIRC.
The markup generated by AjaxSwing can in no way be called semantic but that is a common thing with these kinds of generators.
You can try AjaxSwing pretty easily since it does not require you to do much configuration but my recommendation is to use a dedicated web framework if you want higher scalability.
It sounds like GWT also. Granted that is not what the person said, but if it was a recruiter, they may been confused on the exact technology.
AjaxSwing is a run-time tool and needs a server license for commercial use.
You might want to try Mia Transformer www.mia-software.com. They change Swing Java code to GWT Java Code and GWT changes it to Javascript and then if you want you can use Google V8 compiler for faster execution. Of course it is not 100%. We are going to try it for a large project and see if it works.
The other link provided to us was http://swingweb.sourceforge.net/swingweb/. Have not checked it out though.
Will keep you posted. If you come across a workable solution please share.

Suggestion with best customizable crawlers and scrapers

I have a website which is pretty good but with very less information.
So i felt like adding informtion like news regarding particular sector(for eg politics, hollywood etc). I believe crawlers are best approach to do so? Is my understanding correct, please suggest if you feel any other way to get information without using crawlers from various sources.
Secondly I am doing research from last 2 days and I cannot find a particular source which is capable of doing so. Now I want crawlers to find information, normalize and store in mysql database. Sounds pretty simple ha. But It isnt for me.
As this is very resource and time consuming . what all things should i take into consideration before choosing a crawler. Also I wish to customize it so any tool which is open source and good to be customized will be great.
Any source giving information and research about factors need to take into consideration while creating crawlers or educating about crawlers will be great.
I prefer coding in java but i can code in any other language in case you feel that you have some language.
I hope i have given enough information. Please dont hesitate if you need any more information to give suggestion.
You can use httrack to copy a target website. There is one firefox plugin as well named spiderzilla. But, they will just save the pages.
If you want to parse the data in the pages, then you can use simple_html_dom and store the information in mySQL.
Try the GNU Wget tool. You can add a lot of intelligence to the way it crawls and creates data dumps of web pages. It is open-source and customisable as well, and very fast too.

Understanding large Java Code Base

Are there resources on going about trying to understand a large java code base. Like for example, a graph persistence implementation. If there is minimal / missing documentation, what kinds of approaches do you take ? Are there any books that deal with this ? I know one called Brownfield App Development in .NET.
Perhaps something similar ?
There are number of ways to tackle such a problem and most of the times it will be your personal preference and style of coding and solving problems... for ex:
Start with any documentation/TDD if available.
Use some design/UML tool like EA Architect to generate the UML/Class diagram to understand the class structure.
If the project has some test cases, start by executing and understanding the code behind it.
Try running the application and you can set some debug points and try understanding the flow.
End of the day it all depends on the project, how well the code is documented and your personal style of solving problems.
My suggestions would be:
Get the code building. If there is no build script, write one.
Get the code running.
If there are no tests, start picking off bits of the system to write tests for. You're not really testing, you're learning about the system's behaviour.
Use a modern IDE (Eclipse, Netbeans, etc.) to start tracing the declarations and references to methods and classes.
Good luck!
Ian.
It all depends on how the project is organized. Some ideas off the top of my head:
Look for the core / domain knowledge:
See if domain knowledge is isolated and start from understanding it.
See how the code is split into projects, modules (e.g. jars) and packages. If there is at least some organization, look for the "core" and start learning from there.
Look for other traces of this knowledge: diagrams, tests, documents, samples.
Try running the application. Analyze what happens from the entry points down.
Learn the basic architecture. Look for the familiar ground (frameworks and solutions you know) and see how it is used.
If you want to trace the execution of your Java code to get a feel for the flow of control you can use a tool called InTrace.
NOTE: InTrace is a free and open source tool which I have written.

Best approach to creating a database driven Java website?

I'm fairly new to programming and new to java, but I'd like to jump in the deep end with a little database driven website project. I've read quite a lot about requirements in the 'real world' requesting experience with Spring and Hibernate, so I have those installed on netbeans and a project created (if I hit run I get the default spring page). Now I just need a little guidance as to where to start designing my app (please tell me if I'm getting in a bit too over my head for a beginner!).
Should I start off with my classes? - create all my classes as they map to my database tables and decide which attributes and methods each will require?
Can anyone suggest any good books for maybe.. making a java based website from scratch (i.e. from design right through to deployment) that might be useful for a beginner?
Any help appreciated thanks.
Edit: since posting this I've found a brilliant book that fits my needs just right to get started. Firstly I tried both spring in action and hibernate in action - but found both to be a bit too heavy for my novice mind. Instead I got the Java EE 5 Development with Netbeans 6 book https://www.packtpub.com/java-ee5-development-with-netbeans-6/book and its been a great help. If you use netbeans and are in a similar position to me, I'd say pick it up!
Too over your head? Depends on what you hope to accomplish. Are you trying to create a revenue-generating site to which users will be asked to trust credit card numbers and other sensitive information? Then yeah, you're getting way ahead of yourself. Is this a tool for personal use or a toy you're throwing together primarily as a learning experience? Then I say "Pffffft!" to the notion of over-the-head-ness. Go for it.
As to where to start, I say start with whatever portion of this beast is clearest to you. Have a solid idea of what the database is going to look like? Then start with it and its supporting classes. Have a clear vision of what the guts of the code are supposed to do? Start there. Etc. And if all things are equal, I'd say start at the bottom with the database layer and work your way up -- but that's just me.
And as for the books, can't help you there, but I'm sure somebody can.
I suggest to take a look at web application frameworks such as Spring's Roo or Grails. Sadly I have no experience with Roo. But I do have some experience with Grails.
With Grails you will be working mostly with Groovy, a language similar to Python, but still using the JVM. You'll still have the option to use Java anywhere you like (I think). Grails (and maybe Roo too?) manages Spring and Hibernate for you.
As for books on Grails, I recommend "Grails in Action". I have read a little of "Grails 1.1 Web Application Development" and it also seems to be a good reference. BTW, netbeans supports Grails too.
Not trying to gut your goals, but if you are wondering whether to start with your classes, I would suggest you work on your programming skills more.
I'd suggest taking a look at Larman's "Applying UML & Patterns: An Introduction to Object-Oriented Analysis and Design and Iterative Development (3rd Edition)" as well as a book on relational database theory (you need to know how to model databases properly.)
You can try your hand at building a database driven web app, and it might give you an insight into how to do it, but you need have some programming maturity to take those skills into the non-trivial.
This is a completely personal opinion so please take it with a grain of salt: Before someone tackles the building of a data-driven application with the purpose of eventually being able to use it in non-trivial projects, that person needs to have a good exposure to programming (by good I mean a LOT, say 1-2 introductory courses, 1-2 intermediate and at least one junior-level course, perhaps a total of 15-30 credits.) Unless that person is a natural programming virtuoso, I don't see it happening otherwise.
I would suggest, if you are serious about programming, to spend a substantial amount on learning the fundamentals before tackling something like this.
Good luck.

Java integration with Microsoft Help

I'm writing a GUI with Swing and I'm trying to integrate a microsoft chm help file. The problem is, I don't even know where to start. Can anyone recommend a library/tutorial as a starting point for a project like this? Specifically, I'd like to know about how to open/view specific pages or inidices (I don't even know exactly what the terminology for .chm files is) from java.
Thanks!
I actually decided to go in a different direction for this project in particular (one that doesn't involve a MS help file), but here's a couple of helpful links I found in case anyone else runs into this issue:
Wikipedia article on MS help format
jchm: a java library for using chm files. I didn't investigate it too thoroughly, but it's a starting point.

Categories