Inside Paulo Abrantes' head
[ start | index | login or register ]
start > 2007-03-20 > 1

SnipSnap Developing: DiggIt Macro, SearchMacro hack and more

Created by pabrantes. Last edited by pabrantes, one year and 202 days ago. Viewed 925 times. #2
[diff] [history] [edit] [rdf]
labels
attachments
DiggMacro.jar (2661)

SnipSnap Developing: DiggIt Macro, SearchMacro hack and more

Continuing the idea already presented in my past post >>Snipsnap Developing: Fresh Macros another macro for a web 2.0 widely used service is now available.
This time it's >>digg macro.

To anyone interested in using this macro be warned that it's also using one of the SEO hacks I've made in this case the optimization in the getTitle method for the class SnipImpl. More about this optimization can be read in >>Snipsnap SEO Hacking: Post title optimization.

The macro will work even if the hack described above isn't present, although the submitted title - which can always be changed by the user who's digging - will be the "1", "2", etc instead of the actual post subject.

The Digg Macro is pretty simple and as a single parameter, which is if image should be displayed (defaults to no).

Here's an example:

{diggIt:showImage=true}

would render:

Digg!

Much better than just waiting for a reader to submit the story, no?

Still using the title optimization hack I've developed another feature. It's mostly an user experience feature and it's in the search interface, which was returning a bunch of '1' and '2' as the post names that would match the search criteria are now also formatted to the correct title.

The hack is simple and below I present the modification:

Original SearchMacro:

// Code Snipped for (int i = start; i < end; i++) { SnipLink.appendLink(buffer, hits.doc(i).get("title")); if (i < end - 1) { buffer.append(", "); } }

//Code Snipped

My modification:

for (int i = start; i < end; i++) { String snipName = hits.doc(i).get("title"); Snip snip = space.load(snipName); if(snip!=null) { SnipLink.appendLink(writer, snip); } else { //No snip with the name, Indexes are broken //Still we present the link. Will give a 404 Though SnipLink.appendLink(writer, snipName); } if (i < end - 1) { writer.write(", "); } }

Now results that once where '1', '1','2' now are presented 'Domain Driven Design", 'SnipSnap developing', 'Java programming'.
More useful in the context of search in my opinion.

Finally, since I'm writing about SnipSnap I'll finish informing that Stephan - one of the main snipsnap developers - as announced on his blog that he's leaving snipsnap (more can be read in >>Leaving SnipSnap smiley).
SnipSnap development from the main team has been almost none in the last months (not to actually say year) and now with one of the main developers abandoning the project things don't seem very bright. Well, maybe it's time to renew the development team...

I myself have been thinking in maintaining a fork of the project with many of my tweaks. Now with Stephan leaving, maybe if I implement some of the goodies I'm planning, I'll go forward with the fork idea.

Definitely something to think about…

4 comments (by jpmsi, anonymous, pabrantes) | 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