Wednesday, August 31, 2011

edit hostconfig file on my mac

You can edit it using Terminal. Open terminal, type "cd /etc" (without the quotes), then type "sudo pico hostconfig" (without the quotes).

Make your edits and hit control-x, type "y" when it asks you to save changes, and hit return when it asks for the filename (it'll have "hostconfig" already there as the filename).

Friday, July 15, 2011

[WebContainer : 7] [ERROR] [] [org.apache.wicket.RequestCycle] submitted http post value [radio124] for RadioGroup component [2:form:tabs:panel:crumbPanel:TestRadioGroup] is illegal because it does not contain relative path to a Radio componnet. Due to this the RadioGroup component cannot resolve the selected Radio component pointed to by the illegal value. A possible reason is that componment hierarchy changed between rendering and form submission.

[WebContainer : 7] [ERROR] [] [org.apache.wicket.RequestCycle] submitted http post value [radio124] for RadioGroup component [2:form:tabs:panel:crumbPanel:TestRadioGroup] is illegal because it does not contain relative path to a Radio componnet. Due to this the RadioGroup component cannot resolve the selected Radio component pointed to by the illegal value. A possible reason is that componment hierarchy changed between rendering and form submission.

org.apache.wicket.WicketRuntimeException: submitted http post value [radio124] for RadioGroup component [2:form:tabs:panel:crumbPanel:TestRadioGroup] is illegal because it does not contain relative path to a Radio componnet. Due to this the RadioGroup component cannot resolve the selected Radio component pointed to by the illegal value. A possible reason is that componment hierarchy changed between rendering and form submission.


This issue occurred as My Page had two panels with same component hierarchy. i.e. the child panels was dynamically replaced with each other having a radio group the same wicket id TestRadioGroup.

Sunday, February 20, 2011

Apache Wicket WicketNotSerializableException: Unable to serialize clas

This is a typical Wicket problem which occurs on clicking browser back button and clicking any stale link on the page.

DEBUG - Rendering raw markup
DEBUG - Rendered [Page class = com..web.appointments.page.AppointmentSchedulerPage, id = 3, version = 0]
DEBUG - End render [Page class = com.project.web.appointments.page.AppointmentSchedulerPage, id = 3, version = 0]
DEBUG - ending request for page [Page class = com.project.web.appointments.page.AppointmentSchedulerPage, id = 3, version = 0], request [method = GET, protocol = HTTP/1.1, requestURL = http://localhost:8080/project-1.0/appointmentScheduler, contentType = null, contentLength = -1, contextPath = /project-1.0, pathInfo = null, requestURI = /project-1.0/appointmentScheduler, servletPath = /appointmentScheduler, pathTranslated = null]
DEBUG - ending request for page [Page class = com.project.web.appointments.page.AppointmentSchedulerPage, id = 3, version = 0], request [method = GET, protocol = HTTP/1.1, requestURL = http://localhost:8080/project-1.0/appointmentScheduler, contentType = null, contentLength = -1, contextPath = /project-1.0, pathInfo = null, requestURI = /project-1.0/appointmentScheduler, servletPath = /appointmentScheduler, pathTranslated = null]
ERROR - Error serializing object class com.project.web.appointments.page.AppointmentSchedulerPage [object=[Page class = com.project.web.appointments.page.AppointmentSchedulerPage, id = 3, version = 0]]
org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException: Unable to serialize class: com.project.service.appointments.dataobject.projectAppointment
Field hierarchy is:
3 [class=com.project.web.appointments.page.AppointmentSchedulerPage, path=3]
private java.lang.Object org.apache.wicket.MarkupContainer.children [class=com.project.web.appointments.panel.projectAppointmentSchedulerPanel, path=3:projectAppointmentSchedulerPanel]
private java.lang.Object org.apache.wicket.MarkupContainer.children [class=com.project.web.appointments.form.AppointmentSchedulerForm, path=3:projectAppointmentSchedulerPanel:appointmentSchedulerForm]
java.lang.Object org.apache.wicket.Component.data [class=org.apache.wicket.model.CompoundPropertyModel]
private java.lang.Object org.apache.wicket.model.CompoundPropertyModel.target [class=com.project.service.appointments.dataobject.projectAppointment] <----- data-blogger-escaped-br="" data-blogger-escaped-field="" data-blogger-escaped-is="" data-blogger-escaped-not="" data-blogger-escaped-serializable="" data-blogger-escaped-that=""> at org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:346)
at org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:615)
at org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:538)
at org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:615)
at org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:538)
at org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:615)
at org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:538)
at org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:615)
at org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:538)
at org.apache.wicket.util.io.SerializableChecker.writeObjectOverride(SerializableChecker.java:684)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:322)
at org.apache.wicket.util.io.IObjectStreamFactory$DefaultObjectStreamFactory$2.writeObjectOverride(IObjectStreamFactory.java:129)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:322)
at org.apache.wicket.util.lang.Objects.objectToByteArray(Objects.java:1120)
at org.apache.wicket.protocol.http.pagestore.AbstractPageStore.serializePage(AbstractPageStore.java:203)
at org.apache.wicket.protocol.http.pagestore.DiskPageStore.storePage(DiskPageStore.java:840)
at org.apache.wicket.protocol.http.SecondLevelCacheSessionStore$SecondLevelCachePageMap.put(SecondLevelCacheSessionStore.java:332)
at org.apache.wicket.Session.requestDetached(Session.java:1404)
at org.apache.wicket.RequestCycle.detach(RequestCycle.java:1176)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1454)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:468)
at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:301)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:637)
Caused by: java.io.NotSerializableException: com.project.service.appointments.dataobject.projectAppointment
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:416)
at org.apache.wicket.Component.writeObject(Component.java:4447)
at sun.reflect.GeneratedMethodAccessor30.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
at org.apache.wicket.util.io.IObjectStreamFactory$DefaultObjectStreamFactory$2.writeObjectOverride(IObjectStreamFactory.java:121)
... 23 more
DEBUG - Getting page [path = 2:projectProfilePanel:AptmntCalendarPanel:sAppointmentList:1:sAppointmentTimeFrameList:4:sAppointmentLink, versionNumber = 0]
DEBUG - setting request target to [BookmarkablePageRequestTarget@-371790702 pageClass=org.apache.wicket.markup.html.pages.PageExpiredErrorPage]
DEBUG - update: Session not dirty.
DEBUG - Redirecting to ?wicket:bookmarkablePage=:org.apache.wicket.markup.html.pages.PageExpiredErrorPage
DEBUG - Add homePageLink to [Page class = org.apache.wicket.markup.html.pages.PageExpiredErrorPage, id = 4, version = 0]
DEBUG - Begin render [Page class = org.apache.wicket.markup.html.pages.PageExpiredErrorPage, id = 4, version = 0]


=========================================
Solution

Override the following method in your page class. It would surely resolve the problem :

/**
* Confgured to clear the cache and re-render the page every time user request for it.
* This is used to overcome the browser back button problem.
*/
@Override
protected void configureResponse() {
super.configureResponse();

final WebResponse response = getWebRequestCycle().getWebResponse();
response.setHeader("Cache-Control", "no-cache, max-age=0, must-revalidate, no-store");
}

Sunday, January 9, 2011

HTML CSS - Scrollbar to be added to a div

Just came across a requirement where I had to use the scroll bar with a div.

I used the following to put the same:

<div style="overflow:auto;height:200px;width:500px;">
-----
-----
-----
</div>

This works fine and looks cool.

Friday, December 31, 2010

Wicket : Unable to hide/show the components through Ajax

Hi,

Just came across a problem, where I was not able to hide a text field on a DropDown Change event.

On the onChange event of the dropdown i was doing the following :

myDropDown.add(new AjaxFormComponentUpdatingBehavior("onchange") {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
myTxtField.clearInput();
myTxtField.setModelObject("");
myTxtField.setEnabled(false);
myTxtField.setVisible(false);
target.addComponent(myTxtField);
}
});

Solution:
I added the following line in the onUpdate method and it worked:

myTxtField.setOutputMarkupPlaceholderTag(true);

The SetOutputMarkupPlaceholder() method helps to re-render the wicket components.

Thanks,
Sanjay Ingole

Sunday, December 19, 2010

Wicket : Unable to re-submit the form after the form errors

I was working on a login form where two fields were used as usual i.e. login id and password.

I used a form with an AjaxSubmitLink and overrode its onSubmit and onError methods.
I did not use the FeedbackPanel on the form as I used custom labels with some style to show the errors.

in the onError overridden method I did the following :


      protected void onError(final AjaxRequestTarget target, final Form form) {

        if(userEmail.getFeedbackMessage() != null) {
          invalidEmailLabel.setDefaultModelObject(
                          userEmail.getFeedbackMessage().getMessage().toString());
          invalidEmailLabel.setOutputMarkupPlaceholderTag(true);
        }
        if(userPassword.getFeedbackMessage() != null) {                    
           userPassword.getFeedbackMessage().getMessage().toString());

        passwordError.setDefaultModelObject(
                   userPassword.getFeedbackMessage().getMessage().toString()); 
          loginErrorMessage.setVisible(false);
        }


        userPassword.clearInput();
        userPassword.setModelObject("");
        form.add(userPassword);
        target.addComponent(form);
        
      }
    };

This code looks fine. But I faced one issue - After the page is loaded for the first time, If I enter correct data it works fine but as soon as I input the invalid values, the form validation fails and form error occurs. Which is an expected behavior but then again if I give the correct values and try to submit the form, it doest pass me through. I played with ajax a lot but coud not find the solution.

Then I found the cleanupFeedbackMessages() method by doing some search, but in my custom session I had an empty implementation of cleanupFeedbackMessages(), as my custom session extended org.apache.wicket.Session. 
I changed my session's parent class to org.apache.wicket.protocol.http.WebSession; which does not require to override the cleanupFeedbackMessages() method.

Then in my onError method I called the following which solved my problem.


getSession().cleanupFeedbackMessages();

This method saved my life,My ajax implementation worked fine as expected. I was almost going to implement it on page load event. But could not compromise with what I desired.

Finally somebody has said it correctly : "Where is the will , there is the way."

Let me know if this info helped you.

Thanks,
Sanjay :)

Friday, December 17, 2010

Unable to broadcast webcam with yahoo messanger on my macbook

Hi

 I had a problem using my built-in webcam on macbook while using yahoo messenger, whereas it was working fine with gtalk. I did following to fix the problem and it worked.

Open Yahoo messenger-> Open Preferences -> WebCam -> Video

There is a drop-down called - Video Source with values :

-Google Camera Adapter 0
-Google Camera Adapter 1
-Built-In iSight

In my case Google Camera Adapter 0 was set by default. I changed it to - Built-In iSight.

Then closed the camera and reopened. It solved my problem :)

Just thought it be helpful for somebody who is facing the same problem.

Regards,
Sanjay