Blog

Categories

  • No categories

SEARCH

I’m Attending

CodeMash

LogParser Hits Per Day on Specific Page

Posted in: Programming by Steve on May 10, 2012

I was trying to get hits per week on a specific page, but I had to settle for exporting to a CSV and doing the rest in Excel.

logparser -i:IISW3C -o:CSV "SELECT TO_STRING(TO_LOCALTIME(TO_TIMESTAMP(date, time)), 'yyyy-MM-dd') AS [Day], COUNT(*) AS [Requests] INTO hits_per_day.csv FROM *.log WHERE cs-uri-stem = '/login.aspx' GROUP BY [Day] ORDER BY [Day]"
Reindex All Tables in Database (SQL Server)

Posted in: Programming by Steve on December 7, 2011

Another thing I do a lot and always forget about:

EXEC sp_MSforeachtable @command1="print '?' DBCC DBREINDEX ('?', ' ', 80)"
GO
EXEC sp_updatestats
GO
Execute all SQL Scripts in a Directory

Posted in: General by Steve on November 18, 2011

For my own sanity, I can never remember  this so I’m just posting it

Open CMD Prompt

CD to the directory where all the scripts are located

Use for Windows Authentication:

C:>for %f in (*.sql) do sqlcmd /S <servername> /d <dbname> /E /i "%f"

OR for Username/password:

C:>for %f in (*.sql) do sqlcmd /S <servername> /d <dbname> /U <username> /P <password> /i "%f"

And instead of outputting to the screen, i’ll usually redirect it out to a file so I can review all scripts later

OSX Lion 10.7 Sound Issue Fix

Posted in: General by Steve on September 10, 2011

So after upgrading my MacBook to Lion, I noticed that every once in a while, my sound would go away. I wouldn’t be able to listen to anything using the laptop speakers. I could plug in headphones, but if I wanted to play music for the kids, I wouldn’t be able to. I’ve been searching around for an answer and finally found one in the Apple forums.

The fix that worked for me was opening a Terminal window and running this command:

sudo killall coreaudiod

This will stop the sound and then restart it after a couple of seconds.  This re-enabled the sound on the laptop.

Hope this helps anyone else because I was very frustrated after the upgrade.

Music of 2010

Posted in: Music by Steve on December 24, 2010

Every year, Brad Wilson reviews the albums of the year.  I thought that I would put together my own list of songs of Electronica that I listen to each day at work for this last year.

D-Mad – She Gave Happiness (Arty Remix)



Deadmau5 – Some Chords – 4×4=12



Pendulum – Part 2 (Dusk) – The Island



Daft Punk – Derezzed – TRON:Legacy Soundtrack



Arty – The Wonder – Anjunabeats Vol. 8



And for last, one that doesn’t fit, but just blows my mind.

Deftones – Sex Tape – Rocket Skates

Building SQL Server T-SQL with Error Handling

Posted in: Programming by Steve on December 1, 2010

Today, my manager asked me how I build my T-SQL scripts when I need to update a bunch of data in SQL Server.  I hadn’t really thought much about it, but this is what I normally use.

DECLARE @ErrorCode INT

BEGIN TRANSACTION

	--UPDATE A TABLE OR SOMETHING

	SELECT @ErrorCode = @@ERROR
	IF (@ErrorCode <> 0) GOTO PROBLEM

	--DO SOMETHING ELSE

	SELECT @ErrorCode = @@ERROR
	IF (@ErrorCode <> 0) GOTO PROBLEM	

COMMIT TRANSACTION

PROBLEM:
IF (@ErrorCode <> 0)
BEGIN
	PRINT 'Error Executing Script: Error Code: ' + @ErrorCode
	ROLLBACK TRANSACTION
END

Not sure how anyone else does it, but that’s how I roll.  Any suggestions on how this could be improved? 

Finding a Replacement Program for Microsoft Money

Posted in: Technology by Steve on November 22, 2010

Microsoft Money

Microsoft Money has been my main software for managing my finances since I can remember.  I think the first version I used was Money 95 for free back in the day.  I had tried Quicken, but was unimpressed and went back to using Money.

I have mostly used Money as a way to track accounts (checking, savings, loans & investments) and used as a calendar for upcoming bills.  I wasn’t using any of the advanced features since I really had no need for them.  I really just needed reminders to pay bills since I am really bad at remembering what needs to go out and when.  My wife can attest to that.

When I heard the announcement that Microsoft was discontinuing updates to Money, I was rather disappointed.  I am so used to the interface and has become a part of my nightly routine to monitor my financial situation.

So now, I have to find something that can take it’s place.  I’d like to use something for the Mac, but I’ve not heard good reviews on Quicken for Mac, but I have yet to evaluate it.

Here are some that I am looking at using:

  • MoneyWell – I already have purchased this software, but it does not have a very good calendaring system to notify you of upcoming bills.
  • You Need a Budget - looks pretty intense and could have a lot of awesome features, but I don’t see a lot on bill scheduling and reminders.
  • MoneyDance – haven’t heard much about it yet.
  • Mint.com – I have been using a mint for a long time, but it doesn’t have a nice register or a way to remind you of bills that it’s not signed up for (such as ComEd, Nicor or other local bills).  It’s one of the most requested features on their forums, but they haven’t set up a way to add a manual recurring bill yet, so this ends up not working for my purposes.

Right now, I’m leaning toward trying out Quicken for Mac and You Need a Budget to help wrangle our finances once Money goes away.

 

Another piece to the Home Entertainment Network

Posted in: Technology by Steve on November 21, 2010

After so many different posts about Comcast and their horrible service and inability to help my with my bill, I’ve been slowly building up my entertainment devices and different things that will allow me to get rid of cable.  The next thing is trying to link up my upstairs network with my downstairs TV.  Unfortunately, I can’t run a hard wired ethernet from upstairs to downstairs because I don’t know what’s between the floors to get it through.  So wireless-N is the solution I need.

I already have a D-Link dual band router running my wireless network so getting another one of their products seemed like a good idea so I’m not worried about different product issues. I decided to get the D-Link DAP-1522 Xtreme 4-Port GigaBit Selectable Dual Band Draft 802.11n N Duo Wireless Bridge/Access Point

I’ll be keeping my Xbox downstairs and hooking it up to the wireless bridge because I’ve heard bad things about the Xbox wireless adapter.  I think this is one of the last pieces to allow me to break free of cable.  Once I make a full transition, I’ll have a full blog post on the entire setup with pictures.

Now the last thing to do is to stop watching sports.

Getting Rid of Cable

Posted in: General by Steve on November 8, 2010

Looks like I’m not the only one fed up with Comcast and other providers:

http://www.newsvine.com/_news/2010/11/04/5409798-cable-subscribers-flee-but-is-internet-to-blame

Netflix is definitely giving us a reason to move on to cheaper alternatives.

Issue Installing Gems with Ubuntu 10.04, RVM and zlib

Posted in: Programming by Steve on October 30, 2010

So after writing up the tutorial on getting a Linux VM setup, I came across and issue where I couldn’t install gems. I would get the following error message after trying to install any gem:

ERROR: Loading command: install (LoadError)
  no such file to load – zlib
ERROR: While executing gem … (Name Error)
  uninitialized constant Gem::Commands::InstallCommand

image

I found the answer in the RVM documentation: http://rvm.beginrescueend.com/packages/zlib/

Execute these commands:

rvm package install zlib
rvm remove 1.9.2
rvm install 1.9.2 -C --with-zlib-dir=$HOME/.rvm/usr

This will install zlib in your ~/.rvm/usr directory.

I could then move forward setting up my development environment.