Monday, February 1, 2016

All the modern browsers have implemented a security protocol that prevents the website to access files from the disk. It's a really important security measure that forbids the websites to snoop into your disk and steal your 'data'. However sometimes you want to load the files anyway. May you are developing a web app and you want to load libraries stored on your disk. This security protocol will hinder this action.

You can use work arounds by setting certain flags of the browser that will disable these security fences but the catch is you will become vulnerable to the attacks. I don't advice disabling security in your browser. The workaround that I have found is very secure.

So for example if you want to reference a Jquery file on your disk, trying to access it with


wont work.

So the easiest workaround that doesn't require alot of effort is to serve these library files or any other file that you want to load by serving them via a local server on your system. So your next question will be how can I do that? Well it's pretty simple. Following steps should get you up and running in just a minute.

1. Install wamp/xamp or any other program of your choice.<
2. Put the files that you want to be served by the server in the /path/to/wamp/www/yourfile.js
3. Start the wamp server.
4. Put the local host path to server file where ever you want to access it. Eg. src="http://localhost:81/yourfile.js"

Voila! You should be able to fetch the files locally now.

Thursday, November 19, 2015

Google is rolling out the new Camera app v 3.1 gradually via playstore. The update was long due and the Google's current offering was lacking in several areas, performance is the most the notable one. I got my hands on the updated app via APKMirror. The app is intended for devices running Android Marshmallow. So bad luck for lollipop users.

From the early impressions, the app looks just an aesthetic overhaul. The app brings the UI from the Camera apps of Nexus 5x & 6P. However, it doesn't offer burst mode on neither Nexus 5 or 6. Not surprisingly the later has Auto HDR+ feature. Currently I have a Nexus 5, which is considered the best Nexus device Google has ever released. However the camera along the battery aren't the strong suits of the champ. Though the camera performance & picture qualities have improved plausibly since the inception of the device, the current release takes it to a whole new level.

The latest Google's camera app has improved in both performance & picture quality department. The app launches faster, takes snaps quickly by offloading the image processing on a handler thread & HDR+ enhances the details & shadows on a somewhat mediocre camera of the Nexus 5, like never before. HDR+ now preserves the sky color much better without leaning towards over exposure. The shadows are highlighted much better but there is still some prominent noise but it's not a big deal for me. There is an Auto Flash option available for the HDR+ mode but it never illuminated dark scenes and the photos are always dark.

Screenshot Credits: Phandroid

Non HDR photos are taken instantly. Even if you the camera hasn't focused on the subject, as soon as the shutter key is tapped, the photo will be snapped. Which is better then missing the moment in hunt of focus.

Video department has also been improved. It lets you touch to focus while recording the video. Whereas before you had to wait for a few seconds for the camera to focus & tap the display would result in capturing a photo.

The revamped user interface is also very welcoming. Swiping left from the right edge, switches to Video mode. To open the gallery, you have to tap on the picture icon at the right of the shutter button. Overall the new camera app has breathed new life in the Nexus 5's camera. Hopefully in the near future, Google will address the flash bug in the HDR+ mode & may be add features like Slo-mo & 60 fps video recording for Nexus 6 and may be for the Nexus 5 as well.

Tuesday, March 31, 2015

Proof for verification

Wednesday, February 11, 2015

Lately I have been working with MediaPlayer on Android. I went to Android docs, read the description of the apis. Great! Let's think a rough algo and start working on the app.

I wrote a simple app which just streams a video and provided media player controls in the app for seeking, play pause etc. Pushed it on my device and goofed around with it. Play, pause working great. Video is streaming nicely. What about seeking? Let's seek to some X position. BAAAAM!!! The whole app became unresponsive. I couldn't interact with my device any more. I thought may be I am doing something wrong so I better review the code. After reviewing I couldn't find anything that I might have been doing on the main thread which could have caused this ANR. I searched the internet and found a few questions on Stackoverflow complaining about the same issue and guess what those questions were posted back in 2011 and 2012. I asked some of those devs and to my surprise they had the assumption of these bugs being fixed long ago, but here I am scolding Google for not fixing the issues and releasing premature api's for the media player.

Let's forget about the UI responsiveness for a bit and focus on other apis. I implemented listeners for buffering callbacks. The algo for the app was developed keeping the documentation of those callbacks in the mind, however when I pushed the app on the device, the behavior of the app was totally unexpected. Forget about stuff that shouldn't be happening, things that should have been happening either never happened or occurred seldom. After extensive testing I found that the behavior of the callbacks was totally undefined. Either Android docs failed to mention other possible scenarios for them or they were the bastard child of the messed up code.

Now I looked towards lollipop in the hope that this crappy behavior might have been resolved in the latest and greatest OS. Google again didn't fail to surprise me. Not only the apis that weren't working on Pre-lollipop devices were still in the same buggy state, the apis that were working stopped working altogether. Now I am sitting ducks, frustrated by the piece of shit Google has provided in the name of Media Player, trying to patch the known issues in my player code making it a spaghetti code.

The only solution I can think of is abandon Media Player and write your own player from the scratch, which is a major pain in the ass or use some open source player.

FUCK YOU Google!!!

Sunday, December 14, 2014

Yesterday I rooted my Nexus 5 running stock lollipop. I bought this phone about 3 weeks ago. Lollipop was supposed to improve power consumption of Android devices but the results I acheived were quite opposite of what Google has been claiming. I barely got 3 hours of SOT & I was facing mic issue as well, which means people at the other end couldn't hear my voice clearly & sometimes my voice was gone completely (during important calls offcourse). I knew it could be fixed by rooting the device & modifying the OS to my liking. So far the results & my findings are not that impressive after rooting & modifying the OS.

I flashed ElementalX kernel with stock settings except I undervolted the CPU to 750 mV. I greenified the culprit apps & started to expect at least 5 hours SOT. However the results were quite below my expectations. I couldn't get more then 4 hours SOT with the following settings & usage patterns.

  • Brightness ~25%
  • Calls = none
  • Gaming = light
  • Music = Medium to heavy use (using earphones)
  • Facebook = medium use
  • Baccon Reader (reddit) = medium use.
  • Chrome = Light use
  • Messaging = none
Considering these settings I could have easily acheived more then 5 hours of SOT but I couldn't come even close to that. This clearly indicates that Google needs to fix its latest OS & these battery draining issues. No matter how much we modify kernel or undervolt the CPU at the end of the day rogue apps & processes will still suck the life out of our precious batteries.

I am still looking for ways to get higher numbers of SOT. If you guys have achieved better results, feel free to share them in the comment section.