How to always return a default value for an object property in javascript?

Standard

Hi Guys,

Do you have a need where you want to return something as a default value if your JS object don’t have that property?

Let’s come to our problem.

Lets take an object (kind of a key value configuration object) which is coming from server and we need to make some very important decision based on this data.

var electricalConfig = {
  isLightOn: true,
  isBoardSmart: false,
  noOfSwitch: 10,
  noOfSockets: 3,
  isConnected: true
};

Continue reading

How to sync DB to salesforce if updates done by custom triggers using Heroku connect.

Standard

Hi Everybody,

Are you struggling with your DB updates to salesforce in case of triggers? If Yes, then you are on right place. I was in same situation today and wasted my hours looking for solution.

Problem: I use Heroku Connect to sync my data between salesforce and Postgres DB. I am updating my row by my own custom trigger and noticed that updates are not going back to salesforce.

Continue reading

Web apps with no internet :) Beginner’s Guide for application cache

Standard

Hello Guys,

In this modern world, website are essentials. Have you wondered what if you have to read some article or use some web application while you are moving in train or bus and you have no internet? What if you provide this feature to your user? Answer is : This will be a great user experience to them.

What if your user doesn’t have to download your website content each time they visit? Don’t you think this experience will be much far faster than before? Again answer is YES in capital letters.

Let’s see approach.

Continue reading

spa-hero : Automating build for single page apps

Standard

spa-hero

Create production/dev ready distribution build for javascript based single page applications. spa-hero uses gulp-useref to read out the html file and copy third party dependencies to a separate library folder.

Why I wrote this?

In this modern era of web, we extensivly use npm or bower to download dependencies to our project. These dependencies are right there in our project folder including lots of other files that came in with these packages. After looking at the size of my project one unavoidable question comes to us ,how to upload my project on server? Do I have to pick each and every javascript/css files from node_modules/bower_component folder and maintain a new folder which can be uploaded to server? If yes, then what happen when I added or removed some dependencies and I have to repeat the same cycle? Awww.

Continue reading

Forgot mysql root password?

Standard

Hello again!

I am wondering if anyone of you forgot your mysql db password for root user? Because I did.. LOL!!

So whats the bad thing with this? Oh! dear! its pretty bad because root user is the super admin for your DB and if you cant go through this.. you are screwed. You can’t manage DBs, cant manage users, permission and list is endless.

Here I found a simple way to reset your root password.

Continue reading

Finding the first day and last day of current month.

Standard

Have you faced a situation when you need to find the first day and last day of a month? Such scenarios occurs when we do some kind of enterprise application when accounting or billing modules comes into the picture.

And YES its important as well. Lets find out in some of the technologies.

#JAVASCRIPT

Sometimes we have to send the dates from front end. Lets say by default you have to set date range components from 1st day of this month to current date. So here is the hack.

Continue reading

Atom Editor packages behind the corporate firewall

Standard

Are you in love with brand new code editor from github team?  Yes it’s atom!

Atom editor is opensource and fully customizable in terms of installing packages and plugins to help us with whether its a debug tool, code snippets or anything else. We have bunch of free packages from the community.

But what about installing these packages behind the firewall? As we are not allowed to access URLs in our offices. So for this purpose we use proxy settings that relaxed us with url access.

Continue reading

Starting with gulp

Standard

Gulp – The streaming build system. As the name say, gulp is a tool for building the system.

In short, a tool which can help with automating the build process. Gulp is a javascript based build tool that uses nodejs as its running environment.

Its a task runner which can help with some very important and frequently used task like JS and CSS minification, compiling SASS etc.

Continue reading

prefetch, preconnect, prerender , All about prebrowsing

Standard

How website/app performance matters to you? What ways you know to improve it? Do you know just minification, concatenation, caching? Do we have other options?

What if you can get ready with your assets just before DOM is ready. What if you can load them in advance? Does it make a difference? Do you care? Big question to ask to our self.

We have some cool techniques to achieve advance or pre loading of our assets.

Continue reading