Not Free
Nothing is ever free,
though to you it be.
Somewhere, somehow,
someone paid.
http://www.usmemorialday.org/poetry/notfree2.htm
http://www.flickr.com/photos/branditressler/6925012098/sizes/l/in/photostream/
-o-
Java Reflection – Print all fields in VO / DT class
VO: Value Object Class
DT: Data Transfer Class
Many times we end up writing too lengthy code to print all fields of above classes.
public String toString() {
StringBuffer sb = new StringBuffer();
for (Field field : this.getClass().getDeclaredFields()) {
try {
field.setAccessible(true);
String name = field.getName();
Object value = field.get(this);
sb.append("#").append(name).append("=>").append(value);
} catch (Exception ex) {
ex.printStackTrace();
}
}
return sb.toString();
}
Kids Programming
Scratch is nice Programming language for kids
http://scratch.mit.edu/
The MagPi: a Raspberry Pi community magazine
http://www.themagpi.com/
aeromonas hydrophilia bacteria
If you get cut in a stream, creek, river, or lake in the U.S., you better TELL the hospital to check for aeromonas hydrophilia bacteria. That way, since they won’t think of it, if you tell them first, you might not die.
Courtesy: Took from comments section.
Startup Software Company – Architecture
Problem Statement: Many times startup companies are approaching me to help them to architect their solutions.
Strengths:
1. Good concept with patents and copy rights
2. Experienced management and Marketing
Weakness:
1. Very low investment
2. Lack of technology.
3. No infrastructure.
They expect very fast faced development.
Rapid prototyping.
My suggestions are as follows.
1. Avoid infrastructure issues
Option 1: Go with Amazon
Option 2: Go with any available data centers
2. Use Ubuntu Linux for Development testing.
3. Concentrate on data storage, performance and integrity. (Data Architect / DBAs Work)
4. Keep back end as services. (Don’t build monolithic 500k lines of code and 100 jars)
Also provides easy integration with future UIs and other services.
5. Build UI separately and let it consume services.
6. Choose experienced Solution Architect to orchestrate the end to end solution.
7. Don’t tightly couple with any vendor (Amazon, …etc) specific API.
….I can’t write all hear….contact me for more information….
Web Application Hosting
http://d36cz9buwru1tt.cloudfront.net/architecturecenter/AWS_ac_ra_web_01.pdf
http://aws.amazon.com/architecture/
Option 1: We can move to Amazon and avoid buying all new hardware and internet bandwidth.
Option 2: Learn from Amazon on how they are serving 1000′s of customers without much issues.
Option 3: Planned data center costs must be competitive with Amzon pricing.
http://aws.amazon.com/ec2/#pricing
Monitoring
http://aws.amazon.com/cloudwatch/
Case Studies
http://aws.amazon.com/solutions/case-studies/
Not learning from others is not an excuse for our busy schedules.
We need to spend 10% of our time in research and future planning.
-o-
Oracle deadlock for Delete statement
When analyzing oracle dump
kjxocdr: drop duplicate open [0x1530018][0x362c1],[TX].17 0x0x1b834e988 [held 0][req 3]
kjxocdr: drop duplicate open [0x1530018][0x362c1],[TX].17 0x0x1b834e988 [held 0][req 3]
kjddopr: skip converting lock 0x1d96bf530 dd_cnt 1
user session for deadlock lock 0x1d93e8088
pid=575 serial=63890 audsid=150018868 user: 77/MAS
O/S info: user: abcuser, term: unknown, ospid: 1234, machine: MAS2.abcd.com
program: JDBC Thin Client
application name: JDBC Thin Client, hash value=2546894661
Current SQL Statement:
delete from MAS.table_name where app_name = :1 and lst_updt_ts between :2 and :3
ENQUEUE DUMP REQUEST: from 0.27988 on [0x320020][0x182e1a],[TX] for reason 3 mtype 0
DUMP LOCAL BLOCKER/HOLDER: block level 5 res [0x320020][0x182e1a],[TX]
Solution:
Problem: look at the table description …you can see…INITRANS 2 MAXTRANS 255
We need to increase INITRANS to 100 for better performance. When we have more concurrent sessions, this is important.
http://www.dba-oracle.com/t_initrans.htm
Oracle Finetuning
http://www.dba-oracle.com/art_sql_tune.htm
http://www.orafaq.com/wiki/Oracle_database_Performance_Tuning_FAQ
Java JMX Client
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
import javax.management.MBeanAttributeInfo;
import javax.management.MBeanInfo;
import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
public class JMXClient {
public static void main(String[] args) {
try {
HashMap env = new HashMap();
String[] credentials = new String[] { "userid", "password" };
env.put("jmx.remote.credentials", credentials);
JMXServiceURL url = new JMXServiceURL(
"service:jmx:rmi:///jndi/rmi://server:1234/jmxrmi");
JMXConnector jmxc = JMXConnectorFactory.connect(url, env);
MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();
String domains[] = mbsc.getDomains();
for (int i = 0; i < domains.length; i++) {
System.out.println("Domain[" + i + "] = " + domains[i]);
}
listMBeans(mbsc, "ABC:type=TYPENAME,name=name2");
jmxc.close();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* List all MBeans and their attributes.
*/
public static void listMBeans(MBeanServerConnection server, String path)
throws Exception {
javax.management.ObjectName on = new javax.management.ObjectName(path);
final Set names = server.queryNames(on, null);
for (final Iterator i = names.iterator(); i.hasNext();) {
ObjectName name = (ObjectName) i.next();
System.out.println("Got MBean: " + name);
try {
MBeanInfo info = server.getMBeanInfo((ObjectName) name);
MBeanAttributeInfo[] attrs = info.getAttributes();
if (attrs == null)
continue;
for (int j = 0; j < attrs.length; j++) {
if (attrs[j].isReadable()) {
try {
Object o = server.getAttribute(name, attrs[j]
.getName());
System.out.println("==>" + attrs[j].getName()
+ " = " + o);
} catch (Exception x) {
System.err.println("JmxClient failed to get "
+ attrs[j].getName());
}
}
}
} catch (Exception x) {
System.err.println("JmxClient failed to get MBeanInfo: " + x);
// x.printStackTrace(System.err);
}
}
}
public static void listMBeanAttributes_all(MBeanServerConnection server)
throws IOException {
final Set names = server.queryNames(null, null);
for (final Iterator i = names.iterator(); i.hasNext();) {
ObjectName name = (ObjectName) i.next();
System.out.println("Got MBean: " + name);
try {
MBeanInfo info = server.getMBeanInfo((ObjectName) name);
MBeanAttributeInfo[] attrs = info.getAttributes();
if (attrs == null)
continue;
for (int j = 0; j < attrs.length; j++) {
if (attrs[j].isReadable()) {
try {
Object o = server.getAttribute(name, attrs[j]
.getName());
System.out.println("==>" + attrs[j].getName()
+ " = " + o);
} catch (Exception x) {
System.err.println("JmxClient failed to get "
+ attrs[j].getName());
// x.printStackTrace(System.err);
}
}
}
} catch (Exception x) {
System.err.println("JmxClient failed to get MBeanInfo: " + x);
x.printStackTrace(System.err);
}
}
}
}




