Montag, 2. Juli 2007
Dynamic two dimensional array in Java
I need a dynamic two dimensional array in Java. I thought I might not be the only one, so I searched with regular search engines and the code searches. Surprisingly I did not find any free implementation. I thought this would be a such common case, that the JRE or at least the Jakarta Commons Collections might contain it. No, they do not.
It seems the rest of the world builds their own implementation or uses the javax.swing.table.TableModel and javax.swing.table.DefaultTableModel. The public API of the latter gets near to what I want, but it’s not exactly what I was looking for.
I thought about something like this:
It seems the rest of the world builds their own implementation or uses the javax.swing.table.TableModel and javax.swing.table.DefaultTableModel. The public API of the latter gets near to what I want, but it’s not exactly what I was looking for.
I thought about something like this:
interface TwoDimensionalArray<T>
{
T set(int x, int y, T value);
boolean add(int x, int y, T value);
T get(int x, int y);
Iterator<Iterable<T>> iterator();
boolean isEmpty();
/** returning the overall element count */
int size();
}
Geschrieben von Jörg
in Softwaretechnik
um
08:02
| Kommentare (0)
| Trackbacks (0)
Tags für diesen Artikel: java, open source
Samstag, 23. Juni 2007
Fußbad beim Wandern
Samstag, 9. Juni 2007
Harz Fotos: Rammelsberg
Sehr ruhig hier, oder?
Jogi war neulich ne Woche im Harz und hat knapp 1000 Fotos mitgebracht. Es sind ein paar wirklich schicke dabei.
Hier zwei Exemplare die in den Übertageanlagen des Bergwerks Rammelsberg gemacht wurden. Demnächst vielleicht mehr.
Sonntag, 22. April 2007
declarative music playlists
Last night, while playing a fantasy roleplay game, we listened to an appropriate selfmade radio channel at pandora. I just created a new channel with “Enya”, “Loreena McKennitt”, “Blackmore’s Night” and other artists we would probably have thrown into the CD player instead. We had to rate some songs over the night, but most the time the music was just what we wanted it to be. Surely with many artist we did not even know before. Cool!
Hearing two other channels with the very nice quick mix function along breakfast this morning, I thought about the technology behind it. What was not obvious to me, when using pandora, was that I describe what I want to hear. So it’s a form of declarative music playlist, analogous to fourth generation programming languages. In a simpler manner the “intelligent playlists” in iTunes are the same. As software developer, used to declarative languages like SQL, I use them most the time - but missing complexe conditions and ad-hoc querys.
Concerning pandora I miss one thing the most: I sometimes like to describe what I disliked within a specific song, because I don’t want pandora to guess. But that’s the offtrade, when handing over responsibility in those declarative ways.
Hearing two other channels with the very nice quick mix function along breakfast this morning, I thought about the technology behind it. What was not obvious to me, when using pandora, was that I describe what I want to hear. So it’s a form of declarative music playlist, analogous to fourth generation programming languages. In a simpler manner the “intelligent playlists” in iTunes are the same. As software developer, used to declarative languages like SQL, I use them most the time - but missing complexe conditions and ad-hoc querys.
Concerning pandora I miss one thing the most: I sometimes like to describe what I disliked within a specific song, because I don’t want pandora to guess. But that’s the offtrade, when handing over responsibility in those declarative ways.
Montag, 9. April 2007
Machine Tags tuned
Schon vor einiger Zeit hatte ich bei Frank Westphal über Machine Tags gelesen. Geniales Konzept? Jain. Genial schon, aber eigentlich alles alte Bekannte. Worum geht es?
In Kürze: Normale Tags sind vollkommen ungeordnete Schlagwörter die entweder “vorhanden” oder “zugeordnet” sind oder nicht. Machine Tags haben auch einen Wert und sogar noch einen Namensraum:
<namespace>:<key>=<value>
Also zum Beispiel:
lang:name=java
lang:ver=1.5
Erinnert natürlich stark an XML oder? Oder auch an Properties-Dateien mit Prefixen, wie sie mein Chef gerne verwendet. (Prefixe beispielsweise für Staging, siehe auch Java Magazine 3/07.)
Sie heißen Machine Tags, weil man davon ausgegangen ist, dass sie hauptsächlich von Maschinen benutzt werden würden. Wie Westphals Artikel aber zeigt, ist dies absolut nicht der Fall und sie eröffnen eine ganz neue Dimension des Taggings.
Wie bin ich darauf gekommen diesen Artikel heute wieder auszugraben? Ich habe via iTunes Musik gehört, bewertet, kategorisiert und mich zum wiederholten Mal darüber geärgert, dass man hier nicht vernünftig taggen kann. Ich hatte mir vor einiger Zeit deshalb schon mal ein Tagging-System überlegt, welches ich den Jungs von Songbird vorgeschlagen habe, aber leider in den Wirren ihresbeschi... bescheidenen Forums unterging. Und wenn ich drüber nachdenke ist es fast das gleiche.
Was ich würde gerne Tags wie folgend zu vergeben können:
dance:jive=4
dance:foxtrott=5
rating:jens=4
rating:nils=3
rating:jörg=5
rating:anna=4
rating:average=4
occasion:party=5
occasion:cocktails=4
occasion:work=1
...
Man sieht es: Kategorisierte Tags mit Gewichtung. (Hier mit dem praktikablen 1-5 Sterne Prinzip)
Vielleicht sogar:
occasion:party:jens=5
occasion:party:nils=4
occasion:party:joerg=5
...
Dann noch entsprechende Filtrierungen in “intelligenten Wiedergabelisten” und Ad-hoc.
Sahnehäubchen: Das ganze als p2p-social-tagging-community ...
In Kürze: Normale Tags sind vollkommen ungeordnete Schlagwörter die entweder “vorhanden” oder “zugeordnet” sind oder nicht. Machine Tags haben auch einen Wert und sogar noch einen Namensraum:
<namespace>:<key>=<value>
Also zum Beispiel:
lang:name=java
lang:ver=1.5
Erinnert natürlich stark an XML oder? Oder auch an Properties-Dateien mit Prefixen, wie sie mein Chef gerne verwendet. (Prefixe beispielsweise für Staging, siehe auch Java Magazine 3/07.)
Sie heißen Machine Tags, weil man davon ausgegangen ist, dass sie hauptsächlich von Maschinen benutzt werden würden. Wie Westphals Artikel aber zeigt, ist dies absolut nicht der Fall und sie eröffnen eine ganz neue Dimension des Taggings.
Wie bin ich darauf gekommen diesen Artikel heute wieder auszugraben? Ich habe via iTunes Musik gehört, bewertet, kategorisiert und mich zum wiederholten Mal darüber geärgert, dass man hier nicht vernünftig taggen kann. Ich hatte mir vor einiger Zeit deshalb schon mal ein Tagging-System überlegt, welches ich den Jungs von Songbird vorgeschlagen habe, aber leider in den Wirren ihres
Was ich würde gerne Tags wie folgend zu vergeben können:
dance:jive=4
dance:foxtrott=5
rating:jens=4
rating:nils=3
rating:jörg=5
rating:anna=4
rating:average=4
occasion:party=5
occasion:cocktails=4
occasion:work=1
...
Man sieht es: Kategorisierte Tags mit Gewichtung. (Hier mit dem praktikablen 1-5 Sterne Prinzip)
Vielleicht sogar:
occasion:party:jens=5
occasion:party:nils=4
occasion:party:joerg=5
...
Dann noch entsprechende Filtrierungen in “intelligenten Wiedergabelisten” und Ad-hoc.
Sahnehäubchen: Das ganze als p2p-social-tagging-community ...
« vorherige Seite
(Seite 6 von 17, insgesamt 81 Einträge)
» nächste Seite


Jörg bei Twitter

