Posted on

Code easy with these 3 Array hacks

Arrays are everywhere in JavaScript and with the new spread operators introduced in ECMAScript 6, you can do awesome things with them. In this post I will show you 3 useful tricks you can use when programming.

 

technology-1283624_640

 

1. Iterating through an empty array

JavaScript arrays are sparse in nature in that there are a lot of holes in them. Try creating an array using the Array’s constructor and you will see what I mean.

> const arr = new Array(4);
[undefined, undefined, undefined, undefined]

You may find that iterating over a sparse array to apply a certain transformation is hard.

> const arr = new Array(4);
> arr.map((elem, index) => index);
[undefined, undefined, undefined, undefined]

To solve this, you can use Array.apply when creating the array.

> const arr = Array.apply(null, new Array(4));
> arr.map((elem, index) => index);
[0, 1, 2, 3]

2. Passing an empty parameter to a method

If you want to call a method and ignore one of its parameters, then JavaScript will complain if you keep it empty.

> method('parameter1', , 'parameter3');
Uncaught SyntaxError: Unexpected token ,

A workaround that people usually resort to is to pass either null or undefined.

> method('parameter1', null, 'parameter3') // or
> method('parameter1', undefined, 'parameter3');

I personally don’t like using null since JavaScript treats it as an object and that’s just weird. With the introduction of spread operators in ES6, there is a neater way of passing empty parameters to a method. As previously mentioned, arrays are sparse in nature and so passing empty values to it is totally okay. We’ll use this to our advantage.

> method(...['parameter1', , 'parameter3']); // works!

3. Unique array values

I always wonder why the Array constructor does not have a designated method to facilitate the use of unique array values. Spread operators are here for the rescue. Use spread operators with the Set constructor to generate unique array values.

> const arr = [...new Set([1, 2, 3, 3])];
[1, 2, 3]

 

Posted on

5 Top Python Frameworks For Web Developers

A Web framework can be very helpful for developers to write Web applications without having to handle low-level details as protocols, sockets or process/thread management. But a perfect choice might depend on a developer specific needs, preferences, and skill level. Python is a dynamic, object-oriented language. It was originally designed as an object-oriented language and some more advanced features were added in the later versions. In addition to the design purpose of language itself, the Python standard library is worth praising, and it even brings its own server. In other aspects, Python has enough free data library, free Web page template system and the library interacting with the Web server, which can be designed to your Web application. In this article we are going to look at 5 top Python Frameworks(according to me) for web development purpose.
1. Django

Screenshot from 2017-06-26 17-15-46
Django is a high-level Python Web framework that encourages fast growth and clean, pragmatic design. In case you are building something that’s much like a e-commerce web site, then it’s best to, in all probability, go along with Django. It would get your work executed fast. You do not have to fret about too many expertise selections. It gives the whole lot factor you want from template engine to ORM. If you wish to use your web app framework as a CMS, Django might be a more sensible choice. It’s free and open source.

2. Flask
Screenshot from 2017-06-26 17-22-07
Flask Python framework is highly extensible. A newbie programmer may find Flask inefficient due to lack of features like form validation, and database abstraction layer. In such a case, know that Flask allows you to implement extensions; therefore, you can add any required functionality.

3. CherryPy
Screenshot from 2017-06-26 17-28-40
CherryPy is a Web application development framework based on Python, that greatly simplifies the work of Python Web developers. It provides a friendly HTTP protocol interfaces for Python developers. CherryPy has a built in HTTP server or Web server, so the users of CherryPy can directly run CherryPy application without building Web server.

4. Pyramid
Screenshot from 2017-06-26 17-30-23
Pyramid is an open source, Python web application development framework. Its primary goal is to make it easier for a Python developer to create web applications. Pyramid is similar to Flask . Pyramid is compatible with python3, with a great documentation, its minimal, fast and flexible and has an integration of nosql: mongodb, couchdb . Pyramid is best for Developers working on API projects, prototyping a concept & developing large web applications, such as a CMS.

5. Web2py
Screenshot from 2017-06-26 20-13-12
Web2py is a free open source full-stack framework for rapid development of fast, scalable, secure and portable database-driven web-based applications. Written and programmable in Python.

 

 

Posted on

Best Free-Online tools for your IoT Projects

Best Online Tools for IoT Projects

Arduino Create

 

Create

 

Arduino Create (Arduino Web Editor) is an integrated online platform that enables Makers to write code, access content, configure boards and share projects. Traditionally speaking, going from an idea to a fully-functional IoT device has been a tedious process even for the most advanced engineers and developers. Until now, they would have to frequently switch back and forth between various tools and screens, from IDEs to cloud services.

That’s why Arduino has set out to launch a one-stop shop for the Maker experience, which will change the way you create, collaborate and communicate with your projects and the rapidly growing community.

 

Arduino Cloud

 

Screenshot_48

 

Arduino Cloud is fully integrated in the Arduino Create ecosystem, you will be able to generate a template code in Arduino Cloud and then edit and upload it to your board using the Arduino Web Editor.

 

PubNub

 

pubnub

 

The PubNub Data Stream Network provides global cloud infrastructure and key building blocks for real-time interactivity. PubNub also offers advanced features for enterprise level services such as a real-time dashboard to track all connected devices, EON a framework used to easily convert data into charts and graphs for easier analysis and also the ability to integrate easily into the Microsoft Azure enterprise solutions platform.

 

Circuits.io

 

Screenshot_50

 

Circuits.io tools bring you to make Breadboard Circuits that can be viewed as Schematic and PCB View as well. As a creator, most of your interests will be in the first and last options, though Circuit Scribe is interesting to check out if you’ve not heard of it until now.

Recently, Electronics lab is moved to tinker card.

 

Tinkercad is a simple, online 3D design and 3D printing app for everyone.

 

Screenshot_49

 

Tinkercad is used by designers, hobbyists, teachers, and kids, to make toys, prototypes, home decor, Minecraft models, jewelry – the list is truly endless!

 

GitHub

Screenshot_51

 

GitHub is a web-based Git or version control repository and Internet hosting service. It is mostly used for code. It offers all of the distributed version control and source code management (SCM) functionality of Git as well as adding its own features. It provides access control and several collaboration features such as bug tracking, feature requests, task management and More.

 

MIT App Inventor

 

Screenshot_52

 

App Inventor for Android is an open-source web application originally provided by Google and now maintained by the Massachusetts Institute of Technology (MIT).

It allows newcomers to computer programming to create software applications for the Android operating system (OS). It uses a graphical interface, very similar to Scratch and the StarLogo TNG user interface, which allows users to drag-and-drop visual objects to create an application that can run on Android devices. In creating App Inventor, Google drew upon significant prior research in educational computing, as well as work done within Google on online development environments. Using this tool you can create Android apps without any coding Knowledge. It will be more useful in creating Home Automation Projects.

 

Posted on

5 Best IDE for Python Programmers

An integrated development environment (IDE) is a software suite that consolidates the basic tools developers need to write and test software. Typically, an IDE contains a code editor, a compiler or interpreter and a debugger that the developer accesses through a single graphical user interface (GUI). An IDE may be a standalone application, or it may be included as part of one or more existing and compatible applications. In this article we will know about the 5 best IDE (according to me) for Python Developers

1. VIM

VIM is one of the most advanced text editors and is very popular one among the community of Python developers. It is open source and available free of cost under GPL license. Vim though is best known as an editor but it offers nothing less than a full featured Python development environment when configured correctly for Python development. VIM is light weight, modular and fast and is best suited for programmers who love keyboards and only keyboards, no mouse use while coding.

 


2. Sublime Text 3 / Anaconda Python IDE

Sublime Text 3 is one of the most powerful cross platform lightweight code editors till date. With the use of plugins Sublime Text 3 can be used as a full featured IDE – the Sublime Python IDE. You get elegance of sublime text and powers of Python at one place to create your own magic. The most powerful transformation is brought to you by Anaconda package which provides code completion and linting for Python.

3. Pydev with Eclipse – Best Python IDE (Free Tier)

Pydev is the Python IDE for masses for the simple reason that it is free of cost and comes packed with powerful features for efficient Python programming. It is an open source plugin that runs on top of Eclipse and brings Python to the kingdom of Eclipse. If you are an existing Eclipse user then Pydev is just home for you, if not, then Eclipse might sound intimidating in the beginning but worth the efforts.

4. Emacs – Python Editor cum IDE

Emacs has an ecosystem of its own. It is the GNU text editor which is extensible and highly customizable. When it comes to Python programming, Emacs can be configured in such a way that it gets transformed into a fully functional free Python IDE.

5. Spyder Python

Spyder Python is an open source IDE for Python, best suited for scientific python development. It is a lightweight software, written in Python itself and available as free to use under MIT license. Some of the basic features of Spyder python are multi language editor, interactive console, documentation viewer, variable explorer, Find in files, files explorer etc. It can get Spyder IDE package for windows, Mac or Linux.

 

 

Posted on

Top 5 nodeJs framework for Developers

Node.js is one of the more groundbreaking additions to the web development landscape, offering an environment that enables full-stack JavaScript applications for the first time ever. Prior to Node.js, JavaScript was limited to client-side scripting, but Node transformed the script into a cross-over language, capable of writing software that’s portable between the front and back ends.

JavaScript brought its speed and cross-platform compatibility to back-end development, along with its devoted community of JavaScript programmers. In its 2015 developer survey, Stack Overflow found that JavaScript was the most popular programming language—even among back-end developers. This soaring popularity, along with Node’s expansion into an entire development ecosystem, has fueled the creation of numerous Node.js frameworks that both extend and add to Node.js’s existing features.

Node.js_logo

Let us look at the Node.js framework list representing most powerful and feature rich frameworks available today that help you build real time and scalable web applications with ease.

Express.js

Express.js a lightweight, efficient middleware and routing framework. Express.js is best known as another quarter of the MEAN (MongoDB, Express, AngularJS and Node) stack, and is the most popular Node.js framework. Because Node.js itself wasn’t intended to build websites, the Express framework is able to create an HTTP server in Node, layering in the middleware structure and response/request functions needed to actually run a site. It’s a pretty minimalist framework that’s great for giving developers extra, built-in web application features and the Express API without overriding the already robust, feature-packed Node.js platform. Note that it does require a bit more manual tasks, which can be tedious and time consuming, and has a bit larger footprint than other frameworks.

Socket.io

Socket.io is all about real-time communication and chat apps—the kind of software that hinges on robust event-driven, bidirectional communication between browsers and servers. It’s a websocket-compatible server that’s great at providing collaborative features and real-time analytics, whether they’re in the form of a counter or more in-depth metrics. Socket.io is compatible with every device, operating system, and browser. It’s been used by top tech companies like Trello, Zendesk, Microsoft, and Yammer, as well as Flightcar, a startup that lets people rent out their cars from the airport while they’re traveling.

Hapi.js

Need more enterprise-level functionality? Working with distributed engineering teams? Hapi.js may be the best route for you. Hapi.js was created by developers at Walmart in preparation for Black Friday traffic as an answer to limitations they’d run into with Express—mainly extensibility and maintainability issues. They found that, as the application grew, Express code was more difficult to split into chunks and delegate to different teams. Hapi’s plug-in system enables it to be worked on in sections without breaking the rest of the code base.

Right out of the box, Hapi does a lot more than Express. While there are similarities and differences between the two frameworks, Hapi—which is primarily used for rapidly building and testing application programming interfaces (APIs)—generally enables developers to focus more on writing reusable application logic instead of spending time building infrastructure. It supports API development with an array of plug-ins from authorization and authentication to metrics and logging. It’s been used by heavy-hitters like OpenTable, Macy’s, Condé Nast, and Disney.

Mean.io

Mean.js and Mean.io are frameworks written by the same author with subtle differences. Mean.io was developed first, so it has a bit more documentation and a larger community behind it. It’s based on Node modules, with client- and server-side files in separate modules. Mean.js uses an MVC-style Express/Node back end and an AngularJS-based front end. It also leverages the Grunt tool to enable automated testing.

Mojito

Mojito is an MVC framework based on Yahoo! Cocktails, a JavaScript-based mobile development platform built by developers in house at Yahoo!. Mojito acts like a module that layers very well with other core Node modules, while implementing Cocktails’ on-line/off-line, multi-device, hosted application platform.