To see the number of process for a user run this

by Administrator 25. November 2014 21:46

To see the number of process for a user run this (replacing [user] with the username):

 

ps -eLF -u[user] | wc -l

Tags:

public

install maven in mac os

by Administrator 14. November 2014 20:55

brew install maven

Tags:

maven

YAML

by Administrator 14. November 2014 20:26

 

YAML is a superset of JSON, and as such is a very convenient format for specifying hierarchical configuration data

 

traditional



Tags:

@Platform and @Qualifier

by Administrator 11. November 2014 22:23

@Autowired
private MarketPlace marketPlaces;


@Autowired
@Qualifier( "ios") // the use is unique to Spring. It's darned convenient, too!
 private MarketPlace marketPlaces;



and now jsr 330




package spring;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import static spring.Spring.Platform;

@Configuration
@ComponentScan
public class Spring {

    public static void main(String[] args) {
        new AnnotationConfigApplicationContext(Spring.class);
    }

    @Autowired
 @Platform(Platform.OperatingSystems.ANDROID)
    private MarketPlace android;

    @Autowired
 @Platform(Platform.OperatingSystems.IOS)
    private MarketPlace ios;

    @PostConstruct
    public void qualifyTheTweets() {
        System.out.println("ios:" + this.ios);
        System.out.println("android:" + this.android);
    }

    // the type has to be public!
    @Target({ElementType.FIELD,
            ElementType.METHOD,
            ElementType.TYPE,
            ElementType.PARAMETER})
    @Retention(RetentionPolicy.RUNTIME)
    @Qualifier
    public static @interface Platform {

        OperatingSystems value();

        public static enum OperatingSystems {
            IOS,
            ANDROID
        }
    }
}

interface MarketPlace {
}

@Component
@Platform(Platform.OperatingSystems.IOS)
class AppleMarketPlace implements MarketPlace {

    @Override
    public String toString() {
        return "apple";
    }
}

@Component
@Platform(Platform.OperatingSystems.ANDROID)
class GoogleMarketPlace implements MarketPlace {

    @Override
    public String toString() {
        return "android";
    }
}

Tags:

Spring

Hibernate: Version-Based Optimistic Concurrency Control

by Administrator 11. November 2014 22:17

Optimistic locking discards all incoming changes that are relative to an older entity version. But everything has a cost and optimistic locking makes no difference.

The optimistic concurrency control mechanism takes an all-or-nothing approach even for non-overlapping changes. If two concurrent transactions are changing distinct entity property subsets then there’s no risk of losing updates.

Two concurrent updates, starting from the same entity version are always going to collide. It’s only the first update that’s going to succeed, the second one failing with an optimistic locking exception. This strict policy acts as if all changes are overlapping. For highly concurrent write scenarios, this single-version check strategy can lead to a large number of roll-backed updates.

optimisticlockingoneproductentityoneversion

 

http://a3ab771892fd198a96736e50.javacodegeeks.netdna-cdn.com/wp-content/uploads/2014/11/optimisticlockingonerootentityoneversion1.png

Tags:

Hibernate

https problem (Error code: ssl_error_no_cypher_overlap) in firefox

by Administrator 11. November 2014 20:19

go to about:config

 

You can check the ssl and tls prefs on the about:config page.

 

 

 

Tags:

Open multiple Eclipse workspaces on the Mac

by Administrator 9. November 2014 21:29

OS X Eclipse Launcher 2.0.0 plugin

http://marketplace.eclipse.org/content/osx-eclipse-launcher#.VF-r4S9ZLVR

 

Tags:

Unsupported major.minor version 51.0

by Administrator 9. November 2014 10:40

The version number shown describes the version of the JRE the class file is compatible with.

 

J2SE 8=52, 
J2SE
7=51,
J2SE
6.0=50,
J2SE
5.0=49,
JDK
1.4=48,
JDK
1.3=47,
JDK
1.2=46,
JDK
1.1=45


javac -target 1.4HelloWorld.java

Tags:

java Core

apache ode start problem java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory

by Administrator 9. November 2014 09:58

If you are using Tomcat v.6 or v.7, you probably get the error

 

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory
  at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:54)
Caused by: java.lang.ClassNotFoundException: org.apache.juli.logging.LogFactory
  at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
  at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)
  ... 1 more
Could not find the main class: org.apache.catalina.startup.Bootstrap. Program will exit.



Click on Open launch configuration → Classpath tab → Add External JARs → [your TOMCAT_DIR]\bin\tomcat-juli.jar. Then Ok.

Tags:

apache ode

@RequestHeader in Spring MVC

by Administrator 21. June 2014 20:01

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class RequestHeaderExampleController{
    @RequestMapping(value = "/example", method = RequestMethod.GET)
    public String  getHello(@RequestHeader ("host") String hostName,
            @RequestHeader ("Accept") String acceptType,
            @RequestHeader ("Accept-Language") String acceptLang,
            @RequestHeader ("Accept-Encoding") String acceptEnc,
            @RequestHeader ("Cache-Control") String cacheCon,
            @RequestHeader ("Cookie") String cookie,
            @RequestHeader ("User-Agent") String userAgent){
        System.out.println("Host : " + hostName);
        System.out.println("Accept : " + acceptType);
        System.out.println("Accept Language : " + acceptLang);
        System.out.println("Accept Encoding : " + acceptEnc);
        System.out.println("Cache-Control : " + cacheCon);
        System.out.println("Cookie : " + cookie);
        System.out.println("User-Agent : " + userAgent);
        return "example";
    }
}


Tags:

Spring

About the author

 Welcome to the web site of Azizkhani. This page has two purposes: Sharing information about my professional life such as articles, presentations, etc.
This website is also a place where I would like to share content I enjoy with the rest of the world. Feel free to take a look around, read my blog


Java,J2EE,Spring Framework,JQuery,

Hibernate,NoSql,Cloud,SOA,Rest WebService and Web Stack tech...

RecentPosts

Month List