Java 8 Example – Lambdas

A few months ago I wrote about how our core Java courses are being updated to Java 8.  Now that the updates are a little further along we also have a course map that can show which Java 8 courses we have might be appropriate for you.  You can find that here:

Java Course Map

I thought that it might be good to offer a quick example of some of the things in Java 8 on our blog.  Since you can’t really talk about Java 8 without discussing Lambda expressions I figured I would start there.

Read the rest of this entry »

No Comments

Creating custom HTML helper functions in ASP.NET MVC

ASP.NET MVC provides several  HTML helper functions that generates HTML automatically. E.g. Html.TextBox, Html.CheckBox etc. We can also create our own custom helper functions as well. For creating HTML functions following steps have to be performed:

1. Create a static class

2. Add a static method that returns either string or MvcHtmlString

3. First Parameter should use this and it should be of  type HtmlHelper. HtmlHelper is the class to which we are essentially adding an extension method for each helper function.

Here are a bunch of helper functions:

public static class SimpleCustomHtmlHelpers
{

  public static MvcHtmlString SubmitButton(this HtmlHelper helper, 
                                                 string id, 
                                                 string title)
 {
   string str = string.Format("<input type='submit' id='{0}'” +
                                “ value='{1}' />",  id, title);

   return MvcHtmlString.Create(str.ToString());
 }
 public static string MailTo(this HtmlHelper helper, 
                                    string emailAddress, 
                                    string textToDisplay)
{
   return String.Format("<a href='mailto:{0}'>{1}</a>", 
         emailAddress, textToDisplay);
}

public static string Image(this HtmlHelper helper, 
                                   string imageUrl, 
                                   string altText)
{
   return String.Format("<img src='{0}' alt='{1}' />", imageUrl, altText);
}
}
Using the above code will let us use following helper functions:
1. Html.SubmitButton(‘btnSubmit’, ‘Register’) 
2. Html.MailTo(‘abc@xyz.com’, ‘Email’)
3. Html.Image(‘/images/img.jpg’,’image’)

No Comments

SharePoint Server 2016 RC is now available

Both SharePoint 2016 and Project Server 2016 Release Candidate are not available. SharePoint 2016 RC is mostly feature complete and it’s now safe enough to evaluate it to get an overall picture of the final product. If you have older Beta 2 then it can be upgraded to RC.

If you have InfoPath 2013 and SharePoint Designer 2013 then they will continue to work with SharePoint 2016. Both will be supported for the duration of SharePoint 2016’s support lifecycle.

You can read about the prominent changes made to 2016 version in this blog post:

Permanent Link- Changes in SharePoint 2016

MinRole in SharePoint 2016

Permanent Link- Changes in SharePoint 2016 installation and deployment

No Comments

Exception handling in ASP.NET MVC applications

For exception handling we have been using try..catch..finally block since forever in various languages. In this blog we will see how to handle the unhandled exceptions in ASP.NET MVC. Unhandled exceptions are the exceptions that are not handled using try..catch..finally block. For handling unhandled exceptions or for creating a global exception handler we have to perform following steps:

1. In web.config add following line in the system.web section

<customErrors mode=”RemoteOnly”></customErrors>

2. Before each controller add following annotation:

[HandleError]

public ActionResult Index()

3. In Views folder create a sub-folder named Shared and create a file there named Error. Extension can be .cshtml (razor) or .aspx (web forms engine)

4. Optionally to the Error file add following code to display the actual error message:

@Model.Exception.Message

 

In case if you want to name the Error page something else then change the annotation before controller to [HandleError(View=”custom_name”)]. Replace custom_name with whatever your error page name is.

No Comments

New SharePoint CSOM version released for SharePoint Online

SharePoint supports two main development / deployment techniques for creating SharePoint projects: Server Object Model and Client-Side Object Model. If you plan on doing development for the hosted version of SharePoint, i.e. Office 365 / SharePoint Online, then you CSOM is the only option. A new SharePoint CSOM has been been released for SharePoint Online / Office 365. It also allows development for Project Online (hosted Project Server). It can be downloaded using “Manage NuGet Packages” option in Visual Studio. Just search for the id “Microsoft.SharePoitOnline.CSOM” and VS will download the required files.

No Comments

Microsoft has acquired Xamarin

Xamarin has been known for offering a native cross-platform development solution. It allows writing code using .NET and then running the same code on iOS, Android and WIndows devices. Microsoft has been supporting Xamarin tools in Visual Studio since VS 2013. But, now Microsoft has purchased Xamarin. It might boost Windows phone development and we might see more apps coming over to Windows. Even if Windows Phone apps don’t become popular it would still let .NET developers create cross-platform apps.

No Comments

Simple Algorithms for Effective Data Processing in Java

The needs of Big Data processing require specific tools which nowadays are, in many cases, represented by the Hadoop product ecosystem.

When I speak to people who work with Hadoop, they say that their deployments are usually pretty modest: about 20 machines, give or take. It may account for the fact that most companies are still in the technology adoption phase evaluating this Big Data platform and with time the number of machines in their Hadoop clusters would probably grow into 3- or even 4-digit ranges.

Development on Hadoop is becoming more agile with shorter execution cycles — Apache Tez, Cloudera’s Impala, Databricks’ Spark are some of the technologies that aid in the process along the way.

Read the rest of this entry »

No Comments

Java Courses Being Updated to Java 8

UPDATE – In order to provide clients a choice on which Java version they would like training on, we are releasing new course codes for Java 8.  Our current course codes will stay at Java 7 for those that need that version.

At Web Age Solutions it is important for us to make sure we are offering training that is relevant and appropriate for you.  Even though Java SE 8 was released some time ago, clients have taken a while to start using it since most Java environments they ran applications in had not yet added Java 8 support.  With the latest versions of all major Java EE application servers offering some type of Java 8 support that dynamic has changed.

We are updating our primary Java training courses to add Java 8 coverage.  The primary courses being updated are:

WA2494 Introduction to Java 8 Using Eclipse

WA2509 Advanced Java 8 Using Eclipse

The following courses will remain available using Java SE 7 for clients that need this version.

WA1278 Introduction to Java Using Eclipse

WA1449 Advanced Java using Eclipse

Since we know that there are also lots of Java programmers that do not need to take a “standard” course but simply need to learn what the changes are with this new version, we are also releasing a new course that covers the most recent changes.  This course covers the major changes of Java 8 that will have a significant impact on a wide range of Java applications in addition to a few important Java 7 features that are well known.

WA2493 What’s New in Java 8

So what is new in Java 8?  Will it impact your applications?  Java 8 is one of the most significant updates to Java in some time.  After Oracle bought out Sun, Java 6 was around for quite a while.  Oracle decided to release the "easy stuff" in Java 7 while working on some of the more significant changes for Java 8.

While the following is not an exhaustive list of Java 8 changes (you can go here for that) the following are some of the major features that are likely to impact a large cross-section of Java applications.

  • Lambda Expressions – This is by far the most impactful change in Java 8.  A “Lambda Expression” allows for the definition of an anonymous function that can be used as an object, for example being passed as a method parameter.  Besides simplifying code by replacing many usages of anonymous classes, a wide range of features are available as the rest of the Java platform was examined to use Lambda expressions where they made sense.
  • Collections Stream API – One place where Lambda expressions is leveraged is the Collections “Stream API”.  This lets you perform aggregate operations on a collection of objects.  For example, you might want to search through a set of CustomerProfile objects for all of the ones in a certain zip code and age range.
  • New Date/Time API – Although Java has always had the concept of ‘Date’ to represent a moment in time, many date and time related operations have been difficult.  Even answering the simple question “What was the date of the first Monday in November last year?” would be very complex.  The addition of the Date/Time API in Java 8 is meant to provide standard tools for these kinds of use cases.  This has long been a need in Java and now you won’t need third party libraries to address this need.
  • Concurrency changes – Although Java concurrency is not new, Java 5 and Java 7 introduced significant features in this area.  Java 8 continues to expand this area of Java programming, of particular importance since the impact of efficiently using multiple CPU processors, for example, can realize a significant improvement in performance.
  • Default methods – Currently, if you want to change the API of an interface, any implementing class is forced to implement the new functionality.  With Java 8 “default methods” you can add a new method to an interface along with a “default” implementation.  This implementation would be used for older classes that implement the interface but do not provide a unique implementation of the new method.  This could help you add new functionality to systems while minimizing the impact on existing, and already proven, libraries.

As I mentioned this is nowhere near absolutely all of the new changes in Java 8 but certainly most of the most significant. 

Besides the above courses that are being updated and released, we will also soon have a webinar that covers some of these changes as well.  Keep an eye on our webinar page for when that is scheduled.

No Comments

New Support for ECMAScript 2015

Although it is a huge part of the modern web, the syntax of JavaScript hasn’t really changed significantly in quite a long time. That all changed though last June, when ‘ECMAScript 2015’ was released.  This major update contained some significant changes and new features.  Now that more JavaScript engines and environments support the new specification it is a good time to get familiar with these changes.

Besides browsers adding more support for ECMAScript 2015, also call ECMAScript 6 or just “ES 6”, several of the popular JavaScript platforms are adding support as well.  Node.js 4 & 5 support a majority of ES 6, as does AngularJS 2.0.  Of course, like any major version upgrade of such a fundamental web technology, there will be a gradual migration.  We will see a lot of the same things happen with JavaScript that happened with HTML5 and CSS 3, both of which are now “mainstream” and enjoy much broader support.

One thing we’ve learned at Web Age is you can’t wait for “100% support in 100% of environments” to learn about or even begin to adopt a new technology.  It is important to learn about such major upgrades now so that you are aware what is different and look for places where a new version of a technology might be leveraged.

For those looking to keep up with these major changes to JavaScript introduced in ECMAScript 2015, we have a few resources.  The primary one is a new one-day course that focuses on the changes introduced with ECMAScript 2015.  We chose to release a class focused only on the changes since there are lots of people that have JavaScript skills and just need to learn about the changes.  You can find that course here:

WA2488 JavaScript Changes with ECMAScript 2015

We also are going to have a webinar this week that will provide a very quick overview of the changes.  This webinar will cover the main differences with the new ECMAScript 2015 specification and the impact on how JavaScript code can be written.  In particular, focus will be paid on how various ways to leverage the new version while also considering backwards compatibility.  You can register for that webinar here:

WEBINAR: Changes in ECMAScript 2015

As with all new and emerging technologies, we at Web Age look forward to keeping you up to date on what is happening and helping you learn about these technologies to expand the scope of your development skills!

No Comments

Changes in SharePoint 2016

SharePoint 2016 is due later this year. It includes several changes based on the available preview version. Here are some of the prominent changes: (Note: they could change by the time the final version becomes available)

  1. 5,000 List View Threshold limit

    Technically, SharePoint 2013 allows 30 million items per list. But, OOB, as far as end-users are concerned it enforces 5,000 item limit since querying a large number of items from SQL Server content database is a very resource intensive operation. In SharePoint 2016, end-users won’t have to worry about 5,000 view threshold limit anymore. Technically, the limit is still there but SharePoint 2016 automatically creates indexed columns to overcome the limit.

  2. Upload File Size

    In older versions the max possible upload file size is 2GB. In SharePoint 2016 although there’s no real limit as such but Microsoft recommends 10GB as the max. file size. Anything larger than that can potentially result in time-out.

  3. Faster site collection creation

    In older version it took fairly long time to create a site collection. Depending on your hardware configuration it takes 30+ seconds to create a new site collection. In SharePoint 2016 now it’s possible to create a new site collection in a second. It requires some configuration with PowerShell to make this work.

  4. Improved Compliance Center

    Holds and retention policies have been available in older version. In SharePoint 2016, retention policies can be applied to files stored in OneDrive for Business as well.

  5. Mobile Device Support

    Although SharePoint 2013 also works on mobile devices, but SharePoint 2016 has even better support. It has better responsive web design and which makes it more touch friendly and distinguishes between a small screen device, e.g. a cell phone, and  a larder mobile device, e.g. a tablet.

  6. Zero Downtime Patching

    Admins should be pleased with this feature. SharePoint 2016 allows patching without requiring downtime. Also, the size and number of packages have been reduced which means patching should be performed much faster.

  7. MinRole

    This feature allows selecting a role for SharePoint server at the time installation. Selecting a role optimizes the SharePoint for that role. SharePoint 2016 also lets us check running services and if they are compliant with the MinRole. You can read more on MinRole in my blog post: http://blog.webagesolutions.com/archives/1522

  8. Same Codebase

    In the past Office 365 / SharePoint Online and on-premises SharePoint 2013 had separate codebase. SharePoint 2016 uses the same codebase for cloud and on-premises. It results in a more streamlined UI and development experience.

  9. Hybrid Cloud Search

    SharePoint 2016 search can index the content in the cloud as well which results in a more unified search experience. In order to make this work, Office 365 is necessary.

No Comments