Use of Mobile Phone and its Technology

  • During Emergency

The Emergency Number worldwide for   **Mobile** is 112
If you find   yourself out of coverage area of your mobile network and there is an emergency, dial 112 and the mobile will search any existing network to establish the emergency number for you,  and interestingly this number 112   can be dialed even if the keypad is locked.

  • Car Remote Keys

Have you locked your keys in the car? Does you car have remote keys?
This may come in handy someday. Good reason to own a cell phone:
If you lock your keys in the car and the spare keys are at home, call someone at home on their cell phone from your cell phone. 
Hold your cell phone about a foot from your car door and have the person at your home press the unlock button, holding it near the mobile phone on their end. Your car will unlock.

It really saves someone from driving for keys. Distance is no object. You could be hundreds of miles away, and if you can reach someone who has the other “remote” for your car, you can unlock the doors (or the trunk).

  • Hidden Battery Power

Imagine your cell battery is very low , you are expecting an important call and you don’t have a charger. 
Nokia instrument comes with a reserve battery.

To activate, press the keys *3370#
your cell will restart with   this reserve and the instrument will show a 50% increase in battery.
This reserve will get charged when you charge your cell next time AND…

  • Disable stolen Mobile Phone

To check your Mobile phone’s serial number, key in the following digits on your phone: 
* # 0 6 #

A 15 digit code will appear on the screen. This number is unique to your handset. Write it down and keep it somewhere safe. When your phone gets stolen, you can phone your service provider and give them this code. They will then be able to block your handset so even if the thief changes the SIM card, your phone will be totally useless.
You probably won’t get your phone back, but at least you know that whoever stole it can’t use/sell it either.

  • While using Mobile Phone

When you try to call someone through mobile phone, don’t put your mobile closer to your ears until the recipient answers. Because directly after dialing, the mobile phone would use its maximum signaling power, which is: 2 watts = 33dbi, Plz Be Careful, Message as received (Save your brain) Please use left ear while using cell (mobile), because if you use the right one it will affect brain directly. This is a true fact from Apollo medical team.

Inline Images

Inline images

Inline images are Base64 Encoded Images that appear in HTML as a text. So that no sepearte HTTp request is needed to get the image file. However, it works in IE 6 and 7, there is no use,  as it utilizes the same no of requests as the requests made with images.

 Some urls for Base64 Encoding-

  1.  http://www.motobit.com/util/base64-decoder-encoder.asp
  2. http://www.opinionatedgeek.com/dotnet/tools/Base64Encode/

Sample HTML 

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”><HTML>

<HEAD>

<TITLE> New Document </TITLE>

<link rel=”stylesheet” href=”InlineStyle.css” />

</HEAD>

<BODY>

<div id=”ContentHeader”>

<h2>Table </h2>

</div>

</BODY>

</HTML>

 CSS File

/*–_ANY_STRING_WILL_DO_AS_A_SEPARATORContent-Location:tiltImage

Content-Transfer-Encoding:base64

R0lGODlhBQAQANUAAFKCy1OJy1OLzGyN0mOW0MnX72e91FJ+ymW80myO0vL0+12U0H6b2HaV1VqkzmKy0WGX0WKx0VOHy1SPzFaHzGGaz8vY72Wy1F6vz1+Uz/P2+2Sy0liczlOGy1ymzlWCy16c0FmUzV2dz2Ko01aNzFF5ylJ9ylSRzFOMzFKAy////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAAAALAAAAAAFABAAAAZDQAuhkiksRpcRBLQxbECiByIiCnkwnhCJ4+CQVGBw6UP5lEwdVMeUQp1QqfY77oanBCdByhSYBA4NABIAAxoMCQMKQQA7

*/

 #ContentHeader {min-height: 18px;_height: 18px;margin-bottom: 5px;}

#ContentHeader h2 {float: left;background: url(“data:image/gif;base64,R0lGODlhBQAQANUAAFKCy1OJy1OLzGyN0mOW0MnX72e91FJ+ymW80myO0vL0+12U0H6b2HaV1VqkzmKy0WGX0WKx0VOHy1SPzFaHzGGaz8vY72Wy1F6vz1+Uz/P2+2Sy0liczlOGy1ymzlWCy16c0FmUzV2dz2Ko01aNzFF5ylJ9ylSRzFOMzFKAy////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAAAALAAAAAAFABAAAAZDQAuhkiksRpcRBLQxbECiByIiCnkwnhCJ4+CQVGBw6UP5lEwdVMeUQp1QqfY77oanBCdByhSYBA4NABIAAxoMCQMKQQA7″) no-repeat left top; margin: 0;padding-left: 12px;color: #555;font-size: 16px;

 *background: url(mhtml:http://localhost:8081/CPCex/InlineStyle.css!tiltImage) no-repeat left top; /* IE < 8 */

}

The colored lines are needed for Inline images to work in IE 6 & 7. For an Image to appear in IE 6& 7, it makes a HTTP Request http://localhost:8081/CPCex/InlineStyle.css!tiltImage.

So, the no of HTTP requests remains same in both cases using image file or using Base64 Encoded Image in case of IE 6 & 7.

In other browsers like FireFox, Google Chrome, Safari, IE 8.. Base64 Encoded Image works fine. So it gives frutiful results while applying these Inline Images concept. 

  

 

Using CSS Sprite Images

Using CSS Sprite Images

1. Put all the images into zip file and upload that Zip File in http://spritegen.website-performance.org/

2. It generates a Sprite Image and also Background Position and class  for each image.  Like

.item1 {background-position:0px 0px;}
.item2 {background-position:0px -105px;}
.item3 {background-position:0px -208px;}
.item4 {background-position:0px -312px;}

 3. CSS code looks like

* { margin: 0; padding: 0; }
#nav { width: 400px; margin: 40px auto; }
#nav li {
  list-style-type:none;
 font-size:2em;
}
#nav li a {
 background-image:url(‘../images/Sprite-Image.png’);
 background-repeat:no-repeat;
 padding: 0 0 0 90px;
 display: block;
 height: 72px;
}
.item1 {background-position:0px 0px;}
.item2 {background-position:0px -105px;}
.item3 {background-position:0px -208px;}
.item4 {background-position:0px -312px;}

4. HTML Code

 <ul id=”nav”>
 <li><a href=”Javascript:item1();” title=”Some Link 1″>Item 1</a></li>
 <li><a href=”Javascript:item2();” title=”Some Link 2″>Item 2</a></li>
 <li><a href=”#” title=”Some Link 3″>Item 3</a></li>
 <li><a href=”#” title=”Some Link 4″>Item 4</a></li>
 </ul>

5. JavaScript Code

function item1(){
alert(“Item 1…..”);
}

function item2(){
alert(“Item 2…..”);
}

General HTML Stuffs

These are just handy codes      

  •  Tabs in Html

    

<div>
   <ul>
    <li id=”tabOn0″ style=”display:block;”> <a href=”#” onFocus=”blur();” >예상PRA 11111</a> </li>
    <li id=”tabOff0″ style=”display:none;”> <a href=”#” onFocus=”blur();” onClick=”tabControl(0, 3)”>예상PRA</a> </li>
    <!–2–>
    <li id=”tabOn1″ style=”display:none;”> <a href=”#” onFocus=”blur();”>사유구분</a> </li>
    <li id=”tabOff1″ style=”display:block;”> <a href=”#” onFocus=”blur();” onClick=”tabControl(1, 3)”>사유구분</a> </li>
    <!–3–>
    <li id=”tabOn2″ style=”display:none;”> <a href=”#” onFocus=”blur();”>상세사유</a> </li>
    <li id=”tabOff2″ style=”display:block;”> <a href=”#” onFocus=”blur();” onClick=”tabControl(2, 3)”>상세사유 </a> </li>    
   </ul>
  </div>
  The contents that appears in each tab
  <div id=”tabContents0″  style=”display:block;”>
   <div>달력 넣어주세요.~ </div>
  </div> 
     

  <div id=”tabContents1″  style=”display:none;”>
   <table>
    <col width=”90″ />
    <col width=”*” />
    <tr>
     <th rowspan=”2″ >사유구분</th>
     <td><select name=”select”>
       <option value=”">전체</option>
      </select>
     </td>
    </tr>
    <tr>
     <td><select name=”select2″>
       <option value=”">전체</option>
      </select>
     </td>
    </tr>
   </table>
  </div>   <div id=”tabContents2″  style=”display:none;”>
   <td ><div>
     <textarea name=” ” style=”height:50px;”></textarea>
    </div></td>
  </div>  
 Here is the javascript      

function tabControl(tabNumber, maxNumber){
 for(i=0; i<maxNumber; i++){
   if(i == tabNumber){
    eval(‘tabOn’+i).style.display = ‘block’;
    eval(‘tabOff’+i).style.display = ‘none’;
    eval(‘tabContents’+i).style.display = ‘block’;
   }else{
    eval(‘tabOn’+i).style.display = ‘none’;
    eval(‘tabOff’+i).style.display = ‘block’;
    eval(‘tabContents’+i).style.display = ‘none’;
   }
  }
 }     

Here is the image      

Tabs in Html

  • Table inside table with scroll bars using Html

 <table>
 <col width=”30%” />
 <col width=”*” />
 <tr> – only one outer TR
 <td> – TD for Table 1
  <table> – we define the table inside this TD
   <col width=”25″ />
   <col width=”*” />
   <col width=”*” />
  <thead>
  <tr>
  <th><input type=”checkbox” /></th>
  <th>Heading 1</th>
  <th>Heading 2</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td><input type=”checkbox” /></td>
  <td >test 11</td>
  <td>test 2 <a href=”#”></a></td>
  </tr>
  </tbody>
  </table>
 </td>
  <td> – TD for Table 2
   <div>
   <table style=”width: 2300px;”> – we define the table inside this TD
    <colgroup>
    <col width=”5%”  />
    <col width=”5%” />
    <col width=”5%” />
    <col width=”5%” />
    <col width=”4%” />
    <col width=”5%” />
    <col width=”5%” />
    <col width=”5%” />
    <col width=”*” />    
    </colgroup>
    <tr>
     <th>Heading 3</th>
     <th>Heading 4</th>
     <th>Heading 5</th>
     <th>Heading 6</th>
     <th>Heading 7</th>
     <th>Dead Line</th>
     <th>Heading 8</th>
     <th>Heading 9 </th>
     <th>Heading 10</th>        
    </tr>
    <tr>
     <td>EUR</td>
     <td>P103</td>
     <td>48W
      (09.11.12)</td>
     <td>48W
      (09.11.12)</td>
     <td>N</td>
     <td>48W
      (09.11.12)</td>
     <td>48W
      (09.11.12)</td>
     <td><select name=”select4″> – Combo box inside the table
       <option value=”"></option>
       <option value=”"></option>
       <option value=”"></option>
      </select>
      <br />
      <select name=”select5″ style=”margin-top:5px;”>
       <option value=”"></option>
       <option value=”"></option>
       <option value=”"></option>
      </select>
     </td>
     <td><div>
       <textarea name=” ” style=”height:50px;”></textarea>
      </div></td>     
    </tr>
    <tr>
     <td>12</td>
     <td>rt</td>
     <td>ty</td>
     <td>sdfg</td>
     <td>dfg</td>
     <td>j546</td>
     <td>ghh</td>
     <td>56</td>
     <td>gh</td>     
    </tr>     
   </table>
   </div>
  </td>
 </tr>
</table>
  

  Here is the code for CSS     

.colui-fixedgrid .each {padding: 0;}
.colui-fixedgrid .colui-fixed {padding-bottom: 20px;vertical-align: top;}
.colui-fixedgrid .colui-fixed .hasrow2 {height: 45px;}
.hasrow3 {height:77px;padding: 0;}
.hasrow4{height:104px;padding: 0;}
.colui-fixedgrid .colui-rest-sup {_width: 100%;overflow: auto;overflow-y: hidden;padding-bottom: 20px;}
.colui-fixedgrid td {overflow: hidden;text-overflow: ellipsis;white-space: nowrap;}
   

Here is the image that shows the output.   

     

     

 

Datagrid with ComboBox, Radio Button and Popup

I googled out and could find hardly few examples in the area of embedding Radio Button Group inside Data grid.

So i thought let me share this with web friends.

This Flex control has following advantages

1. Radio Button Group inside Datagrid ( No need to write ItemRenderers )

2. Combo Box inside datagrid

3. Copy and Paste a row ( using Ctrl+C and Ctrl+V)

Radio Button inside Datagrid

Inside the data grid column, we have embedded our radio button as shown below

<mx:DataGridColumn dataField=”Economy” rendererIsEditor=”true”  editorDataField=”selected” width=”350″>
    <mx:itemRenderer >
       <mx:Component>
        <mx:HBox horizontalAlign=”center”>
                <mx:RadioButtonGroup id=”rg” />
             <mx:RadioButton label=”Developed” groupName=”rg” value=”Developed” selected=”{‘Developed’ == data.Economy}” click=”checkRadioHandler(event)” />
             <mx:RadioButton label=”Developing” groupName=”rg” value=”Developing” selected=”{‘Developing’ == data.Economy}” click=”checkRadioHandler(event)”/>     
             <mx:RadioButton label=”Under Developing” groupName=”rg” value=”Under Developing” selected=”{‘Under Developing’ == data.Economy}” click=”checkRadioHandler(event)”/>
        </mx:HBox>
           </mx:Component>
    </mx:itemRenderer>
   </mx:DataGridColumn>

Once we select any of the Radio Button, it has to update our Data Source. In order to do that, we have to use this code

<mx:Script>
         <![CDATA[
          import mx.controls.Alert;
             private function checkRadioHandler(event:Event):void {
                  var outObj:Object = event.currentTarget.parent.outerDocument;
                  var idx:uint = outObj.advDG.selectedIndex;
                  //Alert.show(" Radio button value = " + event.currentTarget.value);
                  outObj.orgData[idx].Economy = event.currentTarget.value;   
                  //outObj. = event.currentTarget.value;                   
              }
         ]]>
</mx:Script>

Combo Box inside Datagrid

Similar to Radio Button, we are using a simple way to embed Combo Box inside our Datagrid

<mx:DataGridColumn dataField=”Climate”  rendererIsEditor=”true” editorDataField=”value”>
           <mx:itemRenderer>
                <mx:Component >
                <mx:VBox horizontalAlign=”center”> 
                  <mx:ComboBox change=”data.Climate = test.selectedItem” creationComplete=”getClimateData()” id=”test”
                 dataProvider=”{outerDocument.openClimateData}”  prompt=”Select” />
                 </mx:VBox>
                </mx:Component>
           </mx:itemRenderer>
        </mx:DataGridColumn>
See the Demo

Here in , if we select a value in our drop down, we have to update our Data Source to reflect this change.

<mx:Script>
      <![CDATA[
      import mx.controls.Alert;
      import mx.collections.ArrayCollection;
      private function getClimateData():void {
       //Alert.show(" inside Script Climate = " + data.Country);
       //Alert.show(" inside Script Climate = " + data.Climate);
       
       for (var i:int=0;i<test.dataProvider.length;i++){
        var item:String = test.dataProvider[i];
        if (data.Climate != null) {
        if(item == data.Climate){
        test.selectedIndex = i;
        break;
          }
        } else {
        break;
        }
       }
       }       
       ]]>
     </mx:Script>

Copy and paste


Copy a row using Ctrl+C and pasting a row using Ctrl+V inside datagrid. To enable this we have to use KeyboardEvent

 See the Demo

Download Source Code

Master Check Box

Many new HTML or JavaScript guys may look for this option often. And ofcourse even I stare this often for my development.

Its just a simple and easy code but so helpful to many.

Here we go…..

In a html, we often use tables or datagrids to display search results.. and etc.. and almost every time we use check box for selectiong the rows.

Many guys would have come across a scenario where, a master check box present in the column header and on select of that, all the check boxs in that column  should be selected.

we have master check box in the Column Header

<input type=”CheckBox” name=”SelectAllCheckBox” onclick=”SelectAll(this)”>

So, on click of this check box ,  it goes to a Javascript Function

function SelectAll(SelectAllCheckBox){
 var form1 = document.TiMakeSingleMailForm;

 if(form1.elements.SelectAllCheckBox.checked == true){

  for( var i=0; i< form1.elements.length; i++){

   var ele = form1.elements[i];
   if(ele.name == ‘checkBoxList’){
    form1.elements[i].checked = true;    
   }
  }     
 }else{

  for( var i=0; i< form1.elements.length; i++){
   var ele = form1.elements[i];
   if(ele.name == ‘checkBoxList’){
   form1.elements[i].checked = false;    
   }
  }
 }
}

This “checkBoxList” is the name of TD

Applications using JavaScript Client API

Two Instances of Tomcat in Single System

I was thinking initially that , is it possible to have 2 instances of Tomcat in your single Computer/Domain.

Hurray!!!! Oh Yes !!.. its possible ..

On searching a lot I found a beautiful document which clearly guide us through the successful installation of 2 Tomcat instances in Single System.

A week after I did it successfully, my friend had got a same requirement.  So i thought just to share this doc to my web friends :)

Here we go..

Editing the registry is risky! If you’re unsure or can’t live with the consequences, don’t do it. And remember, ALWAYS BACKUP! your registry.

The instructions below are for Tomcat 5.0 which is installed as service on a Windows [XP] machine.

To begin with, these are the keys that are created by the Tomcat installer in the registry; you’ll need to modify them. I’ll refer to them by their numbers in the steps.

Registry Keys

I.  HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tomcat5

II. HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Procrun 2.0\Tomcat5

III. HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Tomcat\5.0

IV. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows \CurrentVersion\Run

V. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows \CurrentVersion\Uninstall\Apache Tomcat 5.0

VI. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum \Root\LEGACY_TOMCAT5

  1. Install your first instance of Tomcat to, say, C:\Tomcat5
  2. Check its starting and test it by localhost:8080 as this is the default port.
  3. Start > Run > regedit > [ENTER] will bring up the registry editor for u.
  4. Navigate to Key I and rename the folder from [...]Tomcat5 to, say, [...]Tomcat5_1. This will ensure the next install will not overwrite this key.
  5. In the right pane; modify DisplayName from Apache Tomcat to, say, Apache Tomcat_1. This is to know which service is earlier and which is later, in the Services console
  6. In the right pane; modify ImagePath from “…\bin\tomcat5.exe” //RS//Tomcat5 to “..\bin\tomcat5.exe” //RS//Tomcat5_1
  7. The Enum key under Key I has a value 0 which points to Key VI. Change the data to reflect the change in the key name that you’ll be making later i.e. modify Root\LEGACY_TOMCAT6000 to Root\LEGACY_TOMCAT6_1000 ( But this step can be avoided if you can’t find this entry or can’t modify this entry)
  8. Navigate to Key II and rename the folder; from [...]Tomcat5 to [...]Tomcat5_1. Again, this is to avoid overwriting when installing the second service.
  9. Similarly, modify Key III from [...]5.0 to [...]5.0_1. Same reason as above
  10. Navigate to Key IV and modify the value (not the value’s data) from ApacheTomcatMonitor to ApacheTomcatMonitor_1. This key is for the monitor application; ( This can be avoided if you  don’t have ApacheMonitor)
  11. If you want to uninstall both the instances of Tomcat later (recommended!), you need to modify Key V and rename it from [...]Apache Tomcat 5.0 to [...]Apache Tomcat 5.0_1.
  12. Restart your system now for the changes to take effect.
  13. Be sure that your current install is working as expected by starting your Tomcat Service and checking http://localhost:8080/
  14. Now its time to install the second instance of your Tomcat. During installation. install to say C:\Tomcat5_2 and change port to 8081.
  15. Before you start the second service, you need to change the ports since otherwise it’s going to start with exactly the same ones as your first service and throw exceptions and quit. You need to change the HTTP and SHUTDOWN listen ports at least. If either of these is the same or bound to some other process, Tomcat will not start.
  16. So, Go to $CATALINA_HOME\conf\server.xml ($CATALINA_HOME refers to the Tomcat install directory)
    •  Modify the value for <Server port=”8005″ shutdown=”SHUTDOWN”> to <Server port=”8006”
  17.  Restart your system and the two instances of Tomcat services should start up with no issues.

2 instance of tomcat

Calendar Control in Flex

Its  a Calendar Control developed in Adobe Flex 3.

This control,  both  Weekends and Holidays are selectable and they appear in different color as well.

The very first control which I did was Calendar Control using Flex 3.  It was really hard to make Weekends and holidays in different colors and also selectable.

Initially I tried to make weekends as differnt color using the property disabledDays in DateChooser . Using disabledDays[0,6]  and setting the style for that property we can make weekends to appear in different color. Now its done with Weekend to appear in differnt color. 

Next comes our holidays. And again Flex has a cool option, by using  a property disabledRanges . Using disabledRanges to single day made it possible. I entered all the possible holidays in a XML file  and used HTTPService to read the file.Based on current month and year,I checked for days(dates). If the particular date is available it shows in differnt color.

Thats it..!!! we made it.

But here comes the hardest part in my Calendar control.  Since I used properties like disabledDays & disabledRanges of DateChooser, I was not able to select those days, as its default selectable is false.

And since I’m working in a Company where weekends are still looked like  Friday, Friday , Friday and Monday :) , they want both holidays and weekends as selectable.

I was searching  a lot and found this site which holds the source code of CalendarLayout. 

http://flexpearls.blogspot.com/2008/03/datechooser-with-support-for.html

Brainstorming the source code and you belive it or not, just changing  single  line of code made my Calendar Control to work. And ofcourse you can use the above  link for having background color for different dates. Have a look at it.. its quiet cool!!

In the Calendarlayout source code, inside  the method

mx_internal function setSelectedMonthAndYear(monthVal:int = -1, yearVal:int = -1):void,

just changed this below line ( From true to false)

from

“disabledArrays[columnIndex][rowIndex] = true;” 

to

“disabledArrays[columnIndex][rowIndex] = false;”

just be careful, this line appears 3 times inside the same method. 

And my Calendar Control looks great.

 CalendarControl

Here you can see 12th Dec( Holiday) also weekends are shown in red color.  And the awesome part of it is.. both are selectable :)

Download the source code

Follow

Get every new post delivered to your Inbox.