The day I removed Cygwin from my %PATH%

I was trying to fix some issues with iamisti/mdDataTable. It was last updated in Dec 2016, and I was facing problem with even basic use of it. It worked when I made some very little tweaks in the dist JavaScript. So, I forked the repo hoping I can add these fixes. So, there was npm install and trouble ensued.

I was seeing seeing fatal error messages like this:

AppData\Roaming\npm-cache\_git-remotes\git-github-com-bessdsv-bower-installer-git-temp-5f628818' does not appear to be a git repository

Then I found this:
https://github.com/npm/npm/issues/7357

smikes mentioned,

the official stance of the npm project is that cygwin is not supported

Cygwin had long been one of my favorite tools. But, its prime days are fading. Specially with full Ubuntu bash on Windows 10 makes any Linux emulator on Windows unnecessary.

So, today, I removed Cygwin from my %PATH% on my Windows 7 (Yes I am still using Win 7 on one of my computers).

ciao.

Advertisements

Irony of language fondness

There is an irony about fondness of language in a programmer’s life. I am not very particular about any programming language, I can read and understand and code in quite a few of those. But, my affection is not same for every language I know, and there is the irony.
My favorite language is C++. It is one of the most powerful languages that we have in the industry. It is multi-paradigm and can be used to solve many, if not all, programming problems. Most importantly, to me, C++ sounds very sweet.
On the other hand, there is C#. It has a very strong affiliation with Microsoft and Windows platform and people are prejudiced about it. Nevertheless, it requires proprietary .Net framework to run on top of. Despite these, C# is an amazing language. Its creator had the opportunity to look back into a long history of many languages and decide very carefully from the experiences we had in last half century. So, C# ended up accommodating a plethora of language features, both in terms of capabilities and syntax. I am very fond of C#.
My current job requires me to program in Java. When, I was first introduced to Java when I was a sophomore I became very fond to it. But, then I learned about C# and C++’s wonders kept on unraveling to me. So, I distanced myself from Java, for more than four or five years, until my MS coursework required me into using it. Now, here is the irony! I started my new job here, in Long Island, and my day to day primary language is now Java. I kept rediscovering a lot of facts about Java, and I started to like it again. Specially, Java 8 brings a lot of things I’d like a high level programming language to have. I am learning new things everyday, and would keep learning about them.
So, the irony is, C++ is my favorite language, I admire C# and my primary language is turning out to be Java. Behold, that is not the end of it. I also have to know JavaScript and Python and PHP and happen to like all of them, more or less. And off course, all these languages have their own utilities.
In the end of the day, it occurs to me that, fondness of languages do not matter after all. Every languages have a lot of things to know about and I’d like to be fluent in at least one of them. I just don’t know which one it is going to be!

Originally posted as a Facebook Note. Continue reading

Running Node.js app as a service forever

When you start a Node.js server simply using node app.js, the server stops as soon as the shell session is killed. But if you want to keep you server running, as a server would naturally should, you need some way to keep the server proc alive.

Forever is seemingly a popular choice for running a server, as the name suggests, forever; or technically as long as you want.

While trying to install Forever, globally, via npm, it was complaining about the version number of inherits. So I did:

sudo npm install inherits -g

and then did:

sudo npm install -g forever

You are ready to run a nodejs server forever. Hence, do this:

 forever start --minUptime 1000 --spinSleepTime 1000 app.js

To make sure your new service is up

forever list

And if you want to stop, use

forever stop <PID/PID>

Node.js server on Azure

It is easy to use Node.js on a CentOS VM running on Azure, or any other linux VM on Azure. You can simply yum (with EPEL) install Node.js. Then an easy way to check if everything is working fine, a good idea is to test running a server from node. I am using this simple snippet:

var http = require('http')

var server = http.createServer(function (req, response){
  response.writeHead(200, {"Content-Type":"text/plain"});
  response.end("Hello World");
});

server.listen(8080);

Now you can start it by typing

node app.js

To access this server that you just started, you need to access this port. This server is listening to port 8080. So you need to enable an endpoint on you Azure VM. Go to Microsoft Azure > yourazurevm > Settings > Endpoints and click add.
Capture
Then set following:
Capture
Endpoint: Any name (e.g. Http 8080)
Protocol: TCP
Public port: 8080
Private port: 8080

Now, hit okay and wait for the VM to enable this endpoint (a.k.a. port).

Capture

After this is enabled, you can now go to http://yourazurevm.cloudapp.net:8080/ and see hello world.