Inside Paulo Abrantes' head
[ start | index | login or register ]
start > 2006-08-27 > 1

News: Update

Created by pabrantes. Last edited by pabrantes, one year and 359 days ago. Viewed 966 times. #7
[diff] [history] [edit] [rdf]
labels
attachments

News: Update

Here I am, updating the blog again! I'm sorry for the absence but I've been on vacations. Now I'm back with some goodies!

First of all regarding my latest post, it seems that Blue Pill isn't that undetectable, while on vacations I was still reading >>slashdot from time to time (of course!) and saw an >>article from Alessandre Perilli which explains the flaws in Joanna's thought. My apologies to the readers, I was just forwarding information I have read and it wasn't the most correct one.

But moving on, while on vacations I kept hacking snipsnap so I came up with two macros. The ICalMacro which integrates Apple's ICal software with snipsnap and a simple macro that lists the most viewed blog posts for a given snipsnap weblog. I've also written a simple >>ANT build file that allows you to develop your macros in a easier way. Last but not least to develop the ICalMacro I had to write an ICal API that interacts with the exported ICal files. I'm also making it available in this post. So as I said before, there's plenty of goodies! laugh

iCal API

To develop the ICal Macro I had to write an API that was able to read the exported ICS calendar file and store it. This is the 1st version so it still needs some work, although it's functional.

Some of the work that has yet to be done is:

  • Re-write of the ICS parser, maybe with ANTLR or something… The way I'm doing it (matching strings via indexof() and substring) is not the best one.
  • Re-write the small parts of code that use deprecated methods of Date from java.util.Date object
  • Integrate the few ICS keywords that are not yet integrated
Interested in this API? Well go ahead and download it: iCalMacro

The iCalMacro is a snipsnap macro that using the iCal API renders ICS files automagically in a snipsnap page. It's highly configurable so you can configure the following parameters:

  • You can select the type of data you want to display (ToDOs items or events)
  • For ToDos if they are completed or not
  • And for both types begin and end dates
Interested in this Macro? Well go ahead and download it: Most Viewed Posts

This macro as the name says displays the most viewed blog posts, not much to say about this macro. It's pretty simple you can configure the weblog snip and the number of top posts you want to display.

Interested in this Macro? Well go ahead and download it:

Build File for macros

I've written a build file for snipsnap macros, the code follows below:

<!-- Ant file to build macros for snipsnap By Paulo "Ghost" Abrantes 23/08/2006 contact: pabrantes@pabrantes.net

Instructions: For any macro you wish to add to this building file you just have to add a new task where you define the param macro-to-compile and call makejar target.

Check make-TestMacro for further help

Any needed libraries should be put in ${basedir}/lib -->

<project default="make-world" basedir=".">

<!-- Directory structure variables--> <property name="src" value="src"/> <property name="build" value="build"/> <property name="lib" value="lib"/> <property name="jar" value="bin"/> <property name="etc" value="etc"/> <property name="services" value="${build}/META-INF/services"/> <property name="service-skeleton-file" value="${etc}/org.radeox.macro.Macro"/>

<!-- compilation and installation variables --> <property name="debug" value="on"/> <property name="snipsnap-dir" value="/Users/ghost/applications/_8668_/webapp/WEB-INF/lib/"/> <property name="package" value="org.snipsnap.pabrantes.macro"/>

<path id="compile.class.path"> <fileset dir="${lib}"/> </path>

<!-- Targets --> <target name="prepare-directory-structure"> <mkdir dir="${build}"/> <mkdir dir="${services}"/> <mkdir dir="${jar}"/> </target>

<target name="make-TestMacro"> <antcall target="make-jar"> <param name="macro-to-compile" value="TestMacro"/> </antcall> </target>

<target name="make-world" depends="make-TestMacro"/>

<!-- Skeleton compile + jar --> <target name="compile" depends="prepare-directory-structure"> <javac srcdir="${src}" destdir="${build}" debug="${debug}" includes="**/${macro-to-compile}*.java"> <classpath refid="compile.class.path"/> </javac> </target>

<target name="make-jar" depends="compile"> <echo message="Creating the following jar: ${macro-to-compile}.jar"/> <copy file="${service-skeleton-file}" todir="${services}" overwrite="yes"/> <replace file="${services}/org.radeox.macro.Macro"> <replacefilter token="MACRO_NAME" value="${package}.${macro-to-compile}"/> </replace> <jar jarfile="${jar}/${macro-to-compile}.jar" basedir="${build}" includes="**/${macro-to-compile}*.class,**/org.radeox.macro.Macro" filesetmanifest="mergewithoutmain" />

</target>

<target name="install" depends="make-world"> <copy todir="${snipsnap-dir}"> <fileset dir="${jar}"/> </copy> </target>

<target name="clean"> <delete dir="${build}"/> <delete dir="${jar}"/> </target>

</project>

The directory structure that has to be preserved is the following:

  • An etc directory on the basedir will have to contain a file called org.radeox.macro.Macro with the following content:
# This is a skeleton that the ant build file
# will then replace MACRO_NAME for the correct
# macro name.
#
# DO NOT EDIT THIS FILE!
# Created by Paulo "Ghost" Abrantes
# pabrantes@pabrantes.net
# >>http://www.pabrantes.net
MACRO_NAME
  • Needed libraries for compilation will be put under lib directory
  • Your source code will be at src directory.
  • Don't forget to edit the variables for compilation and installation since they have specific values such as if you want to be compile debug support, the snipsnap dir and your macro package.
And that's all.
Hope it helps you in some way.

Patches or comments about any of the code released in this post, please comment or send it by email.

no comments | post comment
Who am I?
paulo-roca2My name is Paulo Abrantes AKA pabrantes and I'm a software developer. I'm currently employed at >>CIIST working as a Java developer in >>FenixEDU.

This blog is mostly about Java programming, domain driven design and snipsnap bliki developing. Everything written in this blog is my personal opinion and it may not reflect the opinions of my employer and co-workers.


Blog subscription
subscribe by rss subscribe by email

Links
>> Home
>> Paulo's Profile
>> Post History
>> Add to Technorati Favorites
>> Paulo's Photo Gallery
>> WishList
>> Posting without Login

Search Blog
Fellow Bloggers

Recent Posts

Java Programming: Bytecode Injection
Intermission: Sorry For Downtime
Software Developing: Studying The Bliki Domain Model
SnipSnap Developing: Trying to settle a roadmap
System Administration: Load Balancing with Apache
Blogging: Two years have passed
Software Developing: The SnipSnap Saga
Java Programming: Getting your code spicy with Groovy
Software Developing: Fluent Interfaces
Software Developing: Implementing a ShoutBox on SnipsSnip
Software Developing: SnipSnap, SnipIt and SnipSnip
Java Programming: Proxies and Access Control
Java Programming: Proxies and References
Java Programming: References' Package
YALM: Yet Another Layout Modification

For older posts, please refer to post-history for a complete Post History

Logged in Users: (0)
… and 5 Guests.
This is a modified version of snipsnap.org created by >>Paulo Abrantes