Monday, February 1, 2010

Handling innerText in Firefox

FireFox does not support innerText property. You can use textContent instead. Check for the condition document.all and you can use the method accordingly.

if(document.all){
           var productSpecs = items[i].innerText.toString();
}
else{
          var productSpecs = items[i].textContent.toString();
}

Tuesday, November 10, 2009

How to create a IE8 Accelerator

1. Create the below XML file.



1: xml version="1.0" encoding="UTF-8"?>
  2: <openServiceDescription xmlns="http://www.microsoft.com/schemas/openservicedescription/1.0">
  3:   <homepageUrl>http://www.google.com/csehomepageUrl>
  4:   <display>
  5:     <name>Search Digital Inspirationname>
  6:     <icon>http://search.labnol.org/favicon.icoicon>
  7:   display>
  8:   <activity category="Search">
  9:     <activityAction context="selection">
 10:       <execute action="http://www.google.com/cse">
 11:         <parameter name="q" value="{selection}" type="text" />
 12:         <parameter name="cx" value="010722013183089041389:nu0knrjwib8" type="text" />
 13:       execute>
 14:     activityAction>
 15:   activity>
 16: openServiceDescription>




You can add more parameters as required by the provider.






2. Create a link on your webpage so that the user can add the accelerator to the browser first time.


<a href="javascript:window.external.AddService('http://example.com/search.xml')">Install Acceleratora>



 or a button



<button onclick="window.external.AddService('http://example.com/search.xml')">Add Search Acceleratorbutton>

Friday, October 9, 2009

Using AdultPdf PDF Stamp Tool

Code Sample

//Open the File

id = oTest.apOpenEx(Server.MapPath("imagecache/"  + Page.Session.SessionID.ToString() + "9999.pdf"), Server.MapPath("imagecache/"  + Page.Session.SessionID.ToString() + "9999Stamped.pdf"));
//To setup pages on which the watermark should appear.(http://www.adultpdf.com/products/pdfstamp/help/help_cs.html)
oTest.apSetFunctionEx(id, 131, 3, 4, "0", "0");

//Code to modify the watermark
if (id > 0)
{
   oTest.apAddTextEx(id, 9, "UNVERIFIED", 8421504, 17, 10, 10, 50, 0, 1, 100, "Arial", 100, 0, "NONE", 0);
}
oTest.apCloseEx(id);

Monday, September 28, 2009

How to create a incremental variable in SSRS Reports

SSRS does not provide a way to store a varible and increment its value. Here is a tweak to it. I was working on developing a application form in ssrs where the next party number increments for the parties in the dataset. I had to have a variable to increment (I cannot use row number though). I declared a report variable. Then incremented it with the row number within the scope.

=(Code.RollingSeq + RowNumber(''MainDataset")).tostring() & "a. "
=(Code.RollingSeq + RowNumber(''MainDataset")).tostring() & "b. "

Sunday, September 27, 2009

Using Microsoft Messaging Queue With Acknowledgements

How to set up a message queue?
1.Windows-->Control Panel--> Computer Management --> Services and Applications --> Message Queuing--> Private Queues
If you do not see Message Queuing you may need to install this windows features from the add and remove programs.
2. Create a Main Queue and a Acknowledgement Queue.
3. Copy the path and use them in the code below. It is ideal to store them as config elements and use the value.

Example of the path  " localhost\private$\MainQueue "


Dim MainQueue As New System.Messaging.MessageQueue()
Dim AcknowledgementQueue As New System.Messaging.MessageQueue()
Dim Message As New System.Messaging.Message()
Dim AcknowledgementMessage As New System.Messaging.Message()


 MainQueue.Path = "MAIN QUEUE PATH"
 AcknowledgementQueue.Path = "ACKNOWLEDGEMENT QUEUE PATH"


Message.Body = "TEST MESSAGE"
Message.Formatter = New BinaryMessageFormatter(FormatterAssemblyStyle.Simple, FormatterTypeStyle.TypesAlways)
Message.Recoverable = True
'Commented to avoid sending the messages to the deadletterqueue
'Message.UseDeadLetterQueue = True
 Message.ResponseQueue = oInterfacesSubmitAckQueue
 Message.Label = _Payload.GetType().FullName
 Message.Priority = Messaging.MessagePriority.Normal
 Message.Formatter = New BinaryMessageFormatter(FormatterAssemblyStyle.Simple, FormatterTypeStyle.TypesAlways)
 Message.AcknowledgeType = AcknowledgeTypes.NotAcknowledgeReachQueue Or AcknowledgeTypes.FullReachQueue
 Message.AdministrationQueue = AcknowledgementQueue
 MainQueue.Send(theMessage)
 MainQueue.Close()
 AcknowledgementMessage  = MainQueue.Receive(New TimeSpan(0, 0, 2))


 If AcknowledgementMessage.Acknowledgment <> Acknowledgment.ReachQueue Then
            ' Code to perform actions when the message did not reach the message queue
 Else


 End If