“WARNING: Token not found on wikipedia:” warning on pywikipediabot

WARNING: Token not found on wikipedia:te. You will not be able to edit any page.
Received incomplete XML data. Sleeping for 15 seconds…

 

Such a warning is because of pywikipedia being outdated and stale. 

So, try updating; also, one is advised to use git repo instead of svn.

Check https://www.mediawiki.org/wiki/Manual:Pywikipediabot/Gerrit 

Leave a comment

Filed under Random

Interview street Career Gear Programming challenge

Rahimanuddin's Blog

My solution to Interview street Career Gear Programming challenge -2 in PHP :

Question : Given an input string and a specified length, make the string center of a bigger string of length specified length and add stars on both sides.

Sample Input : apple, 21

Sample Output :  ********apple********

<?php
$sample = ReadStdin(‘Please input a string: ‘, “apple”);
$length_sp = ReadStdin(‘Please input specified length: ‘, 21);
echo center_string($sample, $length_sp);
function center_string($string, $specified_length) {
$str_len = strlen($string);

if ($str_len > $specified_length) {
return flase;
}
else if ($str_len == $specified_length) {
return $string;
}
else {
$starlen = $specified_length – $str_len;
$star_string_fr = str_repeat(“*”, ceil($starlen/2));
$star_string_bc = str_repeat(“*”, floor($starlen/2));
$return = $star_string_fr.$string.$star_string_bc;
return $return;
}
}

function ReadStdin($prompt, $valid_inputs, $default = ”) {
while(!isset($input) || (is_array($valid_inputs) && !in_array($input, $valid_inputs)) || ($valid_inputs == ‘is_file’ && !is_file($input))) {
echo $prompt;
$input = strtolower(trim(fgets(STDIN)));
if(empty($input) && !empty($default)) {
$input = $default;
}
}
return…

View original post 4 more words

Leave a comment

Filed under Random

Interview street Career Gear Programming challenge

My solution to Interview street Career Gear Programming challenge -2 in PHP :

Question : Given an input string and a specified length, make the string center of a bigger string of length specified length and add stars on both sides.

Sample Input : apple, 21

Sample Output :  ********apple********

<?php
$sample = ReadStdin(‘Please input a string: ‘, “apple”);
$length_sp = ReadStdin(‘Please input specified length: ‘, 21);
echo center_string($sample, $length_sp);
function center_string($string, $specified_length) {
$str_len = strlen($string);

if ($str_len > $specified_length) {
return flase;
}
else if ($str_len == $specified_length) {
return $string;
}
else {
$starlen = $specified_length – $str_len;
$star_string_fr = str_repeat(“*”, ceil($starlen/2));
$star_string_bc = str_repeat(“*”, floor($starlen/2));
$return = $star_string_fr.$string.$star_string_bc;
return $return;
}
}

function ReadStdin($prompt, $valid_inputs, $default = ”) {
while(!isset($input) || (is_array($valid_inputs) && !in_array($input, $valid_inputs)) || ($valid_inputs == ‘is_file’ && !is_file($input))) {
echo $prompt;
$input = strtolower(trim(fgets(STDIN)));
if(empty($input) && !empty($default)) {
$input = $default;
}
}
return $input;
}

 
?>

1 Comment

Filed under Random

First Amazon Telephonic Interview

I had this opportunity to have interview with Amazon with the help of my friends, who referred me for SDE position.

Immediately after my friends’ reply that he has given my resume with a recruiter and I may get a call from recruiter, I got a call from some person with my interview schedule.

With a lapse of half an hour after schedule, my first interview started.

The interviewer was humble supportive one. After introductions, he straight away asked me questions one after another.

They were:

  1. Implement a stack with push, pull and findmin in O(1) time.
  2. There is an array of positive random integers. All the elements are repeated twice except for one. Find that element.
  3. Wap to stitch all the leaf nodes of a binary tree together. After stitching, the tree becomes a graph, and the stitched elements be stored in a list. Return the head node of the list.

I could quickly answer the first two ones, but had trouble writing working code for the third one. After several minutes passed. And my code messed up, I was asked to leave it. And the phone interview concluded.

With a gap of one hour, I had a second telephonic interview.

This time I was asked only two questions.

They were :

  1. Wap. There is a circular singly linked list, All elements are in ascending order. Insert a given number at its correct place in the list. The number is a random one.
  2.  There is a stair case, at each step, a person can either take two steps or one step. What is the total number of steps?

With the guilt of being unable to do the previous interview coding properly, here, I directly wrote the implementation part of the linked list, without even checking my implementation was a mere singly linked list and not a circular one. Also, missed the syntax errors like a semi-colon(;) at end of struct declaration, etc. And after correcting me for those mistakes, or rather blunders, the interviewer moved onto second question, and I was trying to solve it mathematically and come out with a polynomial expression, while the interviewer intended me to derive a recursive function out of it. After failing with it, the interviewer advised me to follow codechef, topcoder kind of websites and to do more practice.

Hours after interview, I received a mail saying, I am not offered a job/no call for further interview.

I can reapply in 6 months.

Waiting for my second turn now, and practicing for it.

1 Comment

Filed under about myself, geek

Adding a project on your machine to Github

Here is a step by step mini guide to host your local code onto github.

Create git repo locally

We need to add a repository for your project.

Git is a distributed version control system, so each machine has its own repository.

This is different to centralised version control systems like Subversion, which have a single, central, repository.

Go to your project

$ cd my_project

Initialise the repository

$ git init

You should see the following message:

Initialized empty Git repository in /path/to/my_project/.git/

Add all your files to the repo:

$ git add *

Check to see that there are changes to be committed:

$ git status

You should see something like this:

# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#   new file:   my_project.info
#   new file:   my_project.module
#

In this case, my_project.info and my_project.module are the files I have in my project.

Commit the files.

$ git commit -m "First commit"

You should see something like this:

[master (root-commit) 8201309] First commit
 2 files changed, 74 insertions(+), 0 deletions(-)
 create mode 100644 my_project.info
 create mode 100644 my_project.module

Create Github project

Head over to Github and create a new project.

Create new Github repo

Add Github as remote origin

Now we need to push our changes to Github.

Go to the Github page for the repo. You will should see the URL for the Github repo, which you need to copy.

Get URL of Github repo

Add this as the remote origin:

 $ git remote add origin https://github.com/yourname/my_project.git

Pull from Github to local:

$ git pull origin master

And finally, push the code to Github:

$ git push origin master

You should see something like this:

Counting objects: 7, done.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 1.71 KiB, done.
Total 6 (delta 0), reused 0 (delta 0)
To https://github.com/yourname/my_project.git
 ba2316b..3dae654  master -> master

That is all there is to it! Now your project is under version control and public on Github.

1 Comment

Filed under Random

It happens only in India

Today’s the best thing I’ve heard, read and seen over Indian Electronic media.
Outrage of common man has smashed the bounds and a Common man, yes the so emphasized aam aadmi, has shown his anguish.
The prices are ever increasing and so the basic necessities are being deprived by the lower middle class and below.
Time has come that the leaders start thinking in this regard. Sharad Pawar’s case is just the beginning.

Leave a comment

Filed under Random

ODBC in your own linux!!

Very odd to hear?

But its true.

We can now use JDBC-ODBC bridge, which I have discovered today.

I was told that ODBC can be only used with MS-Windows.

But I have found a way to make it possible to use ODBC in Ubuntu.

Check out here:

https://help.ubuntu.com/community/ODBC

Leave a comment

Filed under geek