java

How to avoid NullPointerException?  #angularjs #reactjs

  • So lets look at what is says: The first line of the stack trace tells you a number of things: It tells you the name of the Java thread in which the exception was thrown.
  • But you can be sure that the second line (the first “at” line) will tell you where the NPE was thrown1.
  • The first “at” line would say that the exception was thrown in some line in the class, and line 4 of would be the second “at” line.
  • length(); } public static void main(String[] args) { int length = test(foo, 1); } } $ javac Test.java $ java Test Exception in thread “main” java.lang.NullPointerException at Test.test(Test.java:6) at Test.main(Test.java:10) $ So now we have 2 “at” lines.
  • The first one is for this line: and the second one is for this line: So looking at the first line, how could that throw an NPE?

What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?
Continue reading “java”

Angular 2 Application Architecture

  • We will go over the following topics:

    The challenges of building large scale single page apps
    Three types of state in an app
    The Flux architecture
    The Redux state container
    The advantages of immutable state
    Immutable.js and immutable data collections
    Building a Flux Angular 2 app step by step
    How to use Immutable.js and still keep type-safety
    Conclusions

    The most important question about this type of architecture is probably when should we use it and why?

  • Actions are dispatched directly against the store

    Building an Angular 2 App using Flux

    Let’s build a simple app (available on this repository), that looks like this:

    Notice that the app state is logged in the console.

  • For example the Todo App has the following state:

    We can see the state is separated into two parts:

    the application data, under property todos
    the global Ui state, under property uiState

    Creating a Redux Action

    Now let’s define some application actions.

  • Creating a Redux reducer

    For example this is the reducer for the application data state:

    The reducer just branches the calculation of the new state and delegates it to other functions, or calculates the new state directly in the switch statement if that only takes a couple of lines.

  • The store can now be injected in any component, and used to dispatch actions:

    Immutable.js and immutable data collections

    There are no real benefits for storing state inside a store using Redux if we cannot make the state immutable in a practical way.

In this post we will explore how to design an Angular 2 application according to the Flux architecture, by using the Redux and Immutable.js libraries. We will go over the following topics:
Continue reading “Angular 2 Application Architecture”

8 Reasons to Use GruntJS With Your WordPress Build or Plugin

  • Grunt is a workflow management tool (or, “task runner”) that automates those essential but repetitive code-based tasks like code optimization, JavaScript minification, testing, CSS preprocessing, debugging, and deployment.
  • For example, when you update your CSS code, a watch task can tell Grunt to generate an updated style.css file for you—no extra steps required.
  • An example would be to set up a Grunt “watch task”—called grunt-contrib-watch—in which Grunt watches for changes to any files, whether it’s a JavaScript file, a CSS file, or HTML file.
  • Just code in Sass and save the file, and Grunt will note that change, run the Sass task, and recompile a new, updated Sass file.
  • All Sass code eventually needs to be compiled to pure CSS that a browser can read, and Grunt can automate that process for you, compiling your SCSS files together into your style.css file, in your development folder.

Upwork is the world’s largest freelancing website connecting more than 5 million businesses with talented independent professionals. Our marketplace enables businesses to find, hire, collaborate with and pay freelance talent online. To learn more, check out how it works or read about best practices on our blog, Hiring Headquarters.
Continue reading “8 Reasons to Use GruntJS With Your WordPress Build or Plugin”

Using ES6 and ESNext with TypeScript

  • TypeScript is very particular about what is and isn’t allowed in a TS file to protect you from common developer errors.
  • That said it is super easy to configure TypeScript to use ES6 or ESNext using the option.

TypeScript is very particular about what is and isn’t allowed in a TS file to protect you from common developer errors. By default if you set the compile target to ES5 it only allows you to use globally defined variables that were available in the ES5 time-frame. That said it is super easy to configure TypeScript to use ES6 or ESNext using the lib option.
We also cover how to make sure that these features work across the widest range of browsers using a simple polyfill.

Continue reading “Using ES6 and ESNext with TypeScript”

AngularJS: How Google’s JavaScript framework is changing Web Application Development

#AngularJS is changing #WebAppDev !

#AppDev

  • Traditionally, web applications left the heavy-lifting of data to servers that pushed HTML to the browser in complete page loads.
  • SPAs typically contrast from classical multi-page web applications where page changes are regular and the browser is often asked to fetch new content from the server and then reload to fulfil user requests.
  • The following chart illustrates the results after 3168 votes:

    2-way data binding has entrenched modern front-end development as a tool allowing you to avoid boilerplate code when working with DOM, concentrate on logic and isolate the logic from your templates.

  • 9

    The following code samples show basic data binding implementations for a simple, read-only data table use case:

    AngularJS is a new, powerful, client-side technology that provides a way of accomplishing really powerful things in a way that embraces and extends HTML, CSS and JavaScript, while shoring up some of its glaring deficiencies.

  • 12

    AngularJS incorporates the basic principles behind the original MVC software design pattern into how it builds client-side web applications.

Traditionally, web applications left the heavy-lifting of data to servers that pushed HTML to the browser in complete page loads. The use of client-side JavaScript was limited to improving the user experience. Now this relationship has been inverted – client applications pull raw data from the server and render it into the browser when and where it is needed. 1
Continue reading “AngularJS: How Google’s JavaScript framework is changing Web Application Development”

Up and Running with TypeScript

Up and Running with TypeScript course by @johnlindquist #typescript

The first question you ask after installing TypeScript is “What do I do now?” In this course you’ll learn about using the TypeScript compiler, configuring your project, definition files, and all the ins-and-outs of understanding how to use TypeScript in your project.

Continue reading “Up and Running with TypeScript”

7 Top programming languages to learn in 2017 ( HIGH JOBS)

  • Java is one of the most widely adopted programming languages, used by some 9 million developers and running on 7 billion devices worldwide.
  • Javascript – not to be confused with Java – is another one of the world’s most famous and influential programming languages, and is used to spice up web pages by making them interactive.
  • also, read 5 best javascript ide & javascript editors

    PHP (Hypertext Pre-Processor) is a scripting language, running on the server, which can be used to create web pages written in HTML.

  • These new features make the PHP language a powerful platform and provide a pleasant experience for building web applications and command-line tools.
  • aslo, read 5 best IDE for python

    Swift is a new & modern Programming language introduced to Apple developers and the world in June 2014.

What are the top programming languages to learn today? It is one of the most common questions we get asked, these top programming languages have a much
Continue reading “7 Top programming languages to learn in 2017 ( HIGH JOBS)”