<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-29123587</id><updated>2012-01-25T06:41:57.209-08:00</updated><title type='text'>Brad's Programming Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>31</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-29123587.post-5711174275374218615</id><published>2012-01-25T06:38:00.000-08:00</published><updated>2012-01-25T06:41:57.223-08:00</updated><title type='text'></title><content type='html'>/*I got annoyed always refreshing my FogBugz inbox to see new issues.  FogBugz comes with a feature to e-mail you when a ticket is assigned to you.  However new ticket don't go to me, they go to my boss first.  And he like us to check the box periodically since he is always busy.  So this checks the box for me so I don't have to do it.  It creates a colored notification icon, and the colors change whenever a new ticket arrives.  I could easily be adapted to a variety of other situations.*/&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Data.SqlClient;&lt;br /&gt;using System.Drawing;&lt;br /&gt;using System.Drawing.Imaging;&lt;br /&gt;using System.Runtime.InteropServices;&lt;br /&gt;using System.Windows.Forms;&lt;br /&gt;&lt;br /&gt;namespace BugColor&lt;br /&gt;{&lt;br /&gt;    static class Program&lt;br /&gt;    {&lt;br /&gt;        private static NotifyIcon ni;&lt;br /&gt;        private static Timer timer;&lt;br /&gt;        private static int count;&lt;br /&gt;        &lt;br /&gt;        private static void menu_Close(object sender, EventArgs e)&lt;br /&gt;        {&lt;br /&gt;            ni.Visible = false;&lt;br /&gt;            Application.Exit();&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        public static Color HSVtoRGB(float h, float s, float v)&lt;br /&gt;        //see http://www.cs.rit.edu/~ncs/color/t_convert.html&lt;br /&gt;        {&lt;br /&gt;            if (0 &gt; h || 360 &lt; h)&lt;br /&gt;            {&lt;br /&gt;                throw new ArgumentOutOfRangeException(&lt;br /&gt;                    "h",&lt;br /&gt;                    h,&lt;br /&gt;                    "Value must be within a range of 0 - 360.");&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            if (0 &gt; s || 1 &lt; s)&lt;br /&gt;            {&lt;br /&gt;                throw new ArgumentOutOfRangeException(&lt;br /&gt;                    "s",&lt;br /&gt;                    s,&lt;br /&gt;                    "Value must be within a range of 0 - 1.");&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            if (0 &gt; v || 1 &lt; v)&lt;br /&gt;            {&lt;br /&gt;                throw new ArgumentOutOfRangeException(&lt;br /&gt;                    "v",&lt;br /&gt;                    v,&lt;br /&gt;                    "Value must be within a range of 0 - 1.");&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            float r, g, b;&lt;br /&gt;&lt;br /&gt;            if (s == 0)&lt;br /&gt;            {&lt;br /&gt;                // achromatic (grey)&lt;br /&gt;                r = g = b = v;&lt;br /&gt;            }&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;                h /= 60; // sector 0 to 5&lt;br /&gt;                int i = (int)(Math.Floor(h));&lt;br /&gt;                float f = h - i;&lt;br /&gt;                float p = v * (1 - s);&lt;br /&gt;                float q = v * (1 - s * f);&lt;br /&gt;                float t = v * (1 - s * (1 - f));&lt;br /&gt;&lt;br /&gt;                switch (i)&lt;br /&gt;                {&lt;br /&gt;                    case 0:&lt;br /&gt;                        r = v;&lt;br /&gt;                        g = t;&lt;br /&gt;                        b = p;&lt;br /&gt;                        break;&lt;br /&gt;                    case 1:&lt;br /&gt;                        r = q;&lt;br /&gt;                        g = v;&lt;br /&gt;                        b = p;&lt;br /&gt;                        break;&lt;br /&gt;                    case 2:&lt;br /&gt;                        r = p;&lt;br /&gt;                        g = v;&lt;br /&gt;                        b = t;&lt;br /&gt;                        break;&lt;br /&gt;                    case 3:&lt;br /&gt;                        r = p;&lt;br /&gt;                        g = q;&lt;br /&gt;                        b = v;&lt;br /&gt;                        break;&lt;br /&gt;                    case 4:&lt;br /&gt;                        r = t;&lt;br /&gt;                        g = p;&lt;br /&gt;                        b = v;&lt;br /&gt;                        break;&lt;br /&gt;                    default: // case 5:&lt;br /&gt;                        r = v;&lt;br /&gt;                        g = p;&lt;br /&gt;                        b = q;&lt;br /&gt;                        break;&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            return Color.FromArgb(&lt;br /&gt;                Convert.ToInt32(r * 255),&lt;br /&gt;                Convert.ToInt32(g * 255),&lt;br /&gt;                Convert.ToInt32(b * 255));&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        [DllImport("user32.dll", EntryPoint = "DestroyIcon")]&lt;br /&gt;        static extern bool DestroyIcon(IntPtr hIcon);&lt;br /&gt;        //See http://social.msdn.microsoft.com/Forums/en/winforms/thread/3dd02621-4d7c-470d-b16b-610b11f8213c&lt;br /&gt;&lt;br /&gt;        private static void timer1_Tick(object sender, EventArgs e)&lt;br /&gt;        {&lt;br /&gt;            var con = new SqlConnection("Data Source=OPTIMUS-PRIME;Initial Catalog=fogbugz;Trusted_Connection=yes");&lt;br /&gt;            var cmd = new SqlCommand("SELECT MAX(ixBug) FROM Bug", con);&lt;br /&gt;            SolidBrush brl, brc, brr;&lt;br /&gt;            const float inc = 37f;&lt;br /&gt;&lt;br /&gt;            try&lt;br /&gt;            {&lt;br /&gt;                con.Open();&lt;br /&gt;                int nextCount = (int) cmd.ExecuteScalar();&lt;br /&gt;                con.Close();&lt;br /&gt;                if (nextCount == count)&lt;br /&gt;                    return;&lt;br /&gt;                count = nextCount;&lt;br /&gt;                brl = new SolidBrush(HSVtoRGB(((count - 1) * inc) % 360f, 1, 1));&lt;br /&gt;                brc = new SolidBrush(HSVtoRGB((count * inc) % 360f, 1, 1));&lt;br /&gt;                brr = new SolidBrush(HSVtoRGB(((count + 1) * inc) % 360f, 1, 1));&lt;br /&gt;            }&lt;br /&gt;            catch(SqlException)&lt;br /&gt;            {&lt;br /&gt;                brl = brc = brr = new SolidBrush(Color.Black);&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            var bmp = ni.Icon.ToBitmap();&lt;br /&gt;            var g = Graphics.FromImage(bmp);&lt;br /&gt;            g.FillRectangle(brl, 0, 0, 5, 16);&lt;br /&gt;            g.FillRectangle(brc, 5, 0, 6, 16);&lt;br /&gt;            g.FillRectangle(brr, 11, 0, 5, 16);&lt;br /&gt;            brl.Dispose();&lt;br /&gt;            brc.Dispose();&lt;br /&gt;            brr.Dispose();&lt;br /&gt;            //ni.Icon.Dispose(); Does not destroy the icon, bug in .NET Framework&lt;br /&gt;            DestroyIcon(ni.Icon.Handle);&lt;br /&gt;            var h = bmp.GetHicon();&lt;br /&gt;            ni.Icon = Icon.FromHandle(h);&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        /// &lt;summary&gt;&lt;br /&gt;        /// The main entry point for the application.&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        [STAThread]&lt;br /&gt;        static void Main()&lt;br /&gt;        {&lt;br /&gt;            Application.EnableVisualStyles();&lt;br /&gt;            Application.SetCompatibleTextRenderingDefault(false);&lt;br /&gt;&lt;br /&gt;            var bmp = new Bitmap(16, 16, PixelFormat.Format24bppRgb);&lt;br /&gt;            ni = new NotifyIcon&lt;br /&gt;            {&lt;br /&gt;                Icon = Icon.FromHandle(bmp.GetHicon()),&lt;br /&gt;                Visible = true,&lt;br /&gt;                ContextMenu = new ContextMenu()&lt;br /&gt;            };&lt;br /&gt;            ni.ContextMenu.MenuItems.Add("Close", menu_Close);&lt;br /&gt;&lt;br /&gt;            timer = new Timer {Interval = 1000};&lt;br /&gt;            timer.Tick += timer1_Tick;&lt;br /&gt;            timer.Enabled = true;&lt;br /&gt;        &lt;br /&gt;            Application.Run();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-5711174275374218615?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/5711174275374218615/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=5711174275374218615' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/5711174275374218615'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/5711174275374218615'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2012/01/i-got-annoyed-always-refreshing-my.html' title=''/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29123587.post-2469904342187814254</id><published>2011-09-12T11:01:00.000-07:00</published><updated>2011-09-12T11:11:23.804-07:00</updated><title type='text'>C#, almost replacing C++</title><content type='html'>Here is an article with information I was just looking for in my blog:&lt;br /&gt;http://www.codeproject.com/KB/cs/genericnumerics.aspx&lt;br /&gt;&lt;br /&gt;I guess I never blogged anything on this, because someone else wrote a good article first.  This is one of the most frustrating things about C#, and now I will be able to find it next time. &lt;br /&gt;&lt;br /&gt;If C# had generics that supported primitives in a way that makes sense, I would use C# for 90% of the code I write in C++.  C# has a lot more useful stuff built in, I usually can accomplish the same thing with less code, and for almost anything, the memory manager is better.  Yet well after 1 decade, they can't fix problems with the simplest arithmetic, so I am stuck in C++ land for anything that does anything complicated with numbers.  And no, Java's generics are not better.&lt;br /&gt;&lt;br /&gt;While I am ranting, multidimensional array access (especially return and passing arrays as a parameter) stinks.  The C# way makes sense, but I can understand C++ not wanting all that overhead.  Still, by now, you'd think they'd have a way of making this easy to write and fast for performance - not they I have any idea how to do that.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-2469904342187814254?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/2469904342187814254/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=2469904342187814254' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/2469904342187814254'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/2469904342187814254'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2011/09/c-almost-replacing-c.html' title='C#, almost replacing C++'/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29123587.post-3273168143313274068</id><published>2009-12-01T12:49:00.000-08:00</published><updated>2009-12-01T12:50:01.317-08:00</updated><title type='text'>SQLite</title><content type='html'>I used a Sqlite database for a school project last night.  It is more a substitute for Excel or Access than for SQL Server, and I am not sure how we would use it here, but it is generally useful, and something I wish I learned about years ago.&lt;br /&gt;&lt;br /&gt;Some highlights:&lt;br /&gt;1) Free, cross platform and easy to install.  One .exe file for a Windows machine, or apt-get for Debian based Linux.&lt;br /&gt;2) You can copy/backup/move a database as 1 file (like Excel and Access, unlike SQL Server).javascript:void(0)&lt;br /&gt;3) Open source.&lt;br /&gt;4) Command line interface only (no GUI).  I found something called “Sqlite browser” but am not happy with it.&lt;br /&gt;&lt;br /&gt;It has a steep but short learning curve:&lt;br /&gt;1) If you want to work with a database file ‘mydata.db’, you type ‘sqlite mydata.db’ to get started.  I am not sure what just typing ‘sqlite’ does, but it starts the program, and then you really cannot do anything until you exit (or at least I haven’t figured out how to do anything useful).&lt;br /&gt;2) Creating a new database is similar, ‘sqlite filename.db’, where filename.db is the file name you want to use.&lt;br /&gt;3) You can exit with ‘.exit’&lt;br /&gt;4) You cannot use ‘SELECT TOP 100 * FROM FileMain’, you have to use ‘SELECT * FROM FileMain LIMIT 100;’&lt;br /&gt;5) The command line interface allows line breaks, which is useful for large queries.  You need to type a ‘;’ to process the line.  This can be really frustrating at first, since if you have anything on the line, and you type .help or .exit and hit enter, you just get a line break, and you end up having to CTL-Alt-Delete the program unless you can figure out you need to type a ‘;’&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-3273168143313274068?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/3273168143313274068/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=3273168143313274068' title='59 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/3273168143313274068'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/3273168143313274068'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2009/12/sqlite.html' title='SQLite'/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>59</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29123587.post-4121053529777964653</id><published>2009-09-16T06:49:00.000-07:00</published><updated>2009-09-16T06:50:49.356-07:00</updated><title type='text'>Slow Rollback, Reboot fixed, why?</title><content type='html'>I posted this on SQL Server Central, where it will get more attention than it will here, but wanted to put a copy here as well.&lt;br /&gt;&lt;br /&gt;Today I ran an 'emergency' script to fix a problem in production. The script does 40,000 updates, each of which fires a trigger that does 1 insert. I should have disabled the trigger first, but didn't (mistake).&lt;br /&gt;&lt;br /&gt;This is a very slow (Pentium 4) server, but it has 2 CPUs. MaxDOP is set to 1 (disabling parallel execution), and hyperthreading is turned off in the BIOS.&lt;br /&gt;&lt;br /&gt;After 5 minutes, I realized my mistake not dropping the trigger, and canceled my job, effectively rolling back the changes. I waited another 15 minutes, and as expected the CPU usage of the machine was at 50% during this time. I later found out it was not 1 CPU being used 100% as I expected, but both CPUs actually were used 50%, which I still don't understand. During this time, no one was able to use SQL Server on this machine to do anything, which was also unexpected.&lt;br /&gt;&lt;br /&gt;I suggested rebooting, saying SQL would continue doing what it is doing after it rebooted, so logically this makes no sense, but I hate just waiting and not doing anything. After the reboot, I expected the database to take forever to recover, and I came back online almost instantly.&lt;br /&gt;&lt;br /&gt;Can anyone tell me what happened and why?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-4121053529777964653?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/4121053529777964653/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=4121053529777964653' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/4121053529777964653'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/4121053529777964653'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2009/09/slow-rollback-reboot-fixed-why.html' title='Slow Rollback, Reboot fixed, why?'/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29123587.post-3049323742437310323</id><published>2009-07-21T09:39:00.000-07:00</published><updated>2009-07-21T10:08:48.513-07:00</updated><title type='text'>SQL Server Dependencies are Fixed! (almost)</title><content type='html'>If you look at any good article on what is new in SQL Server 2008, buried at the bottom under a bunch of nonsense about spatial data types (I still haven't found anything I cannot do just as with standard data types, in the unlikely event I will ever need to) and other bell's and whistles, it is possible they will mention dependency tracking has changed.  With the possible exception of the new date data types (again, not at the top of most lists of changes) this is the biggest improvement vs. SQL 2005.&lt;br /&gt;&lt;br /&gt;For some strange reason, SQL Server's syntax always let you reference a non-existent table without giving you any warning, even though referencing a non-existent column in an existing table gave you a syntax error.  Both of these should have been warnings, but should let you create your stored proc anyway, in case the non-existent reference exists at runtime.&lt;br /&gt;&lt;br /&gt;What SQL 2008 fixed is it keeps track of the missing dependency - as opposed to early versions which just ignored it, and did not update a reference to it.  SQL 2008 is still broken - references can still get out of sync.  Before doing anything important, you can updated all the dependencies with:&lt;br /&gt;&lt;br /&gt;SELECT&lt;br /&gt; 'EXEC sp_refreshsqlmodule N''' + s.[name] + '.' + o.name + ''';' AS [stmt]&lt;br /&gt;  , s.[name] AS [schema_name] -- schema name&lt;br /&gt;  , o.[name] AS [object_name] -- procedure, function, or view name&lt;br /&gt;    , o.[type] AS [object_type] -- type (P, FN, IF, TF, or V)&lt;br /&gt;FROM sys.objects o&lt;br /&gt;INNER JOIN sys.schemas s ON o.[schema_id] = s.[schema_id]&lt;br /&gt;WHERE o.[type] IN ('FN','IF','TF','P','V')&lt;br /&gt;ORDER BY&lt;br /&gt; o.[type]&lt;br /&gt;    , s.[name]&lt;br /&gt;  , o.[name]&lt;br /&gt; &lt;br /&gt;I apologize if you wrote this script - I did grab this from the Internet without noting the author.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You can then view all your "missing" dependencies by running:&lt;br /&gt;&lt;br /&gt;SELECT s.name [schema], o.name, d.referenced_entity_name&lt;br /&gt;FROM sys.sql_expression_dependencies d&lt;br /&gt; INNER JOIN sys.objects o ON d.referencing_id = o.object_id&lt;br /&gt; INNER JOIN sys.schemas s ON o.schema_id = s.schema_id&lt;br /&gt;WHERE referenced_id IS NULL&lt;br /&gt;ORDER BY s.name, o.name, d.referenced_entity_name&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This is still broken in one more import way - if you have code like:&lt;br /&gt;&lt;br /&gt;UPDATE T&lt;br /&gt;SET Price = Price + 1&lt;br /&gt;FROM Table1 T&lt;br /&gt;&lt;br /&gt;You will get an unresolved reference to an unknown object 'T' rather than a correct reference to Table1.  I believe you can change any update query to a syntax that will work correctly, and you can easily find all the places you used the "problematic" sytnax with the above query.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If you aren't entrenched in SQL, this change may sound trivial, but I have had problems with dependencies since SQL Server 7, and having this fixed is by far the biggest reason for me to use SQL 2008.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-3049323742437310323?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/3049323742437310323/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=3049323742437310323' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/3049323742437310323'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/3049323742437310323'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2009/07/sql-server-dependencies-are-fixed.html' title='SQL Server Dependencies are Fixed! (almost)'/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29123587.post-6183672907240445133</id><published>2009-01-12T06:12:00.000-08:00</published><updated>2009-01-12T06:27:43.682-08:00</updated><title type='text'>Another SQL Bug</title><content type='html'>In our development environment, I found no one could use SQL Management Studio to update data.&lt;br /&gt;&lt;br /&gt;We would get:&lt;br /&gt;Data has changed since the Results pane was last retrieved. Do you want to save your changes now?&lt;br /&gt;(Optimistic Concurrency Control Error)&lt;br /&gt;Click Yes to commit your changes to database anyway.&lt;br /&gt;Click No to discard your change and retrieve the current data for this row.&lt;br /&gt;Click Cancel to continue editing. &lt;br /&gt;&lt;br /&gt;And then get:&lt;br /&gt;No row was updated.&lt;br /&gt;The data in row X was not committed.&lt;br /&gt;Error Source: Microsoft.VisualStudio.DataTools.&lt;br /&gt;Error Message: The updated row has changed or been deleted.&lt;br /&gt;Correct the errors and retry or press ESC to cancel the change(s). &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;A search of google and MSDN revealed a lot of people with similar errors, but they had no primary key on the table, or actually had other people change the data.  There were also a lot of "why do you want to do this" posts - I really hate it when someone uses that as a reply to a technical question.&lt;br /&gt;&lt;br /&gt;Then I found:&lt;br /&gt;http://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=289535&lt;br /&gt;&lt;br /&gt;I hate having SET NOCOUNT ON, SET NOCOUNT OFF in each of our 1000+ stored procedures, and worse, people do not set these consistently.  So I set SET NOCOUNT ON by default.  Apparently the team that wrote management studio just assumed NOCOUNT would always be false, and relied on the return values without even checking to see if it was on.  Worse, they didn't give me anything in the GUI to use any connection settings other than the default.  So if you use SQL Server 2005, you can either get the reasonable default setting of NOCOUNT to ON OR use Management Studio to enter data.  You cannot do both.  &lt;br /&gt;&lt;br /&gt;I am really hoping this is fixed in SQL 2008, which I haven't had much time to try.  Given the virtually unlimited money and years of time Microsoft invested, these things annoy me.&lt;br /&gt;&lt;br /&gt;BTW - NOCOUNT=TRUE is like a double negative - this is a bad name.  Why not SET COUNT=OFF insead of SET NOCOUNT=ON?&lt;br /&gt;&lt;br /&gt;Both of my coworkers ran into this issue, but ignored it instead of figuring it out.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-6183672907240445133?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/6183672907240445133/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=6183672907240445133' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/6183672907240445133'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/6183672907240445133'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2009/01/another-sql-bug.html' title='Another SQL Bug'/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29123587.post-4440386305429392255</id><published>2008-12-14T13:51:00.000-08:00</published><updated>2008-12-14T14:33:40.134-08:00</updated><title type='text'>Science Cafe</title><content type='html'>Monday, I went to the Science cafe (http://www.greatlakesbrewing.com/communityEvents.php?action=viewEvent&amp;calendar_id=00000084) which had a presentation by Dr. Jerrold Vitek and Dr. Jay Alberts from The Cleveland Clinic.  They did a community presentation on deep brain stimulation, which can be effective for diseases like Parkinson's.  Some of the things I found fascinating:&lt;br /&gt;&lt;br /&gt;1) This and related research was started relatively recently, by randomly lesioning and/or stimulating random parts of the brain.  While this technique does have dramatic improvements for some patients, it was essentially created by trial and error with little regard for the theory of what effect the lesioning or stimulating actually had on the brain.&lt;br /&gt;&lt;br /&gt;2)  One of the presenters (I am still not sure which) had a Physiology degree. I was surprised to hear that advances in our understanding of how the brain works since this technique has started haven't helped much.  He said better understanding of what structures do what things has given them ideas for a starting point, but again, progress is largely by trial and error.&lt;br /&gt;&lt;br /&gt;3) Lesioning and stimulating seem to have similar effects.  Obviously, stimulating is less permanent, and allows better fine tuning.&lt;br /&gt;&lt;br /&gt;4)  A friend and former coworker had this procedure done, with good results so far, probably by the people doing the presentation.&lt;br /&gt;&lt;br /&gt;5)  The effect of stimulating is not always immediate.  Sometimes turning on/off the stimulation changes the problem like a light switch.  In other cases, it can take days before the effect starts, and the effect can last for weeks weeks after stimulation stops.&lt;br /&gt;&lt;br /&gt;6)  Bilateral stimulation seems to result in a drop of cognitive ability, where unilateral does not.  The research gave a vague answer when I asked why, and seemed to be much more interested in helping patients avoid the effect then explaining why this happens.&lt;br /&gt;&lt;br /&gt;7) The researchers complained about lack of funding when asked one question about further research.  I doubt leading researchers at The Cleveland Clinic are not worried about where their next meal comes from, but still don't understand how we can spend nearly 20 billion/year on NASA exploring outer space, but have little to no funding to understand something far more interesting and relevant.  I follow NASA a lot, and their money is far better spent than much of what our government does, but they are an easy target having a large budget publicly available.&lt;br /&gt;&lt;br /&gt;8) At least in one case, an insurance company paid for probe's to be implanted in someone's head, but denied the cost of the device to do the stimulation.  I guess they thought wearing the probes would somehow help.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-4440386305429392255?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/4440386305429392255/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=4440386305429392255' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/4440386305429392255'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/4440386305429392255'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2008/12/science-cafe.html' title='Science Cafe'/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29123587.post-7330830068416354661</id><published>2008-09-23T11:00:00.000-07:00</published><updated>2008-09-23T11:04:31.818-07:00</updated><title type='text'>GAC</title><content type='html'>If I am on a computer named "box1" and type "\\box2\c$\WINDOWS\assembly" into my run directory and see a GAC window, you might assume I'd be looking at the GAC on box2.  You'd be wrong.&lt;br /&gt;&lt;br /&gt;Pulling up this directory on in windows explorer causes Windows to display the contents of the GAC on the local machine instead of the actual directory's contents.  Browsing to this folder over the network does the same thing - show the GAC of the LOCAL machine.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-7330830068416354661?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/7330830068416354661/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=7330830068416354661' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/7330830068416354661'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/7330830068416354661'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2008/09/gac.html' title='GAC'/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29123587.post-8682375274210600636</id><published>2008-09-12T14:46:00.000-07:00</published><updated>2008-09-12T14:54:50.604-07:00</updated><title type='text'>Carnegie Mellon</title><content type='html'>I can finally finish my application to earn a PhD at Carnegie Mellon.  I am posting this entry since they ask for a homepage on my application, and I don't even have anything yet on this blog related to what I want to work on.  This is not because I haven't been reading and working on anything related to my PhD, or I'd rather write about business software, just that this blog has been about what I am working on, not what I would like to be working on.  There are no jobs for researchers in anything interesting with only an M.S. (which I only recently finished anyway), so I do a lot business programming, accounting, sql databases, websites, etc.  What I do for a day job is not bad, and certainly could be worse, but I want the PhD to be able to work on what I find interesting, not what employers find profitable.  &lt;br /&gt;&lt;br /&gt;I may start adding research notes to this blog. So far, despite having a small number of entries, it has been useful, if only just for my own reference.  I doubt anyone from CMU is going to look up this page, but if you are from CMU reading this, please post a comment to prove me wrong.  A blog is not the best source for determining how good a student is, but it is probably better than just going by GRE scores.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-8682375274210600636?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/8682375274210600636/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=8682375274210600636' title='306 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/8682375274210600636'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/8682375274210600636'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2008/09/carnegie-mellon.html' title='Carnegie Mellon'/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>306</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29123587.post-7548985898876610631</id><published>2008-09-09T13:15:00.000-07:00</published><updated>2008-09-09T13:22:25.452-07:00</updated><title type='text'>log4net FileNotFoundException</title><content type='html'>For the longest time I was getting a FileNotFoundException debugging on my local when trying to use log4net in an aspx app.  I would always break on ConfigureAndWatch in the Global.asax.  Since I knew log4net was working, and the correct version was loaded from the GAC, I aways just hit "continue" and never spent any time on it.  &lt;br /&gt;&lt;br /&gt;Today I noticed log4net itself appeared in the call stack when this exception was thrown.  This is odd, the assembly is throwing an exception looking for itself.  I loaded the debug symbols for both log4net and the system assemblies, which is a great thing to be able to do, and found it was thrown from System.Type.GetType which was being used to dynamically load the PatternLayout class from log4net.  Somehow this was incorrectly specified in the logging.config file I used to configure log4.net.  Somehow log4net was not smart enough to know I incorrectly specified a loader, and the system exception, that the assembly could not be found, was being thrown.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-7548985898876610631?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/7548985898876610631/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=7548985898876610631' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/7548985898876610631'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/7548985898876610631'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2008/09/log4net-filenotfoundexception.html' title='log4net FileNotFoundException'/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29123587.post-635289480561782450</id><published>2008-09-09T06:15:00.000-07:00</published><updated>2008-09-09T06:33:59.485-07:00</updated><title type='text'>SQL Server Statistics</title><content type='html'>Today I found a problem with indexed view performance getting worse over time.  This is another post I am creating mostly for myself, but this may be useful for others since it was pretty hard to find all the details on the web.  One of the most important factors to SQL Server performance is up to date statistics.  Using automatic statistics (enabled by default) does a good job, but we found the need to run sp_updatestats during periods of low activity.  We use a Prestonia based server (waiting for Nehalem) for a 5 GB database with 100+ active users, so every bit of performance helps.  Automatic statistics and sp_updatestats handles everything well except indexed views.&lt;br /&gt;&lt;br /&gt;sp_updatestats ignores indexed views.  Microsoft claims this is because statistics on indexed views are ignored except when using the WITH (NOEXPAND) hint.  You need Enterprise Edition to use indexed views without the (NOEXPAND) hint, so the only explanation I can think of for this behavior is somehow Microsoft thinks screwed up statistics will sell more Enterprise licenses.  If they sell more of anything, it will be Oracle licenses.  I have never seen automatic updates work on indexed views either, although I haven't seen this documented.&lt;br /&gt;&lt;br /&gt;The result of this is that indexed view that sped everything up when you created it is getting further out of sync with its statistics.  Eventually this leads to horrible execution plans that just keep getting worse.  The solution, first you should run:&lt;br /&gt;&lt;br /&gt;SELECT so.name, &lt;br /&gt; si.rowmodctr, &lt;br /&gt; si.rowcnt, &lt;br /&gt; CASE WHEN si.rowcnt &gt; 0 THEN 100.0 * si.rowmodctr / si.rowcnt ELSE 0 END PercentError&lt;br /&gt;FROM sys.objects so&lt;br /&gt; INNER JOIN sys.sysindexes si ON si.id = so.object_id&lt;br /&gt;WHERE is_ms_shipped = 0 AND indid = 1&lt;br /&gt;ORDER BY 4 DESC&lt;br /&gt;&lt;br /&gt;Running this periodically will show you the state of all clustered index statistics, including indexed views and regular tables, and is a good thing to pay attention to regardless of if you have Enterprise edition or use indexed views.&lt;br /&gt;&lt;br /&gt;You will need to update stats for each indexed view similar to 'UPDATE STATISTICS vAcBalanceBill', I have not found another way to do this.  Setting this up in SQL Server Agent mostly takes care of the problem.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-635289480561782450?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/635289480561782450/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=635289480561782450' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/635289480561782450'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/635289480561782450'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2008/09/sql-server-statistics.html' title='SQL Server Statistics'/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29123587.post-3149602837100817834</id><published>2008-05-13T08:29:00.000-07:00</published><updated>2008-05-13T08:30:38.132-07:00</updated><title type='text'>Finding the primary key</title><content type='html'>Here is a script to list the primary key or keys on @tablename in SQL Server:&lt;br /&gt; SELECT sc.name &lt;br /&gt; FROM sys.indexes si&lt;br /&gt;  INNER JOIN sys.index_columns sic ON si.index_id = sic.index_id&lt;br /&gt;   AND si.object_id = sic.object_id&lt;br /&gt;  INNER JOIN sys.columns sc ON sc.column_id = sic.column_id&lt;br /&gt;   AND si.object_id = sc.object_id&lt;br /&gt; WHERE si.is_primary_key &lt;&gt; 0 &lt;br /&gt;  AND si.object_id = OBJECT_ID(@tablename)&lt;br /&gt;&lt;br /&gt;I am posting this, since I tried to google it, and most people's answers were way off in the weeds.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-3149602837100817834?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/3149602837100817834/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=3149602837100817834' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/3149602837100817834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/3149602837100817834'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2008/05/finding-primary-key.html' title='Finding the primary key'/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29123587.post-1988617212492985517</id><published>2008-02-15T09:01:00.000-08:00</published><updated>2008-02-15T09:20:35.546-08:00</updated><title type='text'>Script to fix SQL logins</title><content type='html'>When copying a database from one server to another server, the logins/users can get really screwed up.  This is because users are database specific, and logins are server specific and each user must map to a login.  Moving or copying a database brings the users with it, but not the logins.&lt;br /&gt;&lt;br /&gt;An intelligent, well designed, database management system would take care of this for you.  By default, it would map users to logins that have a login with the name, and create disabled logins for users that don't.  What SQL Server does is create all the users that don't have logins as not mapping to anything. Sometimes it maps users that have a login, and sometimes it doesn't (I still haven't found the pattern).&lt;br /&gt;&lt;br /&gt;This means after copying a database to a new server, typically people cannot log in, and a good deal of work needs to be done if you haven't seen the problem before.  The most frustrating is seeing the user and login both being created correctly, but not mapped together.  You can fix this easily with "EXEC sp_change_users_login 'AUTO_FIX', @name", but only if you understand the issue.  Even if you know exactly what is wrong, fixing this manually takes too long.&lt;br /&gt;&lt;br /&gt;I want to post the scripts I use to fix this, if only so I have a good reference.  I hate copying/pasting SQL out of Outlook, and I need a quick way to get this script from any computer across the net.  So feel free to use it if it helps you too.  This should work in most version and environments with minimal changes. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;DECLARE @name varchar(128)&lt;br /&gt;&lt;br /&gt;DECLARE login_cursor CURSOR FOR &lt;br /&gt;&lt;br /&gt;SELECT name FROM [ServerDBWasFrom].master.dbo.syslogins&lt;br /&gt;&lt;br /&gt;WHERE name NOT IN (&lt;br /&gt; SELECT name &lt;br /&gt; FROM master.dbo.syslogins&lt;br /&gt; WHERE name IS NOT NULL&lt;br /&gt;) AND name IS NOT NULL&lt;br /&gt;&lt;br /&gt;OPEN login_cursor&lt;br /&gt;&lt;br /&gt;FETCH NEXT FROM login_cursor INTO @name&lt;br /&gt;&lt;br /&gt;WHILE @@FETCH_STATUS = 0&lt;br /&gt;BEGIN&lt;br /&gt;            PRINT 'Creating login for ' + @name&lt;br /&gt;            EXEC sp_addlogin @name, 'password1'&lt;br /&gt;            EXEC sp_change_users_login 'AUTO_FIX', @name&lt;br /&gt;            PRINT ''&lt;br /&gt;            FETCH NEXT FROM login_cursor INTO @name&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;CLOSE login_cursor&lt;br /&gt;DEALLOCATE login_cursor&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;--This script will fix any orphaned logins (such as those not created using the first script)&lt;br /&gt;&lt;br /&gt;DECLARE @name varchar(128)&lt;br /&gt;&lt;br /&gt;DECLARE login_cursor CURSOR FOR &lt;br /&gt; SELECT name FROM master.dbo.syslogins WHERE name IS NOT NULL&lt;br /&gt;&lt;br /&gt;OPEN login_cursor&lt;br /&gt;&lt;br /&gt;FETCH NEXT FROM login_cursor INTO @name&lt;br /&gt;&lt;br /&gt;WHILE @@FETCH_STATUS = 0&lt;br /&gt;&lt;br /&gt;BEGIN&lt;br /&gt;            PRINT 'Autofixing login for ' + @name&lt;br /&gt;            EXEC sp_change_users_login 'AUTO_FIX', @name&lt;br /&gt;            PRINT ''&lt;br /&gt;            FETCH NEXT FROM login_cursor INTO @name&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;CLOSE login_cursor&lt;br /&gt;DEALLOCATE login_cursor&lt;br /&gt;&lt;br /&gt;GO&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-1988617212492985517?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/1988617212492985517/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=1988617212492985517' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/1988617212492985517'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/1988617212492985517'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2008/02/script-to-fix-sql-logins.html' title='Script to fix SQL logins'/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29123587.post-6989543724506963324</id><published>2007-12-19T05:47:00.000-08:00</published><updated>2007-12-19T06:11:18.171-08:00</updated><title type='text'>Why Linux apps are easy to install</title><content type='html'>I was just thinking about how much easier it is to install something in Linux than it is for Windows.   Windows apps have gotten better (remember Office 2000, MSDE?), but most everything for Linux installs with no end user effort, and works on first try.  This baffled me for a long time.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Here are some of the reasons why:&lt;br /&gt;1) Most everything on Linux is free to distribute and even reverse engineer.  This doesn't mean distributing or reverse engineering makes things easier.  What it means is no stupid copy protection that isn't tested or well designed.  No having to enter a 40 digit key in a password-like field you cannot read only to find out you need to type the  dashes.  No having to defeat security on a legit install that was meant to stop piracy.  No need to call Microsoft on the phone or activate over the internet.  All of these things can be done well, and sometimes they are, but usually I think they are designed by the lowest programmer on the project as an afterthought under pressure to do a release.&lt;br /&gt;&lt;br /&gt;2)  External dependencies.  My biggest problem writing installers is lack of&lt;br /&gt;understanding (or apathy) by the developer team for what dependencies the program uses.  I frequently hear "InstallShield can do that for us".  No it cannot.  And even if InstallShield could perfectly identify and package dependencies, who handles tech support for bad situations?  Can InstallShield do that?&lt;br /&gt;&lt;br /&gt;The big difference with Linux is a Windows install is written to run by itself on a fresh a machine, and contains copies of every dependency it uses.  If any of these are shared with other Apps or usable by themselves, whoever wrote the app most likely isn't thinking about how to install them so they work with anything other than the app they wrote.  Try installing 2 apps written this way and you may need to reformat.  This did get better with XP, but only by restricting the installer developers. &lt;br /&gt;&lt;br /&gt;Linux installs just contains what the programmer wrote, so they are much smaller, and many distros have the ability to automatically identify and download dependent packages.  These dependent packages are written and maintained by the people who wrote them, rather than the team writing the app that could care less.&lt;br /&gt;&lt;br /&gt;3) Linux apps have no options on what to install.  A Linux module being installed is a binary thing - it is either installed or not installed.  Windows apps give you lots of horrible choices on what to install, the worst of which lead you to believe you succeeded only to prompt you randomly later for the disk you installed from.  This is a direct result of the size issue in 2). &lt;br /&gt;&lt;br /&gt;4) Linux apps are configured after being installed.  Windows installs need a babysitter - you cannot walk away, it may ask you for options at any point.  There are hundreds of choices.  Linux just installs, you can walk away, and you can change your mind on configuration later.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-6989543724506963324?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/6989543724506963324/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=6989543724506963324' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/6989543724506963324'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/6989543724506963324'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2007/12/why-linux-apps-are-easy-to-install.html' title='Why Linux apps are easy to install'/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29123587.post-3368894069521302972</id><published>2007-10-18T07:55:00.000-07:00</published><updated>2007-10-18T08:47:01.380-07:00</updated><title type='text'>How to ask a senior programmer to reverse a string</title><content type='html'>I don't ask candidates to program when I interview.  Maybe I should, this certainly seems to be popular opinion, and is one point in the &lt;a href="http://www.joelonsoftware.com/articles/fog0000000043.html"&gt;Joel Test&lt;/a&gt;.   Generally I find questions of this nature are either way too easy (how reverse a string) or take way to long (any real programming).  If you are interviewing for a senior level position, how can you ask someone to reverse a string (or print Fibonacci numbers or any other trivial problem) and do it with a straight face?  I would be insulted if someone asked me, and would have serious doubts about my future coworkers and boss.  Do I really want to work for a company that at first acts impressed by my background and then proceeds to test me on this?&lt;br /&gt;&lt;br /&gt;I have been lucky, and have never hired a candidate who cannot code.  But thinking back to some of the dumber answers I have had to the questions I did ask, I think asking for basic coding is justified.&lt;br /&gt;&lt;br /&gt;So I thought a lot about this, and think I have the solution.  &lt;span style="font-weight: bold;"&gt;Tell the candidate they are being timed&lt;/span&gt;.  How fast a programmer can type a function to reverse a string is not important, and the candidate knows this and may still think you are weird.  But generally, technical people enjoy technical challenges, and this will override any negative reaction in their brains.  After all, most companies hiring at my level make decisions based on how many years I've used C#, and I would much rather be hired based on how fast I can type a simple program.&lt;br /&gt;&lt;br /&gt;How long they actually take is unimportant - this is just a better way of asking them to prove they can actually program.  It is important this timing trick should only be used to avoid insulting senior programmers who should be able to solve these programs in seconds - asking a shy candidate for an intern position to be timed could easily scare the better candidates away.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-3368894069521302972?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/3368894069521302972/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=3368894069521302972' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/3368894069521302972'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/3368894069521302972'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2007/10/how-to-ask-senior-programmer-to-reverse.html' title='How to ask a senior programmer to reverse a string'/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29123587.post-2872025382230757887</id><published>2007-08-23T08:21:00.000-07:00</published><updated>2007-08-23T08:28:04.286-07:00</updated><title type='text'>Do you want to get annoyed?</title><content type='html'>I hate when software asks things like&lt;br /&gt;"Do you want to reboot now?" or&lt;br /&gt;"Do you want to stop debugging?"&lt;br /&gt;&lt;br /&gt;I almost always see this when I've done something that means I have to stop debugging or I have to reboot, even though I don't want to.  While other software forces me to start what I am doing over again, I tolerated this knowing how much harder it would be to write software that let me continue working.  Having the software ask me if I want to is painfully bad design - it feels like my computer is making fun of me.  "Oh, did you want to keep working?  Ha Ha - you want to keep working don't you.  Well you aren't going to!"&lt;br /&gt;&lt;br /&gt;Even worse, but rarely seen, is the dreaded countdown of reboot doom.  This is where the software developer decided not only that a reboot was needed, but they should not give you the option to do it later.  In a perverse attempt to be friendlier than instantly turning off your machine, you get a dialog box saying "your computer will reboot in 30 seconds"  29, 28, 27 ... 1, 0  Like a bomb in a B movie.  If you were doing anything important, now you have to make a split second decision - should you spend your time trying to save your work and close anything running, or try various things to stop your computer from rebooting.  Do I cut the red or green wire?&lt;br /&gt;&lt;br /&gt;Even asking a question is unnecessary.  I know how to reboot my machine, and I can decide when.  How about simply "You will need to reboot your system before using this application".&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-2872025382230757887?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/2872025382230757887/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=2872025382230757887' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/2872025382230757887'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/2872025382230757887'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2007/08/i-hate-when-software-asks-things-like.html' title='Do you want to get annoyed?'/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29123587.post-954340262727227465</id><published>2007-08-21T14:01:00.000-07:00</published><updated>2007-08-21T14:05:52.961-07:00</updated><title type='text'>Bad Chicken Code</title><content type='html'>&lt;o:p&gt;&lt;/o:p&gt;Many people are teaching programmers object oriented programming by thinking about real world objects.&lt;span style=""&gt;  &lt;/span&gt;A chicken and a sparrow are both birds, so think about creating a bird class, and deriving 2 subclasses.&lt;span style=""&gt;  &lt;/span&gt;A sparrow definitely cannot cluck, so only the chicken gets a cluck method.&lt;span style=""&gt;  &lt;/span&gt;At this point, the teacher, who likely has never seen a chicken without breading and cole slaw, tries to figure out if chickens can fly.&lt;span style=""&gt;  &lt;/span&gt;Since I grew up with a friend who raised chickens, I will give both a fly method, but the chickens will print 'flutter'.&lt;span style=""&gt;  &lt;/span&gt;This gives us:  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;abstract class Bird&lt;/p&gt;  &lt;p class="MsoNormal"&gt;{&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;            &lt;/span&gt;abstract void Fly();&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;            &lt;/span&gt;bool hasFeathers() { return true; }&lt;/p&gt;  &lt;p class="MsoNormal"&gt;}&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;public class Sparrow : Bird&lt;/p&gt;  &lt;p class="MsoNormal"&gt;{&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;            &lt;/span&gt;override void Fly()&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;            &lt;/span&gt;{&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;                        &lt;/span&gt;print('Fly');&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;            &lt;/span&gt;}&lt;/p&gt;  &lt;p class="MsoNormal"&gt;}&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;public class Chicken : Bird&lt;/p&gt;  &lt;p class="MsoNormal"&gt;{&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;            &lt;/span&gt;override void Fly()&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;            &lt;/span&gt;{&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;                        &lt;/span&gt;print('Flutter');&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;            &lt;/span&gt;}&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;            &lt;/span&gt;void Cluck()&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.5in;"&gt;{&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.5in; text-indent: 0.5in;"&gt;print (‘Cluck’);&lt;br /&gt;}&lt;/p&gt;  &lt;p class="MsoNormal"&gt;}&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;void SomeMethod()&lt;/p&gt;  &lt;p class="MsoNormal"&gt;{&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;            &lt;/span&gt;Chicken chicken = new Chicken();&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;            &lt;/span&gt;Sparrow sparrow = new Sparrow();&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;            &lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;            &lt;/span&gt;print ('Do sparrows have feathers');&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;            &lt;/span&gt;print sparrow.hasFeathers();&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;            &lt;/span&gt;print ('Can sparrows fly?');&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;            &lt;/span&gt;print ('Sparrows ');&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;            &lt;/span&gt;print sparrows.Fly();&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;            &lt;/span&gt;print ('Do chickens have feathers');&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;            &lt;/span&gt;print chicken.hasFeathers();&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;            &lt;/span&gt;print ('Can chickens fly?');&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;            &lt;/span&gt;print ('Chickens ');&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;            &lt;/span&gt;print chicken.Fly();&lt;/p&gt;  &lt;p class="MsoNormal"&gt;}&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;What could be easier?&lt;span style=""&gt;  &lt;/span&gt;This teaches a student how to categorize based on logical real world concepts and how to implement inheritance in C++ style languages.&lt;span style=""&gt;  &lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;There is a huge problem with this though.&lt;span style=""&gt;  &lt;/span&gt;We don't want new programmers to categorize based on logical real world concepts. &lt;span style=""&gt; &lt;/span&gt;Often times, logical real world concepts is a good place for production programmers to start dividing up large problems.&lt;span style=""&gt;  &lt;/span&gt;But students at this level aren't ready to work on problems 1/10th that size.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Consider the code:&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;void SomeMethod2()&lt;/p&gt;  &lt;p class="MsoNormal"&gt;{&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;            &lt;/span&gt;print ('Do sparrows have feathers? True');&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;            &lt;/span&gt;print ('Can sparrows fly? Sparrows fly');&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;            &lt;/span&gt;print ('Do chickens have feathers? True');&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;            &lt;/span&gt;print ('Can chickens fly? Chickens flutter');&lt;/p&gt;  &lt;p class="MsoNormal"&gt;}&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Aside from being too trivial to use to teach programmers, SomeMethod2() is better in all possible ways (extensible, readable, maintainable etc).&lt;span style=""&gt;  &lt;/span&gt;If we wanted to write a non-trivial program to track various attributes about birds, we likely would create a relational database.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;This is an extremely dangerous, wrong lesson that programmers will need to unlearn later.&lt;span style=""&gt;  &lt;/span&gt;Some programmers simply don't unlearn this, just cannot stop classifying, and probably would have been happier as taxonomists in the biology department.&lt;span style=""&gt;  &lt;/span&gt;Legal secretaries are users, so why not derive a class from them for users - heck why not even derive them from a secretary class?&lt;span style=""&gt;  &lt;/span&gt;U.S. Dollars are money, Wednesday is a weekday.&lt;span style=""&gt;  &lt;/span&gt;When the only tool you have is a hammer, every problem looks like a nail.&lt;span style=""&gt;  &lt;/span&gt;There is no end to the number of real world relationships that the tool of object oriented programming seems to apply to.&lt;span style=""&gt;  &lt;/span&gt;Maybe someone can teach them Prolog.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;The reason we have object oriented programs is not to classify but to create good coupling and cohesion in ways easy for human beings to understand.&lt;span style=""&gt;  &lt;/span&gt;Bad chicken code completely ignores coupling and cohesion, the above example (and most bad chicken code) only suffers from bad cohesion, but throw a bad chicken coder at a large enough problem, and you get coupling issues as well, since they are thinking in terms of classification, not relationships, abstraction or data flow.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Ian Griffiths (&lt;a href="http://www.interact-sw.co.uk/iangblog/2005/09/26/extensionmethods"&gt;http://www.interact-sw.co.uk/iangblog/2005/09/26/extensionmethods&lt;/a&gt;) comments on inheritance and says “It conflates two very important but really rather different concepts: reuse and polymorphism”.&lt;span style=""&gt;  &lt;/span&gt;Now we are teaching our students to use inheritance to define relationships and classifications rather than reuse or polymorphism.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;I was writing programs complicated enough to justify object oriented code long before I learned object oriented programming, and I am not sure how I would go about teaching a new programmer now.&lt;span style=""&gt;  &lt;/span&gt;You cannot completely ignore classes if you teach using Java or similar languages, and teaching Pascal (how I learned) is just too outdated.&lt;span style=""&gt;  &lt;/span&gt;Maybe it would be best to gloss over the class keyword until programmers are writing 1,000 line programs (1 class, several methods), and then show them how much easier programming is if you break code up based on related functionality.&lt;span style=""&gt;  &lt;/span&gt;That way they understand why and when to use different classes at the same time they learn how.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-954340262727227465?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/954340262727227465/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=954340262727227465' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/954340262727227465'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/954340262727227465'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2007/08/bad-chicken-code.html' title='Bad Chicken Code'/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29123587.post-4079777463064816907</id><published>2007-08-21T14:00:00.003-07:00</published><updated>2007-08-21T14:00:55.536-07:00</updated><title type='text'></title><content type='html'>Its been a while since I last posted, and I am not going to clean up my last entry, I am being lazy.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-4079777463064816907?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/4079777463064816907/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=4079777463064816907' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/4079777463064816907'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/4079777463064816907'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2007/08/its-been-while-since-i-last-posted-and.html' title=''/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29123587.post-2085599134955690006</id><published>2007-06-05T13:00:00.001-07:00</published><updated>2007-06-05T13:01:27.602-07:00</updated><title type='text'>Server side comments continued</title><content type='html'>Interesting, apparently the blogger has big issues with HMTL comment tags - it deleted most of my post below.  I will repost/edit later.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-2085599134955690006?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/2085599134955690006/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=2085599134955690006' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/2085599134955690006'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/2085599134955690006'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2007/06/server-side-comments-continued.html' title='Server side comments continued'/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29123587.post-6641474958225037995</id><published>2007-06-05T12:54:00.000-07:00</published><updated>2007-06-05T12:59:06.132-07:00</updated><title type='text'>ASP.NET Server side comments</title><content type='html'>Server-Side Comment Syntax: &lt;%-- Comment --%&gt;&lt;br /&gt;&lt;br /&gt;I found this at:&lt;br /&gt;&lt;a href="http://samples.gotdotnet.com/quickstart/aspplus/doc/webformssyntaxref.aspx#comment"&gt;http://samples.gotdotnet.com/quickstart/aspplus/doc/webformssyntaxref.aspx#comment&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Why do I always forget this?&lt;br /&gt;&lt;br /&gt;BTW - I have seen some pretty interesting bugs were a programmer (actually me) used &lt;!--Standard HTML Comments --!&gt; instead of server side tags to comment out old code.  This means the code actually runs server side, but gets generated inside comment tags client side.  Unless you look at the source, you have no way of noticing, even if you view the client side page every day.  Until one day something goes wrong with the server side code and it crashes or causes some sort of side effect, and you track it down to what you thought was dead code.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-6641474958225037995?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/6641474958225037995/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=6641474958225037995' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/6641474958225037995'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/6641474958225037995'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2007/06/aspnet-server-side-comments.html' title='ASP.NET Server side comments'/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29123587.post-8099194632645231147</id><published>2007-03-28T07:47:00.000-07:00</published><updated>2007-03-28T07:53:01.510-07:00</updated><title type='text'></title><content type='html'>Getting IIS/ASP.NET back to the default forms authentication can be difficult. A small mistake is hard to find. I am writing this mainly so I can go back and look at it next time I have trouble.&lt;br /&gt;&lt;br /&gt;1. Be sure the web site exists, and is configured to the correct directory.&lt;br /&gt;2. On directory security, be sure anonymous access is checked, that user name is set to the default, with Allow IIS to control password checked.&lt;br /&gt;3. Be sure integrated windows authentication is checked.&lt;br /&gt;4. Be sure nothing else is checked.&lt;br /&gt;5. Check the web.config, and be sure it looks something like.&lt;br /&gt;&lt;br /&gt;&amp;lt;authentication mode="Forms"&amp;gt;&lt;br /&gt;&amp;lt;forms path="/" name="CookieName" loginurl="login.aspx"&amp;gt;&amp;lt;authentication mode="Forms"&amp;gt;&lt;br /&gt;&amp;lt;forms loginurl="login.aspx" name="CookieName" path="/"&amp;gt;&amp;lt;/forms&amp;gt;&lt;br /&gt;&amp;lt;/authentication&amp;gt;&lt;br /&gt;&amp;lt;authorization&amp;gt;&lt;br /&gt;&amp;lt;deny users="?"&amp;gt;&lt;br /&gt;&amp;lt;allow users="*"&amp;gt;&lt;br /&gt;&amp;lt;/authorization&amp;gt;&amp;lt;allow users="*"&amp;gt;&lt;br /&gt;&amp;lt;/authorization&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-8099194632645231147?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/8099194632645231147/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=8099194632645231147' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/8099194632645231147'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/8099194632645231147'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2007/03/getting-iisasp.html' title=''/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29123587.post-7502646966812875680</id><published>2007-03-15T08:25:00.000-07:00</published><updated>2007-03-15T08:46:52.845-07:00</updated><title type='text'>Object synchronization method was called from an unsynchronized block of code</title><content type='html'>Despite the tremendous improvement in .NET compared to anything Microsoft released earlier, Microsoft still lags behind where Java was with ease of use of multithreading.  .NET multithreading is great and easy to use - but only if you already know multithreading.  There are hundreds of different ways to handle synchronization, and some work well, some work poorly, and in my opinion, some don't work at all.  All this makes me wish they would just give me Dijkstra's semaphore (P and V methods) and let me build my own stuff on top of it.&lt;br /&gt;&lt;br /&gt;Today, I tried to Google an error I got:  "System.ApplicationException: Object synchronization method was called from an unsynchronized block of code."  Immediately (based on the error message), I thought I either needed to mark the method, class or assembly as needing to use synchronization somehow (either attributes or compiler switches came to mind).  This was odd, because I didn't remember ever needing to do this before (well, not since the COM apartment threading mess anyway).&lt;br /&gt;&lt;br /&gt;You would think this would be easy to find.  I went through every entry on the first 3 Google pages (60 entries).  Lots of people had this problem, but most answers were:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;use Monitors instead of synchronization object X-with no explanation of why.&lt;/li&gt;&lt;li&gt;Do you really need to do this? - I always hate this answer when someone posts a legitimate technical question.  The question still has merit, regardless of whether the author really the answer or not.&lt;/li&gt;&lt;li&gt;Use Google to find the answer - I hate this too.  I am convinced it will eventually destroy Google (any search will eventually only yield thousands of pages telling you to search Google).&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Anyhow, I gave up on Google and went back to my code, and the answer was really simple.  All I did was release the Mutex before I acquired it (I left out the  line of code Mutex.WaitOne).  &lt;/p&gt;&lt;p&gt;I guess I am posting this for 2 reasons&lt;/p&gt;&lt;ul&gt;&lt;li&gt;I don't want anyone else looking through 60 pages of worthless Googling (although I doubt this blog will get ranked in the top 60 anyway).&lt;/li&gt;&lt;li&gt;This is a really bad error message.  Every time you enter a synchronized block of code, you do so by calling an object synchronization method from an unsynchronized block of code.  What it should say is "Invalid Object synchronization method called from an unsynchronized block of code" or simply "Invalid Object synchronization method call".  This would make finding the answer easy.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-7502646966812875680?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/7502646966812875680/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=7502646966812875680' title='362 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/7502646966812875680'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/7502646966812875680'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2007/03/object-synchronization-method-was.html' title='Object synchronization method was called from an unsynchronized block of code'/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>362</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29123587.post-6703202188543443721</id><published>2007-03-07T06:24:00.000-08:00</published><updated>2007-03-07T07:06:38.539-08:00</updated><title type='text'>Architects</title><content type='html'>I have been thinking about software architects lately.  Some, if not most, companies hate to see 'software architect' on a resume, and don't want to hire anyone into that role.  My last employer (not my current) always said they wanted me to step up to that role, but also that customers don't pay for architecture, and it is not very important.&lt;br /&gt;&lt;br /&gt;Nothing could be farther from the truth.  Customers pay big for architecture, but they don't pay for good architecture, they pay for bad architecture.  If everything is architected well (like my current job), existing code rarely needs changed, and most new development involves thinking about what the product should do and how it should do it.  If everything is architected poorly, all the time is spent fixing the same problem over and over.  People blame coders for lacking "attention to detail", when 2000 lines of code are used to do the job of 200.  New development is slow and tedious, the "what the product should do and how it should do it" either becomes big upfront design, or becomes an afterthought.  Products are released that are unsupportable, and if they crash, the only way to find out what code is at fault is by the whole development team staying hours late going through Dr. Watson logs and spaghetti code.  Obviously, products developed this way are more expensive.&lt;br /&gt;&lt;br /&gt;What some people think of as good architects are problems to.  Big companies pay a few "architects" six figure salaries to sit in a private office isolated from the team, draw fancy Visio diagrams about complex "frameworks" and "reusable components", and tell coders what to code.  This make projects more expensive too (although never as bad as the first scenario).  These architects are probably responsible for most of the negativity people have about hiring architects.  They are probably the architects Joel talked about in "&lt;a href="http://www.joelonsoftware.com/articles/fog0000000018.html"&gt;Don't Let Architecture Astronauts Scare You&lt;/a&gt;" - although I blame salespeople for that (more on that later).&lt;br /&gt;&lt;br /&gt;So are architects really needed?  Read about the most popular real world architecture style - &lt;a href="http://www.laputan.org/mud/"&gt;Big Ball of Mud&lt;/a&gt;.  Most agile coding (Scrum, XP) seems to frown on (or ignore) architecture.  It seems most of the successful projects are those that ignore architecture completely, but end up with a well enough architected code base to avoid the first scenario.  But this is far from optimal, and usually happens by chance.&lt;br /&gt;&lt;br /&gt;So what is the solution?  I remember back to my days being an undergrad, and &lt;a href="http://artssciences.udayton.edu/ComputerScience/ShowProfile.asp?u=210BJKGJF50&amp;t=Faculty"&gt;Dr Gowda&lt;/a&gt;'s class.  The most important lesson he always stressed was coupling and cohesion.  This goes back to Structured Design by Larry Constantine in 1974, before I was even born.  With things like "object oriented" and "agile methodologies" becoming more and more popular, no one likes the idea that the solution to most of our problems is over 30 years old.  If a complicated and large system, no matter how otherwise badly designed, is loosely coupled, it can be fixed and used and maintained.  Once a solutions develops bad, tight coupling system wide (to the point it cannot be decoupled), you have to throw it away, or all your efforts become more and more difficult, and eventually wasted.&lt;br /&gt;&lt;br /&gt;I think this is largely the role of architects - to avoid excessive coupling within the system, to prevent it from degrading to this point, and to recognize if this happens.  Beyond that, architects are useful to review code, ensure good programing practices are followed, and spend the rest of their time doing development.  Is this is best left to one or a few team members designated as "architects" or best done by everyone?  I think it is best done by everyone on the team.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-6703202188543443721?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/6703202188543443721/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=6703202188543443721' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/6703202188543443721'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/6703202188543443721'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2007/03/architects.html' title='Architects'/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29123587.post-116249802485050491</id><published>2006-11-02T12:01:00.000-08:00</published><updated>2006-11-02T12:07:53.493-08:00</updated><title type='text'>Studio Source Safe Integration</title><content type='html'>&lt;p&gt;Studio Source Safe Integration has really gone downhill since VS 6. I just lost significant work when trying to pull up a file that was intentionally not yet checked in (or even checked out) - the message I got was "Your action caused a file to be checked out of source safe" and all my work was gone, no prompt, nothing.&lt;/p&gt;&lt;p&gt;I understand how software developers can write bad software for bankers and doctors because they don't understand the first thing about being a banker or a doctor. I don't understand how developers can write software for software developers that is this bad - if they didn't understand the first thing about software development, they shouldn't have been able to create a product at all.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-116249802485050491?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/116249802485050491/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=116249802485050491' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/116249802485050491'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/116249802485050491'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2006/11/studio-source-safe-integration.html' title='Studio Source Safe Integration'/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29123587.post-116196235504240144</id><published>2006-10-27T08:17:00.000-07:00</published><updated>2006-10-27T08:19:15.060-07:00</updated><title type='text'>Non-keyed columns in indexes in SQL 2005</title><content type='html'>I am confused about all the hype about including non-keyed columns in indexes in SQL Server 2005. I clearly understand the advantage of including a column in an index to avoid needing a bookmark lookup to retrieve the data. But I could do that in SQL 2000 - just add the column as a keyed column on the index. So what is the difference with having the column not part of the key? Non-keyed indexes make WHERE clauses slower if I have to do a table scan when I could otherwise do an index scan. If that is the only difference, then why would anyone ever want to use a non-keyed column in an index?&lt;br /&gt;&lt;br /&gt;According to books online:&lt;br /&gt;"They can be data types not allowed as index key columns."&lt;br /&gt;"They are not considered by the Database Engine when calculating the number of index key columns or index key size."&lt;br /&gt;"While key columns are stored at all levels of the index, nonkey columns are stored only at the leaf level""Computed columns that are deterministic and either precise or imprecise can be included columns"&lt;br /&gt;&lt;br /&gt;In my 7 years of SQL Server, I have never run into a situation where I wanted an index on a column and could not add it because of the data type. I am not even sure which types are allowed (I know text and image aren't - but they aren't allowed in the new non-keyed columns feature either). I suppose there might be some special situation needing this.&lt;br /&gt;&lt;br /&gt;The total index key size is 900 bytes. I have run into situations where this was stopped me from using an index I wanted, but it is rare, and never caused much of a problem. 900 bytes is usually more than enough.&lt;br /&gt;&lt;br /&gt;Most of the size of the index is the leaf nodes, so this won't save significant disk space. It probably can make a small but significant performance difference doing index scans/seeks.&lt;br /&gt;Including computed columns might save someone from denormalizing for speed, which saves maintenance, but again, I don't see this happening often enough to be signficant.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So, in summary, If a having a column as part of an index key clearly isn't useful for WHERE clauses, then by default it should be included as a non-key column. And there are some other situations where this is useful. But this is a small optimization, not a revelution.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-116196235504240144?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/116196235504240144/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=116196235504240144' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/116196235504240144'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/116196235504240144'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2006/10/non-keyed-columns-in-indexes-in-sql.html' title='Non-keyed columns in indexes in SQL 2005'/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29123587.post-116128446777173254</id><published>2006-10-19T11:47:00.000-07:00</published><updated>2006-10-19T12:01:07.786-07:00</updated><title type='text'>static</title><content type='html'>Today I learned that static variables declared in a generic base class are shared for all instances of all derived classes (in C#).  I wrote code a while back assuming a separate copy of the static variables would exist for each derived class without thinking too much about the issue.  Today I wrote my 2nd derived class and quickly found this was not true.  I did correctly assumed all versions of a generic class would share the same static variable, but I wasn't 100% of this until today.  I asked another experience developer and he wasn't sure either.  We both agree this would be a great interview question (even if they don't know or get it wrong, it shows a lot about where their ability is with object oriented code).  Fortunately, only 1 derived class made it to production before I found this.&lt;br /&gt;&lt;br /&gt;This also goes to show:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;No matter how well you think you know a language, you can always learn something new.&lt;/li&gt;&lt;li&gt;Being aware of what you don't know is valuable.&lt;/li&gt;&lt;li&gt;You should never make assumptions about things you can research and find out.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-116128446777173254?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/116128446777173254/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=116128446777173254' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/116128446777173254'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/116128446777173254'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2006/10/static.html' title='static'/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29123587.post-115981724319784946</id><published>2006-10-02T12:26:00.000-07:00</published><updated>2006-10-02T12:27:23.213-07:00</updated><title type='text'>ReportViewer Control</title><content type='html'>If you get a "Page navigation is out of range" in a ReportViewer control, you should know that page navigation is a postback.  Look at what you are doing in the PageLoad when IsPostBack == true.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-115981724319784946?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/115981724319784946/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=115981724319784946' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/115981724319784946'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/115981724319784946'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2006/10/reportviewer-control.html' title='ReportViewer Control'/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29123587.post-114953354980774602</id><published>2006-06-05T11:33:00.000-07:00</published><updated>2006-06-05T11:52:29.823-07:00</updated><title type='text'>nullable C# SQL gotcha's</title><content type='html'>I've been looking forward to redesigning our code to use the new nullable value types in C# 2.0 since we made the switch.  The types themselves are not a disappointment, but they don't work as well with SQL Server as one would expect.  Hard to believe Microsoft didn't think about the large developer community that would be using this with SQL Server 2000/2005.&lt;br /&gt;&lt;br /&gt;Two really subtle "gotcha" things I ran into I thought I’d pass along.  (int?)row[“field”] This does not evaluate to null when the field is null.  It throws an exception.  int? fieldValue = null;params.Add(“@Field”, SqlDbType.Int).Value = fieldValue; This does not call stored process with @Field = null when calling SQL Server, it calls stored procs with @Field = default.&lt;br /&gt;My coworker (Bill Ziss) says "This is a major detraction to nullable types' usefulness.  This would've been THE major use of nullable types, imo."  I tend to agree.&lt;br /&gt;&lt;br /&gt;Almost equally annoying (but far more obvious) is the SqlTypes used a property called IsNull and nullable types use a property called HasValue.  This means if I convert my code, I have to change all the !o.IsNull to o.HasValue and o.IsNull to !o.HasValue.  This makes it way to easy to forget to change an ! and introduce bugs, especially when changing this in 10,000+ lines of code.  With as many people already using the SqlDbTypes (even for nullable value types in non-SQL related code) why would they change this?&lt;br /&gt;&lt;br /&gt;Overall, I think I am still going to use the new nullable types, rather than keep using the SqlTypes.  Having to use a SqlType for a variable not being passed to Sql Server seems silly, and I really don't like having to mix/match both.&lt;br /&gt;&lt;br /&gt;I am very disappointed by the lack of support for nullable types in XML datasets in .NET, but after using them in a real project, I have decided they are still too immature for production anyway.  They aren't unusable, but they are so unstable that there is no net gain of time developing software.  Take a look at my post about FDBK49338 on Microsoft's Product Feedback page (&lt;a href="http://lab.msdn.microsoft.com/ProductFeedback/viewfeedback.aspx?feedbackid=32136c55-90d2-4fdc-9b2c-a984b87de7eb"&gt;http://lab.msdn.microsoft.com/ProductFeedback/viewfeedback.aspx?feedbackid=32136c55-90d2-4fdc-9b2c-a984b87de7eb&lt;/a&gt;).  The XSD editor is just plain buggy - I cannot believe this could even make it into BETA 1, let alone 3 betas and released software.  They should have left it as is (it was almost as useless in 2003, but less buggy).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-114953354980774602?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/114953354980774602/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=114953354980774602' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/114953354980774602'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/114953354980774602'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2006/06/nullable-c-sql-gotchas.html' title='nullable C# SQL gotcha&apos;s'/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29123587.post-114927802156230870</id><published>2006-06-02T12:36:00.000-07:00</published><updated>2006-06-02T12:53:41.576-07:00</updated><title type='text'>Enterprise Mismanager</title><content type='html'>I hate hearing programmers complain about developer tools being hard to use - developers should be required to have more intelligence than average users, and in general should trade simple interfaces and well tested software for more complicated, powerful and cutting edge tools. I am posting this, since it is a screen many developers use every day, and hopefully calling attention to this might stop development of similarly bad software in the future.&lt;br /&gt;&lt;br /&gt;However restoring databases in SQL Server 2000 Enterprise Manager features one of the worst GUI designs I have seen in a widely accepted product. You have to enter a name for your database on the first tab, and a filename for the data and log on another tab. This is ok, except which tab you are on and which tabs you have visited before effects which file name SQL Server uses.&lt;br /&gt;&lt;br /&gt;I am not entirely sure how this works, but I think by default, SQL Server uses the database name as the file name, but it only updates this when you click the 2nd tab. So if you change the name of your database and never click the 2nd tab, it uses the old name. If you click the 2nd tab (and don't do anything else) it uses the new name. If you go to the 2nd tab first and then change the name on the first tab, it uses the old name.&lt;br /&gt;&lt;br /&gt;Switching tabs is an operation that should be exclusively read only - this is ridiculous. Did a professional programmer do this on purpose?&lt;br /&gt;&lt;br /&gt;The rest of Enterprise Manager is almost as unergonomical - was this designed for 640x480? Why can't I change the size of the fonts or even size the windows?&lt;br /&gt;&lt;br /&gt;I have used 2005, but not enough to know if it is really better, or just has different quirks I haven't found yet. Hopefully by the time I am using 2005 more than I use 2000 this silliness will end.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-114927802156230870?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/114927802156230870/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=114927802156230870' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/114927802156230870'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/114927802156230870'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2006/06/enterprise-mismanager.html' title='Enterprise Mismanager'/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29123587.post-114925689101444402</id><published>2006-06-02T07:00:00.000-07:00</published><updated>2006-06-02T07:01:31.023-07:00</updated><title type='text'>coffee</title><content type='html'>The problem with coffee is you cannot even pour a cup without spilling until you've had a cup to drink.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-114925689101444402?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/114925689101444402/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=114925689101444402' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/114925689101444402'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/114925689101444402'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2006/06/coffee.html' title='coffee'/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29123587.post-114918960729361147</id><published>2006-06-01T12:18:00.000-07:00</published><updated>2006-06-01T12:20:07.310-07:00</updated><title type='text'>I have a blog</title><content type='html'>I finally have a blog.  Only time will tell if this is a useful journal of programming issues or a tremendous waste of time.  More likely, no one will actually read it, and I will stop posting.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29123587-114918960729361147?l=bbellomo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bbellomo.blogspot.com/feeds/114918960729361147/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29123587&amp;postID=114918960729361147' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/114918960729361147'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29123587/posts/default/114918960729361147'/><link rel='alternate' type='text/html' href='http://bbellomo.blogspot.com/2006/06/i-have-blog.html' title='I have a blog'/><author><name>Brad</name><uri>http://www.blogger.com/profile/16206864251085268607</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry></feed>
