Wednesday, 7 December 2016

Maximum subarray problem

Problem Statement

Finding a contiguous sub-array which has the largest sum in an 1-D array.

Algorithm

This problem is solved by using Kadane Algorithm. This algorithm is a linear time algorithm.

Wednesday, 2 November 2016

Print the number of substrings which are a Palindrome

Q: Given an input string, find out the number of substrings for the given strings which are palindromes.





Solution Strategy : Brute Force
Language : Python


Tuesday, 1 November 2016

C++:Printing the kth smallest suffix for a string

Prequisistes

  • Stl vector
  • std::sort() for vector
  • Pointers

Code 

#include <iostream>
#include <bits/stdc++.h>
using namespace std;

Saturday, 29 October 2016

Thursday, 27 October 2016

Remove Unwanted Software from Ubuntu 14.04

I recently decided to remove some of the useless software that comes bundled with Ubuntu 14.04. This included the games.However removing the games turned out to be little tricky, I finally found the answer on a comment in a thread on Ubuntu forums, thus the post.






Monday, 24 October 2016

Advanced Linux Commands

Here are a few linux commands that are pretty useful. However no one every bothers teaching you these commands. However, here at Programing Wonders we never leave out such awesome stuff. Like how to create this:

whiptail to create password box






Friday, 7 October 2016

How to Dive into Android

Introduction


How to  begin android programing
Android Programing
Recently I dived or rather scuba dived into android. Around three months ago I knew practically nothing about android as far as app development was concerned. Just installing Android Studio on Ubuntu seemed a daunting task. Once the installation was done, looking at the interface of android studio kind of scared me. Around 30 days of resource and knowledge gathering  and I was good to go. 60 days latter I had written a entire app having an interface as good as Whatsapp, OCR and database. In case, you wish for the code, it will be released soon.

Saturday, 10 September 2016

Execute Commands at a Specific Time in Linux-"at"

The other day I was reading about Reliance Jio Offers. Most of their plans come with limited data, but during night times you get unlimited usage. The catch is that night time period is only three hours 2:00 am to 5:00 am.

Unless you are either nocturnal animal like an owl, or a bi-phasic / polyphasic sleeper this implies that you cannot use the unlimited night time benefit. While this might be the case for an average user but for expert users(people who read my blog :-P) this is no problem.

Guess what Linux offers multiple ways to solve this problem

  1. Cron : Read about this yourself. I will not be covering this in the current article. This is more suitable for recurring jobs.
  2. At: The at command this is more suitable for one time jobs. This will be covered in this article.
Android also offers this facility. You might need to have root access for this though. I have covered this in one of earlier articles about Tasker.

Ps: I have no knowledge about IOS, Windows , or Mac platform pertaining to this automation issue. So go figure it out yourselves, in case you are using one of these platforms, leave a comment below explaining how you did it. And I will create a new post for the same.

Wednesday, 7 September 2016

Identify Mobile Operating System using Python and ADB


Q:Write a Python/Java/C+ program to verify the operating system name and version of Mobile devices.


Note: This program will only work for android devices. (Since Iphones do not have anything equivalent to adb. )No wonder android is the favorite platform when it comes to app development. Android market is also more developer friendly as compared to its ios counterpart.

Errors: In case you get an error about insufficient permission, either edit udev rules or borrow a phone from your friend, having a well known global manufacturer.

OS:Fedora 20 64 bit
Phone: Sony Xperia
Language: Python
Dependencies: Just adb package,No need for sdk
fedora:               <yum install adb>
ubuntu:              <apt-get install adb>