As I was again trying to remember how to sort a list of objects in Java bases on multiple keys, I had the luminous idea to finally write it down.
We have a list of pizza’s, and I want them sorted according to size, number of toppings and furthermore by name. This means that there will be groups ordered by size and within those groups the pizza’s are ordered into groups by number of toppings and in those groups the pizza’s are ordered by name.
We want to end up with a list like this:
- Pizza’s 34cm:
- Anchovy (34cm, tomato, cheese, Anchovies)
- Prosciutto (34cm, tomato, cheese and ham)
- Chicken Special (34cm, tomato, cheese, chicken and turkey pieces)
- Vulcano (34cm, tomato, cheese, mushrooms and ham)
- Peperone (34cm, tomato, cheese, mushrooms, ham, capsicum, chili peppers and onions)
- Pizza’s 30cm:
- Anchovy (30cm, tomato, cheese, Anchovies)
- Prosciutto (30cm, tomato, cheese and ham)
- Chicken Special (30cm, tomato, cheese, chicken and turkey pieces)
- Vulcano (30cm, tomato, cheese, mushrooms and ham)
- Peperone (30cm, tomato, cheese, mushrooms, ham, capsicum, chili peppers and onions)
- Pizza’s 26cm:
- Anchovy (26cm, tomato, cheese, Anchovies)
- Prosciutto (26cm, tomato, cheese and ham)
- Chicken Special (26cm, tomato, cheese, chicken and turkey pieces)
- Vulcano (26cm, tomato, cheese, mushrooms and ham)
- Peperone (26cm, tomato, cheese, mushrooms, ham, capsicum, chili peppers and onions)
I hadn’t gotten around to putting Simple Java Mail into Maven Central due to the complexities of going through Sonatype first. But now it is done: Simple Java Mail v1.9 now resides in Maven Central and can be included in your project using the following dependency:
NOTE: This article demonstrates a way to set up a database for private in-app use only. If you need to provide content to the outside world, this article is not for you.
You want use a database inside your application to store static or dynamic content, right? Then perhaps you went to the Android docs on creating databases? The first thing you’ll notice is that it mentions content providers and the NotePadProvider example of this principle. Once you start digging into that, you may very well get lost at first, consider how convoluted this system works, with uri’s, matchers, paths and all. It gets messy quickly with lots of constants denoting your exposed content URI’s on top of your database properties and mapping in between.
Toss all that out please, you don’t need it.
Posted in android
Recently my WordPress instance crashed due to a faulty plugin update, resulting in a PHP error and rendering my blog useless. After overcoming the initial panic reaction, I realized i didn’t need to dive into the PHP code just yet: I could just disable the plugin in the database instead.
Here’s how, given you have access to the database.
Since the Android SDK doesn’t come with the source code, you need to get it manually from the Google Git repo’s. Unfortunately, the tutorial is Linux oriented and convoluted. Fortunately, us pesky Windows users have people like Brad Chow and some helpful Asian folks that provide us with a solution out of the box.
Here’s a recap:
Last week we took a quick look on how to make clover ignore private constructors in Eclipse. This week, we’ll quickly cover Ant
Here’s a blatant repost of How to make Clover ignore private constructors by Alex Ruiz.
I was actually looking for a regular expression matching private constructors so that I could make Clover ignore these in the Eclipse plugin. His post is about how to configure Clover in Maven however, here’s how you configure the Eclipse plugin.
Having several projects in Bamboo that share a repository, build script and libraries, it can be tricky to configure Bamboo build plans correctly; but it isn’t hard at all. I’m going to quickly show you how I configured Bamboo Plans for two projects that are in the same repository, but share a master library. This is a very common setup and the point is to make Bamboo build only for the plans if their associated project has been updated.
In addition to the shared master library folder, I’m going to include a master build.xml file as well and see how that works with the nested projects.
I recently needed to move over my code base from a remote repository to another remote repository using Subversion. To accomplish this I used svnsync, as demonstrated by this excellent little article. Here’s a quick Windows version of that article, demonstrating a google code project migration.
Very Simple Java Mail is no more. Long live Simple Java Mail!
Vesijama has been renamed to Simple Java Mail and the name Vesijama has been degraded to a working title. The reason: the title didn’t reflect the intention nor the function of the project and people complained about the outlandish name.
And so the project moved altogether to a new space at Google code: Simple Java Mail.
For now the library jars have been renamed manually, but in the future the name will be incorporated in the sourcecode itself as well.