iPhone MKMapView Annotation Clustering

You don’t necessarily need to use a 3rd party framework because since iOS 4.2, MKMapView has a method called – (NSSet *)annotationsInMapRect:(MKMapRect)mapRect which you can use to do your clustering. Check out the WWDC11 Session video ‘Visualizing Information Geographically with MapKit‘. About half way through it explains how to do it. But I’ll summarize the … Read more

Java Annotations

Annotations are primarily used by code that is inspecting other code. They are often used for modifying (i.e. decorating or wrapping) existing classes at run-time to change their behavior. Frameworks such as JUnit and Hibernate use annotations to minimize the amount of code you need to write yourself to use the frameworks. Oracle has a … Read more

How to write a Java annotation processor?

This can not be done with a compile time annotation processor. Compile time time annotation processors can only generate new files (and classes) they can not modify existing classes. You can do reflection at runtime but strictly speaking you that is not called annotation processing. Also you won’t have access to local variables. If you’re … Read more

Annotate Time Series plot

Matplotlib uses an internal floating point format for dates. You just need to convert your date to that format (using matplotlib.dates.date2num or matplotlib.dates.datestr2num) and then use annotate as usual. As a somewhat excessively fancy example: import datetime as dt import matplotlib.pyplot as plt import matplotlib.dates as mdates x = [dt.datetime(2009, 05, 01), dt.datetime(2010, 06, 01), … Read more

Hibernate mapping between PostgreSQL enum and Java enum

You can simply get these types via Maven Central using the Hypersistence Util dependency: <dependency> <groupId>io.hypersistence</groupId> <artifactId>hypersistence-utils-hibernate-55</artifactId> <version>${hibernate-types.version}</version> </dependency> If you easily map Java Enum to a PostgreSQL Enum column type using the following custom Type: public class PostgreSQLEnumType extends org.hibernate.type.EnumType { public void nullSafeSet( PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, … Read more