Wednesday, October 7, 2015

Password retrieval from Heidi SQL


In case you forget your MySQL login then you can retrieve it in case you use Heidi SQL to connect with MySQL server and your password is stored in its settings.

You have to follow steps as listed below:
1. Go to File  ==> Export settings to dump all settings in a file
2. Open up the file in a text editor e.g. notepad
3. Look for your server name in the file
4. Your user name and password would be listed as 
  •  Servers\serverName\User<|||>1<|||>username
  •  Servers\serverName\Password<|||>1<|||>75453A3A7C7477695 
5. Now you have received your password but it is in encoded form and hence, can not be used directly. Use below mentioned JS to decode
function heidiDecode(hex) {
  var str = '';
  var shift = parseInt(hex.substr(-1));
  hex = hex.substr(0, hex.length - 1);
  for (var i = 0; i < hex.length; i += 2)
  str += String.fromCharCode(parseInt(hex.substr(i, 2), 16) - shift);
  return str;
}
document.write(heidiDecode('75453A3A7C7477695')); 
Just replace code in the last line of JS with your encoded password and run it in your browser console. You will get your password.

Monday, February 9, 2015

Localstorage size limitations




We have started relying highly on localstorage and are storing lots of data in localstorage. However, it also has a limit beyond that it would not work and would request data from server directly for each request.

Defaults:
Default value of storage capacity can be viewed as below:

Firefox - 
1. In the URL type about:config
2. Search for dom.storage.default_quota in the config parameters. You will find value as 5120 which will translate to 5MB

Chrome  -
Limit is listed as 5MB on Chrome specs

IE - 
The limit is listed as 10MB on IE Specs


Current usage check
You can check current usage of localstorage by running following javascript in the browser console:
var total = 0;for(var x in localStorage) {  var amount = (localStorage[x].length * 2) / 1024 / 1024;  total += amount;  console.log( x + "=" + amount.toFixed(2) + " MB");}console.log( "Total: " + total.toFixed(2) + " MB");


Here is some javascript code to find the size of your localstorage http://jsfiddle.net/b31gzjys/2/
During my research I found this blog very helpful- Dom storage