Showing posts with label software. Show all posts
Showing posts with label software. Show all posts

Wednesday, July 15, 2015

Spring MVC command function

Hi,

I spent whole day being stucked at a bug that wasnt really a bug, but is actually born out of my weak understanding of Spring MVC.

Follow the link here: http://www.tutorialspoint.com/spring/spring_mvc_form_handling_example.htm
http://crunchify.com/simplest-spring-mvc-hello-world-example-tutorial-spring-model-view-controller-tips/


@RequestMapping
It is usually used to write the extended link address.
for eg, @RequestMapping("/welcome") would take care of all links in the server with localhost:8080/welcome/* to localhost:8080/welcome.html

However, in my situation where i am using a portal server,i actually use a
@RequestMapping("VIEW")
and extract the extended link address from

    protected HttpServletRequest getOriginalServletRequest(
   PortletRequest request) {
HttpServletRequest httpServletRequest = PortalUtil
.getHttpServletRequest(request);
HttpServletRequest originalServletRequest = PortalUtil
.getOriginalServletRequest(httpServletRequest);
return originalServletRequest;
    }
then, getParameter from the HttpServletRequest.

For eg, /non360?actionType=Amend
i will getParameter(actionType), which is Amend!


The next issue is the "command" object.
if you are using form, Spring MVC will only detect the "command" object, and ignore the rest.

Monday, March 9, 2015

Autowiring (Java Spring Annotations)

Hi,

Autowiring is a very useful function in Java annotation and Spring
http://java.dzone.com/articles/why-you-should-use-springs

So the key points to note when doing Autowire is:
- it cannot be a new object.

- you might need a setter function if you are wiring a particular variable.

- you can pass the autowired object by reference, but it will only be a read-only. hence if you are passing a DAO, you can only get read-only database access, and cannot write back to database.

- you are required to declare the autowired object in your application-context.xml (beans.xml)


More guides on autowiring:
http://www.tutorialspoint.com/spring/spring_autowired_annotation.htm

It is indeed difficult to understand, but damn useful to use.


Friday, December 5, 2014

The Proxor Test

Hello,

So my nightmare just ended during Wednesday where we sat thru the 6hours grueling programming test, and despite practicing long and hard, majority of us gotten a Proxor 3 rating, which is not that bad, but just meant we are just entry level programmers.

So what is Proxor?

http://www.proxor.com/

This is a set of test designed by some university professor to test real world software developers to see if they can really code, or are they just there to get the fat paycheck by smoking through.

Being in a company which uses Java as our core languages, we were asked to do the pilot test to help evaluate if this is a good tool for our company to use for recruitment.
We were given a preparation code which were almost identical to the test questions. There are a total of 13 questions, of which 4 will end up as our test questions.
http://www.proxor.com/page/howtoprepare

So after much preparation, I am glad to say that we have compiled some of the solutions. They are able to pass the Junit provided, but I believe that in order to do well in, you must be able to identify all the possible error situations like special characters and wrong inputs etc.
The code efficiency also do matter in my opinion.

There is no proper comments inside the code, but a benreadme.txt are provided for most of the questions.

Do read the READMEFIRST, then inside each question, read the readme to know what is the question about.
if it is not clear enough, a video to show how the output should be is here. (the link provided inside the readme is outdated)
http://www.proxor.com/page/solution


b3n's answers and brochures for Proxor
https://www.dropbox.com/sh/t2aoaapm07z8urn/AACO3uX_zcXwEazomx7X6fqfa?dl=0

I am not sure if I have infringed any rights or not, but if i did, do send me an email to tell me about it and I will be sure to remove it immediately!


Last but not least, while it is still in pilot trial run, I believe that this would be a useful tools to differentiate a good coder from a mediocre ones, as well as to provide certain feedback on how you can further improve your coding standards and skills. But more can be done to make the results give more details on your strength and weaknesses in coding!



Regards
Benjamin Chai

Proxor answers
Proxor test
Proxor Java
Proxor Pilot Test
Proxor Test Solutions