Adding a logging file for TraceListener

Debugging the third-party apps I maintain has become more difficult since my organization is eliminating local admin accounts, and the application’s obsolete paradigm of saving log files in application folders (i.e. Program Files) is impossible in my environment, and also complicated because I must be a remote admin to use remote debugging, and my development system does not exhibit the same behavior and runs a different operating system. The app already uses TraceListener for live debug logging, and I need to configure a listener. Since major refactoring Shall Be Avoided, a golf clap for a return to remote debugging in log files :\

Reference: http://stackoverflow.com/questions/870634/overriding-system-diagnostics-trace-writeline-to-log-to-a-file

In code:  (Trace is in System.Diagnostics)

Trace.Listeners.Add(new TextWriterTraceListener(“foo.log”));

Trace.WriteLine(“Application started.”, “MyApp”);

Trace.WriteLine(“about to do stuff…”, “MyApp”);

(do stuff)

Trace.WriteLine(“stuff is done…”, “MyApp”);

Trace.WriteLine(“Application finished.”, “MyApp”);

foreach (TraceListener listener in Trace.Listeners)
{
listener.Flush();
}

Or a modification to app.config:

<configuration>
<system.diagnostics>
<trace autoflush=”false” indentsize=”4″>
<listeners>
<add name=”fileLogger”
type=”System.Diagnostics.TextWriterTraceListener”
initializeData=”LogFile.log” />
<remove name=”Default” />
</listeners>
</trace>
</system.diagnostics>
</configuration>

 

See also:

http://stackoverflow.com/questions/870634/overriding-system-diagnostics-trace-writeline-to-log-to-a-file

Create a Logger using the Trace Listener in C#

https://msdn.microsoft.com/en-us/library/sk36c28t(v=vs.110).aspx

http://stackoverflow.com/questions/27610/how-to-add-simple-tracing-in-c

http://nlog-project.org/2010/09/02/routing-system-diagnostics-trace-and-system-diagnostics-tracesource-logs-through-nlog.html

http://dickvdbrink.github.io/c%23/2015/01/09/CSharp-Logging-using-Trace-and-DebugView.html

I like the looks of this:  http://dickvdbrink.github.io/c%23/2015/01/09/CSharp-Logging-using-Trace-and-DebugView.html

NLog, log4net, and EntLib are all noted as prepackaged logging systems by http://www.thejoyofcode.com/From_zero_to_logging_with_System_Diagnostics_in_15_minutes.aspx

 

 

Posted in Uncategorized | Leave a comment

Database unit testing resources

Not strictly a linkdump, but a list of resources for database unit testing.

tSQLt, SQLunit, DBunit, dbForge

Posted in Linkdump, Programming, SQL Server, System/DB Administration | Leave a comment

Linkdump: SQL Server security through ActiveDirectory Groups, ConnectionString encryption

I swear I have a post or linkdump on this. Log now, search later!

Securing SQL Server using ActiveDirectory:

https://www.mssqltips.com/sqlservertip/1831/using-windows-groups-for-sql-server-logins-as-a-best-practice/

https://serverfault.com/questions/457798/why-does-a-d-account-need-sql-server-login

https://security.stackexchange.com/questions/98247/ad-user-vs-sql-user-for-sql-server-authentication

https://dba.stackexchange.com/questions/12453/login-to-sql-server-using-windows-authentication

Connection String encryption:

https://msdn.microsoft.com/en-us/library/89211k9b(v=vs.110).aspx

https://msdn.microsoft.com/en-us/library/ms254494(v=vs.110).aspx

http://stackoverflow.com/questions/11637348/encrypt-connection-string-in-app-config

https://msdn.microsoft.com/en-us/library/ff647398.aspx

 

 

 

 

 

Posted in Linkdump, SQL Server, System/DB Administration | Leave a comment

SQL Server linkdump: Create login, Relocate database and best practices, corruption repairs

https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=sql+server2016+create+new+login&*

https://docs.microsoft.com/en-us/sql/relational-databases/security/authentication-access/create-a-login

http://www.quackit.com/sql_server/sql_server_2014/tutorial/sql_server_user_logins.cfm

https://www.supremainc.com/en/node/618

 

https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=moving+a+database+from+one+drive+to+another+detach+database&*

http://dba.stackexchange.com/questions/52007/how-do-i-move-sql-server-database-files

https://docs.microsoft.com/en-us/sql/relational-databases/databases/move-user-databases

https://docs.microsoft.com/en-us/sql/relational-databases/databases/move-system-databases

 

 

https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=ozar+how+to+requisition+drives+for+sql+server&*

SQL Server 2005 Setup Checklist Part 2: After The Install

https://www.sqlskills.com/blogs/paul/multiple-log-files-and-why-theyre-bad/

 

 

When should you put data and logs on the same drive?

 

SAN Storage Best Practices for SQL Server

SQL University: The Basics of Storage

https://www.sqlskills.com/blogs/paul/corruption-demo-databases-and-scripts/

https://www.sqlskills.com/blogs/paul/sqlskills-sql101-dealing-with-sql-server-corruption/

https://www.sqlskills.com/blogs/paul/sqlskills-sql101-switching-recovery-models/

 

Posted in Linkdump, SQL Server | Leave a comment

replace 2008 sienna door cable

https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=replace%202008%20sienna%20door%20cable  

How to Replace Power Sliding Door Cables on 2004-2010 Toyota Sienna

Posted in Uncategorized | Leave a comment

AL in a nutshell

You can get the Players Guide and the DMs Guide from dndadventuresleague.org. I’ll explain (long, maybe TL;DR) and then at bottom summarize what you’ll need to know.

1. In AL, players control their character choices – race, class, background, feats, etc – and cannot be limited by the DM. They are allowed anything in the PHB, and some restricted things in one other book of their choosing. A.k.a, “PHB+1 book”. They can also pick a background out of any AL source. New players won’t be aware of the +1 books, and experienced players should be able to show you the book and explain the features in use. Anyone doing something you feel is strange should be able to back it up with documentation, or at your discretion you may choose to not allow it at your table.
a. Abilities are assigned with the 27-point buy system in the PHB, so a score range of 8-15, plus racial modifiers. The point-buy system generates what is called the Standard Array, which some people choose to use. (15 14 13 12 10 8, before racial modifiers.)
b. Hit points are max at first level (die type plus con mod), then each level thereafter the static number in the PHB (average + 0.5) plus con mod. For example, a rogue (d8 die type) with CON 14 (+2) starts with 10hp, and gains 7 each level thereafter.
c. Starting equipment/cash is not rolled; it is simply whatever is listed for background and class.
d. Factions are like political groups or unions or mafia, and provide free raise-dead services for their members until 6th level. (If raised this way, they get no experience and cannot replay that session.) There’s a free document on DMsGuild.com “Factions and the Adventurers League”, that describes them in depth. Their names, generally from “goodish” to “less goodish”: Harpers, Order of the Gauntlet, Emerald Enclave, Lords’ Alliance, Zhentarim.
e. Evil alignments are restricted. Only Lawful Evil, no Neutral Evil or Chaotic Evil. And LE only if you are in the Lords’ Alliance or the Zhentarim factions. The AL Player’s Guide has some rules about playing cooperatively; basically, you are expected to work together toward goals and not foil other players. The player who has a major problem with this may be asked to leave the table by the DM or organizer.
2. Characters are allowed to join to other tables/games out of sequence, so at the end of every session the DM must provide closure by awarding experience, gold, renown, and downtime, and also magic items if any were found. (The players decide who gains magic items, with the DM randomly determining in case of disagreement. Characters with lower count of magic items get first pick.) This also means someone may come in with a fresh character at the start of any adventure, even (with some DM discretion) in the middle of a multi-part.
a. If you are running a multi-part adventure, at your discretion you are able to require incoming characters to consume resources to reflect progress through previous phases.
3. Log sheets track each character’s adventures played and rewards gained. A DM is entitled to review log sheets of any character at the table. If the player is unable to back up their character or a feature with documentation on the log sheet or related certificates, the DM is able to disallow use at their table.
a. Players are not required to use the usual formats for character sheets or log sheets. This is an accessibility requirement for AL openness to all players, but it also means people can use smartphones or tablets or laptops at will. You don’t need to tolerate disrespectful behavior like playing Candy Crush, but you cannot restrict players to paper sheets either.
4. It’s nice when you’re specifically running DDIA05, which is primarily to introduce the game to players new to D&D. This makes things easier on you in a few ways.
a. DDIA05 takes characters quickly from levels 1 to 5 by using milestones. Any character is legal for play as long as they are levels 1-5, but not 6+.
b. The milestones assign pre-calculated experience (and, I think, also downtime and renown) for each part of DDIA05, but gold depends on player actions.
c. Most new players especially in DDIA05 should simply use pre-gen characters. Organizers typically provide stacks of pre-gens.
5. You gain rewards for DMing! AL PDFs typically state how much exp, gold, and downtime you gain as a reward “package”, or you gain per 2 hours played in the hardcovers. The package can be applied to any of your characters at any time. Track it on your own DM log sheet. The DM Quest Rewards list can be downloaded free from DMsGuild.com.
6. In a convention environment, AL DMs must stick to a strict time schedule for their table. If that means cutting content short or eliminating encounters, do what you need to do to wrap up the table on time. (Personal note: When I’m running behind I try to cut out less important stuff in the middle, and leave the final encounter if possible. It’s the big finish, which everyone remembers.)
a. In that light, I try to let the players do the role-playing. DM roleplaying toward each player can take a long time and that often cuts down on the amount of content covered.

Summary:
1. Encourage pre-gens for fresh players. If they make a character, they don’t roll anything.
2. Factions are how you save your game.
3. DMs end each session by awarding exp, gold, downtime and renown. And magic items.
4. Players decide where/what they will play next.
5. Use log sheets to record your rewards, as a player and as a DM.
6. Play nice! (This does not apply to DMs. Mwuhahaha.)
7. DDIA05 simplifies things for you.
8. Watch your time.

Posted in RPG / D&D | Leave a comment

Drink?

This question came up at the office today:

Do you drink a lot

<awkward pause>

of coffee?

Posted in Office, Quote of the Day | Leave a comment

Removing Email from msdb Database

http://www.databasejournal.com/features/mssql/removing-email-from-msdb-database.html

Posted in Uncategorized | Leave a comment

Linkdump: PowerPivot, Power View

http://sqlmag.com/sql-server-2012/understanding-powerpivot-and-power-view-microsoft-excel-2013

https://support.office.com/en-us/article/Create-a-Data-Model-in-Excel-87e7a54c-87dc-488e-9410-5c75dbcb0f7b?CorrelationId=78e51730-55c5-44fb-8c9e-8897cb9e691e&ui=en-US&rs=en-US&ad=US&ocmsassetID=HA102923361

Learning Path

SQL SERVER PRO RESOURCES
For more information about PowerPivot, see
A Walkthrough of PowerPivot for Excel 2010
What’s New in Microsoft SQL Server 2012 PowerPivot

For more information about Power View, see
Introducing Microsoft Power View
Getting the Most Out of Microsoft Power View

OTHER RESOURCES
For an example of content that leverages both PowerPivot and Power View, see
Tyler Chessman’s Excel 2013 U.S. Debt Workbook

For more information about Excel 2013, see
Excel 2013: Implications for PowerPivot and Excel Data Import Users, Part I
What’s New for Excel 2013 Developers

Posted in Uncategorized | Leave a comment

DAX formatter

http://www.daxformatter.com by Marco Russo and Alberto Ferrari

 

Posted in Business Intelligence, Linkdump | Leave a comment