Gokul's Blog


Leave a comment

Looking Back – 2008

I have learnt/worked on a lot of things in 2008. Some people have been my guiding stars I would like to thank those gurus for the help during need.

1. Tomas Restrepo

2.  Ivar Lumi from Lumisoft – Thank You for the wonderful MIME Parser

3. Dmitry – (dimastr.com) Learnt a lot from his website & his tools & you were very responsive in your emails

My family & friends who have always been very supportive & helpful .

Thank You Tomas for your acknowledgement and the wonderful Tools

http://winterdom.com/weblog/2008/09/24/PipelineTestingAcknowledgements.aspx

Advertisements


Leave a comment

XPS to PDF

Download GhostPDL 1.52:   http://ghostscript.com/releases/ghostpdl-1.52.tar.bz2
Extract it, then build the entire project: it is simple, just open ghostpdl.sln in Visual Studio 2005, then perform a normal build
After the build you will find gxps.exe here: \ghostpdl-1.52\ghostpdl-1.52\xps\obj
Convert your XPS file to PDF format like this: gxps.exe -sDEVICE=pdfwrite -sOutputFile=test.pdf -dNOPAUSE  test.xps
I hope it helps.

 

Reference Article: http://social.msdn.microsoft.com/Forums/en-US/windowsxps/thread/b1f15193-3073-4205-b882-c599fcff1559/

gxps.exe -sDEVICE=pdfwrite -sOutputFile=MyFile.pdf -dNOPAUSE "C:\MyFile.xps"


Leave a comment

Executing 100000 DB Inserts (Sqlite)

Open the csv file via System.data.OleDb
Open the sqlite database via System.Data.SQLite
Begin a transaction on the sqlite connection
loop over the rows in the csv, inserting them into the sqlite tables
Commit the transaction

Which code below is faster

Code 1:

     using (SQLiteCommand mycommand = new SQLiteCommand(myconnection))
      {
        int n;

        for (n = 0; n < 100000; n ++)
        {
          mycommand.CommandText = String.Format("INSERT INTO [MyTable] ([MyId]) VALUES({0})", n + 1);
          mycommand.ExecuteNonQuery();
        }
      }

Code 2:

 using (SQLiteTransaction mytransaction = myconnection.BeginTransaction())
      {
        using (SQLiteCommand mycommand = new SQLiteCommand(myconnection))
        {
          SQLiteParameter myparam = new SQLiteParameter();
          int n;

          mycommand.CommandText = "INSERT INTO [MyTable] ([MyId]) VALUES(?)";
          mycommand.Parameters.Add(myparam);

          for (n = 0; n < 100000; n ++)
          {
            myparam.Value = n + 1;
            mycommand.ExecuteNonQuery();
          }
        }
        mytransaction.Commit();
      }


Leave a comment

Bookmarklets

Some sample use of bookmarklets used in IE & Chrome

javascript:void(window.open(‘http://www.pdfdownload.org/web2pdf/Default.aspx?left=0&right=0&top=0&bottom=0&page=0&cURL=’+document.location.href));

 

IE Bookmarklet

javascript:(function(){var%20snippet_host=’http://thumbtack.livelabs.com/Scripts/Bookmarklet/&#8217;;var%20scriptBlock=document.createElement(‘SCRIPT’);scriptBlock.type=’text/javascript’;scriptBlock.src=snippet_host+’bookmarklet.js?’+parseInt(Number(new%20Date())/1000);document.getElementsByTagName(‘head’)[0].appendChild(scriptBlock);})();