CSS3: Plugin to build cur and ico for Photoshop

April 28th, 2012 by jeremychone | No Comments »

http://www.telegraphics.com.au/svn/icoformat/trunk/dist/README.html

HTML5: File API save as

April 25th, 2012 by jeremychone | No Comments »

http://eligrey.com/blog/post/tag/file-api

Maven: Pom.xml and AspectJ

March 26th, 2012 by jeremychone | No Comments »

In the Lib that has the aspect, add this to the pom.xml

<!-- AspecJ Compile -->
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>aspectj-maven-plugin</artifactId>
  <version>1.3</version>
  <configuration>
    <source>1.6</source>
    <target>1.6</target>
    <outxml>true</outxml>
    <showWeaveInfo>true</showWeaveInfo>
    <verbose>true</verbose>
  </configuration>
  <executions>
    <execution>
      <goals>
        <goal>compile</goal>
        <goal>test-compile</goal>
      </goals>
    </execution>
  </executions>
</plugin>
<!-- /AspecJ Compile -->

.....

<dependency>
  <groupId>org.aspectj</groupId>
  <artifactId>aspectjrt</artifactId>
  <version>1.6.7</version>
</dependency>

<dependency>
  <groupId>org.aspectj</groupId>
  <artifactId>aspectjweaver</artifactId>
  <version>1.6.7</version>
</dependency>

Then, on the application that receive the aspect, need to have the failOnError:false to allow the mvn compiler to continue. Then, we weave the dependency “LibWithSomeAspects” in.

<plugin>
  <artifactId>maven-compiler-plugin</artifactId>
  <configuration>
    <source>1.6</source>
    <target>1.6</target>
    <!-- Temporary fix for supporting aspectJ -->
    <failOnError>false</failOnError>
  </configuration>
</plugin>

<!-- AspecJ Compile -->
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>aspectj-maven-plugin</artifactId>
  <version>1.3</version>
  <configuration>
    <source>1.6</source>
    <target>1.6</target>
    <outxml>true</outxml>
    <showWeaveInfo>true</showWeaveInfo>
    <verbose>true</verbose>
    <weaveDependencies>
      <weaveDependency>
        <groupId>com.example</groupId>
        <artifactId>LibWithSomeAspects</artifactId>
      </weaveDependency>
    </weaveDependencies>
  </configuration>
  <executions>
    <execution>
      <goals>
        <goal>compile</goal>
        <goal>test-compile</goal>
      </goals>
    </execution>
  </executions>
</plugin>
<!-- /AspecJ Compile -->

RegEx: Match filename with extension

March 7th, 2012 by jeremychone | No Comments »

Checking if it is a image file

([^\s]+(\.(?i)(jpg|png|gif|bmp))$)

Very good explanation of this regex here

CSS: Less JavaScript and Java Less Processor

February 23rd, 2012 by jeremychone | No Comments »

less

Asual Java Less processor (not on maven central yet ;(

Java: json parser and serializer

February 19th, 2012 by jeremychone | No Comments »

Jackson

Check the later Jackson JSON Parser core release (apache source license) for the latest version.

<dependency>
	<groupId>org.codehaus.jackson</groupId>
	<artifactId>jackson-mapper-asl</artifactId>
	<version>1.9.4</version>
</dependency>

All Jackson Maven Dependencies

Java: Eclipse Copyright Plugins to easily update java file headers

February 13th, 2012 by jeremychone | No Comments »

Copyright Plugins

HTML5: Display local images without going to server

January 25th, 2012 by jeremychone | No Comments »

Note: assuming jquery

// get the input element
var $fileElement = $("input[type='file']");
var $image = $("img:first");

// on change
$fileElement.on("change",function(){
   if (this.files && this.files.length > 0){
       var file = this.files[0];
       var reader = new FileReader();
       reader.onload = function(e) {
	   $img.attr("src", e.target.result);
       }
       reader.readAsDataURL(file);
   }
});

Google API References

December 11th, 2011 by jeremychone | No Comments »

Color Palette Builders: Kuler and Color Scheme

December 10th, 2011 by jeremychone | No Comments »