Monthly Archives: March 2016

HOW IOS SWIFT PROGRAMMING IS GETTING POPULAR

How IOS Swift programming is getting popular

IOS Swift Programming

Swift is a persuasive and intuitive programming language for iOS, OS X, tvOS, and watchOS. Writing up the swift code is interactive and enjoyable, the syntax is brief yet expressive, and applications run at lightning-fast. Swift is ready for your next project – or addition into your current application – because, the Swift code runs parallel with Objective-C.

INTRODUCING SWIFT:

Swift is a new programming language that builds on the best of C and Objective-C, without the constraints of C compatibility. Swift adopts safe programming patterns and has added more modern features to make programming easier, malleable, and more lively. Swift’s clean slate backed by the mature and much-loved Cocoa and Cocoa Touch frameworks, is an opportunity to reimagine how software development works.

Swift took many years in making. Apple laid the foundation for Swift by progressing the existing compiler, and framework infrastructure. Objective-C itself evolved to support blocks, collection literals, and modules, enabling framework adoption of modern language technologies without any interruption.

As Swift is familiar to Objective-C developers, it adopts readability of Objective-C’s named parameters and the power of Objective-C’s dynamic model. Building from the common ground, Swift introduces many new features and consolidates the procedural and object-oriented portions of the language. Another important feature of Swift is, it allows the programmers to experiment with the Swift code and can see the results immediately, without the overhead of building and running an application.

Swift combines the best of modern language thinking with wisdom from the wider Apple engineering culture. The compiler is optimized for performance and the language is optimized for development, without compromising on anyone either.

According to the Red Monk’s Programming Language rankings, Swift has climbed from 68th position in 2014 to 22nd position in 2015, a jump of 46 slots. According to the meteoric rise, Swift is expected to become a top language sometime in this year.

Swift is a fantastic way to write iOS, OS X, watch OS, and tvOS apps, and will continue to advance with new features and capabilities. It has also gone open source, which is one of the main reason for its popularity.

Swift Programming Language
SYNTAX ENHANCEMENT:

The syntax features make the users write more expressive code while improving consistency across the language. The SDK’s have employed new Objective-C features such as, generics and nullability annotation to make Swift code even cleaner and safer.

TYPES, VARIABLES, AND SCOPING:

Under the environment of Cocoa and Cocoa Touch, many classes were part of the foundation kit library. This includes, NSString string library, the NSArray, and the NSDictionary collection classes. Objective-C provides various bits of syntactic sugar to allow some of the objects to be created within the language. But, once it is created the objects are manipulated within the object calls.

NSString *str = @”hello,”;
str = [str stringByAppendingString:@” world”];

In swift, many of these basic types have been promoted to the language’s core and can be manipulated directly. For instance, strings are invisibly bridged to NSString and can be coupled with the “+” operator allowing simplified syntax.

var str = “hello,”
str += ” world”
INTERACTIVE PLAYGROUNDS:

Playgrounds make writing Swift code astonishingly simple and fun. If a user types a line of the code, the result appears immediately, and a user can have quick look of result which is side of the code, or can pin the result directly below. And in new Xcode 7, playground contains comments that use rich text with, bold, italic, and bullet lists in addition to embedded images and links.

DESIGNED FOR SAFETY:

Swift excludes entire classes of unsafe code. The variables are initialized always before use, arrays and integers are checked for overflow, and memory is managed automatically. Another safety feature of Swift is, by default Swift objects can never be nil. The Swift compiler will stop you from trying to make or use of nil object with a compile-time error. This makes the writing of code much cleaner and safer, and prevents massive category of runtime crashes in your applications.

RAPID AND POWERFUL:

From its earlier concept, Swift was built much faster. Using the high-performance LLVM compiler, Swift code is transformed into optimized native code that gets the most out of modern hardware.

PLATFORM SUPPORT:

One of the most impressive aspects of developing Swift is, it is now free to be ported across wide range of platforms, devices, and use cases.

The major goal is to provide source compatibility for Swift across all platforms, even though the actual implementation and mechanisms may differ from one platform to other.

CONCLUSION:

Swift has all the necessary features to quickly become a popular programming language for iOS and OS X in both the enterprise and the consumer worlds. The type interference characteristic of the language will make it especially suitable for the enterprise and the simple and clean syntax will attract those on consumer projects.

HOW CI/CD PROCESS IS DOMINANT IN DEVOPS WORLD

How CI/CD process is dominant in DevOps world

ci/cd_process_is_dominant

Continuous” is the word that you would often hear constantly in any discussion around DevOps. Almost everything in DevOps is continuous: be it Continuous integration, Continuous deployment, or Continuous delivery. So let’s take a closer look at the idea of continuity and why it has become central in the DevOps world.

CONTINUOUS INTEGRATION:

Continuous Integration is a software development practice where members of a team integrate their work frequently. In a broader sense, a continuous integration that aims at integrating the whole system or solution as often and as early as possible.

Continuous Integration is a software development practice where members of a team integrate their work frequently. In a broader sense, a continuous integration that aims at integrating the whole system or solution as often and as early as possible.

CONTINUOUS DELIVERY:

Continuous Delivery is the process of delivering code to the customer or end user whenever the developer feels that a section of code ready to be released, rather than releasing the entire code at one time. If the new release fails any of the set parameters, it is returned to the developing team for corrections before it gets integrated into the main system.

The major advantage of using continuous delivery is the improved communication with the client. Hence, the client need not to wait for the whole project to be completed to check whether the work meets his expectations or not. Also, the process of continuous delivery allows the developer to fix bugs, new products, and updates to be released quickly with less risk and without a huge labour costs.

CONTINUOUS DEPLOYMENT:

Continuous Deployment makes use of automated processes for both release of new code into the main environment and to test the code before it is integrated into the system. The major advantage of this process is, it allows the developer to concentrate on the tasks which is in hand, rather than continually test previously-written code and keep track of potential issues. Using this process, the developer simply delivers the new code to the automated system when the developer believes it to be ready. In continuous deployment, there is no large batch processing. Each individual of an element of a project can be released when it is ready using this process.

THE MAJOR BENEFITS OF CI/CD:

The three major benefits of CI/CD are listed below

* The increase in deployment frequency.
* Increase in release/delivery frequency.
* Decrease in the number of broken builds going into the production.

Once you have moved to Continuous Deployment process, the developer has to make several pieces of automation in place. The developer must automate the Continuous Integration Build Server and Continuous Delivery to Staging, as well as it has the ability to automatically deploy to production.

In the Ideal Workflow, the entire process could be automated from start to finish:

* Firstly, the developer checks-in the code to development branch.
* The Continuous Integration server picks up the changes need to be done.
* Then it performs the unit test.
* The unit test will be performed from Merge to Staging environment, the voting will be made based on the test results.
* If the deployment is successful in Staging environment,
* QA tests the environment and if the test is successful then it is moved to production.
* The Continuous Integration server picks this up again and regulates whether it is OK to merge into the production or not.
* If successful, then it will deploy to the Production environment.

This process varies slightly depending on needs, requirements, and approaches.

According to the DevOps.com’s survey, over 80% identify CI/CD as part of their DevOps initiative.

The survey pinpoints CI/CD as the dominant DevOps solution being implemented now.

MAKING SENSE OF THE DIFFERENCES:

Though all these terms look similar, there are some essential differences in these three processes. For precedent, continuous deployment requires both continuous delivery and continuous integration in order to work properly and to avoid errors in the release. In addition, continuous deployment is dependent on having automated testing, analysis, and release systems in place.

All the three processes are useful in minimizing risk and labour cost while allowing developers the greatest creative freedom. Understanding the exquisite differences among the three is essential for making use of the process that will benefit your team and company.

FOCUS ON KENDO UI

Focus on Kendo UI

Focus on kendo ui

The Web has been transforming since a very long time, and now the web demand is rich for interactive web applications. For developing that kind of applications, a developer needs a broad range of developer tools in their toolbox. In this article, we are going to learn about Kendo UI which is a new and intriguing JavaScript tool set.

KENDO UI IS ABOUT:

Kendo UI is a “JavaScript framework for building modern and interactive web applications”. Now-a-days, people expect rich interactive and fluent websites. In order to achieve that, a developer must make good use of available client-side technologies, which Kendo UI does for you.

WHAT DOES A KENDO UI PROVIDE?

Kendo UI provides an extensive collection of rich UI widgets, these are HTML 5 controls based on jQuery and it is supported by all current browsers. It has different categories of UI widgets:

Web – These are widgets for web and touch enabled desktop development. It consists of a fully featured grid with paging, sorting, filtering, and custom templates, tree view, rich text editor, and many more.

DataViz – They are also called as Data Visualization widgets. This is used for development of desktop and mobile websites. These are usually used for representing data which includes charts and gauges.

WHY KENDO UI?

Easy Setup: Now the question may arise that why Kendo UI and why not the other available tools. Here’s the answer, firstly, Kendo UI provides all the tools you need in one package. There is no need of installing half a dozen libraries to make your web look better. It also provides different parts of the toolset to work more efficiently.

MVVM: Kendo UI also provides MVVM (Model-View-View-Model) framework which enablesdeclarative binding and two-way data synchronization in your web application.

Performance: Kendo UI has been designed from the ground level to the top with performance in mind and there are no shortcuts used along the way, thus this has resulted in an extremely performing toolset.

Support: Kendo UI is a product of popular vendor, others have community support for their product where as, Kendo UI has a proper professional support.

Easy to Learn: Kendo UI uses common JavaScript language, so that it is easy for any JavaScript developer to get started. It provides ready-to-use applications saving your time to include the needed Kendo UI libraries and set up the components in your app.

WORKS WITH ALL BROWSERS:

Browser support is decisive when choosing any type of web tool, there is nothing bad than finding a perfect tooling for the solution. Kendo UI has been designed with a lot of intelligence to support majority of browsers and browser versions. Kendo UI is supported on:

*Firefox 10.0+
* All versions of Chrome
* Opera 10.0+
* IE 7.0+
* Safari 4.0+

With the broad support of Kendo UI, a user can be confident that whosoever is accessing the website can get the view the user intended.

FINAL THOUGHT:

Creating useful and attractive websites for today’s audience has become a crucial task than ever before Kendo UI web development shows the user how to add the latest web features to your website. The experts have created a fully supported code library that makes the user focus on what makes their site special.

TOP UNIT TESTING FRAMEWORKS IN UI SPACE

Top unit testing frameworks in UI space

Top unit testing frameworks in ui space

Unit testing, as the name implies, is about testing individual units of code.

In this article, we will let you know about what is unit testing and Unit Testing of Angular Applications.

In this article, we completely aimed at beginners and who are familiar about Angular but haven’t gone deep into unit testing their applications. So, let’s dive deep in and explore about unit testing of Angular applications.

A WORD ABOUT UNIT TESTING:

Unit testing is a software testing process in which the smallest testable parts of an application, called units, are individually and independently explored for proper operation. Unit testing is generally automated but it can also be done manually. Each unit is tested separately before integrating them into modules to test the interfaces between the modules.

The major goal of unit testing is to isolate each part of the program and test that the individual parts are working correctly. This means that for any function or procedure when a set of inputs are given then it should return the proper values. It should handle the failures gracefully during the course of execution when any invalid input is given.

There are many test frameworks and tools available to the Angular developer, and they may already have preferences around tooling. To setup a decent testing environment for your AngularJS application, you will need a several npm modules. So, let’s take a quick look at them.

Karma:

Karma is a test runner provided by the Angular team, Karma will execute your tests in multiple browsers which shall ensure that your application is compatible with all browsers. Karma is an engine that runs the test against code. Though, it has been written for AngularJS, it is not specifically tied to it and it can be used for any JavaScript application.

Configuration:

Navigate to your working directory in your terminal or command prompt and follow the given instructions.

Install AngularJS
* npm install angular –save
Install Karma
* npm install -g karma –save-dev
Install Jasmine
* npm install karma-jasmine jasmine-core –save-dev
Install ngMock
* ngMock allows you to inject and mock angular services to
help you test your application.
* npm install angular-mocks –save-dev
karma.conf.js
* karma init.
* Select Jasmine as your testing framework.
* Select a browser.
*Specify the paths to your js and spec files.
* Open your karma.conf.js and add the location of angular.js in to file array.
node_modules/angular/angular.js
* Add the location of ngMock just below of that.
node_modules/angular-mocks/angular-mocks.js
This is the process of the configuration, now a user can proceed and write his code.
Mocha:

Mocha is a testing framework for JavaScript running on node.js. It holds test suites and test cases, and it offers fair reporting features. It uses declarative syntaxes to nest expectations into cases and suites. Mocha can be used with most various JavaScript assertion libraries like;

Should.js, express.js, and chai.

describe(‘Array’, function( ) {
describe(‘#indexOf( )’, function( ) {
it(‘should return -1 when the value is not present’, function( ) {
assert.equal(-1, [1,2,3].indexOf(5));
assert.equal(-1, [1,2,3].indexOf(0));
});
});
});

Chai:

We have seen how Mocha provides test-suite and test-cases capabilities for JavaScript. Chai offers various ways of verifying things in test cases. These verifications are performed through “assertions” and marks a test case as failed or passed.

Sinon:

Sinon describes itself as “standalone test spies, stubs, and mocks for JavaScript”. Stubs, spies, and mocks all answer the same question. Sinon provides smart and precise way to monitor whether the function is called, if so, with which arguments, and how many times, etc.

Final Thought:

AngularJS is still a young, and growing framework. Unit testing in AngularJS applications follows a fractal design. Hope that the testing patterns we’ve mentioned in this article prove useful in your own development and practices.

ADVANTAGES & DISADVANTAGES OF REACT.JS

Advantages & Disadvantages of React.JS

The world is changing on a daily basis, it’s hard to devote your time to learn new frameworks especially when the framework is ultimately becoming a stand-off. React opens a world of new possibilities such as server-side rendering, real-time updates, different rendering targets like iOS, Android, and many more.

WHAT IS REACT?

React (sometimes referred as React.js or ReactJS) is a Javascript library created by a collaboration of Facebook and Instagram. It allows developers to create fast user interfaces. React views are typically rendered using components that contain additional components specified as custom HTML tags. One of the unique features of React.js is not only it can perform on the client side, but it can also be rendered on the server side, and they can work together interoperably.

It also uses the concept called Virtual DOM, creates an in-memory data structure cache, enumerates the resulting differences, and then updates the browser’s displayed DOM efficiently. This allows the programmer to write code as if the entire page is rendered on each change while the React libraries only render the subcomponents that actually changes.

Every framework has its own advantages and disadvantages. Let’s see the major pros and cons of React.js.

THE GOOD:
React.js is extremely efficient: React.js creates its own virtual DOM where your components actually live. This approach gives you enormous flexibility and amazing gain in performance. React.js also calculates what are the changes needed to be made in DOM. This process of React.js avoids expensive DOM operations and make updates in a very cient manner.

It makes writing Javascript easier: React.js uses a special syntax called JSX, which allows you to mix HTML with Javascript. The user can drop a bit of HTML in the render function without having to concatenate strings, this is another fantastic thing. React.js turns those bits of HTML into functions with a special JSXTransformer.

It gives you out-of-the-box developer tools: When you start your journey with React.js, do not forget to install official React.js chrome extension. It makes debugging your application much easier. After you install the extension, you will have a direct look into the virtual DOM as if you were browsing a regular DOM tree in the elements panel. Isn’t it pretty amazing!

It’s awesome for SEO: One of the biggest issue with Javascript frameworks is that they are not search engine friendly. Though there have been some improvements in this area, search engines generally have trouble reading Javascript heavy applications. React.js stands out from the crowd because you can run React.js on the server, and the virtual DOM will be rendered to the browser as a regular web page.

UI Test Cases: It is extremely easy to write UI test cases because the virtual DOM system implemented entirely in JS.

THE BAD:
* React.js is only a view layer.
* Integrating React.js into a traditional MVC framework such as rails would require some configuration (i.e., substituting erb with React.js).
* There is a learning curve for beginners who are new to web development.

WHY YOU SHOULD USE REACT.JS:
* React.js works great for teams, strongly enforcing UI and workflow patterns.
* The user interface code is readable and maintainable.
* And also, there is now a lot of demand for developers with ReactJS experience.

HOW TO DISTINGUISH BETWEEN LEFT AND RIGHT MOUSE CLICK WITH JQUERY?

How to distinguish between left and right mouse click with jQuery?

///HTML
<div id=”right”>Check Which Mouse Click You have Clicked
THIS IS A TEST FOR MOUSE CLICK!</div>
//JavaScript Code
$(“div”).mousedown(function(e) {
if (e.which===1)
{
alert(“left”)
}
else if (e.which ===3) {
alert(‘right mouse button is pressed’);
}
});
There are eight cases for pressed button. Among them bit 001 (1) is for left click event and bits 011(3) is for right click.

WHAT IS THE DIFFERENCE BETWEEN REQUIRED AND NG-REQUIRED?

What is the difference between required and ng-required?

In HTML attribute required is to tell that field must be required in order for the form to be valid.

And it is not possible to write condition like required=”true” or required=”false”. It gives you a HTML error. This can be solved using Angular.

While, Using Angular attribute ng-required=”MyCondition” means ‘RequireFun(MyCondition)’ and sets the HTML attribute dynamically for you depending on your condition.

WHAT IS STDOUT FLUSH IN NODEJS?

What is Stdout flush in NodeJS?

For example

sys.stdout.write(“hello I am Writing something”);
sys.stdout.flush();

Stdout flush is used for checking writable stream is “write” successful or not.

“sys.stdout.flush()” gives result true if flush was successful and false if kernel buffer is full and it can’t write yet.