Hibernate Search with Jersey – Lucene Tutorial

This tutorial is to show you how to search and rank your data on relevance using Hibernate.

First of all, the Hibernate documentation does a great job on explaining the full scope of it’s search, but I had to make a few updates to get it working with Jersey.

Okay, so let’s begin. The first thing you are going to want to do is import the libraries to your project. In this example we are using Maven, but Gradle is an option as well.

Using Maven:


Continue reading

Serving Private Files From S3 Bucket – AWS in Java

If you are building any kind of application, you will most likely need to store and display images or other types of files. This tutorial will quickly show you how to access private images on your S3 Bucket.

By default, if you try to access an image via URL, that is not publicly available you will see something like this:

<Message>Access Denied</Message>

In order to serve your image to the front end without having to make it public you will need to use your IAM user credentials (Access Key Id and Secret Access Key) to generate a temporary URL and pass it to the front end.

In Java, to do this, you could write a simple method like so:

public static URL generatePresignedUrlRequest(String image){
        BasicAWSCredentials awsCreds = new BasicAWSCredentials(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY);
        AmazonS3 s3client = new AmazonS3Client(awsCreds);
        java.util.Date expiration = new java.util.Date();
        long msec = expiration.getTime();
        msec += 1000 * 60 * 60; // 1 hour.
        GeneratePresignedUrlRequest generatePresignedUrlRequest =
                new GeneratePresignedUrlRequest(BUCKET_NAME, image);
        generatePresignedUrlRequest.setMethod(HttpMethod.GET); // Default.
        URL s = s3client.generatePresignedUrl(generatePresignedUrlRequest);
        return s;

The method takes in the Object Key (aka filename as defined in your bucket), and generates a URL that is valid for a set period of time (in this case 1 hour).
This keeps your images secure and does not give the public access to them without your secret keys!

Entrepreneurs – Creating Your First Mobile App

So you came up with a great app idea and have been thinking about it for a while now but aren’t sure where to start. I am writing this article from my personal experiences of being involved in the field, in hopes to guide you in the right direction.

Determine platform to support

After the idea stage, you will need to start planning what your target market is, and what will be the best avenue to reach that target market. In other words: Is your target market mainly an Android crowd, Apple crowd, Blackberry or a combination of them?


The next step is to begin planning out your app on paper or using a mockup tool. This will help you visualize your app and it will help you when approaching developers to explain your idea. These mockups do not have to be very detailed, just some basic screen layouts will suffice. Below is an example of a wireframe in its beginning stages; a good group of developers can take these and provide suggestions based on their experience in the field.

wireframe example
Continue reading

Android guide to setting a single or repeating alarm

If you are developing an app which deals with alarms, you might be confused as to how to set either a single alarm or a repeating alarm, I will walk you through it so you can get a better understanding of how it works.

In this example, we will say we are trying to create an alarm that triggers some piece of code at 8:30 AM, either once or repeating everyday.
Use this code snippet wherever it is that you want to create your alarm.

AlarmManager alarmMgr = (AlarmManager) c.getSystemService(Context.ALARM_SERVICE);
Intent receiverIntent = new Intent(c, WakeupReceiver.class);
PendingIntent alarmIntent = PendingIntent.getBroadcast(c, 0, receiverIntent, 0); //The second parameter is unique to this PendingIntent,
                                                                                 //if you want to make more alarms, 
                                                                                 //make sure to change the 0 to another integer
int hour = 8;
int minute = 30;

Calendar alarmCalendarTime = Calendar.getInstance(); //Convert to a Calendar instance to be able to get the time in milliseconds to trigger the alarm
alarmCalendarTime.set(Calendar.HOUR_OF_DAY, hour);
alarmCalendarTime.set(Calendar.MINUTE, minute);
alarmCalendarTime.set(Calendar.SECOND, 0); //Must be set to 0 to start the alarm right when the minute hits 30

//Add a day if alarm is set for before current time, so the alarm is triggered the next day
if (alarmCalendarTime.before(Calendar.getInstance())) {
   alarmCalendarTime.add(Calendar.DAY_OF_MONTH, 1);

alarmMgr.set(AlarmManager.RTC_WAKEUP, alarmCalendarTime.getTimeInMillis(), alarmIntent);

Continue reading

Project Management Tools Used @ Alias Apps

At Alias Apps, we take great pride in offering a very personal approach to each client and project, taking the time to listen, ask the right questions and provide the correct advice. When we first started the company, this wasn’t a very hard task as we only had a small number of clients; but as we grew over the next year we realized that it is not so easy to keep track of every project, every client and every email anymore and we needed to setup systems to help us manage our growth. As most small businesses would, we researched heavily to find the best free solutions. Below are some of our project management tools which we use on a daily basis to make sure that each project is completed on time and all of our clients are kept up to date with the progress on their projects.

Continue reading

Intro to Mobile Apps for Businesses

How can your business benefit from having an app?

Mobile apps are among the fastest growing markets in the world. In Canada, more than 55% of the population now owns a smartphone and have an average of 25 apps installed. Having a mobile app gives your business a new presence and allows your potential customers to find your information, products & services as easily as finding tomorrow’s weather forecast.

By having a mobile app for your business you will be able to build a community around your products and services by allowing users to interact with the business and between each other. As soon as somebody installs your app you know they are a potential client. An app will allow you to make money, save time and get new leads by selling or communicating directly through the app. Your business will be able to reach app users 24/7 through push notifications & promotional offers.

Lastly, your business can increase brand awareness and showcase products or services in a fast and intuitive manner. Think of it like another form of marketing.

This all sounds great, but how much will it cost?

The cost of app development is greatly affected by the development process that the contracting app development company chooses to persue. Generally speaking, Hybrid apps will usually cost about half the price and will take less time to develop over Native apps, however you may be sacrificing some user experience.

Continue reading

Caching GET Requests Using Angular $resource

When designing web apps for mobile, two factors that we take for granted in a browser must be addressed, namely, speed and bandwidth usage. Making a request to the server for the same data can significantly slow down an app, and increase the bandwidth usage. The solution to this problem is caching, and starting in Angular 1.2, the $resource object comes with a cache parameter to simplify the process of caching a GET request.

Using the cache parameter requires adding only a single line of code to your $resource service.

.service('Products', function ($resource) {
    return $resource(/product/:id',
            query: {
                method: 'GET',
                cache: true

Now only the first GET request will actually hit the server, and continual requests will be retrieved from the $cacheFactory. Depending on the kind of application you are developing, you could be finished here, however many applications have data that changes based on user interactions. If that is the case, you will need a way to tell the cache to reload itself with the newest data from the server. This can be accomplished by creating a simple factory to remove a key from the $cacheFactory.

.factory('Cache', function ($cacheFactory) {
    var $httpDefaultCache = $cacheFactory.get('$http');
    return {
        invalidate: function (key) {

Anytime your $resource has changed, you can reload the cache by calling:

// to reload the entire cache
// to reload a single entry
Cache.invalidate('/api/v1/product/' + entry.id);

Thanks for reading, comment below if you have any questions or comments.