NXTs are a lot of fun to "play" with. But as the development of the software-side goes on it becomes harder and harder to find and fix bugs as they appear. As a good programmer it would only be logical to strife for a good coverage with unit-tests. But unfortunately the lejos development kit seems to only partially support JDK functionality thus rendering JUnit or any kind of mock-frameworks unusable.
So here is a little something to circumvent these restrictions:
1) Create a new Java-Project where your tests will be located
2) right-click on it and go into "Build Path" -> "Configure Build Path..."
3) select the "Project"-Tab and click on "Add" proceed by selecting the Lejos project you want to test.
Now you can proceed to write tests using your favorite Frameworks as if you were writing them in the lejos project itself.
Dienstag, 4. Juni 2013
Samstag, 18. September 2010
How to receive something send from an Adobe Acrobat PDF via Stripes
Last three days were terribly frustrating...
I couldn't seem to be able to find a single person who tried this before.
Thus now this entry:
So, Adobe Acrobat has such a nice function to let you add a "Submit" button into your pdf.
Since our company works heavily with Stripes I thought that it would be quiet convinient to click on the "Submit" within the pdf, send the data to our ActionBean and let the validation decide if everything was correct.
The big question now was: How does Adobe send the data?
When you create a submit button you can descide how and what you want to transmit.
I did choose html and thought "Yea, it will most likely transmit the whole thing in a gigantic string"
ohhhh, how wrong I was...
The only question to my above thought was, how I can tell stripes to accept this String and set it into a variable for further processing.
After a very long time of failing I took a look at the request and, oh wonder.
Adobe does not send the data in a gigantic String. It does send the content in kay-value pairs (the name of the text-field/checkbox beeing the key).
only thing left: introduce variables/getter and setter with the corresponding names.
Conclusion:
If you submit a PDF with a text-field named "test" just create a variable "test" with the getters/setters and stripes correctly loads the values into it. Validating this is now a piece of cake.
Have fun.
I couldn't seem to be able to find a single person who tried this before.
Thus now this entry:
So, Adobe Acrobat has such a nice function to let you add a "Submit" button into your pdf.
Since our company works heavily with Stripes I thought that it would be quiet convinient to click on the "Submit" within the pdf, send the data to our ActionBean and let the validation decide if everything was correct.
The big question now was: How does Adobe send the data?
When you create a submit button you can descide how and what you want to transmit.
I did choose html and thought "Yea, it will most likely transmit the whole thing in a gigantic string"
ohhhh, how wrong I was...
The only question to my above thought was, how I can tell stripes to accept this String and set it into a variable for further processing.
After a very long time of failing I took a look at the request and, oh wonder.
Adobe does not send the data in a gigantic String. It does send the content in kay-value pairs (the name of the text-field/checkbox beeing the key).
only thing left: introduce variables/getter and setter with the corresponding names.
Conclusion:
If you submit a PDF with a text-field named "test" just create a variable "test" with the getters/setters and stripes correctly loads the values into it. Validating this is now a piece of cake.
Have fun.
Abonnieren
Posts (Atom)