Internet Explorer 8 on Windows 7 more restrictive 0

Dealing with handling sessions on 3rd party content (I mean content pulled in using iFrames or Ajax from a different domain than the main page), I recently encountered an issue particularly with Internet Explorer 8 on Windows 7, but not on Windows XP or Windows Vista – our (3rd party) cookies handling sessions were suddenly being blocked. Soon after I found out that the same issue exists for Internet Explorer 6 on Windows XP. I tried to find any issues or topics online in particular what had changed in IE8 on Windows 7, but – nothing. The solution, however, I had to seek for more than a day as I found it using trial&error as it was not described anywhere, but it proved to be pretty simple.
Read more »

Importing/exporting data with MySQL 0

This is more of a note-to-myself entry to dig it up later easily, but the syntax to import dump file to MySQL is:

mysql -p -h database_server -u mysql_user mysql_dbname < file_dbname.sql

The same way mysql dump can be created:

mysqldump -p -h database_server -u mysql_user mysql_dbname > dump_file.sql

Good resource with more on this is here.

Get query string variables of Javascript files 1

Looking at different scripts linking to Javascript and AJAX frameworks such as Scriptaculous, I noticed that it allows loading of particular parts of it by adding them in the following query string such as this:

<script type="text/javascript" src="scriptaculous.js?load=effects,builder"></script>

Looking at scriptaculous.js itself, it relied on some built-in functionality for that. I was unsuccessful in finding online a ready function to do exactly that, so inspired by this piece of code and borrowing the regex part of it, I wrote a function which grabs the additional parameters and allows using them in the Javascript:

function getJSvars(script_name, var_name, if_empty) {

var script_elements = document.getElementsByTagName(‘script’);

if(if_empty == null) {
var if_empty = ;
}

for (a = 0; a < script_elements.length; a++) {
   var source_string = script_elements[a].src;
       if(source_string.indexOf(script_name)>=0) {

       var_name = var_name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
       var regex_string = new RegExp("[\\?&]"+var_name+"=([^&#]*)");
       var parsed_vars = regex_string.exec(source_string);
       if(parsed_vars == null) { return if_empty; }
       else { return parsed_vars[1]; }

      }
   }
}

Usage of it is simple: if you have a Javascript which should parse some dynamic variables (such as user or account ID), you can include it right after the included Javascript like this:

<script type="text/javascript" src="script.js?var1=value1&var2=value2"></script>

instead of creating a server-side generated dynamic Javascript using PHP or other language. The values of variables like var1 can be retrieved like this:

var var1 = getJSvars(‘script.js’, ‘var1′);

You can also add a value as third parameter to output in case var1 is empty, but it is optional.

Now this is scary 0

Could you possibly imagine it is this easy to capture what is typed on your keyboard? Wirelessly.. even through a wall!

Read more »

Welcome! 1

In this web site you will find different useful on-line tools, code snippets, maybe even different ideas and thoughts on different topics. The purpose of this web site is to serve more like a personal notepad, but it is aimed also to be useful for others.