Thursday, September 8, 2011

JCopia

Have you ever thought how to download video and audio from flash players on internet sites like Youtube, Google Video, MySpace, DailyMotion, Metacafe, Break, Blog sites of your friends with embedded audio and video content and so on?

This is a commercial product :


Capture flash video and audio from any website to your computer

Tuesday, July 12, 2011

maven copy Dependenies/Resources

Add the following plugin to your pom to copy dependencies :
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.3</version>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${deployment.dir}</outputDirectory>                                      
                            <excludeArtifactIds>javaee-api</excludeArtifactIds>
                        </configuration>   
                    </execution>
                   
                </executions>
            </plugin>

 Add the following plugin to your pom to copy Resources :

            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.5</version>
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${deployment.dir}</outputDirectory>
                            <resources>         
                                <resource>
                                    <directory>target</directory>
                                    <filtering>true</filtering>
                                    <includes>
                                        <include>*.jar</include>
                                    </includes>
                                </resource>
                            </resources>             
                        </configuration>           
                    </execution>
                </executions>
            </plugin>
 
You can then simply run the Project and have the needed libraries in your deployment location.

But remember to define the properties for addressing the target library. In this example :


    <properties>
        <glassfish.home>/opt/programs/glassfish</glassfish.home>
        <deployment.dir>${glassfish.home}/glassfish/domains/my-domain/lib</deployment.dir>
    </properties>

my maven assembly plugin

I want the provided dependencies in the current project and all the included submodules to take place in the current project's target/lib-lib directory.

the assembly.xml file :


<assembly xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xsi:schemalocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>assembly</id>
<formats>
<format>dir</format>
</formats>

<modulesets>
<moduleset>


<useallreactorprojects>true</useallreactorprojects>


<includes>


<include>CHILD-MODULE-1-GROUP-ID:
CHILD-MODULE-1-ARTIFACT-ID</include>
<include>CHILD-MODULE-2-GROUP-ID:CHILD-MODULE-2-ARTIFACT-ID</include>
</includes>

<binaries>
<dependencysets>
<dependencyset>
<outputdirectory>/lib-lib</outputdirectory>

<unpack>false</unpack>
<scope>provided</scope>
</dependencyset>
</dependencysets>
<includedependencies>true</includedependencies>
</binaries>
</moduleset>
</modulesets>

</assembly>


the pom.xml file :

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.2.1</version>
                <configuration>
                    <descriptors>
                        <descriptor>assembly.xml</descriptor>
                    </descriptors>
                </configuration>
            </plugin>
        </plugins>
    </build>

Now use the "package assembly:assembly" action to execute it.

Tuesday, May 3, 2011

find unwanted charsets and collations in your mysql schemas

Use this command to find the unwanted charachter set and collations :

# note that the unwanted collation in this sample is 'utf8_persian_ci', and the
# correct collation is to be 'utf8_general_ci'


SELECT table_schema, table_name, column_name, character_set_name, collation_name
FROM information_schema.columns
WHERE collation_name = 'utf8_persian_ci'
and character_set_name = 'utf8'
and table_schema = 'smartbase'
ORDER BY table_schema, table_name,ordinal_position;


then use the follownig script to correct them :


ALTER TABLE THE_TABLE_NAME CONVERT TO CHARACTER SET utf8 COLLATE 'utf8_general_ci';

Thursday, February 24, 2011

Manupulate Environment Variables using Terminal - ubuntu

see :
https://help.ubuntu.com/community/EnvironmentVariables