Search This Blog

Friday, February 8, 2013

Git - running garbage collection on your repository

There is a neat feature of git called "garbage collection" that I recently got familiar with. My half-a-year repository which had 1.6 GB (the .git folder itself having had 424 MB) was shrunk to 1.5 GB (with the .git folder having 292 MB).

C:\Repo\.git>git gc
Counting objects: 55965, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (15987/15987), done.
Writing objects: 100% (55965/55965), done.
Total 55965 (delta 42100), reused 52422 (delta 38932)

There is also an "aggressive" garbage collection option which you can use:


Usually git-gc runs very quickly while providing good disk space utilization and performance. This option will cause git-gc to more aggressively optimize the repository at the expense of taking much more time. The effects of this optimization are persistent, so this option only needs to be used occasionally; every few hundred changesets or so.

For more info have a look here.

Silverlight DevExpress DXperience Grid Printing Layouts

This example shows how to use simple templates in DevExpress printing mechanism. The most important thing you can't miss is that it is absolutely essential to use DevExpress template controls in DataTemplate - plain Silverlight controls are simply removed when the template is processed. In this example this is <dxe:TextEdit /> used instead of Silverlight's <TextBlock>.

    <DataTemplate x:Key="headerTemplate">
      <dxe:TextEdit  Text="{Binding Path=Content, Mode=OneWay}" />

var preview = new DocumentPreviewWindow();

var link = CreateExportServiceLink(gridControl, preview);

private PrintableControlLink CreateExportServiceLink(

IPrintableControl gridControl, 
DocumentPreviewWindow documentPreviewWindow)
{ var link = new PrintableControlLink(gridControl)
ExportServiceUri = "",
Landscape = true
var model = new LinkPreviewModel(link);
documentPreviewWindow.Model = model;

return link;}

private void PrepareHeader(PrintableControlLink link)

link.ReportHeaderTemplate = (DataTemplate)Resources["headerTemplate"];
link.ReportHeaderData = "Text to be displayed";

Java generic methods; Java generic classes; Java static generic method

Java has a different syntax for generic methods, generic classes and static generic methods.

  • Java generic classes
public class ComboBoxDefinition<T extends Identifiable> extends AbstractFieldDefinition implements xxxx
    protected ComboBoxDefinition(BeanContainer<T> beanContainer)
  • Java generic methods
public class ComboBoxDefinition
    public void draw(List<? extends Control> controls) {
  • Java static generic methods
public class SomeClass
     public static <T extends Identifiable> void create(BeanContainer<T> beanContainer) {

Silverlight call simple get (REST/HTTP) and receive an image

This is the simplest method to receive an image from http server - we receive a stream with the message.

var wc = new System.Net.WebClient();
var applicationHostSource = Application.Current.Host.Source;
var request = "http://" + applicationHostSource.Host + ":" + applicationHostSource.Port +"/" + "Image.png";
wc.OpenReadCompleted += (sender, downloadStreamCompletedEventArgs) =>
var stream = downloadStreamCompletedEventArgs.Result;
var image = new BitmapImage();
StoredImage = image;

wc.OpenReadAsync(new Uri(request));