Dec 24, 2011

HTML5: Interference Demo

About 10 years ago I wrote this demo in Delphi using OpenGL. Using HTML5 we can generate interference scene of two coherent point sources more simpler. Please check out sources
How to use: click at the two different points of the image and enjoy the generated pictures.

Oct 21, 2011

.NET: One version file for all projects in solution

Glean a colleague the method of keeping the version info of all projects in solution:
  1. Create file VersionInfo.cs in solution root folder near .sln file.
  2. Put version info into the file:
    using System.Reflection;
    [assembly: AssemblyCompany("")]
    [assembly: AssemblyCopyright("Copyright © 2011")]
    [assembly: AssemblyTrademark("")]
    [assembly: AssemblyCulture("")]
    [assembly: AssemblyVersion("")]
    [assembly: AssemblyFileVersion("")]
  3.  Delete corresponding assembly attributes from all AssemblyInfo.cs files
  4. Link to VersionInfo.cs file in all projects: Project -> Add Existing Item... -> Add as a Link (down arrow near the "Add" button).

Oct 20, 2011

SVN: How to commit ("the true way")

Follow the simple rules then you commit to source control (SVN e.g.):
  1. Before committing the code please update ALL sources. Your code may have references to code in other folders.
  2. Build whole solution.
  3. Run unit-tests. You can use the minimal acceptance scenario for these purposes.
  4. (optional) Run check style utilities such as StyleCop or FxCop.
  5. (optional) Deploy solution locally and manually check changed cases and related functionality.
  6. Commit the code with log message:
    • Use notation:
      • "[+] something has been added (new functions, files etc.)"
      • "[*] something has been changed  (fix bugs, refactoring etc.)"
      • "[-] something has been deleted (delete files, unused classes etc.)"
    • Add Jira or other bugtracker issue number to comments. If you use integrated tools e.g. TortoiseSVN+CSharpTest.Net or Visual Studio+TFS you could select the issue number in the client tool.
    • Add an additional comments about the changes
  7. Check how your code builds on the build-server.
  8. Keep in mind that if your commit is the reason for the project to fail building or otherwise causes a severe bug, you will be taken out of wherever you are (bath, bar, bed whatever) and will be forced into your workplace to fix the problem ASAP ;)

Oct 19, 2011

Free SVN Hosting. Part 2

After 4 years of using hosted SVN I returned to for private projects. It has free plans and very stable!

Oct 17, 2011

Jira: How to add comment from C# code

1. Add reference to web-service http://jiraserver.local/rpc/soap/jirasoapservice-v2?wsdl
2. Execute code:
using (var jira = new JiraSoapServiceService())
  var token = jira.login("user", "password");
  jira.addComment(token, "Project-2233", 
      new RemoteComment { body = "Comment from C# code" });

Oct 14, 2011

SVN: How to get SVN log with C#

using (SvnClient client = new SvnClient())
Collection<SvnLogEventArgs> logItems;

client.GetLog(new Uri("svn://svnserver/mainproject/trunk"), out logItems);
StringBuilder builder = new StringBuilder();
foreach (var item in logItems)
item.Revision, item.Time, item.Author, item.LogMessage.Replace('\r', ' ').Replace('\n', ' '));
File.WriteAllText("log.txt", builder.ToString(),Encoding.UTF8);
SharpSVN Project:

Apr 9, 2011

SharePoint: get/set lookup using JavaScript

Hi guys,
Sometimes we need to get/set values of lookup fields at the client using JavaScript. The main problem is that the SharePoint renders as "select" and as complex of "input", "img", "select" (then we have more than 20 items in lookup field). I have the reciept:

function setLookUpValue(fieldCaption, lookupId, lookupValue){
var selectField = $('select[title="'+fieldCaption+'"]');
if (selectField.length) {
var inputField = $('input[title="'+fieldCaption+'"]');
var hidden = inputField.attr('optHid');
if (hidden != null)
$('input[id='+ hidden +']').val(lookupId);

function getLookUpValue(fieldCaption){
var selectField = $('select[title="'+fieldCaption+'"]');
if (selectField.length) {
return {'lookupId': selectField.val(), 'lookupValue': $('select[title="'+fieldCaption+'" option:selected]').text()};
var inputField = $('input[title="'+fieldCaption+'"]');
var hidden = inputField.attr('optHid');
var hiddenValue = null;
if (hidden != null)
hiddenValue = $('input[id='+ hidden +']').val();
return {'lookupId': hiddenValue, 'lookupValue': inputField.val()};

PS. Don't forget to reference to jQuery

Mar 29, 2011

SharePoint: Developer Dashboard

Для тех кто в танке: в SharePoint есть встроенная Developer Dashboard, которая выводит отладочную информацию об эвент ресиверах и прочем.
Выглядит так (красным обведена кнопка вызова панели):
Включается из командной строки:
stsadm.exe -o setproperty -pn developer-dashboard -pv OnDemand

Mar 21, 2011

SharePoint: Разработка отчетности используя Reporting Services

Презентация с Russian SharePoint User Groups 18 марта 2011:
View more presentations from wonderu.
Восстанавливайте из бекапа с помощью команды:
stsadm -o restore -url http://<вэбприложение> -filename <путь к резервной копии> -newdatabaseserver <имя сервера DB> -username -password

Feb 10, 2011

MJPEG Decoder от Microsoft

На сайте Channel 9 опубликован материал по использованию библиотеки MJPEG Decoder на платформах:
  • Silvelight (out of browser)
  • Windows Phone 7 (Silverlight, XNA)
  • XNA 4.0
  • WinForms
  • WPF
Данная библиотека позволит с легкостью обрабатывать/отображать "картинку" с большинства IP-камер.