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;

Monday, October 16, 2017

Windows 10 Fall Creators Update and Microsoft Launcher (Preview)

Fall Creators Update is the latest version of the Windows 10 Operating System by Microsoft. It is now available as beta release. To get this update you need to register your Windows 10 account as an Windows Insider. To join the program go to: https://insider.windows.com/en-us/

Windows 10 PC Version History:

Version Code Name Marketing Name
1507 Threshold 1
1511 Threshold 2 November Update
1607 Redstone 1 Anniversary Update
1703 Redstone 2 Creators Update
1709 Redstone 3 Fall Creators Update

Windows 10 version 1507, codenamed "Threshold 1", is the first release of Windows 10. It carries the build number 10.0.10240; while Microsoft has stated that there was no designated release to manufacturing (RTM) build of Windows 10, 10240 has been described as an RTM build by various media outlets.

Windows 10 Fall Creators Update, or Windows 10 version 1709, codenamed "Redstone 3", is the fourth major update to Windows 10 and the third of the four major updates planned under the Redstone codenames. The first preview was released to Insiders on April 7, 2017. It will be available generally on October 17, 2017.

Windows 10 version 1803, codenamed "Redstone 4", is the fifth major update to Windows 10 and the last of four major updates planned under the Redstone codenames. The first preview was released to Insiders on August 31, 2017. It will be available in early 2018.

Friday, October 06, 2017

Monoalphabetic Substitution Cipher in Python

import random

plain_text = "devharsh_T @ $01.2"
cipher_text = ''
decipher_text = ''

alphabets = [chr(a) for a in range(0,127)]
mappings = [chr(a) for a in range(0,127)]

random.shuffle(mappings)

print(alphabets)
print(mappings)

for i in range(len(plain_text)):
  for j in range(127):
    if(plain_text[i] == alphabets[j]):
      cipher_text += mappings[j]
 
print(plain_text)
print(cipher_text)

for i in range(len(cipher_text)):
  for j in range(127):
    if(cipher_text[i] == mappings[j]):
      decipher_text += alphabets[j]
     
print(decipher_text)

Wednesday, October 04, 2017

Monoalphabetic Substitution Cipher in C++

#include <iostream>
#include <string>
#include <ctime>
#include <chrono>
#include <thread>

int main()
{

  char plain[100] = "devharsh";
  char cipher[100];
 
  char alphabets[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
  char mappings[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
 
  alphabets[26] = '\0';
  mappings[26] = '\0';
 
  std::cout << alphabets << "\n";
  std::cout << mappings << "\n";
 
  for (int i=0; i<26; i++)
  { 
    srand((int)time(0));
    std::this_thread::sleep_for(std::chrono::milliseconds(300));
    int irand = rand() % 26;
    char temp = mappings[i];
    mappings[i] = mappings[irand];
    mappings[irand] = temp;
  }
 
  std::cout << alphabets << "\n";
  std::cout << mappings << "\n";
 
  for (int i=0; i<sizeof(plain) / sizeof(char); i++)
  {
      for (int j=0; j<26; j++)
      {
          if (plain[i] == alphabets[j])
          {
              cipher[i] = mappings[j];
          }
      }
  }
 
  std::cout << plain << "\n";
  std::cout << cipher << "\n";

}

Monday, October 02, 2017

Mozilla Firefox Quantum 57+ Legacy Extensions And Alternatives


If you are a Firefox fan than you must have experienced periodical out-dating and temporary unavailability of your favorite extension every time you update your browser. Same thing is going on with the upcoming release of Firefox which is Firefox 57. It will release from November 2017 but if you are on beta channel you can upgrade to it now, from October 2017. If you have upgraded you will notice many extensions are not compatible and since disabled by-default and there is no option available to enable them. These extensions are listed as "Legacy Extensions" which used to be listed as incompatible extensions in previous versions.

From Firefox Official Blog:

In the past, extensions often stopped working each time a new version of Firefox was released, because developers had to update them every six weeks to keep them compatible. Since extensions could also modify Firefox internal code directly, it was possible for bad actors to include malicious code in an innocent-looking extension. To address these issues, and as part of broader efforts to modernize Firefox as a whole, we’ve transitioned to a new framework for developing Firefox extensions. Outside of rare instances, extensions created with the new standard won’t break in new Firefox releases. You can still personalize Firefox with extensions the same way you do now, except they won’t break in new Firefox releases.



I found couple of essential extensions in this list like Adblock Plus and Browsec VPN. I did some lookup and the alternatives you can use are AdBlock for Firefox (https://addons.mozilla.org/en-US/firefox/addon/adblock-for-firefox/?src=ss) and Best Proxy Switcher (https://addons.mozilla.org/en-US/firefox/addon/best-proxy-switcher/?src=search). 

To find alternatives click on "Find a Replacement" button next to the extension and you will be redirected to Firefox add-on pages listing alternative extensions listed under that category.

Java Standard Edition 9 Features And Download Links




Java SE 9

At JavaOne 2011, Oracle discussed features they hoped to release for Java 9 in 2016. Java 9 should include better support for multi-gigabyte heaps, better native code integration, a different default garbage collector (G1, for "shorter response times") and a self-tuning JVM. In early 2016, the release of Java 9 was rescheduled for March 2017, later again postponed four more months to July 2017, and changed again to be finally available on September 21, 2017, due to controversial acceptance of the current implementation of Project Jigsaw by Java Executive Committee, which led Oracle to fix some open issues and concerns, and to refine some critical technical questions.



End of Public Updates for Oracle JDK 8

Oracle will not post further updates of Java SE 8 to its public download sites for commercial use after September 2018. Customers who need continued access to critical bug fixes and security fixes as well as general maintenance for Java SE 8 or previous versions can get long term support through Oracle Java SE Advanced, Oracle Java SE Advanced Desktop, or Oracle Java SE Suite. For more information, and details on how to receive longer term support for Oracle JDK 8, please see the Oracle Java SE Support Roadmap.