Discussion Locked

PuneJava Blog

0 helpful
47 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
blog root

47 replies

by satish.talim

The enhanced for makes it easier to iterate over all the elements in an array or other kinds of collections. Look at this simple example:

public class EnFor{  public static void main(String[] args)  {    String[] cities =      {"Pune", "Mumbai", "Bangalore", "Hyderabad"};
    for (String name : cities)    {      System.out.println(name);    }  }}

If we analyse the for code, then the following happens:
(a) a String variable called name is created and set to null. The variable that you declare must be compatible with the elements in the array.
(b) Next, the first value in the cities array is assigned to name.
(c) The body of the loop is executed.
(d) The next value in the cities array is assigned to name. Remember, with each iteration, a different element in the array will be assigned to name.
(e) This is repeated as long as there are elements in the array.

Note: The : in the for, means "IN". Also, what follows the : must be a reference to an array or other collection.


Technorati Tags: Enhanced for loop in J2SE 5.0

























Blogs linking to this article

This post originally appeared on an external website

by satish.talim

Looking to earn some extra income, from the comfort of your home?
RentACoder
helps you earn this extra income using your hard-won Java technical skills. It lets you locate and bid on coding projects and questions from around the world! By completing a free registration, you can publicize your skills on the online resume system and receive emails as new bid requests come in.

After you register, I suggest you read the
Articles for Coders
to understand how things work at RentACoder.


Technorati Tags: Earn Money with Java from Home, RentACoder

























Blogs linking to this article

This post originally appeared on an external website

by satish.talim

If you are an ardent fan of the 'Head First' series of Java books, then you will find Kathy Sierra, Bert Bates and Eric Freeman's blog
Creating Passionate Users
a 'must read'. Do definitely read their blog entry
Sample Java Exam Questions
where you will find 11 mock exam questions from their upcoming update to their SCJP study guide (for the Java 5 version of the exam).


Technorati Tags: Head First Blog

























Blogs linking to this article

This post originally appeared on an external website

by dalicoder

I had read a couple of chapters of their books online (exerpts from their site) and LOVED them!  I have purchased three of their books (Java, Design Patterns, and Servlets/JSPs).  I'm reading them all at the same time!  Great stuff!  Thanks for pointing out their blog.

 

--Dave

by satish.talim

Do you hate to type Java code? Static imports helps you save some typing. If you are using a static class or a static variable, you can import them and save some typing. The simple example below, should clarify this concept:

import static java.lang.Math.*;import static java.lang.System.out;
public class MyMath5{  public static void main(String[] args)  {    // returns a double between 0.0 thro' (but not    // including) 1.0    double r1 = random();    int r2 = (int) (random() * 5);    out.println("r1 = " + r1);    out.println("r2 = " + r2);
    // Returns the absolute value of the argument    int x = abs(-240);    double d = abs(240.45);    out.println("x = " + x);    out.println("d = " + d);
    // Returns an int or long (depending on whether    // the argument is foat or double)    // rounded to the nearest integer value    int p = round(-24.8f);    long q = round(24.45);    out.println("p = " + p);    out.println("q = " + q);
    // Returns a value that is minimum of two values    int c = min(243, 240);    double dd = min(90876.5, 90876.49);    out.println("c = " + c);    out.println("dd = " + dd);
    // Returns a value that is maximum of two values    int e = max(243, 240);    double f = max(90876.5, 90876.49);    out.println("e = " + e);    out.println("f = " + f);  }}

Technorati Tags: Static imports in J2SE 5.0

























Blogs linking to this article

This post originally appeared on an external website

by satish.talim

Wondering what Boxing's got to do with Java? And I didn't mean Laila Ali, the first woman to win a World Boxing Council title, either! You wouldn't like to mess with her, would you?

So, what is Boxing in Java? Boxing refers to the automatic conversion from a primitive to its corresponding wrapper type: Boolean, Byte, Short, Character, Integer, Long, Float or Double. Since this happens

This post originally appeared on an external website

by satish.talim

If you have been waiting for an opportunity to learn J2EE in a structured way without shelling out a lot of money on books and classes, this might be just what you were looking for. Sun Microsystems employee Sang Shin in his spare time, offers this advanced J2EE class, for free.Technorati Tags: J2EE Programming (with Passion!) Online Course
Blogs linking to this article

This post originally appeared on an external website

by satish.talim

What Is Spring, Part 2 by Justin Gehtland, Bruce A. Tate -- In part one of this two-part excerpt from Spring: A Developer's Notebook, authors Bruce Tate and Justin Gehtland showed you how to automate a simple application and enable it for Spring. Today, the authors will cover how to use Spring to help you develop a simple, clean, web-based user interface.Technorati Tags: Spring, What is

This post originally appeared on an external website

by satish.talim

What's a Singleton? A commonly asked question. A Singleton is a class for which only one instance can exist within a program ie. only one single object of that particular class can be created in a program.

Write a class in a way which prevents a casual programmer from creating more than one instance. Have a constructor, but make it private so that no other classes may call it. Now that we have no

This post originally appeared on an external website

by satish.talim

India is doing great on all the frontiers today, whether it is business or sports. However, like any developing country, who is developing so to say, signs of the cost we are paying for this development are starting to appear. See article: India's poor tackle toxic e-waste on BBC.

We need to be careful and not repeat the mistakes that the west made on their way up.Technorati Tags: India's poor

This post originally appeared on an external website

by satish.talim

Technologies to Watch:A Look at Four That May Challenge Java's Development Dominance by Bruce A. Tate. The author has a knack for identifying successful technologies. He was one of the early developers who identified the emergence of the Spring framework; he predicted the demise of EJB 2 technologies a full year before the EJB 3 expert group abandoned the older approaches. In his new book, Beyond

This post originally appeared on an external website

by satish.talim

An Enterprise Archive File (EAR) is a convenient way to bundle up all the pieces of a full-fledged J2EE application. An EAR keeps everything organized.

An EAR can contain at least one of any of the following modules. You can safely omit any of them, if they aren't needed.Web module - A WAR file containing presentation tier componentsEJB module - An EJB JAR file containing the middle-tier

This post originally appeared on an external website

by satish.talim

When a user sends a request to your server, the user's browser uses the URL information to create a request message. Amongst other information, the request message contains an Accept-Language header that provides information to the server about the preferred languages. This helps the server to localize the application. We can use JSP Standard Tag Library (JSTL) to find the locale (represents a

This post originally appeared on an external website

by satish.talim

I am just back from the PuneJava Meet at the Maratha Hall, Hotel Sun and Sand, Pune (held on Sunday, 20th Nov. 2005) and it was a grand success. I shall put up the details and the downloads as soon as it's available to me from the speakers. A big thank you to Ashish Kulkarni, Harshad Oak and Girish Nadkarni.Technorati Tags: PuneJava Meet 2005
Blogs linking to this article

This post originally appeared on an external website

by satish.talim

Laszlo is an open source XML-native platform for building Rich Internet Applications. Laszlo applications are written in the XML-based language LZX (XML and Javascript). These applications run on all leading Web browsers on all leading desktop operating systems. Frameworks like Struts handle the flow of an application on the server, while technologies like Laszlo push that logic to the client.

This post originally appeared on an external website

by satish.talim

Tomcat 5.5.9 is the default servlet container included with JBoss 4.0.2. It is deployed as a SAR (Service Archive) in $JBOSS_HOME/server/default/deploy/jbossweb-tomcat55.sar.

Thanks to the modular design of JBoss, swapping out Tomcat for another servlet container is easy. Jetty is another option that is fast, mature and open source. Download a pre-build SAR, ready to drop in and run.

Hat Tip:

This post originally appeared on an external website

by satish.talim

If you've used Struts for a long time, you're probably used to sending static pages back to the client. AJAX offers a much richer browser experience, without requiring a complete refresh every time the user does something. Paul Browne shows how you can incrementally add AJAX functionality to an existing Struts application, without having to rewrite the server side to accommodate the changed client. Read the entire article on
java.net
.


Technorati Tags: Sprinkle Some AJAX Magic in Your Struts Web Application, Struts, AJAX, java.net


























Blogs linking to this article

This post originally appeared on an external website

by satish.talim

Kynesys Technologies Private Limited, Pune have arranged a training session covering "Eclipse and JSP 2.0" on 10th December 2005 (Saturday) at their office. This 2 hours session is FREE and starts at 10:30 am.

This session is only for Java Developers with 1 year experience. For freshers, they are arranging another session, very soon. Registration for this Free Session is available on their

This post originally appeared on an external website

by satish.talim

O'Reilly's new book "JBoss at Work: A Practical Guide" helps you learn to build a project using extensive code examples, and delve into all the major facets of J2EE application deployment on JBoss, including JSPs, Servlets, EJBs, JMS, JNDI, web services, JavaMail, JDBC, and Hibernate.

This book will help you:

- Implement a full J2EE application and deploy it on JBoss
- Discover how to use the

This post originally appeared on an external website

by satish.talim

Java, once considered the elite programming language, the answer to all the enterprise problems and all that. But here's a thought provoking article by Business Week which feels that Java maybe losing ground to others like the open source LAMP (Linux, Apache, MySQL, PHP) combo, Microsoft.NET, etc. What do you think ? technorati tags: java, lamp, linux, apache, mysql, php, business week,

This post originally appeared on an external website

by junk99

Java is still a great language for the experienced
developer. However, it does have a steep learning curve compared to many of the
other languages out there. Unless the IDE's make Java coding more VB like it
may continue to loose ground.

by jim.cotton

JAVA is an open standard with several large investments by industry experts Sun, IBM, HP. Thoses that are being lured into the .NET arena with MS are making a huge mistake. We've seen the consistent effort of MS to force 'proprietary' inroads into 'open standards' over and over. JAVA will continue to mature.

by macvelli

It's not clear what the big fuss about LAMP is since you can just as easily have Linux, Apache/Tomcat, MySQL, and Java as well.  PHP is great if you like scripting and what not, but a true enterprise application is either going to be .NET or Java.  If you pray to Bill Gates every day then .NET is the solution for you, otherwise there is no equal to Java.

by mjremijan

Java is a great technology.  I agree with the previous
post stating the learning curve is very high.  This is true, and it
doesn't get easier because then you start throwing other technologies in the
mix such as struts, tiles, hibernate, etc.  I believe this is a shame
because although you can go nuts and make an application extremely complicated
there is no reason to do so.  In general, I believe people working with
LAMP technologies have a let's-build-it attitude while Java developers have a
let's-build-it-right attitude.  The former (in my opinion) leads to
rapidly developed application which get the job done but not in the
"right" way, with "right" being things like design
patterns, code reuse, test-first development, etc.  Where as the
latter (again, in my opinion) leads to hugely complex systems because of trying
to do things "right".  For enterprise systems you need the power
and flexibility doing things "right" gives, but you shouldn't start
there.  Unfortunately, resources teaching Java technology tend to push you
there first.  I believe the Java world
would benefit from instead pushing the simpler let?s-build-it attitude.  Later, if you?re online recipe database
becomes world famous then you can worry about test-first Spring dependency
injection with an EJB business tier and hibernate persistence.

by Member 35274876

Java, C, C++, C#............Assembly....get the job done, thats it.
Interpreted and or scripted languages do their particular well thats
why we need them. You are seeing a moves towards LAMP on mobile devices
etc ( the Motorola E895 Linux based mobile see ).There are billions of devices out there,
using many different language variants, so 'learn just one at your
PERL'.

LAMP, Small Business Server ...etc are platforms that applications run
on. The language choices used to deliver applications should be
determind by
"what get the job done, on time within budget and is cost effective in
implementation and maintenance".

From me programmers need to have a full language toolbox, and that
means being familiar with as many languages as possible, used across
the many different platforms. Java isnt legacy and neither is Assembly
just look at that mobile in your hand, you will find it has an OS, and
Applications each programmed in different language that was fit for
purpose.

For me the JCP process means developers have some input into language
development and Java pays my bills and will do so for the next couple
of years. That doesnt mean that I ignore C#, C, C++ or Assembly my home
library is evidence of that. So as I said before 'learn just one language at
your
PERL'.

by rcrathore

Sun is paying price for ignoring the contemporary thinking such as Agile
Development, Extreme programming. It pushed for sub-standard
technologies which caused pain to developers (Entity Beans is an
example). It called dirty work-arounds as J2EE design patterns.
It forgot that Java is not greater than OOP and J2EE is not equal to
EJB. Instead of carrying forward the great language such as Java (which
was much ahead of C++ when it started), it played in hands of big
companies such as IBM, HP etc to make compromises on specifications. It
is learning from its mistakes but a lot of ground has been lost and I
think top position in programming language is vacant and it remains to
be seen what happens in next 1 or 2 years.

by the chad

Java is doomed because it has become a victim of its own
success. It is too hard for Newbs to get going in Java to the point
that they be productive on complicated, enterprise-class
systems. Not only do they have to learn the language, but they have to
learn the framework (Struts/Shale/Spring/etc), the DAL (Hibernate),
threading, unit testing, etc., before they are even productive.

IDEs help a little (if you're still writing getter/setter
classes by hand or living without auto code-completion, then grow
up and start using Eclipse), but they can't help the Newbs
understand the concepts that are essential for writing Java apps.

When an application is built and goes into maintenance mode,
this is where doing things "right" pays off. By adhering to the MVC
model, making changes to business logic or the presentation layer
is much easier than trying to wade through spaghetti code without
messing things up. LAMP projects are easy to roll out, but fall
down on the maintenance
for this very reason, which is why they are
not suitable for enterprise development.

Things like Ruby/Rails looks promising, because it combines the
ease of coding with the "right" way of doing things. Yes, it is
still possible to make a poorly-constructed application using
Ruby/Rails--which is why one hires talented developers instead of
Schlubs.

I picked up Java about 9 years ago, and to me it is like a
well-worn, comfortable shoe. It will be a hassle to give it up as
my primary development tool, but I see the writing on the wall:
Java won't go away, but as the majority of Newbs gain experience,
it won't be in Java, so the emphasis will shift to something else.
As the Pragmatic
Programmer
advised, "Learn at least one new language a year."
This is very good advice.

by gsaman

Although all the comments are right in my opinion, the fact that we are even discussing who is better in the programming language is a sign that not one of them can suit every need, each one has come to be because someone out there decided that the tools available lacked certain features, too complex, etc. In my opinion  Java and .Net are in the same category competing. Perl, PHP and others are competing in another category. And history has shown us that each language has evolved in it's own group, improving and borrowing ideas from others, ie .Net borrowed a lot of concepts from java, java borrowed from C++ and so on. In summary I think java has a bright future, so does .Net PHP, and others...

by gsaman

Although all the comments are right in my opinion, the fact that we are even discussing who is better in the programming language is a sign that not one of them can suit every need, each one has come to be because someone out there decided that the tools available lacked certain features, too complex, etc. In my opinion  Java and .Net are in the same category competing. Perl, PHP and others are competing in another category. And history has shown us that each language has evolved in it's own group, improving and borrowing ideas from others, ie .Net borrowed a lot of concepts from java, java borrowed from C++ and so on. In summary I think java has a bright future, so does .Net PHP, and others...

by lajuan

Although, the learning curve can be steep with JAVA there are just too many holistic systems out there to even consider branding JAVA as legacy software.

For example, in our Enterprise environment we use a middle-ware product to create JAVA wrapper classes to expose properties of 4GL Natural Programs that run on a Z/OS based mainframe. (64 bit processing) We then access our mainframe data residing in ADABAS via an Intranet web front end. The web front-end portion is scripted in Java Server Pages (JSP) and uses the JAVA wrapper classes to communicate with a middle-ware broker running on our mainframe. I also forgot to mention that data received back from our mainframe is written to our web server as XML using a JAVA routine.

I think many technologies suffer from lack of proper marketing and listening to the valued consumer. Just look at the similarities in syntax between C# and JAVA? Now ask yourself this. Which company provides free technical training on their products and even gives away gifts?

So the answer is yes, JAVA is legacy software when it comes to understanding the customer and giving them what they perceive as a necessity. The good part is that the tech industry is volatile and competition drives product lines. So it?s a coin toss at whose product is better one day or another?

by patrick

want the power of Java without the complexity ? Consider Adobe/Macromedia ColdFusion! Its a scripting language at it simplest like LAMP, but can form the the presentation layer of a J2EE app if you need to do it 'right'.

It can talk to .NET via COM and it it runs on top of java so you have all the power of java, with the simplicity of a scripting language and powerfull integration with flash.

dont get me wrong, there are times when EJB's and a full model 2 app makes sense, but then there are times when its just overkill. i feel cold fusion gives u the best of both worlds.

by lajuan

Although, the learning curve can be steep with JAVA there are just too many holistic systems out there to even consider branding JAVA as legacy software.

For example, in our Enterprise environment we use a middle-ware product to create JAVA wrapper classes to expose properties of 4GL Natural Programs that run on a Z/OS based mainframe. (64 bit processing) We then access our mainframe data residing in ADABAS via an Intranet web front end. The web front-end portion is scripted in Java Server Pages (JSP) and uses the JAVA wrapper classes to communicate with a middle-ware broker running on our mainframe. I also forgot to mention that data received back from our mainframe is written to our web server as XML using a JAVA routine.

I think many technologies suffer from lack of proper marketing and listening to the valued consumer. Just look at the similarities in syntax between C# and JAVA? Now ask yourself this. Which company provides free technical training on their products and even gives away gifts?

So the answer is yes, JAVA is legacy software when it comes to understanding the customer and giving them what they perceive as a necessity. The good part is that the tech industry is volatile and competition drives product lines. So it?s a coin toss at whose product is better one day or another?

by brian.kiser

I was a Java developer for about a year before I was a .NET developer.  When you're immersed in a technology and everyone you're working with in a technology, it feels like that technology is the center of the IT world.  It was the same then with Java as it is for me now with .NET.

Saying either technology is doomed seems foolhardy.  Both technologies are strong right now, and any prediction at this point is pure conjecture.  It's true one of both of these technologies may die at some point, but when?  With the strong showing both technologies are making right now, I would not be surprised to see both of them alive in 10 or 20 years.  One of both of them may even become the COBOL or C++ of the new era of software tools, outlasting all others and outliving their expect lifespan.

With that said, I'd like to state my personal preference and say that I love .NET.  In the last month, I've written my first web application, a small application in VS2005, and began work on my first mobile application.  When a tool has a "steep learning curve" like Java, while another tool gives you the same capabilities (on the Windows platform) then the easier tool is the one I will use.  When working in Java, there were lots of minor quirks that drove me crazy (albeit mostly with the WSAD and JDeveloper IDEs).  I don't have those minor annoyances anymore in .NET.  IMO, .NET is really a superior tool.

My prediction is that both are going to be around for many years, and that's good.  I wouldn't want to live in a world where there was only one software company to choose from.

by malcolm davis

Java Hard?

When I started using Java, I had been doing C/C++ from the commercial software
business.  Difficult of a language or
technology is relative to where you start. 
What people are comparing Java to is what is referred to as scripting
languages.  :-)

PHP is great. 
However, it is not meant for everything. 

by kahnt

I'm not the programmer I used to be when developing interpreters and
compilers at Watcom over 20 years ago - my exposure is more in the
rolling out of solutions. I have worked with LAMP - easy to implement
because the people doing the implementation know it. My stuff tends to
still be the ancient tools - shell scripts, C, C++, Fortran, Pascal and
when I want to ensure some portability, Java. If I had a compiler for
it available, I'd possibly even resort to Cobol for certain tasks. That
said, that is for stuff that I want to use, and don't want to have to
do by hand - not business critical. Not like the days when the
University of Waterloo used Fortran (WatFor) to write a precursor to
their C compiler.

That said, I still find that when things need to be secure from the
user's desktop to the client's server, and more responsive than just a
form, Java is what gets used. The only .NET I've encountered in any
solution outside Microsoft is actually the Beagle search system on
Linux, written that way because it is from the Ximian group of Novell,
who developed Mono, the Linux implementation of .NET. Java is what
seems to be used to reach beyond the limitations of scripting and
browser when desktop applications, or worse yet, Citrix distribution of
applications (lets bog down the central box with multiple instances of
a large and often not that efficiently written application, and the
network with sending the visual interface to dozens of desks.)

My experience is primarily driven currently by in-house applications -
putting things out over the Internet to consumers or business clients
raises different priorities - quick loading and quick response rather
than an application kept active for hours at a time. If your only tool
is a hammer, every problem looks like a nail - to lose access to tools
that best handle the task relative to the most popular current fad is
to lose out on efficiency, power and effectiveness - otherwise Java
would have replaced all of the Cobol code coming up to Y2K.

by satish.talim

PuneRuby in association with Reevik Technologies Pvt. Ltd is pleased to announce the following 'free' workshop for its members.

Venue:
Symbiosis Institute of Computer Studies and Research, 7th Floor, Atur
Centre, Gokhale Cross Road, Model Colony, Pune-411016

Date: Sunday, 26th March 2006

Time: 1400 to 1800 hrs

Schedule:
(a) QuickRuby by Satish Talim
(b) Advanced Ruby and Welcome to Rails playground by Dibya Prakash
This workshop is restricted to PuneRuby members, whose membership is free at http://groups.yahoo.com/group/puneruby/

(a) Developers - 20
(b) Corporate - 5
(c) Students - 5
(d) Reserved seats - 5

Registration is on a first-come-first-serve basis. Kindly send the following information to satish.talim@gmail.com
(a) Name and Postal address
(b) Email id
(c) Contact number
(d) Whether a Student / Developer / Corporate
(e) Company name and designation
(f) Years of software experience
(g) What's your interest in Ruby and Rails?

Selected members will have to pay a nominal fee of Rs 50-00 towards snacks etc.
Decision of the organizers is final and binding.

by satish.talim

Two interviews in a series of interviews I plan to take of the Ruby Gurus -

Bruce Tate:
Java is no longer the answer to every software development problem. Ruby
is exploding onto the scene, just as Java did at the end of 1990s.
Developers are driving the revolution, and the amazing productivity of Ruby on Rails is fueling it. So who better to talk about Ruby and Rails than the strongest proponent of Ruby, Bruce Tate.

Peat Bakke:
There is a lot to learn from experienced Ruby developers and in our continuing series of talking to such Ruby enthusiasts from around the world, Satish Talim today talks to Peat Bakke.

Phil Tomson:
Another Ruby guru interviewed.

More to follow.

This discussion is closed to new replies.