Tuesday, July 22, 2014

Saving and Sharing Web Page Performance Information from Chrome

I was perusing a web site during lunch and once again lamenting its performance. I fired up the devtools for chrome and the Network tab does a good job of showing you the sticking points in the app and I was wondering if there is a way to share this sort of information. It turns out there is. The data from the Network tab can be saved in a format called HAR. HAR is a JSON format that contains all of the data you see in the network tab in devtools.

There appear to be quite a few tools available for allowing you to view HAR data. The most accessible one I found was here http://ericduran.github.io/chromeHAR/

A good summary of HAR files is here



If you want to save data from the network tab in a HAR file in Chrome devtools, right click in the log of network traffic and select Save As HAR With Content. This file can then be dropped onto the above HAR viewer page and you can see the output, including the timeline.

Friday, June 27, 2014

Cleaning up Disk Space on Your Machine

One recurring annoyance with working on lots of different projects is that over time your disk just gets full. Working in many MS SQL Server databases over the years I've noticed that there is a pretty simple way I can usually reclaim a lot of diskspace from SQL Server on my machine. I currently have over 100 development databases on my machine and a lot of those were one time uses. I'm sure I could remove a bunch of them, but in a pinch, this allowed me to very quickly reclaim over 30GB of disk space

Dynamically generate the dbcc shrink database syntax for all of the databases on my box

select 'dbcc shrinkdatabase([' + name + '], TRUNCATEONLY);' from sys.databases where name <> 'master'


copy the output into a sql server query window and run it

I had issues with one database because it was restoring. After removing that database from the list of queries, it ran rather quickly and I got a gobs of disk space back. If you have databases on your machine that you do not want to shrink, you can remove those from the list

For more information on SHRINKDATABASE

http://msdn.microsoft.com/en-us/library/ms190488.aspx

Update

You can use the following to generate a dynamic sql statement and execute it using EXEC

DECLARE @SQL VARCHAR(MAX)

select @SQL = COALESCE(@SQL,'') + '
dbcc shrinkdatabase([' + name + '], TRUNCATEONLY);' from sys.databases
where name not in ( 'master', 'model', 'tempdb', 'msdb')

print cast(@SQL as ntext)

EXEC(@SQL)