Monday, May 21, 2012

Gemini Database Permission using Windows Authentication


This is just a reminder for myself on how to get the Gemini Issue Tracker up and running.
  1. Install the database using Windows Authentication
  2. Add [MachineName]\ASPNET as user on the created database
  3. Select db_owner under both Schemas owned by this user and Database role membership
  4. Edit the Gemini website web.config file.
  5. Set the connection string to
    <add name="Gemini" connectionString="Data Source=[ServerName];Initial Catalog=[DatabaseName];Integrated Security=SSPI;"/>
    (Note: This connection string is for SQL 2008)
The website should open now.

Thursday, May 17, 2012

Use VBA to open a file

'Use Windows Explorer to launch the file.
VBA.Shell "Explorer.exe " & Chr(34) & strFilePath & Chr(34), vbNormalFocus 


'Use command to launch the file
VBA.Shell "cmd /c """ & GetItemFolder & strFileName & """"

Wednesday, May 16, 2012

Adding "All" to combobox

Table/Query
If the Row Source Type property is Table/Query then create a union query. If the first field in the is a primary key you can't use Null as the value of the field. Use a numeric value (-1 or 0 as an example)

With primary id field
SELECT DISTINCT [CategoryID], [Description] FROM [Categories] UNION SELECT Null as AllID, "(All)" AS AllField FROM [Categories] ORDER BY [Description]

Without primary id field
SELECT DISTINCT [CategoryID], [Description] FROM [Categories] UNION SELECT -1 as AllID, "(All)" AS AllField FROM [Categories] ORDER BY [Description]

Take note of the where the ORDER BY clause has been moved.

Value List
 If the Row Source Type property is Value List then just add (All) to the list.

Example
"(All)";"Hello"; "World"





   
   

Monday, October 26, 2009

C# Code Formatting Using Blogger Stylesheet

You can include the styles for the code formatting in the main stylesheet.

Adding the style

Select Dashboard > Layout > Edit Html.

Scroll down to or find the stylesheet closer, ]]></b:skin>.

Insert the following style before the stylesheet closer. It should like the below.  

     .csharpcode pre { margin: 0em; }
     .csharpcode .rem { color: #008000; }
     .csharpcode .kwrd { color: #0000ff; }
     .csharpcode .str { color: #006080; }
     .csharpcode .op { color: #0000c0; }
     .csharpcode .preproc { color: #cc6633; }
     .csharpcode .asp { background-color: #ffff00; }
     .csharpcode .html { color: #800000; }
     .csharpcode .attr { color: #ff0000; }
     .csharpcode .alt
     {
         background-color: #f4f4f4;
         width: 100%;
         margin: 0em;
     }
     .csharpcode .lnum { color: #606060; }
     ]]></b:skin>

Editing a post

Goto http://www.manoli.net/csharpformat/ and paste your code in the box provided. Untick embed stylesheet and select format my code.

On your post Select Edit HTML and paste the html code of the formatted code in your post.

Sunday, October 25, 2009

C# Generate GUID

Use the following code to generate a guid.
Guid.NewGuid().ToString().ToUpper();
I've created a simple form to generate the guid for my own use. You can download the source here.


C# Code Formatting

You can use this service to formatting your code to html. Great for using in a blog.

http://www.manoli.net/csharpformat/.