Tuesday, September 5, 2017

Auto forwarding sms

Recently i was trying a way to auto forward the incoming sms from one phone to another. I stumbled upon the app MacroDroid Its almost a perfect app for doing automated tasks like auto forwarding sms, alarm, reading out messages and many more.

Its based on trigger action and configure where you need to create a trigger and the corresping action alongwith some configurations(if any).

Here is an example to auto forward any sms:

1. Create a new Macro
2. Add the trigger : Incoming sms from a contact (one can choose among contacts,unsaved contacts,etc)
3. Add the corresponding Action, in this case, forward the sms . Add the contact to whom the sms is to be forwarded here.
4. Add the constraints if any for the trigger to work.

After using the app in different phones, i faced a problem that the app doesn't seem to work as expected on Mi phones. The main reason behind it is to do with the ROM of the Mi phones being configured such that it doesn't allow all applications to run in the background by default. Hence the MacroDroid app was getting killed once the user either locks the phone or some other priority app being opened.

Though the problem can be solved only after Mi releases an updated version for their ROM , here is a tweak to make the app not being closed in the background automatically.

Go to Settings->Permissions->AutoStart->. Here you will find a list of various apps . Choose the aap you need to autostart and make it active.

Next go to Settings->Permissions->Permissions-> . Here you need to grant the corresponding permissions to allow the app to use.

Next go to Settings->Battery->Manage apps battery usage->Choose apps. Choose the required app and after selecting the app choose on No restrictions

Hope the post was useful. Please leave behind comments if you face some issues. Thanks.

Thursday, December 22, 2016

Enabling VoLTE in Redmi 3S

I bought Redmi 3S recently.Though it is a VoLTE enabled handset,the signal is not shown. So on inserting the Jio Sim card, i couldn't see the VoLTE signal. To overcome this here's a small tweak : Go to Settings -> Sim cards and mobile networks -> Here you will find the sim cards 1 and 2 Go to the specific sim card where there is Jio Sim Next go to Access point names . Here you need to add a new APN with name as Jio 4G and APN as jionet Next go to more and save the settings. The APN will reset. You should be able to see the VolTE/HD sign now. If not, try changing the Access Point to something else and again switch back to the newly set Access Point. Voila! the VoLTE should be back.

It may happen that after this even if u disable mobile data it may not be disabled. So for that you need to go to the network settings as mentioned above and Restore default APN . Now you should have a working VoLTE as well as internet.

All the best.

Sunday, December 9, 2012

Digits/Life of PI

Well this post comes mainly after watching Life of Pi and being inspired by it. I always wanted to solve this problem PIVAL but never quiet got the kick untill watching the movie.

Till date about 10 million digits of PI have been successfully known. I started with Machin's Machin's formula which gives correct values till 100 decimal places. Then i came upon this formula by Chudnovsky which helped me to calculate around 35000 digits of PI within the time limit specified (~25 secs). On applying binary splitting and a customized square root function (Newton's method) i was able to improve to 37000. Hope to increase more and in search of better results.

Saturday, October 6, 2012

Modifying the Euler Totient Funtion

Hi All, Came across an interesting problem and thought of sharing it. Most would know about the ETF , which basically helps one to count the number of integers co-prime and less than N . However to get the count of integers which are co-prime to N but less than a specified limit (say M <= N ) is not so common.

At first i thought of modifying the ETF calculation ETF calculation by initialising result to m . The results were 'almost' accurate but not correct. So as a turnaround , i got a different approach. We can factorise N and then from M do an inclusion-exclusion principle on the factors of N . i.e say the factors of N are p1,p2,p3..pk . Then the required solution would be : M - sum(M/pi) (1<=i<=k) + sum(M/pi*pj) - ..sum(M/pi*pj*..pk)

Though i had got the result but coding it was the next challenge. 1. First step was easy as it involved just factoring N . (O(sqrt(N)))
2. Next we had to get all combinations of the factors, in other words all the subsets. This can be done by bitmask technique, i.e consider binary representation of integers and if the ith bit is set then the integer is in the set . We can store each subset in a vector and then based on the size of the subset calculate the denominator with appropriate sign!
3. Thus we can calculate the answer perfectly. :)

Hope it was useful. Finally a post after almost 6 months.Been really busy , specially after getting into this corporate world.

Sunday, March 4, 2012

A tutorial on trees

I came across this site eternally confuzzled which seems really good on data structures, specially trees and thought of sharing it..Hope it's useful :)

Monday, December 12, 2011

divisibility by 7

Hi, recently i came across a problem where it was required to check if a number is divisible by 7 . Though quiet an elementary task, i think its not very commonly known. This is what i found.
Test 1:
Reverse the number . Mulitply each digit of this reversed number by the digits 1(=1%7),3(=10%7),2(=100%7),6(=1000%7),4(=10000%7),5(=100000%7) consequtively till all digits are covered. Sum the products. If this value is divisible by 7 then the original number is too.
Actually these numbers are the cyclic remainders of division by 7.
Test 2:
Take the last digit of the number and subtract it from the number formed by the remaining digits.If this value is divisible by 7 then the original number is too. We can do it recursively to reduce the number .

Hope that helps.

Thursday, October 20, 2011


Hi, recently came across an article which through some questions, has great explanation of pointers . They show that arrays are not pointers which is common pitfall.
Here's the link:
Njoy reading. :)