LSMW recording vs BDC recording

LSMW RECORDING

  • The LSMW recorder is much simplified when compared to the SHDB recorder:
  • It always start with default options (update mode A, no default size, use BDC mode (SY-BINPT is ‘X’), do not simulate background mode (SY-BATCH is space), and SY-CALLD is set to ‘X’).
  • In LSMW recording, BDC_OKCODE and BDC_CURSOR fields cannot be edited, and you can’t delete or add .
  • We Cannot control the screen flow of a LSMW recording.

BDC RECORDING [SHDB recorder]

  • BDC is mainly for any customized application
  • In BDC recording, BDC_OKCODE and BDC_CURSOR fields can be edited, and you can delete or add .
  • We can control the screen flow of a BDC recording in our program.
  • Can handle in both Direct Input & Batch Input methods.

LSMW recordings can’t be migrated to SHDB recordings and vice versa.

Permanent link to this article: https://blog.openshell.in/2011/03/lsmw-recording-vs-bdc-recording/

Replace Special Characters Using Java

Target Audience: Java Programmers

What should you know already? Basics of Java

Have you ever been tried to replace all special characters in a String? If you had, you may know replace() and replaceAll() methods. Of course, both methods replaces all occurrences of specified strings.

replace() and replaceAll()

See the following examples:

String str=”blaaah”;
str=str.replace(“a”,”one”);

The above code outputs bloneoneoneh.

String str=”blaaah”;
str=str.replaceAll(“a”,”one”);

This also gives output bloneoneoneh. So, what is the difference between replace() and replaceAll() methods? replaceAll() method uses regular expression for searching the replacement portion in the String object. Assume that you are in a situation of replacing all special characters with empty (“”). What will you do? Will you use replace() or replaceAll()? The following code replaces all special characters in a String:

String str=”hai ? i @c / \ ho(w) : are ^ you ??”;
System.out.println(str);
str = str.replaceAll(“[^a-zA-Z 0-9]+”,””);
System.out.println(str);

The above code gives the following output:

hai ? i @c / ho(w) : are ^ you ??
hai i c how are you

What if you try to do this using replace() method? It will not give the result as you expected. Because it deals with String constant, where as replaceAll() deals with Regular Expression.

Regular Expression is very flexible. Suppose you want to replace all special characters other than ( and ), then the code will be:

str = str.replaceAll(“[^a-zA-Z 0-9()]+”,””);

It will give the following output:
hai c ho(w) are you

Of course, your valuable comments and feedback are most welcome.

References

Permanent link to this article: https://blog.openshell.in/2011/03/replacing-special-characters-using-java/

Adding dynamic controls in Asp.net

1.Declare public variables

static DropDownList[] drp_arr;
static int drp_count;

2.Write methods to develop dynamic controls

protected void add_dropdown(DropDownList drp)
{
try
{
//add to a container on the page
pnltitle.Controls.Add(drp);
//add a spacer after the control
pnltitle.Controls.Add(new LiteralControl(“<br><br>”));
}
catch (Exception ex)
{ }
}
private void createdropdown()
{
try
{
for (int i = 0; i < drp_arr.Length; i++)
{
//create a new instance of the control
DropDownList new_drp = new DropDownList();
new_drp.ID = “drp_title” + i.ToString();

new_drp.Items.Add(“Mr”);
new_drp.Items.Add(“Miss”);
new_drp.Items.Add(“Mrs”);

//add dropdown to dropdownarray
drp_arr[drp_count++] = new_drp;
//call our add function
add_dropdown(new_drp);

}
}
catch (Exception ex)
{ }
}

3.In the page_load event type the following code

drp_arr = new DropDownList[2];

{
if (drp_arr.Length > 0)
{
if (drp_arr[0] is DropDownList)
{
//for each DropDownList saved in our array, recreate it
foreach (DropDownList drp in drp_arr)
{
add_dropdown(drp);
}
}

createdropdown();
}
}
catch (Exception ex)
{

}

4. Bulid and run the page

Have a Happy Coding..

Permanent link to this article: https://blog.openshell.in/2011/02/adding-dynamic-controls-in-asp-net/

Excel to MySQL

New working place, new company but still wants to blogging with Openshell. Yes friends, I changed my company to C-DAC, Pune.

Target Audience: DB Administrators, DB Developers, System Integrators

What Should You Know Already? SQL query knowledge

The very first task assigned to me in the new company was to import MS Excel file (.xls or .xlsx) to MySQL table. Usually MS Excel provides many options to import data from other sources like XML or using data source.  Now, the data from excel file has to be exported to a form which MySQL could read and insert into existing relational tables. You can think about .sql file. Usually, MySQL tables can be imported by SQL script (.sql) files. SQL script file contains the DDL and DML queries. But in our case, we need to load the rows of excel file into a table. The Microsoft Excel file can be converted as a delimited file called as .csv (Comma Separated Values), from csv file we can load the data to MySQL relational table.

Excel to CSV

Just open the excel file, choose File -> Save As -> Other formats. (Figure 1.) In the save dialog box under file type choose .csv, give a name. Note that only the current sheet can be saved as .csv file not the entire workbook. Open the .csv file using any simple text editor. You can see the content; each row is delimited by a carriage return (ie. \\r\\n in Windows, \\n in Unix) and each field is separated by a comma.

Figure 1. Save As (other formats)

CSV to MySQL

Once the .csv file is created, now you can use the following command to import into your table. Make sure the target table’s field count is equivalent to .csv file field count.

LOAD DATA INFILE ‘/tmp/filename.csv’ INSERT INTO TABLE [table name] FIELDS TERMINATED BY ‘,’ LINES TERMINATED BY ‘\\n’;

Example:

Assume student_details.xls file contains 4 rows of student details such as registration number, name, address and gender (as shown in Figure 2), that need to be loaded into an existing MySQL table, might be student table.

Figure 2. Student Details Excel Sheet

Save the file as .csv format. Choose File->Save As->Other Formats . Give a name, say students.csv and choose Comma Delimited (.CSV) for save as type as shown in figure 3.

Figure 3. Save student_detail.xls file as students.csv

Open students.csv file in Wordpad, you can see each row including the header ( you can delete the first line of .csv file as it is header) is separated by new line and each field is separated by , (comma).

Now, think about the target table. In my example the following is the struture of student table in MySQL.

Field Field definition
regno int not null primary key auto_increment
name varchar (50)
address tinytext
gender varchar(6)

Assume the students.csv file is saved in My Documents of current user, then the LOAD command will be:

LOAD DATA INFILE ‘C:\\Users\\Administrator\\Documents\\students.csv’ INSERT INTO TABLE student FIELDS TERMINATED BY ‘,’ LINES TERMINATED BY ‘\\n’

If you have any doubts, feel free to send comments or queries. Happy programming.

Downloads

student_details.xls | students.csv

Permanent link to this article: https://blog.openshell.in/2011/02/excel-to-mysql/

The Project Team – Funny Quotes

I Got this Funny Quotes via Forward mail. But it is basically 100% true , even though described in as a funny way.

See:

1. Project Manager is a Person who thinks nine Women can deliver a baby in One month
2. Developer is a Person who thinks it will take 18 months to deliver a Baby.
3. Onsite Coordinator is one who thinks single Woman can deliver nine babies in one month
4. Client is the one who doesn’t know why he wants a baby
5. Marketing Manager is a person who thinks he can deliver a baby even if no man and woman are available
6. Resource Optimization Team thinks they don’t Need a man or woman; They’ll produce a child with zero resources
7. Documentation Team thinks they don’t care whether the child is delivered, they’ll just document 9 months.
8. Quality Auditor is the person who is never happy with the PROCESS to produce a baby and lastly……
9. Tester is a person who always tells his wife that this is not the Right baby

Permanent link to this article: https://blog.openshell.in/2011/02/the-project-team-funny-quotes/

Augmented reality – 6th Sense

Amazing Video

Watch this amazing presentation. It is really Amazing. It has been Presented 2 years before itself.

Permanent link to this article: https://blog.openshell.in/2011/02/augmented-reality-6th-sense/

Warning before navigate away from a page

In some cases, if you are in between any work of editing or typing a content, and you wont let the visitor to navigate away from the page without particular condition, say the document is not saved yet, you can block the navigation (even the closing of the browser window) with Javascript.

Code:

window.onbeforeunload = function (evt) {
var message = ‘Are you sure you want to leave?’;
if (typeof evt == ‘undefined’) {
evt = window.event;
}
if (evt) {
evt.returnValue = message;
}
return message;
}

Permanent link to this article: https://blog.openshell.in/2011/02/warning-before-navigate-away-from-a-page/

jQuery Traversing Tips

Just a quick review of tips available in jQuery to manage nodes (contents) near by the content / node which is triggered an event like click, hover etc

Functions: find, parent, parents, children, first, last, closest

Suppose you need to manage some nodes nearby a link or a button on an event.

Say

$(‘.button’).click(function(){

// code goes here

})

To get the current parent of triggered element, use $(this).parent()

To get the parent which has a class , use:

$(this).parents(‘.classname’);

To find any other element just above the node, use :

$(this).parents(‘.classname’).find(‘li’);

to get the first element in find, use

find(‘li:first’)

and for last, use

find(‘li:last’)

To get exactly the child nodes, use:

$(‘.classname’).children(‘some_selector_here’);

Here comes another very useful function, which is, closest

$(this).closest(‘td’)

Permanent link to this article: https://blog.openshell.in/2011/02/jquery-traversing-tips/

Network Address Translation(NAT) or Port Forwarding

hi dear,

This article is not made for technical person though if you are a network kiddy or if you are searching for a startup on NAT  this article is a good place to start. I assume you might have knowledge of public ip and private ip if not click here.

Network Address Translation(NAT) or Port forwarding is mostly used in small to large companies but it can also be use in home or educational and playing purpose like setup you own home webserver or call server and so on.

nat is a feature which come with atmost all routers and broad band modems even which comes for home internet plan.

Nat is used to show a group of computer(Private ip address LAN) in one single IP address(mostly Public IP address). If you enable nat in your router and if you configure it properly then you can access your computer from your friends computer or office or outer place any where.

If you have your webserver IIS, Apache, XAMP etc(port 80) which runs on 192.168.1.10 private ip address and javaserver Tomcat, glassfish etc(port 8080) which runs on 192.168.1.15 private ip address both can be accessed from outer network on 59.90.100.57 (public ip address ISP will give it for every broad band internet connection). So you can have more than one server service which runs on one ip.

Permanent link to this article: https://blog.openshell.in/2011/02/network-address-translationnat-or-port-forwarding/

IBM DB2 CLP Help System

Target Audience: DB2 Developers

DB2 developers may feel exhausting time when working with CLP when accessing help documents. IBM DB2 enables CLP help reference (like MAN in Unix/Linux).

When SQL query is processed, in case of any failure DB2 returns the error using SQL codes. In CLP interactive mode type the following command to get help reference on SQL Code.

db2> ? sqlxxxx

For example, if the sql state/code is 42701 then, try as follows:

db2> ? sql42701

This command will list out the possible cause of the problem with user actions that could taken place to run query successfully.

Permanent link to this article: https://blog.openshell.in/2011/02/ibm-db2-clp-help-system/