Sunday, March 25, 2018

C++ Array Declaration Stack Overflow Exception

Error: Stack overflow when declaring a huge array in C++.

Unhandled exception at 0x00007FF60B7040C8 in Tutorial.exe: 0xC00000FD: Stack overflow (parameters: 0x0000000000000001, 0x00000081A80D3000). occurred


Problem code:

#include <iostream>
#include <fstream>

int main()
{
    //do something..

    int nar[10000000];

    //do something more..

    return 0;
}


Friday, February 16, 2018

[How To] Download image from Google

Google has recently removed "View Image" button from its search results. But don't get disappointed, you still can download image from Google searches.

Step 1: Search what are you are looking for in Google, and switch to Images tab from All tab.


Step 2: Scroll google image search page until you find what you want.


Step 3: Click on the image you want to download and click on "Visit" button.

Hide password in Command prompt


@echo off

set "psCommand=powershell -Command "$pword = read-host 'Enter Password' -AsSecureString ; ^
    $BSTR=[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pword); ^
        [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)""

for /f "usebackq delims=" %%p in (`%psCommand%`) do set password=%%p

echo %password%

Wednesday, October 18, 2017

Fix error "Invalid data set: 0" in Perl module GD::Graph

Error Message:
Invalid data set: 0 at D:\New\TOOL\graph.pl line 24.

Problem Code:

my @a1;
my @a2 = [-9,8,0,1,-2,-5,6,-4,3,7];

foreach my $i (1..10)
{
    push @a1, $i;
}

my @data = (
    @a1,
    @a2
);

Solution:

my @a1;
my @a2 = [-9,8,0,1,-2,-5,6,-4,3,7];

foreach my $i (1..10)
{
    push @a1, $i;
}

my @data = (
    [@a1],
    @a2
);

Fix error "Not a valid source data structure" in Perl module GD::Graph

Error Message:
Not a valid source data structure at D:\New\TOOL\graph.pl line 24.

Problem Code:
my $gd = $graph->plot(@data) or die $graph->error;

Solution:
my $gd = $graph->plot(\@data) or die $graph->error;

Complete working code:
#!/usr/bin/env perl
use strict;
use warnings;
use GD::Graph;
use GD::Graph::bars;