Tuesday, February 19, 2013

Comfortable Work From Home: Compensated Survey

Do you usually bump into online surveys when you toggle from a website to the next? Ever question yourself why someone would compensate your effort with only completing a mere survey? Perhaps, you might be astounded that successful companies are ready to compensate anyone who shares their thoughts about the company. These companies wish for your opinions on what sort of merchandise you have a preference on, how you consider visiting shops online, and if their assistance is helpful or not, and so on. Your answers are very vital to the companies so they may be familiar with their customer’s opinions about their company so as to make enhancements and end up serving them better.

At this time, you take part here. The paid surveys are just one of the countless ways you can work from home ideas which companies propose online. Any person who has a belief on something can accomplish it without trouble and from your safe and cozy home. The quick transport from different work areas, the irritating time you have to change different uniforms, and the stress of really consuming more time outside than at home are easily prevented by just responding to surveys that pay you as your part-time work. Completing those added recommendations would not be needed for you to access a second occupation. They only necessitate your sincere view and they can easily reimburse you for just that.

Monday, February 18, 2013

Spring bean syntax




1. Import resources

Below is the syntax to import resources from various files. It is helpful when you want to bifurcated beans and database configuration in separate files and merger everything into single servlet. Here you can provide absolute or relative path of the source file.

<beans>
<import resource="file1.xml" />
<import resource="../file2.xml" />
</beans>

2. Spring MVC Dispatcher Servlet, syntax to load XMLs using init param

You can use it in web.xml file to XMLs using init param. You can load various XMLs like  beans and database configuration etc.

<web-app>
    <servlet>
        <servlet-name>test</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>            
            <param-name>contextConfigLocation</param-name>
            <param-value>
                /WEB-INF/test/*.xml
            </param-value>        
        </init-param>        
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>test</servlet-name>
        <url-pattern>/test/*.do</url-pattern>
    </servlet-mapping>
</web-app>

3. Url Handler Mapping syntax

Below is the example for Mapping URLs with respective beans, this is useful when you want to keep all URLs mapping together at one place.

<beans>

    <bean id="handlerMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="mappings">
        <props>
            <prop key="/sfc.do">simpleFormController</prop>
            <prop key="/mac.do">multiActionController</prop>
        </props>
        </property>
    </bean>


    <bean id="simpleFormController" class="com.javaxp.FormController" autowire="byName">
        <property name="commandName" value="formBean"></property>
        <property name="commandClass" value="com.javaxp.FormBean"></property>
        <property name="formView" value="form"></property>
        <property name="successView" value="submit"></property>        
    </bean>

    <bean id="multiActionController" class="org.springframework.web.servlet.mvc.multiaction.ParameterMethodNameResolver">
<property name="paramName" value="action" />
<property name="defaultMethodName" value="defaultPage" />
    </bean>

</beans>

PHP example - Google Recaptcha validation using jquery (AJAX)

In earlier post we have seen JSP example, how to validate Recaptcha using jquery,  Now we will see how to achieve the same in PHP.

To know more about Google recaptcha, click here.

To run php example add recaptcha-php-1.11 in your application. Please see the self explanatory PHP code below.

test.php

JSP example - Google Recaptcha validation using jquery (AJAX)


Below is the example for Google Recaptcha validation using jquery(AJAX).

What is reCAPTCHA?

reCAPTCHA is a free CAPTCHA service that protects your site against spam, malicious registrations and other forms of attacks where computers try to disguise themselves as a human; a CAPTCHA is a Completely Automated Public Turing test to tell Computers and Human Apart. reCAPTCHA comes in the form of a widget that you can easily add to your blog, forum, registration form, etc.

To know more about Google recaptcha, please see below links
http://www.google.com/recaptcha
https://developers.google.com/recaptcha/

Please see self explanatory JSP code below. To run below example add recaptcha4j-0.0.7.jar file in your applications classpath.

test.jsp

Monday, February 11, 2013

java.lang.Exception: Socket bind failed: [730048] Only one usage of each socket address (protocol/network address/port) is normally permitted.

In earlier post, we have seen how to rid of - java.net.BindException: Address already in use: JVM_Bind :8080. Today i saw another similar error, please see the error below.


java.lang.Exception: Socket bind failed: [730048] Only one usage of each socket address (protocol/network address/port) is normally permitted.  
    at org.apache.tomcat.util.net.AprEndpoint.init(AprEndpoint.java:649)
    at org.apache.tomcat.util.net.AprEndpoint.start(AprEndpoint.java:766)
    at org.apache.coyote.http11.Http11AprProtocol.start(Http11AprProtocol.java:137)
    at org.apache.catalina.connector.Connector.start(Connector.java:1122)
    at org.apache.catalina.core.StandardService.start(StandardService.java:540)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Feb 11, 2013 8:13:42 PM org.apache.catalina.core.StandardService start
SEVERE: Failed to start connector [Connector[HTTP/1.1-8080]]
LifecycleException:  service.getName(): "Catalina";  Protocol handler start failed: java.lang.Exception: Socket bind failed: [730048] Only one usage of each socket address (protocol/network address/port) is normally permitted.  
    at org.apache.catalina.connector.Connector.start(Connector.java:1129)
    at org.apache.catalina.core.StandardService.start(StandardService.java:540)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Feb 11, 2013 8:13:42 PM org.apache.coyote.ajp.AjpAprProtocol start
SEVERE: Error starting endpoint

Wednesday, February 6, 2013

Oracle Moves Past 2012 Woes


Oracle had a bumpy ride in 2012. The company lost an important patent lawsuit centered on Google's Android platform, which must have hurt. In the last half of the year, a series of unpatched security flaws were discovered, leading to many industry experts recommending users remove Java from their browsers entirely.

Oracle wasn't exactly proactive with its response to the security flaws, which allowed malware to escape the Java "sandbox." Instead, the company stuck to its questionable policy of releasing patches on a restrictive and immutable schedule. To many, it looked like the company was closing the remote blinds on the office windows and hoping the problem would go away.

Still Number One

In spite of these setbacks, Java remains the shining star in Oracle's portfolio. Java maintains its position as the most used coding language in the Pypl Popularity Language Index.

The outlook for Java developers is also promising. For the second year in a row, technology professional website Dice ranked Java and J2EE developers as the most sought-after professionals in the industry.

Bye-Bye Java 6, Hello 7

Okay, Java 7 has actually been out for some time now, but plenty of enterprises and consumers are still happy with Java 6. That's going to change in February 2013, when the last public patch for Java 6 comes out. After that, you're on your own as far as Java 6 security goes.

The first patch for Java 7 is due out during the summer of 2013, so you have plenty of time to roll over from Java 6 to the new version. Just don’t leave it too late; running an obsolete version of Java is an invitation for security breaches.


Java Closes One Door, Opens another


The last public security patch for Java 6 comes out February 19, 2013, marking an important turning point for Oracle. Java 6 was developed by Sun Microsystems, which Oracle bought out for a purported $7.4 billion in 2011. Java 7, in contrast, is the first edition of Java released by Oracle. With Java 6 retired, Oracle cuts the program’s last ties to its parent company.

To be totally fair, Java 6 enjoyed a longer life than previous editions. The final public patch was originally scheduled for July 2012, and then bumped back to November 2012. Despite these two reprieves, it looks like the end is finally in sight.

Life after Retirement  

The final security patch serves as a warning to consumers and businesses. Oracle continues to provide security patches to enterprises with support plans after a final public patch, but for those of us without support plans, it's time to consider switching to Java 7.

Sure, in theory you could continue to use Java 6, but without the safety net of security updates you're asking for trouble. Old and retired programs attract hackers and malware like hyenas circling an injured antelope. Both sets of scavengers know their preys' defenses are down.

If you’re looking to update to Java 7, do so before June 18, 2013. The date marks the first major patch for the new system. (Don't get me started on Oracle's ironclad update schedule; in my mind, patches should be released when they're needed, rather than on a fixed timetable. Emergency response teams and drug rehab centers offer protection and help when it's most needed. To my mind, security patches are the virtual equivalent).