Saturday, June 10, 2017

AF's EN (this is linkjacking)

Arcade Fire - the music band - has come out with a new single, "Everything Now". It is a catchy track, which is likely to get more play.

However, it isn't famous, as in the sense of indexing. There is no direct jump to the new single's page on an authoritative source like Wikipedia, or in other words, the Wikipedia page doesn't show up in its search results on the big G. The search engine's irrelevant weighing of the time dimension, and looking for backlinks, has resulted in a recent emergent fad be buried in inaccessibility.

What's worse, is the results push in a 2005 single "Everything Now!" in the most literal result which will confuse the seeker.

Even the phrase "arcade fire everything now" leads to a smorgasbord of live entities, or to be seen as insufficient knowledge sources, but not to the song's Wikipedia page - yes, there is one.



Tuesday, April 19, 2016

Hacking cars for a ransom

Sometime earlier this year (2016), Eugene Kaspersky commented on the state of "connectedness" of the newer automobiles - on how this symbiosis of several digital components (talking over a CAN bus) is going to invite/foster hacking attacks. An accompanying demo disabled a Cherokee this way, to show what hackers can do to the cars of today.

In the meantime, I had another scenario playing in head. Automated driving is in its infancy (Google cars is demo-ing), but one thing we understand is that it will involve a lot of connected micro-devices inside the car talking over the cloud to a massive central controller (server). Where there's a technology, there exists a way to reverse engineer it. What if we have hackers taking over a fleet of Google Cars and asking for a ransom?

"We have taken control one thousand cars, and hence over a thousand lives. The cars are our slaves now. One command, and they would drive off the road. Somebody gets hurt real bad. The cost to mitigate this situation (ie have us relinquish control) is 100 billion dollars!"
To some extent this is the pulp fiction generator in my head at work. But sometimes reality comes overlapping.

Monday, April 11, 2016

ISRO Bhuvan: go eat it

The ISRO has a very cool portal called running, Bhuvan. I just got to find out. It was a digression from an urgent forest fire situation at hand, that I ended up at the Uttarakhand Forests Dept website, thereby led onto a Forest Fire Info page, which had a banner, saying "View Forest Fire Alert for Uttarakhand State on Bhuvan - collaborative effort between ITGC and NRSC").


The Uttarakhand forest portal homepage [on Bhvan] describes it as
Bhuvan Uttarakhnad Forest portal provides a platform for hosting of all GIS database of Uttarakhnad Forest. It is a satellite based technology to watch over the State's forests boundaries, gives detailed location and satellite images of any area or project under various forestry schemes in the State. 
It can keep an eye over activities like; Plantation, Forest Fire, Protected Areas, Asset Management, Eco-tourism, Forest rest Houses location, land Use cover, Wastelands, Map downloading facility etc. can be visualised. User can add layer over the map and take print out for planning purposes. 

While my original purpose of reporting a LIVE fire incident didn't find an end, I got busy checking out the portal, which is a lotta map data through a easy, working, live-loading form (forms are the horror of Indian govt portals, but this worked).

Though the implementation and the utility of the tool is great, live data part is lacking. I found no forest fire incidents around Nainital in the month (so far). It was the increasing incidents of these fires that got me there, to find that none go reported. I figured they do have a satellite system to monitor the forest cover and report any developing fires, but that doesn't seem likely. No such data exists. The data says, "all clean". It also reminded of other incidents of forged data, as part of some institutional laxity, and a creeping fear that we'll have an under-powered tool in the future is taking shape.


Tuesday, July 14, 2015

PHP cURL Guzzle mbstring apache extension - crap of the day

My day's woes were something like so.. Working on the OAuth driver was throwing some stuff I hadn't seen before. It had a short fix.

Short fix: PHPIniDir directive in Apache, configured alongside PHP extension, should point to the php.ini file, not the php.ini directory!

Platform: Windows 7 / Apache 2.4 / PHP 5.6.11 Thread-safe / Laravel 5.1 / MySQL 5.6

I had set my path variables right, and phpinfo() was showing that it could pick php.ini from its directory just fine. Apache sometimes has a separate php.ini that comes with XAMPP-type installations, but that wasn't the case. I went through all documentation of guzzle and checking out the Middleware and its Promises and dd-ing in my libraries... which was basically pointless.

Finally it was established that cURL wasn't loading because it wasn't being picked up by PHP. I started getting a mbstring error now; while the extension was enabled. Disabling other extensions didn't affect the output. That's when I tried checking all ways php.ini could be popped in, and wallah, editing the PHPIniDir in httpd.conf, worked.

[2015-07-14 15:33:10] local.INFO: Authenticating user with provider: twitter
[2015-07-14 15:33:10] local.INFO: redirecting to twitter
[2015-07-14 15:33:10] local.ERROR: exception 'Guzzle\Common\Exception\RuntimeException' with message 'The PHP cURL extension must be installed to use Guzzle.' in G:\passionstreet\framework\laravel\vendor\guzzle\guzzle\src\Guzzle\Http\Client.php:72
Stack trace:
#0 G:\passionstreet\framework\laravel\vendor\league\oauth1-client\src\Client\Server\Server.php(307): Guzzle\Http\Client->__construct()


And before that a Guzzle Client 400 Error

[2015-07-14 15:13:25] local.INFO: Authenticating user with provider: facebook
[2015-07-14 15:13:25] local.INFO: retrieving social login user, with provider facebook
[2015-07-14 15:13:26] local.ERROR: exception 'GuzzleHttp\Exception\ClientException' with message 'Client error: 400' in G:\passionstreet\framework\laravel\vendor\guzzlehttp\guzzle\src\Middleware.php:69
Stack trace:
#0 G:\passionstreet\framework\laravel\vendor\guzzlehttp\promises\src\Promise.php(198): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Response))
#1 G:\passionstreet\framework\laravel\vendor\guzzlehttp\promises\src\Promise.php(152): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), Array)

And before that a Guzzle 403

[2015-07-14 14:41:54] local.INFO: retrieving social login user, with provider google
[2015-07-14 14:41:56] local.ERROR: exception 'GuzzleHttp\Exception\ClientException' with message 'Client error: 403' in G:\passionstreet\framework\laravel\vendor\guzzlehttp\guzzle\src\Middleware.php:69
Stack trace:
#0 G:\passionstreet\framework\laravel\vendor\guzzlehttp\promises\src\Promise.php(199): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Response))
#1 G:\passionstreet\framework\laravel\vendor\guzzlehttp\promises\src\Promise.php(152): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), Array)

And before that doing something weird redirecting with a provider 'Rahul'

[2015-07-14 14:41:39] local.INFO: Authenticating user with provider: rahul
[2015-07-14 14:41:39] local.INFO: redirecting to rahul
[2015-07-14 14:41:39] local.ERROR: exception 'InvalidArgumentException' with message 'Driver [rahul] not supported.' in G:\passionstreet\framework\laravel\vendor\laravel\framework\src\Illuminate\Support\Manager.php:90
Stack trace:
#0 G:\passionstreet\framework\laravel\vendor\laravel\framework\src\Illuminate\Support\Manager.php(63): Illuminate\Support\Manager->createDriver('rahul')

Then back to the cURL

Then I got back to the first error to start my day, that in one of the views
[2015-07-14 13:10:06] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Method Illuminate\View\View::__toString() must not throw an exception' in G:\passionstreet\framework\laravel\storage\framework\views\f404135fc8f0d4d388888d2a371ebe1d:0
Stack trace:
#0 {main}
[2015-07-14 13:23:54] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Method Illuminate\View\View::__toString() must not throw an exception' in
 



Sunday, April 19, 2015

Crazy KitKat upgrading Gionee M2

The past weekend I wasted a lot of time, over what seemed an innocuous software update after getting fixed a broken USB/power port on the Gionee M2. 
The original issue that put this phone out of service was a bad USB port. It had been a dead phone for the longest time. Thanks to Delhi's Nehru Place, that what Mumbai's repairmen couldn't do, was done, which is fixing that minor issue. Once the a new jack was soldered onboard, then phone sprang back to life. It was great to know that the battery wasn't screwed up, since that is one component impossible to find as its not a standard "Chinaphone" feature to include 4200mAh brick batteries.

Riding on this success, I then thought of doing a software fix. The Gionee M2 came a JellyBean 4.2.0 phone, and apparently Gionee had been not-so-useless by coming out with a KitKat 4.4.2 upgrade. The instructions were clear and straightforward enough on Gionee (India's) website.

Here's the phone specs.
Hardware : MT6582
Model : M2
Build number : M2
Build date UTC : 20140719-110128
Android  v : 4.2.2
Baseband v: MOLY.WR8.W1315.MD.WG.MP.V11, 2013/11/27 10:34
Kernel v : 3.4.5 (android@android-6) (gcc version 4.6.x-google 20120106 (prerelease) (GCC) ) #1 SMP  Sat Jul 19 18:59:30 CST 2014

It seemed there would be no apparent harm. But being me, keeping out of the harm's way is impossible. Hence, I initially screwed up on the image I'd downloaded for my phone.
Thanks to girlfriend, it was a 4G phone and not 8G as she had remembered. It was her phone, initially, so she'd better remembered. I chose a wrong scatter file (8G), and hesitantly started the firmware upgrade process. The KK upgrade would finally have the BLE working on this phone, which I had been wanting for energy-efficient BT chips found in newer 'lifestyle' devices.

It was a relief to see everything progressing smoothly. The image file started loading one by one, and reached 99%.. that's when the error struck. I was devastated.

After a lot of 'not-getting-it', and confusion between the ADB/Preloader/VCOM drivers, and technique to boot in preloader (with the Power+Volume Up buttons), the 4G KitKat finally got the phone working. Oh, in the meantime, it was considered a brick. Thankfully, it was an incident of 'soft brick'. I am trusting enough that 9 in 10 'bricked' phones would probably be bricked this way, and can be rescued.



Mine, though was unleashing a new story of rescue. On booting the phone to KitKat, it gave an error about "Invalid IMEI". Since I'd forgot to put the SIM card inside, I tried doing that, but it still said the same. The SIM was detected and carrier was displayed on the screen, bu the phone would show no signal or no connection for the carrier (Airtel, Vodafone, tried on both, in this case). 



The phone, it turned out, was more than devastated. It lost its two children, to put it metaphorically. Being a dual-sim phone, it had two SIM slots. That means, two IMEI numbers as well. Both those IMEI numbers had been erased during the fiasco. Some technology. Some neck!
It showed 'null' for both the IMEIs just like the screenie below. 


 I retried doing the same stuff but to no good.


Learnt that it happens to phones. Didn't know IMEI could be accidentally erased. Then learnt that it's easy to reset and change IMEI on MTK chipsets, the types (MT65xx) that the Gionee M2 has. If it is accidental, it should be well within legality as well, I presume, as long as it's being done. I could make a good business out of it.

Anyways that depends on whether I manage to fix this phone or not.
  Lately, I've been traveling a lot.

I took this phone on travel with me and my laptop, as we had to zip through Delhi then zip back and slingshoot ahead to the Airport come back again and slingshoot to Noida. There are ways to reset the IMEI even without rooting, but that involves modifying image files and reapplying scatter files, which is tedious, and besides the phone is outta warranty. 
This Gionee M2 was successfully rooted using this link on XDA-developers . 


Then I installed MTK Engineering Mode, an app that opens you to backdoor stuff. There, you enter the commands to reapply the IMEIs. The instructions are all over. This experience left me a bit disillusioned with MTK chipsets, enamored by the hacker/modification community, and also scared about the ease with which changing IMEI is possible - thought they were the last resort to tracking stolen phones, but it is SO EASY to trust that you have some last-resort security on your device, which turns to be an illusion.

Considerations aside, this Gionee M2 is a working phone now. Its battery is seriously impressive, and I hope that future battery technology will make it reasonable to expect 3 days of active use of our mobile devices with a slow draining battery that will not die so soon as in these days.


Wednesday, September 3, 2014

babies

me: my contract agreement on this planet has no condition for either of those
though i might make babies to research random motion

D: or making your wife looks fat

me: you mean fatter than default setting for women?

D: I must admin there are plenty of uses of babies.  so dont be shy

me: having baby = shared admin = annoying
you will always be arguing about which package to install on the baby 
then one day baby will revoke your admin rights and then its back to base 0

Update with Select using Joins

Using a technique called Path Enumeration, we can arrange hierarchical menus, typically seen on shopping websites. Here's a query to quickly generate the path tree for menu items. Here, it is shown to build paths for children to parent nodes 4 and 6.

UPDATE ADJLIST A INNER JOIN
(
SELECT A1.id, CONCAT(A2.path,A1.id,'/') AS NEWPATH FROM ADJLIST A1
INNER JOIN (SELECT id, path FROM ADJLIST WHERE id IN (4,6)) A2
ON A1.parent_id = A2.id
) A3
ON A.id = A3.id
SET A.path=A3.newpath


See: 
http://stackoverflow.com/a/25328460/1330710
http://stackoverflow.com/questions/1262786/mysql-update-query-based-on-select-query
http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_concat
http://stackoverflow.com/questions/14815668/add-to-existing-value-in-mysql-column-using-concat-function
http://www.slideshare.net/billkarwin/models-for-hierarchical-data