29 November 2015

07 November 2015

Get through the certificate problems which show "This connection is untrusted"

At some places, the SSL security certificates used, don't get recognized properly and users are put through the hassle of adding an exception an innumerable number of times to connect to perfectly valid websites. This is the screen you get to see on Firefox:


Instead of always clicking the "Add Exception" button, I searched if there was something I could use to get rid of this error. Turned out that Firefox had an addon named SkipCert which automatically adds the exception and in a few seconds, you'll be taken to the website you wanted to view.


Get the addon here: https://addons.mozilla.org/en-US/firefox/addon/skip-cert-error/

As for Chrome, these appear to be the solutions: http://superuser.com/questions/104146/add-permanent-ssl-certificate-exception-in-chrome-linux


Using TBB's concurrent containers

When searching for a tutorial on TBB's concurrent containers, you might end up finding a 1 minute video on it which doesn't play because you don't have Flash installed, or might just want a tiny program to show how to start using it. This blog post shows you exactly that!

You can use a TBB concurrent vector exactly like you use an std::vector.

#include <iostream>
#include <tbb/concurrent_vector.h>

int main(int argc, char** argv)
{
    tbb::concurrent_vector vec;
    tbb::concurrent_vector::iterator vecIter;
    vec.reserve(100);
    vec.push_back(1);
   
    for(vecIter = vec.begin(); vecIter != vec.end(); vecIter++)
    {
       std::cout<< *vecIter << "\n";
    }//for
   
    vec.clear();
   
    return 0;
}//main



Just make sure you

  • Include TBB's includes folder (/usr/local/tbb44_20150728oss/include/)
  • Point the project to TBB's lib folder (/usr/local/tbb44_20150728oss/lib/ia32/gcc4.4/libtbb.so)
  • Add TBB's lib folder to LD_LIBRARY_PATH in ~/.bashrc. (export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/tbb44_20150728oss/lib/ia32/gcc4.4/")


For concurrent queue, the pop function is different.

#include <iostream>
#include <tbb/concurrent_queue.h>

int main()
{
    tbb::concurrent_queue q;
    q.push(10);
    q.try_pop();//This is thread safe. Better than using if (!q.empty()) {q.pop();}
}//main


A C++ debugging helper

When working with C++ and you're in debug mode, you might be accustomed to these:
  • Using a lot of std::cout statements.
  • Seeing a clutter of outputs.
  • Introducing a lot of temporary code which you don't want to be part of the final build
  • Commenting out useful code which you don't want others to delete later because it's useful

and more...

I needed a way of color coding various outputs, so I used this:

/* Include this hpp file in any file where you need to output
 * cerr or cout.
 * 
 * Usage: In your code, instead of typing std::cout<<"Hi";
 * Just type cout("Hi");
 * Same way, instead of std::cerr<<"Error"; just type cerr("Error");
 */

#ifndef DEBUGHELPER_HPP
#define DEBUGHELPER_HPP

#define DEBUG_MODE

#define USEFUL_CODE_TEMPORARILY_COMMENTED_OUT_DONT_DELETE_IT
#define CODE_FOR_TESTING_FEEL_FREE_TO_DELETE_IT

#ifdef DEBUG_MODE
    //Colour code by Vaughan Schmidt. http://www.codebuilder.me/2014/01/color-terminal-text-in-c/
    #define RESET   "\033[0m"
    #define BLACK   "\033[30m"      // Black
    #define RED     "\033[31m"      // Red
    #define GREEN   "\033[32m"      // Green
    #define YELLOW  "\033[33m"      // Yellow
    #define BLUE    "\033[34m"      // Blue
    #define MAGENTA "\033[35m"      // Magenta
    #define CYAN    "\033[36m"      // Cyan
    #define WHITE   "\033[37m"      // White
    #define BOLDBLACK   "\033[1m\033[30m"      // Bold Black
    #define BOLDRED     "\033[1m\033[31m"      // Bold Red
    #define BOLDGREEN   "\033[1m\033[32m"      // Bold Green
    #define BOLDYELLOW  "\033[1m\033[33m"      // Bold Yellow
    #define BOLDBLUE    "\033[1m\033[34m"      // Bold Blue
    #define BOLDMAGENTA "\033[1m\033[35m"      // Bold Magenta
    #define BOLDCYAN    "\033[1m\033[36m"      // Bold Cyan
    #define BOLDWHITE   "\033[1m\033[37m"      // Bold White
    #define CLEAR "\033[2J"  // clear screen escape code
    #define coutBlack(x) (std::cout << BLACK << (x) << RESET)
    #define coutBoldBlack(x) (std::cout << BOLDBLACK << (x) << RESET)
    #define coutRed(x) (std::cout << RED << (x) << RESET)
    #define coutBoldRed(x) (std::cout << BOLDRED << (x) << RESET)
    #define coutGreen(x) (std::cout << GREEN << (x) << RESET)
    #define coutBoldGreen(x) (std::cout << BOLDGREEN << (x) << RESET)
    #define coutYellow(x) (std::cout << YELLOW << (x) << RESET)
    #define coutBoldYellow(x) (std::cout << BOLDYELLOW << (x) << RESET)
    #define coutBlue(x) (std::cout << BLUE << (x) << RESET)
    #define coutBoldBlue(x) (std::cout << BOLDBLUE << (x) << RESET)
    #define coutMagenta(x) (std::cout << MAGENTA << (x) << RESET)
    #define coutBoldMagenta(x) (std::cout << BOLDMAGENTA << (x) << RESET)
    #define coutCyan(x) (std::cout << CYAN << (x) << RESET)
    #define coutBoldCyan(x) (std::cout << BOLDCYAN << (x) << RESET)
    #define coutWhite(x) (std::cout << WHITE << (x) << RESET)
    #define coutBoldWhite(x) (std::cout << BOLDWHITE << (x) << RESET)   

    #define cerr(x) (std::cerr << (x))
    #define cout(x) (std::cout << (x))
    //... etc
#else 
    #define cerr(x)
    #define cout(x)
    //... etc
#endif

#endif // DEBUGHELPER_HPP

Not only are the cout's easier to type now, they are also easy to disable.
 
UPDATE: As someone commented below, you could use a logger too, but the #defines helped me in the specific way I wanted.

25 October 2015

Aha!

 Continued from the previous Aha!.


The road hump jump
Share with this link



Continued in the next Aha! 
 
 

14 October 2015

Do recruiters still need to ask for resume / CV printouts?

In a digitized world, it is quite a paradox that companies still require interviewees to bring a printout of their resume or interview invite email.


If the phrase"save trees" makes you roll your eyes, then please feel free to stop reading. The rest of this blog post requires a more creative and inventive mind to interpret it.


Why in the world would you require printouts?

Assume a company conducting just 100 interviews every three months.
  • That's 100 * 3 sheets of paper on average * 4 quarters a year = 1200 pages.
  • For 3000 companies in a city, that's = 1200 * 3000 = 3.6 million pages a year!!! With that much of paper, you can make 293.49 copies of the Indian Constitution. The bulkiest constitution in the world! As for cost, that'd be 7.2 million Indian Rupees.
  • And oh...in terms of trees, that's 432 of them.
  • On top of that, you also want candidates to carry a printout of the interview call email?
  • Some companies even expect candidates to carry and submit photocopies of their marks card and resume even if they have not yet been selected by the interviewer (when you ask a candidate to submit exactly the same details a million times, it's a sign that your recruitment process is messed up. Ever heard of referential integrity?).
  • Then there's the entering of candidate details on a bunch of paper forms!


Seriously, HR departments...haven't a single one of you considered moving into the digital age?



What can be done:
  • Let interviewers use their work laptops to view documents
  • Specifically ask the candidate not to bring a printout of anything
  • Candidates can email their resume and scanned copies of other documents.
  • They can bring a copy of the interview call email on their smartphone (a copy of this email is usually asked for by the security guard).
  • If candidates are expected to fill in their details in a form (do you even need a form? Why not fill in details after being selected?), allow them to do it via an online form (perhaps even a day before the interview). You could even create a user friendly form that could be used on a smartphone. Create forms that  can be shared with the candidate on the smartphone via bluetooth (if the candidate does not have connectivity to the internet).
  • If the candidate wishes to share any additional documents, it could be done either via Google drive, bluetooth or via a pen-drive or rewritable CD/DVD. Make sure you use the pen drive on either a Linux or Mac OS, to avoid those annoying Windows viruses.

Yes, I know you might be a company which has very strict security and device policies. Do understand that these policies and security are meant to prevent sensitive company information from leaking out; not for preventing candidate information from coming into the company.

A creative/inventive mind will always find a way to create facilities and spaces where interviews can still be conducted with a minimal use of paper.
Once you've become digital, shout it out! Let the world know that your department is awesome! Spread the news. It really is time to get out of the feudal age.

No more printouts!!!

If you want to hear the magic word before going digital, here's me saying "Pleeeeeeease!!!".