Tuesday, January 4, 2011

How to communicate to senior management of the company effectively?

There are many points those need to keep in mind while you are communicating with senior managers.



  1. Most importantly to understand the business and customers of the organization and respect them.

  2. You should be aware about prospective/concerns of the senior manager.

  3. You need to have a much broader focus when communicating with senior management than you would when communicating to rest of employees.

  4. As time plays major factor in communication, as soon as you can communicate your ideas/ problems to managers, you are doing one thing right in order to communicate effectively. Moral : “focus on the most critical things you need to tell a senior manager”.

  5. If you are communicating in writing the gist / intent should be clear enough in first 2-4 lines and if you are communicating verbally then it should be clear with in first few mins say 1 min.

  6. Over communication is major problem among the team members while they communicate to their managers, many senior managers discard the information if it’s too much.

  7. Prepare a list or outlines of the points those you want to make.

  8. Feel free to take your notes with you and refer to them. That just shows you are organized and you have put thought into using your managers' time efficiently.

  9. If they ask you something that you don't have the answer to, don't panic. Just tell them you'll check on it and give them an answer later. It would be better if you can give time bound answers like “I'll give answer in next 1 hr or later today etc..”.

  10. One major problem i have seen that team members don't verify their EMails or messages If they are communicating in writing, So write out your messages / MoMs or e-mail but DON'T SEND IT until you have re-read it and edited it(if required).

  11. Remember that the way you use language reflects your attitudes and your respect for the audience.

  12. Be an effective Listener by understanding the complexities of listening, prepare to listen, Focus on each and every points, delay judgment, establish eye contact with the speaker, take notes effectively and encourage others to talk.

  13. If you are technical person then don't give your judgment very early. Generally people say its not possible, we can't do it, we should not do it, how this task will be done, etc etc.

    Apart from above points YOU MUST UNDERSTAND / RESPECT THE GIVEN DEADLINES BY YOU TO MANAGER or MANAGER TO YOU for the given tasks. Because using these deadlines / timelines your managers plan further activities and business plans.



Sunday, January 2, 2011

How to Install Darwin Streaming Server 5.5 on Ubuntu

Darwin Streaming Server, the open source version of Apple’s QuickTime Streaming Server technology that allows you to send streaming media to clients across the Internet using the industry standard RTP and RTSP protocols. Based on the same code base as QuickTime Streaming Server, Darwin Streaming Server provides a high level of customizability and runs on a variety of platforms allowing you to manipulate the code to fit your needs.

  1. Make sure you have installed libc6-dev, linux-libc-dev, gcc and g++. if not follow the below :

    $ sudo apt-get install libc6-dev linux-libc-dev gcc g++

  2. download the source from

    http://dss.macosforge.org/downloads/DarwinStreamingSrvr5.5.5-Linux.tar.gz

  3. Extract the file

tar xzf DarwinStreamingSrvr5.5.5-Linux.tar.gz

  1. create group and users for this streaming server

sudo addgroup --system qtss

sudo adduser --system --no-create-home --ingroup qtss qtss

  1. If you want to change the password of this user then execute the below command. (Not mandatory)

sudo passwd qtss

  1. Enter to “DarwinStreamingSrvr5.5.5-Linux and type:

    sudo ./Install

  2. To verify access the URL http://localhost:1220/

  3. If Server doesn't respond, Run the DSS web server:

    sudo /usr/local/sbin/streamingadminserver.pl

  4. Now try step (7), you should be able to see the login page:

  5. Login with the admin user name and password, you will see home page, here you can modify your server settings.

  6. To stream the UGC files, you need to hint them using MP4Box.

    Installing MP4Box :

    $ sudo apt-get install gpac

    Exceute the below command

    $ MP4Box -hint

    access the file via rtsp protocol in browser

    rtsp://127.0.0.1:554/

12. Done.

Difference between GSM, GPRS, EDGE, 3G, WCDMA and HSDPA

It's a very basic and non-technical comparison.

GSM

GSM, stands for Global Systems for Mobile Communications, is basic standard bearer of 2G technologies. It is mainly used in mobile communication. Short Messaging System (SMS) was introduced into GSM networks along with capability to download content from various service providers. The content could ring tone, logos and picture messages.

It can support Voice telephony and Data however the Data rate is only 9.6Kb/s, that is very low bit rate for date communication.

GPRS

GPRS, stands for General Packet Radio Service, is used to give higher data speed over GSM. It is not the replacement of GSM. It is just a extension to the older GSM technology to gain faster speed.

Multimedia Messaging System or MMS is the feature of GPRS. It allowed subscribers to send videos, pictures, or sound clips to each other just like text messages. GPRS also provided mobile handset the ability to surf the Internet at dial-up speeds through WAP enabled sites.

GPRS offered higer bit rate ( Up to 171kb/s) by usage of A packet-linked technology over GSM.

EDGE
  • EDGE stands for Enhanced Data Rates for GSM Evolution. This technology, also termed as Enhanced GPRS.
  • This is a technology that uses the same equipment as GSM with only a few minor modifications to provide faster data speeds and is often regarded as a stepping stone towards 3G thus it is called 2.5G.
  • EDGE gives the users the inimitable chance to increase the throughput capacity and the data speed at least 3 to 4 times higher to what GPRS offers.
  • EDGE is a digital mobile phone technology but GPRS is a mobile data service.
  • It is a 3G Radio technology and GPRS or General Packet Radio Service is essentially packet oriented.
3G
  • The introduction of 3G changed a lot of the accepted standards in the mobile phone industry. It allows the use of a greater bandwidth that allows more features to be implemented on it.
  • 3G gives many features like video calls and TV applications because of the speed of 3G which began at 384kbps; well within DSL speeds. Further development on 3G technologies have also created even faster data rate reaching 3.6 and even 7.2Mbps.

  • Existing GSM networks are not compatible with the 3G networks. To keep it, requires a new infrastructure.
  • According to popularity and demand Telecom Operators place 3G towers in those areas.They have to operate 2 radios in particular areas; one for GSM and one for 3G.
  • Mobile phone Users are also required to switch mobile phones in order to take advantage of the new features of 3G.
WCDMA

3G Networks are based on WCDMA i.e. Wideband Code Division Multiple Access, a mobile technology that improves upon the capabilities of current GSM networks.

HSDPA

HSDPA (High Speed Downlink Packet Access) is what is also known as 3.5G, as it offers no substantial upgrade to the feature set of WCDMA, but improves the speed of data transmission to enhance those services.
WCDMA networks provides max 384kbps speed whileHSDPA allowed speeds above 384kbps, the most notable of which is 3.6Mbps and 7.2Mbps.

HSDPA has lower latency times and Fast Packet Scheduling compared to WCDMA.



Friday, November 12, 2010

How to start working with Hibernate

Introduction of Hibernate

Detailed introduction can be found in various good books and tutorials however I am just giving the basic idea about hibernate.

Hibernate is a solution for object relational mapping and a persistence management solution or persistent layer. In other words : Lets assume you have an application with some features containing some business logic and you need to save data in the database. All the business logic resides in Java code which works with Objects, where your database (mysql, postgresql etc...) are not all deal with objects. Hibernate provides a solution to map database tables to a class.


There are few steps to start working with hibernate

1) Basic setup for hibernate
2) Create Database / tables
3) Create POJO for tables
4) Mapping POJO with DB table
5) Hibernate configuration
6) Log4j configs
7) Run the example


Basic setup for Hibernate

a) Install jdk1.5.x/1.6.x, JAVA_HOME and PATH must be set correctly.
b) download and extract zip/tar file of Eclipse IDE (I used Galileo).
c) download the following jars* from http://hibernate.org
ant-1.6.2.jar
ant-antlr-1.6.2.jar
ant-junit-1.6.2.jar
ant-launcher-1.6.2.jar
antlr-2.7.4.jar
ant-swing-1.6.2.jar
asm-3.3.jar
c3p0-0.8.5.jar
cglib-2.2.jar
cleanimports.jar
commons-collections-2.1.1.jar
commons-logging-1.0.4.jar
concurrent-1.3.2.jar
connector.jar
dom4j-1.5.2.jar
ehcache-1.1.jar
ejb3-persistence-3.3.2.Beta1.jar
hibernate-3.2.6.ga.jar
hibernate3.jar
hibernate-annotations-3.4.0.GA.jar
hibernate-commons-annotations-3.1.0.GA.jar
hibernate-core-3.3.0.SP1.jar
hibernate-entitymanager-3.4.0.GA.jar
hibernate-search-3.0.1.GA.jar
hibernate-validator-3.0.0.ga.jar
jaas.jar
jacc-1_0-fr.jar
jaxen-1.1-beta-4.jar
jboss-cache.jar
jboss-common.jar
jboss-jmx.jar
jboss-remoting.jar
jboss-system.jar
jdbc2_0-stdext.jar
jgroups-2.2.7.jar
jta.jar
junit-3.8.1.jar
log4j-1.2.9.jar
mysql-connector-java-3.0.16-ga-bin.jar
mysql-connector-java-3.1.6-bin.jar
oscache-2.1.jar
postgresql-8.2-504.jdbc3.jar
proxool-0.8.3.jar
swarmcache-1.0rc2.jar
versioncheck.jar
xerces-2.6.2.jar
xml-apis.jar

*some are not required e.g. if you are using mysql as your database then postgresql-8.2-504.jdbc3.jar is not required.

Create DB table (Postgres SQL) :

|--------------------------------------------------------------------|

CREATE TABLE "public"."emp" (
id SERIAL,
name text,
dob date
PRIMARY KEY(id)
);
|--------------------------------------------------------------------|

Create POJO Employee

package net.vs.example;

public class Employee {

private Integer id;

private String name;

private Date dob;

public Employee(){

}

public Integer getId() {

return id;

}

public void setId(Integer id) {

this.id = id;

}

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public Date Dob() {

return dob;

}

public void Dob(Date dob) {

this.date = date;

}


Mapping POJO with DB table

You can use XML or annotations to define, how to map your class attributes to a database table.
Create the Employee.hbm.xml in the package net.vs.example and change it to the following

PostgreSQL Version:

xml version="1.0" encoding="UTF-8"?>

DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD

3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >

<hibernate-mapping>

<class name=net.vs.example.Employee table=emp>

<id name="id" column="id">

<generator class="sequence">

<param name="sequence"> emp_id_seq param>

generator>

id>

<property name="name" column = "name"/>

<property name="dob" column="dob" />

class>

hibernate-mapping>



Hibernate configuration

Create a file named “hibernate.cfg.xml” in your root directory
Insert the following in your hibernate file.


PostgreSQL Version:

xml version='1.0' encoding='UTF-8'?>

DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"

"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

<session-factory>

<property name="connection.url">

jdbc:postgresql://localhost:5432/myDB

property>

<property name="connection.username"> myuser property>

<property name="connection.driver_class">org.postgresql.Driverproperty>

<property name="dialect">org.hibernate.dialect.PostgreSQLDialectproperty>

<property name="connection.password">mypwdproperty>


<property name="hibernate.show_sql">trueproperty>

<mapping resource="employee.hbm.xmll" />

session-factory>

hibernate-configuration>


Configuring Log4J

As you can see above we added the log4j library. This library does like a configuration file in thesource directory or it welcomes you with the following error.

log4j:WARN No appenders could be found for logger (TestClient).

log4j:WARN Please initialize the log4j system properly.


Create a file named log4j.properties in the root directory and insert the following:

### direct log messages to stdout ###

log4j.appender.stdout=org.apache.log4j.ConsoleAppender

log4j.appender.stdout.Target=System.out

log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

### set log levels - for more verbose logging change 'info' to 'debug' ###

log4j.rootLogger=debug, stdout

log4j.logger.org.hibernate=info

#log4j.logger.org.hibernate=debug

### log HQL query parser activity

#log4j.logger.org.hibernate.hql.ast.AST=debug

### log just the SQL

log4j.logger.org.hibernate.SQL=debug

### log JDBC bind parameters ###

log4j.logger.org.hibernate.type=info

### log schema export/update ###

log4j.logger.org.hibernate.tool.hbm2ddl=info

### log HQL parse trees

#log4j.logger.org.hibernate.hql=debug

### log cache activity ###

log4j.logger.org.hibernate.cache=info

### log transaction activity

#log4j.logger.org.hibernate.transaction=debug

### log JDBC resource acquisition

#log4j.logger.org.hibernate.jdbc=debug

### enable the following line if you want to track down connection ###

### leakages when using DriverManagerConnectionProvider ###

#log4j.logger.org.hibernate.connection.DriverManagerConnectionProvider=trace



Run the example


TestHibernate.java

public class TestHibernate{

public static void main(String agrs[]) {

Session session = null;
try {

SessionFactory factory = new Configuration().configure().buildSessionFactory();
session = factory.openSession();

Employee emp = new Employee();
emp.setName("John");
emp.setDob(new Date());

session.save(emp);

} catch(Exception be){
be.printStackTrace();
}
finally {
// Actual contact insertion will happen at this step
if (null!=session){
session.flush();
session.close();
}

}

}


Cheers !




Wednesday, August 4, 2010

Life Cycle of a Bean in Spring


Life Cycle of a Bean in Spring

A Spring Bean is managed by IoC Container / Spring Container, whenever a bean is declared in the Spring configuration file, container will find it and do the following steps to make available for the application.

1) Firstly, spring creates an instance of the Bean using Java Reflection API.
2) If there are any properties associated with bean then spring injects those properties. If there are any bean as a peoperty then spring finds that bean and inject it.
3) If the Bean class implements the BeanNameAware interface, then the spring will call setBeanName() method by passing the name of the Bean.
4) If the Bean class implements the BeanFactoryAware interface, then the spring will call setBeanFactory() method by passing an instance of BeanFactory object.
5) If there are any BeanPostProcessors associated with the BeanFactory that loads the Bean, then the spring will call postProcessBeforeInitialization() method before the properties for the Bean are injected.
6) If the Bean class implements the InitializingBean interface, then the spring will call afterPropertiesSet() method once all the Bean properties defined in the Configuration file are injected.
7) If there is any custom init-method declared in the configuration file, that method will be called.
8) If there are any BeanPostProcessors associated with the BeanFactory that loads the Bean, then the spring will call postProcessAfterInitialization() method.
9) Now bean is ready to use.
10) If the Bean class implements the DisposableBean interface, then the spring calls destroy() method when the Application no longer needs the bean reference.
11) If there is any custom destroy-method declared in the configuration file, that method will be called.

Friday, June 25, 2010

Difference between ResultSet TYPE_SCROLL_SENSITIVE and TYPE_SCROLL_INSENSITIVE

Difference between ResultSet TYPE_SCROLL_SENSITIVE and TYPE_SCROLL_INSENSITIVE

If you would like to have a scrollable ResultSet Object then you need to supply constant when you create an object of it. By default it is FORWARD_ONLY, you can traverse forward in order to fetch records from table.

e.g. Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE , ResultSet.CONCUR_READ_ONLY);
Or
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE , ResultSet.CONCUR_READ_ONLY);

Or
Statement stmt = this.con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);

Or
Statement stmt = this.con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);


A result set that is TYPE_SCROLL_INSENSITIVE does not reflect changes made while it is still open and one that is TYPE_SCROLL_SENSITIVE does.
Changes will be visible if result set is closed and re-opened.

TYPE_SCROLL_SENSTIVE does not *guarantee* that all changes made to the result set by others will be visible.It depends on a number of factors including the driver implementation (whether it caches the rows or not), the transaction isolation level etc...

Wednesday, June 2, 2010

Why should use Stored Procedures

In software development its very common to interact with Database(s) and Application Layer used to fetch data from DB using any programming language like java, C# conjunction with SQL.
There are two kind of DB languages
1) SQL : Non procedural language, where you can not write your own logic / subroutines.
2) PL/SQL: Procedural language, where you can write business logic and subroutines.

Stored procedures used where we would require the following
* modular programming at DB level
* Faster execution.
* Reduce network traffic.
* Security mechanism.

Advantages:

->You can modify stored procedures independently of the program source code.The application doesn't have to be recompiled when/if the SQL is altered.
->Stored procedures abstract or separate server-side functions from the client-side.
->Stored procedures allow a lot more flexibility offering capabilities such as conditional logic.
->Stored procedures are stored within the databse and run directly in database engine, bandwidth and execution time are reduced. This is because a single stored procedure can execute a complex set of SQL statements.

Disadvantages:

->If we need to modify anything in stored procedure then its definition has to be replaced.
->Any changes in the stored procedure will impact all the places whereever this procedure is used.

How to create :
http://download.oracle.com/docs/html/B16022_01/ch3.htm
Examples in java:
http://www.oracle.com/technology/sample_code/tech/java/jsp/oracle9ijsp.html