Take a look at GC running visually
A simple program that creates a byte array of 100000000 elements and lets print the memory allocations.
package mainimport ("fmt""runtime""time")func printStats(mem runtime.MemStats) {runtime.ReadMemStats(&mem)fmt.Println("mem.Alloc:", mem.Alloc)fmt.Println("mem.TotalAlloc:", mem.TotalAlloc)fmt.Println("mem.HeapAlloc:", mem.HeapAlloc)fmt.Println("mem.NumGC:", mem.NumGC)fmt.Println("-----")}func main() {var mem runtime.MemStatsfor i := 0; i < 2; i++ {s := make([]byte, 100000000)if s == nil {fmt.Println("Operation failed!")}printStats(mem)}time.Sleep(time.Second)// adding time.Sleep so that GC finishes it works and print out the output to terminal}
There is a package in Golang…
Super Simple
Code we will be testing :
package mainimport ( "fmt" "log" "net/http")func main() { http.HandleFunc("/", helloWorldEndPoint) fmt.Println("Server : http://localhost:8080") log.Fatal(http.ListenAndServe(":8080", nil))}func helloWorldEndPoint(
writer http.ResponseWriter,
request *http.Request) { fmt.Fprintf(writer, "hello world")}
<anything>_test.go
, these files are ignore by compilerfunc TestXxx(*testing.T)
where Xxx does not start with a lowercase letter. The function name serves to identify the test routine.go test
Writing Test
You can simply get started with my boilerplate on GitHub :
Or here is the procedure :
Answer: When I tried to create a typescript server with node, I faced issues that weren't addressed in procedures I followed.
So let’s get started
npm init
2. Installing Dependencies :
Install the following dependencies that will get you started
npm install typescript express @types/express @types/node ts-node ts-node-dev
Add tsc in scripts inpackage.json
"scripts": {…
It was amazing!
Disclaimer: I don’t claim to be an expert in any of them. This was just a thought experiment
In the last week of May, I was working on the front-end part of my personal project, which got me frustrated and bored to some extend. So I decided to take 1–2 days off to refresh myself. I decided to take a deeper look at the world of competitive coding (i do solve some questions, but not very seriously). So wandering on the internet I came to this website called code wars. While signing up, they asked to pick…
Also an amazing programming language for mathematical modeling data science, statistics, and machine learning.
For those of you who don’t know what Julia is, here is a quick and short intro :
The hot new server-side high-performance language.
For those of you who don’t know what Golang is, here is a quick and short intro :
We live in a world where Java handles the majority of critical processes, but the thing is, java…
and it’s compiler is just mind-blowing
For those of you who don’t know what Rust is, here is a quick and short intro
In the world where C/C++ powers everything we know, what brings us to Rust? …
It’s super easy !!!
You will be needing the following packages
npm i express dotenv
Inside your project folder, create a file named “server.js” and copy the following contents inside it.
const path = require('path');const express = require('express');const app = express();const port = process.env.PORT || 3000;app.use(express.static(path.join(__dirname, 'build')));app.get('/*', (req, res) => {res.sendFile(path.join(__dirname, 'build', 'index.html'));});app.listen(port, () => {console.log('Server is up!');});
Add git add all your files, commit them and push them to GitHub, we…
When speed meets power !!!
From here, you have 2 options
Just using CPU
Create a file with .ipynb extension and paste the following JSON in it
This article was written in June of 2020, please check for the newer version, if you can find it.
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Julia on Colab.ipynb",
"version": "0.3.2",
"provenance": []
},
"kernelspec": {
"name": "julia-1.2",
"display_name": "Julia 1.2" …
You don’t have to(mostly), just click a button!
Vue.js is probably the best js front-end framework, and Heroku is probably the best PaaS.
npm install express dotenv serve-static
2. Create a file named server.js in the project folder
Add the following code snippet in it
// Server fileconst express = require('express')const serveStatic = require('serve-static')const path = require('path')const dotenv = require('dotenv');dotenv.config();const app = express()// All urls goto to index.html in /dist folder [build folder]app.use("/", serveStatic(path.join(__dirname, '/dist')))app.get(/.*/, function (req, res) {res.sendFile(path.join(__dirname, '/dist/index.html'))})const port = process.env.PORT…