Wednesday, May 11, 2011

RSS date sort with pubdate

Problems with RSS date sorting could be caused by the formatting of the date.
Use the format below:
<pubdate>startdate.ToString("o")</pubdate>

This will produce the format within the feed which will sort appropriately.
<pubdate>2011-04-28T00:00:00.0000000</pubdate>

Friday, April 8, 2011

Using hidden field to confirm status before postback

Declare in page
<input type="hidden" id="confirmed" name="confirmed" value="">

Set up javascript validation
function SelectBtn_Click(src, e)
{
  var f = document.MyForm;
  var v = f.NumberOfTxt.value;

    if (IsStringOfDigits(v) && confirm("Are you sure you want to   select " + v + "?\n If \"Yes\" click OK, otherwise click Cancel."))
  {
    document.MyForm.confirmed.value = "Y";
    event.returnValue = true;
    return true;
  }
  else
  {
    document.MyForm.confirmed.value = "";
    event.returnValue = false;
    return false;
  }
}

Set attribute in code behind
this.SelectBtn.Attributes["onclick"] = "return SelectBtn_Click(this, event);";

In postback, check the hidden value
"Y".Equals(Request.Form["confirmed"])

Tuesday, March 29, 2011

FTP from command prompt

C:\>ftp ftp.server.com
Connected to ftp.server.com.
220 You have connected to ftp.server.com
User (ftp.server.com:(none)): username
331 User name okay, need password.
Password:
230 User logged in, proceed.
ftp> dir
200 PORT Command successful.
150 Opening ASCII mode data connection for /bin/ls.
drw-rw-rw- 1 user group 0 Feb 8 16:10 .
drw-rw-rw- 1 user group 0 Feb 8 16:10 ..
drw-rw-rw- 1 user group 0 Oct 25 10:00 blah
drw-rw-rw- 1 user group 0 Oct 21 12:17 blah2
4 Transfer complete.
ftp: 2987 bytes received in 0.25Seconds 11.95Kbytes/sec.
ftp> cd blah2
250 Directory changed to /blah2
ftp> dir
200 PORT Command successful.
150 Opening ASCII mode data connection for /bin/ls.
drw-rw-rw- 1 user group 0 Feb 8 16:22 .
drw-rw-rw- 1 user group 0 Feb 8 16:22 ..
-rw-rw-rw- 1 user group 13824 Feb 8 16:22 test spreadsheet only.xls

226 Transfer complete.
ftp: 199 bytes received in 0.00Seconds 199000.00Kbytes/sec.
ftp> put C:\LocalMachine\Applications\ConsolidatedData.xls
200 PORT Command successful.
150 Opening ASCII mode data connection for consolidateddata.xls.
226 Transfer complete.
ftp: 640512 bytes sent in 6.38Seconds 100.47Kbytes/sec.
ftp> dir
200 PORT Command successful.
150 Opening ASCII mode data connection for /bin/ls.
drw-rw-rw- 1 user group 0 Feb 9 09:37 .
drw-rw-rw- 1 user group 0 Feb 9 09:37 ..
-rw-rw-rw- 1 user group 640512 Feb 9 09:37 consolidateddata.xls
-rw-rw-rw- 1 user group 13824 Feb 8 16:22 test spreadsheet only.xls

226 Transfer complete.
ftp: 276 bytes received in 0.00Seconds 276000.00Kbytes/sec.
ftp>


* Note: To send a link directly to ftp with the credentials within the link, it should be in the form: ftp://blah:pa3sw0rd@ftp.server.com

Wednesday, March 9, 2011

SQL detect table data change with Update Trigger

ALTER TRIGGER [dbo].[Table_OnUpdate] ON [dbo].[Table]
FOR UPDATE
AS

DECLARE @firstname_changed BIT
DECLARE @lastname_changed BIT
DECLARE @middlename_changed BIT

SELECT
@firstname_changed = CASE WHEN i.firstname <> d.firstname THEN 1 ELSE 0 END,
@lastname_changed = CASE WHEN i.lastname <> d.lastname THEN 1 ELSE 0 END,
@middlename_changed = CASE WHEN i.middlename <> d.middlename THEN 1 ELSE 0 END
FROM inserted i INNER JOIN deleted d ON i.tableid=d.tableid

IF ((@firstname_changed = 1) OR (@lastname_changed = 1))
BEGIN
--Table data changed
END

Friday, January 21, 2011

Parser Error Message: Ambiguous match found.

This error was being received after converting a project from .NET 1.1 to 3.5.
The issue is most likely due to two variable names in code behind differing only by case.

Here are two links for further research if needed:
Peter Johnson's blog (real name??)
Eran Sandler's post.

Monday, January 10, 2011

Assembly's manifest definition does not match the assembly reference

This error can occur if an attempt is made to reference a different version of a .dll and the previous .dll is being imported during compilation.

To fix this issue:
  • Bring up the properties of the project having the problem
  • Click on the "Reference Paths" tab
  • Verify that the reference path defined is the actual path of the .dll that should be referenced.

Friday, December 17, 2010

Update the result of an inner join from a SQL table

UPDATE @result
SET selectiondate=eventdatetime
FROM @result r
INNER JOIN (
  SELECT r.id, MAX(h.EventDateTime) eventdatetime
  FROM @result r
  LEFT JOIN statehistory h WITH (NOLOCK) ON h.id = r.id AND h.eventid = @CONST_SelectedEvent
  GROUP BY r.id
) d ON d.id=r.id