Posts

Creating a Simple Node.js project with MongoDB connectivity (Part 1)

Image
For beginners who would love to have a short intro about why Node has become a raving feature lately, let's start off with elucidating its basic features here. Node.jsAs defined by the official site for Node.js, it is a JavaScript runtime built on Chrome's V8 JavaScript engine. It utilizes an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js is packaged and retrieved from npm which is the largest ecosystem of open source libraries in the world. It's an open source server framework that enables developers to obtain full certification to modify the script as desired.Totally free - Talk about not having to input all that messy credit card info to have access to the script.No need to hassle about platform prerequisites. Node has been proven to run on  most of the renowned platforms such as- WindowsLinuxUnixMac OS Xetc.As obviously known, Node.js utilizes JavaScript on the server.There's just a vast arena of facts which can be discussed und…

OSGi Framework

Image
After a long lapse, I thought of reverting to a general, yet, in-vogue-theory elucidation. This post will be skimming through the OSGi Framework and its basic layout.
The OSGi (Open Services Gateway initiative) framework offers a dynamic modular architecture which has been used in many applications such as Eclipse Equinox, Apache Felix, etc. Contemplating OSGi framework’s back-end functionalities aids in developing Eclipse plugins and similar atomic programs.
OSGi framework architecture comprises 3 theoretical layers. Each layer is reliant on the layer(s) underneath it. The figure below shows the outline of each layer.
Service LayerModule LayerLifecycle layer Service Layer This is the layer that fulfills a service request from a client who is the requester. The service requester/client will request a service from the service provider, who publishes the service if it is available.
This resembles and functions in a manner similar to a Service Oriented Architecture (SOA) which is extensiv…

A pristine Pattern Matching method in Javascript

Whenever it comes to Pattern matching developers have almost always sought JS functions as they provide an easy way to perform pattern matching ranging from numeral and alphanumeric strings to algebraic functions. So though, I'm here to elucidate a more sleek way in which pattern matching can be done in modern JavaScript, I feel that it's crucial to state the predecessor(...maybe not yet!) pattern matching method, that is Regex. Regex Pattern Matching The most common and rudimentary method followed world-wide is the Regex Reference. Regex, that is Regular Expressions, are applied on a character string to check for the existence of a specified pattern. Regex also provides a "match and modify" functionality, to coin the term. What this means is that we can search for a particular pattern and perform replacement, split, sub-string extractions,etc.  at the same time.
The following syntax illustrates the base structure of any regex.
          /pattern/modifiers;
So for exa…

AngularJS vs ReactJS

Image
Today I just came across an interesting question and thought of creating this. At many occasions, developers try to render ReactJS as the best over AngularJS. But, according to my personal opinion, this is purely opinionated and also strongly depends on the type of the project in context.
First of all, here's a very brief definition of what AngularJS & ReactJS according to their documentations.
AngularJS
AngularJS is a structural framework for dynamic web apps. It lets you use HTML as your template language and lets you extend HTML's syntax to express your application's components clearly and succinctly. Angular's data binding and dependency injection eliminate much of the code you would otherwise have to write."
Here's a perfect example to try out this.
ReactJS
React.js is a JavaScript library for building user interfaces. (Famously used by Facebook)
The comparison between the two has been jotted out in the following table

interact.js Javascript Library

Image
Previously we've discussed enabling the drag and drop functionalities using the jsPlumb library. Recently, I stumbled upon the interact.js Javascript library, which I found to be as user-friendly as jsPlumb.
Below is a short comparison of the two.  





 LibraryLicenseLanguage/InfrastructureLevelBuilt-in editorGithub
jsPlumb



MIT/GPL2HTML, JavaScriptMediumNot Present2931 stars, 755 forks interact.js
MIT
Standalone JavaScript
Medium
Not Present
5452 stars, 351 forks
The above details are not presented here to render either one as the bet over the other. 
But, in my own experience, I've blended both in my projects utilizing the drag and drop functions for some elements from jsPLumb and the drag and resize function for one element from inter.js. But the only concern when using both the libraries within one function, issues related to the drag function of jsPlumb and interact.js overriding each other bringing out an unintentional effect, needs to be handled. I my case, I removed the jsP…

Creating Multi dimensional Arrays in Javascript

Image
If you asked my opinion about Multidimensional arrays, 3 or 4 years ago, I would have said that they were the most simplistic concept to grasp but the most complicated to implement since this is what pops into my mind as soon as I think of a Multidimensional Array


That was ages ago before I discovered the most easiest way, as easy as understanding multidimensional arrays, to implement them. Well, maybe some of you may already be well aware and this might sound like a trivial task, there is a percentage that needs clarification in this concept like I did 4 years ago. So buckle up, here we go.
Let's start off with the very basics. What's an Array?
The primitive definition of arrays simply stated that " Arrays were a storage medium that could hold a fixed number of values of a single type" . While this is partially true, it not the case anymore. Considering the programming language that I've chosen at hand, I think we can expand this definition and modify it to new lev…

Deleting Connections when elements are deleted in jsPlumb

Image
Removing the connections along with the parent element can be  little tricky if not correctly handled. This requires the maintenance of information regarding a connections source and target. 
In order to do so, we'll be using an array called 'list'. The list array is a two- dimensional array instantiated with the number of connections at the time of deletion of a parent element. 
An event listener will be called when the user clicks on the cancel icon of an element, as shown below. (I've tried as far as possible to simplify each and every code line via comments)


































The reason to declare the list array within the call to delete listener is the fact that there is no viable place other than this that could assure that the user has fully completed connecting as desired, plus there is little to no concern regarding this details up till an element needs to be deleted( up till what we've covered in this context, but the connection details are crucial when it comes to processing…