Good Java property files editor

I used plugin for eclipse. I think this one: http://sourceforge.net/projects/eclipse-rbe/ It is OK, allows adding and renaming properties, shows warnings if property is not translated to all supported languages etc. Its disadvantage is that it always uses `\uXXXX’ notation for unicode characters. So, you must use this plugin to read created files. It makes search … Read more

Closing a java.util.Iterator

Create a custom iterator which implement the AutoCloseable interface public interface CloseableIterator<T> extends Iterator<T>, AutoCloseable { } And then use this iterator in a try with resource statement. try(CloseableIterator iterator = dao.findAll()) { while(iterator.hasNext()){ process(iterator.next()); } } This pattern will close the underlying resource whatever happens: – after the statement complete – and even if … Read more

C# attribute text from resource file?

Here is my solution. I’ve added resourceName and resourceType properties to attribute, like microsoft has done in DataAnnotations. public class CustomAttribute : Attribute { public CustomAttribute(Type resourceType, string resourceName) { Message = ResourceHelper.GetResourceLookup(resourceType, resourceName); } public string Message { get; set; } } public class ResourceHelper { public static string GetResourceLookup(Type resourceType, string resourceName) { … Read more

Create a control in Resources and reuse it in XAML WPF

When you define a arbitrary Control in Resources, you can use it in the future in Control which have property Content and derived from Control class. These are the followings: ContentControl, Label, ContentPresenter, etc. Also you must set x:Shared=”False” for resource if you want to use this resource in many Controls, because x:Shared=”True” by default … Read more