Stuart Cox's invitation is awaiting your response
|
Trials and tribulations of a C# developer. As I find or develop useful techniques, code snippets, bug resolutions, etc. I post them here. Hope you find them useful!
|
Posted by
mouse
at
3:06 AM
0
comments
|
Posted by
mouse
at
7:37 AM
0
comments
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
Posted by
mouse
at
7:37 AM
0
comments
We had a SharePoint 2007 (MOSS) implementation with many, many PDF documents. We installed the Adobe IFilter and crawled the site, but the conents of the PDF file were not being indexed. The icon showed up correctly, searches on document titles worked ok, but the PDF content was not searchable. Now for the fix! We had to install the IFilter on the database server.
Posted by
mouse
at
9:28 AM
1 comments
Labels: MOSS, Search, SharePoint
On a recent project I've had the need (unfortunately) to pull data from Access into SQL Server. We implemented this using Linked Server to query the Access database. In case I need to find it again, here's the code...
The Linked Server can be created using SQL Enterprise Manager, but we needed to script it.
Posted by
mouse
at
2:50 PM
0
comments
Labels: Access, SQL Server, TSQL
Reporting Services does not support alternating row colors out of the box. But you can get the effect using a little custome code and expressions. Most object properties support expressions. For example, we can specify the background color for a cell as a color (i.e. "White") or a code expression.
To get alternating row colors, I use two functions which I add to the report code module. To access the report code module, view the report options, select the Code tab, and copy the following code into the code window.
Posted by
mouse
at
10:08 AM
0
comments
Labels: Reporting Services, SQL Server, Visual Basic
Null conversions are a real pain. Nullable types in the 2.0 framework are a great addition, but fall a bit short in my mind. They don't handle DBNull values coming out of the database, so that leaves you with more null conversion work to do. For example:
Posted by
mouse
at
11:09 AM
0
comments
Labels: .Net 2.0, ASP, C#, Generics, SQL Server, System.ComponentModel
With a combination of CSS filters like Glow and Shadow, you can get some really nice effects. I had alot of trouble getting CSS filters to work, though, and this post may save you (and me) some time in the future trying to figure it out.
See SSI Developer and Fred's samples for some samples of filters usage. I found nice Shadow filter tutorials on Mandarin Design and A List Apart, two of my favorite design blogs. Filters should work on img, span, div and font tags. If they don't work immediately, don't be surprised. These filters only work for IE users, and only then if you get it just right. Use of the filters is a bonus, as many users may not see them at all. But the effects can be quite nice (see some shadow and css samples in this post below), especially if you're in a controlled browser environment (intranet apps). Here's a checklist I found I had to use to get it working. My test browser is Internet Explorer 6.0 running on Windows XP sp2. 1 Check Your DOCTYPE The DOCTYPE specified for your page has to be right or they will not work (for more information, read the W3C DOCTYPE guidelines). If you have specified a DOCTYPE for HTML 4.1 or XHTML 1.0/1.1, the filters will not work. The HTML 2.0 and HTML 3.2 doc types worked well for me. Try one of these DOCTYPES or remove the DOCTYPE altogether if you can. I also had success with listing multiple DOCTYPE tags, as long as I listed one of these first.
Posted by
mouse
at
3:22 PM
0
comments
This function loads a string from a text file and caches it using the System.Web caching object. I have to go track down this code snippet frequently. Thought I would post it here so I can find it later.
Posted by
mouse
at
3:39 PM
0
comments
Labels: ASP, C#, StreamReader, System.IO, System.Web, System.Web.Caching
SQL Server Reporting Services has a bug that annoys me. I have a report with SQL based parameters (a dropdown list), and a date range that I default using a Reporting Service expression.
The bug occurs when users run the report multiple times. Changing the dropdown option reverts the date to the default. Reporting Services assumes that a change in the dropdown should revert all non-sql based parameters to their default values. Very annoying for the users, and there's no way around it in the current version of Reporting Services using parameter dependencies. The workaround I came up with is simply to change the date parameter and make it a SQL query rather than a Reporting Services expression. This prevents or tricks Reporting Services into leaving the parameter alone when users change other SQL-based parameters. I added a DataSet containing a SQL query with my date logic (in this case, the first date of the current month).
Posted by
mouse
at
2:54 PM
0
comments
Labels: DateTime, Reporting Services, SQL Server, TSQL
SQL Server TSQL query to return the last friday, based on the current date. This technique can also be modified to return any other day of the week or to get the next Friday, etc.
Posted by
mouse
at
2:39 PM
0
comments
Labels: DateTime, SQL Server, TSQL
I need to create an ArrayList to and array of entity objects. In this sample, an array of Person objects. I need to build the array dynamically, and I'd like to use the intrinsic .Net System.Collection classes. In this sample, we'll use an ArrayList object.
Once we've created the ArrayList and added all the people to it, we want to convert it to an array of Person objects. The cast is a little wierd, and took me a while to figure out...
Posted by
mouse
at
1:18 PM
0
comments
Labels: ArrayList, C#, Convert, System.Collections