• Write your first web scraper in Python with Beautifulsoup

    Ok, so I am going to write the simplest web scraper in Python with the help of libraries like requests and BeautifulSoup. Before I move further, allow me to discuss what’s web/HTML scraping. What is Web scraping? According to Wikipedia: Web scraping (web harvesting or web data extraction) is a computer software technique of extracting information from websites. This is accomplished by either directly implementing the Hypertext Transfer Protocol (on which the Web is based), or embedding a web browser.   So use scraping technique to access the data from web pages and make it useful for various purposes (e.g: Analysis, aggregation etc). Scraping is not the only way to…

  • How I wrote my first Machine Learning program in 3 days

    A few weeks back I was intrigued by Per Harald Borgen’s post Machine Learning in a Week which oversimplified the entire learning and implementing a Machine Learning algorithm in a week on a real dataset. He laid down the framework that how as a programmer one can get into ML thing without getting worried about heavy maths and statistics. It was a good excuse to give this ML thing a chance which I had been trying to do for many years after completing Coursera course. Alright. So on this Monday I started my mission. I had to find out some good dataset to achieve the task. Initially I wanted to use NASA’s meteorites…

  • Mbstring not found error while installing mailparse PHP extension

    Today I had to install mailparse via PEAR. On installing I came across one of the errors: mbstring not found despite of it was right there. One of the simplest option to fix it is given below. Though I am working on MAMP but it will work with anyone since it’s part of PHP Source. Go to your PHP Source Library. In my case it is: /Applications/MAMP/bin/php/php7.0.8/include/php/ext/mbstring/libmbfl/mbfl and add following lines in mbfilter.h #undef HAVE_MBSTRING #define HAVE_MBSTRING 1 and then run PEAR command again pear install pecl/mailparse If all goes well it should give something like: Build process completed successfully Installing '/Applications/MAMP/bin/php/php7.0.8/lib/php/extensions/no-debug-non-zts-20151012/mailparse.so' install ok: channel://pecl.php.net/mailparse-3.0.1 configuration option "php_ini" is not set to…

  • Currently Reading – Chrome extension about social book reading

      I love reading books, in fact lots of books. I’am sure many of you read books as well. Books on different topics and subjects help you to expand the horizon of knowledge and creativity. Often it happens that you extract an idea from a book and you give your own touch in it and produce a product which people love to use. In the age of social media when people love to let others know about their daily activities by updating a status, it ‘s not surprising that there are such social sites available which let your friends know about what you’re reading. Goodreads is one of them which…

  • Online JSON Diff Viewer

    Just came across this awesome tool to compare JSON. Yeah, at time it’s needed to compare them. Check this out(http://json-diff.com/) The thing I like most was the interface.

  • Develop your first Facebook messenger bot in PHP

    (Credit: Independent.co.uk) Facebook recently announced a Bot platform for it’s Messenger which provides businesses and individuals another way to communicate with people. What is a Chat bot? A computer program designed to simulate conversation with human users, especially over the Internet. Chat bot in PHP When I heard of it, my very first thought was to a bot in PHP. I started to find some SDK in this regard released by Facebook but none was present. I headed over to documentation which provided good information for starters. Ok! so without wasting further time, let’s build our first Bot Timebot In order to create an Fb bot you will need two things to…

  • How to remove local git branches?

    If you are working on a project having lots of feature branches, you’d like to remove all of once your deployment is done and all feature branches merge into master.  Following simple command can help you to get rid of them. git branch | grep 'DB-' | xargs git branch -d Here DB- is prefix of your feature branch. So, if you have branches like DB-1, DB-2; it will run grep branch and then grep all strings match DB- and then will remove them. xargs rule!

  • Laravel: How to avoid redirecting to home after login?

    If you are working on a Laravel 5.1 based project and using Auth class for authentication purpose, chances are you would have faced issue of redirecting to home after login. While docs say that you can override the behaviour by setting the $redirectedPath value. Thing is it will still not work. After wasting a reasonable time, I figured out the issue. By default Auth constructor is defined as:   public function __construct() { $this->middleware('guest', ['except' => 'getLogout']); } This middleware actually calls  RedirectIfAuthenticated trait. If you go to definition you will find:   public function handle($request, Closure $next) { if ($this->auth->check()) { return redirect('/home'); } return $next($request); } Hardcoded right.…