It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I currently run a website on LAMP, I am currently in the process of refactoring my code from normal php to Zend framework with Doctrine. I am happy with setup but often find function not found errors on live site cause I have renamed function. Which is frustrating as most of time is wasted is patching these errors.
So I have decided to switch from php to java as the code gets compiled, so just error will not go to live site. With java netbeans will work better.
But as I have not been in touch to j2ee for many years. What is the best replacement for my above setup in java?
Option 1. Jsf 2 with Hibernate
Option 2. Seam
Option 3. Spring
Option 4. Struts with Hibernate
My server has 24 gig ram and 2 core i7 processor and ssd drive on raid 0
Will my server handle the same amount of visitors if java was used without any performance issues?
I like the way I can update my site without losing live sessions(logged-in users). Can I do the same in Java? from my experience each update to site will redeploy the App which resets all the Active Sessions.
I love to consider .Net but from what I have read on most forums, no one recommends it?
Kind regards
Zerone
You problem is not switching to Java from PHP your problem is an good test coverage via unit and in particular with integration tests. From what you wrote the best thing might be to take a look at Selenium and to automate testing as most as possible. You need a complete infrastructure to deploy to a test system and run integration tests on it (Selenium) and after that you can say everything is ok.
Java will perform better, but switching to Java seems like overkill for this situation. That said, I would recommend something based on Spring and Hibernate. Spring can be a real godsend for configuring just about anything in Java and Hibernate is similar to Doctrine.
Apache Tapestry would make a good presentation toolkit for your site. It's a great templating library that is cleaner than JSP.
Java has a large variety of solutions to the same problem. Currently, the mainline Java solution to presenting items on the web is Java Server Faces.
Older (which doesn't always mean worse) solutions include Struts, Apache Tapestry, (parts of) Spring, etc. These solutions benefit from maturity, having an established following, etc. Basically they are good solutions because people already know the points where they fail, and already know how to work around them. The new solutions attempt to remove these pain points, and thus suffer from new pain points. Think of it as not noticing your headache until after you fix your broken arm.
Java will perform much better because the code that delivers the web pages is already in memory, so it avoids a number of items that take time (process spawning, disk access, webserver to language engine communications, etc). There are other PHP solutions which also attempt to solve similar problems using similar techniques; however, PHP has a different coding background and style. For example, Java doesn't need to discard any state between web page requests, something that PHP does (and often uses a number of libraries and workarounds to mitigate).
My recommendation is to use Java, but realize that a direct port will incur a lot of unnecessary expense. Choose a web facing toolkit (JavaServerFaces is the newest and part of the Java EE standard), and start off by porting the static portions of the HTML web pages. Organize your requests by scope (how long the side effect of the request should persist), and use the Servlet standard to store the artifacts generated by the request in the appropriate application, session, request, etc scope.
On the database side of things, there are many standards and solutions to pick from too. Personally, as you don't have a lot of legacy concerns, I would go with JPA. While it is not really a 100% complete solution, it will push you to use an interface which can be replaced by better implementations over time, without the need to recode your application. By stating it isn't 100% complete, I mean that you need to select a JPA provider as the default provider probably won't meet your real-world production needs. That said, the default provider should sustain development oriented work, and JPA's standards should protect you from unexpected differences when you run the code against different environments.
Whether you wish to fully restructure you code into a Java EE multi-tier architecture, of if you just want to embed a large Servlet (server faces is a type of servlet solution) that does everything is more of a function of how much you wish to architect your code. It is not a porting problem. That said, the biggest benefits of a typical Java solution over a typical PHP solution is that the Java architecture is designed to work faster and provide more features out-of-the-box. If you intend to do a port with no rearchitecting, you might be better off just finding out the bottlenecks in the PHP code and fixing them.
if you dont use ajax, i prefer 4 (struts + hibernate):
jsf needs an little bit of expiriences on such heavy load (getter-methods must be fast and so on).
if you use ajax, i prefer an combination of 3 and 1
regards
peter
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I'm starting a new web based enterprise application, and I'm thinking of using Wavemaker.
I'm a fairly experienced java-ee developer, but it seems to me that even in this case, WaveMaker still makes sense to develop the application fast and focus on the business logic.
My questions are :
1- Are their any drawbacks to this platform
2- Can I do all the normal things from the server side easily (like sending mail,building birt reports, adding jobs)
3- Can I freely manipulate javascript (for example for specific animations, using plugins....)
4- Can I integrate realtime processes, like websockets ?
Thank you
I've used Wavemaker in an Enterprise application with success. We used quite advanced features such as heavy use of backend logic based on JavaServices, an run-time SQL database selector made inhouse, JS plugins for the frontend, obfuscation etc
We later recruited a devteam to take support of this application and, although the community is small, the team learn quickly and was able to maintain the code base.
As I see it, Wavemaker is a excellent tool if you like to:
deploy a web-based CMS for your midsized SQL database
deploy a smaller web control page for your java back end system
To answer you questions:
1) Small community: Although the community is friendly and on their toes, it is too small to ensure the type of feeback you might be used to. You will have to spend quite some time banging your head to the wall when you try to go beyond the example applications.
2) Yes, you have all the freedom you would expect from a Java backend. Simply said; each REST api is assigned to a Java Method, its up to you to implement the logic. I have built wavemaker on SQL, mongoDB. With email interactions, data parsing, file upload/download etc You name it
3) Yes, you can add JS plugins and customize the scripts generated by Wavemaker. You might want to make sure that you don't edit the auto generated JS, since they will be overwritten. but as soon as you found the right entry point you are free to customize just the way you like it.
4) Yes, since you build you own back end in java you are free to open up any type of communication you like to have. And since you are able to customize the front end js you will be able to read this data. But as I said in question 1 - there will only be a small community helping you
So to sum it up:
I vote for Wavemaker, but make sure to only deploy it if you application will be similar to the templates/demo provided, if you build a unique system you might like to look into other solutions.
All choices have drawbacks. There is not a lot of WM expertise to be had. You'll need to deal with some issues in terms of the library at hand, dojo, spring etc instead.
you can,but it requires some java knowledge. You are operating in a spring MVC you can
you can, you are operating in a dojo client there
possible, probably. worth the effort, doubt it.
1- Drawbacks- It's enterprise focused platform, so will require own effort to learn it.
2- Yeah, you can do pretty much all normal things (at least from my experience, till now)
3- The tool has kind of open-source configuration so its easy to manipulate or customize your codes if needed
4- From my experience, WaveMaker has one of the best and most diverse integration options available.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I asked this the other day but it was closed, probably because I have a tendency to ramble so I'll get straight to the question.
I've written programs before so I'm not looking for an introduction to programming.
I was wondering if anyone had a good site/article/book that they think would be a good introduction to designing a server application.
The server will be a linux based amazon ec2 server with apache. I would prefer to use python, I know Java as well though if you think that would be a better programming language for server technology. It will be accessed over the internet via a web browser.
Again, does anyone know of a good site/article/book that they think would be a good introduction to designing a server application?
**Edit
The end application will be for use with a web browser to access via ajax to return information from a database/maintain a database and add/delete files from the server. Right now though I'm just looking to write a simple app that will take an ajax call, do something simple with it, and return the manipulated data.
**Edit
For starters I would like to just integrate with a static HTML page that uses javascript to ajax and update the HTML. Later I'll move onto creating the pages dynamically based on database information and templates with ajax calls to have the server update a database when I get more comfortable.
**Final Edit
Ok, for all the people who voted to close this. Where in your mind is "where is a good place to start learning to write a server application" not a straightforward or vague question? Seriously it isn't vague or unanswerable. The only way it would be overly broad is if you assume that when I ask about learning how to write a server application you are assuming that I already have a working knowledge of how server applications work and just left out what should be assumed to your elite hacker mind as given. To summarize, you had to learn about server application theory somewhere. All I'm asking is where (outside of school) and how can I learn the same thing.
Outside of those guys thank you all for providing the information I was looking for. It changed my thinking about how applications run on servers and gave me some insights.
I think you should clarify exactly what you want to build first. Java and Python both have their own strengths and weaknesses for development and execution - they also have a multitude of libraries and frameworks that you can use. For example, in Python you could build web applications off of Tornado, Twisted, Pyramid, Django, and countless others. Java has numerous
Apache has been on a general decline from having a place in webapp stacks. It's a great general web server, but it's totally unneeded with the technologies you're mentioning. If you're deploying Java, you can use Tomcat and Jetty. If you're deploying Python, you can use something small like nginx to proxy http to the python app or use the uwsgi protocol. Most people I know have something like nginx or varnish on port 80, and just proxy everything back to python/java/php/apache/etc.
Once you explain exactly what you want to learn how to build , you'll likely have better answsers.
What are you looking for exactly. What will contains your server and what will the main application ? just web ? webservices ? cron ?
you could look at google app engine
These days site like Udacity Coursera etc are getting popular and are doing wonderful job. I am particularly attending a course CS253. http://www.udacity.com/view#Course/cs253/CourseRev/apr2012/Unit/20006/Nugget/51001
I think thats the best resource.
If you already know Java, look toward a Servlet application. It is a rather easy way to get introduced to HTTP servers, and Tomcat does enough of the heavy lifting to allow you to focus on the actual handling of requests in a manner that isn't heavily concerned with socket handling, protocol deciphering, etc.
If the low level server details are what you are after, Java is still a good choice, just look at a client / server socket tutorial, and start adding features / code structure.
Good luck, and have fun
in fact you wanna know how servers work. have you ever tried to google "how a server works" ?
After requests and responses theory, you have to learn differents kind of server (web, ftp, smtp etc.)
Finally, python provides networks modules
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I'm currently developing a programming contest website, and want to implement support for submitting code and running it on the website. After quite a bit of googling, I still haven't found any "guides" for this.
Does anyone know of a website(or other sources) that contains some basic guidelines or ground rules for this?
Appreciate all replies.
PS: If anyone wonders about all the programming language tags, I'm planning on supporting at least these languages.
Careful -- if you're finding it difficult to break this project down into some smaller, more tactical problems, I'd strongly suggest that you make no attempt whatsoever to actually run anyone else's code on your site. In terms of creating the site itself, I'd suggest leveraging pre-built components or services where possible -- Wordpress, GitHub, etc.
Once you've got the submissions, you'll want to have a way to run them safely. For all practical purposes, this means that you should assume that any machine you run someone else's code on might spontaneously burst into flames. While it's true that some of these languages have features you should be able to use to run code in a "sandbox", you're probably not going to be expert enough in all these languages to be able to properly secure all of them.
It seems that something like Amazon's EC2 might be helpful -- spin up a VM when you need to run a submission, and throw it away when you're done. They've got some pre-configured images that would probably be well-suited to running this code, and if something gets buggered up because of buggy or malicious code, you don't mind too much because you're just going to throw it away when you're done.
There is a site that already does this, albeit for a particular purpose: scraping data.
https://scraperwiki.com/ - Unlike jsfiddle, scraperwiki executes server-side code. As far as I can gather, they likely sandbox the environment via amazon instances. Not sure that their code can be entirely audited and sanitized, given the variety of languages and scraping libraries they support.
I think most people are baffled as to how scraperwiki keeps hackers and spammers at bay from misusing their resources. They've been rather mum about it; either they've manually audited every bit of executed code, or hackers/spammers haven't caught onto them yet. Since the site has a specific function, they probably check data utilization to determine suspicious activity. ...but, one man's site scraping is another man's harassment and injection by get/post.
My hunch is that they'll never publicly spell out what their security audit process is like.
If you really had to do it, simplest mechanical way of doing this without virtualization is to use a variant of eval(). But, not all languages have that. Which brings you to option B, which is virtualization. Better people than I can explain how to regiment virtual machines to this effect, and will caution you properly on letting strangers abuse your resources. Instead, I'll share my PHP experience.
Some years back I've made a project that does code execution on the fly (on a local machine.) As you type, it takes the code via ajax and executes after each keystroke. Here's a video of its behavior: http://www.youtube.com/watch?v=Yfxrt2pc3pg.
Half a decade and 3 improvement prototypes later, I'm still not sure how I would responsibly lock this down as a common resource.
For Java it is quite simply:
You're have to create Servlet, for uploading source code into server (for
example, via POST request)
Use Java Compiler API to compile source code to bytecode ( tutorial )
Compiled bytecode you're might dynamically load via ClassLoader and launch it (also you're might configure SecurityManager)
And don't forget about MVC architecture :)
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm planning on writing a simple web application that will be used by lots of users (as complicated as a simple bookmarking app) and I'm trying to decide which framework/language to use.
I'm very experienced with Spring/Hibernate and Java in general but new to both Grails and RoR (and Spring ROO).
The only reason I'm considering RoR is because Java hosting is MUCH more expensive than RoR hosting (which is supported by almost any hosting vendor for 5$ per month).
Assuming the price wasn't an issue, which one of the frameworks/languages mentioned above would you recommend for a Java developer (who knows how to configure Spring/Hibernate etc.)?
I'm afraid that by using RoR I won't be able to easily support many users who are using the website at the same time.
thanks
First you can have a look to these related questions :
Rails or Grails?
Learning Ruby on Rails any good for Grails?
https://stackoverflow.com/questions/1283935/what-technology-asp-php-joomla-rails-grails-for-a-website-from-scratch
Is Grails worth it?
Is Grails (now) worth it?
Now, I will try to answer you according to your requirements you have communicated and the information I have gathered from the internet and my own experience.
Ruby on Rails
I do not advice you to start with RoR because you are a Java developer and you will have to learn a new language (Ruby) and a new environment (Rails). The hosting issue is not a real issue. You can have a VPS hosting plan for $10 (www.enjoyvps.com) perfectly suited for small grails app. If you application needs more memory, you might need to add another 10 Bucks.
If you hosting is really THE critical factor, go with Python/Django or PHP/Kohanna (a very good MVC framework). Otherwise, according to your background, Grails is more suited for you than Rails.
Grails
Few months ago, I had the same dilemma as yours and I decided to have my way with Grails. Why?
Because it's cool !! I mean, community is very helpful and dynamic, Groovy is a pleasure to develop with (be careful : thereafter , there are good chances that you will loath Java). Also, it is a state-of-the-art framework based on very-well established technologies (Hibernate, Spring, Java) and hence, it can improve considerably your market value as a developer. Grails is my favorite
Spring Roo
Roo is Grails for Java. So if you don't want to learn Groovy and if you need pure Java application (that will always run faster than a Groovy-based app), go with it. The community is smaller than Grails but the project is supported by SpringSource who is quite active in the community. I think that if you want to go as fast as possible, this is the solution for you.
Spring Application
You should choose this option only if you don't like Spring Roo integrated technologies (Hibernate, JSP, Maven...) and you want Java absolutely. Otherwise, there is no interest (except for educational purposes) of spending hours of configuration and tuning when you can build sophisticated enterprise applications in a best-practice manner within minutes (with Rails, Roo or Grails).
Each of the options above will provide you enough performance for the application you want to build. A lot depends on best practices for website applications like good architecture design, correct usage of caching strategies and requests optimization...
My Bottom Line
If you have some time to spend for learning new concepts (Groovy, RAD...), go with Grails. If not, go with Roo. Forget about Spring App and Rails.
If hosting is THE issue, so go with Python/Django. You can deploy on GAE, it's free scalable, performant and you will deal with the same concepts as Rails or Grails.
I don't understand the obsession with runtime performance. Given your scenario your primary focus should be on your performance, as in your ability to get things done with the chosen technology.
You will get more done in a given period of time with Groovy than with Java any day. Often one line of Groovy code will equate to 10 lines of Java code etc etc
Very rarely will byte code execution time be your performance issue, most often its...
Bad algorithm implementation or design.
Bad DB design and / or queries
Taking to long to get things done and then having all sorts of commercial relationship issues because of it.
With web applications you are usually not performing lots of long running CPU bound operations. Most of your request / response time is spent in the wire (internet routing etc) and in the DB (executing queries).
Choose a technology that takes a load off your mind and one that frees you from writing mountains of boiler plate code, so that you can rather concentrate on designing and implementing good algorithms, DB's and queries etc etc
Id personally choose Grails.
I chose Roo over Grails and Rails at my company. Runtime performance, easy debugging, nice Eclipse integration (it's plain old Java after all), no "black magic" happening at runtime. In fact, there is no Roo runtime library needed to run a Roo app, just the library dependencies like Hibernate and AspectJ. You can look at the code that is generated so you know exactly what is going on. Also a biggie for me is that Google has chosen Roo as the preferred tool for creating GWT apps going forward and they are throwing their support behind it. I have been extremely impressed with Roo thus far, I think it will be the tool of choice in the near future.
Performance issues with RoR are going to be caused more by the $5 hosting plan than by the choice of language and framework. Consider Heroku for your hosting, as you can start cheap / free, and then scale up as needed.
For a simple bookmark app, however, Rails is probably overkill. Take a look at the Sinatra framework as well, as you weigh your options.
Have you looked at Gaelyk? http://gaelyk.appspot.com/
It's a lightweight Groovy framework for Google App Engine
I know this post is a bit old. It's 2012 now and Spring Roo just released version 1.2.2 3 months back.
I'm a Java developer & has just started an ambitious project that will see me launching a web application for wide adoption. I'm going through Spring Roo & is getting my hands dirty. My first impressions are nice, but when I read over the Internet about it being a good framework for fast prototyping and only for developing CRUD operations etc. I feel a bit demotivated to use it.
But I personally think that Spring Roo (SP) gets my project started with best practices already implemented with the choice of files created which I can use as template for custom use. Obviously, I'm not afraid to code. We will always have to code ourselves, I don't want any "magic".
I also tried to look around the RoR scene and is easily intimidated by the learning curve involved.
I don't see much traction in the Spring Roo community. Is there any specific reason for it?
Also are there any better alternatives? I'm a bit confused over my decision of finalizing a framework that is both robust and scalable in future. I don't want to be a position where Twitter is now where 2 years worth of RoR code makes them re-think their choice of RoR. Is Spring Roo the best bet for me?
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I come from a Java and PHP background to build web applications.
Has anyone used Lua before to build a web applications?
Question: If so, what are the pro's & con's of using Lua versus PHP or Java for a web application? (e.g. web server support, performance, code maintenance, etc).
As others mentioned Lua is "do it yourself" kind of environment. Also it is very fast and quite memory efficient compared to Perl/PHP/Python/Ruby especially if you are using LuaJIT. And it is very easy to integrate with C/C++ code. Usually these points are irrelevant for a typical web application where performance is usually restricted by database. Also where you don't really care about C/C++ integration and where you don't really want to do things yourself but rather you want to build on top of existing frameworks. For this reason I don't think Lua is a good fit for a typical web applications. At the same time there are some niche applications where Lua shines. For example our company specializes at building high performance HTTP servers used for adserving. So what we are using is our own HTTP server written from scratch in C++ which integrates Lua as a scripting language for our business logic. This allows us to do customization of the business logic in Lua quickly compared to what we had to do if it was pure C++. At the same time we always have an option to do performance critical parts in C++. If we were using any other scripting language we are positive it would be slower, it would use more memory and generally would be harder to integrate with C++ code. At the same time we don't really care much about loss of extensive library support were we using other scripting languages as the domain we are working in is quite specialized so usually those libraries are irrelevant for it anyway.
I am using Lua right now to build a web application! Whatever happened to software developers that "do it yourself" got a bad name - too lazy, weaned on bloated megabytes of support libraries, or what? In reality, as others have pointed out, there is decent support, just not on the scale of Python, say. Lua is by far the fastest scripting language (especially with www.luajit.org around), and much, much cleaner as a language design than any other in its league out there. This is vital for long-term maintenance.
For those using lighttpd as their webserver (me included), the added bonus is that the full power of Lua is available for mod_magnet scripts, useful for synchronous request handling/rewriting-on-steroids.
I have programmed a few websites with Lua. The first one was a raid planner for my World of Warcraft guild (that's often how you start programming in Lua...). I used mod_lua with an alpha version of Apache 2.4 for that. Two others were small contests sites for customers, developed with WSAPI, Nginx, Spawn-fcgi and Orbit. This setup is damn fast, faster than mod_lua and anything else I have seen. The pages would display instantly as if they were in cache ! The experience was very pleasant and Lua makes you quickly productive. But you better be well organized. Lua is missing a lot of batteries when it comes to web development, so you often have to implement your own and it can become messy. So I suggest you plan what you will need before you start. I used my own Lua "ORM" with MySQL and a forked version of Lua Pages for the templates. Have a look here if you want to give Lua+Wsapi+Nginx a try : http://mascarenhas.github.com/2009/10/24/wsapi-nginx-fcgi.html
I think it is the best setup.
There are quite a few projects using Lua for web development.
For example, Nanoki, an HTTP and wiki engine developed in pure Lua.
Or Sputnik, which is build on top of Kepler.
That said, Lua is very much a, hmmm, "do it yourself" kind of environment.
Pros: fast, small, elegant, easy to make your own binding to a C library.
Cons: sometimes you have to write your own libraries for things you would get for free in Python.
http://luanova.org/ has a number of good posts on web development in Lua.
We use lua with great success for our backend implementation. You can also have a look at JUCI webgui for embedded devices. It uses lua for backend implementation. You can have a look at how code interacts with lua/C backend: https://github.com/mkschreder/juci
Note however that this backend is a pure jsonrpc backend so it does not create any html like php or cgi pages. Lua is perfect if all you do is handle and respond to json requests. You can also have main application in php and use lua to write the application on the backend. Or main application completely in javascript.
I think that if you are going to use lua in places where you want to generate html then you will find it lacking many features, but if you limit it to purely functional backend implementation then you will find that it works very well.
lighttpd and mod_magnet are really great platform, but I recommend that you first take a look at Kepler Project. It's a quite great beginning.
You can take your PHP/Java background useful.