DeadSimpleScreenSharing 2: Open source browser based self-hosted screen sharing

This blog post is about a project that I have built, which is called DeadSimpleScreenSharing 2, which the next version of DeadSimpleScreenSharing, and it is much better and faster than the previous version.

It offers audio conference out of the box and supports sharing your screen with any number of users just by sharing a URL, and it is very high quality and super fast.

I am also offering a self-hosted version of the application that you can run on your own server, and the self-hosted version is also white label so you can rebrand it with your organisation’s brand name.

So, here is how you can use this super simple service:

Step 1: Go to http://deadsimplescreensharing.com and click the “Host a Meeting” button

Step 2: It will take you the chrome extension page, where you’ll have to install the extension

Step 3: After installing the extension, click the extension icon, and a window will appear, in that window click the “Host a Meeting” button

Step 4: Done! Your screen is being shared, you can share the URL with others so that they can join your session.

Using Postgres with Parse Backend

Facebook killed parse last year, but thankfully they Open-Source the parse backend. Initially, the Parse Backend only supported MongoDB database, but later support for  Postgres has been added by the contributor from the community.

So using Postgres with Parse Backend is really quite simple, you just have to install the latest version of Parse Backend, and in the databaseURI specify the Postgres connection string.

Here is an example:


 

As you can see in the example above we have specified the connection string to connect to the Postgres database.

If you are not familiar with the structure of the connection string, then here is the breakdown.

If you have any question, please leave the comment below.

 

The definitive guide to being super productive in life.

In this blog post we will discuss ways in which we can be more productive.
To answer this question we must first ask what do we want to become productive in.

Productivity is always in context to work. What work we want to do first need to be determined.

What do we want to do Everyday?

We got only one life to live and we have to decide what we are going to do with it.
To do that we will have to do certain things.

Think about what do we want in our lives, When we get old What would we consider a life well lived?

Write those things down and write down what we are going to sacrifice for it cause nothing in life is free.
Everything we do in life, every opportunity we take, we lose other opportunities we could have taken.

In finance we called this opportunity cost. If you are investing in bonds you are losing out on the opportunity of investing in stocks and losing out on investing in real estate and all other investments we could have made.

When choosing a way of life, you are losing out on all the other ways of life that you could have lived.

When living a life, always consider your options before starting, cause as time passes we are set in our lives and it becomes somewhat difficult to change our ways. We should do so if we still have the chance. Cause you can’t live a productive life if you don’t like what you are doing.

If you ask me what my goals are, this would be the list:

  1. Being an awesome entrepreneur, giving my company and my client the best work of my life. Getting the kind of work satisfaction that you get when you know that you have done the best work you have ever done before.
  2. Having time for my family and friends.
  3. Earning a lot of money.
  4. Having time for my hobbies like video games.
  5. Heaving good health physical as well as mental.

At this point in time, this is what I want in life. This could change in the future because of new knowledge or circumstances. But, for now I am pointing my life in this direction

Importance of time.

Time is the only commodity we all get the same. You and I have got the same 24 hrs a day as Beyonce, Tim Cook, Mark Zuckberg or any other human being in the world. Time is the most expensive commodity in the world cause No matter how much amount of money or power you have, you don’t get 25 hrs a day.

“ If you love life don’t waste time, for time is what life is made up of”
— Bruce lee.

I give my time and the time of others highest priority.
I spend my time like I spend my money doing a price/ value analysis. What is the value I am getting after investing x amount of it. Is the value sufficient enough for me to be investing time in it. If I think I will be regretting it later I don’t invest my time in the activity. Now, value could be rest, entertainment, work satisfaction, time spend with family etc.

More people than not hear this advice and ignore it. Saving little bit of time is like saving and investing money, You save a little time here and a little time there and you have a lot of time to do the thing you really wanted to do but didn’t have time for.

An important way to maximise time is dividing your day into fifteen minute slots and giving specific work some slots of that time.

Venture capitalist Vinod Khosla does this in his life.

Reducing Clutter

There are two kinds of clutter

  1. The clutter of mind
  2. The clutter of physical stuff.

Files on the computer, notifications from twitter, Facebook, email subscriptions you don’t read. These all things competes for your attention,

apart from these, the clutter in your office at home, things that you buy and have no use of or the things which you brought at some point in time and are just lying around all contribute to clutter, and it creates the nagging feeling that some works need to be done and is not done yet, bills needs to paid etc.

Clutter reduces the ability of your mind to think clearly. It reduces the ability of the mind to focus and to process information according to neuroscientists at the Princeton university (https://unclutterer.com/2011/03/29/scientists-find-physical-clutter-negatively-affects-your-ability-to-focus-process-information)

Avoid Multitasking

Doing many things at once. Checking email, writing up a presentation, doing research.
We all do multitasking to one point or the other, but why do we do it, cause

“Multitasking gives a great feeling of work being done”

but, actually little or nor work is done when you multitask according to research done by Zeng Wang [http://researchnews.osu.edu/archive/multitask.htm]

According to research multi-taskers are really bad at work, doing multitasking not only

  1. takes up a lot of time for work to be done.
  2. Reduces the quality of work done.

Why?

Believe it or not, when we multitask, we don’t really work on multiple projects simultaneously. We can only really work at one project at a time. We switch context when we start working on the other thing at hand so in reality we really are doing
one job for a little amount of time and then switching over to the next job.

While this happens our brains has to have the relevant information about the work at hand and has to do rational thinking about it as well.

As we switch more and more contexts brain gets tired and slow and loses its flow.
hence multitasking
we make mistakes
It takes a lot of time
gets us real tired

All for nothing, Instead single work at a time saves a lot of time energy and results in great work done

this is what I do personally on my life

I do one and only one thing at a time.

If I am working I am not browsing Facebook, Imgur or reddit for leisure.
If am riding my bike I am not thinking about work.
If I am spending my time with family, I am not thinking about any other things.

Having discipline in life

One of things in life to live happily is to have discipline in life. Making your own rules and living by them.

”If a person can control himself, he can control the world.”
— Ancient Indian saying

Controlling oneself is one of the most difficult things in life. But, the rewards are so very great. You can have the best goals and the best plans in your life but without a disciplined approach its useless.

According to study by Wilhelm Hoffman

”People with high self control are happier than those without.”

Ways to achieve self discipline.

According to research done at Stanford University.
Will power works like a metamorphical muscle, the more with exercise it along with good nutrition and sleep it gets better with time.

So, if you want to have self discipline.

Eat healthy.
Exercise or go for a walk.
Research suggests that walk reduces stress levels, increases creativity and improves self discipline. If you fail sometime, forgive yourself and start again with renewed rigour.

Deciding on what to do tomorrow.

Having a clear plan as to what you are going to do today helps a lot. Usually take a lot of time thinking what they are going to do today and managing and replying emails and other stuff in the morning. Which is a really bad time to do this sort of thing.

Cause it takes up a major chunk of the morning time and by noon you haven’t really done anything and there is a whole lot of work remaining. Invariable there is stress.

I used to waste my morning on emails and scheduling. But, I learned if I did these things in the evening before leaving the office. I have my work set of for tomorrow morning. You won’t believe the kind of work that gets done by noon if you don’t have to go through that scheduling and emails.

Delegating tasks, saying NO and minimising distractions

You should not really do everything your self. But delegating tasks reduces the things your brain has to think about.

That is a really very very nice things.

The less things you have to think about, the more deeply you will think about them.

a lot of psychological studies states that the brain is like a muscle gets tiered by making decisions. It has a limited capacity to make decisions and this capacity get recharged after sleeping. That capacity will invariable increase as you use the brain, but in the short term it is constant.

Use that capacity of brain on the goals of your life and delegate as much small stuff as you can.
Try to minimise/avoid the distractions and rather than abstaining from them.

Many well known personalities wear same clothes daily, so as to avoid thinking what they have to wear today.
Examples include:

  • Steve Jobs Black turtleneck blue jeans
  • Albert Einstein grey suit no socks and unkept hair.

How to get customers for your startup- A comprehensive guide.

Marketing and selling products and services for your newly created startup can be a difficult preposition. But, it can easily be done if we think about it logically.

Let’s Start:-

For the sake of understanding, let’s assume we have a SaaS (Software as a Service) startup. We sell something that helps early stage entrepreneurs build their enterprises.

Defining a Persona

Now lets have a look at who our customer is and try to build a persona of our ideal customer.

Some things to consider:

  • Gender
  • Age
  • Martial status
  • Education
  • Income
  • Interests
  • Aspirations in life.
  • Employment.
  • Where does he/she lives

For our startup, our customer is the founder of an early stage startup, and his name is Mike.

  • Mike is a male
  • He is 27 years old
  • Mike lives in San Francisco,
  • Single and a graduate in business,
  • Mike has a job and makes around 100k/ year.
  • He wants to start a startup and make it big in life.
  • Mike does’t know programming or design and has to rely on other people for these skills.

Now, we have got Mike but,
Mike doesn’t know about us
nor about our awesome product that is going to help him make it big.
We have got to find him and tell him.

Where can we reach mike?

We might be able to meet mike in places where he generally hangs out, like:

On the Social media sites:

  • twitter
  • facebook

And Website which provides startup news and updates:

  • product hunt
  • betalist
  • hackernews
  • inbound.org

Apart from this Mike is also reading stuff about entrepreneurship and success on sites like:

  • entrepenuer.com
  • thenextweb
  • lifehacker
  • Medium
  • Forbes
  • VentureBeat
  • etc.

Mike also does a lot of things in the physical world:

  • Mike visits technology meet-ups.
  • Mike visits coffee shops, building his business plans
  • Mike visits trade fairs.

What does mike want ?

Since Mike is starting a early stage startup, he is probably looking for ways to:

  • build a website,
  • Build his product
  • Market his product,
  • Looking for people in his network who might be be interested or willing to help him with his startup.
  • Maybe he is trying to pitch his idea to investors
  • Looking for a small office space or a Co-working space among many other things.
  • Mike might even be looking for his early employees or freelancers perhaps. That might be designers and
    developers to help him build his product.

At this point in time we have got Mike with his early stage startup and we know what does Mike wants and the places where he hangs-out and the people he hangouts with.

Now we have got to get to Mike and help him succeed in his startup.

Why do we want to do that ?

Because Mike does not want to buy our SaaS product. Mike wants to succeed in his business. And we are not going to sell our SaaS product to him. Mike will buy a resource from us that is going to help him achieve success in his business.

Marketing that does not look like marketing is the best kind of Marketing.

Up till now what we have done is

  1. Customer Profiling: Identifying who our customer is.
  2. Identifying distribution channels: Finding out where our customer is.

From now on, We will help our customer find us.
There are two ways we can get this done.

  1. In the physical world.
  2. Over the internet.

We can choose both ways or we can choose any one based on our resources and which we think might work best for our product.

The Physical World

We can go to the meet-ups, where mike is hanging out.
To the coffee shops where he is working on his business plans.
To the trade fairs where he might visit to sell his product.
Out-side Co working spaces where he might be visiting.
We can talk to him and tell him about our product and how we can help him.

OR

We can
Find out his contact number/email and call him or email him.

Cold calling is an awesome sort of Marketing, you just need to know whom to cold call and how to execute. People out there have real problems to solve and if we can help them. It is going to be great business.

(One of the biggest examples of cold calling working is today’s business environment is AppAftercare  app maintenance business by Einar Vollset.

It is an awesome company, He even runs a course explaining how he markets his products.)

And we can speak to Mike, tell him how awesome our product is and how he is going to be huge success by using it.

Over the internet

We have already figured out where Mike hang outs over the internet, We just need to reach out to him and help him out with his Business.

  1. Building a Side Project.
  2. Teaching.
  3. SEO

1. Building a Side project.

A side project can be a website or a tool that does some kind of leg work for Mike.
For example
Mike needs to get a lot of things done.

He needs a Website, a logo, he needs legal stuff done, he needs to find designers and developers, he needs productivity tools. He needs to learn basics of coding or design. He needs photos for his blog or social media posts etc.

If we can build a tool or a side project that can help Mike in achieving his objective. He is going to come finding us.

One of the awesome companies that are doing this kind of thing is: Buffer

Buffer is company that helps entrepreneurs schedule their social media posts. They need to attract people who are into social media.

They have a side project called:

  1. Pablo is website that helps you design images for your social media posts. This solves a big problem for Entrepreneurs and social media marketers.

When Mike is searching for photos for twitter post and he stumbles-upon Pablo.
He gets to know that there is this SaaS company called Buffer which helps him save time
on his social media marketing and he is likely to buy from them.

2. Teaching

Blogging is a very well known tool for inbound marketing. But what to blog is thing to consider. We need to only blog things that are going to help Mike.

Actionable content, Content from which mike can take away something from and apply to his life and business and get results.

A study by New York Times, claims that the likelihood of an article being shared is the most for articles with
practical utility. articles with actionable content gets shared the most.

Ideas to blog about?

We already know a lot about Mike. Lets just think what would be the core idea Mike would like our advice on?

Answer: Entrepreneurship and success.

Well, this is just one thing. What are the other complimentary things we could help Mike with.

Complimentary ideas

  • Productivity
  • Marketing
  • Getting startup ideas
  • Validating startup ideas
  • Building an MVP.
  • Getting funding etc.

Apart from writing an article, you could also make video or podcasts or slide-share. But the basic idea between all these mediums is the same, that is to help the customer achieve success in his/her pursuits.

And writing an article is just not enough. We will have to tell Mike we exist and here is an awesome article which would be a great help to him.

Distributing your Side Projects/Articles and doing SEO:

Well we have a great SaaS product, a great tool to help Mike and we are also writing awesome articles.

How are we going to make Mike come to us?

Well we know where Mike hangs out on the internet. We can just through stuff on the social media and hope and pray that Mike reads OR we can be proactive in our efforts to reach Mike.

Here’s How:

Now, there are certain people on social media who are called influencers. These people have a large amount of following.

We will need to find out certain influencers who would be interested in distributing our free tools and blog articles to their network of people on social media.

How we are going to do that?

With a certain tool called as Followerwonk, which is available at MOZ.com It helps us sort influencers on twitter with certain keywords in their profile or bios.

for example. If our tool is an open source product. we will sort people with open source in their bios and see if they post other people’s open source products on twitter.

Then we will contact them and ask them to distribute our product.

We could do something similar for product hunt as well. Product hunt is an awesome network that lists digital products.
Though we don’t have followerwonk for product hunt. Product hunt has hunters and we can contact them on twitter and ask them if they will hunt our product.

This same thing we are going to do with our Blog article. One thing to remember though: The quality of our content should be top notch. The better the quality of our product the more viral it will become.

One very good side effect of this will be people will start linking to our blog or free product page.
For example some one is writing some post and they might link to us as a reference. This is going to increase our SEO.

Or someone might be listing free resources for Entrepreneurs and
businesses and they might list our product.

Alternatively, we can also search for blogs on google.
Just typing in Open source software blogs or Entrepreneurship blogs and Google will give us a list if blogs and we can contact those blogs and ask them if they can list or add a link to our free product site or blog article.

Build an email subscription list:

Always try and build a subscription list. The people who are subscribing to your articles really believe in your content. And you should make them search for your articles from time to time.
They are a dedicated audience and dedicated traffic to your blog. Do your upmost to make it really easy for them to signup to your mail list.

What is SEO ?

SEO is search engine optimisation. What is means is that When mike does a google search for a product or problem that we could solve our website ranks higher in the search ranking.

To increase search ranking there are many things Search Engines consider. Among them are

  • Keywords
  • Number of links connecting to our site
  • Traffic coming to our site
  • Number of social media posts of our site.

What are Keywords?

Key words are words Mike might type into the search engine bar to find something he wants to find.

For example if Mike wants to hire a mobile app development company, He might search
mobile app development companies in San Francisco. or hire mobile app developer.
We need to research keywords that are relevant to our industry and customer

Typically we should try to rank in the top three keywords our customer would search.
Now there are two kinds of SEOs.
Onpage and
OFF page.
Here is a very good guide to Onpage SEO.

For finding out keywords
Think

“will searchers really find what they are looking for when they search using using these keywords?”

Or

Find out what key words competition is using. Tools like Open web explorer and SEM Rush are a great for this kind of research

and google keyword planner is another great tool for keyword research. It tells you how much traffic is there for a particular keyword. It even tells you how much difficult it is to rank for a particular keyword.

And we already have been doing a lot of off page SEO by building free products and Blogs.
Just be sure to sub-domain your free product page and blog site to your startup site.

After getting an understanding of keywords. DO a quick on page SEO. It doesn’t take much time is simple to do and the results are for ever
here is a quick guide.

These key word tools tools will also come in handy when distributing blog articles

Doing Paid Ads.

If we have the budget or if we want to do experiments we can use paid ads for this purpose.
Building a paid ad is an skill unto itself
We will need to answer questions like these ?

What is the goal of the ad?

The goal could be to drive signups, or
influencing people to read our blog post
or
converting people to buy our product.

What keywords to target?

Key word targeting in ads is a skill. You need to find key words that drive traffic but aren’t that expensive to buy.
We discussed some of the tools we could use above.

Which platform to choose?

Ideally we should only choose platforms where our customers visit (mike). Another thing to consider is what mood mike is in when he is on a particular platform.

Research shows that for long form content twitter is a good source, for relaxed entertaining content Facebook is good media.
For getting conventions search engine ads like on google and bing are a good source.

Other things to consider:

What ROI do we want, and at what cost ads are feasible for us.

What does a client pay us VS How much does it cost to get the client is an important thing to consider.

Assuming our goal is to convert the client to buy our product.

Income from client > How much money a single click costs * How many clicks are required to get the client.

##In Conclusion:

Marketing like everything else in life is a trial and error thing. All of the things will not work everywhere.
And running with all the strategies and all the distribution channels that I have mentioned is a not a good idea especially when your resources are limited. Instead try and identify what channels suits you the best and work with it.

So many times it happens that one of the channels brings in more customers than all of the other channel combined.

I wish you best of luck for your adventures.

This blog post is by Mohammed Lakkadshaw. Founder at Mohammed Lakkadshaw & Co. A Mobile and Web design and development company.

Mixpanel Tracking in AngularJS

For my recent angularJS application, I needed to integrate Mixpanel.
I didn’t found any light-weight directives which I could include in the application that would allow me to easily track events using Mixpanel in the application, so I built Mixular.
Mixualr is a lightweight angularJS directive which you can use to track events in your application.

Installation

You can install mixular via bower

Or you can clone the repo from Github

How to use it

To use mixular in your application include the Mixpanel javascript tracking library, and the angular-mixular-directive.js in your index.html

Then add mixular dependency in your AngularJS application:

Once you have added the dependency, you can start tracking events in your application, e.g:

Add the property mixular and specify the events on which you want to trigger the tracking, supported event types are:

  • click
  • focus
    1. hover
    2. keydown
    3. keypress
    4. keyup
    5. mousedown
    6. mouseenter
    7. mouseleave
    8. mouseout
    9. mouseover
    10. mouseup
    11. scroll
    12. select

The eventLabel can be used to specify a label for the event e.g “Banner Ad clicked”.

Passing properties

To pass multiple properties for a event you can type the keyword prop followed by the property name e.g prop-product=“Laptop” prop-price=“500”

That’s all

If you have any questions or suggestions regarding the directive, leave them in the comment section below.

Thanks

Introduction to SalisJS

I was looking for a Node.JS web framework for my project, and in my quest for finding the best framework, I stumbled across Sails.JS, and I have been using it for a few months now and it is pretty awesome at most of the part, so if you need something like Rails for Node.js, Sails is the way to go.

The Sails.JS is an MVC framework, so there are Models, Views and Controllers.

Models:

In Sails.JS you can create models, and model represents the data model, so if for each table you would have a model and in case of no-sql databases, each collection is represented by a model.
Inside a model you can describe, the attributes present in that model, their datatype and validation rules.

Example of a User Model:
user.js

In the above example we have a user model, which has a number of attributes, like firstName, lastName, email and role.
The model structure is pretty straightforward, and Sails.js provides some useful helpers in modules like the enum.
We have added an enum attribute in role, now Sails will accept only the values present in the enum array.

Magic:

The magical part is sails is blueprints. Sails will create CRUD routes based on the data model.
Sails will look at your data-model and will create blueprint routes and REST api.
So, by looking at the model we have created above sails will create REST APIs.
Create User: HTTP POST: /user
Update User: HTTP PUT: /user/:id
Delete User: HTTP DELETE: /user/:id
Fetch User: HTTP GET: /user/:id
Get All Users: HTTP GET: /user

Associations in Model

In Sails you can associate one model with another model, and associations can span across databases.
So if you have user data stored in Postgres and photos stored in Mongodb, you can interact with the data if they lived in the same database.

Many to Many

In this type of association, one model can be associated with many other models and vice versa.
Lets consider an example of a Real Estate, a Real Estate can be owned by multiple people, a person can own multiple Real Estates.
Thus we can create a many to many relationship between people and real-estate.
So, let’s begin:

So, in the above example we have created two models, one is user model and another one is estate model.

In the estate model we have created a property named owner, which reference the user model model and points to the owners of the property, so this will be an array containing all the owners of the property.

In the User model we have created a property named estates, and it points to the estate model and it will contain all the estates owned by the user.

LifeCycle callbacks in Models

There are lifecycle call-backs present in the models which are very helpful, for e.g: If want to can write some cleanup code when an item in a model is deleted, so you can write the code for that inside the afterDestroy method.

Callbacks on create

Callbacks on update

Callbacks on destroy

Consider the example:

To learn more about the lifecycle callbacks, see the official documentation.

Controllers

The main logic of your application will be present in the controllers, the controllers are responsible for responding to the requests.
Although, some magic is provided by Sails, using blueprints to create automatic CRUD API, often times it is not enough and you will want to add more functionality and more types of routes.

Consider an example controller file name greeting.js:

The above file contains two actions, namely hello and hi, inside these actions we can write the code to do whatever we want, in the above example we are sending messages, “hello world” and “hi user” respectively.

Sails has automatic routing, so the controllers and actions that you have created will be routed automatically, by the following format /:controller/:nameOfAction.

So routes for our above actions will be /greeting/hello and /greeting/hi.

Overriding blueprint actions

If you want override the blueprint actions, like create, update or delete, just create actions in the controller with that name and it will override the default functionality.
Suppose we want override the create functionality for user, so in user controller, we will create an action having the name create.

The above code overrides the create functionally, now if we send a http post request at url /user, instead of creating a new user it will send a response “Hello world”.

In the similar manner we can override the default behaviour by creating actions having the name create, update and delete.

Policies

You don’t want anyone accessing and performing unintended activity, like deleting all your real estates, so for that we have policies.
If you are familiar with ExpressJS, polices are similar to ExpressJS middle-wares.
The official SailsJS documentation explains policies in great detail, be sure to head over there and read about it in details.

Conclusion

That’s my take on SailsJS, it’s a great framework to build apps in Node.JS.
Let me know if you have any suggestions, questions about this in the comments.

Better API documentations

image

It is a tedious job to write api documentations, and we have been using word documents and excel spreadsheets to create api documents.
But they are difficult to follow and search though, what if there was an easier and cleaner way to create API documents? When I started working on my latest project I was searching for an efficient way to write API documents and a way to generate beautiful documentations, my quest for finding the best api documentation tool lead me to API Blueprint.

What is API Blueprint?

API blueprint is a language based on Markdown which allows you to write API documents clearly, moreover it has great tools which takes in your api blueprint document and convert it into beautiful html API documentation and much more.

Useful tools:

Here are some tools which I find useful, that you can use with your api documentation written using API Blueprint. These tools make the API blueprint documents very powerful. There are tools generate beautify html documentations to even create mock api servers.

Creating Online documentation:

There is a web app called as Apiary, which allows you to write in api blueprint format, and it generate beautiful online documentations, it also provide mock api server which will emulate your API based on the documentation, which is pretty useful if you don’t have the API server ready yet and want to use the APIs for prototype the applications.
It will allow you to quickly build and test the API, without writing a single line of code.

API blueprint document into html documentation

There is an awesome tool called as Aligo which will allows to create beautiful html documentation from the api blueprint document.

API blueprint document into POSTMAN collection

A utility called as Blueman allows you to convert the api blueprint domination into POSTMAN collection, which you can import into your POSTMAN REST Client.

Local Mock Server

API Blueprint Mock Server create a local api mock server using the api blueprint which you have provided, which you can use to prototype REST APIs.

Building command line apps in Node.js

Node.js is becoming very popular platform for creating command line utilities, so I am writing this blog post to help you get started.

Creating an executable script

To create an executable script you will have to add shebang at the top of the script. E.g:

Assuming you are on a UNIX like system, you will also have to change the permission of the script and make it executable.

and now you can execute the script:

Accepting arguments

You would also want use command line tool to accept arguments, which you can do using process.argv. This is an array which will contain all the supplied command line arguments.

script.js

The above script will print out all the supplied arguments, when executed it will generate the following out:

To remove ‘node’ and path from your script can slice out those arguments:

There several libraries out there that will make the task of accepting arguments easier, but if you are doing something trivial, I would suggest sticking to the default method.
One notable example of such library is cli.

Colors on the command line

If you want to display messages with different colours, there is a nice library called as colors to do it effortlessly.
Install it via nom:

And then include it in your script:

Exit event

If you want to preform some operation on exit, you can listen to the exit event. Once the exit event is called there is no way to prevent the exiting of the event loop, hence you must only perform synchronous operations in this handler.

Exit codes

Node.js provides supports for exit codes, if you script exits without any error, the exit code should be 0. If your script exits with an error it should be 1 or higher.
Exit codes in node.js are passed using process.exit().

Process object

process.uptime()
Returns the number of seconds the script has been running

process.memoryUsage()
Returns an object describing the memory usage

process.pid
The PID of the process

If you have any questions or suggestions feel free to comment.

Mastering web-storm

I am big fan of sublime text, and I use it extensively. Then I came across WebStorm, I like it and I want to learn more about it, because any craftsman should know how to use his tools effectively.
So I was looking for some tutorial and videos on mastering web storm and I came across this excellent video by John Lindquist. I highly recommend that you watch the video.

I have also tried to summarise what’s there in the video, but I recommend that you watch the whole thing, but for those who cannot spare the time to watch the whole thing, here is the excerpt:

Code Inspect:

Webstorm offers a nice code inspector, and to inspect code, right click on any directory inside Webstorm and click inspect Code.
It will give you a list of the issues and warnings and improvements which you can make, and is kind of really useful when your are doing code reviews and stuff like that.

Autocomplete Shortcut: Whenever a small bulb appears in Web storm, it indicated that Webstorm has some suggestions, and you can hit alt+Enter to bring the menu which shows the suggestions.

Go back in time: Webstorm has a nice auto-save feature, you don’t have to manually save things in Webstorm, and when you have changed something and want to revert your change you can go back in time by: Right-click-> local history

Getting things from CDN: When using CDN in script tags and stylesheets src, Webstorm will show a warning, you can hit alt+Enter->Download locally, by doing that it will download the linked file and show autocomplete off that.

Fine tune suggestions: In Webstorm you can fine tune the settings about auto-complete, suggestions, warning and errors.
Click on the lower right hand side corner->on hector the inspector and fine tune the inspection

Keyboard shortcuts:

To learn about keyboard shortcuts, go to
Shorcut Foo

Actions:

Cmd + Shift + A bring the action bar.
Select content, and press cmd+shit+a and select create live template.
And add variable by $name$ and $end$ to specify where the cursor ends.
Webstorm uses velocity template language.

Refactoring

Refactor this shortcut CMD+SHIFT+ALT+T
/+tab automatically generate the document
**Cmd+Alt+V
to pulling out variable.

Open up the file structure: can also be invoked by cmd+f12

To navigate project: cmd+shift+n, wildcard are also supported
s/a/*.js -> source/auto/ and all the javascript
cmd+alt+shift -> type the name of the method
and cmd+shift+i while doing this, will also show preview of the file, and cmd+shift+j while doing that will show documentation if available.

Version control:

Webstrom also has an integrated VCS manager, to bring the VCS Popup hit Ctrl+V.
Webstorm is also integrated with Github, you can easily import your github repos in Web-storm.

External tools:

To add external tools, go to Preference -> External tools and add details about the external tools you want to add, for e.g. Yeoman

File launchers:

If you create a coffee script file, it will ask you to add a watcher, and it will generate the corresponding js file, same if for sass etc.

Dead Simple Screen sharing (DSS) – Overview

Grab source on GitHub

Project site

Sometime ago a developed an open-source screen sharing application called as DeadSimpleScreenSharing which allows you to share your screen with anyone right from your browser.
It requires you to install an extension, when you click “Share your Screen” button on that extension, it will gives you a unique url which you can share with any number of people, and they can view your screen.
In this blog post I will give a brief overview on how this application works.

The Extension:

The DSS requires you to install an extension, a extension is required because there has to be some application running background which listens to tab changes and transmits this data to the server.
The extension uses the chrome extension api’s caputreVisibleTab() method get the visible tab and attaches mutationObservers and listen for DOM changes, when there is a change in the DOM, it transmits the data to the server via web sockets.

The Server:

The server is written in Javascript(node.js) and uses web sockets (socket.io), each session is namespace by unique id which is generate when the user presses the “Share your screen” button on the extension.
The server just receives the data and forwards it to all the connected clients in that namespace.

Get it working locally:

If you want to run DSS locally, you need to have:
1. Node.js installed
2. Install express using ‘npm install express’
3. Install socket.io run ‘npm install socket.io’
and follow along the video.