Really, you’d think there would be lots of choice when it comes to hosting wouldn’t you? Well I’ve spent several days and many phone calls to try and find a hosting company for the up and coming launch of glasscubes.com . Aside from rackspace I cannot (yet) find a company that understands whats needed and can provide a good level of support.
Most of the companies have 24×7 support, but it many ticket based, of even if phone based, they still have at best an hours resolution time. Thats just not going to cut the mustard. We need a company that can respond immeadiately to a situation - its unacceptable for our customers not to have access to their data. We on our side a building a very reliable and fault tolerant system. However there are always unexpected issues in production coming from hardware, network to just plain unlucky.
So far Rackspace have been the only company that can provide what we’re after at the level we want - so whats the problem? well cost of course - as a small startup where every penny counts its a bit painfull. Whether we can find a replacement or not in the next couple of months we’ll see.
Just to add, we’ve been looking at Amazon EC2 as well with interest. I’d love to go with that for many reasons - whats stopping us? - slow support turn around…
Posted in general.
Tagged with cloud, hosting.
Not wicket related but checkout Google servers - they finally lifted the lid on how they do it.
[credit cnet]
MOUNTAIN VIEW, Calif.–Google is tight-lipped about its computing operations, but the company for the first time on Wednesday revealed the hardware at the core of its Internet might at a conference here about the increasingly prominent issue of data center efficiency.
Most companies buy servers from the likes of Dell, Hewlett-Packard, IBM, or Sun Microsystems. But Google, which has hundreds of thousands of servers and considers running them part of its core expertise, designs and builds its own. Ben Jai, who designed many of Google’s servers, unveiled a modern Google server before the hungry eyes of a technically sophisticated audience.
Google’s big surprise: each server has its own 12-volt battery to supply power if there’s a problem with the main source of electricity. The company also revealed for the first time that since 2005, its data centers have been composed of standard shipping containers–each with 1,160 servers and a power consumption that can reach 250 kilowatts.
read the rest here on CNET

Posted in general.
Don’t know about you but apache wickets DropDownChoice has always confused me somewhat. Take today, I was trying to createa simple dropdown choice that displays all the ‘cubes’ in our web application . It wasn’t tied to a form, as I had overrided the onSelectionChanged menthod. So we had:
add(new DropDownChoice<TeamProject>("otherCubes", getCubeService().getCubes()) {
@Override
protected boolean wantOnSelectionChangedNotifications() {
return true;
}
@Override
protected void onSelectionChanged(TeamProject newSelection) {
setResponsePage(new ProjectPage(newSelection));
}
});
This seem to work fine until I actually selected something. I was getting:
java.lang.IllegalStateException: Attempt to set model object on null model of component: cubeTab:cubesContainer:allProjects:otherCubes
at org.apache.wicket.Component.setDefaultModelObject(Component.java:3007)
at org.apache.wicket.markup.html.form.FormComponent.updateModel(FormComponent.java:1141)
at org.apache.wicket.markup.html.form.DropDownChoice.onSelectionChanged(DropDownChoice.java:157)
at java.lang.reflect.Method.invoke(Unknown Source)
turns out I must have a default model, even if I don’t use it :
...
add(new DropDownChoice<TeamProject>("otherCubes", new Model(), getCubeService().getCubes())
..
Posted in general.
Don’t you love Internet Explorer? Man if this browser didn’t exist just thing of the millions of dollars/euro/etc that would be saved every week from developers not having to graple with Microsofts buggy/hard-to-work-with browser. I will be a happy man the day it dies.
Anyhow the reason for the post: We noticed here that IE handles return key pressed events different when submitting a form. We have a form with a signal TextArea and a AjaxButton. In Firefox when either clicking on the button or hitting return in the text area we would arrive on our AjaxButtons onSubmit method. All good and dandy.
However
In IE when clicking on the button everything worked as expected. But when hitting return we found that the page just refreshed and the onSubmit of the ajaxbutton was not called. It turns out that FF and IE handle this differently. FF will look for the first button in the form and submit that, where as IE simply submits the whole form.
This means we had to implement the onSubmit in the form as well as the AjaxButton onSubmit.
Problem here is you end of duplicating code as you only have the AjaxRequestTarget on the ajaxbutton onSubmit. Jeremy Thomerson came up with a couple fo suggestions one of which we have implemented do get rid of this duplicate code. I’d be interested to know if anyone has come up with a better way of handling this:
= new Form() {
add(new AjaxButton() {
void onSubmit() {
if(!form.isSubmitted()) {
onSubmit();
}
}
void onSubmit() {
IRequestTarget iTarget = RequestCycle.get().getRequestTarget();
AjaxRequestTarget target= null;
if (iTarget instanceof AjaxRequestTarget) {
target = (AjaxRequestTarget) iTarget;
}
//logic..
}
}
This seems to work fine.
Posted in general.
I was trying to replace a Panel in a fairly complex page, by doing:
Panel viewer = ...
add(viewer);
(…)
public void onClick() {
Panel newDetailPanel = new DetailPanel(viewer.getId(), documentModel);
viewer.replaceWith(newDetailPanel);
}
… that seems and works fine — but only on the first click!
The problem is: if I carry on clicking / replacing Panels, Wicket will throw an Exception:
java.lang.IllegalStateException: This method can only be called on a component that has already been added to its parent.
This happens because the second time we click on the link, Wicket loses the reference to the original viewer Panel, therefore not being able to determine whether it has been added to some component in the hierarchy (and can’t call replaceWith on a component that hasn’t been added).
So we will need to update that reference:
public void onClick() {
YourMainPanelOrPage.this.addOrReplace(viewer);
Panel newDetailPanel = new DetailPanel(viewer.getId(), documentModel);
viewer.replaceWith(newDetailPanel);
viewer = newDetailPanel;
}
…and now it should work.
Posted in general.
Something I just came across today whilst creating a BookmarkablePageLink, was an issue where it appeared that the parameters I was passing to the constructor where not being passed to the new instance. I orginally had something like:
PageParameters map = new PageParameters();
BookmarkablePageLink link = new BookmarkablePageLink(”team”, TeamPage.class, map);
if (testCondition) {
map.put(TeamtPage.TEAMID, teamId);
}
This did not work. However a quick look at the source code for BookmarkablePageLink reveals why:
this.parameters = pageParametersToMiniMap(parameters);
It is essentially creating a new Map which is stored in the class, and hence when adding items to the Map after calling the constructor does not work. Obvously the good code is:
PageParameters map = new PageParameters();
if (testCondition) {
map.put(TeamtPage.TEAMID, teamId);
}
BookmarkablePageLink link = new BookmarkablePageLink(”team”, TeamPage.class, map);
Anyhow whats the moral of this? make sure you have the source to Wicket in your IDE as one of the great things about this framework is that you can look at the very understandable source and see what is happening straight away
Posted in wicket.
Tagged with navigation, wicket.
This is not directly related to wicket but I guess that many might be using warp-persist in their project.
I am using @Transactional annotation to mark my methods in the service layer. Everything was working as expected until … until I did something like this:
public class UserService {
public User createNewUser (String name) {
...
createNewUser(name, defaultPermission);
...
}
@Transactional
private User createNewUser (String name, Permission permission) {
...
}
}
The surprise here is that in this case the transaction will never be created! The @Transactional works only on non private methods since private methods can not be intercepted for transaction wrapping.
This is well documented here. A classic case of RTFM
Posted in general.
Just a quick tip that I didn’t realise I could do , if say you can an Entity:
public class Person {
String name;
List emails;
}
public class Email {
String email;
}
Say for whatever reason I only want to show the first email in the list you can do the following using a CompoundPropertyModel :
...
setModel(new CompoundPropertyModel
(person);
add(new Label("name"));
add(new Label("email", new PropertyModel(item.getModel(), "emails[0].email")));
Notice the syntax for the PropertyModel and how you get directly index the list:
emails[0].email
. Wicket is smart enough to take care of nulls, which is why wicket is wicked.
Posted in general.
Tagged with Add new tag.
Well 2009 is finally here and to kick it off, we’ve created wicket dev to document our docoveries, pain and of course pleasure working with Apache Wicket. Over time we hope that we can provide some good handy snippets of code and tips that we discover whilst building our next generation social productivity application.
Posted in general.
Tagged with new.