Connect Joomla to an SMTP Server

November 5th, 2012 by rtssys

Connecting Joomla to an SMTP can be difficult with a fresh install on a new server.  Detailed are many steps which may or may not impact your particular environment but are all worth trying to resolve any issues you may be having.

These steps are detailing a Joomla 1.5.17 install onto a dedicated Centos 6.3 linux web server connecting to a Microsoft Exchange Server to send SMTP email.

You may have to use sudo or sudo -u root depending on how your server is setup to execute many of these commands.


Is sendmail installed?  Is it the latest version?

  • Get sendmail installed


Check what version of Sendmail is installed on your box

 rpm –qa sendmail

Update to the most recent version.

 sudo yum install sendmail

You may also need this to create your cf file

sudo  yum install sendmail-cf

  • Get sendmail running

You may have to shut down postfix because you can’t have sendmail and postfix running at the same time

sudo  /etc/rc.d/init.d/postfix stop

Or

sudo service postfix stop

Next you should make sure that the sendmail service is running

sudo service sendmail restart

Then check it’s status

sudo service sendmail status

You want to see something like this:

sendmail (pid  15687) is running…
sm-client (pid  15696) is running…

sendmail (pid  15687) is running…

sm-client (pid  15696) is running…


Make sure sendmail starts up if your restart your box

sudo chkconfig sendmail on

Are your Configuration Settings Correct?


  • /etc/mail/sendmail.mc

Replace this line in sendmail.mc

DAEMON_OPTIONS(`Port=smtp, Addr=127.0.0.1 Name=MTA’)dnl

with

DAEMON_OPTIONS(`Port=smtp, Name=MTA’)dnl

You may have to define this host as well:

define(`SMART_HOST', `yourSMTPserverDomain')dnl

Save the file and restart sendmail again

Can Httpd send emails?

Check your email settings here:

getsebool -a | grep mail

if httpd_can_sendmail is off then you will have to run this command to turn it on.  It will take a minute so just wait.


sudo -u root setsebool -P httpd_can_sendmail on

Restart sendmail again and make sure it’s running.

  • Try sending a test email:

/usr/sbin/sendmail youremail@gmail.com

-> Press Enter

Type:  ”Subject: test”

-> Press Enter

Type ‘.’

-> Then press enter again

Setup you Server in the Joomla back end Admin Console

Site -> Global Configuration -> Server

  • Try sending a test email through the  Joomla back end admin console:

Then you can send a test email using:  Tools -> Mass Mail.

Other problems?

Having trouble finding files?

Use this command to find files:

find / -name 'filename'

If you have any other problems check the mail logs:

sudo tail -f /var/log/maillog
Please let me know if I left out anything and I hope this helps any problems you may have!

Drill down Reports using Hyperlinks in Jasper/Ireports

September 17th, 2012 by rtssys

Drill down Reports using Hyperlinks in Jasper/Ireports

Jasper does not offer the ability to drill down on data. But, what is possible is to have a summary report which can be blown up using a hyperlink to a detailed report. For simplicity let’s call the Summary report as ‘Main report’ and Detailed report as ‘Subreport’.

Steps for the Main Report

  • Identify an element (Header label etc.) in the main (Summary) report that you would want to create a hyperlink on.

  • Right click on hyperlink and follow as below:

Hyperlink Target = Self                            Hyperlink Type = ReportExecution

  • Add two parameters, first one would have the report path

_report : “/reports/samples/ClientAddress”  (Double quotes are important)

  • The second parameter will be the parameter defined in second report

ClientID : $F{Client_ClientId}

Step for the Sub Report

  • This report will have a parameter called ClientID

Save both the reports in Repository and run the first one. Click on the link and it would take you to the second report.

The Case for Data Quality

September 17th, 2012 by jyot

By now most of us know how data-driven the whole course of forming strategies and making key decisions in business has become. So we know that Business Intelligence is important, and it is here to stay. We may also know how Business Intelligence works to bring more clarity into an organization’s activities. There is the integration of data warehouses, which is nothing but bringing together disparate data sources into a single platform and creating databases that can speak to each other. And there is the creation of reports that bring to light the important stuff executives need to know about their business in the form of crisp metrics.

That is, by and large, the general understanding people have about what a BI solution basically does. So what can’t it do? When data is aggregated, analyzed, and reports are churned out, there is a considerable portion of time spent on doing quality check on the data reported. But there is a catch. What happens to the garbage that is already in the data? Yes, we are talking about the age-old garbage in, garbage out principle. The quality check can very well unearth these anomalies in the data but when they come from the source, i.e., from the point of data-feed, there isn’t much that the BI tool/person can do at the report writing stage to fix those errors. This is especially true in those cases where database providers are separate from the BI team that works with the data.

Needless to say, errors like that can be costly. Imagine a case of wrong billing which invariably leads to uncollected receivable. Now imagine a few hundred, or may be thousands of cases like that. The losses, when they pile up, are significant. A 2002 study conducted by The Data Warehousing Institute (TDWI) estimated that poor quality customer data costs U.S. businesses a massive $611 billion a year. More recently, Ovum published a research paper where they estimate the total cost of bad data quality in US to be $700 billion – a sizable 30% of their revenues.

However, the good news is that this is a problem that is clearly solvable. Maintaining rigorous data quality is entirely possible, as long as the key decision-makers in a company recognize how crucial this task is and therefore treat it as a project in its own right. It calls for a well thought-out strategy. Here are a few steps we recommend from our experience to tackle the data quality beast:

  1. Recognize that it is not entirely up to the IT department or BI vendor to fix these errors. The often cited barrier to improving data quality is lack of commitment to the cause by key decision makers in the company. Almost half of the 647 survey respondents in TDWI’s Data Quality survey had no plans for improving their data quality. It takes a strong and willing collaboration between all the users of data – the business users, the data analysts or report writers and the IT department/database provider.
  2. Decide on a workable method to eliminate errors. The business users and BI analysts can work together to come out with reports that alert erroneous data feed as soon as they happen. At the same time, they need to bring these error prone entries to the attention of the data-feed application providers (if different from the BI guys), so that they can embed checks and balances in the application to prevent incorrect entries. We followed this approach with one of our clients, spending a considerable chunk of our time in identifying areas that require data validation and building reports to support the validation process. Within weeks, our client was able to recoup over a million $ worth of receivables.
  3. Define a formal process for this task and define the scope of the project. Build a list of error-prone areas and set timelines to correct each of these issues. It is important to recognize that this is an evolving process and therefore the timelines set must be realistic.
  4. Transparency is key. Everyone needs to be on the same page about ongoing progress on the project.
  5. A lot of data quality problems arise out of training issues and this must be duly noted and acted upon by the concerned managers in the organization.

A solid investment in a formal approach like this will eliminate the pain points for all the parties involved. More importantly, it leads to sizable long-term financial savings for the company that may be used to seeing a lot of money go down the drain due to data quality issues. But the most beneficial outcome of this is that it gradually leads people to gain faith in the data at their disposal so that the decision-making process is not unduly hindered by lack of reliable information.

Install Sun Java JDK on CentOS 6

February 10th, 2012 by jyot

Something that should have taken a minute at max, took us an hour to resolve.

I hope someone will find this link very helpful – http://mohammadthalif.wordpress.com/2011/10/08/how-to-install-java-sun-jdk-in-centos-6-2/

The most important command was : # update-alternatives – -config java
So, if your server has openjdk or any other jdk version, you need to run the update to get sun(oracle) JDK effective.

Happy installing :)

Jyot

Having trouble with the Grails install-plugin command?

October 27th, 2011 by rtssys

Are you having issues with dependencies or other problems when trying to use install-plugin?

We are using:

Grails 1.3.7

STS 2.5

Go into your project’s BuildConfig.groovy

/[Your_Project_Name]/grails-app/conf/BuildConfig.groovy

Find the repositiories section:

repositories { grailsPlugins() grailsHome() grailsCentral()

// uncomment the below to enable remote dependency resolution
// from public Maven repositories
//mavenLocal()
mavenCentral()
//mavenRepo "http://snapshots.repository.codehaus.org"
//mavenRepo "http://repository.codehaus.org"
//mavenRepo "http://download.java.net/maven/2/"
//mavenRepo "http://repository.jboss.com/maven2/"

}

Search for mavenCentral().
Uncomment this line out. This will then enable remote dependency resolution.

Then try the install-plugin command on the command line.

Here is an example:

install-plugin mail

or

install-plugin http://plugins.grails.org/grails-mail/tags/RELEASE_1_0-SNAPSHOT/grails-mail-1.0-SNAPSHOT.zip 

If running install-plugin on the command line does not work for you, you can try the plugin manager.

Right-click your project -> Grails Tools(Towards the bottom) -> Grails Plugin Manager.

Search for your plugin then install and click the OK button.

http://stackoverflow.com/questions/7905714/grails-install-plugin-does-not-work-for-me/7921928#7921928

Groovy: “That’s 357 Minutes Of My Life I Can’t Get Back”

July 29th, 2011 by jyot

So there I was. I worked my full day of client meetings and looking for new office space, only to face a late-night data migration, transferring data between two tables.  I did not expect it to be an overnight endeavor.

The Groovy script I had authored seemed simple and straightforward to me.  I logged in, cd’d to its location on the server, typed the name of the script, and hit enter.


Six hours later, the prompt returned.


You can imagine I was not a happy camper, constantly executing queries on the database to answer the question: “Is it really doing anything? Is it hung?”
Row by row the data was deposited.  Six long hours later, I wearily logged off and crawled into bed just as the sun began to peek over the horizon.
I did not want to repeat this. 
So, I did a little research.  Hopefully what I learned can help others avoid this very costly oversight.

Enter Groovy’s  batchUpdate feature.  Perhaps I’m just a little late to this party, but from a novice’s perspective, Approach 1 (see listing) seems perfectly reasonable: for each row in one table, insert the data into another table.



Approach 1: “Brute Force”


// This took more than 6 Hours

mssql.withTransaction

{

cachesql.eachRow(”select * from HDL.TransactionJournal where TransactionDate between ‘2010-08-01′ and ‘2011-08-01′ “)

{ row ->

mssql.execute(”insert into[dbo].TransactionJournal (ID, TransactionDate,TxCode,TxType) values (?,?,?,?)”, [row.ID,row.TransactionDate, row.TxCode,row.TxType])

}

}




After running this script and painstakingly monitoring its progress overnight, I embarked on a quest to determine the better way to do this.  After a bit of searching, I discovered Groovy’s batchUpdate. 

I quickly rewrote my script, and the same data transfer took 3 minutes.  That’s right – from 360 minutes to 3.  How’s that for two orders of magnitude’s difference?

The concept is this: do a mass insert, and commit every x number of rows, instead of inserting and committing each row singly.  The higher you set the parameter for committing, the faster it will run.

Approach 2: Same Data Shuffling, Much Faster Performance

// This took 3 mins

mssql.withTransaction

{

//it commits after each 10K insert

def updateCounts = mssql.withBatch(10000, “insert into[dbo].TransactionJournal (ID,TransactionDate,TxCode,TxType) values (?,?,?,?)”,

[row.ID,,row.TransactionDate, row.TxCode,row.TxType]“)

{ ps ->

cachesql.eachRow(”select * from dbo.TransactionJournal where TransactionDate between ‘2010-08-01′ and ‘2011-08-01′ “)

{ row ->

ps.addBatch([row.ID,row.TransactionDate, row.TxCode, row.TxType])

}

}

}

The underlying lesson learned here is a fairly standard one, which is, when doing something that looks like batch processing in a database, make sure to use batch processing (within a transaction) to ensure optimal performance. 

Groovy’s batch processing feature was introduced in November 2010 with the release of 1.7, so anyone who picked up Groovy prior to that (like myself) may be accustomed to working around this previously missing feature.

Hopefully this article will help others avoid the mistake of quickly whipping up a script like this – only to sit and watch it execute, not-so-quickly.

Taking SEO to the Next Level

June 15th, 2011 by rtssys

How to Improve SEO For Your Site

First step: Keywords

- Whether you have had your site for awhile or are just starting, finding relevant and significant keywords is important.

- Keywords should produce high value and high volume, but they should not be difficult. If your keyword that is used often with a lot of competition, that keyword will not help you as much as needed. Still use it, but look for other closely related keywords with less difficulty.

Second step: On-page Optimization

- Images should have image names describing the image itself. The images used should be relevant to the site and also be almost descriptions of your keywords themselves.

- If using wordpress (or any blog), make titles and headings using your keywords.

- Do not use title tags too much. Most search engines look down upon repetitive keywords and bring down your ranking.

Third step: Links

- Links that are used in tweets are significant for SEO.

- Use shortening twitter tools for links (bit.ly, etc) and customize the link to have your keywords in shortened link.

- Use keywords in tweets and posts for all social media.

- Use a link tracking site (opesiteexplorer.com) to see popular competition’s backlinks and attempt to get involved with some of those links as well.

- Use Google Analytics  to see any errors on your site. If these crawl errors are overlooked, it could affect the traffic to your site.

- Use canonical URL tags for your pages. These will help  search engines to link all duplicated content to the original page and link.

Prevent users to accidently navigate away and lose data – GWT/SmartGWT

June 10th, 2011 by jyot

Just add to the panel. A very useful code.

//Added the code to prevent the users navigating away.
Window.addWindowClosingHandler(new Window.ClosingHandler() {
public void onWindowClosing(Window.ClosingEvent closingEvent) {
closingEvent.setMessage(”Do you really want to leave the page?”);
}
});

//Added the code to prevent the users navigating away.

Window.addWindowClosingHandler(new Window.ClosingHandler() {

public void onWindowClosing(Window.ClosingEvent closingEvent) {

closingEvent.setMessage(”Do you really want to leave the page?”);

}

});

Improve your SEO – 36 Tips to help you get started

June 2nd, 2011 by rtssys
  1. Quality and unique content is the most important aspect and must be relevant. Focus all content on the keywords.
  2. Always keep SEO in mind when creating a page.
  3. Site must be accessible and simple to do so.
  4. Page Rank is not an important factor.
  5. Do not use Frames and use Flash and AJAX cautiously to optimize SEO.
  6. Watch for canonicalization problems. Make sure whether your site redirects using http://www.yoursite.com and http://yoursite.com.
  7. The URL extension is not important.
  8. If main landing page is mainly flash or images, have text and navigation links below the fold.
  9. SEO is an active process at all time.
  10. Social media is key to understand. Using twitter, Digg, facebook, etc will keep content fresh.
  11. Keep site active with new information whenever possible. Blogging is a great way to keep active on a website.
  12. Reuse of content from other links is important to keep active.
  13. Add comment boxes or interactions to your site or blog.
  14. SEO for domains
  15. Search non-profit .edu domains that need sponsors. These domains are looked highly upon from search engines.
  16. Make sure domain ownership information is not blocked. This may make you look like a spam site.
  17. For shared servers, check that other banned sites are not on the same server. This may bring down your ranking.
  18. Check server headers.
  19. SEO for keywords
  20. Have keyword Title Tags on every page of your site.
  21. Key phrases are just as important as keywords. Try to add locations to searches to be found locally as well.
  22. Use keyword phrase as link to your backlinks. Create a network of these backlinks but only if they are relevant to your keywords.
  23. If keyword count is strangely high, this count will hinder your SEO not help it. Do not crowd your content with just keywords repetitively.
  24. Your RSS feed should be rich with keywords.
  25. SEO for Images/Videos
  26. With all images and videos, make sure to use subtitles. These subtitles should be full of keywords. Most images and videos are ranked with this surrounding content.
  27. If you have many videos on your site, use a sitemap for the videos so they are more likely to be found.
  28. Use different sites as well as YouTube to post your videos.
  29. SEO for Links
  30. Have links explain what they are relevant to when clicked. Instead of “Click Here”, “Coffee Grounds” link uses keywords and is a better choice.
  31. Link out so others will want to link back to you.
  32. Make sure outside links link back to your domain.
  33. Links are all about quality not quantity.
  34. Surround links with descriptive, relevant content to that link.
  35. Email links for newsletters, etc are helpful links as well.
  36. Backlinks from a high ranked site are ranked high and carry weight back to your site.

Setting up a SQL Server 2008 R2 Local Database Instance

May 24th, 2011 by rtssys

Setting up and accessing a local database instance in SQL Server 2008 is a somewhat less then intuitive process.  This post will attempt to alleviate some of the wasted time and frustration of this process.  Please let me know if you experience any issues and also if you see anything that needs to be corrected.  Thanks and I hope this helps!

Start up the Local Server

  • Click Start -> Microsoft SQL Server 2008 R2 -> SQL Server Configuration Manager
  • Set the SQL Server(SQLEXPRESS) and SQL Server Browser to automatic start mode.
  • Right click -> Properties -> Service Tab
SQL Server 2008 Server Settings

SQL Server 2008 Server Settings

Login to Local Server

  • Now open up SQL Server Management Studio and Connect to Object Explorer and select Server Name: [Your PC name]\SQLEXPRESS
  • Example:  8540P-KL\SQLEXPRESS
  • To find your PC name:  Right click My Computer -> Properties -> Computer Name tab
  • Login using windows authentication:  Using the user name [Your Domain]/[Your User Name]
SQL Server 2008 Login Settings

SQL Server 2008 Login Settings

Setup User Account

  • In SQL Mgmt Studio -> Expand your local Server -> Security -> Right click on Logins -> New Login
  • Uncheck Enforce password policy, password expiration and user must change pw(Since this is local)
  • Default database -> Your Database
  • User Mapping Page -> Map to your db and grant db_owner role
  • Status Page -> Grant Permission to connect and Enable Login
SQL Server 2008 User Settings Local DB

SQL Server 2008 User Settings Local DB

Setup Access Permissions/Settings for User

  • Right click your Local Server -> Properties -> Security Tab -> Enable SQL Server and Windows Authentication Mode
  • Open SQL Server Configuration Manager -> SQL Server Network Configuration -> Protocols for SQLEXPRESS -> Enable TCP/IP
SQL Server 2008 Server Permissions

SQL Server 2008 Server Permissions

Database Properties File for Spring Project

  • database.url=jdbc:jtds:sqlserver://[local PC Computer name];instance=SQLEXPRESS;DatabaseName=[db name];
  • database.username=[Your user name]
  • database.password=[Your password]
  • database.driverClassName=net.sourceforge.jtds.jdbc.Driver

Thank you and feel free to post any additional questions below.

Chris Anatalio