Quartz – Java Job Scheduling Service

Most of the Java Projects, Enterprise Applications need some form of scheduling every now and then. People try to implement in number of ways like Timer, EJB etc. In one of my assignments I stumbled up on very interesting scheduling service known as Quartz. I was amazed by its simple but powerful implementation. Most interestingly its open source and can be integrated with virtually any Java application from the stand-alone application to the e-commerce system. Quartz supports all types of schedules, you can configure your timings from milliseconds to days to years. Quartz stands apart from other scheduling services by providing some state of the art features like Job Persistence, Transaction Support, Job Clustering, Listener Support.

Installation: Quartz get installed in matter of minutes. Only you have to download the latest jars that are available on their official site and add it to your project or application. That’s it!

Quartz allows you to divide your task in Job and run this job as per the schedule you have configured. You can uses a configuration/properties file to read the schedule. Sample properties file is shown below

In ideal scenario, you would need a scheduler class and a job to schedule. Here I am providing sample scheduler and job which is executed by trigger we create as Hourly.

Above scheduler class is creating an instance of job and a trigger to schedule the job. Job names are used so that job is uniquely identified in the schedule context. Here you will see that I am also trying to add the listener to the job. This is helpful when you want to do some another job once this is job is complete. e.g ETL. Here is the job and listener classes.
MyJob.java

MyJobListener.java

You can see that MyJobListener class is implementing JobListener interface and methods jobToBeExecuted and jobWasExecuted are implemented. These method will give user full control to listen to the jobs status.

Java Sorting Using Comparable

In Java you can do sorting by implementing 2 interfaces

1) Comparable
2) Comparator

Here we will see sorting example using Comparable Interface. As an example we will be sorting objects of Employee class.

When using comaprable interface make sure the object class
which you are sorting implements comaprable interface and override compareTo method correctly.

As I was more used to Java 1.4, I didnt followed any Java Generics implementation.

SortTest is main class that will actually create an array list and fill it with some random Employee objects.

Employee is class that will implement compare To method. I have added simple if-else control structure that will decide what to return on the basis of employee id.
less : -1           equal : 0           greater : 1

Here is the code for classes:

Output:
sort_comparable
Limitations:

  1. Objects should be mutally comparable. i.e you can not compare objects of different classes.
  2. Using comparable binds sorting to one perticular strategy.
    e.g. In above example we have sorted using employee id to compare. now if we need to sort on employee name it will be difficult.

Next, I will be putting similar example using Comparator Interface.

How to add Options Framework to WordPress Theme

When a WordPress Theme developer takes up any new theme development, he has to think about some neat and unique design and what all features he is going to offer in the new theme. It’s not quantity but quality and configuration usability that makes user to choose your theme over others. If you start to code for admin configuration in your theme, it will take you ages to come up with some descent design and options.

When I gave a try to WordPress theme development, first thing I looked for is that “How I am going to provide all those options which I have in mind with minimal code?” I stumbled up on few plugins that were available in market and could have worked very well with my theme. Of all such plugins one stood out in simplicity and functionality and that is Options Framework Plugin . The Options Framework Plugin makes it easy to include a full featured options panel in any WordPress theme.

My aim was to use same functionality as an in-built feature of my theme and not as a plugin. This would have saved a great deal of time of theme. So I did some search and trials and I was able to implement the framework inside my theme. I am going to share the same here in this article.

First you need to copy the plugin copy from GitHub to your local drive. Once you have the zipped archive on your machine, unzip it and copy files and folders as displayed in below image to to one “admin” folder.admin-dir

 

Next task is to initiate the framework and provide options.php to this framework. Basically this framework uses a php file to get its options data. By default the name of the file is “options.php” but you can override this by simply adding simple filter. Now I will show you my theme’s includes/inc folder where I am going to put above admin folderinc-dir

 

You can see I have one “options-panel.php” which is going to initiate the framework and “options.php” which stores my actual options. Here is the code for framework initiation

The code is simply locating the options framework and invoking i. The above code also shows you how to put in the filter to override the options file name. Now this framework supports almost all of the options types, these are listed below

  • text
  • textarea
  • checkbox
  • select
  • radio
  • upload (an image uploader)
  • images (use images instead of radio buttons)
  • background (a set of options to define a background)
  • multicheck
  • color (a jquery color picker)
  • typography (a set of options to define typography)
  • editor

The framework provides you nicely grouped options. All options belonging to one group are displayed in one tab. Tabs shown as below.basic-settings

And above can be achieved using the options.php

The first element with type as heading will be treated as one tab and all other options that follows will be added under that tab till we encounter next element of type heading. Isn’t it easy? Now if you want to add next tab, just add one more element with type heading in and you will get your next tab. e.g.

You can find details of other options that is available in the downloaded folder. With all this information I think you will be able to add options framework to your theme with ease and make your theme powerful than ever.

Top 5 Best Responsive CSS Frameworks for Web Design

After developing two WordPress themes based on responsive css frameworks, I believe I should put in my opinion on which framework I felt is more user friendly. I am going to start a new WordPress theme which uses Foundation CSS Framework and then I will a try to Twitter Bootstrap Framework and develop the Theme. In this article I will be concentrating more on these 2 frameworks but we will review other frameworks that are available in market.Continue reading →

3 Tips to Help You Simplify Your Web Design

When it comes to web design, the saying ‘less is more’ could not be truer. Simplicity is key, as it provides an all-around easier to use design for the user, helps to reduce confusion with navigation, and makes the website look sleek and professional. In turn this can help to produce more of your desired results – for example, more signups, better sales of products, and visitors staying on your site for longer. But, what if whatever you do, you simply can’t get the sleek, simple, minimalist looking result that you desire. There’s no need to worry as by following some simple steps, you’ll be able to simplify your website and start seeing results. Here are some tips.

Photo by tiramisustudio at freedigitalphotos.net

Focus on the Essentials

There are a number of cool elements that can be added to websites that aren’t absolutely necessary and can often cause a cluttered looking interface if overused or not used correctly. Unfortunately, many web designers fall foul to these features, thinking that by adding them, the website will look better – a result that is not always the case. This is why when designing a simple website, any good web designer (such as those at Sioux Falls web design) will tell you that you should concentrate only on the bare essentials. The 80-20 rule is a great way to go about achieving this result. When designing your site, focus on the 20% that is delivering 80% of usefulness – this could be reviews, media badges, an online store button, or a subscribe form. The fewer distractions there are on your website, the better chance it has of doing well.

Less Pages

The more pages that your website has, the harder it will be to navigate around, meaning that many users might be put off visiting or staying on your page for long. Having fewer places to explore and less clicks is a key element of simplifying your website design, and you can do this by either merging multiple pages into one, or trimming away pages that aren’t absolutely needed. A great way to do this is to imagine that you are the customer – if you visited your website, what would be the key things that you’re looking to do? Once you’ve determined what it is that your customers want to find out when they visit your site, you’ll know which pages to keep, and which can go.

Limit Colors

With so many color choices out there, it’s easy to see why many web designers can get carried away when designing the color scheme of a site. However, using too many colors can simply become a distraction, so it’s important to choose no more than two or three complimenting colors to keep your website looking sleek and simple. Using different shades of the same color, for example, light blue and dark blue, adds more subtlety to your site.

If you’re a web designer who’d like to add any tips to the above list, we’d love to hear from you in the comments.

Working For Yourself. No, It’s Not Easy

Being an entrepreneur, on any level, is tough. It takes a lot of attention, focus, self-esteem, and drive. All of these elements go into your will, and it’s your will that guides you forward in your life. There are plenty of things that cause people to struggle in the world of working for oneself. We get lazy, distracted, and lose focus in so many other ways. But if you’re a solopreneur, even if you’re just a freelancer, your success, at the end of the day, comes down to you. So how do we stay motivated? How do we maintain the drive to succeed? It’s different for everybody, but here are a few ways.Continue reading →

How to Learn Internet Marketing

banner407

Learn every detail about internet marketing

Significance of internet marketing to your business might be change depend on your product or service. However, it is obvious that internet is getting bigger than ever in every single day and even right now, there are millions of products and services you can get by just using the internet. So, the importance is obvious.
Continue reading →

Four Fundamental Principles of HTML Email Template Design

opHTML email continues to prove itself as a viable tool for businesses who want to communicate with their audience in an effective, and relatively inexpensive way.  For the email marketer, it has become an indispensable weapon that often means the difference between failure and success.  Although more customers and subscribers are demanding HTML email, ensuring seamless compatibility across the array of mail clients and web browsers can make actually designing the template a nightmarish experience.  Don’t fret.  We have listed four of the best practices you can use to guarantee a great design.

1. Create Your Email with a Good HTML Editor

We all know that most email readers excel at sending and receiving email.  That is what they are made for, so that is what they are good at.  Unfortunately, many do not realize that these programs are not great at creating HTML email, even though they may support the format.  We strongly suggest that you do not design your template with a typical mail client such as Eudora or Microsoft Outlook.  By doing so, you run the risk of ruining the format of the message for your recipients using different mail reading programs.  Luckily, there are many capable HTML editors on the market, and all are geared to simplify the design process and help you create messages that are compliant with web standards.

2. Build Your Layout with HTML Tables

You can discover a range of design possibilities that can be easily coded by using HTML tables for your layout.  These tables make it easier to break your space into columns and rows, allowing you to add streamlined organization to your template.  They can also help weed out some of the problems caused by different email readers and how they render HTML code.  While some designers may prefer more advanced methods that call for coding to the latest standards, using tables doesn’t necessarily mean you have to revert to the primitive days of HTML programming.  The fact that so many clients support HTML today increases the chances that your tables will display just fine.

3. Understand General CSS Guidelines

If you are a proficient HTML designer, you may be used to creating a separate CSS file that contains the formatting instructions for tags, and referencing that file through a link in the head section of a web page.  Although this works fine in most locally operated mail programs, it usually does not carry over to web-based mail.  For example, Hotmail requires that CSS be spelled out in the body, Yahoo mail needs it spelled out in the head, and Gmail only offers support for inline CSS.  These are just a few of many reasons why designing HTML email with CSS can be very frustrating.  There are, however, several ways around them.  If you carefully format your CSS with semantic markup, email readers that only ignore some of its features will likely downgrade your message to an Rich Text Format (RTF) look without ruining your links.

4. Simplicity is Power

When designing your HTML email template, try your best to the keep the formatting as simple as possible.  The technology itself is ideal for incorporating things like images, Flash animation and forms, but you should never let these dynamic features hinder the effectiveness of your message.  The more complex HTML gets, the more it degrades in performance and turns off the reader.  You must also keep in mind that some mail clients may not work in perfect harmony with certain features.  This should give you all the more reason to keep your design simple and effective.

6 Tips to Get Twitter Followers

Twitter can be a valuable tool for publicizing your lenses or website but first you have to put in some work upfront to grow your Twitter follower base to a valuable size. However, you don’t want just any followers, such as autobots, you want followers that are genuinely interested in the topics that you cover. So you need a follower strategy that will develop a valuable follower base of interested Twitter followers.

There are plenty of  tech tips and review tools out there that claim they can get you thousands of Twitter followers and some of them may be able to, but the quality of your followers is also very important. If you do not get like-minded Twitter followers, then your tweets are going to fall on deaf ears and there will be no valuable to your follower base.
1. Set up your Account to Follow Back

Twitter account holders will only follow accounts that follow them back, so it is best to setup your account to automatically follow back. There are several tools on the web to manage your Twitter productivity. Personally, I use SocialOomph to manage my multiple Twitter accounts. It auto follows anyone that follows me and also sends a direct message that I created to those new followers.

It used to be that lots of companies offered free tools for auto follow features, but because of some restrictions that Twitter has placed on the number of follows and unfollows from any one server, most tools now charge for this service. There are several free tools that let you compare your followers and friends so that you can sync them up manually. These are helpful but they take a bit more work than an auto follow tool. If you are interested in these free tools, check out ManageFlitter or FriendorFollow.

2. Share Lots of Good Content

Be Interesting!
The best way to get new Twitter followers and create buzz is to actually share something worth retweeting. It seems most marketers on Twitter just want to send out self-serving tweets about their product, service or content. While this is okay to do in moderation, you need to pepper your tweet stream with info that is useful to your followers. Most of the time, this will not come from your own site. However, it is this karma that can result in others sharing your material too.

@GuyKawasaki is one of the best Twitter users at sharing interesting info from across the web and his stuff gets retweeted all time. As a result, he has hundreds of thousands of Twitter followers. If you are only planning to send out marketing info on your products, it is going to be a lot tougher to grow your Twitter follower base.

Share good interesting things that you find from around the web and people will place a much greater value on your tweets.

3. Use lots of Hashtags

Twitter followers hashtag are the most valuable tool on Twitter and you need to take advantage of them. A hashtag is a word with the # in front of it such as #movies. When I tweet about anything I always include several hashtags that I think make sense, some may not have even been used before but I include them because they are likely to be used in the future. So if it is a movie post, I will include the #movies #films #cinema and maybe event specific hashtags for stars, such as #tarantino.

The reason hashtags are so important because when people want to find specific information on Twitter, they often search by hashtag. It is a very easy way to follow a stream about a specific topic. So if I wanted to know what was going on with Quentin Tarantino, I would search #tarantino on Twitter and get This Stream.

From a follower standpoint this is incredibly important for two reasons, when someone is specifically looking for #tarantino info, my tweet is going to show up in the #tarantino stream if I used this hashtag. Secondly, it is a way to keep treats relevant long after you tweeted them. One of the big problems with Twitter is the sheer number of tweets per minute mean that anything you say now will likely disappear from the first page of your followers stream within 5 minutes. But if you use highly targeted hashtag, those tweets will continue to show up in specific searches for a much longer period (depending upon how often a tag is used).

I like to have some general tags in my tweets to get more current exposure and then a few highly specific tags to show up in searches in the future. Most of my unsolicited follows come from hashtags.

4. Find users with Similar Interests (that Follow Back)

The Twitter recommendation engine is a good place to start and I through the “Who to Follow” list once every couple of days. However, I only follow users that look like they follow back (following is equal to or greater than followers). But don’t stop at the “Who to Follow” list, there are other good methods to get Twitter followers by finding other people with similar interests.

Do Hashtag Searches
i have already discussed the value of hashtags to get your tweets noticed, but they are also good to find like-minded Twitter users. You can use hashtags to search any specific topic. Then as you look through the tweets with that hashtag, you can find good Twitter users to follow that are also likely to follow you back.

For instance, my focus is movies so I will often do searches of #movies and #films to find people posting about movies that I do not yet follow. Again, I only focus on people that are likely to follow me back (more following than followers) but this is a great way to find lots more Twitter users to follow outside of the short little list that Twitter recommends.

Browse through your Follower and Following Lists
Theoretically, your followers and following lists have interests similar to you, at least a majority should. If you browse through your followers followers, or your followings followers, you will find lots of other Twitter users with similar interests. Screen those for the likeliest to follow you back and then follow those users.

These are all great free ways to find Twitter users to follow and also to get like-minded Twitter followers in return.

5. Search the Hashtag #Followback

The #followback hashtag is specifically used by people looking to increase their own followers by following others. Virtually all of the people using this hashtag will follow you back, however, to be safe I usually look at the number of followers and following for each person. If someone has thousands more followers than following there is a good chance they will not follow you back.

6. Use Twiends to Get More Twitter Followers

Twiends is a really interesting site for growing your Twitter follower base. The site uses seeds (as in to grow your garden) as currency to help you grow your network. You get a certain number of seeds just for joining and you can decide how many seeds your are going to pay for people to follow you (the default is 2 seeds per user).

You can follow other Twiends members to get more seeds to find more Twitter followers for yourself. So it becomes an endless loop. What really makes this work though is the segmentation. You can enter up to five interest keyword phrases so you can specifically follow people that have one of those 5 interests also. That is a good way to make sure you are moving in the right direction of adding Twitter followers with similar interests.

To know more online networking technique check-  http://primaveraglobalpt.info/