Get Affordable E-Commerce Solutions With Web Development And Design Companies



If you have any plan to start an e-commerce business, first and foremost thing is that you must have an idea how and from where it must be started and what are the steps needed in order to make it a successful one. E-commerce business success is laid with the websites. Here your websites must be very creative and professional so that it grabs the attention of the target audiences with a glimpse of an eye. Otherwise your customers will move to the other sites available, that their eye catches. So in order to bring them to your particular sites your websites must have the capability to hit the audience’s eye at a glimpse.

If you face any problem you need not have to worry because, for your own benefit Web design and Web development companies are there to help you with affordableecommerce solutions to make your websites more creative and attractive which will lead you to the zenith to attain the best satisfaction. The developers will never let you down, as they have got several years of experiences working with different projects and have the potentiality to solve any problems undertaken by them that will bring maximum benefits or the best outputs to your company. They will deliver their work on time and will satisfy your clients and customers all around. There are many advantages or benefits of hiring these web developers and designers. 

Some of them are-
        It helps You to get direct control over your project
        It will save the cost of staff, equipments and technology and will be very cost effective
        Skilled professionals working with different typical projects
        Risk mitigation
        On time completion of project undertaken by them
        Will provide Technical support to help you throughout your way
        Prompt and direct communication
        Provides highly scalable solutions

Qualities That Helps You To Hire A Best Wordpress Designer

Everybody wants to make their websites outstanding and attractive to attract more visitors online and do the best e-commerce business. But they don’t have any idea how to design their websites and give it a professional look. But for their concern, there are many Wordpress design companies available in today’s market that provides WordPress designers for hire at your own affordable price that you may have never dreamt off.

WordPress is considered as one of the most popular blogging on the internet in today’s world. It is a free open source blogging tool and a content management system based on PHP and MYSQL. It contains features that include plugins and a system of creating templates. It allows one to have a website and a blog at a time. There are many benefits of hiring a Wordpress designer. It brings peace in your mind. You don’t have to worry about which plugins or theme is the best that you must use. Ease of updating an uncomplicated SEO tools. Users can log into your Wordpress site from any computer and even on their smart phones to post new blogs or make website updates. 

There are many qualities and potentialities that a Wordpress designer must possess in them. One must look that if they have the following qualities in them or not before hiring such a designer. The following qualities are listed below-
  • They must have the knowledge of HTML5 and CSS3.They must know how to optimize images and graphics using CSS sprites.
  • Must have the knowledge about Search engine optimization.
  • Must know at what process the company will provide the designers in full time, part time or in hourly basis?
  • At what cost the company will offer them with high quality assurance.
  • Must know to offer Wordpress blog design and customization solutions in a short period of time.
  • Must know the working methodologies and project management techniques followed by Wordpress designers for implementing Wordpress projects.
  • Check out the Wordpress design portfolio of the Wordpress designer. It will help you to get detailed information about his or her experience, knowledge and expertise in WordPress designing.
For More Details, Please visit www.WordPressIndia.in

Making calls from iPhone App

Making calls from iPhone App

This application allows to make call within app , after call completion User can get back to the running application.


// label for "Contact Number"
UILabel *headerLbl = [[UILabel alloc]initWithFrame:CGRectMake(20,105,100,40)];
headerLbl.text = @"Contact # :";
headerLbl.textAlignment = UITextAlignmentCenter;
headerLbl.backgroundColor = [UIColor clearColor];
[self.view addSubview:headerLbl];
[headerLbl release];

compPhoneHead = [[UIButton alloc]initWithFrame:CGRectMake(133,105,146,39)];
UIColor *background_Color = [UIColor colorWithPatternImage:[UIImage imageNamed:@"phoneNoButton.png"]];
compPhoneHead.backgroundColor = background_Color;
[compPhoneHead addTarget:self action:@selector(callAlert) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:compPhoneHead];

compPhone = [[UILabel alloc]initWithFrame:CGRectMake(120,115,193,20)];
compPhone.backgroundColor = [UIColor clearColor];
compPhone.font = [UIFont fontWithName:@"Times New Roman" size:15];
compPhone.text = @"(012)345-6789";
compPhone.textColor = [UIColor blackColor];
compPhone.textAlignment = UITextAlignmentCenter;
[self.view addSubview:compPhone];


Phone Number on screen


Following code is used to implement the Calling functionality.

-(void)callAlert{

alert = [[UIAlertView alloc] initWithTitle:@"Message" message:@"Are you sure to make Call" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"Cancel", nil];
[alert show];
[alert release];
}
// alert view delegate
- (void) alertView:(UIAlertView *)alertV clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 0 && alertV==alert){
[self makeCall];
}
}
// method to make call if “OK” button is clicked on AlertView
-(void)makeCall{

NSLog(@"this is calling phone");
NSString *phoneNumber = [NSString stringWithFormat:@"tel:%@",compPhone.text];
phoneNumber = [phoneNumber stringByReplacingOccurrencesOfString:@"(" withString:@""];
phoneNumber = [phoneNumber stringByReplacingOccurrencesOfString:@") " withString:@"-"];
phoneNumber = [phoneNumber stringByReplacingOccurrencesOfString:@" " withString:@""];
NSURL *phoneUrl = [[NSURL alloc] initWithString:phoneNumber];

Opening an app within another app is managed in iOS through the "url scheme" mechanism. If an app defines an url scheme and this scheme is public, then we can use it to run the app. Basic rule is to first check that the device supports that scheme like we cannot make a phone call on an iPad because the phone app is not supported on iPad). If the scheme is supported then we can call it. This concept is used in making call through app.


// Check If device is able to make a call or not

if([[UIApplication sharedApplication] canOpenURL:phoneUrl]) {
NSURLRequest *phoneRequest = [NSURLRequest requestWithURL:phoneUrl];
UIWebView *phoneWebView = [[UIWebView alloc]init];
[phoneWebView loadRequest:phoneRequest];
} else {

// do something else, e.g. inform the user that he/she cannot open the app
UIAlertView *alerts = [[UIAlertView alloc] initWithTitle:@"Message" message:@"Unable to make Call" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles: nil];
[alerts show];
[alerts release];
}
}

Export Fusion Charts as Images

Export Fusion Charts as Images

For enabling export of chart at client-side, we'll need to assemble the following elements: Note:Here, we assume that you have been able to generate the chart for your page.

⇒ The chart itself embedded using Fusion Charts JavaScript class inside FusionCharts.js.
⇒ Fusion Charts Export Component - This is named FCExporter.swf.
⇒ Fusion Charts Export Component JavaScript class - This JavaScript class is inside js file named FusionChartsExportComponent.js.


1. Including java script class in your page:
<script type="text/javascript" src="js/FusionCharts.js"></script>
<script type="text/javascript" src="js/FusionChartsExportComponent.js"></script>

2. create an instance of the export component in your page using the following JavaScript code:

//Initialize Batch Exporter with DOM Id as fcBatchExporter
var myExportComponent = new FusionChartsExportObject('fcBatchExporter', "swf/FCExporter.swf");
//Add the charts to queue. The charts are referred to by their DOM Id.
myExportComponent.sourceCharts = ['myChartId1'];
//Chenge the message
myExportComponent.componentAttributes.defaultExportFileName = 'Column2D Chart';
//Render the exporter SWF in our DIV fcexpDiv
myExportComponent.Render("fcexpDiv");
myExportComponent.BeginExport();
//Display coverscreen and exporter div
function displayscreen(){
document.getElementById('cover_screen').style.display='block';
document.getElementById('fcexpDiv1').style.display='block';
}


3. Draw the chart and export it:

// apply Cover screen
<div class="cover_screen" style="display:none;" id="cover_screen"></div>
<div id="fcexpDiv1" class="ExportContainer" align="center">
// Div where the export chart is rendered
<div id="fcexpDiv"> Area for FusionCharts Export </div> </div>

//Div where the chart is shown
<div id="chart1div" style="z-index:-15000;" align="center">The chart will appear within this DIV. This text will be replaced by the chart.</div>
// Java Script for chart
<script type="text/javascript">
var myChart1 = new FusionCharts("swf/Column2D.swf", "myChartId1", "350", "300", "0", "1");
var data= "<chart yAxisName='Sales Figure' caption='Top 5 Sales Person' numberPrefix='$'
useRoundEdges='1' bgColor='FFFFFF,FFFFFF' showBorder='0'exportDialogColor='e1f5ff'
exportDialogBorderColor='0372ab' exportDialogFontColor='0372ab'
exportDialogPBColor='0372ab' exportEnabled='1' exportAtClient='1'"
data += "exportHandler='fcBatchExporter'>”
data + = "<set label='Alex' value='25000'/>"
data + = "<set label='Mark' value='35000'/>"
data+= "<set label='David' value='42300'/>"
data+= "<set label='Graham' value='35300'/>"
data+= "<set label='John' value='31300'/>"
data+= "</chart>"
myChart1.addParam("wmode", "opaque");
myChart1.setDataXML(data);
myChart1.render("chart1div");
</script>
<input type="image" src="image/export.gif" id='one' Click="initiateExport();"/>

Chart with export button

capturing the image

Save image

Get contact from the android device

Get contact from the android device

The Contacts Database is divided into 3 tables which are contacts, raw contacts and data.
⇒ Each table contains column (_ID) which is an auto incremented primary key.
⇒ Data table contains all the contact info like phone number, mail id, address etc.
⇒ User cannot add any data into contacts table. The data in this table is populated internally.
⇒ The RawContacts table contains all the actual contact created .Hence we use the raw contacts while retrieve contacts.



Uri uri=RawContacts.CONTENT_URI;
String projection [] = new String[]{ RawContacts.CONTACT_ID,RawContacts.ACCOUNT_TYPE,RawContacts.DISPLAY_NAME_PRIMARY };
Here RawContacts.CONTACT_ID is the id of the row in ContactsContract.Contacts table that this raw Contact belongs to.

Raw contacts are linked to contacts by the aggregation process which can be controlled by AGGREGATION_MODE field.


String selection=RawContacts.ACCOUNT_TYPE+ “=?”;
String selectionArgs[]=new String[]{“any account name which type contact you want to retrieve like for
retrieve Google contacts you have to specify “com.google”};
String sortOrder=ContactsContract.Display_Name;

Now create cursor using these parameters.

Cursor cursor=getContentResolver.query(uri, projection, selection, selectionArgs, sortOrder);
Now all the requested column and their value in cursor now and we can get those value from the cursor like this.
While (cursor.moveToNext()) {
int contactId=cursor.getInt(cursor.getColumnIndex(RawContacts.CONTACT_ID));
String contactName = cursor.getString(cursor.getColumnIndex(RawContacts.DISPLAY_NAME_PRIMARY);
String accountType = cursor.getString(cursor.getColumnIndex(RawContacts.ACCOUNT_TYPE);
}

So now we get only Google contacts but if we put selectionArgs=null then we get all the existing contact of device.


How to get Sim contact details from android device?

⇒ In this we have to take different Uri to get sim contact detail.
⇒ The name of the column where sim contact name and contact number are exists names are “name” and “number”.

Uri uri=Uri.parse (“content://icc/and”);
String projection [] = null;
String selection = null;
String selectionArgs [] = null;
String sortOrder = null;
Cursor simCursor= getContentResolver.query (uri, projection, selection, selectionArgs, sortOrder);
While (simCursor.moveToNext()) {
String simContactName=simCursor.getString(simCursor.getColumnIndex(“name”));
String simContactNumber=simCursor.getString(simCursor.getColumnIndex(“number”));
simContactNumber.replaceAll (“\\D”,””);
simContactNumber.replaceAll (“&”,””);
}
So now we get sim contact number and contact name.

Get Contacts

Get Next or Previous 12 Months in Oracle

Get Next or Previous 12 Months in Oracle using procedure

In oracle to get next or previous 12 months from specified month of year, below is a procedure which accept two parameter year and month name.


CREATE OR REPLACE PROCEDURE dbo.GET_MONTHS(
PERIOD_YEAR IN VARCHAR2,
PERIOD_MONTH IN VARCHAR2
)
AS
MONTH_STR1 VARCHAR2(2000);
MONTH_STR2 VARCHAR2(2000);
V_MONTH_DIGIT NUMBER;
V_PERIOD_YEAR NUMBER;
P_PERIOD_YEAR NUMBER;

BEGIN

SELECT TO_NUMBER(TO_CHAR(TO_DATE(PERIOD_MONTH,'MON'),'MM'),'99')
INTO V_MONTH_DIGIT FROM DUAL;
V_PERIOD_YEAR := TO_CHAR(TO_NUMBER(PERIOD_YEAR,'9999')+1,'9999');
P_PERIOD_YEAR := TO_CHAR(TO_NUMBER(PERIOD_YEAR,'9999')-1,'9999');
FOR LP IN 0..11
LOOP
IF LP<V_MONTH_DIGIT-1 THEN
MONTH_STR2 := MONTH_STR2 || TO_CHAR(ADD_MONTHS('1-JAN-'||PERIOD_YEAR,LP),'MON')||'-'||PERIOD_YEAR||',';
MONTH_STR1 := MONTH_STR1 || TO_CHAR(ADD_MONTHS('1-JAN-'||PERIOD_YEAR,LP),'MON')||'-'||V_PERIOD_YEAR||',';
ELSE
MONTH_STR2 := MONTH_STR2 || TO_CHAR(ADD_MONTHS('1-JAN-'||PERIOD_YEAR,LP),'MON')||'-'||P_PERIOD_YEAR||',';
MONTH_STR1 := MONTH_STR1 || TO_CHAR(ADD_MONTHS('1-JAN-'||PERIOD_YEAR,LP),'MON')||'-'||PERIOD_YEAR||',';
END IF;
END LOOP;

MONTH_STR1 := substr(MONTH_STR1,0,length(MONTH_STR1)-1);
MONTH_STR2 := substr(MONTH_STR2,0,length(MONTH_STR2)-1);

DBMS_OUTPUT.PUT_LINE('Next 12 Months :'||MONTH_STR1);
DBMS_OUTPUT.PUT_LINE('Previous 12 Months :'||MONTH_STR2);
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
WHEN OTHERS THEN
RAISE;

END GET_MONTHS;


Parameters :

PERIOD_YEAR: Year from which we get next or previous year
PERIOD_MONTH: Month from which we get next or previous month
In the procedure firstly we get the passed month in numeric format in local variable V_MONTH_DIGIT. After that we execute a loop for generate months and store in local variables MONTH_STR1 and MONTH_STR2.

To execute procedure: EXEC GET_MONTHS('2007','APR');

Output:

Capturing or Browsing photo Programmatically in iPhone

Capturing or Browsing photo Programmatically in iPhone

Using UIImagePicker Photo Browsing in Application is possible.


UIImageView *empImage = [[UIImageView alloc] init];
UIImage *im = [UIImage imageNamed:@"ImagePlaceholder.png"];
[empImage setImage:im];
empImage.frame = CGRectMake(60, 40, 200, 200);
[self.view addSubview:empImage];

//Choose Image button
UIButton *showImage = [[UIButton alloc]init];
UIImage *Image = [UIImage imageNamed:@"browseButton.png"];
[showImage setBackgroundImage:Image forState:UIControlStateNormal];
[showImage addTarget:self action:@selector(getPhoto:)
showImage.frame = CGRectMake(62,250,96,33); forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:showImage];

//Caputure Image button
UIButton *captureImage = [[UIButton alloc]init];
UIImage *Image1 = [UIImage imageNamed:@"captureButton.png"];
[captureImage setBackgroundImage:Image1 forState:UIControlStateNormal];
[captureImage addTarget:self action:@selector(capturePicture:) forControlEvents:UIControlEventTouchUpInside];
captureImage.frame = CGRectMake(162,250,96,33);
[self.view addSubview:captureImage];

PlaceHolder for Image and browse


Browse button opens the phone gallery where Images are saved.

// method for “showImage” button
-(IBAction) getPhoto:(id) sender {
UIImagePickerController * picker = [[[UIImagePickerController alloc] init]autorelease];
picker.delegate = self;

if((UIButton *) sender == choosePhotoBtn) {
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
} else {
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
}

[self presentModalViewController:picker animated:YES];
}

Browse Image


// method for “captureImage” button
-(IBAction)capturePicture:(id)sender{

if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Message" message:@"Unable to Capture image" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles: nil];
[alert show];
[alert release];
}else{
// if capture image is not supported by the device or Stimaulator
UIImagePickerController* imagePickerController = [[[UIImagePickerController alloc]init]autorelease];
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePickerController.delegate = self;
imagePickerController.allowsEditing = YES;
[self presentModalViewController:imagePickerController animated:YES];
}
}

Capture Button opens iPhone Camera and Stores in Application Directory

// delegate imagePickerController
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissModalViewControllerAnimated:YES];
imageView.image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
}

The UIImagePickerController class manages customizable, system-supplied user interfaces for taking pictures and movies on supported devices, and for choosing saved images and movies for use in your app. An image picker controller manages user interactions and delivers the results of those interactions to a delegate object.

Delegates to be included in .h file : <UIImagePickerControllerDelegate,UIPopoverControllerDelegate> Frameworks required in the Application : UIKit.framework, Foundation.framework, CoreGraphics.framework

Loaded Image

Validations in Struts2

Validations in Struts2

In struts2 we can define validation using xml file. In struts2 for validation rules has classes and all classes implements validator interface.

Struts Action 2 relies on a validation framework provided by XWork to enable the application of input validation rules to your Actions before they are executed. Struts2 Validation Framework allows us to separate the validation logic from actual Java/JSP code, where it can be reviewed and easily modified later.

Validation framework comes with set of useful routines to handle form validation automatically and it can handle both server side as well as client side form validation. If certain validation is not present, you can create your own validation logic by implementing java interface.

  • required
  • requiredstring
  • stringlength
  • int
  • double
  • date
  • email
  • url
  • fieldexpression
  • regex For each rule given, there is an implementation class exist for it as told above.


    Examples:
    required
    For ‘required’ rule the class name is RequiredFieldValidator, for ‘int’ the class name is IntRangeFieldValidator
    If we want to create our own validator class then our class should also implements validator interface. Validator
    interface is given in com.opensymphony.xwork2.validators.*. This rule verify whether user entered value is null
    or not, here we cannot pass any parameters.
    Example:
    <field name="uname">
    <field-validator type="required">
    <message> User name is mandatory </message>
    </field-validator>
    </field>


    requiredstring
    This will validates whether the input entered is a valid string or not we can pass a parameter called trimto this
    rule. Trim will removes extra space from left and right sides of given word.
    Example:
    <field name="uname">
    <field-validator type="requiredstring">
    <param name="true">true</param>
    <message> you must enter string value </message>
    </field-validator>
    </field>

    stringlength
    This rule validates whether the given input is with in the given range of characters or not. This rule is the combination
    of both min, max length rules. To this rule we can pass either both parameters min length and max length or any one of
    the paramenters.
    Example:
    <field name="uname">
    <field-validator type="requiredstring">
    <param name="minLength">8</param>
    <param name="maxLength">12</param>
    <message> user name should be with in ${minLength} and ${maxLength} characters </message>
    </field-validator>
    </field>

    int
    This rule verifies whether the given input value is with in the given range of integer or not, To this rule we need to pass
    min, max parameters.
    Example:
    <field name="uname">
    <field-validator type="int">
    <param name="min">25</param>
    <param name="max">35</param>
    <message>Age should be in between ${min} and ${max} </message>
    </field-validator>
    </field>
    Note: Actually ‘double‘ also same as int, but we need to pass the parameters minInclusive,maxInclusive

    double
    Double field validator check whether given input is double or not .
    fieldName - The field name this validator is validating. Required if using in-Validator Syntax otherwise not required
    minInclusive - the minimum inclusive value in FloatValue format specified by Java language (if none is specified, it will be checked)
    maxInclusive - the maximum inclusive value in FloatValue format specified by Java language (if none is specified, it will be checked)
    minExclusive - the minimum exclusive value in FloatValue format specified by Java language (if none is specified, it will be checked)
    maxExclusive - the maximum exclusive value in FloatValue format specified by Java language (if none is specified, it will be checked)
    Example:
    <validators>
    <!-- Plain Validator Syntax -->
    <validator type="double">
    <param name="fieldName">percentage</param>
    <param name="minInclusive">20.1</param>
    <param name="maxInclusive">50.1</param>
    <message>Age needs to be between ${minInclusive} and MaxInclusive} (inclusive)</message>
    </validator>

    <!-- Field Validator Syntax -->
    <field name="percentage">
    <field-validator type="double">
    <param name="minExclusive">0.123</param>
    <param name="maxExclusive">99.98</param>
    <message>Percentage needs to be between ${minExclusive}
    ${maxExclusive} (exclusive)</message>
    </field-validator>
    </field>
    </validators>


    date
    This will validate whether the given input date is with in the range of the dates or not, we need to pass min,
    max parameters to this rule. When we enter the date values then the format to be followed is dd-mm-yyyy
    Example:
    <field name="dob">
    <field-validator type="date">
    <param name="min">01/01/2011</param>
    <param name="max">01/01/2020</param>
    <message>year should be in between ${min} and ${max} </message>
    </field-validator>
    </field>
    And email, url are simple just like required, we no need to pass any parameters hope you are good.

    fieldexpression
    In struts 1.x, with validator frame work we can do only per field validations, i mean we can validate field by field.
    But here in struts 2.x we can do the between field validations also with this fieldexpression rule. Actually if we want
    to do between fields in struts 1.x, we must do manually but here we can do this via framework validator framework which
    supports both per-field and between filed validations also. To work with this rule we must pass one parameter named
    ‘expression‘ between field means, we can compare the current entered value with any one of above field.
    Example:
    <field name="myDateOfBirth">
    <field-validator type="fieldexpression">
    <param name="expression">
    <! [ CDATA[#myDateOfBirth < #myFatherBirth]] >
    </param>
    <message>Your Birth date must be less then your father dob</message>
    </field-validator>
    </field>
    Note: here #myFatherBirth is other field name
    email
    This rule validates whether the given input in the correct format or not.
    Example:
    <field name="email">
    <field-validator type="requiredstring">
    <message key="errors.required" />
    </field-validator>
    <field-validator type="email">
    <message key="errors.invalid" />
    </field-validator>
    </field>

    url
    This rule validates whether the given input in the correct format or not.
    Example:
    <field name="fblink">
    <field-validator type="url">
    <message>Please enter a valid url</message>
    </field-validator>
    </field>
    regex
    Validates a string field using a regular expression.
    Example:
    <field name="userId">
    <field-validator type="requiredstring">
    <message>Employee Id is a mandatory field</message>
    </field-validator>
    <field-validator type="regex">
    <param name="expression">
    <![CDATA[([E][m][p][0-9][0-9][0-9])]]>
    </param>
    <message>Valid Employee Id required e.g. Emp001</message>
    </field-validator>
    </field>

  • Performance Tuning in DataBase

    Performance Tuning in Oracle

    One point that needs to be made clear is that performance tuning is not an exact science - you can't always predict that a certain tactic or technique will improve performance. Every change has to be tested, because it may improve performance in one area, it may also degrade performance in another area. Adding an index is a classic example of this - it may improve query performance but the performance of inserts and deletes become slower because the index entries also have to be updated.

    You also need to be aware that improving response time is not the only aim that you might have - you might want to reduce memory usage instead - which might mean having to redesign or rewrite some stored procedures. All these issues need to be considered before you start looking at performance.

    Validation framework comes with set of useful routines to handle form validation automatically and it can handle both server side as well as client side form validation. If certain validation is not present, you can create your own validation logic by implementing java interface.

    Causes of Poor Performance

    One cause of poor performance is high Oracle communication overhead. Oracle must process SQL statements one at a time. Another cause of poor performance is inefficient SQL statements. Because SQL is so flexible, you can get the same result using two different statements. Using one statement might be less efficient.


    For example, the following two SELECT statements return the same rows (the name and number of every department having at least one employee):

    EXEC SQL SELECT DNAME, DEPTNO
    FROM DEPT
    WHERE DEPTNO IN (SELECT DEPTNO FROM EMP)
    END-EXEC.

    Contrasted with:

    EXEC SQL SELECT DNAME, DEPTNO
    FROM DEPT
    WHERE EXISTS
    (SELECT DEPTNO FROM EMP WHERE DEPT.DEPTNO = EMP.DEPTNO)
    END-EXEC.

    The first statement is slower because it does a time-consuming full scan of the EMP table for every department number in the DEPT table. Even if the DEPTNO column in EMP is indexed, the index is not used because the subquery lacks a WHERE clause naming DEPTNO.

    Another cause of poor performance is unnecessary parsing and binding. Recall that before executing a SQL statement, Oracle must parse and bind it. Parsing means examining the SQL statement to make sure it follows syntax rules and refers to valid database objects. Binding means associating host variables in the SQL statement with their addresses so that Oracle can read or write their values.

    Automatic Performance Tuning Features

    The Oracle automatic performance tuning features include:

  • Automatic Workload Repository (AWR) collects, processes, and maintains performance statistics for problem detection and self-tuning purposes.
  • Automatic Database Diagnostic Monitor (ADDM) analyzes the information collected by the AWR for possible performance problems with the Oracle database.
  • SQL Tuning Advisor allows a quick and efficient technique for optimizing SQL statements without modifying any statements.
  • SQLAccess Advisor provides advice on materialized views, indexes, and materialized view logs.
  • End to End Application tracing identifies excessive workloads on the system by specific user, service, or application component.
  • Server-generated alerts automatically provide notifications when impending problems are detected.
  • Additional advisors that can be launched from Oracle Enterprise Manager, such as memory advisors to optimize memory for an instance. The memory advisors are commonly used when automatic memory management is not set up for the database. Other advisors are used to optimize mean time to recovery (MTTR), shrinking of segments, and undo tablespace settings. Tuning an Application / Reducing Load

    If your whole application is performing suboptimally, or if you are attempting to reduce the overall CPU or I/O load on the database server, then identifying resource-intensive SQL involves the following steps:

  • Determine which period in the day you would like to examine; typically this is the application's peak processing time.
  • Gather operating system and Oracle statistics at the beginning and end of that period. The minimum of Oracle statistics gathered should be file I/O (V$FILESTAT), system statistics (V$SYSSTAT), and SQL statistics (V$SQLAREA, V$SQL or V$SQLSTATS, V$SQLTEXT, V$SQL_PLAN, and V$SQL_PLAN_ STATISTICS).
  • Using the data collected in step two, identify the SQL statements using the most resources. A good way to identify candidate SQL statements is to query V$SQLSTATS. V$SQLSTATS contains resource usage information for all SQL statements in the shared pool. The data in V$SQLSTATS should be ordered by resource usage. The most common resources are:
  • Buffer gets (V$SQLSTATS.BUFFER_GETS, for high CPU using statements)
  • Disk reads (V$SQLSTATS.DISK_READS, for high I/O statements)
  • Sorts (V$SQLSTATS.SORTS, for many sorts)

    One method to identify which SQL statements are creating the highest load is to compare the resources used by a SQL statement to the total amount of that resource used in the period. For BUFFER_GETS, divide each SQL statement's BUFFER_GETS by the total number of buffer gets during the period. The total number of buffer gets in the system is available in the V$SYSSTAT table, for the statistic session logical reads. Similarly, it is possible to apportion the percentage of disk reads a statement performs out of the total disk reads performed by the system by dividing V$SQL_STATS.DISK_ READS by the value for the V$SYSSTAT statistic physical reads. The SQL sections of the Automatic Workload Repository report include this data, so you do not need to perform the percentage calculations manually.

    After you have identified the candidate SQL statements, the next stage is to gather information that is necessary to examine the statements and tune them.

    If you are most concerned with CPU, then examine the top SQL statements that performed the most BUFFER_GETS during that interval. Otherwise, start with the SQL statement that performed the most DISK_READS.

    Information to Gather During Tuning

    The tuning process begins by determining the structure of the underlying tables and indexes. The information gathered includes the following:

  • Complete SQL text from V$SQLTEXT
  • Structure of the tables referenced in the SQL statement, usually by describing the table in SQL*Plus
  • Definitions of any indexes (columns, column orderings), and whether the indexes are unique or non-unique
  • Optimizer statistics for the segments (including the number of rows each table, selectivity of the index columns), including the date when the segments were last analyzed
  • Definitions of any views referred to in the SQL statement
  • Repeat steps two, three, and four for any tables referenced in the view definitions found in step five
  • Optimizer plan for the SQL statement (either from EXPLAIN PLAN, V$SQL_PLAN, or the TKPROF output)
  • Any previous optimizer plans for that SQL statement

    Note: It is important to generate and review execution plans for all of the key SQL statements in your application. Doing so lets you compare the optimizer execution plans of a SQL statement when the statement performed well to the plan when that the statement is not performing well. Having the comparison, along with information such as changes in data volumes, can assist in identifying the cause of performance degradation.

  • Know the Benefits of Hiring a Magento Developer

    Today in this vast competitive market websites plays a significant role for doing e-commerce businesses to buy and to sell the products online all across the globe. A website must have the capability to grab the audience’s attention. The main success behind a successful website is its visibility, easy to download, user friendly and a complete CMS (Content management system).

    Magento development India has many important features to help and make websites noticeable in an online market. It keeps updated and upgrade and gives a wide e-commerce platform to control the online transaction. This service is very low in cost and the benefits after this is very high in return and it helps to enhance an e-commerce business. With the help of Magento customer relationship services can be performed very easily. It has its many unique features like account creation, customized form and currency conversion. Among the many e-commerce websites Magento have played a significant role and have acquired the top position because of its elasticity, portability and durability.

    If one hire a Magento developer one can get the full benefit out of it. Magento developers have got plenty of experiences to help you throughout the way. They will never put you down infact they will help you to solve out the problems and develop your websites and make it more attractive to attract the target audience. The benefits of hiring a Magento developer are-

    • They maintain the quality throughout the project to ensure faster delivery.
    • Their main focus is on clients requirements to give them the satisfaction.
    • Investment is not required from your end.
    • Dedicated and experienced developers working for you.
    • They work for 24 * 7.
    • Trust worthiness and reliability.
    • They deliver the best work on time under supervision.
    • Technical support and direct communication.
    For More Details Visit  - www.MagentoIndia.com

    iBall Groovy Bluetooth Neckphone With Mic


    Hello Friends,

    Just a little Review on iball Groovy .


    1. Effective range : 10 m
    2. Working Time : 6-7 Hours
    3. Supported Profiles : HSP, HFP, A2DP, AVRCP
    Pairing with device :

    1. Switch on by pressing power button for 5-6 seconds till alternate RED , BLUE LED blinks , which means you are in Pairing Mode
    2. Search from Laptop Bluetooth Devices > Add a Bluetooth Device > My Device is Setup and ready to find 
    3. It will start Bluetooth device search  , select iBall-Groovy 
    4. Select --> Use Passkey Found in Documentation
    5. For iBall-Groovy passkey is 0000 .
    6. Once done , you need to click on Audio Icon at bottom right 
    7. Click on Devices > Independent (R.T.C.) Headphones (IDT High Defination Audio CODEC)
    8. Unmute selected volume and that should work!!!!

    iBall-Groovy Main Pannel

    Playback Interface 


    Blue LED




    • Simple and Slim design 
    • Nice audio quality 
    • Mic works absolutely fine , with clarity
    • affordable price


    I Personally Enjoying iBall Groovy!!!! Your reviews and experience is welcome here , any problems issues it will be nice if all of you can post here, I know this was just a little overview and not a complete analysis

    Best Regards,
    Girish

    Squid Proxy Configuration RHEL5

    Hello Friends,

    Squid is very popular proxy used on Redhat servers , here is little tutorial on configuring sqid , checking squid logs , Hope you will enjoy!

    SQUID Configuration :
    ---------------------------

    1. yum install squid*
    2. vi /etc/squid/squid.conf

    Parameters to configure :
    -----------------------------

    By Default no machine is allowed to connect proxy server except localhost so need to allow access
    to our subnet 192.168.0.0/24 (Need to create acl Step 3)

    1. visible_hostname universe.server.com    # universe.server.com is my Servers Hostname
    2. http_port 192.168.0.60:8080             # My Servers Ip : 192.168.0.60 , Port 8080
    3. acl mylan src 192.168.0.0/255.255.255.0 # mylan is name given to ACL
    4. http_access allow mylan
    5. http_access deny !mylan
    6. Save changes and Exit
    7. service squid start

    On Client :
    ---------------
    1. Open browser
    2. Edit > Preferences > Connection settings > 
    3. Manual Proxy Configuration > Http Proxy > 192.168.0.60 , Port 8080

    Thats it!!!!
    You should be able to browse websites here onwards!!!



    Additional Configuration :
    -------------------------------
    http://www.redhat.com/archives/ext3-users/2010-August/msg00003.html
    1. vi /etc/squid/squid.conf
    2. cache_dir ufs /var/spool/squid 100 16 256 
    Amount of Disk in MB to be used for Caching             : 100
    Number of First  Level cache directories to be created  : 16
    NUmber of Second Level cache directories to be created  : 256

    Default Squid Cache directory  : /var/spool/squid/(16 dirs)/(256 dirs)/(the small files)

    'Level-1' is the number of first-level subdirectories which will be created under the 'Directory'--> The default is 16.
    'Level-2' is the number of second-level subdirectories which will be created under each first-level directory -->  The default is 256.

    Where to check Squid Access Logs ? Who visited XYZ Sites?
    -----------------------------------------------------------
    Log File : /var/log/squid/access.log
    Sample Logs :
    ---------------
    [root@universe squid]# tail -f /var/log/squid/access.log
    1350983287.130   2452 192.168.0.254 TCP_MISS/200 83569 GET http://www.htc.com/managed-assets/images/home-page/marquee/wp-8x-360/blue/wp8_35.png - DIRECT/125.99.127.201 image/png
    1350983287.865   3913 192.168.0.254 TCP_MISS/200 61282 GET http://www.htc.com/managed-assets/images/home-page/marquee/wp-8x-360/blue/wp8_31.png - DIRECT/125.99.127.209 image/png
    1350983288.327   1746 192.168.0.254 TCP_MISS/200 44226 GET http://www.htc.com/managed-assets/images/home-page/marquee/wp-8x-360/blue/wp8_08.png - DIRECT/125.99.127.209 image/png
    1350983290.043   1595 192.168.0.254 TCP_MISS/200 22004 GET http://www.htc.com/managed-assets/images/home-page/marquee/wp-8x-360/blue/wp8_10.png - DIRECT/125.99.127.201 image/png
    1350983290.214   2348 192.168.0.254 TCP_MISS/200 32779 GET http://www.htc.com/managed-assets/images/home-page/marquee/wp-8x-360/blue/wp8_26.png - DIRECT/125.99.127.209 image/png
    1350983290.553   3932 192.168.0.254 TCP_MISS/200 66018 GET http://www.htc.com/managed-assets/images/home-page/marquee/wp-8x-360/blue/wp8_17.png - DIRECT/125.99.127.201 image/png
    1350983291.331    777 192.168.0.254 TCP_MISS/200 830 GET http://metrics.htc.com/b/ss/htcww-en-prod,htcglobal-prod/1/H.25.2T/s3457431454036? - DIRECT/66.235.142.3 image/gif
    1350983291.525   3197 192.168.0.254 TCP_MISS/200 79093 GET http://www.htc.com/managed-assets/images/home-page/marquee/wp-8x-360/blue/wp8_01.png - DIRECT/125.99.127.209 image/png
    1350983292.021   1806 192.168.0.254 TCP_MISS/200 32147 GET http://www.htc.com/managed-assets/images/home-page/marquee/wp-8x-360/blue/wp8_28.png - DIRECT/125.99.127.209 image/png
    1350983292.572   2529 192.168.0.254 TCP_MISS/200 66253 GET http://www.htc.com/managed-assets/images/home-page/marquee/wp-8x-360/blue/wp8_19.png - DIRECT/125.99.127.201 image/png

    Squid Forensics :
    ----------------------
    http://philosecurity.org/2009/04/19/squid-forensics
    Where in cache , file xyz.jpg stored ?
    ------------------------------------------
    grep -r “xyz.jpg” /var/spool/squid/    --> recursively search

    Monitoring and Displaying squid logs in a nice fashion, and may then go deeper with searching and reporting functions --> squidview
    Squidview Tool   : http://www.rillion.net/squidview/
    Sarg tool        : http://sarg.sourceforge.net/sarg.php

    Squidview :
    ---------------
    1. wget http://www.rillion.net/squidview/squidview-0.79.tar.gz
    2. tar -zxvf squidview-0.79.tar.gz
    3. cd squidview-0.79/
    4. ./configure
    5. make
    6. cp Makefile.old Makefile
    7. make oldgcc
    Launch squidview : ./squidview


    Best Regards,
    Girish







     

    Snort Tutorials

    Snort Tutorial :
    -------------------

    3 Basic Modes :
    --------------------
    1. Sniffer Mode
    2. Packet Logger Mode (Logs Packets to disk)
    3. Network Intrusion Detection System (NIDS) , analyze network traffic as per Rules Defined by users.

    Sniffer Mode :
    ------------------
    [root@universe rules]# snort -v
    10/23-16:53:37.964423 192.168.0.104:22 -> 192.168.0.102:51490
    TCP TTL:64 TOS:0x10 ID:9175 IpLen:20 DgmLen:712 DF
    ***AP*** Seq: 0xE9BBEF63  Ack: 0x7C361CE8  Win: 0x4B60  TcpLen: 32
    TCP Options (3) => NOP NOP TS: 2482891 2406025
    =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
    10/23-16:53:37.964504 192.168.0.104:22 -> 192.168.0.102:51490
    TCP TTL:64 TOS:0x10 ID:9176 IpLen:20 DgmLen:360 DF
    ***AP*** Seq: 0xE9BBF1F7  Ack: 0x7C361CE8  Win: 0x4B60  TcpLen: 32
    TCP Options (3) => NOP NOP TS: 2482891 2406025
    =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+


    Display packet data + Headers :
    ---------------------------------
    [root@universe rules]# snort -vd
    =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
    10/23-16:55:25.083474 192.168.0.104:22 -> 192.168.0.102:51490
    TCP TTL:64 TOS:0x10 ID:10322 IpLen:20 DgmLen:168 DF
    ***AP*** Seq: 0xE9C66BA7  Ack: 0x7C364A68  Win: 0x4B60  TcpLen: 32
    TCP Options (3) => NOP NOP TS: 2509669 2416736
    87 45 00 A3 DC 71 91 72 AE 1E 8B B0 A6 A6 2E 56  .E...q.r.......V
    9A 29 BE 45 64 80 28 71 5C 46 02 FF 52 FF 54 8B  .).Ed.(q\F..R.T.
    51 39 5D B0 3E 14 BA 5D 99 27 FA 89 D8 0C DC EC  Q9].>..].'......
    46 5A 27 29 DB DA E4 20 00 3B 93 3A C6 A4 43 A9  FZ')... .;.:..C.
    E9 99 30 EC 69 5B 83 8D 46 9D DF FA C8 93 F9 04  ..0.i[..F.......
    A4 02 28 33 4F CF 2D 15 EB 48 1D 55 C7 17 20 2A  ..(3O.-..H.U.. *
    F3 58 C7 73 EA A5 2D 3F 66 82 64 F3 AE 76 C3 42  .X.s..-?f.d..v.B
    C8 52 A5 88                                      .R..
    =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
    10/23-16:55:25.084084 192.168.0.104:22 -> 192.168.0.102:51490
    TCP TTL:64 TOS:0x10 ID:10323 IpLen:20 DgmLen:120 DF
    ***AP*** Seq: 0xE9C66C1B  Ack: 0x7C364A68  Win: 0x4B60  TcpLen: 32
    TCP Options (3) => NOP NOP TS: 2509669 2416736
    46 18 30 B7 BD 5C A8 16 E8 38 87 49 A7 CA DF 6C  F.0..\...8.I...l
    AD 79 02 5F 17 A5 AF 17 6D 66 F6 E0 1F 3C 5B F9  .y._....mf...<[.
    47 D4 CD 3C 62 03 D6 09 FB B3 B2 F5 4F 10 3C 05  G..34 BA 04 EB 0C EF 2A 7D 79 63 AE 3B AB 22 DE 2E  4.....*}yc.;."..
    CE 79 D1 FB                                      .y..

    =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+

    3 Main Commands :
    --------------------
    snort -v                 --> Headers
    snort -dv                --> Headers + Packet Data
    snort -dev               --> Headers + Packet Data + Data Link Layer
    snort -dev -l ./log      --> -l for specifying Log Directory
    snort -dev -l ./log -h 192.168.0.0/24   --> Log data with specified network range
    snort -dev -l ./log -b  --> Binary mode logging
    snort -dev -r packet.log --> Read packets with -r switch


    Links :
    ----------
    http://seclists.org/snort/2010/q4/533

    How to create own snort Rules :
    --------------------------------------
    SQL Injections are becoming very common attacks on websites , in such cases we can detect attemps on IDS like snort
    We need to find signature for most common SQL Injection Queries
    Ex.
    ' or 1=1--  -->  %27+or+1%3D1--
    Rule for attack :
    --------------------
    alert tcp any any -> any any (content:"%27+or+1%3D1--";msg:"Dude Someone is performing SQL INJECTION";sid:1000003;rev:1;)

    Content = %27+or+1%3D1--
    msg     = Message you want to display
    sid     = Unique ID assigned to this rule
    sid & rev uniquely identify the rule

    Implement Rule in Snort :
    -------------------------------
    1. vi sqlinjection.rules     (I created this file /etc/snort/rules )
    2. alert tcp any any -> any any (content:"%27+or+1%3D1--";msg:"Dude Someone is performing SQL INJECTION";sid:1000003;rev:1;)
    3. Save and Exit
    4. vi /etc/snort/snort.conf
    5. Edit As Below :
       ----------------------------------
       include $RULE_PATH/youtube.rules
       include $RULE_PATH/sqlinjection.rules
       ----------------------------------
       In our case #RULE_PATH = /etc/snort/rules/
    6. Save and Exit

    7. snort -v -i eth0 -l . -c /etc/snort/snort.conf --snaplen 1518 
    -l .             --> Save files in current directory
    -c               --> Snort configuration file
    --snaplen 1518   -->

    8. Execute attack on client machine
     
    Snort Output :
    -----------------
    Action Stats:
         Alerts:            5 (  0.074%)   --> We successfully caught ATTACK!!!
         Logged:            5 (  0.074%)
         Passed:            0 (  0.000%)

    9. Check file alert in current directory
    [root@universe rules]# pwd
    /etc/snort/rules
    [root@universe rules]# cat alert
    [**] [1:1000003:1] Dude Someone is performing SQL INJECTION [**]
    [Priority: 0]
    10/23-20:05:06.145217 192.168.0.101:45670 -> 192.168.0.13:8080
    TCP TTL:64 TOS:0x0 ID:2665 IpLen:20 DgmLen:332 DF
    ***AP*** Seq: 0x6564F124  Ack: 0x28B08D67  Win: 0x2E  TcpLen: 32
    TCP Options (3) => NOP NOP TS: 42526540 5354755
    [**] [1:1000003:1] Dude Someone is performing SQL INJECTION [**]
    [Priority: 0]
    10/23-20:05:06.230814 192.168.0.104:28692 -> 220.226.205.30:80
    TCP TTL:64 TOS:0x0 ID:41431 IpLen:20 DgmLen:260 DF
    ***AP*** Seq: 0x29121933  Ack: 0x43B3A536  Win: 0x2E  TcpLen: 32
    TCP Options (3) => NOP NOP TS: 5354776 23618074

    Now we have All required information about ongoing Attack!!!!


    Why we used --snaplen ??
    ------------------------------
    Command : snort -V
    My Current Snort version : Version 2.9.0.5
    When I use snort without --snaplen option , I was not able to collect alerts , nor any alert file was generated
    With reference to : http://seclists.org/snort/2010/q4/533
    The IPQ and NFQ DAQs had an internal buffer limitation that is fixed in the latest release.




    Will be adding more soon.....

    Best Regards,
    Girish

    Installation Snort IDS for FUN in 2 Minutes

    Hello Friends,


    As a beginner I struggled to run Snort IDS (Intrusion Detection System) on my Personal  RHEL 5 ,

    Its absolutely easy but , was not for me on RHEL 5 especially , due to dependencies.


    Snort Download Link                                 : http://www.snort.org/snort-downloads

    RHEL5, Cent OS 5.5, or Fedora Core 11 : http://www.snort.org/snort-downloads/rhel5/


    My Snort Version : Snort 2.9.0

    Linux Kernel        : 2.6.18-8.el5xen

    Linux OS             : RHEL 5


    I am uploading all required dependencies for snort 2.9.0 here , you need to follow simple steps to install snort in 2 minutes.

    After installation comes gr8 part of IDS World!!!!!

    Soon will be adding snort tutorials!!!

    Best Regards,
    Girish





    Struts2 - Interceptors Introduction

    Interceptors Introduction

    Author: Ashish Garg

    The struts2 framework makes it easy to share certain solutions using an "Interceptor" strategy. When you request a resource that maps to an "action", the framework invokes the Action object. But, before the Action is executed, the invocation can be intercepted by another object. After the Action executes, the invocation could be intercepted again. Unsurprisingly, we call these objects "Interceptors."

    Interceptors can execute code before and after an Action is invoked. Most of the framework's core functionality is implemented as Interceptors. Features like double-submit guards, type conversion, object population, validation, file upload, page preparation, and more, are all implemented with the help of Interceptors. Each and every Interceptor is pluggable, so you can decide exactly which features an Action needs to support.

    Interceptors can be configured on a per-action basis. Your own custom Interceptors can be mixed-and-matched with the Interceptors bundled with the framework. Interceptors "set the stage" for the Action classes, doing much of the "heavy lifting" before the Action executes

    Strtus2 provide some default interceptor but developer can create his own interceptor as per requirement. Below is an configuration of interceptor in struts configuration file.


    <package name="default" extends="struts-default">
    <interceptors>
    <interceptor name="timer" class=".."/>
    <interceptor name="logger" class=".."/>
    </interceptors>
    <action name="login"
    class="tutorial.Login">
    <interceptor-ref name="timer"/>
    <interceptor-ref name="logger"/>
    <result name="input">login.jsp</result>
    <result name="success"
    type="redirectAction">/secure/home</result>
    </action>
    </package>

    User Defined Interceptor



    import com.opensymphony.xwork2.ActionContext;
    import com.opensymphony.xwork2.ActionInvocation;
    import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpSession;
    import org.apache.commons.lang.xwork.StringUtils;
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
    import org.apache.struts2.StrutsStatics;

    /**
    *
    * @author Ashish Garg
    */
    public class LoginInterceptor extends AbstractInterceptor implements StrutsStatics {

    private static final Log log = LogFactory.getLog(LoginInterceptor.class);
    private static final String USER_HANDLE = "USER_ID";
    private static final String LOGIN_ATTEMPT = "loginAttempt";

    @Override
    public void init() {
    log.info("Intializing LoginInterceptor");
    System.out.println("Intializing LoginInterceptor");
    }

    public String intercept(ActionInvocation invocation) throws Exception {

    final ActionContext context = invocation.getInvocationContext();
    HttpServletRequest request = (HttpServletRequest) context.get(HTTP_REQUEST);
    HttpSession session = request.getSession(true);

    // Is there a "user" object stored in the user's HttpSession?
    Object user = session.getAttribute(USER_HANDLE);
    if (user == null) {
    // The user has not logged in yet.

    // Is the user attempting to log in right now?
    String loginAttempt = request.getParameter(LOGIN_ATTEMPT);

    /* The user is attempting to log in. */
    if (!StringUtils.isBlank(loginAttempt)) {
    return invocation.invoke();
    }
    return "login";
    } else {
    return invocation.invoke();
    }
    }
    }

    Struts-Configuration For User Defined Login Interceptor


    <struts>
    <!-- Configuration for the default package. -->
    <package name="default" namespace="/" extends="struts-default">
    <interceptors>
    <interceptor class="com.Garg.Action.LoginInterceptor" name="loginInterceptor">
    </interceptor>
    <interceptor-stack name="loginStack">
    <interceptor-ref name="loginInterceptor"/>
    <interceptor-ref name="defaultStack"/>
    </interceptor-stack>
    </interceptors>
    <default-interceptor-ref name="loginStack"></default-interceptor-ref>
    <global-results>
    <result name="login" type="redirect">Login</result>
    </global-results>
    <action name="Login" class="com.Garg.Action.LoginAction">
    <interceptor-ref name="loginStack"></interceptor-ref>
    <result name="success">/jsp/ViewJSP.jsp</result>
    <result name="input">/jsp/Login.jsp</result>
    </action>
    </package>
    </struts>

    Compass App for iPhone

    Compass App for iPhone

    Free GPS apps are about a dozen in the iPhone app store, but, surprisingly, there aren’t a lot of free iPhone compass apps out there. This Compass App can be very useful and can be integrated with various other applications dealing with Map and Directions to know the current proceeding magnetic direction. Driver related apps can make a best use of it. This app can also be used for fun sake.

    The iPhone Compass app, works like actual magnetic needle compass. Launch the Compass app by tapping its button "Compass Direction", and it shows you the magnetic direction you're facing.


    // code for allocing "Compass Direction" button
    btnCompass= [UIButton buttonWithType:UIButtonTypeRoundedRect];
    [btnCompass setTitle:@"Compass Direction" forState:UIControlStateNormal];
    [btnCompass addTarget:self action:@selector(showCompass) forControlEvents:UIControlEventTouchUpInside];
    btnCompass.frame = CGRectMake(20, 350, 280, 30);
    [self.view addSubview:btnCompass];

    // method to proceed for CompassViewController
    -(void)showCompass{
    NSLog(@"going to call show Compass");
    [UIView beginAnimations:@"View Flip" context:nil];
    [UIView setAnimationDuration:1.0];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
    [UIView setAnimationBeginsFromCurrentState:YES];
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.navigationController.view cache:NO];
    CompassViewController *compassViewController = [[[CompassViewController alloc]initWithNibName:@"CompassViewController" bundle:nil]
    autorelease];
    [self.navigationController pushViewController:compassViewController animated:YES];
    [UIView commitAnimations];
    }

    Compass Button


    In CompassViewController, viewDidLoad accommodates the following code. It makes use of CLLocationManager(and its delegate ) which

    helps to get direction for magnetic needle

    //Compass Image View
    imgCompassView = [[UIImageView alloc]initWithFrame:CGRectMake(20,90,280,280)];
    [imgCompassView setImage:[UIImage imageNamed:@"compassImg.png"]];
    [self.view addSubview:imgCompassView];
    imgCompassView.center = CGPointMake(160, 230);

    //Needle Image View
    imgNeedle = [[UIImageView alloc]initWithFrame:CGRectMake(152,140,16,93)];
    [imgNeedle setImage:[UIImage imageNamed:@"directionArrow.png"]];
    [self.view addSubview:imgNeedle];
    //imgNeedle.center = CGPointMake(160, 230);

    //ManagerLocation
    location_Manager = [[CLLocationManager alloc] init];
    location_Manager.desiredAccuracy = kCLLocationAccuracyBest;
    location_Manager.delegate = self;
    location_Manager.distanceFilter = kCLDistanceFilterNone;
    [location_Manager startUpdatingHeading];

    The needle pointer that shows you where the magnetic direction you're facing.

    CLLocationManagerDelegate:
    /*---------- getting Direction Angle -------------*/
    -(void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading{
    //[location_Manager stopUpdatingHeading];
    NSLog(@"New magnetic heading %f",newHeading.magneticHeading);
    [imgCompassView setTransform:CGAffineTransformMakeRotation(2*M_PI*newHeading.magneticHeading/360)];
    }
    /*----------------- End of above task ----------------*/


    newHeading.magneticHeading co ordinate helps to move the needle pointer.


    Show Compass

    Play sound(wav audio) in Java

    Play sound(wav audio) in Java

    Just for fun or for some application need, java provides functionality to play audio file. This is inbuilt in java and do not need any additional library. Following is simple code to play an wav file in java.


    package play_audio;

    import java.io.File;
    import javax.sound.sampled.AudioFormat;
    import javax.sound.sampled.AudioInputStream;
    import javax.sound.sampled.AudioSystem;
    import javax.sound.sampled.DataLine;
    import javax.sound.sampled.SourceDataLine;

    /**
    *
    * @author Yusata Infotech
    */
    public class play_audio {
    public static void main(String[] args) {

    try {
    System.out.println("Start");
    File f = new File("d://wavs//beep-1.wav");
    AudioInputStream audio = AudioSystem.getAudioInputStream(f);
    AudioFormat format;
    format = audio.getFormat();
    SourceDataLine auline;
    DataLine.Info info = new DataLine.Info(SourceDataLine.class, format);
    auline = (SourceDataLine) AudioSystem.getLine(info);
    auline.open(format);
    auline.start();
    int nBytesRead = 0;
    byte[] abData = new byte[524288];
    while (nBytesRead != -1) {
    nBytesRead = audio.read(abData, 0, abData.length);
    if (nBytesRead >= 0) {
    auline.write(abData, 0, nBytesRead);
    }
    }
    } catch (Exception E) {
    System.out.println(E.getMessage());

    }
    }
    }

    Generate Code128, QRCode, PDF417 Barcode in Java

    Generate Code128, QRCode, PDF417 Barcode in Java:

    A barcode is an optical machine-readable representation of data. The data which it represents, can be get back by machine reading it. Originally barcodes represented data by varying the widths and spacing of parallel lines, and may be referred to as linear or 1D barcode. Today there are number of barcodes used for many a purposes.

    In Java, we may need to generate a barcode for some particular string. The generated barcode can be used for printing labels etc. Following is an example of generating barcode from java using ZXing api of google. It is open source api which can be used for generating barcodes for several types. Following is simple java program to generate various barcode(code128, QRCode and pdf417(Mostly used on drivers license in USA)) using ZXing.


    package barcode;

    import com.google.zxing.BarcodeFormat;
    import com.google.zxing.Writer;
    import com.google.zxing.client.j2se.MatrixToImageWriter;
    import com.google.zxing.common.BitMatrix;
    import com.google.zxing.oned.Code128Writer;
    import com.google.zxing.pdf417.encoder.PDF417Writer;
    import com.google.zxing.qrcode.QRCodeWriter;
    import java.io.File;
    import java.io.FileOutputStream;

    /**
    *
    * @author Yusata Infotech
    */
    public class Barcode {
    public static void main(String[] args) {
    BitMatrix bitMatrix;
    Writer writer = new QRCodeWriter();
    try {
    // Write Barcode
    bitMatrix = new Code128Writer().encode("123456789", BarcodeFormat.CODE_128, 150, 80, null);
    MatrixToImageWriter.writeToStream(bitMatrix, "png", new FileOutputStream(new File("D://code128_123456789.png")));
    System.out.println("Code128 Barcode Generated.");
    // Write QR Code
    bitMatrix = writer.encode("123456789", BarcodeFormat.QR_CODE, 200, 200);
    MatrixToImageWriter.writeToStream(bitMatrix, "png", new FileOutputStream(new File("D://qrcode_123456789.png")));
    System.out.println("QR Code Generated.");
    // Write PDF417
    writer = new PDF417Writer();
    bitMatrix = writer.encode("123456789", BarcodeFormat.PDF_417, 80, 150);
    MatrixToImageWriter.writeToStream(bitMatrix, "png", new FileOutputStream(new File("D://pdf417_123456789.png")));
    System.out.println("PDF417 Code Generated.");
    } catch (Exception e) {
    System.out.println("Exception Found." + e.getMessage());
    }

    }
    }

    QRCode



    Code128



    PDF417

    Download ZXing Library here

    What is Multi Level Marketing (MLM)?



    Rancor Infotech Pvt. Ltd. manages this blog, is the fast progressing Software Development Company. We develop various Softwares which includes MLM Software, Inventory Software, ERP Software and many more. You can contact us at +91-9999671076 and Email ID is info@rancorinfotech.com.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    MLM Software
    Multi-Level-Marketing (MLM)
    MLM or multi level marketing is just another form of network marketing. With a combination of direct selling and franchising, process of multi level marketing comes into practice. During the process of MLM, new members are created in a chain so that they can sell or distribute the products. The chain continues as the members you have recruited recruit other members and the hence the chain goes on. Longer the chain you are having in MLM, better the profits you would be attaining. Members who are linked with the chain of MLM work on the compensation that is earned by selling the products. 

    MLM or multi level marketing is also termed as pyramid marketing. Today, various multinational companies are offering MLM opportunity to people so that they can work and earn as much as they can. MLM business is preferred for use by many professionals who want to earn something extra. MLM has come to people as a business opportunity that will leverage their earning capacity. MLM works on a simple concept of recruiting people and promoting the goods. Once you have recruited people, they come under you as your downlink assistance. Even when doing the recruitments, you have to specify your team members that, they have to promote the products, which are being offered because it is the only way to earn profits. 

    Before joining any MLM business, it is important that you do intense research work on the programs, which are offered by any company so that you are not duped of your hard earned money that you will be investing for being a part of the MLM business network.