Log Parser Lizard

Recently I’ve been working a bit with Log Parser Lizard and it’s been very helpful.

You can take log files, import them, pick the expected format, and then query them in a SQL style manner.

So for example, I took a bunch of IIS log files and was able to easily run this query against it:

SELECT *
FROM 'C:\Users\Chris\Downloads\www-logs\*.log'
where sc-status = 404 and cs-uri-stem <> '/AzureFileHandler.ashx'
and cs-uri-stem <> '/js/jquery.1.11.1.min.js'

 

Pretty cool

image

IE11 Dev Tools (F12) Will Prevent HTTP 304

If you happen to be working on testing your client side caching of things like images and JS files, you might be banging your head against a wall wondering why you are not seeing any HTTP 304s being sent while analyzing the network traffic with the IE F12.  Those tools apparently suppress the browsers ability to cache these files, most likely to aid people who are debugging javascript from trying to understand why their changes aren’t being seen.  If you look at the Fiddler image below, you can see I loaded a site, which resulted in mostly 304s.  I then opened F12 in IE and reloaded the same site, and from that point on it avoided its cache and downloaded all the files.

image

Shrink your SQL Server Log Files (LDFs)

If you just want to shrink your log files, you can use the following code, but make sure to replace DBName with whatever your real database name is.

USE DBName
ALTER DATABASE DBName SET RECOVERY SIMPLE
DBCC SHRINKFILE( 'DBName_log',1000 )
ALTER DATABASE DBName SET RECOVERY FULL

If by chance your log file isn’t named DBName_log, you can find out what the actual name is by using this bit of code:

USE DBName
SELECT name
FROM sys.database_files
WHERE type_desc = 'LOG'

SQL Server Report Builder Error “Cannot Retrieve Application. Authentication Error”

I found myself unable to use the Report Builder from the SSRS web app today with the error “Cannot Retrieve Application. Authentication Error.”

Turns out, even if you supply the right credentials when you login to the site, those credentials are not used when launching the Report Builder, only your local current windows credentials are.

So, you need to add your SSRS credentials to your local windows credential cache. To do this:

Go to User Account in Control Panel and pick your account (or just search for Manage Network Passwords)
Select Manage Network Passwords
add an entry in the Windows (not Web) section
put in the name of the report server, you might need to do both the machine name and the FQDN
put in the user and password you use to login

That solved my problems.

Calculating Returns on Flipping a House vs Renting vs Investing in Stock

My parents and I have purchased a house that we (mostly through the work of my mom honestly) are renovating.  The project is practically finished and we are at the decision point of asking ourselves: do we sell the house or do we rent it out?

There are a ton of factors to consider:

1) How much could we sell the house for?

2) How much rent could we get for it?

3) If we sell now we will pay tax on the profit at our marginal tax bracket rate (28% most likely)?

4) If we rent it out, how much value will be lost by selling the house later when it’s not in pristine condition that it is now?

5) How much will this area appreciate in value over the next X years?

6) How much will property taxes increase?

7) How much money will we need to invest to maintain the property?

8) What type of return on investment would we be realizing if we didn’t buy the house and just stuck our money in the stock market?

9) If we flipped the house and the invested the proceeds for the next X years, how would that compare with renting the house over those years?

These are just the tip of the iceberg.  Obviously there is no way that we can identify all these values and know all these answers, but in order to try to improve my understanding of the issue, I’ve created a fairly detailed excel file to analyze as many data points as I could think of when it comes to answering: Should I buy this house and fix it up or invest my money elsewhere, and if investing in the property makes sense, should we rent it or flip it?

I’m not an expert at any of this, so take my excel file and its calculations with a grain of salt.  If anyone notices something I’ve done wrong I’d be interested to know so I can update the excel document with more accurate information.

Rent vs Flip Calculations Template Excel Document

Async winform process that reports progress

This is mostly put together from examples I pulled online, but I got it working and I figure other people could use it as well. This has a Form1 form and a ProgressForm form put I tried to put all the code together for this post.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace TestingAsync
{ 
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Console.WriteLine("Starting..");
            var mgr = new Manager();
            mgr.GoAsync(this);
            MessageBox.Show("END");
        }
    }

    class Manager
    {
        private static ProgressForm _progressForm;

        public async Task GoAsync(Form owner )
        {
            //var owner = new Win32Window(Process.GetCurrentProcess().MainWindowHandle);
            _progressForm = new ProgressForm();
            _progressForm.Show(owner);

            var progress = new Progress<int>(value => _progressForm.UpdateProgress(value));
            await Go(progress);

            _progressForm.Hide();
        }

        private Task<bool> Go(IProgress<int> progress)
        {
            return Task.Run(() =>
            {
                var job = new LongJob();
                job.Spin(progress);
                return true;
            });
        }
    }

    class LongJob
    {
        public void Spin(IProgress<int> progress)
        {
            for (var i = 1; i <= 100; i++)
            {
                Thread.Sleep(25);
                if (progress != null)
                {
                    progress.Report(i);
                }
            }
        }
    }


}

Highlighting the current file in Solution Explorer

Every time I switch version of Visual Studio I need to go looking for how to enable this feature.

When I’m working on a file, I want to see that file highlighted in solution explorer, not some other file.  I don’t want to have to go searching for the current file.  To achieve this, just go to Options>Projects and solutions>General and pick Track Active Item in Solution Explorer.

image