My Quotes

When U were born , you cried and the world rejoiced
Live U'r life in such a way that when you go

Monday, January 28, 2013

Disable absolute URL access- Apache web server

you can disable accessing through absolute url and allow access only with relative url with this htaccess code 

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)? [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ - [NC,F,L]

Saturday, January 26, 2013

Persistence Unit not found - JPA- RESOLVED

Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named

This is so annoying

I had been looking for solutions for the same. Here are the pointers for the same

Hope this helps someone.

  1. My project structure is as follows . I am using JPA2.0
  2. .
    ├── pom.xml
    └── src
        ├── main
           ├── java
              └── se
                  └── mycomp
                      └── domain
           └── resources
               ├── META-INF
                  └── persistence.xml
        └── test
            └── java
  3. Compare the case sensitiveness for the Persistence Unit Name.
  4. If you have JPA2.0 as a dependency, you can go ahead and remove the same
  5. Check if your provider is 
  6. <persistence-unit name="manager1" transaction-type="RESOURCE_LOCAL">
    Check your pom.xml if you have hibernate entity manager as a dependency.
    If needed add the hibernate annotations too . No HARM
    Thats it, the errors are gone.

Sunday, January 6, 2013

Recursive windows commands

To do a recursive move do:
            for /r %x in (foo) do move "%x" "drive:\path\bar"
To do a recursive rename do:
            for /r %x in (*.c) do ren "%x" *.cpp