Posts

Auto refresh not working on VSCode - Linux

I recently switched from Windows to Linux on my old home computer because my main laptop was broken and i had to get some work done. When i started Vscode on Linux i noticed that changes are not being auto detected for files bound to GIT. Digging further i learned that you have to have auto refresh : enabled from Vscode settings , which turned out to be ok in my settings. Then i googled some more and saw a lot of people asking the same question on various forums. However , after clicking around frantically for a while i figured out the problem. If you open Vscode from the Folder context menu by clicking on Open with  Vscode then it doesn't pick up the changes for some reason. But if you open Vscode by simply typing code <path to project> then it opens without an issue.  So that is the result of my Sunday morning investigation. My Linux distro is Linux mint 19.3

Installing XDebug on Windows + XAMPP + VSCode

Image
So i'm not the most proficient PHP guy out there. In fact i have been a .NET developer most of my life. Being so i am so used to having a formidable debugger at my disposal as we were raised on Visual Studio which has excellent debugging capabilities. Because of that fact the first thing i wanted to setup when i was handed a PHP project was setting up Debugging ! I asked some of friends and most of them were using some sort of printing mechanism but no , your boi gaba does not get down like that so i decided to setup debugging and ended up going for XDEBUG  which i absolutely loved! My setup was Windows 10 + XAMPP + VSCode as the IDE ,working on a Laravel project. So when i first setup XDEBUG on my machine , i followed this great article   which taught me how to set things up. After setting up i used and enjoyed XDEBUG to the fullest for about a year on my machine. Then today , i had to transfer to a new computer so i decided to set up my beloved XDEBUG on my new mach...

Finding Partitions of a number

So recently i got a question from my friend Sameera who had this requirement.  Given a number N , he wanted to generate all possible combinations of n1,n2 where n1 + n2 = N For example if i give you 25 , you should output : 1,24 2,23 3,22 4,21 5,20 6,19 7,18 9,16 10,15 11,14 12,13 But he had an additional condition as well , these number pairs should not contain  an addition which involves a carry  .  ( As a non native English speaker this is the first time i even heard that word :) ) So that means in the above example if i gave you 25 , you should only output: 1,24 2,23 3,22 4,21 5,20 10,15 11,14 12,13 Notice that i have left out  6,19 7,18 9,16 Because adding them involves transferring 1 digit from one place to another. ( Please excuse my language as i am not a mathematician or well versed in maths so im trying to explain this in layman idiot terms here ). Ok , so in add...

Sending a POST request in Simple Javascript

So recently i wanted to send a POST request to one of my backends using only simple plain Javascript. Found this code on Quora which worked nicely. Code : xhr = new XMLHttpRequest (); var url = "url" ; xhr . open ( "POST" , url , true ); xhr . setRequestHeader ( "Content-type" , "application/json" ); xhr . onreadystatechange = function () { if ( xhr . readyState == 4 && xhr . status == 200 ) { var json = JSON . parse ( xhr . responseText ); console . log ( json . email + ", " + json . name ) } } var data = JSON . stringify ({ "email" : "tomb@raider.com" , "name" : "LaraCroft" }); xhr . send ( data );

How to Debug NodeJs Easily

Found this great article on how to easily debug NodeJs using VSCode https://medium.com/the-node-js-collection/debug-your-node-js-app-in-60-seconds-9ee942a453f0

Angular for Dinosaurs : How i got started after being out of the game

Image
So you are a software developer who has been living away from the action for a while and suddenly when you came back to the real world , everyone is talking about all these fancy JavaScript frameworks and you have no effing clue how to get started ? Do not worry as your man gaba was on that same place a few months back . I used to work in a product company for 5 years , during that time i hardly had time to work with any new technologies specially JavaScript ( despite being a front end developer earlier in my career ). So finally when i decided to try my hand at Angular , needles to say i was confused with all the jargon and fancy JS stuff going around. But after a few months of effort i was able to come to terms with Angular and now i can say that i can manage an Angular project on my own! Of course i am no expert , but i'm good enough to manage the day to day work using the popular framework. So without further delays let me tell you how i crawled from under the rock an...

Mysterious Errors in Visual Studio

Today i encountered this weird error after i upgraded one of my Kentico   projects to a new version.  The problem was , i added newer versions of some existing DLL file references to my Visual Studio solution and when i ran the build , it gave me mysterious errors ! Mysterious because even though there is no error seemingly , it gives the red error message and the whole deal. So after much googling i realized that it was my stupid mistake which caused all of this.  Cause of the error was : My project was built on an older .NET version than the one which the new DLLs were built on. So i did not get a clear error message but some generic "missing references" message. p.s - I know i am too stupid to not infer the cause from the "missing reference" message :P . But i will just post this for any future idiots like my self stuck in a rut.