Threading in C++11

Threading is sooo easy in C++11. It’s done 1 single line :3


thread t(&MeraClass::sayHi,this,"Nayar");

That’s it. Use t.join() anywhere you want it to complete 😀

The first argument is the name of the function or method you want to call. Since i mostly code using Object Oriented Programming (OOP), i need to specify the class name then pass the object from which i’m creating the thread. Here could be the class:-


using namespace std;
class MeraClass {

public:
   MeraClass(){
       thread t(&MeraClass::sayHi,this,"Nayar");
       t.join();
   }

   void sayHi(string name){
        cout << "Hi "<< name <<endl;
   }
};

Hey Java, BURN!!!! 3:)

Cross-Platform Scripting on Windows and Linux

I was kinda amazed at how well my .sh script on Linux would work perfectly on Windows 7.

Firstly, i had written a script to clone my dissertation files using git. I have a file named “cloner.sh”


#!/bin/sh

git clone git@example.com:project1.git
git clone git@example.com:project2.git
git clone git@example.com:project3.git

I just double-click on it from Windows 7 and my projects get cloned ASAP. On Linux, i had to mark it as executable before it would run.

I was more amazed when i tried to write a script for compiling our report on LaTex. I installed TeXworks but to compile the project we have to do about 6 -8 clicks. I wrote a compilation script and named the file as “compiler.sh”


#!/bin/sh

pdflatex main
bibtex main
pdflatex main
pdflatex main

My friend on Windows 7 pulled the file, double clicked on it. And lo! The PDF was generated correctly. It even auto downloaded missing packages as if it were run from TeXworks. Awesome! (Psst. The Linux one doesn’t do it on the fly -_-)

I added some lines to clean the mess the compilation process usually leaves

rm *.aux
rm *.bbl
rm *.blg
rm *.lof
rm *.log
rm *.lot
rm *.toc

Once again, magic! The auto-generated files were swept away.

But how is that possible?
Does Windows also use the same commands as Linux does?

I managed to get a screenshot of the window that popups for few seconds to display the output. Git also shows here. Weird nan?



I guess the “Linux” environment came along when i installed Git bash on my PC and my friend’s. Anyways, i don’t have much time to know how it just works. I’m just happy that it’s working for me and my mate 😀

First Interview

After doing a fun technical test for DCDM Consulting, I got qualified for an interview with the HR department. One of the interesting question that was

A bear moves 1 km south, 1km east and 1km north. It returns to the place it started. What is the color of the bear?

Back to the interview, she asked me whether to do the talking in English or French. Without hesitation said English. But I stumble not because I was tensed I need to start watching English serials again. Big Bang Theory anyone?
The questions that put me in the key:

If one day you miss your deadline, everyone is very angry at you. How would react?

I was like WTH!?  o.O 
I don’t know the way they work. The atmosphere there. The reason of it. I said I’d apologies. I feel so stupid. lol.

What are your strength and weaknesses?

 
It’s such an embarrassing question. The whole time it’s me flattering myself. Now they tell me to say something against me. Hahaha.
Anyways, I’ll not be going to have an internship or part-time job (at least for now) with them because they are recruiting people to work with them from 8:30 to 17:00 for 6 months. Plus OVERTIME! 
The schedule doesn’t fit me especially i have to do my final year project/dissertation.
And BTW, the coffee they offered was awesome 😀