Search systems on desktop/enterprise level

I've put together a few links regarding search systems on desktop/enterprise level





http://desktop.google.com/features.html


RemoveQueryStringFromUrl helper function

I've recently added to my UriHelper class the function RemoveQueryStringFromUrl

   public static string RemoveQueryStringFromUrl(string url)


  {


   //similar to string qs = QueryStringHelper.QueryStringFromUrl(url);


   string urlPath = url.LeftBefore("?");


   return urlPath;


  }


It refers to methods from My QueryStringHelper class and

My StringHelper class


Prevent Jet.OLEDB provider to converts strings to decimals


I have an utility, that reads a CSV files into ADO.Net , modifies it and Saves as another .CSV file.
Unfortunately Microsoft.Jet.OLEDB provider corrupts some string column, incorrectly interpreting them as decimals.
Thanks to the article
I was able to specify schemaIni before reading the file using the function
 

public static void SaveSchemaIni(string path, string schemaIniContent)

{

FileInfo fileinfo = new FileInfo(path);

string dirPath =fileinfo.DirectoryName;

string schemaIniPath = dirPath + "\\schema.ini";

string sFileNameInIni=schemaIniContent.LeftBefore("]");

string newFileName = ("[" + fileinfo.Name + "]");// +Environment.NewLine

if(!String.IsNullOrEmpty(sFileNameInIni))

{

schemaIniContent=schemaIniContent.RightAfter("]");

}

schemaIniContent = newFileName + schemaIniContent;

StreamHelper.SaveStringToFile(schemaIniContent, schemaIniPath);

}
 
 
LeftBefore and RightAfter are string extensions from My StringHelper class

Restore SQL Server Database from suspect

Below are a few links, that can help, if you need  Restore SQL Server Database from suspect

MyITforum.com : How to recover user databases from a “Suspectstatus(

 
You could also try detaching the DB, then do a single file attach only using
the db, dropping the log file. That solved the suspect issue for one of
our DBs. Somewhere in the SQL message logs it indicated that the LOG file
was corrupted
 
 

Here is the MSSQL command needed to attach an .mdf SQL database file with no .ldf file, enjoy!

sp_attach_single_file_db @dbname= 'databasename', @physname= 'C:\Users\Blake\Documents\Databases\databasefile.mdf'

 

Server: Msg 823, Level 24, State 6, Line 1

I/O error 2(The system cannot find the file specified.) detected during read at offset 0000000000000000 in file 'D:\OnePointDB\OnePointLog1.log'.

 
 
 
Run sp_resetstatus with the @dbname parameter. (ie : sp_resetstatus @dbname = "pubs")
 
 
USE Master
GO

-- Determine the original database status
SELECT [Name], DBID, Status
FROM master.dbo.sysdatabases
GO

-- Enable system changes
sp_configure 'allow updates',1
GO
RECONFIGURE WITH OVERRIDE
GO

-- Update the database status
UPDATE master.dbo.sysdatabases
SET Status = 24
WHERE [Name] = 'YourDatabaseName'
GO

-- Disable system changes
sp_configure 'allow updates',0
GO
RECONFIGURE WITH OVERRIDE
GO

-- Determine the final database status
SELECT [Name], DBID, Status
FROM master.dbo.sysdatabases
GO
 
 

string RemoveBefore helper function

// <summary>
       ///if sToFind not found, then original string should be returned
       /// Otherwise removeBefore
       /// </summary>
       /// <param name="str"></param>
       /// <param name="sToFind"></param>
       /// <returns></returns>
       public static string RemoveBefore(this string str, string sToFind)
       {
           int num1 = str.IndexOf(sToFind);
           if (num1 > 0)
           {
               return str.Remove(0, num1);
           }
           else
           {
               return str;
           }
           
       }

IsStringContainsAnyFromList helper function

/// <summary>
       /// Returns true, if  string contains any of substring from the list (case insensitive)
       /// See similar (with SqlLikeMatch support) in ResponseMessagePatternsCache
       /// </summary>
       /// <returns></returns>
       public static bool IsStringContainsAnyFromList( string stringToSearch,List<String> stringsToFind)
       {
           //TODO: create overloads with exact match  or case sencitive
           if (stringsToFind.IsNullOrEmpty())
           { return false; }
           else
           {
               stringToSearch = stringToSearch.ToUpper();
               return stringsToFind.Where(pattern => stringToSearch.Contains(pattern.ToUpper())).Count() > 0;
           }
       }
 

«May»
SunMonTueWedThuFriSat
24252627282930
1234567
891011121314
15161718192021
22232425262728
2930311234