Wednesday, December 12, 2012

Stackoverflow User Details in python


badge_counts_bronze :: 115
email_hash :: 51d623f33f8b83095db84ff35e15dbe8
badge_counts_silver :: 104
badge_counts_gold :: 34
user_mentioned_url :: /users/1/mentioned
user_type :: moderator
answer_count :: 138
creation_date :: 1217514151
user_tags_url :: /users/1/tags
user_timeline_url :: /users/1/timeline
about_me :: Stack Overflow Valued Associate #00001

Wondering how our software development process works? Take a look!

Find me on twitter, or read my blog. Don't say I didn't warn you because I totally did.

However, I no longer work at Stack Exchange, Inc. I'll miss you all. Well, some of you, anyway. :)

up_vote_count :: 2729
user_id :: 1
question_count :: 15
reputation :: 23510
view_count :: 92244
user_favorites_url :: /users/1/favorites
display_name :: Jeff Atwood
age :: 41
down_vote_count :: 543
last_access_date :: 1355227926
association_id :: febfb878-3f6f-4215-9323-46d15d62ac7d
user_questions_url :: /users/1/questions
location :: El Cerrito, CA
accept_rate :: 100
user_reputation_url :: /users/1/reputation
user_badges_url :: /users/1/badges
user_answers_url :: /users/1/answers
website_url ::
user_comments_url :: /users/1/comments

Tuesday, August 7, 2012

Fetch web page in libcurl

Saturday, July 14, 2012

Pthread in c++ class

In pthread API, the pthread_create() takes function which takes a generic pointer and returns a generic pointer. Here is a sample pthread implementation in c

In thread....
Message : Hello
Thread exiting...
The problem with pthread_create in c++ is that it can't take member function as a thread function. Because, pthread_create expects a normal function, not a c++ member function. If we pass a member function, then the implicit this pointer won't be available inside this, hence the purpose of member function won't be fulfilled. For this reason, we need to make the thread function static and pass this pointer as object. Inside the function, everything should be accessed through the this pointer. Here is a sample code of pthread_create in C++

In Thread...
Message : Hi Hi
Thread exiting...
Here, the problem is we need to write a static member function for every class that needs to use pthread_create(). I have made a wrapper class for this. Here is the code along with how to use it.

Control in Main
In Thread...
Message : Ho Ho
Thread exiting...