Friday, August 3, 2012

keep a form from posting with jQuery in the name of validations without putting something goofy and old school inline in the form tag

<script type="text/javascript" src="Scripts/jquery-1.5.1.js"></script>
<script type="text/javascript">
   $("form").submit(function () {
      var poc = $("#ctl00_LayoutWorkspace_POC").val();
      var title = $("#ctl00_LayoutWorkspace_ProjectTitle").val();
      if (poc == "") {
         $("#poc_warning").attr('style', 'color:Red;');
      } else {
         $("#poc_warning").attr('style', 'color:Red;display:none;');
      }
      if (title == "") {
         $("#title_warning").attr('style', 'color:Red;');
      } else {
         $("#title_warning").attr('style', 'color:Red;display:none;');
      }
      if (poc == "" || title == "") {
         return false;
      } else {
         return true;
      }
   });
</script>

some elementary asp:dropdownlist manipulations

This will add an empty ListItem at the end of an asp:dropdownlist.

POC.DataBind();
POC.Items.Add(new ListItem("",""));

 
 

This will add an empty ListItem at the beginning of an asp:dropdownlist and make it the default selection.

POC.Items.Add(new ListItem("",""));
POC.Items.Insert(0, new ListItem("", ""));
POC.Items[0].Selected = true;

Thursday, August 2, 2012

Twitter Political Index

Twindex, the Twitter Political Index, is new as of today. CNN.com offers "Twindex is a joint effort between Twitter, Topsy, and two polling groups, the left-leaning Mellman Group and the more conservative NorthStar Opinion Research. The collective goal is to dive into Twitter's deep trove of data, and pull up insights faster than Gallup and other traditional polling companies. Expect to see Twindex results referenced in all political news and commentary as we head into the presidential election." It should be superior to merely http://www.realclearpolitics.com/epolls/latest_polls/

Wednesday, August 1, 2012

rowspan is akin to colspan

http://www.htmlcodetutorial.com/tables/index_famsupp_30.html shows it off.

C# Operators

http://msdn.microsoft.com/en-us/library/a1sway8w%28v=vs.71%29.aspx is a pretty good cheat sheet on C# operators! Meh.

left, inner, and right joins in SQL

I have some data for this schema in which Vehicle is a child of RegisteredDriver and a RegisteredDriver has zero to n Vehicles in a one-to-many relationship. A Vehicle always has one RegisteredDriver.

  • SELECT * FROM RegisteredDriver returns 400 records
  • SELECT * FROM Vehicle returns 573 records

 
 

SELECT *
FROM RegisteredDriver AS man
LEFT JOIN Vehicle AS car
ON man.RegisteredDriverId = car.RegisteredDriverId

...returns 676 rows including those for which a RegisteredDriver has no Vehicle (there are 103 of these) and including one row for each of the 573 Vehicle records.

 
 

SELECT *
FROM RegisteredDriver AS man
INNER JOIN Vehicle AS car
ON man.RegisteredDriverId = car.RegisteredDriverId

...returns 573 rows, one row for each of the 573 Vehicle records.

 
 

SELECT *
FROM RegisteredDriver AS man
RIGHT JOIN Vehicle AS car
ON man.RegisteredDriverId = car.RegisteredDriverId

...returns 573 rows, one row for each of the 573 Vehicle records. If a Vehicle could be without a RegisteredDriver then additional records for such circumstances would be included in this record set.

a talk I gave yesterday on AJAX with MVC

&

...offer the audio for a talk I gave yesterday on AJAX with MVC while http://www.tomjaeschke.com/ajax.rar has my "slides" in the form of an ASP.NET MVC3 project which should just run in VS2010 without issue. (This code will not be kept available forever.)

from yesterday's talk on Twitpic