Microsoft is reaching out to Linux developers in a way that the company never has before. “The Bash shell is coming to Windows. Yes, the real Bash is coming to Windows,” said Microsoft’s Kevin Gallo on stage at today’s Build 2016 keynote. The announcement received an uproarious applause from the crowd. The new functionality will […]
Category: Programming / Software Engineering

Javascript Catches And Pitfalls – part1 (equality and comparisons)
Javascript is a programming language originally written in 10 days, buy a chap named Brendan Eich for the Netscape Corporation. However brilliant, Brendan is still just a human, so you’d guess that Javascript was not without bugs and corks. Although a lot has changed since then, a solid number of JS specific “head scratchers” lives […]

Solution to the gcc error: undefined reference to `ilogb’ (C/C++)
The ilogb( ) functions return the exponent of their floating-point argument as a signed integer. If the argument is not normalized, ilogb( ) returns the exponent of its normalized value. Here’s simple program that uses ilogb()
1 2 3 4 5 6 7 8 |
#include <math.h> int main(int argc, char*argv[]){ double x = 1234.5678; int retval = ilogb(x); return 0; } |
Now, if You use this function and get the following gcc linker error: undefined reference to `ilogb’ […]

Random DateTime in the range (C#)
So You need a random DateTime value in some range, and C# Random class does not provide Random.NextDateTime(from, to). Here’s a simple solution for this problem…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
public static DateTime NextDateTime(this Random rnd, DateTime dateTimeFrom, DateTime dateTimeTo) { //Calculate cumulative number of seconds between two DateTimes Int32 Days = (dateTimeTo – dateTimeFrom).Days * 60 * 60 *24; Int32 Hours = (dateTimeTo – dateTimeFrom).Hours * 60 * 60; Int32 Minutes = (dateTimeTo – dateTimeFrom).Minutes * 60; Int32 Seconds = (dateTimeTo – dateTimeFrom).Seconds; Int32 range = Days + Hours + Minutes + Seconds; //Add random number of seconds to dateTimeFrom Int32 NumberOfSecondsToAdd = rnd.Next(range); DateTime result = dateTimeFrom.AddSeconds(NumberOfSecondsToAdd); //Return the value return result; } |
As this method is written as an extension method to Random class, you’ll be able to use it just as a static Random class method (Random.NextDateTime(startDateTime, endDateTime). […]

Experience of having my blog/post #1 hot reddit on programming subreddit for a day.
I have this blog o’ mine for several years now but I’m not super dedicated to it. I was never trying to become a world renown writer/blogger. I use to have several people a day checking the content out, mostly by following links from stackoverflow.com to my blogs with solutions to various programming issues. My […]

It’s all her parent’s fault
I already told this story on my blog before I got hacked and lost everything, and I wanted to bring it back to life, as I find it extremely entertaining and funny. Years back, I was working as a “promising” junior software engineer for a company that specializes in enterprise solutions and services for large […]

Real life example on how NOT to apply for a job in IT
In one of the companies I worked for, I held the position of a senior software engineer which made me involved in our hiring process and all the emails from our info@ and jobs@ email addresses were being forwarded to me (as well as every other senior dev and to HR people). One day, we […]

So I got hacked
In my previous post I mentioned I got hacked. Let me provide you with some details… I have an Amazon Web Services (AWS) account for a while now, maybe a bit over a year which is intended for my personal use. Couple of months ago I needed another AWS account, but this time it was […]

irhadbabic.com Reloaded
Howdy!!! Thanks to recent unfortunate events (my hosting account got hacked) I lost my blog and the whole platform it was running on. I could try restoring blogs and images and recreating them on the new platform, but I couldn’t be bothered. Let’s face it, there’s very few people reading the damn thing :D. A […]