Wednesday, October 23, 2013

OpenEMM Mail Server Configuration In Unix

After spent lot of time on internet for the mail server configuration on OpenEMM, I found no best approach to follow required steps.

Not to dig-in much. Here I am describing some steps to be followed.

The use of Sendmail is enabled by default in OpenEMM. This should be disabled first.
But before that if your server is running then first stop the same.

1. Change to user openemm with
su - openemm

2. Go to /openemm/bin directory and stop the server
sh openemm.sh stop

3. Disable Sendmail with in the same directory with following command
sh sendmail-disable.sh

4. Go to /openemm/conf directory

5. Create a file with name smart-realy and add content inside that as below.
username:password@smtp.mytestserver.com

6. If your username or password contains "@" special character then you need to modify semu.py file in /openemm/bin/scripts directory.

Just open the file with a text editor and replace character @
with the pipe symbol | in lines 160 and 163 each.

7. Start the server with following command. Go to /openemm/bin directory
sh openemm.sh start

This is it.

Hope this will help you for the configuration to the point.




Tuesday, October 22, 2013

Google Cloud SQL Integration with Google App Engine


One of App Engine’s most requested features has been a simple way to develop traditional database-driven applications. In response to the feedback, google announced the
Google Cloud SQL. There are several advantages after using Google Cloud SQL over other database. Google Cloud SQL brings many benefits to the App Engine community:
  • No maintenance or administration
  • High reliability and availability
  • Familiar MySQL database environment with JDBC support (for Java-based App Engine applications) and DB-API support (for Python-based App Engine applications).
  • Comprehensive user interface for administering databases.
  • Integrated with Google App Engine and other Google services
  • Simple and powerful integration with Google App Engine.
Google Cloud SQL allows you to create, configure, and use MySQL databases that live in Google's cloud. It is a fully-managed service that maintains, manages, and administers your databases. It is primarily intended for programmatic use within applications. It has an interactive UI, which is helpful for learning about the product, getting started using it, investigating the schema, and submitting trial queries.
To setup Google Cloud Storage in your GAE application using JDBC, follow the below mentioned 3 steps:
·         Create a Google Cloud SQL Instance from.
·         Configure the Google Cloud SQL Instance from
·         Connect the Google Cloud SQL Instance
Cloud SQL Data Creation and Ingestion
Google Cloud SQL lets you import existing databases or create them from scratch. You can perform the usual SQL commands to create and drop database tables, and to create, update, and delete rows and data as follows:
·         interactively from the online SQL prompt
·         from the command line with the google_sql tool
·         from App Engine applications
·         programmatically from other applications using JDBC
·         from Apps Script scripts
·         using third-party tools, such as the Squirrel SQL Client
To create and configure an SQL instance you can follow instructions from here and here.

Connect the Google Cloud Instance

To connect to the Google cloud instance, follow the below mentioned guidelines:

/**
    * Method to retrieve the database connection
    *
    * @return
    */    
   public Connection getConnection() {
         String url = null;
         Connection connection = null;
         try {
               if (SystemProperty.environment.value() == SystemProperty.Environment.Value.Production) {
                     logger.info("Trying to establish connection");
                     Class.forName("com.google.cloud.sql.jdbc.Driver");
                     url = "jdbc:google:rdbms://reservosdevbatch:rvdevbatchdb/email_campaign?user=root";
               } else {
                     // Local MySQL instance to use during development.
                     Class.forName("com.mysql.jdbc.Driver");
                     url = "jdbc:mysql://localhost:3306/email_campaign?user=root&password=root";
               }
               connection = (Connection) DriverManager.getConnection(url);
         } catch (Exception e) {
               logger.info("Error while connecting");
               logger.info(e.getLocalizedMessage());
         }
         return connection;

   }
·         Add the MySQL Connector Jar
Manually put mysql-connector-java-5.1.22-bin.jar in your app engine sdk folder: file:///opt/appengine-java-sdk-1.6.0/lib/impl/

·         Enable MySQL Connector/J
The MySQL Connector/J is available in Google App Engine but it's not included in an app unless the app explicitly asks for it. To do that, add a <use-google-connector-j> element to the app's appengine-web.xml file as shown in the following example:
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">

      ...

      <use-google-connector-j>true</use-google-connector-j>
  
   ...

</appengine-web-app>


Happy Clouding!!
That's it! Now you can deploy your application and try it out!

Wednesday, September 18, 2013

Oracle releases JDK 8



JAVA SE 8 JDK Preview build available now
Download JDK 8 preview build from here.

Java Standard Edition 8 (Java SE 8) isn't due until March, but Oracle has just released a preview build for testing by developers. The Developer Preview for JDK (Java Development Kit) 8, known as Milestone 8, was made available on Monday.


The key feature of this release is Project Lambda (JSR-335), which adds closures and related features to the Java language to support programming in multicore environments. Project Lambda comprises lambda expressions, default methods, and method references to the Java programming language, and it extends the libraries to support parallelizable operations upon streamed data.

Project Lambda was one of the biggest features to slip past the Milestone 6 release in January, because of Oracle's focus on the Java-based browser security vulnerabilities that have grabbed headlines over the past two years.

In addition to Project Lambda, Milestone 8 comes with a number of new features, including the new Date and Time API (JSR 310); Compact Profiles, which defines some subset Profiles of the Java SE platform to run on small devices; the Nashorn JavaScript Engine (JSR-223), which aims to allow Java developers to embed JavaScript in Java applications. Reinhold, Chief Architect of the Java Platform also noted the removal of Permanent Generation from the HotSpot virtual machine.

Reinhold says developers have till the end of October to report bugs and problems, saying:
“After that we’ll gradually ramp down the rate of change in order to stabilize the code, so bugs reported later on might not get fixed in time for the GA release.”