Friday, November 16, 2012

Java Script function to Convert your local Date to UTC format Date

There might be a case that you might need to save date on UTC format while the user input date might be regional date time format. The following function converts the date on the UI layers itself  from the input reginonal date to UTC Date.

function convertToUTCFormat(date){
var year = "" + date.getUTCFullYear();
var month = "" + (date.getUTCMonth() + 1);if (month.length == 1) { month = "0" + month; } //months range is [0-11]
var day = "" + date.getUTCDate(); if (day.length == 1) { day = "0" + day; }
var hour = "" + date.getUTCHours();if (hour.length == 1) { hour = "0" + hour; }
var minute = "" + date.getUTCMinutes(); if (minute.length == 1)  minute = "0" + minute; } var second = "" + date.getUTCSeconds(); if (second.length == 1) { second = "0" + second; }

return year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second+":000"; }

Read More...

Tuesday, October 2, 2012

java.lang.IllegalStateException: Imbalanced frame stack! (exit() called too many times) !

If you started using SpringSource Insight,It's highly recommended to increase the memory of the tc Runtime Instance to more than what your application requires on its own . The following is the exception you might see in case there is not enough memory.
type Exception report
message

descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
java.lang.IllegalStateException: Imbalanced frame stack! (exit() called too many times)
com.springsource.insight.intercept.trace.ThreadLocalFrameBuilder.exit(ThreadLocalFrameBuilder.java:61)
com.springsource.insight.collection.DefaultOperationCollector.exit(DefaultOperationCollector.java:111)
com.springsource.insight.collection.DefaultOperationCollector.exitAbnormal(DefaultOperationCollector.java:85)
com.springsource.insight.plugin.annotation.InsightOperationAnnotationCollectionAspect.ajc$afterThrowing$com_springsource_insight_plugin_annotation_InsightOperationAnnotationCollectionAspect$3$5840edd2(InsightOperationAnnotationCollectionAspect.aj:50)
com.concur.midtier.webservices.xmlhttp.servlets.ReqRespMessageListener.service(ReqRespMessageListener.java:165)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)


note The full stack trace of the root cause is available in the VMware vFabric tc Runtime 2.6.2.RELEASE/7.0.22.A.RELEASE logs.

There are few options to resolve this issue.
  1. Increase the max heap
    For example: -Xmx512m
  2. or max PermGen size JVM option.
    For example: -XX:MaxPermSize=256m
  3. Increase the Spring insight max frame
    For example: -Dinsight-max-frames=6000
OR you can have all of the above JVM parameters.

Read More...

Wednesday, April 11, 2012

Get the current Value from a TextField in extJS !

Get the Current(or the latest) Value from the textField:

var currentValue= Ext.getCmp('expName').value;

Get the value that was initially loaded (or initialized)
var loadedValue=Ext.getCmp('expName').getValue();


On a separate note, You can define a label with a html message into it.
For example :
  {xtype:'label', 
   id:'duplicate_warning_msg',
   html:''Duplicate value detected !', hidden:true 
   }

You can make it visible or hide it with setVisible method as following.
Ext.getCmp('duplicate_warning_msg').setVisible(true);

Read More...

Friday, November 18, 2011

Get the the difference between two dates in MS SQL

The DATEDIFF() function returns the difference between two dates
Syntax: DATEDIFF ( datepart , startdate , enddate )

Following is an example for the DateDiff()
DECLARE @startdate datetime ='2011-11-14 02:00:06.957';
DECLARE @enddate datetime = '2011-11-16 05:00:15.490';
SELECT DATEDIFF(day, @startdate, @enddate) as dayDifference,DATEDIFF(HOUR, @startdate, @enddate)as hourDifference
Output

dayDifference hourDifference
2 51


Similarly the following are the available datepart Options on the DateDiff() Function.

year(or yy or yyyy)
quarter(or qq or q)
month (or mm or m )
dayofyear(or dy or y )
day (or dd, d )
week(or wk or ww)

hour(or hh)
minute(or mi or n)
second(or ss or s )
millisecond(or ms)
microsecond(or mcs)
nanosecond(or ns)
TZoffset(or tz)
ISO_WEEK(or isowk or isoww)


Read More...

Get the Row Numbers as a separate column on MS SQL Query

I was trying to execute a new query where I need the Row number as a new column on the result itself. I used the SQL Function ROW_NUMBER() to get the row number.
Following query gives the Report Path with the HitCount along with the added Row Number.

select ROW_NUMBER() OVER(ORDER BY count(ReportPath) DESC) AS 'Row Number', ReportPath,count(ReportPath) as HitCount
FROM [ReportServer].[dbo].[ExecutionLog2]
Group by ReportPath
Order by HitCount desc


Cheers !
Read More...

Friday, July 8, 2011

Get the Disk Usage Statistics from the WinDirStat !

WinDirStat is an opensource tool to identify howmuch of disk space you are using on your wondow box. It shows disk, file and directory sizes in a treelist as well as graphically in a treemap, much like KDirStat or SequoiaView.

Once i started using it, i feel like life would have been very hard without it.
Why don't you try it yourself.

You can download the tool from http://windirstat.info/

Read More...

Wednesday, June 29, 2011

How to parse multi value parameter from SSRS Report !

While writing an SSRS Report, I had to parse a multivalued parameter and stored it on a temp table. After some googling i came up with the following solution. @id is the multi valued parameter that need to be parsed. Following is the sample code that you can used to parse and put the values on a temp table.


-- @uid is the parameter. Lets define the parameter for testing.

declare @uid as nvarchar(200)
set @uid='u01052901,u01052789,u01052897,u0105345,u08023432,u0234324,u23479879'

create table #TempIDTable (
slice varchar(50))
declare @index1 int
declare @u_id nvarchar(4000)
set @index1 = 1
if @uid is null
set @index1 = 0
while @index1 !=0
begin
set @index1 = charindex(',',@uid)
if @index1 !=0
set @u_id = left(@uid,@index1 - 1)
else
set @u_id = @uid
insert into #TempIDTable select @u_id
set @uid= right(@uid,len(@uid) - @index1)
if len(@uid) = 0
break
end

Select * from #TempIDTable
--drop table #TempIDTable

Read More...

Pages

 ©mytechtoday.com 2006-2010

TOP