This blog is about my history as a software engineer utilizing technologies C#, Java, React, JavaScript, .NET Core, SQL Server , Oracle, GIT, GitHub, Jira, Azure, AWS and HTML5. “I have not failed. I've just found 10,000 ways that won't work.” Thomas A. Edison. Please click on all my ADVERTISING links to help support this blog. Thank you.
Tuesday, May 30, 2006
Update to Access Folders without reboot
Need to access a folder you were just given access to? No need to reboot. Simply go to Start > Run > Type CMD At the dos prompt type gpupdate
Friday, May 19, 2006
SQL Server Leading Zeros for CHAR Type
declare @DirectiveNumber char(6)
declare @DirLength int
SET @DirectiveNumber = (SELECT DirectiveNumber FROM dbo.tblPlants WHERE PlantId = '1201')
--UPDATE dbo.tblPlants SET DirectiveNumber =
SET @DirectiveNumber = @DirectiveNumber + 1
Select @DirLength = LEN(@DirectiveNumber)
IF (@DirLength = 1)
SET @DirectiveNumber = '00000' + @DirectiveNumber
IF (@DirLength = 2)
SET @DirectiveNumber = '0000' + @DirectiveNumber
IF (@DirLength = 3)
SET @DirectiveNumber = '000' + @DirectiveNumber
IF (@DirLength = 4)
SET @DirectiveNumber = '00' + @DirectiveNumber
IF (@DirLength = 5)
SET @DirectiveNumber = '0' + @DirectiveNumber
UPDATE dbo.tblPlants SET DirectiveNumber = @DirectiveNumber WHERE PlantId = '1201'
SELECT @DirectiveNumber
declare @DirLength int
SET @DirectiveNumber = (SELECT DirectiveNumber FROM dbo.tblPlants WHERE PlantId = '1201')
--UPDATE dbo.tblPlants SET DirectiveNumber =
SET @DirectiveNumber = @DirectiveNumber + 1
Select @DirLength = LEN(@DirectiveNumber)
IF (@DirLength = 1)
SET @DirectiveNumber = '00000' + @DirectiveNumber
IF (@DirLength = 2)
SET @DirectiveNumber = '0000' + @DirectiveNumber
IF (@DirLength = 3)
SET @DirectiveNumber = '000' + @DirectiveNumber
IF (@DirLength = 4)
SET @DirectiveNumber = '00' + @DirectiveNumber
IF (@DirLength = 5)
SET @DirectiveNumber = '0' + @DirectiveNumber
UPDATE dbo.tblPlants SET DirectiveNumber = @DirectiveNumber WHERE PlantId = '1201'
SELECT @DirectiveNumber
Tuesday, May 16, 2006
ASP.NET 2.0
WOW,
Well I just deployed my first ASP.NET 2.0. What a difference from 1.x.
I learned that you can deploy by using a publish and precompiled mode that will not cause a slow load the first time a user accesses the site, but the issue with using that is that when you make change you have to redeploy all the .aspx and .dll files again. That kinda sucks.
However, after a little research I found a tool that add-ons from microsoft: http://msdn.microsoft.com/asp.net/reference/infrastructure/wdp/
This feature more reflects the ASP.NET 1.x way of creating dlls
Well I just deployed my first ASP.NET 2.0. What a difference from 1.x.
I learned that you can deploy by using a publish and precompiled mode that will not cause a slow load the first time a user accesses the site, but the issue with using that is that when you make change you have to redeploy all the .aspx and .dll files again. That kinda sucks.
However, after a little research I found a tool that add-ons from microsoft: http://msdn.microsoft.com/asp.net/reference/infrastructure/wdp/
This feature more reflects the ASP.NET 1.x way of creating dlls
Friday, May 12, 2006
How do I hide a column in my Datagrid if AutoGenerateColumns is set to True?
Question: How do I hide a column in my Datagrid if AutoGenerateColumns is set to True?
Answer: AutoGenerated columns do not appear in the Datagrid's Columns() collection, and so the usual method of hiding a Datagrid column will fail:
'Will NOT work for AutoGenerated columns:
Datagrid1.Columns(1).Visible = False
So the place to handle this is in the ItemDataBound event of the Datagrid:
<asp:DataGrid id="Datagrid1" runat="server" AutoGenerateColumns="True" OnItemDataBound="Datagrid1_OnItemDataBound"/>
Codebehind
Private Sub Datagrid1_OnItemDataBound(s As Object, e As DatagridItemEventArgs)
e.Item.Cells(1).Visible = False
End Sub
Answer: AutoGenerated columns do not appear in the Datagrid's Columns() collection, and so the usual method of hiding a Datagrid column will fail:
'Will NOT work for AutoGenerated columns:
Datagrid1.Columns(1).Visible = False
So the place to handle this is in the ItemDataBound event of the Datagrid:
<asp:DataGrid id="Datagrid1" runat="server" AutoGenerateColumns="True" OnItemDataBound="Datagrid1_OnItemDataBound"/>
Codebehind
Private Sub Datagrid1_OnItemDataBound(s As Object, e As DatagridItemEventArgs)
e.Item.Cells(1).Visible = False
End Sub
Tuesday, May 09, 2006
Monday, May 08, 2006
Parse Error When adding new Web pages to application
I am banging my head on this one... All of my other Web forms work fine but now...
I am getting the following error when adding new Web forms to my application:
I just added simple Web form with Hello World typed on the page.
Server Error in '/XXX.QuipSap.WebUi' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load type 'XXX.QuipSap.WebUi.TestForm'.
Source Error:
Line 1: <%@ Page Language="vb" AutoEventWireup="false" Codebehind="TestForm.aspx.vb" Inherits="XXX.QuipSap.WebUi.TestForm"%>
Line 2:
Line 3:
Source File: c:\inetpub\wwwroot\XXX.QuipSap.WebUi\TestForm.aspx Line: 1
SOLUTION:
OK as crazy as a solution that this sounds, but I am not to happy with the solution but it works.
When I create add a new Web form I just remove the inherits part from the first line of the aspx page. If I add labels or buttons and double click on them VS.NET 2003 adds back the inherits and magically (HMM I say magically because if I knew what was fixing it I would not be writting this) fixes the issue.
I am getting the following error when adding new Web forms to my application:
I just added simple Web form with Hello World typed on the page.
Server Error in '/XXX.QuipSap.WebUi' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load type 'XXX.QuipSap.WebUi.TestForm'.
Source Error:
Line 1: <%@ Page Language="vb" AutoEventWireup="false" Codebehind="TestForm.aspx.vb" Inherits="XXX.QuipSap.WebUi.TestForm"%>
Line 2:
Line 3:
Source File: c:\inetpub\wwwroot\XXX.QuipSap.WebUi\TestForm.aspx Line: 1
SOLUTION:
OK as crazy as a solution that this sounds, but I am not to happy with the solution but it works.
When I create add a new Web form I just remove the inherits part from the first line of the aspx page. If I add labels or buttons and double click on them VS.NET 2003 adds back the inherits and magically (HMM I say magically because if I knew what was fixing it I would not be writting this) fixes the issue.
Parse Error When adding new Web pages to application
I am banging my head on this one... All of my other Web forms work fine but now...
I am getting the following error when adding new Web forms to my application:
I just added simple Web form with Hello World typed on the page.
Server Error in '/XXX.QuipSap.WebUi' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load type 'XXX.QuipSap.WebUi.TestForm'.
Source Error:
Line 1: <%@ Page Language="vb" AutoEventWireup="false" Codebehind="TestForm.aspx.vb" Inherits="XXX.QuipSap.WebUi.TestForm"%>
Line 2:
Line 3:
Source File: c:\inetpub\wwwroot\XXX.QuipSap.WebUi\TestForm.aspx Line: 1
SOLUTION:
OK as crazy as a solution that this sounds, but I am not to happy with the solution but it works.
When I create add a new Web form I just remove the inherits part from the first line of the aspx page. If I add labels or buttons and double click on them VS.NET 2003 adds back the inherits and magically (HMM I say magically because if I knew what was fixing it I would not be writting this) fixes the issue.
I am getting the following error when adding new Web forms to my application:
I just added simple Web form with Hello World typed on the page.
Server Error in '/XXX.QuipSap.WebUi' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load type 'XXX.QuipSap.WebUi.TestForm'.
Source Error:
Line 1: <%@ Page Language="vb" AutoEventWireup="false" Codebehind="TestForm.aspx.vb" Inherits="XXX.QuipSap.WebUi.TestForm"%>
Line 2:
Line 3:
Source File: c:\inetpub\wwwroot\XXX.QuipSap.WebUi\TestForm.aspx Line: 1
SOLUTION:
OK as crazy as a solution that this sounds, but I am not to happy with the solution but it works.
When I create add a new Web form I just remove the inherits part from the first line of the aspx page. If I add labels or buttons and double click on them VS.NET 2003 adds back the inherits and magically (HMM I say magically because if I knew what was fixing it I would not be writting this) fixes the issue.
Parse Error When adding new Web pages to application
I am banging my head on this one... All of my other Web forms work fine but now...
I am getting the following error when adding new Web forms to my application:
I just added simple Web form with Hello World typed on the page.
Server Error in '/XXX.QuipSap.WebUi' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load type 'XXX.QuipSap.WebUi.TestForm'.
Source Error:
Line 1: <%@ Page Language="vb" AutoEventWireup="false" Codebehind="TestForm.aspx.vb" Inherits="XXX.QuipSap.WebUi.TestForm"%>
Line 2:
Line 3:
Source File: c:\inetpub\wwwroot\XXX.QuipSap.WebUi\TestForm.aspx Line: 1
SOLUTION:
OK as crazy as a solution that this sounds, but I am not to happy with the solution but it works.
When I create add a new Web form I just remove the inherits part from the first line of the aspx page. If I add labels or buttons and double click on them VS.NET 2003 adds back the inherits and magically (HMM I say magically because if I knew what was fixing it I would not be writting this) fixes the issue.
I am getting the following error when adding new Web forms to my application:
I just added simple Web form with Hello World typed on the page.
Server Error in '/XXX.QuipSap.WebUi' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load type 'XXX.QuipSap.WebUi.TestForm'.
Source Error:
Line 1: <%@ Page Language="vb" AutoEventWireup="false" Codebehind="TestForm.aspx.vb" Inherits="XXX.QuipSap.WebUi.TestForm"%>
Line 2:
Line 3:
Source File: c:\inetpub\wwwroot\XXX.QuipSap.WebUi\TestForm.aspx Line: 1
SOLUTION:
OK as crazy as a solution that this sounds, but I am not to happy with the solution but it works.
When I create add a new Web form I just remove the inherits part from the first line of the aspx page. If I add labels or buttons and double click on them VS.NET 2003 adds back the inherits and magically (HMM I say magically because if I knew what was fixing it I would not be writting this) fixes the issue.
Parse Error When adding new Web pages to application
I am banging my head on this one... All of my other Web forms work fine but now...
I am getting the following error when adding new Web forms to my application:
I just added simple Web form with Hello World typed on the page.
Server Error in '/XXX.QuipSap.WebUi' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load type 'XXX.QuipSap.WebUi.TestForm'.
Source Error:
Line 1: <%@ Page Language="vb" AutoEventWireup="false" Codebehind="TestForm.aspx.vb" Inherits="XXX.QuipSap.WebUi.TestForm"%>
Line 2:
Line 3:
Source File: c:\inetpub\wwwroot\XXX.QuipSap.WebUi\TestForm.aspx Line: 1
SOLUTION:
OK as crazy as a solution that this sounds, but I am not to happy with the solution but it works.
When I create add a new Web form I just remove the inherits part from the first line of the aspx page. If I add labels or buttons and double click on them VS.NET 2003 adds back the inherits and magically (HMM I say magically because if I knew what was fixing it I would not be writting this) fixes the issue.
I am getting the following error when adding new Web forms to my application:
I just added simple Web form with Hello World typed on the page.
Server Error in '/XXX.QuipSap.WebUi' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load type 'XXX.QuipSap.WebUi.TestForm'.
Source Error:
Line 1: <%@ Page Language="vb" AutoEventWireup="false" Codebehind="TestForm.aspx.vb" Inherits="XXX.QuipSap.WebUi.TestForm"%>
Line 2:
Line 3:
Source File: c:\inetpub\wwwroot\XXX.QuipSap.WebUi\TestForm.aspx Line: 1
SOLUTION:
OK as crazy as a solution that this sounds, but I am not to happy with the solution but it works.
When I create add a new Web form I just remove the inherits part from the first line of the aspx page. If I add labels or buttons and double click on them VS.NET 2003 adds back the inherits and magically (HMM I say magically because if I knew what was fixing it I would not be writting this) fixes the issue.
Thursday, April 13, 2006
Friday, April 07, 2006
Sunday, January 29, 2006
Right click command prompt
Here's a handy tip that I got from a co-worker, who found it in the book Microsoft Visual C# .NET Step by Step. It creates a shortcut in the right click context menu of Windows Explorer to open a command prompt in the current directory. When I need to run scripts in a very long directory name, this is very handy.
So here's how you set it up:
Open up windows explorer
Tools -> Folder Options.
File Types Tab
Select the Folder file type
Click Advanced
Click New
For the Action type what ever you want the context menu to display, I used Command Prompt.
For the Application used to perform the action use c:\windows\system32\cmd.exe (note on win2k you will want to specify the winnt directory instead of the windows directory)
You can also use this feature to attach context actions to file types. Or if you want to create a right click open with option for any file type (for instance I like to be able to open any file with notepad, see: my blog entry here.
So here's how you set it up:
Open up windows explorer
Tools -> Folder Options.
File Types Tab
Select the Folder file type
Click Advanced
Click New
For the Action type what ever you want the context menu to display, I used Command Prompt.
For the Application used to perform the action use c:\windows\system32\cmd.exe (note on win2k you will want to specify the winnt directory instead of the windows directory)
You can also use this feature to attach context actions to file types. Or if you want to create a right click open with option for any file type (for instance I like to be able to open any file with notepad, see: my blog entry here.
Friday, January 20, 2006
Arrays
Well I guess it is time to start being a true programmer and master arrays. So what did I learn day one about using arrays.
If you are going to use C# and want a dynamic array you better use the following code... (HINT USE AN ARRAY LIST)
int i = 0;
ArrayList al = new ArrayList();
while (myReader.Read())
{
al.Add(myReader.GetInt32(0));
i = i + 1;
}
If you are going to use C# and want a dynamic array you better use the following code... (HINT USE AN ARRAY LIST)
int i = 0;
ArrayList al = new ArrayList();
while (myReader.Read())
{
al.Add(myReader.GetInt32(0));
i = i + 1;
}
Friday, January 13, 2006
SharePoint Stats
Getting Usage Statistics on Sharepoint Portal 2003 Areas
This comes from this microsoft blog
"There are pages available in Windows SharePoint Services that will allow you to obtain usage statistics for WSS Sites. However, this is not the case for Areas in SharePoint Portal Server 2003. There are no built-in hyperlinks in the Admin pages for viewing usage statistics for a give Area.
Does this mean that usage statistics are not available for Areas in SPS 2003? No, it just means that you have to know a backdoor URL to get to the pages that display the stats. Here is the format of the URL:
http://{your portal name}/_layouts/1033/usageDetails.aspx
This URL will take you to a usage statistics page for the Home Area of your portal. (Note: the 1003 is the designator for you language, so it will be different if not using U.S. English).
If you want to look at usage statistics for a Subarea, for instance, News, you would modify the URL to look as follows:
http://{your portal name}/News/_layouts/1033/usageDetails.aspx"
Moojjoo Blog
This comes from this microsoft blog
"There are pages available in Windows SharePoint Services that will allow you to obtain usage statistics for WSS Sites. However, this is not the case for Areas in SharePoint Portal Server 2003. There are no built-in hyperlinks in the Admin pages for viewing usage statistics for a give Area.
Does this mean that usage statistics are not available for Areas in SPS 2003? No, it just means that you have to know a backdoor URL to get to the pages that display the stats. Here is the format of the URL:
http://{your portal name}/_layouts/1033/usageDetails.aspx
This URL will take you to a usage statistics page for the Home Area of your portal. (Note: the 1003 is the designator for you language, so it will be different if not using U.S. English).
If you want to look at usage statistics for a Subarea, for instance, News, you would modify the URL to look as follows:
http://{your portal name}/News/_layouts/1033/usageDetails.aspx"
Moojjoo Blog
Wednesday, January 11, 2006
Validating Edits in Grids
When using the Grid Web Controld a lot of times I find myself needing to customize the edit functionality to use validation. The following are the procedures that I use to customize the Data Grid Web Controld.
In order to implement a customization in a datagrid you need to implement a template
<asp:TemplateColumn HeaderText="Gift Amount">
<itemtemplate>
<asp:label id="lblAward_Amount" text='<%# DataBinder.Eval(Container.DataItem, "Gift_Amount", "{0:c}") %>' Runat="server" />
</itemtemplate>
<edititemtemplate>
<asp:textbox ID="txtGift_Amount2" text='<%# DataBinder.Eval(Container.DataItem, "Gift_Amount", "{0:c}") %>' runat="server" />
<asp:regularexpressionvalidator id="Regularexpressionvalidator1" runat="server" ControlToValidate="txtGift_Amount2"
ErrorMessage="Money Values only example 20.00 no commas!" ValidationExpression="\d*.\d{2}"></asp:regularexpressionvalidator></asp:boundcolumn>
</edititemtemplate>
</asp:TemplateColumn>
To access this in the code behind you must using the following:
// This will access the control inside the data grid.
tempGiftAmount = (((TextBox)e.Item.FindControl("txtGift_Amount2")).Text);
In order to implement a customization in a datagrid you need to implement a template
<asp:TemplateColumn HeaderText="Gift Amount">
<itemtemplate>
<asp:label id="lblAward_Amount" text='<%# DataBinder.Eval(Container.DataItem, "Gift_Amount", "{0:c}") %>' Runat="server" />
</itemtemplate>
<edititemtemplate>
<asp:textbox ID="txtGift_Amount2" text='<%# DataBinder.Eval(Container.DataItem, "Gift_Amount", "{0:c}") %>' runat="server" />
<asp:regularexpressionvalidator id="Regularexpressionvalidator1" runat="server" ControlToValidate="txtGift_Amount2"
ErrorMessage="Money Values only example 20.00 no commas!" ValidationExpression="\d*.\d{2}"></asp:regularexpressionvalidator></asp:boundcolumn>
</edititemtemplate>
</asp:TemplateColumn>
To access this in the code behind you must using the following:
// This will access the control inside the data grid.
tempGiftAmount = (((TextBox)e.Item.FindControl("txtGift_Amount2")).Text);
Wednesday, December 28, 2005
Inserting Null Values into SQL Server "FINALLY"
After many months of frustration I finally discovered the code to post null values into SQL Server.
cmd.Parameters.Add("@Emp_EID", System.DBNull.Value);
cmd.Parameters.Add("@Emp_EID", System.DBNull.Value);
Tuesday, November 01, 2005
Validating Multi-line text boxes in ASP.NET using regular expression validator
Validate Multi-line text box in ASP.NET with Regular Expression
^[\s\S]{0,200}$
200 is the Character count
^[\s\S]{0,200}$
200 is the Character count
Subscribe to:
Posts (Atom)