MY mENU


Thursday 31 May 2012

Turn Off Window Animation


You can shut off the animation displayed when you minimize and maximize Windows. Open Registry Editor and go to HKEY_CURRENT_USER\Control panel \Desktop\WindowMetrics. Create a new string value "MinAnimate". Set the value data of 0 for Off or 1 for On

How does the JavaServer Pages technology work?


JSP pages use XML tags and scriptlets written in the Java programming language to encapsulate the logic that generates the content for the page. It passes any formatting (HTML or XML) tags directly back to the response page. In this way, JSP pages separate the page logic from its design and display. JSP technology is part of the Java technology family. JSP pages are compiled into servlets and may call JavaBeans components (beans) or Enterprise JavaBeans components (enterprise beans) to perform processing on the server. As such, JSP technology is a key component in a highly scalable architecture for web-based applications. JSP pages are not restricted to any specific platform or web server. The JSP specification represents a broad spectrum of industry input.

Wednesday 30 May 2012

Add a program to the Right Click Menu So as to Use it Everywhere by just doing a Right-Clicking


When you right click on any folder, you can have access to that application, the same as using Sent To and New. Open Registry Editor. Navigate and choose: HKEY_CLASSES_ROOT\Folder\shell. Add a new Key to the "Shell" Key and name it anything you like. Give it a default value that will appear when you right click a folder, i.e. NewKey (use an "&" without the quotes, in front of any character and it will allow you to use the keyboard). Navigate and click on the registry key HKEY_CLASSES_ROOT\Folder\shell\NewKey. Now you have to add a New Key named Command and Set the (Default) value of the application you want to run. For example: c:\program files\internet explorer\iexplore.exe (Include the full path)

Why do I need JSP technology if I already have servlets?


JSP pages are compiled into servlets, so theoretically you could write servlets to support your web-based applications. However, JSP technology was designed to simplify the process of creating pages by separating web presentation from web content. In many applications, the response sent to the client is a combination of template data and dynamically-generated data. In this situation, it is much easier to work with JSP pages than to do everything with servlets. 

Tuesday 29 May 2012

Create a drive menu for My Computer


Windows XP makes it easy for you to configure My Computer so it works like a menu, with
each drive listed as a menu item. Here's how. Right-click the Start button, and select Properties.Click Customize, which is adjacent to the Start Menu radio button, and select Advanced. Scroll through the Start Menu Items list box until you see My Computer. Select Display As A Menu, and click OK twice. Now, when you select My Computer from the Start menu, you'll see a menu of individual drives. To access the contents of that drive, just select the drive letter from the menu

Formatting date with fmt:formatDate Action


Date and time are important matters in internationalized web applications. Different country has it own way to present date and time in different format. JSP has an action called to allow you to format date and time based on a specificlocale. Here is a table of action attributes. As you can see only value attribute isrequired for action.

Date and time are important matters in internationalized web applications. Different country has it own way to present date and time in different format.  JSP has an action called  to allow you to format date and time based on a specificlocale. Here is a table of action attributes. As you can see only value attribute is required for action.
Attributes
NameMandatoryMeaning
valueyesDate and/or time value to be formatted.
typenoAccept date or/and time to be used to format
dateStylenoSpecify predefined formatted style for date only if date value is used for formatting.
timeStylenoSpecify predefined formatted style for time only if time value is used for formatting.
patternnoSpecify standard customized pattern for formating date and/or time
timeZonenoIf the time value is used to format, this attribute specify time zone for that time value.
varnoThis attribute is for exporting scoped  variable which stores the formatted date and/or time as a string
scopenospecify the scope of var.

Let's take a look at an example of using  action to format date in different locale.
First we use the useBean tag to initialize a scoped variable called now and store current date value into this variable. Then we set the locale to different locales: US and FR and print out the current date in now variable by using  action.

Formatting Date and/or Time

By default format and print only date. If you want to print time or bothdate and time you can use the type attribute. The type attribute accepts date, time and both to allow you to print such a this information in a specific locale. Let's take a look at an example:
Formatting Date Time with predefined styles and custom patterns
You cannot only format and print date & time with predefined styles provided by JSTL but also with a custom pattern. The timeStyle and dateStyle attributes of specify the predefined styles you want to format. Patterns attribute enables you to define your own style. In this case, you need the date & time code table bellow to find exactly what you want to format.
CodeMeaning
GThe era (A.D., B.C., and so on)
yThe year (yy for two-digit years, yyyy for four digits)
MThe month (MM for numeric month, MMM or longer for month names orabbreviations)
wThe week of the year (ww for two digits)
WThe week of the month
DThe day of the year (DDD for three digits)
dThe day of the month (dd for two digits)
FThe numeric day of the week
EThe text day of the week (EEEE or longer for full name)
aAMa.m./PMp.m. indicator
HHour of the day (0–23)
kHour of the day (1–24)
KHour in a.m./p.m. (0–11)
hHour in a.m./p.m. (1–12)
mMinutes in hour
sSeconds in minute
SMilliseconds in second
zFull time zone name
ZRFC 822 time zone (for example, 0500)
Here is an example of using predefined styles and custom pattern to format and print date & time.

Monday 28 May 2012

Change Icons of your Desktop Objects (MyComputer, Recycle bin..)


Go to HKEY_CLASSES_ROOT\CLSID, and look for the CLSID subkey from the table above for
the object whose icon you want to change. Open the subkey and then the DefaultIcon subkey under that. To change the icon for My Computer, open the subkey HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\DefaultIcon.
Change the Default value to the path of the icon that you want displayed. Follow the same
for changing the icons of ther items as well. Exit the Registry. You might have to reboot for
the new settings to take effect. If you aren't able to change your icons still, then try editing the following: HKEY_CURRENT_USER\Software\Microsoft \Windows\CurrentVersion \
Explorer\ CLSID\, and you will be in.

Formatting Number with fmt:formatNumber Action


JSTL provides you the to format number in different forms. If you remember, with the action you can print any number such as integer or floating-point number. But with you have more controls how number is formatted and printed. The most simple basic usage of the action is as follows:

The action accepts any number in the value attribute. It does more than the action that it formats the number based on the locale which specify by the web browser setting in the client side or set by the web application in the server side. Let's take a look at an example of using :
In the above example, first we define a variable and set its value to 200.51. Then we  use action to override the locale of the browser. We set the locale to en_US so when we use the action  to format the number therefore it displays as 200.51 which is USA format. Next we set the locale to fr_FR and print the number again, now it displays as 200,51 which is France format.
Let's take a look at attributes of the in more details:
NameMeaning
valueNumeric value to be formatted.
typeDetermine the value is formatted as number, currency, or percentage.
patternSpecify a custom formatting pattern for the output.
currencyCodeOnly apply for the currency formatting which accepts ISO 4217currency code.
currencySymbolOnly apply for the currency formatting, accepts currency symbol
groupingUsedUsed to define grouping separator for formated number
maxIntegerDigitsSpecify the maximum number of digits in the integer portion of the formatted number in the output.
minIntegerDigitsSpecify the minimum number of digits in the integer portion of the formatted number in the output.
maxFractionDigitsSpecify the maximum number of digits in the fractional portion of the formatted number in the output
minFractionDigitsSpecify the minimum number of digits in the fractional portion of the formatted number in the output.
varThe variable name of the exported scoped variable
scopescope of the var variable

 Printing the percentage

Let's play with the printing percentage value.
In order to print the percentage format, you assign percent to the type attribute of the action.
Printing different currency locale  To print currency, you assign currency to the type attribute and set the locale before outputting the formatted number.
Printing number with a custom pattern Sometimes, you'll need to print number with a specific custom pattern especially number inscientific notation. In these cases, you can define your own pattern and specify it in thepattern attribute of the action. Let's take a look at an example of printing a big number with a scientific pattern:
If you run the above code you will see the number is formatted as the pattern which is46.5637E9 .
There are a lot more cases you'll need to format number and output it on screen. You can refer to the attribute table above to find what you need and exercise with it to get more familiar with different kind number formatting.

Sunday 27 May 2012

Change Text and Baloon Tip Associated With All Desktop Icons


You need to know the object's class ID (CLSID), which uniquely identifies each system object. The following table lists the CLSIDs for common desktop objects. CLSIDs for desktop objects


Desktop object                            CLSID
My Computer                      {20D04FE0-3AEA-1069-A2D8-08002B30309D}
Recycle Bin                         {645FF040-5081-101B-9F08-00AA002F954E}
Microsoft Outlook               {00020D75-0000-0000-C000-000000000046}
Internet Explorer                 {FBF23B42-E3F0-101B-8488-00AA003E56F8}
The Internet                         {3DC7A020-0ACD-11CF-A9BB-00AA004AE837}
My Network Places            {208D2C60-3AEA-1069-A2D7-08002B30309D}
Briefcase                             {85BBD920-42A0-1069-A2E4-08002B30309D}
Dial-Up Networking            {992CFFA0-F557-101A-88EC-00DD010CCC48}


Run the Registry Editor, go to HKEY_CLASSES_ROOT\CLSID, a key that lets you change
characteristics of system objects, and highlight the CLSID whose name or balloon text you want to change. For example, to change My Computer, highlight the subkey HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}. Keep
in mind that HKEY_CLASSES_ROOT\CLSID has many CLSIDs listed under it, so it might
take you a while to find the proper subkey. Once you find the right subkey, if you want to edit the name of the object, open the Default value and type in the text that you want to appear underneath the object. If you want to edit the balloon text for the object, open the InfoTip value and type in the text that you want to appear as balloon text. Once you're done, exit the Registry and reboot.

Working with URL-Related Actions


In web application developmentweb developers usually have to deal with URL manipulation such as importing URL, redirect to another URL...JSTL provides several useful URL-relatedactions to simplify URL manipulation.

The Action

The action is used to define a parameter. It is used inside the body of other actions such as import>. and  actions. the syntax of the action is simple as follows:
You specify the parameter name in the name attribute and its value in the value attribute.

The Action

The action enables you to retrieve the content of an URL and then you canprocess it within JSP page. The syntax of the action is as follows:
The only attribute url is mandatory. The URL could be in absolute or relative form. If it is in relative form, the resource you refer must be inside the web application. Inside the body of the action, you can also has parameter which specify by the action. Let's take a look at an example of using the action:
In the example, we use the action to retrieve the content of an XML file resided in the web application. Then we output the content of the XML file into the textarea. Later on if you learn how to process XML, you can parse this XML content to extract data inside it.

The  Action

 The  simply to redirect the current page to another page or URL. The syntax of the is as follows:
You can put any URL in the url attribute of the action. Let's take a look at an example of using the action:
In the above example, you choose a search engine and click Go button, the page will beredirect to the corresponding URL.
JSTL c:redirect Action Demo

The Action

The  action enables you to format an URL correctly. Inside the action, you can put multiple to construct URL. Here is an example of using the action: 
In the above example, we construct a link:  http://localhost/JSTLDemo/curl.jsp?mode=demo by using c:url action. We use the to define the query string which is mode with the value demo.

Saturday 26 May 2012

create custom expandable list in android.

This example shows how to create custom expandable list in android.
Algorithm:
1.)  Create a new project by File-> New -> Android Project name it CustomExpandableList.
2.)  Run for output.
Steps:
1.) Create a project named CustomExpandableList and set the information as stated in the image.
Build Target: Android 4.0
Application Name: CustomExpandableList
Package Name: com. example. CustomExpandableList
Activity Name: CustomExpandableList
Min SDK Version: 14
2.) Open CustomExpandableList.java file and write following code there:
<strong>packagestrong> com.example.CustomExpandableList;
<strong>importstrong> android.app.ExpandableListActivity;
<strong>importstrong> android.os.Bundle;
<strong>importstrong> android.view.ContextMenu;
<strong>importstrong> android.view.ContextMenu.ContextMenuInfo;
<strong>importstrong> android.view.Gravity;
<strong>importstrong> android.view.MenuItem;
<strong>importstrong> android.view.View;
<strong>importstrong> android.view.ViewGroup;
<strong>importstrong> android.widget.AbsListView;
<strong>importstrong> android.widget.BaseExpandableListAdapter;
<strong>importstrong> android.widget.ExpandableListAdapter;
<strong>importstrong> android.widget.ExpandableListView;
<strong>importstrong>android.widget.ExpandableListView.ExpandableListContextMenuInfo;
<strong>importstrong> android.widget.TextView;
<strong>importstrong> android.widget.Toast;
<strong>publicstrong> <strong>classstrong> CustomExpandableList<strong>extendsstrong> ExpandableListActivity {
ExpandableListAdapter mAdapter;
@Override
<strong>publicstrong> <strong>voidstrong> onCreate(Bundle savedInstanceState){
<strong>superstrong>.onCreate(savedInstanceState);
// Set up our adapter
mAdapter = <strong>newstrong> MyExpandableListAdapter();
setListAdapter(mAdapter);
registerForContextMenu(getExpandableListView());
}
@Override
<strong>publicstrong> <strong>voidstrong> onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
menu.setHeaderTitle("Sample menu");
menu.add(000"Sample action");
}
@Override
<strong>publicstrong> <strong>booleanstrong> onContextItemSelected(MenuItemitem) {
ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo)item.getMenuInfo();
String title = ((TextView) info.targetView).getText().toString();
<strong>intstrong> type =ExpandableListView.<em>getPackedPositionTypeem>(info.packedPosition);
<strong>ifstrong> (type ==ExpandableListView.<em>PACKED_POSITION_TYPE_CHILDem>) {
<strong>intstrong> groupPos =ExpandableListView.<em>getPackedPositionGroupem>(info.packedPosition);
<strong>intstrong> childPos =ExpandableListView.<em>getPackedPositionChildem>(info.packedPosition);
Toast.<em>makeTextem>(<strong>thisstrong>, title + ": Child " + childPos + " clicked in group " + groupPos,
Toast.<em>LENGTH_SHORTem>).show();
<strong>returnstrong> <strong>truestrong>;
} <strong>elsestrong> <strong>ifstrong> (type ==ExpandableListView.<em>PACKED_POSITION_TYPE_GROUPem>) {
<strong>intstrong> groupPos =ExpandableListView.<em>getPackedPositionGroupem>(info.packedPosition);
Toast.<em>makeTextem>(<strong>thisstrong>, title + ": Group " + groupPos + " clicked", Toast.<em>LENGTH_SHORTem>).show();
<strong>returnstrong> <strong>truestrong>;
}
<strong>returnstrong> <strong>falsestrong>;
}
<strong>publicstrong> <strong>classstrong> MyExpandableListAdapter<strong>extendsstrong> BaseExpandableListAdapter {
<strong>privatestrong> String[] groups = { "Android Versions""Android Phones"};
<strong>privatestrong> String[][] children = {
{ "IceCream Sandwitch""Gingerboard""Android 2.0""Android 1.6" },
{ "Razr""Sony Ericsson""Galaxy Tab""Galaxy" }
};
<strong>publicstrong> Object getChild(<strong>intstrong> groupPosition,<strong>intstrong> childPosition) {
<strong>returnstrong> children[groupPosition][childPosition];
}
<strong>publicstrong> <strong>longstrong> getChildId(<strong>intstrong>groupPosition, <strong>intstrong> childPosition) {
<strong>returnstrong> childPosition;
}
<strong>publicstrong> <strong>intstrong>getChildrenCount(<strong>intstrong> groupPosition) {
<strong>returnstrong> children[groupPosition].length;
}
<strong>publicstrong> TextView getGenericView() {
AbsListView.LayoutParams lp = <strong>newstrong> AbsListView.LayoutParams(
ViewGroup.LayoutParams.<em>MATCH_PARENTem>, 64);
&nbsp;
TextView textView = <strong>newstrong>TextView(CustomExpandableList.<strong>thisstrong>);
textView.setLayoutParams(lp);
textView.setGravity(Gravity.<em>CENTER_VERTICALem> | Gravity.<em>LEFTem>);
textView.setPadding(36, 0, 0, 0);
<strong>returnstrong> textView;
}
<strong>publicstrong> View getChildView(<strong>intstrong> groupPosition,<strong>intstrong> childPosition, <strong>booleanstrong> isLastChild,
View convertView, ViewGroup parent) {
TextView textView = getGenericView();
textView.setText(getChild(groupPosition, childPosition).toString());
<strong>returnstrong> textView;
}
<strong>publicstrong> Object getGroup(<strong>intstrong> groupPosition) {
<strong>returnstrong> groups[groupPosition];
}
<strong>publicstrong> <strong>intstrong> getGroupCount() {
<strong>returnstrong> groups.length;
}
<strong>publicstrong> <strong>longstrong> getGroupId(<strong>intstrong>groupPosition) {
<strong>returnstrong> groupPosition;
}
<strong>publicstrong> View getGroupView(<strong>intstrong> groupPosition,<strong>booleanstrong> isExpanded, View convertView,
ViewGroup parent) {
TextView textView = getGenericView();
textView.setText(getGroup(groupPosition).toString());
<strong>returnstrong> textView;
}
<strong>publicstrong> <strong>booleanstrong>isChildSelectable(<strong>intstrong> groupPosition, <strong>intstrong>childPosition) {
<strong>returnstrong> <strong>truestrong>;
}
<strong>publicstrong> <strong>booleanstrong> hasStableIds() {
<strong>returnstrong> <strong>truestrong>;
}
}
}
3.) Compile and build the project.
Output