Tuesday, February 6, 2024

Running Golang Code Snippets in Jupyter Lab

The following docker command starts the Golang Jupter Lab notebook:

docker run -it -d -p 9000:8888 --name mygo -v <your-dir>:/notebooks/host janpfeifer/gonb_jupyterlab:latest


Tuesday, April 18, 2023

Running C++ Code Snippets in Jupyter Notebooks

When I first encountered C++ on Jupyter Lab, I was excited to start experimenting with the Dockerfile for the same. Previously, I posted a Dockerfile in my post Programmer's Quest: C++ in Jupyter Docker (progquest.blogspot.com), but it is outdated.

Please use the following Dockerfile going forward. This docker works fine for all C++ (C++11, C++14 & C++17):
FROM docker.io/jupyter/scipy-notebook:latest

RUN mamba install -yn base nb_conda_kernels \
    && mamba create -yn xeus-cling xeus-cling boost \
    && mamba clean -qafy

>> docker build --rm -t mycpp-jupyter .

>> docker run -it -d -p 8888:8888 --name mycpp -v <your dir>:/notebooks mycpp-jupyter

Saturday, August 7, 2021

C++ in Jupyter Docker

Now, you can run C++ code snippets in Jupyter Nottebook.

Docker File

FROM frolvlad/alpine-miniconda3

RUN conda install -y -c conda-forge bash jupyter jupyterlab jupyter_contrib_nbextensions

RUN conda install -y -c conda-forge xeus-cling xtensor xwidgets widgetsnbextension

RUN apk update

RUN apk add nodejs npm

RUN jupyter labextension install @jupyter-widgets/jupyterlab-manager

RUN mkdir /work 

WORKDIR /work

CMD jupyter notebook --allow-root --ip 0.0.0.0

 

Building Docker

docker build --rm -t jupyter-cpp .

Running Docker

docker run -p 8888:8888 -it -d -e JUPYTER_ENABLE_LAB=yes -v <your dir>:/work --name <docker-name> jupyter-cpp

Use the "docker logs <docker-name>" command to get the URL & Token for the Jupyter Notebook.

It supports C++11, C++14 & C++17. 

Thursday, June 24, 2021

Dockers for Jupyter Notebook

 Docker are like mini-Vms but without any kernel of its own and shares the host's kernel. Dockers are implemented based the Linux Kernel virtualization tools like Namespaces & C-Groups.

In the past few days I was trying to install and run Jupyter Notebook in my Windows PC, it has become increasingly frustrating as it takes a lot of time to install and has lot of other shortcoming.

Finally, I gave up installing Jupyter Notebook on my Windows PC, instead I used Docker to install the Jupyter Notebook in my Linux Mint Virtual Machine.

The best and easy way to run Jupyter Notebook Docker is by the following command:

docker run -p 10000:8888 -d -e JUPYTER_ENABLE_LAB=yes -v <your-work-dir>:/home/jovyan/work --name myjupyter jupyter/datascience-notebook

Use the "docker logs <docker-name>" command to get the URL & Token for the Jupyter Notebook.


Friday, November 27, 2020

My Choice

There are lots and lots of Programming Languages in today's world. More and more are proliferating each and every day.
So, some of the people ask me what are languages we need to learn. I tell them that my Choice are:
  • C++ - my favorite
  • Python - scripting language - very fast, very minimal syntax, vast library
  • Haskell - Functional programming language of my choice
  • Nodejs/JavaScript - Web Scripting & Server Scripting
  • Golang - Versatile - combines the elegance of C++ and power of Python

Tuesday, September 17, 2019

MinGW - C++ 8.0 by Stephan T. Lavavej

Stephan T. Lavavej has compiled MinGW with the latest C++17 supporting compiler:

https://nuwen.net/mingw.html

Sunday, September 18, 2016

Unix Internals - With C Programming Examples-2

Print all the environment variables using the envp argument in main() function.


/* Program to Print Environment Variables
 * Program Name : prenv.c
 *
 */
#include <stdio.h>
int main(int argc, char *argv[], char *envp[])
{
    int i = 0;

    while (envp[i]) {
        printf("Environment Variable : %s\n", envp[i]);
        i++;
    }
    return 0;
}



Print all the environment variables using extern variable environ.

/* Program to Print Environment Variables
 * Program Name : prenvv.c
 *
 */
#include <stdio.h>

extern char **environ;

int main(int argc, char *argv[])
{
    int i = 0;

    while (environ[i]) {
        printf("Environment Variable : %s\n", environ[i]);
        i++;
    }
    return 0;
}


The output of both the programs are same.

Program Output:


$ ./prenv
Environment Variable : _=./prenv
Environment Variable : HZ=100
Environment Variable : SSH_TTY=/dev/ttyp0
Environment Variable : PATH=/bin:/usr/bin:/usr/gnu/bin:/sbin:/usr/local/bin
Environment Variable : HUSHLOGIN=FALSE
Environment Variable : EDITOR=emacs
Environment Variable : SHELL=/bin/ksh
Environment Variable : HOME=/home/reemus
Environment Variable : TERM=xterm
Environment Variable : PWD=/home/reemus/prog/cprog
Environment Variable : TZ=EST5EDT
Environment Variable : ENV=/home/reemus/.kshrc
$