Monday, May 30, 2011

CROSS APPLY

 select  diIdDocument, nopDenumireDocument   into #1  
    from OJ_DocumenteIncarcate
    inner join OJ_TipuriDocumenteSolicitare on diIdDocument = tdsIdDocument
    inner join OJ_NomOpisDocumente on nopIdOpisDocument = tdsIdTipDocument        
               
select distinct diIdDocument, DocumenteAtasate
into #docTypes        
    from #1 a           
CROSS APPLY ( SELECT nopDenumireDocument + '; '               
              FROM #1 b               
              WHERE a.diIdDocument = b.diIdDocument                
              ORDER BY nopDenumireDocument                
              FOR XML PATH('') )  D ( DocumenteAtasate )               

     drop table #1        
     drop table #docTypes  

Thursday, May 26, 2011

Format ToString Nullable DateTime

DateTime? date = getDate();
string strDate = date.Value.ToString("yyyy/MM/dd");

Check if JS function exists

if(typeof yourFunctionName == 'function') {
yourFunctionName();
}

Sunday, May 22, 2011

OpenCV - Convert image to grayscale

  1. /* load image */
  2. IplImage *src = cvLoadImage( argv[1], CV_LOAD_IMAGE_COLOR );
  3.  
  4. /* get image properties */
  5. width  = src->width;
  6. height = src->height;
  7.  
  8. /* create new image for the grayscale version */
  9. IplImage *dst = cvCreateImage( cvSize( width, height ), IPL_DEPTH_8U, 1 );
  10.  
  11. /* CV_RGB2GRAY: convert RGB image to grayscale */
  12. cvCvtColor( src, dst, CV_RGB2GRAY );

Resize image in OpenCV

#include < iostream >
#include "cv.h"
#include "highgui.h"

using namespace std;

int main( int argc, char** argv )

{
// Create an IplImage object *image 
IplImage *source = cvLoadImage( argv[1]);
// Here we retrieve a percentage value to a integer
int percent = atoi(argv[3]);

// declare a destination IplImage object with correct size, depth and channels
      IplImage *destination = cvCreateImage
( cvSize((int)((source->width*percent)/100) , (int)((source->height*percent)/100) ),
                                     source->depth, source->nChannels );

//use cvResize to resize source to a destination image
cvResize(source, destination);

// save image with a name supplied with a second argument
      cvSaveImage( argv[2], destination );


return 0;

}

Wednesday, May 18, 2011

Get selectedvalue from dynamic dropdownlist

DropDownList ddlTest = (DropDownList)this.FindControl("ddlTest ");
 string selectedValue = Request.Form[ddlTest.UniqueID];

Tuesday, May 3, 2011

Citation Modification IEEE Standard

http://channel9.msdn.com/Forums/Coffeehouse/240589-Word-2007-citations-should-be-simple-but-solved