I got about an 8 month headstart on my team with wicket and jdave and I'm seeing them constantly run into the same stuff I had to figure out earlier, so I thought I'd cover the issues publicly and hopefully that will help out other people who just want to jump in and start coding without reading any waterfally books, mailing lists or wikis.
Q. my model object is not updated when I submit with formtester
A. do you have validation errors? check with wicketTester.getMessages(errorlevel). then check out how wicket validation works
Hint: FormTester was upgraded for 1.3 so that setValue(field,value) fails silently, i.e. does nothing, when you set a value on a field that does not exist. practical. selectValue doesn't the opposite.
Q. wicket.debugComponentTrees(); just gives a dashed line
A. your component has been started without markup. if it's not a Page, Border or Panel this will happen. create a HelperPanel (or is there such a thing already in wicket?), add, your component to that, and start testing. you can make your helperpanel implement IMarkupResourceStreamProvider, and then provide the markup in a string, rather than a separate file.
if debugComponentTrees doesn't even give you a dashed line, it's worth noting that the output comes from log4j at debug level, you must configure your wickettester class to be able to output at that level.
Q. I want to test a FormComponent
A. so far jdave doesn't help you out, so every project I know has made their own FormComponentSpecification. it's like above, with the helperpanel, but with a helper form.
Tip: FormComponentPanel extends FormComponent but not Panel, look at the implementation how it handles the panelish stuff. there, when testing an FCP, you will get no markup by default. so I herd u liek traits.
Q. I set outputMarkupId(true) on my component, but it can't be made visible with my ajax behavior, and there's no error message anywhere
A. setOutputMarkupId outputs the markup id(!), so that wicket's javascript can find the right place to fiddle with the DOM. if your component is initially invisible, outputting the markupid won't help. you have to also setOutputMarkupPlaceholderTag(true) also, which means, an invisible component gets a place holder in the html which can then be replaced with the actual component and its contents. (actually there's a hard to find error message in the wicket ajax debug window, if you open up your page in the browser, instead of just hanging out with your red bar)
as an aside, you can call setOutputMarkupId(true) in an unreasonable place, such as inside your ajax behavior's event method, just before target.addComponent(component); wicket won't realize you did this, but things won't work as you'd hope either.
Q. calling component.replaceWith(otherComponent) twice fails, my component is not attached to a parent :(
A. the first time you call it, component becomes unattached to its parent, and otherComponent is added in its place. the second time, you should replace otherComponent, with the third component. (attaching also has a specific definition in Wicket, which I am not referencing here.)
Tip: when you have an open FormTester, and you execute an ajax event, you have to start (and populate) another formtester, if you want to keep fiddling with your form
Tip: the wicket form processing works as follows
1. everything in http is a String array, this is in getRawInput();
2. values are first converted from String[] to whatever type is expected, either by the model object, or by a specific converter you have set on your formcomponent, this value goes into getConvertedInput();
3. validation is performed on the converted input
4. if validation passes for everything on the form, the converted input is copied into the models as the model objects.
Monday, February 25, 2008
Monday, February 18, 2008
mobile services
while all kinds of quasi-useless stuff like hsdpa get massive coverage, there are numerous interesting advances in mobile networks, that are not really publicized adequately. no employer I have ever had has added any new mobile services besides packet radio to their subscriptions. and with employer controlled subscriptions, individual employees usually are unable to enable any services on their own.
for example, multisim: several handsets share the same mobile number. up to five phones(sim cards) can participate, and can all be turned on at the same time. I have an e90, which, I have to say is LARGE, even compared to my previous n73 which was already a well built phone. there are several sub-100 euro phones out there, most of them quite small, which can be used as a secondary handset for sports, drinking or drunk sports.
push-to-talk. when phones with PoC came out in Finland, no operator supported it. a year ago I found out they do now, but it's hard to find out anything about it. supposedly it gets old really quick, but I can't know.
for some reason the network still sends out the msisdn to the handset when making a call or texting, rather than something more interesting, such as the name of the caller.
I shouldn't forget my favorite features, which are the 1700meter accurate symbian 3rd edition location service available on gmm and nokia's operator independent agps with 15 second satellite locks inside a moving vehicle.
for example, multisim: several handsets share the same mobile number. up to five phones(sim cards) can participate, and can all be turned on at the same time. I have an e90, which, I have to say is LARGE, even compared to my previous n73 which was already a well built phone. there are several sub-100 euro phones out there, most of them quite small, which can be used as a secondary handset for sports, drinking or drunk sports.
push-to-talk. when phones with PoC came out in Finland, no operator supported it. a year ago I found out they do now, but it's hard to find out anything about it. supposedly it gets old really quick, but I can't know.
for some reason the network still sends out the msisdn to the handset when making a call or texting, rather than something more interesting, such as the name of the caller.
I shouldn't forget my favorite features, which are the 1700meter accurate symbian 3rd edition location service available on gmm and nokia's operator independent agps with 15 second satellite locks inside a moving vehicle.
Tunnisteet:
innovation,
mobile
Saturday, February 16, 2008
transactional memory
while efficient support for STM for mainstream programming environments may be an academic endeavour, it looks like intel and sun are going for hardware or hybrid implementations. out in 2009.
atleast in the haskell version, because of the types of the transactional variables, code won't compile when attempting to use transactional variables outside of transactions.
atleast in the haskell version, because of the types of the transactional variables, code won't compile when attempting to use transactional variables outside of transactions.
Tunnisteet:
transactional memory
Wednesday, February 6, 2008
STM's
with multicore cpus upon us, we have to get concurrent everywhere. an alternative to locks for imperative programming is Software Transactional Memory.
a programmer I respect, was out for a week, so he missed out on this. after learning so much from him, it was a pleasure to be able to teach him something new.
in essence, rather than having locks, taking them in some priority, forgetting to release them, forgetting to take them, taking too many, etc, certain state containing variables, are declared transactional.
as in a database, in an atomic and isolated block, reads and writes to these transactional variables operate on a transaction log, which is replayed uninterruptibly at the end of the transaction. if STM variables are accessed by another thread the transaction can be retried, the transaction can block until a condition is met, or transactions can be combined to solve the withdraw from one of two accounts problem.
MapReduce decouples the parallelization code from the application code for a certain subset of problems, STM does the same for a different set of problems. currently STM is only available for totally awesome programming languages.
a programmer I respect, was out for a week, so he missed out on this. after learning so much from him, it was a pleasure to be able to teach him something new.
in essence, rather than having locks, taking them in some priority, forgetting to release them, forgetting to take them, taking too many, etc, certain state containing variables, are declared transactional.
as in a database, in an atomic and isolated block, reads and writes to these transactional variables operate on a transaction log, which is replayed uninterruptibly at the end of the transaction. if STM variables are accessed by another thread the transaction can be retried, the transaction can block until a condition is met, or transactions can be combined to solve the withdraw from one of two accounts problem.
MapReduce decouples the parallelization code from the application code for a certain subset of problems, STM does the same for a different set of problems. currently STM is only available for totally awesome programming languages.
Tunnisteet:
concurrency,
haskell,
stm
Sunday, February 3, 2008
global optimization
i'm amazed at how quickly knowledge rots in the software development (and consulting) world. but I'm never surprised by the horrors it creates.
when the customer says they want a system that does X, we're actually trying to find a global optimum for the customer's business. if we see that for one tenth of the cost, we can improve Y, so that X becomes totally unnecessary we'll suggest that.
this requires that we have up to date information on Y. if we know what was best practice 2 or 5 years ago, and we base our decisions on that, we might be leading everyone down the wrong path.
one thing we run into a constantly is databases. mysql 3.23 didn't have transactions, and its contemporary postgresql didn't have inner joins. knowing just that, one would never be able to move beyond oracle.
personally, I just learned that mysql is adding two new storage engines maria and falcon. I just told my friend, who has to run two versions of the same application, the older of which has a suboptimal schema, that mysql has triggers and views.
people are telling me, mysql high-avalailability, scalability, and replication are issues, and that in oracle they are transparent. is this true? how can I find out? and is the proverbial ROI, best here, or is my time best spent on something completely different?
we have to balance the benefit of a better choice, with the cost of acquiring the information to justify our decisions.
in agile software development, we have a phrase that says we decide everything at the last responsible moment. that is essentially the same balance.
when the customer says they want a system that does X, we're actually trying to find a global optimum for the customer's business. if we see that for one tenth of the cost, we can improve Y, so that X becomes totally unnecessary we'll suggest that.
this requires that we have up to date information on Y. if we know what was best practice 2 or 5 years ago, and we base our decisions on that, we might be leading everyone down the wrong path.
one thing we run into a constantly is databases. mysql 3.23 didn't have transactions, and its contemporary postgresql didn't have inner joins. knowing just that, one would never be able to move beyond oracle.
personally, I just learned that mysql is adding two new storage engines maria and falcon. I just told my friend, who has to run two versions of the same application, the older of which has a suboptimal schema, that mysql has triggers and views.
people are telling me, mysql high-avalailability, scalability, and replication are issues, and that in oracle they are transparent. is this true? how can I find out? and is the proverbial ROI, best here, or is my time best spent on something completely different?
we have to balance the benefit of a better choice, with the cost of acquiring the information to justify our decisions.
in agile software development, we have a phrase that says we decide everything at the last responsible moment. that is essentially the same balance.
Tunnisteet:
agile,
consulting,
life,
mysql
Subscribe to:
Posts (Atom)