{{error}}
{{(quickSearchResults.length>10)?'10+':(quickSearchResults.length)}} {{(quickSearchResults.length==1)?'result':'results'}}
{{result.title}} {{result.timeStamp | mysql2ymd }}
I am sorry, no such article was written yet.
How to put in Windows the timestamp (year, month, day, hour, and minute) in an environment variable
(for /f "tokens=2,3,4 delims=/ " %i in ('date /t') do set _YMDHM=%k-%j-%i)
(for /f "eol=P tokens=1,2 delims=: " %i in ('time /t') do set _YMDHM=%_YMDHM%-%i-%j)
The final result should be similar to:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\dsorescu>clear

C:\Users\dsorescu>(for /f "tokens=2,3,4 delims=/ " %i in ('date /t') do set _YMD
HM=%k-%j-%i)

C:\Users\dsorescu>set _YMDHM=2013-15-03

C:\Users\dsorescu>(for /f "eol=P tokens=1,2 delims=: " %i in ('time /t') do set
_YMDHM=%_YMDHM%-%i-%j)

C:\Users\dsorescu>set _YMDHM=2013-15-03-04-10

C:\Users\dsorescu>
SSL installation on Apache, and why SSL compression is A SECURITY HOLE
Some examples of how to install on Apache the certificates:
SSLCertificateFile /home/dsorescu/private/html/ssl/sorescu.eu.crt
SSLCertificateChainFile /home/dsorescu/private/html/ssl/sorescu.eu.pem #the CA file
SSLCertificateKeyFile /home/dsorescu/private/html/ssl/sorescu.eu.key
Most of people will also be tempted to enable the SSL comprssion as following:
SSLCompression on
Using compressed SSL poses a security leak very easy to understand and to exploit; the explaination is as following (all entities mentioned below are fictional and meant to ease the understanding of the method):
  1. your internet operator (or the IT department from your work) can listen to your compressed SSL requests (obviously they cannot decrypt them);
  2. the operator will modify your HTTP (non-secure) pages to include a small invisible image as following: <img src='https://dragos-matei.sorescu.eu/scrambled-image-name-freaky-url.png'/>;
  3. the network operator will measure the length of the browser request (the request will contain the cookies and the image fake url in a compressed and encrypted version);
  4. the network operator knows that once the url will contain repeating keywords (including passwords), the compressed SSL request will be shorter.
For this task to be successful, the operator (or your employer) should know a bit about which cookies the target site is using (this is not protected), and they have to use your browser to make lots of requests based on various possible passwords.
A way to ameliorate the speed of detection is to give up the brute force, but use orthogonal and white-noise techniques, which allows the attacker to send few very long requests with random information and see which of the requests is "closer" to your cookie values.
This works on the principle that the size of the compressed text decreases with the similarity of its components.
More details on: Short explanation from TheRegister.co.uk and Security.StackExchange.com.
Easy tool to query for IP details http://whois.net/ip-address-lookup/[IP_VALUE]
Often I was in need to know who is accessing my site. Aside the IP, I needed further information (like country or company owning the IP), and I found the following site very useful: http://whois.net/ip-address-lookup/[IP_VALUE] link.
Sorescu.EU SSL enabled - and how to enable SSL using cPanel for all subdomains
Steps (yes - it works out-of-box with Windows, you Linux geeks!):
  1. First step would be to buy a wildcard certificate, in my case being wildcard.sorescu.eu.pfx; this file should contain both, the private and the public key;
  2. Extract the key from the PFX: openssl pkcs12 -in wildcard.sorescu.eu.pfx -nocerts -out sorescu.eu.key; attention - you must know from before the password to be able to open the PFX; you will also be promted to enter the PEM pass phrase - which you should put it of a different value;
  3. Ensure that sorescu.eu.key was generated;
  4. Decrypt the key by running openssl rsa -in sorescu.eu.key -out sorescu.eu.decrypted.key;
  5. Ensure that sorescu.eu.decrypted.key got created;
  6. IMPORTANT! Now you need to generate the actual certificate, by running openssl pkcs12 -in sorescu.eu.pfx -clcerts -nokeys -out sorescu.eu.crt;
  7. Check that sorescu.eu.crt file got created;
  8. Generate the PEM file using openssl pkcs12 -in wildcard.sorescu.eu.pfx -cacerts -nokeys -out cabundle.pem; sincerely I don't understand much from this extension, only that it seems to contain the certification chain of the certificate;
  9. Check that the PEM file is created;
  10. Inside the cPanel open the SSL section;
  11. Go to Certificates (CRT);
  12. Once you install the CRT, you get a message similar to Installed Certificates for the domain(s): *.sorescu.eu (auto-detected);
  13. From the SSL home page in cPanel go to Activate SSL on Your Web Site (HTTPS);
  14. In the Certificate (CRT), Key (KEY), Ca Bundle (CABUNDLE) paste the text contents of the following files: sorescu.eu.crt, sorescu.eu.key, cabundle.pem;
  15. Open the web page.
I want to thank to http://www.mickgenie.com/cpanel-how-to-install-ssl-with-pfx-file/ for figuring me out how manage it.
Please also see below:
Sorescu technical Knowledge Base now supports OSSD fast search in Google Chrome
Now, once you visited KB.Sorescu.EU for the first time, you may instantly search the site via the Chrome's search extensions just by typing K, B, and [TAB] followed by your search query.
An example is below:

The technology used is OSSD Open Search standard; implementation has been done in two steps:
  • The home file contains the link to the OSSD file;
  • The second step was to supply the browser with the OSSD file.
Have a nice browsing experience!
2 files attached: header.html OSSD.xml
header.html
<link title="Sorescu KB" type="application/opensearchdescription+xml" rel="search" href="http://kb.sorescu.eu/ossd"/>
OSSD.xml
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
	<ShortName>Sorescu KB</ShortName>
	<Description>Sorescu technical knowledge base</Description>
	<InputEncoding>UTF-8</InputEncoding>
	<Image height="16" width="16" type="image/x-icon">http://kb.sorescu.eu/favicon.ico</Image>
	<Url type="text/html" template="http://kb.sorescu.eu/search/{searchTerms}"/>
</OpenSearchDescription>
Google Maps zoom control and other events - list for dummies
http://gmaps-samples-v3.googlecode.com/svn/trunk/map_events/map_events.html
Or, how to check if the Google Map zoom changed in your page.
An example of using it is attached.
1 files attached: googleMapsListener.js
googleMapsListener.js
google.maps.event.addListener(map,'bounds_changed',function(){
				alert('Tada - '+map.getBounds());
			});
Light easy to use open web fonts - and how to use them
A great collection of web fonts found on: http://www.google.com/webfonts.
The usage of such fonts is very easy, as in example.
1 files attached: GoogleWebFonts.css
GoogleWebFonts.css
@import url(http://fonts.googleapis.com/css?family=Crafty+Girls|La+Belle+Aurore|Rock+Salt);
*{
	font-size:10px;
	font-family:"Rock Salt";
}
.dms-button{
	font-family:"Crafty girls";
}
Annoying issue with PHP $_GET replacing the dots in variable names
The PHP replaces certain characters (among which dots, spaces, and square brakets) in the $_GET field names.
Personally I am strongly against pre-processing such information without a strong ground. The ground, the same with the well-known magic quotes workaround is to ameliorate the developer's life in using the parameters in a safer and easier way.
However, the effect is that in order to use any kind of variable name the developer needs to patch the patch.
The idea is that before using the $_GET variables they have to be corrected:
  1. clear the old keys;
  2. replace them with the correct key.
But now, another issue appeared in the PHP LightOpenID implementation, where the constructor strongly relies on this workaround.
Also this had to be fixed now.
2 files attached: PhpArgumentsFix.php LightOpenIdFix.php
PhpArgumentsFix.php
{// Fix because $_GET replaces var name ., underscore, space, etc. to "_" FIX:F1301041743
	foreach($_GET as $k=>$v)
		unset($_GET[$k]);
	$get=explode('&',$_SERVER['QUERY_STRING']);
	foreach($get as $kv){
		if(!@strlen($kv))
			continue;
		$kv=explode('=',$kv);
		$k=urldecode($kv[0]);
		$v=@urldecode($kv[1]);
		$_GET[$k]=$v;
	}
}//EOFIX:F1301041743
LightOpenIdFix.php
//FIX:F1301041743
		foreach($this->data as $k=>$v){
			$this->data[str_replace(".","_",$k)]=$v;
		}
		//EOFIX:F1301041743
jQuery - adding custom selectors
A trick for jQuery on how to add custom made selectors (I needed case insensitive CONTAINS selector).
Example:
$("td:icontains('IE9')").prepend(icon('ie'));

Credentials go to http://css-tricks.com/snippets/jquery/make-jquery-contains-case-insensitive/ from where I found it.
1 files attached: jQuerySelector.js
jQuerySelector.js
Google Chrome extension to dynamically manipulate pages
How to make a small ad-hoc extension that manipulates dynamically pages every time they get loaded.
Their utility might be (but not limited to) autologin, GUI augmentation, manipulation, reformatting.
  1. Create a folder on disk (as an example, "E:\ChromePlugin\");
  2. Create a manifest.json file;
  3. Copy one JS utility (like jquery-1.8.2.js to the folder);
  4. Add an icon file (let's call it icon.png) to the folder (check http://kb.sorescu.eu/article/121107093243/Great-PNG-transparent-icon-finder-site-http-www.iconfinder.com- to find nice icons);
  5. Create the script file (let's call it script.js);
  6. Add the extension: Google Chrome > Wrench > Extensions > tick the "Developer mode" > click "Load unpacked extension" and select the folder ("E:\ChromePlugin\");
  7. Make available via HTTP (preferably HTTPS if you want to avoid some minor issues) the dynamic file (let's call it ChromeExtension.js);
  8. Attention, the jquery-1.8.2.js script mentioned in the manifest.json file won't be available in the context of http://localhost:81/js/ChromeExtension.js.
The manifest.json file contents should be as in manifest.json
The script.js is file the script that is actually launched every time a page loads. The ChromeExtension.js file contents is as attached.
3 files attached: manifest.json script.js ChromeExtension.js
manifest.json
{
	"manifest_version":2, 
	"name": "Hello World!", 
	"content_scripts":[
		{
			"matches":["*://*/*"],
			"js":["jquery-1.8.2.js","script.js"]
		}
	],
	"version":"1.0",
	"description": "My first Chrome extension.",
	"browser_action":
	{
		"default_icon": "icon.png",
	}
}
script.js
jQuery.getScript("http://localhost:81/js/ChromeExtension.js", function(data, textStatus, jqxhr){
}).fail(function(x){
	//alert("http://localhost/js/ChromeExtension.js could not be loaded");
});
ChromeExtension.js
// the jquery.js dump: (function(a,b){fu...
if(window.location=='www.erepublik.com'){
	// my actions
}
if(window.location.host.match(/^projects.*/)){
	// my TOP-SECRET work-related tweaking and bypassing applications
}
if(window.location=='http://betalogin.mdmconsole.com/#Login'){
	$("input#email").val("MY_SECRET_USER");
	$("input#password").val("MY_SECRET_PASSWORD");
	$("#ext-gen20").click();
}