David Yardy PE, MCSD.NET

just give me the source...

Today’s Hot Links

posted @ Thursday, October 30, 2008 8:54 PM | Feedback (0)

1.) XAML Power toys - XAML Power Toys is a Visual Studio 2008 SP1 Multi-AppDomain Add-In that empowers WPF & Silverlight developers while working in the XAML editor.  Its Line of Business form generation tools, Grid tools,  DataGrid and ListView generation really shorten the XAML page layout time. 

2.) Microsoft Chart Controls for .NET Framework 3.5 Released! - Microsoft Chart Controls for .NET Framework 3.5 are now publicly available.

3.) WPF Toolkit – Oct 2008 Release - http://www.codeplex.com/wpf/Release/ProjectReleases.aspx?ReleaseId=15598

4.) Permanent Link- Keep Your Office 2007 Documents Readily Available the Easy Way

image

5.) CodeRush Xpress for C# - Developer Express and Microsoft are proud to announce a new version of CodeRush licensed exclusively for C# developers working in Visual Studio. The new product is called CodeRush Xpress, and it includes a fresh selection of hand-picked features taken from CodeRush and Refactor! Pro.

category: Tools

Sonos Update – still a very cool product

posted @ Thursday, October 30, 2008 6:33 PM | Feedback (0)

Today I received an update to my Sonos system.  Great things abound.

Included in this release is Sonos access to Last.fm, Pandora and 1000’s of radio stations and ‘shows’ from around the world.

Just messing around I entered West Chester, Ohio and got a list of all the local radio stations.  Of course you can enter any city you wish.  Very cool.

 image image

Sonos®, Inc., the leading developer of wireless multi-room music systems for the home, today released Sonos System Software 2.7. Sonos 2.7 delivers a world of music to every room of the house—free of charge—by providing instant, computer-free access to Last.fm and Pandora® personalized radio services, plus more than 15,000 radio stations and shows via Sonos Radio.

The system now provides music from both subscription-based services (Napster®, Rhapsody® and SIRIUS®) and free music services (Last.fm, Pandora and Sonos Radio) right out of the box.

All of these services stream music directly from the Internet to the house so they work even when the computer is turned off – no need to download songs or have a server running.

Sonos’ new Radio guide, powered by RadioTime, lets you tune in to more than 15,000 free Internet radio stations, radio shows and more. You can browse easily for both local and international stations or use Search to find a specific station, show or host. When you find what you want, simply add it to Favorites for your future listening.

Last.fm on Sonos is a free global music service that lets you discover, play and share new songs and artists based on your unique musical tastes — right from any Sonos Controller. After an account is created on Last.fm, Sonos customers can enjoy continuous music streaming all over the house. Simply enter the name of a favorite artist or tag keywords and Last.fm’s unique recommendation system instantly creates a personalized radio station featuring music you’re sure to love. Last.fm on

Sonos also features the capability to scrobble all of the music you play on your Sonos Multi-Room Music System. Every song you listen to on Sonos — whether it’s from your personal music library or a music service like Napster®, Rhapsody®, Pandora®, and of course, Last.fm — is automatically added to your personal music profile. This allows Last.fm to customize your music recommendations and open the doors to even more music discovery, in more rooms of the house.

Pandora, the popular personal radio service is now available for free on Sonos. After creating a free account on Pandora.com, Pandora lets you create and play up to 100 radio stations based on your favorite songs or artists. Using Pandora’s Music Genome Project®, Pandora’s highly-trained musicians analyze songs, one at a time, using close to 400 musical traits including melody, harmony, instrumentation, rhythm, vocals, lyrics, and more to automatically build a station with songs that share interesting musical similarities. With a Sonos Controller in hand, you can rate the music you hear to further refine the station’s playlist on the fly. Play the same Pandora radio station in each room, perfectly synchronized; or, play different stations in different rooms to fit the mood.

Other new features of Sonos System Software 2.7 include:
• Updated Rhapsody support with improved sound quality. Rhapsody now streams at 192 MP3 (versus 128 kbps WMA previously).
• Support for RTSP streaming protocol which allows for expanded Internet Radio coverage.

category: Tools

Telerik Reporting – Really Impressive

posted @ Tuesday, October 14, 2008 9:53 AM | Feedback (0)

My experience with the relatively new Telerik reporting solution has been very positive.  In order to create a report you simply need a 3 dll’s within your solution and a data source. 

The data source can be ANY ADO.NET data source as well as business objects, XML, Web Services etc.  As the data source can be any ADO.NET source the reporting solution works against SQL Server, MySQL, Oracle, Access, OLE DB etc.

I have been a big fan of SQL Reporting Services for quite a while (moving to SQL RS many years ago as I ran from Crystal Reports).  Unlike SQL RS it is a very fast install on local development workstation and nothing on the server is required.  The product is licensed by developer making utilization by the enterprise not dependent on the number of users.  This really works out well in the Internet type environment. 

I found the the designer (within Visual Studio) to be very fast and easier to use that SQL RS.  The drag and drop features and the visual clues are clearly superior than other reporting solutions I have used.

Telerik Reporting supports the most commonly used output formats out-of-the-box: PDF, Excel, RTF, CSV, MHTML, BMP, GIF, JPEG, PNG, TIFF and metafile (EMF).

The Telerik product certainly makes it easy to find the data source, connect within Visual Studio and drag and drop the fields onto the design surface.

More information can be found online at Telerik Reporting

image

SSMS Tools Pack

posted @ Sunday, October 12, 2008 9:48 AM | Feedback (0)

This is a free (please donate) SQL Server Management Studio add-on that is small, easy to install and is packed with some great features.

  • Query Execution History – every sql statement that you run is automatically logged and available at a later time
  • Search Database Data – search through all non-binary columns in every table of the database for a search term.
  • Uppercase/Lowercase Keywords
  • Run one Script on multiple databases
  • Copy execution plan bitmaps to clipboard
  • Generate Insert statements for a single table, the whole database or current resultsets
  • Create, Read, Update and Delete stored procedure generation
  • plus more!

    image

Check it out SSMS Tools Pack

category: SQL Server

Web Site (to do’s and not to do’s)

posted @ Tuesday, October 07, 2008 9:19 PM | Feedback (0)

I read this post by Josiah Cole and have to provide this abbreviated list and less sarcastic version of things to do when designing a web site.

  1. Do not resize the user’s browser window ever.
  2. If your web site does not immediately load on your home page and deliver your message within a couple of second’s your site needs redesign.
  3. Never ask your customer which version they want to visit (high/low bandwidth etc.)
  4. Never develop a web site entirely in Flash.
  5. Do not reinvent the website navigation.  Put the navigation along the top, left or even right. Period.
  6. Print designers do not have the same skill set as web site designers.
  7. Content is King.  Search engines need real text.
  8. Ensure your web site can work in the major browsers FireFox and Internet Explorer.
  9. No flashing items on the web site (no blinking, blipping or barking)
  10. Never put music on the web site.
  11. Use text navigation (not graphics)
  12. A site map with logical sub sections is better than using drop downs.
  13. If your site needs a search engine to find content it’s time to redesign the web site.
  14. The size of the pages is important. Keep it low and small.  50% of American web users do not have broadband.
  15. Do not hide your message or obscure what you want users to do.
  16. Allow individuals to get to the content fast and easily.  Make the content easily visible and provide mechanisms to allow users to jump to items of interest.
  17. If you use video embed your video in Flash within the browser.
  18. Never make your users mouse over a graphic to understand what it is or where it will navigate the user to.
  19. Use new technology sparingly.  The users of the web site will not be as impressed by new technical things as you may be.

Josiah this is a great list of things to do and not do to establish a great web site.  These are certainly words to live by.

category: Asp.Net

Cannot Resolve Collation Conflict

posted @ Monday, October 06, 2008 9:03 PM | Feedback (0)

“Cannot resolve collation conflict for equal to operation” – huh?

When joining fields in different collated databases you can see the above error message.  In my particular case I had two databases with different collations and I was doing a join across the databases on the fields.

The resolution was to add the keywords “COLLATE DATABASE_DEFAULT” near the equal ‘=’ signs.

For example:

SELECT p1.BEEF_1 FROM dbo.PHEN p1 INNER JOIN 
Database2.dbo.PHEN p2 ON p1.BEEF_1 COLLATE DATABASE_DEFAULT =p2.BEEF_1 COLLATE DATABASE_DEFAULT AND
p1.BEEF_2 COLLATE DATABASE_DEFAULT=p2.BEEF_2 COLLATE DATABASE_DEFAULT

Collation can affect where clauses, join predicates, functions and databases.

More about Collation

A Collation encodes the rules governing the proper use of characters for either a language, such as Greek or Polish or an alphabet such as Latin1_General (the Latin alphabet used by western European languages).

Each SQL Server collation specifies three properties: sort order for Unicode data types (nchar, nvarchar, ntext), the sort order for non-Unicode character types (char, varchar and text) and finally the code page used to store non-Unicode character data.  A SQL Server collation defines how the database engine stores and operates on character and Unicode data.

category: SQL Server

75 (Really) Useful JavaScript Techniques +More

posted @ Saturday, September 13, 2008 9:11 AM | Feedback (0)

Generic Collections and Filtering

posted @ Saturday, September 13, 2008 8:51 AM | Feedback (1)

When dealing with collections the common question is how to filter them based on criteria.  The following are a few techniques used to accomplish this.

A delegate is like a function pointer.  A predicate is a method that returns true or false.  In the case of List<T> it is possible to pass it a delegate that is a function that returns true or false.

In the examples below I have base object a generic collection of those objects and am using the FindAll method to return only a few of the objects based on matching criteria.  There are a number of samples, just un-comment the ones of interest.

   23             Persons personList = new Persons();

   24             Person p1 = new Person("Rose", "Bob");

   25             Person p2 = new Person("Rose", "Phil");

   26             Person p3 = new Person("Smith", "Jack");

   27             personList.Add(p1);

   28             personList.Add(p2);

   29             personList.Add(p3);

   30 

   31             //Sample 1 Using Predicate Technique (long form)

   32             //Predicate<Person> filterByLastName;

   33             //PersonFilter filter = new PersonFilter("Rose");

   34             //filterByLastName = new Predicate<Person>(filter.FilterByLastName);

   35             //List<Person> list = personList.FindAll(filterByLastName);

   36 

   37             //Response.Write("Original Collection Count " + personList.Count.ToString() + "<br />");

   38             //Response.Write("Filtered List Count " + list.Count.ToString() + "<br />");

   39 

   40             //// this is a shorter version and uses the RemoveAll method to items

   41             //personList.RemoveAll(filterByLastName);

   42             //Response.Write("After persons removed from the collection Count " + personList.Count.ToString());

   43 

   44             //Sample 2 shortform version

   45             List<Person> list2 = personList.FindAll(new PersonFilter("Rose").FilterByLastName);

   46             Response.Write("Count " + list2.Count.ToString());   47 

   48 

   49             //Sample 3 using lambda expression

   50             //List<Person> list3 = personList.FindAll(

   51             //    r => r.LastName == "Rose");

   52             //Response.Write("Count " + list3.Count.ToString());   53 

   54 

   55             //Sample 4 with arrays

   56             //Person[] personList2 = {

   57             //   new Person("Rose", "Bob"),

   58             //   new Person("Rose", "Phil"),

   59             //   new Person("Smith", "Jack"),

   60             //};

   61             //outputs each person in array

   62             //Array.ForEach(personList2, delegate(Person p)

   63             //{

   64             //    Response.Write(p.LastName + "<br />");

   65             //});

   66 

   67             //outputs each person after findall

   68             //Person[] personList3 = Array.FindAll(personList2,

   69             //    delegate (Person p)

   70             //    {

   71             //        return p.LastName == "Rose";

   72             //    }

   73             //);

   74             //Array.ForEach(personList3, delegate(Person p)

   75             //{

   76             //    Response.Write(p.LastName + "<br />");

   77             //});

The following are simple classes used in the above exmaples

   86     public class Persons : System.Collections.Generic.List<Person> {

   87 

   88     public Persons() {

   89     }

   90 }

   91 

   92 

   93 

   94 public class Person {

   95 

   96     private string _lastName;

   97     private string _firstName;

   98     public string LastName {

   99         get {

  100             return _lastName;

  101         }

  102         set {

  103             _lastName = value;

  104         }

  105     }   

  106     public string FirstName {

  107         get {

  108             return _firstName;

  109         }

  110         set {

  111             _firstName = value;

  112         }

  113     }

  114 

  115     public Person(string lastName, string firstName) {

  116         _lastName = lastName;

  117         _firstName = firstName;

  118     }   

  119 

  120 }

  121 

  122 

  123 public class PersonFilter

  124 {

  125 

  126     private string _match;

  127 

  128     public PersonFilter(string match)

  129     {

  130         _match = match;

  131     }

  132 

  133     public bool FilterByLastName(Person per)

  134     {

  135         if (per.LastName == _match)

  136         {

  137             return true;

  138         }

  139         return false;

  140     }

  141 

  142 

  143     public bool FilterByFirstName(Person per)

  144     {

  145         if (per.FirstName == _match)

  146         {

  147             return true;

  148         }

  149         return false;

  150     }

  151 }

Everyday I Learn - String.Trim vs Trim(string)

posted @ Wednesday, August 20, 2008 2:00 PM | Feedback (0)

String.Trim method - Removes all occurrences of white space characters from the beginning and end of this instance.

Trim(var) method - returns a string with no leading or trailing spaces

Yes, there is a difference between these.  The String.Trim will remove any non-visible characters such as line feeds and carriage returns.

How I came across this was as a result of an odd exception I am getting from an application.  Randomly the NameValueCollection after a postback will have an appended or prepended line feed.

i.e.
hidCustomerID: -1
hidCustomerNo: 0
hidCurrent: True

hidOrderID: -1

When the codebehind tries to ctype(hidCurrent, Boolean) it recieves True or False with additional hidden line feeds.  This is within an ASP.NET 2.x web application.  I have yet to find the source of this problem but I am hoping the String.Trim() will help me out here.  If you have any ideas please let me know what may be going on here.

SQL Server – Find Field Value in Database

posted @ Saturday, August 16, 2008 11:23 AM | Feedback (0)

The following is a SQL Script that can be run in a database to return all tables and columns where a particular value is present.  This can be used for strings or values with a small modification.

This type of thing is great when moving applications/products between servers.  This is certainly a good script to include in your master table to be used over and over.

DECLARE @value VARCHAR(64)
DECLARE @sql VARCHAR(1024)
DECLARE @table VARCHAR(64)
DECLARE @column VARCHAR(64)

SET @value = 'valuehere'

CREATE TABLE #t (
    tablename VARCHAR(64),
    columnname VARCHAR(64)
)

DECLARE TABLES CURSOR
FOR

    SELECT o.name, c.name
    FROM syscolumns c
    INNER JOIN sysobjects o ON c.id = o.id
    WHERE o.type = 'U' AND c.xtype IN (167, 175, 231, 239)
    ORDER BY o.name, c.name

OPEN TABLES

FETCH NEXT FROM TABLES
INTO @table, @column

WHILE @@FETCH_STATUS = 0
BEGIN
    SET @sql = 'IF EXISTS(SELECT NULL FROM [' + @table + '] '
    --SET @sql = @sql + 'WHERE RTRIM(LTRIM([' + @column + '])) = ''' + @value + ''') '
    SET @sql = @sql + 'WHERE RTRIM(LTRIM([' + @column + '])) LIKE ''%' + @value + '%'') '
    SET @sql = @sql + 'INSERT INTO #t VALUES (''' + @table + ''', '''
    SET @sql = @sql + @column + ''')'

    EXEC(@sql)

    FETCH NEXT FROM TABLES
    INTO @table, @column
END

CLOSE TABLES
DEALLOCATE TABLES

SELECT *
FROM #t

DROP TABLE #t

One Hundred Pushups – oh ya for real

posted @ Sunday, August 10, 2008 10:25 PM | Feedback (1)

Back from vacation and back into the routine of work and I am ready to get in shape.  City living and a ‘developers’ lifestyle has left my body in rough shape.

My wife and I recently invested in some home exercise equipment and I assembled it today.  I was scanning some blogs this evening and came across a couple of other individuals in similar modes.  Rob Conery posted about the onehundredpushups ‘program’ and thought this is good timing.

So my goal is to do my time (2 – 30 minute sessions) on our home equipment daily as well as the 100 pushup plan.  I did the initial test and with sore arms I completing this post.

For my friends out there, if you also get involved and do the program with me (and complete it) I will buy and have delivered your choice of merchandise from their site.  Let me know if this sounds too good. I am serious.

I start day 1 tomorrow.  Let me know if you like my offer.

Developer Humour – Real Technology Heroes

posted @ Saturday, August 09, 2008 11:11 PM | Feedback (0)

As you are listening to these realize that it is impossible not to think of someone you know.  That is just funny.

It Works on My Computer Guy - “dozens of dependencies”, “replace the production server with your development pc” - “all in a days work”

Overly Complicated App Guy – “18 abstraction layers”, “what the hell were you thinking”

Mr “I can build your own version of asp.net better than Microsoft” Guy – very very funny!!

SQL Server 2008 Installation – not so quick

posted @ Thursday, August 07, 2008 11:29 PM | Feedback (0)

Before you rush to download SQL 2008 you may want to read the following KB article which warns that Visual Studio 2008 SP1 ‘may be required’ for SQL Server 2008 installations KB956139 (found here)

”Because certain SQL Server 2008 features install components that are also part of the release version of Visual Studio 2008 SP1, SQL Server 2008 requires Visual Studio 2008 with SP1. If Visual Studio 2008 without a service pack is installed instead, it may not work correctly after you install SQL Server 2008.“

Currently Visual Studio 2008 Service Pack 1 (SP1) is in beta at the current time.  I do not know the expected delivery of SP1 but should be soon (hang tight).

category: SQL Server

Internet Explorer Default Source Editor (View Source)

posted @ Tuesday, August 05, 2008 9:50 AM | Feedback (2)

With a new laptop there have been quite a few things I have had to configure again.  One of those is the default source view application related to Internet Explorer.  The following instructions apply to Windows XP (not sure yet on Vista).

I thought by changing the HTML Editor within IE (Tools - Internet Options - Programs) would have fixed the problem.  Nope, that did not work.  The following however does work nicely.

Run Regedit

HKEY_LOCAL_MACHINE
|- Software
|-- Microsoft
|--- Internet Explorer
|---- View Source Editor
|----- Editor Name (Default) = "C:\Program Files\TextPad 4\TextPad.exe"

If 'View Source Editor' doesn't exist you will need to create then create the key 'Editor Name' and set the value to the path to the editor that you are going to use.

I know other individuals like Notepad2 or SlickEdit

What editor's do you use?

category: Tools

Web Site Complete - Content Missing?

posted @ Sunday, July 13, 2008 9:44 PM | Feedback (0)

Ever have trouble getting content for web projects.  Pepi Ronalds wrote up a very nice article describing the pains related to getting content (type) for web related projects.  Check it out here.