Thursday, 10 January 2013

Learn Basic Java in 10 Minutes


What is Java?

You can find tons of definition about Java on web; Answer is simple “Programming Language to develop any kind of application with Object Oriented approach and it can run anywhere”.

Sample application
For example, you need to develop an application to track your daily expenses on your PC. The application can be developed by Java by the following manner.

Minute 1 Session
First download and install Java Development Kit (JDK) from official Oracle site. The JDK is the software environment where you can compile and run your Java programs.  Download here.

Minute 2 Session
Know the commands to compile and run a Java program.  Before that you need to set the path to point your Java compiler on your development location. Assume that you have installed JDK on your C:\Program Files\Java\jdk1.7.0 drive. You need to run the following line of code in your command prompt before accessing Java compiler.
SET PATH = C:\Program Files\Java\jdk1.7.0\bin;
Open start menu and type cmd on your Windows machine to open command window.  Now open your folder where your Java programs are saved.

For example: D:/MyJava.
Cd  D:/MyJava
D:MyJava > SET PATH = C:\Program Files\Java\jdk1.7.0\bin;

Note that “jdk1.7.0\bin” folder contains Java compiler (javac) and Java interpreter (java) applications.
Now you are ready to run a sample Java program on your machine. Unlike like regular hello world application, we are going to run a practical program to track daily expenses.

Minute 3 Session
Just learn about simple Java program and know the basic steps to compile and run a program.
A Java class is a blueprint of an object. An object in an instance of a class.

Step1: Identify Java classes
Step2: Develop Java classes
Step3: Develop main class
Step4: Compile all classes
Step5: Run main class

Main class is a Java class which has interpreter calling method named main like below:

public void main(String args[]){ // main method to run a Java program
// Code to call other objects/classes
}

Minute 4 Session
In our case, we need to develop an application for daily expense tracking. The following classes may satisfy these requirements.
ExpenseTracker
ExpenseTrackerMain

Minute 5 Session
Develop ExpenseTracker Java class.

public class ExpenseTracker {

public void addExpense(String expenditure, double amount){
System.out.print(“Expenditure ”+ expenditure+”  “+amount+” added on ”+new java.util.Date());
}

}

Save this file as ExpenseTracker.java in your working folder.

Minute 6 Session
Develop ExpenseTrackerMain class to run this application.

public class ExpenseTrackerMain {

public static void main(String as[]){
ExpenseTracker tracker = new ExpenseTracker();
String expen = JOptionPane.showInputDialog(null, “Expenditure”);
String amount = JOptionPane.showInputDialog(null, “Amount”);
Double doubleAmount = Double.parseDouble(amount);
tracker.addExpense(expen, doubleAmount);
}

}

Minute 7 Session
Compile your application.  Just open your working directory where you saved these .java files and follow the below steps.
Open command prompt and go to your working directory.

Type SET PATH = C:\Program Files\Java\jdk1.7.0\bin; // recall Minute 2 session
Type javac *.java
This command will compile both ExpenseTracker and ExpenseTrackerMain Java files. This action will generate .class files inside your working directory.

Minute 8 Session
Run your application.
Open command prompt and go to your working directory.
Just type java ExpenseTrackerMain in your command window.

Minute 9 Session
Your first Java program is done.
What is next?
Just add some methods in ExpenseTracker Java file, call those methods in ExpenseTrackerMain class, compile and run again.

Minute 10 Session
Similar to Expense Tracker application develop Task Tracker application by using the following code snippet.

public void addTask(String task, Status status){
System.out.print(“Task ”+ task +”   added on ”+new java.util.Date()+”.  Status of this task is :”+status);
}

One of the best ways to develop your Java knowledge is by Oracle’s Java Certification program. There are numerous vendors available to teach Java in the world but there are few vendors are having good knowledge and latest updates.

Wednesday, 9 January 2013

5 Reasons to be excited about Java in 2013



With 2012 done and dusted, it’s time to look forward to the coming 12 months for the development world. Over the past few days, we’ve asked some respected developers for their predictions - now it’s time for our own.

Here’s five quick reasons why you ought to be excited about what 2013 holds...

1. Java 8

An obvious place to start but for most Java developers, it’s the release of 2013. Assuming there’s no further delays, we can expect Java 8 to arrive in September, bringing with it long awaited lambda functions.

It’s fairly likely in the immediate aftermath of Java 8’s welcome, we will see blogposts of equal measure either moaning at the complexity of the new features or saying the release isn’t big enough to warrant interest.

Either way, some much needed deferred features finally make an appearance and the rest of us will just knuckle down. The improved Date and Time API within Java 8 also deserves a mention here.

2. JVM languages go from strength to strength

2012 was really the year when JVM languages took centre stage. Front of the pack was multi-paradigm Scala, notching up impressive enterprise clients thanks to investment into Typesafe. Extending the possibilities with Akka and Play 2.0!, it looks like the foundations are in place to push further in 2013. The real challenge is selling Scala to those who don’t need something heavy duty.

The dynamic Groovy wasn’t far behind last year, adding static compilation into the mix with Groovy 2.0.  A third major version is expected not long after Java 8 to allow Groovy developers to get the most of the new features. The supporting cast, including Gradle and Grails, could be a big draw for those looking for a Java alternative that isn’t too far removed.

We’ve not mentioned the likes of Clojure, JRuby and Kotlin; the latter undergoing plenty of work as it nears a final version. Ultimately, success comes down to the fostering of an active community, which many JVM languages have cottoned onto, and the spinoff projects within that community.

If 2012 was the rise, 2013 is the consolidation within enterprise circles, which is fuelled by the developers using the language.

3. The increasing importance of JavaScript in Java

Details were thin on the ground for two new initiatives in OpenJDK for most of 2012, but by the year’s end, we had learnt a bit more about each project’s goals and their importance to Java innovation.

The new JavaScript engine set to be included within Java 8 will embed JavaScript into Java applications. Project Nashorn cements the notion of JavaScript’s reemergence and ever more relevance to Java developers.

Initially shrouded in secrecy, Nashorn was open sourced in November and appeared in the OpenJDK repository four days before Christmas. Another big plus point for Nashorn is the crucial inclusion of wildly popular node.js within the deal, ushering in a polyglot future. With plenty more details set to come, we’ll be monitoring this one with eagle eyes.

4. Getting more bang for your buck - harnessing the GPU

Another project within OpenJDK that has great potential is Sumatra, aiming to harness greater Java performance by utilising the GPU. Initial investigations are centred on the Hotspot JVM to lay the groundwork, before ‘leveraging’ Java 8 library and languages features such as lambdas to test the techniques with cutting edge Java.

The project, led by GPU specialist AMD, expects to find some roadblocks on the way with the Java API and its constructs, so we won’t be seeing ideas implemented in Java 8, but Sumatra could lead to some great advances and new techniques down the line for developers.

5. Java drifts even further into the cloud

With dozens of IaaS and PaaS options flooding the market, from both indies like Jelastic and industry giants like Oracle and AWS, developers are now spoilt for choice. Java has, it seems, successfully made the leap into the brave new world of “the cloud”.

The biggest current problem, as highlighted by Martijn Verburg on the Java Advent Calendar blog, is a lack of standardisation and optimisation. With Java’s own cloud features delayed to Java EE 8, it’s now up to the providers to provide standards such as CAMP or, failing that, the community to come up with universal frameworks like jclouds. Meanwhile, others are refusing to wait patiently for Oracle to provide features like multitenancy and efficient garbage collection, such as Waratek (which we profiled in September).

With cloud platforms rapidly becoming the norm, we’re likely to see the launch of even more third-party solutions for supporting Java in the cloud: by the time Java EE 8 rolls around (possibly 2014), we may not even need it. (Elliot Bentley)

Tuesday, 8 January 2013

Telerik ASP.NET AJAX Q1 2013 with Persistence Framework and iOS6 Support

Telerik ASP.NET AJAX control suite Q1 2013 will provide support for persistence framework with which users will be able to preserve their settings between sessions by saving the state of any RadControl on the page in a file, database or any other storage mode. The release will also include significant performance enhancements by leveraging HTML5, CSS3 with support for iOS6 and Windows 8 touch user interface.

Telerik is also planning to add SASS support which enables developers to build custom skins very easily. Moreover, all the controls included with the upcoming release will be Section 508 and level AA compliant. Telerik is also working towards the creation of controls which will be compatible with W3C Web Content Accessibility Guidelines 1.0/2.0.

The Q1 2013 release will ship with a new control which incorporates TreeView functionality in a ComboBox. Moreover, it will also include a new DropDownList and an advanced editor control with the look and feel of website search boxes.

Telerik ASP.NET AJAX control suite Q1 2013 will include several new features for existing controls - PivotGrid, HTML Chart, Image Editor, Async Upload, Editor, Grid, AutoCompleteBox, TreeList, Slider, ComboBox, Barcode and is expected to release in February 2013.

Monday, 7 January 2013

ASP.NET Page Life Cycle Overview


When an ASP.NET page runs, the page goes through a life cycle in which it performs a series of processing steps. These include initialization, instantiating controls, restoring and maintaining state, running event handler code, and rendering. It is important for you to understand the page life cycle so that you can write code at the appropriate life-cycle stage for the effect you intend.

If you develop custom controls, you must be familiar with the page life cycle in order to correctly initialize controls, populate control properties with view-state data, and run control behavior code. The life cycle of a control is based on the page life cycle, and the page raises many of the events that you need to handle in a custom control.


General Page Life-Cycle Stages

In general terms, the page goes through the stages outlined in the following table. In addition to the page life-cycle stages, there are application stages that occur before and after a request but are not specific to a page. For more information, see Introduction to the ASP.NET Application Life Cycle and ASP.NET Application Life Cycle Overview for IIS 7.0.

Some parts of the life cycle occur only when a page is processed as a postback. For postbacks, the page life cycle is the same during a partial-page postback (as when you use an UpdatePanel control) as it is during a full-page postback.

Stage
   

Description

Page request
   

The page request occurs before the page life cycle begins. When the page is requested by a user, ASP.NET determines whether the page needs to be parsed and compiled (therefore beginning the life of a page), or whether a cached version of the page can be sent in response without running the page.

Start
   

In the start stage, page properties such as Request and Response are set. At this stage, the page also determines whether the request is a postback or a new request and sets the IsPostBack property. The page also sets the UICulture property.

Initialization
   

During page initialization, controls on the page are available and each control's UniqueID property is set. A master page and themes are also applied to the page if applicable. If the current request is a postback, the postback data has not yet been loaded and control property values have not been restored to the values from view state.

Load
   

During load, if the current request is a postback, control properties are loaded with information recovered from view state and control state.

Postback event handling
   

If the request is a postback, control event handlers are called. After that, the Validate method of all validator controls is called, which sets the IsValid property of individual validator controls and of the page. (There is an exception to this sequence: the handler for the event that caused validation is called after validation.)

Rendering
   

Before rendering, view state is saved for the page and all controls. During the rendering stage, the page calls the Render method for each control, providing a text writer that writes its output to the OutputStream object of the page's Response property.

Unload
   

The Unload event is raised after the page has been fully rendered, sent to the client, and is ready to be discarded. At this point, page properties such as Response and Request are unloaded and cleanup is performed.

Saturday, 5 January 2013

11 predictions for enterprise software in 2013

All cloudy in the ERP forecast: The options for, and customers' comfort with, cloud-based ERP could grow significantly this year.

Market watchers will be eyeing whether Workday has the same success winning megadeals with its newer financials module as it did with HCM (human capital management). Microsoft's Dynamics ERP product lines should get additional cloud deployment options, as should customers of Infor and Epicor. Expect more attention to be paid to the likes of Plex and Kenandy, which specialize in cloud-based ERP for manufacturers. Meanwhile, Oracle and SAP will hope to fend off the competition overall with their own cloud modules.

With no shortage of choices now and upcoming for cloud ERP, the real question seems to be whether customers will vote en masse with their wallets.

Salesforce.com will move further into ERP: Even as it reformed its image from a cloud CRM software vendor into a full-blown platform player and moved into new application categories, Salesforce.com has yet to make an aggressive push into ERP software on its own, preferring instead to work with partners such as Workday and Infor.

Salesforce.com has taken one small step in the direction of ERP with the introduction of Work.com, a human resources application for managing employee performance. But Work.com can easily be added to the edges of a customer's software landscape, versus supplanting a rival product.

While it's not clear Salesforce.com will either develop a robust ERP suite on its own or acquire a vendor who already has one, in 2013 expect to see the company make some type of move, even if it's just a strengthening of partner relations. ERP simply takes up too much of the IT budget pie, and Salesforce.com will want a bigger slice.

Oracle and others will invest heavily in mobility and mobile middleware: Mobile application deployment options and design became the name of the game in enterprise software this year. SAP has made much of its mobile middleware and device management software, which it acquired through the $5.8 billion acquisition of Sybase in 2010.

Oracle is hardly lacking in mobile development tools, but it seems likely that it will scoop up a specialized company or three, perhaps next year, in order to strengthen its position. Don't be surprised if the likes of Hewlett-Packard and IBM do the same.

Oracle will get out of some part of the hardware business: It's no secret that Oracle has struggled with Sun's hardware business following the 2010 acquisition of Sun. Oracle executives have sent a consistent message, however, that the vendor is focused on higher-margin systems like the Exadata database machine and has little interest in competing with Hewlett-Packard or IBM in the commodity server market.

But Exadata's real profitability lies in the large amount of Oracle database and other software it runs, which delivers Oracle steady streams of lucrative maintenance revenue. This speaks to the real issue: Oracle has always been a software company at heart, so expect some type of retreat from hardware in 2013.

SAP boosts HANA with big data buy and nomenclature shift: Expect SAP to purchase an up-and-coming "big data" product or vendor, and perhaps several, including at least one that specializes in integration with the Hadoop framework for large-scale data processing, said Jon Reed, an independent analyst who closely tracks the company. Such a move would surely be taken with an eye on building out the capabilities of SAP's HANA in-memory database.

SAP will also seek to disassociate the NetWeaver brand name from its cloud products, Reed said. "For 2012, HANA will be the new term du jour."

Hadoop's momentum will continue: Expect plenty of additional adoption for Hadoop, according to analyst Curt Monash of Monash Research. "Everybody has the 'big bit bucket' use case, largely because of machine-generated data," Monash said via email. "Even today's technology is plenty good enough for that purpose, and hence justifies initial Hadoop adoption." Development of further Hadoop technology will be rapid as well, Monash said.

MySQL gets some more competition: Usually when the topic of alternative databases comes up, the incumbent is often Oracle or IBM DB2. But in 2013, MySQL could be playing the latter role. "NoSQL and NewSQL products often are developed as MySQL alternatives," Monash said. "Oracle has actually done a good job on MySQL technology, but now its business practices are scaring companies away from MySQL commitments, and newer short-request SQL DBMS are ready for use. Also, look for PostgreSQL to regain visibility as part of the mix."

Software all around: "[2013] will be the year everyone wants to be a software company," said analyst Ray Wang, CEO of Constellation Research. "Large hardware vendors and systems integrators will take advantage of [the consumerization of IT trend] and the cloud to consider delivering software-based solutions and IP to their market and competitors."

HP will make another big software buy: As most people have heard by now, Hewlett-Packard's $10.3 billion acquisition of infrastructure software vendor Autonomy hasn't gone terribly well, particularly in the public relations department.

Although HP shareholders may shudder at the thought of the company shelling out yet more billions, CEO Meg Whitman may push for another big acquisition as part of her turnaround plan.

Along with the search and data management software from Autonomy, HP also has a powerful database in the form of Vertica. Missing components in its lineup seem to be middleware and business applications, so if a deal does occur, watch those spaces.

Economic turmoil on tap: There's likely to be an economic recession in the U.S. in 2013, resulting in a significant pullback in IT spending, particularly on new purchases and investments, according to analyst Frank Scavo, president of the IT research firm Computer Economics.

This will "impact the traditional enterprise software vendors in a greater way than they realize," Scavo said. "Upgrade projects for traditional on-premises enterprise systems will be cancelled or delayed. The third-party maintenance business will prosper as customers look for ways to cut support costs. This will put pressure on traditional vendors to cut maintenance rates, which they have been resisting. This in turn will pressure their operating margins."

While cloud-based vendors will suffer less, they'll still see some deals take longer to close, Scavo said.

Don't believe anything you've just read: "Very few people see really new trends before they start," Scavo said. "I agree with Bill Gates, who said, 'We always overestimate the change that will occur in the next two years and underestimate the change that will occur in the next 10.'"

Source:java world

Friday, 4 January 2013

Making a switchable Desktop and Mobile site with ASP.NET MVC 4 and jQuery Mobile

There's something about making an experience great on a pocket supercomputer phone that is so much more satisfying than a desktop. Actually got this blog looking nice on mobile devices back in 2006 when nobody was mobile except doctors and, well, all of us techies here on the blogs.

About the importance of a good mobile site before in posts like Create a great mobile experience for your website today. Please. However, some folks had asked me if I'd do a post on how to do a combination Desktop and Mobile site using ASP.NET MVC similar to the examples I used in my talks in Russia on mobile earlier this year. (There's video of those ASP.NET mobile presentations available)

When you start Visual Studio 2012 and go File | New ASP.NET MVC 4 app, there's an Internet Application template and a Mobile template. One gets you a standard desktop site - although with responsive design elements so it works on small screens - and the other gets you a jQuery Mobile application meant primarily for phones and tablets. Let's make one that switches between both.

We will do a small site in ASP.NET MVC for the Desktop, do some quick DB access, add jQuery Mobile and a View Switcher switch back and forth. I'll be using the Electric Mobile Studio from Electric Plum to simulate an iPhone. You can get a 7 day trial or you can get the Lite version of the Electric Plum Mobile Simulator with WebMatrix 2.
Quick CRUD Example

First, a model for DVDs.
public class DVD
{
    public int ID { get; set; }
    public string Title { get; set; }
    public int Year { get; set; }
    public Rating rating { get; set; }
}

public enum Rating
{
    G, PG, PG13, R
}

Next, I scaffold out the Index, Create, Edit, Delete, etc. Unfortunately scaffolding doesn't do Enums (I'm sad) for my Movie Ratings so I add EditorFor() calls to my Create and Edits, and update my Index.
<div class="editor-label">
    @Html.LabelFor(model => model.rating)
</div>
<div class="editor-field">
    @Html.EditorFor(model => model.rating)
    @Html.ValidationMessageFor(model => model.rating)
</div>

Shared/EditorTemplates/Rating.cshtmlI could have used DropDownList I suppose, but I have always found that helper confusing. Instead, I'll create a Rating.cshtml that makes a dropdown. I could change this at some future point to be fancier and not even use a DropDown.

Aside: How do you guys usually handle Enums? I've seen it done a few ways. I'd like this to be more generic, but here's what I did for the Rating editor Template. Note the nullable ? as it has to work for both Create and Delete
@model MyApp.Models.Rating?
@using MyApp.Models

<select id="@ViewData.TemplateInfo.GetFullHtmlFieldId("")" name="@ViewData.TemplateInfo.GetFullHtmlFieldName("")">
    @foreach (int rating in Enum.GetValues(typeof(Rating))) {
        var name = Enum.GetName(typeof(Rating), rating);
        <option value="@name" selected="@(Model.HasValue ? (int)Model == rating : false)">@name</option>
    }
</select>

OK, so there's a basic Desktop CRUD app.


For more Information Browse http://www.hanselman.com/blog/MakingASwitchableDesktopAndMobileSiteWithASPNETMVC4AndJQueryMobile.aspx

Thursday, 3 January 2013

ASP .Net Development Vs Java Development


Java being the predecessor of all other programming languages is open source and on top of that is platform independent. Being platform independent has made it the preferred choice of amateurs and professionals alike. Being open source, Java API’s can easily be accessed by developers unlike .NET which is proprietary software and whose API’s are not accessible. Java, being open source, users do not have to grapple with hefty license fees each year, something which is mandatory in case of proprietary software.


Java being a very old technological platform is being taught in universities for a number of years. Therefore, there is an abundance of talent when it comes to developing applications in Java. There is however a significant shortage of developers who are acquainted with the .Net platform in the developed world. You would need to offshore your application development work to a low cost location like India where you would find a significantly higher number of developers acquainted with .NET technologies.


Some developers are of the opinion that ASP. NET is just an improved version of JAVA and has been developed by overcoming the short- comings of Java. Supporters of .NET technologies claim that Java is a language while .Net is language independent. Opting for .Net does not bind you to a single language as .Net supports multiple languages. It even supports Java as J# is very close to Java.


Another major advantage of using .Net is the ease with which it allows the exchange of data between various software applications. This occurs because the dot net platform allows different programs to exchange data via a common set of exchange formats, to read and write the same file formats and to use the same protocols. Such features make ASP.NET the preferred programming language for developing database driven websites and applications. .Net proves to be useful when applications stored on remote systems have to communicate with each other through standard internet protocols like XML, SOAP.



In my opinion, you should always develop applications on such a platform which does not get obsolete in the next five or even ten years. In simple words, you should avoid the upgrade treadmill offered by proprietary software’s who ask you to upgrade every few years.