Senger CodeLab 🚀

: All Posts

How to increment a datetime by one day

How to increment a datetime by one day

How to increment the day of a datetime for i in range1 35 date datetimedatetime2003 8 i printdate But I need pass through months and years correctly Any

Read more →

How to initialize static variables

How to initialize static variables

I have this code private static dates array start gt mktime 0 0 0 7 30 2009 Start date end gt mktime 0 0 0 8 2 2009 End date close gt mktime23 59 59 7 20 2009

Read more →

How to pass arguments and redirect stdin from a file to program run in gdb

How to pass arguments and redirect stdin from a file to program run in gdb

I usually run a program as aout arg1 arg2 ltfile I would like to debug it using gdb I am aware of the set args functionality but that only works from the gdb

Read more →

How to perform case-insensitive sorting array of string in JavaScript

How to perform case-insensitive sorting array of string in JavaScript

I have an array of strings I need to sort in JavaScript but in a caseinsensitive way How to perform

Read more →

How to print a percentage value

How to print a percentage value

Given a float between 0 and 1 how to print it as a percentage For example 13 should print as

Read more →

How to round a number to significant figures in Python

How to round a number to significant figures in Python

I need to round a float to be displayed in a UI eg to one significant figure 1234 gt 1000 012 gt 01 0012 gt 001 0062 gt 006 6253 gt 6000 1999 gt 2000 Is there

Read more →

How to use custom packages

How to use custom packages

Im trying to create and use a custom package in Go Its probably something very obvious but I cannot find much information about this Basically I have these two

Read more →

HTML5 Audio stop function

HTML5 Audio stop function

I am playing a small audio clip on click of each link in my navigation HTML Code ltaudio tabindex0 idbeepone controls preloadauto gt ltsource srcaudioOutput

Read more →

Infinite loop in useEffect

Infinite loop in useEffect

Ive been playing around with the new hook system in React 167alpha and get stuck in an infinite loop in useEffect when the state Im handling is an object or

Read more →