Monday, June 25, 2012

Industry Maneuvers

This is kind of big news for a whole cornocopia of developers because of what it says about the effect Apple ultimately has on Microsoft as well as Flash:

https://www.zdnet.com/blog/microsoft/xamarin-abandons-its-silverlight-for-linux-technology/12797

Friday, June 22, 2012

The worm turns: Embedded SQL vs Stored Procs

Written by James Kovacs about 5 years ago.
Historically Microsoft recommended stored procs because they gave much better performance. Query optimizers in SQL Server 2000 and 2005 have improved dramatically and this is no longer much of an issue. The biggest hassle with stored procs is you have two places to maintain and version code — namely your application and the database. Versioning is much more painful because even without database schema changes, you need the correct set of stored procs for the code base that is running against them. When you’re pulling apart the result set, you need to compare the columns in the stored proc select statements against the columns that your DataReaders are expecting. A trivial task, but mind-numbingly boring. It’s easier if the select is in close proximity to the code that parses it. Personally I’m a big fan of having an ORM tool such as NHibernate or LINQ generate the dynamic queries for me and perform the parsing. I honestly think that’s the way of the future and hand-optimized stored procs will be used for perf critical operations when needed.
And Microsoft doesn't provide a good way of organizing and managing Stored Procedures into folders.

Wednesday, June 20, 2012

Why Did Adobe Buy Macromedia?

Six years on and this is as good as the speculating got:



The fact that Slashdot never got beyond the superficial (and very unsatisfactory in my opinion) explanations might be an indication of Slashdot's non-designer fanbase.

Tuesday, June 19, 2012

Log4Net Logging

Isn't it interesting that by far the most popular .NET logging library is one "owned" now by Apache?  And which had its beginning in Java?

Here is an excellent page to quickly get you up and started with Log4Net:
http://www.justinrhinesmith.com/blog/2008/05/12/quick-and-easy-log4net-setup/
(thank you Justin)

And here is the answer to the question which usually follows:
Note: In log4net speak, an output destination is called an appender.
More than one appender can be attached to a logger.

Is it possible to direct log output to different appenders by level?

Yes it is. Setting the Threshold option of any appender will filter out all log events with a lower level than the value of the threshold option.

For example, setting the threshold of an appender to DEBUG will also allow INFO, WARN, ERROR and FATAL messages to log along with DEBUG messages. (DEBUG is the lowest level). Similarly, setting the threshold of an appender to ERROR will filter out DEBUG, INFO and WARN messages but not ERROR or FATAL messages.  See Example 1.

If you must filter events by exact level match, then you can attach a Filter, such as a  LevelMatchFilter, to any appender to filter out logging events by exact level match. See Example 2.

For more on the matter of Threshod vs. Filter vs. Evaluators, see further below.


Example 1:



<log4net>
    <appender name="FileAppender" type="log4net.Appender.FileAppender">
        <threshold value="INFO" />
        .....other elements specific to FileAppender.....
    </appender>
    <appender name="" type="log4net.Appender.SmtpAppender">
        <threshold value="ERROR" />
          .....other elements specific to  SmtpAppender .....
    </appender>
</log4net>


Example 2:


<log4net>
    <appender name="FileAppender" type="log4net.Appender.FileAppender">
         <filter type="log4net.Filter.LevelMatchFilter">
              <acceptOnMatch value="true" />
              <levelToMatch value="INFO" />
         </filter>
        .....other elements specific to FileAppender.....
    </appender>
    <appender name="" type="log4net.Appender.SmtpAppender">
         <filter type="log4net.Filter.LevelMatchFilter">
              <acceptOnMatch value="true" />
              <levelToMatch value="ERROR" />
         </filter>
          .....other elements specific to  SmtpAppender .....
    </appender>
</log4net>

Threshold vs. Filter vs. Evaluator

Threshold is the simplest, Filter gives you more flexibility, and Evaluator is only available with certain appenders, such as the one for sending emails. For more see:
Threshold vs. Filter vs. Evaluator


Finally...


What to actually write to the log? see:
http://logging.apache.org/log4net/release/sdk/log4net.Layout.PatternLayout.html



For more on Log4Net, be sure to check out:

and of course: