Corona | Corona lets developers use integrated Lua, layered on top of Objective-C, to build graphically rich applications that are also lightweight in size and quick in development time. | |
Phone Gap (Adobe) | The mobile framework allows web developers to natively target all smartphone with a single codebase (JavaScript, HTML and CSS) by enabling a Foreign Function Interface (FFI) to an embedded WebView or Webkit on the device. | |
Rhomobile (Motorola Solutions company) | Rhodes is a framework for building native applications that can run on a variety of smartphones. Rhodes uses a Model View Controller pattern. Views are written in HTML | |
Titanium Mobile | Appcelerator Titanium Mobile is a web based application framework solutions allowing web developers to apply existing skills to create native applications for iPhone and Android using the familiar JavaScript syntax. Developers will also have to learn the extensive Titanium API. Wikipedia notes that the term cross-compiler is misleading as the titanium engine interprets the code during run time. |
Thursday, November 10, 2011
Cross Platform Mobile Application Development Framework Comparision Chart
Tuesday, October 11, 2011
Using PHPMailer and Gmail to send email
The code assumes that you have PHP 5.x version and you have class.phpmailer.php file in the include directory.
Google uses ssl for the smtp connection. In order for this example to work with google smtp server, you need to enable ssl in your php.ini file by adding a line that says extension=php_openssl.dll
If you are not sure of the exact location of the php.ini file and you are using xampp, you can find the location of the php.ini file by navigating to http://localhost/xampp/phpinfo.php on your browser and look for the text "Loaded Configuration File". Once you find the file, edit it and look for the text "extension=php_openssl.dll". If the text is not found in your file, add a new line at the end of the file with the above text.
IsSMTP();
$mail->SMTPDebug = 1; // 1 tells it to display SMTP errors and messages, 0 turns off all errors and messages, 2 prints messages only.
$mail->Host = "ssl://smtp.gmail.com"; // specify main and backup server
$mail->Port = 465; // set the port to use
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = 'user@gmail.com'; // replace this with your email acct
$mail->Password = 'userPassword'; // replace this with your password
$mail->From = 'jmeslie@gmail.com';
$mail->FromName = 'Jean Meslie';
$mail->AddAddress('receipient@yahoo.com', 'Receiver');
$mail->AddReplyTo('user@gmail.com'); // Adds a “Reply-to' address. Un-comment this to use it.
$mail->Subject = 'test message';
$mail->Body = 'message body goes here. This message was sent at '. time();
if ($mail->Send() == true) {
echo 'The message has been sent at '. time();
}
else {
echo 'The email message has NOT been sent for some reason. Please try again later.';
echo 'Mailer error: ' . $mail->ErrorInfo;
}
?>
Monday, October 3, 2011
Recreate GRANTS to user in oracle without dba privilege
select replace('GRANT ' || decode(select_priv,'Y','SELECT','') || decode(insert_priv,'A',',INSERT','') || decode(delete_priv,'Y',',DELETE','') || decode(update_priv,'Y',',UPDATE','') || decode(references_priv,'Y',',REFERENCES','') || decode(alter_priv,'Y',',ALTER','') ||' ON '|| owner || '.' || table_name || ' TO ' || GRANTEE ||';','GRANT ,','GRANT ') from TABLE_PRIVILEGES where owner= 'OWNER' order by table_name, grantee;
Tuesday, September 27, 2011
window.onload being used in multiple places within the same application included
Recently one of my team members ran into an issue where we had used
the window.onload to dynamically set some values in a cookie object.
Our application handles multiple javascript files and we had used
window.onload in another jsp also for another reason.
So,when multiple jsp files are trying to add different functions to the window.onload event, only the last function was executing. We developed a workaround by adding the function that chains the onload event functions. Below snippet gives an example of how we solved it.
-
function addLoadEvent(functionName) {
var firstonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = functionName;
}
else {
window.onload = function() {
if (firstonload ) {
firstonload();
}
functionName();
}
}
}
and the actual function definition is in the original jsp and this
function is called from there. So the first time window.onload may
not be a function so we are setting it, On subsequent assignments,
window.onload exists, so whatever it holds will be wrapped up with the
new function. the list grows like that...
Tuesday, June 7, 2011
Struts2 navigate away from error pages
This will also prevent the user from navigating away to a different method in the same action. Sometimes that is not the desired behavior we like. For example, if the user is editing an item and there is a validation error and the user does not want to fix the validation error, however they choose to navigate to a different page on the same action, the workflow interceptor will prevent the user and put them back to the edit page.
If the desired behavior is to let them proceed to to another page, you can exclude those methods in the interceptor configuration similar to the following example.
<interceptor-ref name="defaultLoginStack" >
<param name="validation.excludeMethods">doInput,doList</param>
<param name="workflow.excludeMethods">doInput,doList</param>
</interceptor-ref>
In the above example, if the user tries to access the doList or doInput methods the validation will be skipped and the workflow will allow to continue even if the previous page had errors.
Friday, May 13, 2011
Tomcat Resource Configuration for Oracle Database Connection
However there are situations where the application code is dependent on Oracle database. One such example is when you use Oracle Stored procedures and you need to use Oracle Cursor as on output parameter. In such case you will have to cast the Statement to Oracle specific oracle.jdbc.OracleCallableStatement class to get the cursor.
However if you simply cast the java.sql.CallableStatement to oracle.jdbc.OracleCallableStatement you may notice that you get a class cast exception if you configured your DataSource using the above method.
To overcome the class cast exception, you need to configure the data source using a Oracle specific connection factory. The following example will server that purpose. The text in bold are the changes pertaining to the Oracle connection factory.
<Resource name="jdbc/OracleDS" auth="Container" type="oracle.jdbc.pool.OracleDataSource"
user="DBUser"
password="xxxxxx"
driverClassName="oracle.jdbc.OracleDriver"
factory="oracle.jdbc.pool.OracleDataSourceFactory"
url="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=your.db.host)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=serviceName)))"
maxActive="?"
maxIdle="?"
maxWait="-1"/>
Tuesday, October 5, 2010
spring apache commons configuration
1) Define the properties beans in spring xml file (typically ApplicationConfiguration.xml file)
as follows:
<!-- Apache Commons Configuration Composite configuration -->2) Define a bean with the getter and setter that returns/accepts an array of org.apache.commons.configuration.Configuration class. To make it easier for the rest of the code to get the configuration easy, you may want to add a utility method in there to return the combined Configutaion. Here is an example:
<bean id="configurations"
class="org.springmodules.commons.configuration.CommonsConfigurationFactoryBean">
<property name="configurations">
<list>
<bean class="org.apache.commons.configuration.PropertiesConfiguration">
<constructor-arg type="java.net.URL"
value="classpath:myconfiguration.properties" />
<property name="reloadingStrategy">
<bean class="org.apache.commons.configuration.reloading.FileChangedReloadingStrategy"/>
</property>
</bean>
<bean class="org.apache.commons.configuration.SystemConfiguration"/>
</list>
</property>
<!-- define configuration as a set of spring resources -->
</bean>
<bean id="configuration" class="org.apache.commons.configuration.Configuration" factory-bean="&configurations" factory-method="getConfigurations"/>
private Configuration configs[] ;3) Define the bean properties in the spring xml file. I suggest, that you may want to define the above method in a base class of all your beans and define it as an abstract bean. This will enable you to use the properties in all your beans without having to define the properties in every bean. Here is an example:
private ConfigurationBuilder cfgBuilder ;
public Configuration[] getConfigs() {
return configs;
}
public void setConfigs(Configuration[] configs) {
this.configs = configs;
cfgBuilder = new ConfigurationBuilder();
for (Configuration cgf: configs) {
cfgBuilder.addConfiguration(cgf);
}
}
public Configuration getConfig() {
return cfgBuilder.getConfiguration();
}
<bean id="baseActionBean" class="com.my.company.BaseAction" abstract="true" >4) Add the necessary libraries if you do not have them already. Here is the list of jars you will need.
<property name="configs" ref="configuration" />
</bean>
<bean id="logonClass" class="com.my.company.UsefulAction" parent="baseActionBean">
</bean>
commons-lang-*.jarWith these changes, you should be able to use the properties in your beans with a code as simple as getConfig().getString("propertyKey")
commons-configuration*.jar
spring-modules-jakarta-commons*.jar