If this blog helped you in any way, please donate a dollar here

Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts

Saturday, July 27, 2019

The Techgig C Skill Test

I used to consider myself to be pretty good in C, so I decided to try out the world's biggest programming contest platform, TechGiG (Look here: https://www.techgig.com), or so they claim to be. I wonder why I hadn't dabbled in this platform all this years since the platform seems to be existing for quite some time now. I do remember some 5-6 years ago I had dabbled a bit in the website and then stopped, I wonder why, can't really recall.

So I decided to give it a spin. I decided to try out the TechGig Skill test. Here's what I found while attempting the test.

There were 25 questions and I got 6 wrong and 19 correct. I wonder which ones I got wrong. Also considering some multiple choice answers didn't really answer the question. Also, I really wonder what a Java Question was doing in a C Skill test! Take a look:


Being the Java n00b, I might have messed that up. Moving on to one of the brilliant CHTML Questions in recent times.


That's an amazing blend of HTML and C. Amazing HTML coding skills are the feature of the tests in TechGig, since this sort of goof-up is pretty common.

Let's move on to the wrong answers now. I got this wrong apparently:


Well, I do pride myself in such questions, but seems like I have forgotten how printf handles the parse string! Well, what does ideone think?


Dear! O Dear! Ideone might have got it wrong too! Wait, maybe TechGig was wrong? Dare I say that!

Let's move to the next incorrect answer by me. Here we go:


Well, well, well. Seems like I've forgotten the basics of pointers! :( What does ideone think then ?


I think I've caught on by this point. I'm quite a C n00b also. Shall we see the next incorrect answer by me ?


This was quite tricky, so it's possible I might have messed up here. But really ?


By this point I'm convinced that the compiler used by ideone is perhaps broken. Or maybe it's TechGig that sucks?

I'll leave it to you, the reader to figure that out.

Sunday, December 23, 2018

Open numbers in whatsapp without saving as contact

Whatsapp Number Opener

Say you want to make a whatsapp conversation with someone for temporary purposes but in order to do that you need to add that person as a contact first. Now adding someone as a contact is by itself a security risk as you can potentially expose your display picture and status to that person. If this is someone with whom you are involved in a transaction, then you'd not want to save this contact just for one time communication. Well, then what is the solution? How do you text this person without saving their number first?

Monday, December 5, 2016

Selenium ChromeDriver Install Script

Hello Folks,



As I was trying to instruct someone how to install Selenium Webdriver on OSX, I realised that there were no good scripts to automate this task. There were instructions, sure, but none of the were a copy and paste solution. Not that I encourage copy-paste, I found this rather inconvenient though.

So here's a script install selenium chromedriver for any unix osx or windows computers (assuming cygwin) -

In case, the github plugin did not work the URL is here:

https://gist.github.com/rghose/106ae71639c6f9ce9076a260a5614b94

Enjoy!

Sunday, November 2, 2014

Identifying the actor

So, here I am at Candies, Bandra looking at an all too familiar Bollywood actor, who was also a customer there. He played the villain or cop in many movies, I know him. He had his son with him as well. They bear an uncanny resemblance. I want to go up there and get a picture clicked with him. Wait, what was his name?

I asked my friend who was with me, he too seemed clueless. He also wanted to get a picture clicked, but what if he asked his name? We were terrified of that prospect, as we saw a young woman probably in her 30s, go up to him and click one herself. Damn. Shes knows his name for sure.

In our dilemma and brain racking to recollect his name, he was done with his buying and he left. Leaving me pondering over this problem of his identity. So I came home and tried searching Google, assuming it will read my brainwaves. No use. I could not find a Bollywood actor who visited Candies often, he was not a very well known figure like say, Shahrukh Khan for instance, but he was pretty well known. Now I decided to do this: http://en.wikipedia.org/wiki/List_of_Indian_film_actors!

Again, there were too many! So I made these:

a) Python script to get the images from an infobox element in a page here.
b) Shell script to automate this here.

Armed with these tools, I did this:
# wget http://en.wikipedia.org/wiki/List_of_Indian_film_actors
# grep '<li><a href=' List_of_Indian_film_actors | grep 'title' > list
Deleted the last irrelevant line and fired up "./parse_names.sh list"

I made myself some coffee, came back to my laptop and casually started browsing the thumbnails from my file manager. Found him!



Saturday, November 26, 2011

Genetic Algorithms

I have been busy for the past few months and it reflects on the time it took to bring out another post on my very beloved blog. Since getting admitted to post-graduate studies I have been fascinated by non-deterministic algorithms that are used to solve NP hard problems with reasonable accuracy. The branch of study I am referring to is known as "Soft-Computing".

There are various such algorithms that are based on the natural actions or inspired from nature. Some examples are Genetic Algorithms, Artificial Neural Networks, Fuzzy Logic, et cetera. What is so fascinating about this branch is that non-determinism and confusion are the concepts that determine the solution! When I say determine the solution I never mean to imply it finds out the exact solution always, it does not. These computations will find out the approximate results that are good enough for humans to understand and apply.

Let me try to elaborate each of these wonderful concepts to the best I can. In this part I shall be elaborating on Genetic algorithms.

Monday, August 8, 2011

Iterative Inorder Traversal of Binary Search Tree

A student from my undergrad college asked an innocent question to me on a facebook group to write an iterative implementation for In-Order Traversal of a Binary Search Tree. Of course I obliged and wrote up a code. However, I had never dug deeper into the properties of such traversals before and my observation was quite unexpected.

I was asked a question in the M.Tech. programme interview at NIT Durgapur about the significance of In-Order traversals of BSTs. I wasn't aware of any! So I gave a prompt reply, that it prints the elements in a sorted order. I was sure I was correct but the expression on their faces led me believing I was surely wrong! Oh well, I never did study theory before, so I guess my anguish was justified.

So, for my fellow junior, here's the code I promised:

Tuesday, June 7, 2011

Devhelp documentation for C

Standard C Library documentation can be easily found on the command line via the terminal. Do a simple 'man scanf' and you get the entire documentation for the function. This functionality requires the appropriate manual pages to be installed which is part of the standard C library documentation.

Dev-Help is a documentation viewer for GNOME and has various books to be used by developers. Standard repositories of Ubuntu, LinuxMint and Debian contains many devhelp books but a notable exception is the Standard C Library Documentation

Wednesday, November 17, 2010

Database connectivity with Java


Spent a lot of time today searching for ways to use Database connectivity on my Ubuntu box. I write the code but it just was not working!


Wrote this code to test for connectivity with this :


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class TestDatabase {

Monday, October 11, 2010

[OFF] Losing out

It was tech fest time yet again... with RCC-IIT and A.O.T. organizing their Annual technical festvals a few days ago.


The RCC Fest was a disaster. Reminds me of Heritage a couple of years back. The questions were not meant to be solved! (I can't figure why they pose questions that cannot be solved within the given time) The time was 45 minutes and we were supposed to do a modified DFS and a travelling salesman problem. However the DFS was easily solvable in the given time but apparently no-one could (and that included me)! Fall from grace? Hmm... maybe.

Thursday, September 23, 2010

Obfuscated Code Contest

Obfuscation is an art. It refers to making your code hard to read... hard to understand using advanced concepts. So, let me present a code that prints my name, but in an obfuscated manner! This was done by me a couple of years ago, but was faulty. I corrected it and here it is:

float m[] = {2.94576846098867283087373218349056E+32, 3.761396E+24, 9.316795E-39 };
main(){printf(m);}

Magic eh? Nope... just an understanding of data types.

The concept here is pretty simple. Data representation is exploited. Don't think IEEE754 here, since this can be made with a simpler technique. So.. let me ask my readers... what technique can be used to generate the number?

I am giving away a prize for the person who answers this first and correctly. Best of Luck!

Friday, August 6, 2010

Captcha in PHP

Writing a custom captcha for your website is a fairly easy task with the PHP GD Library.

The GD Library is a graphics library that enables to draw (and generate) graphics. This output can be done on any of the standard image file formats.

In my example I choose to create a PNG file that will be displayed in my registration page. So the first piece of code I need is somthing like this:

Friday, July 9, 2010

Learning about Web Technology

I am a C fan, hence I love PHP. The world of ASP.NET seems to be very attractive due to the obvious reasons of GUI designer and Rapid Application Development. Again, JSP has got a similar attraction.

However, due to poor support of ASP.NET on Linux, (or perhaps my lack of knowledge in this field!) I am still unable to say hello world on MonoDevelop. JSP appeared pretty complicated at first due to the oh-so-many XML files and odd looking folders. So PHP seemed natural.

Well I have to admit that I like things hand on, so the toolkit based approach in Netbeans, Eclipse and Mono seemed a little too heavy for me. Another reason may be these tools are so sluggish! On my 1-Gig P4 machine, it takes ages for Eclipse to load.

Wednesday, April 14, 2010

Tech Fests Win and Loss

National Institute of Technology aka R.E. College of Durgapur was famous for being the college second only to IIT Kharagpur in West Bengal in Engineering Education. This was not what I had expected of them.

The prelims questions were so bad that we (me and Sarthak) could challenge them that they knew nothing about them They were mostly wrong. All of them used the depreciated C90 standard and the TurboC standard (sic!). In the 2 events of programming : Khula Maidan and Code Marauders, I qualified in only Code Marauders. In Khula Maidan, I did not qualify. So, I wasn't good enough? Mine and Sarthak's teams did not qualify, we challenged them that the scripts were checked wrongly and questions posed erroneous. After much persuasion, they found Sarthak's paper and qualified them. And they didn't find our paper. We were notified we did not make the cut-off make necessary.

Tuesday, February 9, 2010

Palindrome Formation problem

Recently in the BESU tech fest, the final round of programming event contained a series of interesting questions.

Even though I was unlucky enough to not win a prize (after making some kiddish mistakes), I happen to have discovered something of a problem that read:

Thursday, October 30, 2008

Diwali time... tubri timE!

I just cannot forget the huge tubris (you need to be Bengali) my friend made for Diwali. They were 4x4 inches and man was that a beauty to watch! Cost me a hole-in-the-wallet though... worth it.

Aw-right... I just tried edubuntu ... it's awesome...

Trying my hand at some SDL programming... after I edited an error in a game called brickshooter... resolved after a few tweaks. Well, for me life is all about computing now-a-days... so much to do... so little time.

Well.. that's it for now. Bye!