Wednesday, 3 August 2011

Setup the TIFF iFilter for SharePoint 2010


Setup the TIFF iFilter for SharePoint 2010




If your running SharePoint 2010 on Windows Server R2 or Windows 7 the Tiff iFilter is a great add on that will OCR all your scanned Tiff files. The feature is turned off by default due to the additional load it can put on processing, but its easy to enable and greatly benefits searching.

The first step to enable the iFilter is adding the feature to the server. This is done through Server Manger. Click on Features in the tree and then Add Features on the right.

image

Check the box next to Windows Tiff IFilter.

image

Click next to confirm your selection then install the feature.

Now the the feature is installed it needs to be enabled and configured. Click on the start button and type gpedit.msc into the search window to launch the local group policy editor.

image

Under Computer Configuration select Administration Templates, then select the OCR folder.

image

This is were you will configure OCR for Tiffs.

image

The first option is to force OCR for all pages in a tiff. The TIFF iFilter attempts to optimize performance by skipping blank pages or pages that have non-textual content such as pictures. In my scenario almost every tiff was an invoice so I enabled this to ensure that no pages were missed during the OCR process.

image

The next setting is for the OCR language that you wish to check for. By default this will be the server system language, however if you have several different languages that you are expecting you can enable them here as long as they are part of the same code page. For example you could check for English, Dutch, French, and Italian since they all belong to the Western European code page. If you wanted to look for Japanese and English though you would have to use some other means of OCR since the Tiff iFilter does not support using more than one code page. Since I was only using English Tiff I left this setting as “Not Configured”.

image

If you have already installed SharePoint prior to these steps you will need to restart the associated SharePoint services. I was using a stand alone development environment so I was able to just reboot my server.

Now that you have the Tiff iFilter installed a full crawl will need to be run to OCR the documents. To run a full crawl open up central administration and click on manage service application.

image

Click on Search Service Application.

image

Under crawling click content sources.

image

Start a full crawl.

image

Once the crawl has finished go to your document library and search for some text that should be in one of your tiffs to see if everything worked.

image

Results!

image

Getting full text search results from the OCR data collected by the Tiff iFilter is easy, free, and a greatly improves searching in SharePoint 2010.


Wednesday, 20 April 2011

How to Enqueue Submits While Offline



How to Enqueue Submits While Offline


Scenario:


User fills out forms for a particular form template while the laptop is disconnected from the network.  Upon reconnection, seamlessly syncrhonize the offline forms to a Windows SharePoint Services form library.



Solution:


Using OnSubmitRequest, you can have the code save to the offline folder depending on if we're offline or not, as in the following code, which is written in C# using our Visual Studio .NET Toolkit.  You will also need to add a project reference to System.Xml.dll and the using System.XML; directive to your form code.


public void OnSubmitRequest(DocReturnEvent e)



{


if (thisApplication.MachineOnlineState == XdMachineOnlineState.Online)

{

// submit to Sharepoint using DAVAdapter

(thisXDocument.DataAdapters["Submit to Sharepoint"] as DAVAdapter).Submit();

}

else

{

// We are offline or working offline.

XmlDocument oDOM = new XmlDocument();

Microsoft.Office.Interop.InfoPath.SemiTrust.IXMLDOMDocument oWrappedDOM = thisXDocument.DOM;


oDOM.PreserveWhitespace = true;

oDOM.LoadXml(oWrappedDOM.xml);

oDOM.Save("C:SubmitForm_"

+ DateTime.Now.ToString("yyyy.MM.dd_HH.mm.ss.ff") + ".xml");

}


e.ReturnStatus = true;

}


Then, if you've been offline for a while and a number of files have built up, you can run the following jscript to invoke InfoPath externally and force a submit looping through the files, as below:




var oFileSys = new ActiveXObject("Scripting.FileSystemObject");

var oSubmitDir = oFileSys.GetFolder("C:Submit");

var oFilesInSubmitDir = new Enumerator(oSubmitDir.Files);


var oApp = new ActiveXObject("InfoPath.Application");


var fso = new ActiveXObject("Scripting.FileSystemObject");


for (; !oFilesInSubmitDir.atEnd(); oFilesInSubmitDir.moveNext())

{

var strFileName = oFilesInSubmitDir.item().Name.toLowerCase();


if (strFileName.length >= 4

&& strFileName.lastIndexOf(".xml") == (strFileName.length - 4))

{

try

{

var oDoc = oApp.XDocuments.Open(oFilesInSubmitDir.item().Path);

oDoc.Submit();

oDoc.View.Window.Close();


var f = fso.GetFile(oFilesInSubmitDir.item().Path);

f.Delete();


}

catch (e)

{

WScript.echo("ERROR: " + e.description);

}

}

}

oApp.Quit();




The InfoPath 2003 SP1 Preview



Do you know about the InfoPath 2003 SP1 Preview release? There are actually two free downloads available:




  1. The InfoPath 2003 SP1 client: new features and improvements added to the InfoPath client.

  2. The InfoPath 2003 Visual Studio toolkit: this provides the ability to write .NET managed code business logic in your InfoPath form.


Anyone can download and install this version of InfoPath and use it until it expires.


When the Office System 2003 SP1 is released (mid-2004), InfoPath will be updated to have many new features, in addition to performance improvements and bug fixes (and if you just want the performance improvements and bug fixes, the new features can be turned off).  The SP1 is completely backwards compatible with InfoPath 2003.


This preview gives you a chance to try out an initial version of the SP1 bits now so that you can learn the new features and plan for the SP1 deployment within your company.


The SP1 release is very important in that we were able to address customer wishes.  Give it a try!  We're certainly excited about it and will be posting about InfoPath SP1 here often (and we'll make it clear when a post is SP1 specific).




Welcome to the InfoPath

The InfoPath Team is looking forward to posting a variety of topics for our InfoPath users, including:

  • Feature highlights.

  • Code snippets.

  • Our best practices.

  • Tips 'n Tricks.

  • Common work-arounds.

  • Show how to leverage other Microsoft technology with InfoPath.


We're super-excited about InfoPath and look forward to helping our customers realize the most they can out of our new Office System 2003 application.

Please leave some feedback if there are areas you'd like to see us cover

Change of Apache port in xamp http.config file

Change apache port in xamp http.config file
C://xamp/apache/config/--> change localhost 80 to 8080

Sample example of error message infomation for site

Sorry, an error has occurred...

Unfortunately an error has occurred during the processing of your page request. Please be assured we log and review all errors, even if you do not report this error we will endeavor to correct it.

Google:
500. That’s an error.

The server encountered an error and could not complete your request.

If the problem persists, please report your problem and mention this error message and the query that caused it. That’s all we know.

URL Redirection on HTML Head meta code

<html>
<head>
<title></title>
<meta HTTP-EQUIV="REFRESH" content="0; url=http://domain.com/">
</head>
<body>
</body>
</html>

Display Logo & banner from SQL Server Database

<%
string sql = "select * from header";
string href = "";
string src = "";
string title = "";

foreach (DataRow dr in DbConnection.GetData(sql).Tables["ResultTable"].Rows)
{

href = dr["header_href"].ToString();
src = dr["header_src"].ToString();
title = dr["header_title"].ToString();

}
}

%>
<span><a href="Default.aspx"><img src="images/logo.png" alt="logo" border="0px"/></a></span>

<span><a href="<%=href %>" title='<%=title %>' target="_blank"><img src="<%=src %>" alt="<%=title %>" border="0px"/></a></span>

<%--<span><a href="banner.aspx" title=' banner title' target="_blank"><img src="images/banner.jpg" alt="banner" border="0px"/></a></span>--%>

Email contact form in php

<html>
<head>
<script src="calendar.js"></script>
<style>
input {border:1px solid #ABABAB}
</style>
</head>
<body>

<?php

$t=$_GET['to'];
if ($t=="m")
//if "email" is filled out, send email
{
$t="to@mail.com";
}
else
//if "email" is not filled out, display the form
{
$t="your@mail.com";
}

?>

<form method='post' action='mailform.php'>

<input name='to' type='hidden' value='<?php echo $t; ?>' />

Email: &nbsp;&nbsp;
<input name='email' type='text' /><br />
Subject: <input name='subject' type='text' /><br />
Date &nbsp;&nbsp; :
<input name='todate' onclick="event.cancelBubble=true;this.select();lcs(this)" onfocus="this.select();lcs(this)" type="text" value="dd/mm/yy" /><br />
Message:<br />
<textarea name='message' rows='15' cols='40'>
</textarea><br />
<input type='submit' />
</form>

</body>
</html>

mailform.php

<?php

$to = $_REQUEST['to'];
$subject = "New Appointment on ".$_REQUEST['todate'];
$message = $_REQUEST['message'];
$from = $_REQUEST['email'];
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent to the concerned doctor.";

?>

Stored Procedures Questions and Answers

Why do stored procedures reduce network traffic?

When a stored procedure is called, only the procedure call is sent to the server and not the statements that...
What are stored-procedures? And what are the advantages of using them.

Stored procedures are database objects that perform a user defined operation. A stored procedure can have a set of compound...
What is stored procedure?

Stored procedure is a group of SQL statements that forms a logical unit and performs a particular task. Stored Procedures...
What is the advantage of using stored procedure over the SQL queries ?

Writing the SQL statements inside our code is usually not a good idea. In this way you expose your database...
Can you have a nested transaction ?

Yes, very much. Check out BEGIN TRAN, COMMIT, ROLLBACK, SAVE TRAN and @@TRANCOUNT

What is an extended stored procedure?

Can...
How can I return from within a T-SQL the list of all available character sets and code pages ?

You can use the xp_enumcodepages undocumented extended stored procedure to return the list of all available character sets and code...
How do I report information about the active locks ?

To report information about the active locks, you can use the sp_lock system stored procedure. Read about the sp_lock stored procedure...
What is normalization ?

Well a relational database is basically composed of tables that contain related data. So the Process of organizing this data...
What is a DATABASE trigger ?

What is a DATABASE Procedure ?

A DATABASE TRIGGER is a stored procedure associated with a table that ORACLE7 automatically executes on one or more specified...
How can I return from within a T-SQL the list of server’s hard drives ?

You can use the xp_fixeddrives undocumented extended stored procedure to return the list of all hard drives and the amount...