{{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.
Easy way to install the Microsoft Expression Encoder - using the MS WebPI
An easy way to install the Microsoft Expression Encoder (in case you need to process multimedia streams (via C#, etc.) is to simply follow the link http://www.microsoft.com/web/downloads/platform.aspx from where you install the Web Platform Installer - were you select the Microsoft Expression Encoder and it will automatically install the dependencies - Azure, .NET Web Express, etc. And all of it is free and easy.
Simple Dynamic C# Execution
A simple way to execute C# code, without using the Visual Studio is shown in RunCS.cs. Steps:
  1. Compile the code as RunCS.exe;
  2. Create a CS file;
  3. Execute RunCS.exe "my_file.cs" param1 param2
The CS file must contain the following lines, as in Program.cscript.
2 files attached: RunCS.cs Program.cscript
RunCS.cs Program.cscript
//@main MyNameSpace.MyClassName
//@assembly %programfiles%\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll
using System;
//@title This is optional, and it will be the window title
//@include ..\\my_dependency_file.cs
using System;
namespace MyNameSpace{
 public class MyClassName{
  public static void Main(string[]args){
    Console.WriteLine(args[0]+" "+args[1]);
  }
 }
}
How to execute remote programs on Windows
Recently I needed to start a program on a remote machine, so I used the following C# code (after adding the System.Management assembly).
1 files attached: Remote.cs
Remote.cs
Tray icon flash on new messages in Outlook
Using the utility class from the previous post I wrote a small utility that is running through all the Outlook accounts and counts all the unread messages from inbox. Once a change is detected, the icon starts blinking, that will stop once you click once with the mouse on it.
Right now it is working for me with two Exchange accounts configured on my Outlook.
Very important note: before importing, you must add the reference to Microsoft.Office.Interop in order to access the Outlook interoperability automation engine.
The code is attached.
1 files attached: OutlookNotification.cs
OutlookNotification.cs
C# counter in a Tray Icon - utility
Below is a small class I wrote in order to put a small tray icon with a custom background color, foreground color, and a text.
The particularity of this application is that it does not use any form.
1 files attached: TrayCounter.cs
TrayCounter.cs
Visual Basic and other applications don't start anymore after MS Windows update
It seems that recently Microsoft rolled out some new updates, among which one of them is related to a vulnerability in MSCOMCTL.OCX related to the RTF file handling. It might seem minor, but as a consequence the OCX file got fixed and it is not registered anymore.

In order to fix it, you have to run one of the following commands: 
  • regsvr32 c:\windows\system32\mscomctl.ocx
  • regsvr32 c:\windows\syswow64\mscomctl.ocx
depending on the operating system's bitness (either 32 or 64 bits).

For further information please consult also http://www.net-security.org/secworld.php?id=13429.
How to safely migrate data between databases in MySQL with PHP
I saw many people using lots of complex methods in attempt to move data between databases and file systems.

One of the most frequent methods is storing sequential data records in CSV, TSV, XML, or other formats. Obviously, each syntax requires specific escaping algorithms, a fact that most of times is omitted or forgotten by developer.

The last time I had to move data between two different instances of MySQL from two different sites I followed the approach:
  1. Select the database records and put them in an object (array);
  2. serialize the array;
  3. encode the array in base64 to ensure the text needs no escaping algorithm;
  4. copy the text on a support (file, ftp, mail, etc.);
  5. decode the array from base64 to native format;
  6. deserialize the array;
  7. take each record and save it to the database.
Some of the advantages are:
  1. you don't transfer database records, but business objects;
  2. if you have complex relations or fields, they just get wrapped, irrelevant on the database representation.
A code example is in sample.php.

And the result will be similar to sample.txt.
2 files attached: sample.php sample.txt
sample.php sample.txt
Right click functionality on some buttons - how to, and demo
To use at best the screen estate it is indicated sometimes to implement right-click handlers that trigger menus or other activities.

Recently I thought implementing such functionality on http://my.sorescu.eu/. The functionality implemented was triggering a dialogue box; the complete functionality is still under development, but the right-click handler has been implemented.

First, I looked for a library, and I found one that looked nice and simple (implemented using jQuery): http://www.abeautifulsite.net/blog/2008/05/jquery-right-click-plugin/#demo.

I am using Google Chrome right now to test it, and I saw the following misbehaviour: if I right-click on the "MY Place" button after right-dragging, I get the event triggered multiple times.

I patched the code by inserting a line after line 53:
$(this).mousedown( function(e) {
					var evt = e;
					$(this).unbind('mouseup');//added by dragos-matei@sorescu.eu to avoid double right click events, or ghost right clicks for right dragging events starting from this button
					$(this).mouseup( function() {
						$(this).unbind('mouseup');
						if( evt.button == 2 ) {
							handler.call( $(this), evt );
							return false;
						} else {
							return true;
						}
					});
				});
The issue seems to be in the original code that every time the  rightMouseDown   occurs, a new  rightMouseUp handler is added. 
What I did was to remove the rightMouseUp event also when rightMouseDown event.

Thanks to http://www.abeautifulsite.net and I hope it was useful for you.

N.B.: No guarantee that the script in discussion and the modification I did is useful, safe, good, or whatever else - just take it without any warranty, of any kind, under any circumstances.
Java 6 BrainBench certification results for Dragos-Matei Sorescu
I am happy to anounce that I passed another certification test, this time in Java. The overall results are:
Name: Java 6
Score: 4.53Date: 2012-07-10

View detailed topic results

Scored higher than 99% of all previous test takers.

Demonstrates understanding of most advanced concepts within the subject area. Appears capable of mentoring others on the most complex projects.
Strengths
 Core Libraries 
 Practical Software Engineering 
 Integration Libraries 
 Class Definition 
 Support Libraries 
Weak Areas
    None Noted
Results per section are as below:
Dragos-Matei Sorescu
Test:Java 6
Date:10-Jul-2012
Score:4.53
Correct/Total:(34/40)
Topics/SubtopicsCorrect/Total
Tools(2/3)
Compiler(0/1)
Annotation Processing(1/1)
Deployment(1/1)
Practical Software Engineering(6/7)
Object Design(1/1)
Best Practices(4/4)
Refactoring(0/1)
Patterns(1/1)
Integration Libraries(5/5)
Web Services(2/2)
Scripting(1/1)
JNDI(1/1)
JDBC(1/1)
Class Definition(4/6)
Methods and Fields(2/3)
Inheritance(0/1)
Access Modifiers(1/1)
Generics(1/1)
Support Libraries(4/6)
Networking(0/1)
XML(2/2)
Internationalization(0/1)
Security(2/2)
Core Libraries(6/6)
I/O(4/4)
Math(1/1)
Language and Utilities(1/1)
Visual Libraries(2/2)
OS Integration(1/1)
Components(1/1)
Syntax(3/3)
Data Types(1/1)
Flow of Control(1/1)
Expressions(1/1)
Virtual Machine(2/2)
Thread Management(1/1)
VM Internals(1/1)
Comments option available on Sorescu Knowledge Base
Now, based on the OpenID authentication, the KB.Sorescu.EU site accepts reader's comments. Please feel free to add your contribution to the value of the site.