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:
--aggressive
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.
Search This Blog
Friday, February 8, 2013
Git - running garbage collection on your repository
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>.
<UserControl
[....]
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors">
<UserControl.Resources>
<DataTemplate x:Key="headerTemplate">
<dxe:TextEdit Text="{Binding Path=Content, Mode=OneWay}" />
</DataTemplate>
</UserControl.Resources>
[....]
</UserControl>
var preview = new DocumentPreviewWindow();
var link = CreateExportServiceLink(gridControl, preview);
PrepareHeader(link);
private PrintableControlLink CreateExportServiceLink(
IPrintableControl gridControl,
DocumentPreviewWindow documentPreviewWindow)
{ var link = new PrintableControlLink(gridControl)
{
ExportServiceUri = "http://127.0.0.1:8080/IExportService",
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";
}
<UserControl
[....]
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors">
<UserControl.Resources>
<DataTemplate x:Key="headerTemplate">
<dxe:TextEdit Text="{Binding Path=Content, Mode=OneWay}" />
</DataTemplate>
</UserControl.Resources>
[....]
</UserControl>
var preview = new DocumentPreviewWindow();
var link = CreateExportServiceLink(gridControl, preview);
PrepareHeader(link);
private PrintableControlLink CreateExportServiceLink(
IPrintableControl gridControl,
DocumentPreviewWindow documentPreviewWindow)
{ var link = new PrintableControlLink(gridControl)
{
ExportServiceUri = "http://127.0.0.1:8080/IExportService",
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.
{
protected ComboBoxDefinition(BeanContainer<T> beanContainer)
{
}
}
{
public void draw(List<? extends Control> controls) {
}
}
- Java generic classes
{
protected ComboBoxDefinition(BeanContainer<T> beanContainer)
{
}
}
- Java generic methods
{
public void draw(List<? extends Control> controls) {
}
}
- Java static generic methods
public class SomeClass
{
public static <T extends Identifiable> void create(BeanContainer<T> beanContainer) {
{
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();
image.SetSource(stream);
StoredImage = image;
};
wc.OpenReadAsync(new Uri(request));
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();
image.SetSource(stream);
StoredImage = image;
};
wc.OpenReadAsync(new Uri(request));
Monday, January 7, 2013
Aero2 Poland APN settings
Aero 2 is an operator that serves free internet access in Poland. To set APN settings in Aero2 on an Android device just enter these:
Nazwa: darmowy
APN: darmowy
Proxy: <nie ustawiono>
Port: <nie ustawiono>
Nazwa Użytkownika: <nie ustawiono>
Hasło: <nie ustawiono>
Serwer: <nie ustawiono>
MMSC: <nie ustawiono>
Proxy dla wiadomości MMS: <nie ustawiono>
Port MMS: <nie ustawiono>
Protokół MMS: <nie ustawiono>
MCC: 260
MNC: 17
Typ uwierzetylnienia: <nie ustawiono>
Typ APN: <nie ustawiono>
Name: darmowy
APN: darmowy
Proxy: <nie ustawiono>
Port: <nie ustawiono>
Username: <nie ustawiono>
Password: <nie ustawiono>
Server: <nie ustawiono>
MMSC: <nie ustawiono>
MMS message proxy: <nie ustawiono>
MMS port: <nie ustawiono>
MMS Protocol: <nie ustawiono>
MCC: 260
MNC: 17
Authorization type: <nie ustawiono>
APN type: <nie ustawiono>
Nazwa: darmowy
APN: darmowy
Proxy: <nie ustawiono>
Port: <nie ustawiono>
Nazwa Użytkownika: <nie ustawiono>
Hasło: <nie ustawiono>
Serwer: <nie ustawiono>
MMSC: <nie ustawiono>
Proxy dla wiadomości MMS: <nie ustawiono>
Port MMS: <nie ustawiono>
Protokół MMS: <nie ustawiono>
MCC: 260
MNC: 17
Typ uwierzetylnienia: <nie ustawiono>
Typ APN: <nie ustawiono>
Name: darmowy
APN: darmowy
Proxy: <nie ustawiono>
Port: <nie ustawiono>
Username: <nie ustawiono>
Password: <nie ustawiono>
Server: <nie ustawiono>
MMSC: <nie ustawiono>
MMS message proxy: <nie ustawiono>
MMS port: <nie ustawiono>
MMS Protocol: <nie ustawiono>
MCC: 260
MNC: 17
Authorization type: <nie ustawiono>
APN type: <nie ustawiono>
Thursday, January 3, 2013
Devexpress PrivotGridField header template in RowArea
Here's a little image that should help in understanding which templates work for which parts of DevExpress PivotGrid. My goal was to change the header of the row in PivotGrid (to be precise the header of the PivotGridField in RowArea)
<dxpg:PivotGridField x:Name="fieldProduct" FieldName="ProductName" Area="RowArea" AreaIndex="2" AllowedAreas="RowArea" ValueTemplate="{StaticResource productNameHeaderTemplate}" />
<dxpg:PivotGridField x:Name="fieldProduct" FieldName="ProductName" Area="RowArea" AreaIndex="2" AllowedAreas="RowArea" ValueTemplate="{StaticResource productNameHeaderTemplate}" />
Sunday, December 23, 2012
Java Vaadin controls - ControlHelper getParent()
Vaadin controls, just like every other UI, creates a child-parent tree. This class helps to retrieve parent of a specified type. getParent() is extremely useful when invoked deep withing the tree structure to e.g. retrieve the main tab control and close it.
/**
* The purpose of this class is to help with the management of Vaadin controls child-parent tree.
*/
public class ControlHelper {
private static final int _MAXIMUM_PARENT_ITERATION_COUNT = 100;
/**
* Get parent of the control which has a specified type.
*
* @param cls type of the control to return
* @param control origin control (where to start traversing the tree)
* @param <T>
* @return
*/
public static <T extends AbstractComponent> T getParent(Class<T> cls, AbstractComponent control)
{
if (control == null)
return null;
AbstractComponent parent = control;
for (int i = 0; i < _MAXIMUM_PARENT_ITERATION_COUNT; i++)
{
if (parent.getParent() == null)
return null;
//Return parent of the desired class type
if (parent.getParent().getClass().isAssignableFrom(cls))
return (T) parent.getParent();
parent = (AbstractComponent) parent.getParent();
}
return null;
}
}
/**
* The purpose of this class is to help with the management of Vaadin controls child-parent tree.
*/
public class ControlHelper {
private static final int _MAXIMUM_PARENT_ITERATION_COUNT = 100;
/**
* Get parent of the control which has a specified type.
*
* @param cls type of the control to return
* @param control origin control (where to start traversing the tree)
* @param <T>
* @return
*/
public static <T extends AbstractComponent> T getParent(Class<T> cls, AbstractComponent control)
{
if (control == null)
return null;
AbstractComponent parent = control;
for (int i = 0; i < _MAXIMUM_PARENT_ITERATION_COUNT; i++)
{
if (parent.getParent() == null)
return null;
//Return parent of the desired class type
if (parent.getParent().getClass().isAssignableFrom(cls))
return (T) parent.getParent();
parent = (AbstractComponent) parent.getParent();
}
return null;
}
}
Subscribe to:
Posts (Atom)
