Veggy Smash 3

We are bringing our Veggie matching game out of the shadows and into full view for all.

Match veggies, be healthy, solve puzzles! This game actually will teach you to be healthier and is fun to play at the same time.

Rule of the game: Swap two vegetables to make chains of three or more of the same vegetable.

Multiple gameplay modes based on score, weeding your garden, getting rid of sugar, breaking wooden blocks, destroying trans fats and time trials will keep you occupied!

Every level provides a healthy tip and the game is motivating you to live a healthy real life (outside your smartphone)!

If you like our game then please Like us on Facebook:
https://www.facebook.com/veggysmash3

Available on

Google Play: https://play.google.com/store/apps/details?id=com.amivarius.games.veggysmash

Apple App Store: https://itunes.apple.com/us/app/veggy-smash-3/id1050514032

Amazon Underground: https://www.amazon.com/dp/B01AF3CR7A

Landing page: http://www.veggysmash3.com

New Unity licenses!

Good news, Unity now has a new licensing system and the licenses for small Indie developers just went a bit cheaper! I immediately took advantage of this new licensing and subscribed us to using the new Unity Plus level as it provides us with enough features for low cost. Main feature we were after is the ability to customize the splash screen and this allows us to remove the Unity splash screen and make our game look more Professional, but there are other nice features also like better analytics and cloud build support, although we haven’t started to use the cloud-build yet.

Unity

We hope we’ll be able to use this and improve our first game Veggy Smash 3 and finally start actually making some progress to improve it. Currently we have to admit the game is still not ready for prime-time and lacks a lot of features we want to build. Also, we need to improve the whole UI a lot more.

Anyway, this post serves as a first of many that will be about Unity and Game development as we haven’t written anything about that so far on this blog.
Even though we have been developing our little game for over a year now and it’s been out there for about half a year already. Here are couple of screenshots from the Veggy Smash 3 we’ve been making:

Veggy Smash 3 Veggy Smash 3 Veggy Smash 3

CXF @WebService and XMLGregorianCalendar with JAXB

Lately we’ve done a lot of work with some different web-services and at one point we discovered that some people have trouble formatting their timestamps properly. Good solution would be to ask people to use a proper standard and not re-invent their own wheels, but that’s not always a possibility. Fortunately there’s a rather simple solution for this. All you need is to define a @XmlJavaTypeAdapter and teach it how to convert different values into suitable formats.

JAXB and XML by default uses a timestamp format of “yyyy-MM-dd’T’HH:mm:ss’Z'” which translates to 2015-04-11T14:15:12.000 roughly and some people think it’s ok to send us SQL ISO format timestamps that look very similar – specifically missing the T letter in the timestamp, like this: “yyyy-MM-dd HH:mm:ss”.

For example, in my web service entity I have a RelaxedXMLGregorianCalendarAdapter in use which is our own implementation:

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType
@XmlRootElement(name = "Metainfo")
public class Metainfo {
    @XmlJavaTypeAdapter(RelaxedXMLGregorianCalendarAdapter.class)
    protected XMLGregorianCalendar generationTime;
}

And here’s the implementation for the adapter (note that we turn null, empty string and specifically a word “infinity” into null’s):

import javax.xml.bind.annotation.adapters.XmlAdapter;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;

public class RelaxedXMLGregorianCalendarAdapter extends XmlAdapter<String, XMLGregorianCalendar> {

	@Override
	public String marshal(XMLGregorianCalendar v) {
		return v.toXMLFormat();
	}

	@Override
	public XMLGregorianCalendar unmarshal(String v) throws Exception {

		if (v == null) {
			return null;
		}
		
		if (v.trim().isEmpty()) {
			return null;
		}
		
		// Who thinks that this is OK for a date field?
		if ("infinity".equals(v.trim())) {
			return null;
		}
                // Replace the space with T to match our default pattern.
		return DatatypeFactory.newInstance().newXMLGregorianCalendar(v.replace(" ", "T"));
	}
}

So there you have it. This is how you can customize how JAXB is handling some type conversions and pretty much you can customize anything JAXB does with this approach. Like teach it to treat -1 for specific fields as null or teach it understand different date formats.

CXF, JAXRS, XML and CDATA

I was in a need to export some XML tags as CDATA in my CXF XML @WebService that generates some XML for our partner.

We had a field that contained an URL and in that we have ampersand characters. By default these get turned into “&amp;” but our specific XML partner was not OK with that so we had to adjust to CDATA. That turned out to be rather complex as I was hoping for something simple like @CDATA annotation – but as always, life is full of suprises.

Anyway, the trick is rather simple to make it work – We need to define our own XML Stream Writer and overwrite the default write method from “writeCharacters” to “writeCData”.

We had a very specific tags in mind only so we specified those as static string array.

You can do this like this:

import java.util.Arrays;

import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;

import org.apache.cxf.staxutils.DelegatingXMLStreamWriter;

/**
 * Simple CDATA XML Stream Writer that exports some items as CDATA
 */
public class CDataXMLStreamWriter extends DelegatingXMLStreamWriter {

	// All elements with these names will be turned into CDATA
	private static String[] CDATA_ELEMENTS = { "infoUrl", "description" };

	private String currentElementName;

	public CDataXMLStreamWriter(XMLStreamWriter del) {
		super(del);
	}

	@Override
	public void writeCharacters(String text) throws XMLStreamException {
		if (Arrays.asList(CDATA_ELEMENTS).contains(currentElementName)) {
			super.writeCData(text);
		} else {
			super.writeCharacters(text);
		}
	}

	public void writeStartElement(String prefix, String local, String uri) throws XMLStreamException {
		currentElementName = local;
		super.writeStartElement(prefix, local, uri);
	}
}

OK; So now we have this nice writer, but how do you use it? Well, we are running it all inside a CXF that’s running with Spring container so as it turns out, we need an “Interceptor” that would help us write stuff. You can make one easily like this.


import java.io.OutputStream;

import javax.xml.stream.XMLStreamWriter;

import org.apache.cxf.interceptor.AttachmentOutInterceptor;
import org.apache.cxf.message.Message;
import org.apache.cxf.phase.AbstractPhaseInterceptor;
import org.apache.cxf.phase.Phase;
import org.apache.cxf.staxutils.StaxUtils;

public class CDataWriterInterceptor extends AbstractPhaseInterceptor {

	public CDataWriterInterceptor() {
		super(Phase.PRE_STREAM);
		addAfter(AttachmentOutInterceptor.class.getName());
	}

	@Override
	public void handleMessage(Message message) {
		// Required for CDATA to working
		message.put("disable.outputstream.optimization", Boolean.TRUE);
		XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(message.getContent(OutputStream.class));
		message.setContent(XMLStreamWriter.class, new CDataXMLStreamWriter(writer));
	}
}

And now, how do you use this interceptor? In your applicationContext.xml or similar Spring context file, define the interceptor and use it!
Note that the LoggingFeature is not required but I’ve left it in here so that you could easily enable logging to see the incoming and outgoing messages better.


	<bean id="CDataWriterInterceptor" class="com.amivarius.cxf.util.CDataWriterInterceptor" />

	<jaxrs:server .... >

		<jaxrs:features>
			<bean class="org.apache.cxf.feature.LoggingFeature" />
		</jaxrs:features>

		<jaxrs:outInterceptors>
			<ref bean="CDataWriterInterceptor" />
		</jaxrs:outInterceptors>

	</jaxrs:server>

And that’s it folks!

The output will be <![CDATA[]]> nicely 🙂

Material Theme for Liferay

So yes, we’ve been busy and made a new theme called Material Theme for Liferay. You can take a wild guess what inspired us but in reality it’s just a simple Google Material Design based theme. I really love their design.

I don’t have time to write up a lot of marketing BS at this point so just look at the damn screenshots and admit it’s just what you have been looking for: Liferay Material Design theme.

 

screen5 screen4
screen2 screen3

Liferay Business Theme

Business Liferay Theme

Yes, we’ve done it again. This time we’ve made a Business Theme for Liferay. If you need a new theme or setup a site with Liferay then please check out one of our themes and give it a try – we won’t disappoint. This theme is fully customizable, you can setup the background images, adjust colors, fonts, sizes, page layouts etc.

You can get it from Liferay Marketplace

product_business_theme

All our themes offer Unlimited colors not specific color-schemes like most liferay themes because we feel that most of the time “Blue” is not quite the same as the blue in your company logo and we don’t want to compromise. Naturally you also get Responsive design that works on All modern browsers and super-great support – If you have a problem with our product then we will fix it.

Company Theme for Liferay

Theme for Liferay

Our code-monkeys have been hard at work lately and we’ve released a new theme called Company Theme for Liferay. If you need a new theme or setup a site with Liferay then please check out one of our themes and give it a try – we won’t disappoint. This theme is fully customizable, you can setup the background images, adjust colors, fonts, sizes, page layouts etc.

With this theme we feel that we have learned a few new tricks and maybe we should start building more themes for Liferay. Maybe it’s time Liferay had equally good quality and flexibility in themes as WordPress?

It’s available on Liferay Marketplace and you can have it NOW.
product_company_theme

All our themes offer Unlimited colors not specific color-schemes like most liferay themes because we feel that most of the time “Blue” is not quite the same as the blue in your company logo and we don’t want to compromise.

Naturally you also get Responsive design that works on All modern browsers and super-great support – If you have a problem with our product then we will fix it.

Liferay Company Theme Preview

Liferay Theme: Dashboard

We have spent some time working on a simple theme for Liferay that we have released on Liferay Marketplace. This Liferay theme that we simply call Dashboard theme is meant to be used for intranet applications, specifically mostly dashboard applications as the name suggests.

liferay dashboard theme

Notable features of this Liferay theme are:

  • Unlimited Custom colors – We decided to let the administrator pick the colors instead of color schemes.
  • Customizable settings – Boxed or full-width, Show / Hide search, Edit footer, Pick your fonts, Adjust the header height etc.
  • We included jQuery and jQueryUI and animate.css libraries but you can easily disable them.
  • Of course the design is responsive and scales to the smaller screens also.

You can read more about the features of the theme and see it in action right here: http://beta.amivarius.com/theme-dashboard but you can also check it out straight in Liferay Marketplace.

Liferay Dashboard Theme

Liferay Dashboard Theme Minimized Menu

Liferay Gallery Portlet

Our latest Liferay Image Gallery Portlet is finally available on the marketplace. We have teamed up with our good friends at Infira and implemented a really neat looking image gallery that you can use to present your portfolio, products, contacts or team event pictures.

Our Fancy animated liferay gallery portlet with document library support has these features:

  • Uses your specified Liferay built-in Document Library Folder as the image source.
  • Fully Responsive Design
  • Automatic Image Positioning
  • Click-to-enlarge
  • Ability to show/hide title and description of image
  • Supports multiple instances per page
  • Configurable (you can adjust all aspects of the portlet)
  • Adjustable colors and thumbnail size

screen4

screen5

screen1

 

This portlet is based on a special version of Opie Scripts Responsive Fully Customizable jQuery Portfolio Gallery.

For those of you who have been following our latest activity in the Liferay world you might want to know that we are working hard at the moment to release our next item into the marketplace which will be a super fancy dashboard theme that transforms your Liferay into really nice dashboard that’s properly suitable for the big screens and small screens. Stay tuned!

 

Liferay Carousel Portlet

Today we finished our work on Liferay Carousel Portlet for Liferay 6.2. It’s a rather useful portlet for public and also internal sites that we submitted to Liferay Marketplace and allows one to show your content, advertising or even important news in a carousel form. As everything went well with the submission process then the portlet is available in the marketplace since today and you have yet another fancy way to display your content in Liferay!

Content Carousel Portlet is basically a portlet that displays Liferay’s Web Content Articles inside a Carousel, allowing you to customize the slides in every way. You can add a single picture to the slide, that’s just fine. But you can also add a whole HTML5 embedded movie clip or your fancy Call-to-Action button on that slide.

We are slowly ramping up our portlet development efforts and we plan to submit many more useful portlets and some fancy new themes for Liferay Marketplace in the near future.

Our Carousel portlet scales nicely to full width of the portlet area, allowing you to show it either as small slides on a side or a large carousel on the top of the page. You can customize the animation and slide durations. Of course the portlet is also multi-instance capable so feel free to add multiple Carousels with different settings on your pages if you really want to show off your awesome content.

Here’s a simple screenshot:
liferay carousel portlet

Another screenshot – Notice that this time there’s text on the slide that’s not part of the image:
Liferay Carousel Slide Portlet

And here’s the screenshot for the configuration mode:
Liferay Content Carousel Config