czwartek, 9 stycznia 2014

Ubuntu: how to find a file by name and date?

Just an example:

find /home/zbyszek/data/backup/ -newermt "2004-01-01 00:00:00" ! -newermt "2008-01-01 00:00:00" -name *.mp3

czwartek, 12 września 2013

Eclipse Maven project: how to change web.xml version from 2.3 to 3.1

1. Modify pom.xml:


        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
        </plugins>



2. Update Maven project ( alt-F5 ).


You should have Project->Properties->Project Facets->Java->1.7
If you got errors, you should correct  Project->Properties->Java Build Path->Libraries


3. Modify web.xml


<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
    id="WebApp_ID" version="3.1">
    <!-- your web.xml content here -->
    <display-name>Archetype Created Web Application</display-name>
</web-app>


4. Update Maven project ( alt-F5 ).

If you get errors. Go to step 5.

5. (Most interesting!)  Modify org.eclipse.wst.common.project.facet.core.xml

5.1. Evoke: Window>Show View>Other>General>Navigator
5.2.  Navigate to: org.eclipse.wst.common.project.facet.core.xml
5.3. Modify line: <installed facet="jst.web" version="2.3"/> to
<installed facet="jst.web" version="3.1"/>
5.4. Save changes.

6. Update Maven project ( alt-F5 ).


 

czwartek, 22 sierpnia 2013

Text align in callibre ebook reader

Example is here.

You need put this code in: Preferences>User Stylesheet
body {
text-align:justify !important;
text-indent:2em !important;
}

sobota, 17 sierpnia 2013

Ho to set a new context path for webapp in Eclipse Kepler

Right click on project, then:
->Properties->Web Project Settings->Context root:

If you are building war for glassfish through maven (mvn package), you may create file glassfish-web.xml in the same folder as web.xml and write down:
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
<!-- Doesn't work when build with Eclipse -->
    <context-root>/YourContextPath</context-root>
</glassfish-web-app>
 

sobota, 13 lipca 2013

Icon for primefaces commandButton

I found placing my own icon in <p:commandButton> a little confusing. When I try to do this I got no icon at all, or strange mark looked like this:
When I've done a little research I found this:

I can have an icon in a three way:

#1. Button as a picture. There is no value/description visible. Only an icon/picture.
         <p:commandLink action="#{someBean.someAction()}">
            <h:graphicImage name="images/new_create.png" />
         </p:commandLink>


#2. Button with an icon/picture as a background. So one see a description like "New" and the picture of icon in background. 
<p:commandButton value="New!" styleClass="ui-back-but-new"/>
and respectively in css: 
.ui-back-but-new{
   background: url("#{resource['images/new_create.png']}") no-repeat top left !important;
}


#3. Button with an icon placed left to its description (value attrib).
<p:commandButton value="New" icon="ui-but-new-icon"/>
and respectively in css:
.ui-but-new-icon{
   background-image: url("#{resource['images/new_create.png']}") !important;
}


The problem was...:

All my problems came from wrong path to the icon image. It is probably the most frequent mistake. I have coded it as images/new_create.png in css statements. Structure of folders was /resources/images/new_create.png.

The proper path could be given in a three ways:
  • url("#{resource['images/new_create.png']}")
  • url(../resources/images/new_create.png) 
  • url(/MyAppName/resources/images/new_create.png) 
The first way is the best. It uses JSF resource identifier so it is most flexible. 

The effect #1, #2, #3:

czwartek, 11 kwietnia 2013

Howto enable silverlight in ubuntu firefox

You can install moonlight from site but still - there will be no effects. You don't have apropirate codecs. In the next step you need to open page with samples. Then clik on one of given samples and allow to install codec. Thats all.

Howto remove a broken add-on from Thunderbird

When you add a broken add-on to Thunderbird it may cause Thunderbird to prevent you from doing anything, so you cannot remove add-on which is causes Thunderbird crash. Write in terminal:

thunderbird -safe-mode

Then you can remove and add-on.
source