Thursday, November 26, 2015

Hosting webserver on Mac with Python

I needed to host a webserver with basic setup to load a file for a project. Here is what I did

1. in Mac, I opened terminal, and went to the folder that had index.html and typed
python -m SimpleHTTPServer 8000
This spit out the following log
Serving HTTP on 0.0.0.0 port 8000 ...
And it hung there. Which is indication that the server is running on port 8000

That is all that you would have to do to host a webserver on Mac with python.

In order to access this file from a different system, we need the name or ip address for localhost.
ip address can be obtained by typing ifconfig in terminal, and getting the inet address of en0 section, if you are connected to the internet via ethernet LAN cable.

Or you can go to system preferences -> Network and get the ip address given in the right side section of the preference window in Mac

After getting the ip address, if you type http://xxx.yyy.zzz.uuu:8000/index.html, it should display the webpage.


Hope this helps. 

Thursday, November 19, 2015

CPPCheck and latest 1.71 version


I normally use CPPCheck to verify the code sanity in my c++ projects. Few days back I tried to update to latest from 1.69 version. I uninstalled 1.69, and installed latest 1.71 from http://cppcheck.sourceforge.net. But when attempting to run the application, it says MSVCP140.dll missing.

Here is how I fixed it, and thought this blog post might help others who also have similar issue.
This dll belongs to MS Visual C++ as the name in the dll suggests. Downloading Visual C++ redistributable for Visual Studio 2015, even though you dont use 2015 version, should fix this missing dll issue. It can be downloaded and installed from https://www.microsoft.com/en-us/download/confirmation.aspx?id=48145


Hope this helps.