Sunday, May 19, 2013

How to hide What's Hot in Google+

This was so irritating. Here you go.

Click on What's Hot on left side bar

Click on Settings gear wheel, and uncheck the box.


Wednesday, May 1, 2013

Flex: Customize line Series DataTips

Here is what I wanted to do. I wanted to have a flex linechart with the following options

1) Custom data tip
2) Always show data points
3) Change the color of data points based on my data ( like Red, Blue, Green )

1) Custom data tip: This was the easiest option, just call dataTipFunction, which will return a string.You can control the text and its color in the function. When some thing fails, I show my message in Red.

2) Alwasy show data points: For this I used mx.charts.renderers.CircleItemRenderer, so all my datapoints appear. You can control the size using radius property. More than 1 renderer is available, like diamond,box etc

3) Change the color of data points: I used fillFunction to control the color of data points.


<mx:LineChart id="linechart" width="100%" height="100%"                               
                                dataTipFunction="CustomToolTip" dataTipMode="multiple"
                                showDataTips="true" >       

                      <mx:verticalAxis>
                          <mx:LinearAxis baseAtZero="false" title="Total Minutes"/>
                      </mx:verticalAxis>
                     
                      <mx:horizontalAxis>
                          <mx:CategoryAxis categoryField="Run_Date"
displayName="Run Date"  title="Run Date"/>
                      </mx:horizontalAxis>    
                                           
                      <mx:series>
                          <mx:LineSeries id="lineseries" displayName="TotalMinutes"
form="segment" yField="Total_Minutes" radius="6"                                        
                                         itemRenderer="mx.charts.renderers.CircleItemRenderer"
                                         fillFunction="{fill_color}">                                                       
                          </mx:LineSeries>                              
                      </mx:series>
                     
                  </mx:LineChart>

public function fill_color (element:ChartItem, index:Number):IFill
            {               
                if (element.item.Job_Status.search("success")>0)
                    return new SolidColor(0XFF00 ,1);//green
                else if (element.item.Job_Status.search("error")>0)
                    return new SolidColor(0xFF0000 ,1);        //red           
                else
                    return new SolidColor(0x66ff ,1);
            }

private function CustomToolTip(hd:HitData):String
{
    var sJobStatus:String;
    if (hd.item.Job_Status.search("success")>0)
        sJobStatus = "<FONT COLOR='#339966'>" + hd.item.Job_Status + "</FONT>";     //green
    else if (hd.item.Job_Status.search("error")>0)
        sJobStatus = "<FONT COLOR='#FF0000'>" + hd.item.Job_Status + "</FONT>"; //red
    else
        sJobStatus = "<FONT COLOR='#117adc'>" + hd.item.Job_Status + "</FONT>"; //blue
   
    return "Job Status: <b>"+sJobStatus+"</b>";
}


Thursday, March 21, 2013

Oracle: 100% CPU Usage

I am running Oracle on a  Windows box, and on several occasions my CPU usage goes to 100% for oracle.exe and stays there for a long time crippling the whole server. Most of the time my session browser does not show anything, so I cannot figure out whats causing oracle to run at 100% CPU

Here is what I found out from Oracle metalink to debug and figure out what SQL causes oracle to go 100%.

  1. Download processExplorer, and launch it
  2. Locate the program that's using 100% CPU, mostly it will be Oracle.exe
  3. Double click on the executable name, and open its properties window.
  4. Ignore any warning messages if any
  5. On the properties window, click on Thread tab
  6. Find the thread with high CPU%
  7. Note down the Thread Id

Run the SQL below, and substitue  XXXX with the thread id. It should give you the session info as well as the SQL causing CPU to go crazy. You can investigate further or kill the session

SELECT p.spid Thread_ID,  b.name Background_Process,  s.username User_Name,  s.osuser OS_User,  s.status STATUS,  s.sid Session_ID,  s.serial# Serial_No,  s.program OS_Program, sql_text
FROM   v$session s, v$process p,  v$bgprocess b, v$sqlarea cql
WHERE s.paddr  = p.addr
AND   p.addr = b.paddr(+)
and   s.sql_hash_value = cql.hash_value(+)
AND   p.spid     = XXXX

If you prefer to kill the session, get the session id and serial no from the above query, and run the command below.
Alter system kill session 'Session_ID,Serial_No' ;