Blog

Categories

  • No categories

SEARCH

I’m Attending

CodeMash

Starting From Scratch Using KickoffLabs

Posted in: General by Steve on February 4, 2013

I had an idea for a site and needed to get some validation on whether or not it was a good idea. I started building a site before I had any feedback and didn’t have any validation of the website direction.

I had heard of other services, but having been a part of the developer community, I had heard of Kickoff Labs and decided to go with them. I was pleasantly surprised at how quick it was to get a site up. I was able to use a simple layout and gather email addresses for people that were interested in the idea.

In the process of getting everything finalized, I had a problem with my original domain name. I emailed support at 10PM on a Wednesday and got a response within an hour, resolving the issue. This was outstanding service.

I highly recommend using kickofflabs.com for your signup pages. 

SQL Server Backup and Restore Across Server Username Fix

Posted in: Programming by Steve on August 22, 2012

I run into this a lot while deploying new fixes. If you have a production and a stage environment, before deploying to production, you should backup and restore your database to the staging database to do all your UAT. However, if your usernames are the same, then you may run into an issue where SQL has an "orphaned" user that cannot be associated to the database (http://msdn.microsoft.com/en-us/library/ms175475.aspx).

USE [database_name]
GO
exec sp_change_users_login "auto_fix", "username";

That should get you back up and running.

Installing PostgreSQL on OSX

Posted in: General by Steve on June 19, 2012

While trying to move my development environment from SQLite3 to PostgreSQL, I ran into an issue. Following the instructions from Railscasts #342:

brew install postgresql

Got this error message:

Error: You must `brew link ossp-uuid’ before postgresql can be installed

To fix this, I had to execute the following command:

sudo chown -R whoami /usr/local/share/man/man3

Then I was able to brew install postgresql.

After doing that, I wanted to start my first database by running the command:

initdb /usr/local/var/postgres

This gave me the error:

FATAL: could not create shared memory segment: Cannot allocate memory

To fix this, I had to add a file called /etc/sysctl.conf and add the following lines:

kern.sysv.shmall=65536
kern.sysv.shmmax=16777216

Additionally, I had to add

export PATH=/usr/local/bin:$PATH

to my ~/.bash_profile file

After restarting my machine, I was then able to create the database and move on with moving over to PostgresSQL 

REF:

https://github.com/mxcl/homebrew/issues/11427

https://gist.github.com/2794006

http://jeffammons.net/2011/09/fixing-postgres-on-mac-10-7-tiger-for-django/

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.