The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,465 other followers

Archive for December, 2012

Nice! @Flickr holiday gift: 3 months of Pro membership…

Posted by jpluimers on 2012/12/29

Just got my free Flickr holiday gift: 3 months of Pro membership.

If you have a free Flickr account, it will give you three months of Pro to try it.

Yay!

You have now activated your Flickr Holiday Gift.

We’ve extended your Flickr Pro subscription for an additional 3 months at no charge.

Your Pro Account expires on 16th December, 2013

–jeroen

Posted in About, Flickr, Personal, Power User, SocialMedia | Tagged: , , | Leave a Comment »

Excel Grid lines: How do you make Excel print those cell lines? – AfterDawn: Forums

Posted by jpluimers on 2012/12/28

One thing I always forget (especially since the UI in Office 2007 changed quite a bit, but the idea below gets me going).

I’m assuming you want to print the grid…

  1. File > Page Setup,
  2. then go to the Sheet tab.
  3. On that page, under Print, there’s a checkbox called “Gridlines”.

–jeroen

via How do you make Excel print those cell lines? – AfterDawn: Forums.

Posted in Excel, Office, Power User | Leave a Comment »

Wow, Comment SPAM is just like how politicians talk: use loads of sentences, but say nothing.

Posted by jpluimers on 2012/12/26

If recent comments like below are flagged automagically as SPAM, then any political info will get auto-flagged as SPAM too (:

There are actually loads of details like that
to take into consideration. That may be a nice point to convey up.
I offer the thoughts above as common inspiration but clearly
there are questions just like the one you deliver up where an important factor will likely be
working in sincere good faith. I don?t know if finest practices have
emerged around issues like that, but I am sure that your job is
clearly identified as a good game. Both boys and girls really feel the impact of
just a second’s pleasure, for the remainder of their lives.

–jeroen

 

Posted in Opinions | Tagged: | Leave a Comment »

.NET/C#: use Assembly.GetName() if you to access internal/private information from Assembly

Posted by jpluimers on 2012/12/26

There is a lot of information in Assembly that is either internal or private. Luckily you van get an AssemblyName instance through Assembly.GetName() or Assembly.GetName(Boolean) which has quite a few public members that get initialized while calling the internal AssemblyName.Init method.

This is the member mapping of AssemblyName members to Assembly members:

AssemblyName member Assembly member
Name GetSimpleName() *internal
GetPublicKey() GetPublicKey() *internal
GetPublicKeyToken() null
Version GetVersion() *internal
contains the AssemblyVersionAttribute of the assembly
CultureInfo GetLocale() *internal
HashAlgorithm GetHashAlgorithm() *private
VersionCompatibility AssemblyVersionCompatibility.SameMachine
CodeBase GetCodeBase(Bool) *internal
Flags GetFlags() | AssemblyNameFlags.PublicKey
KeyPair null
ProcessorArchitecture complex set of calls

–jeroen

via: Assembly.GetName Method (Boolean) (System.Reflection).

Posted in .NET, .NET 3.5, .NET 4.5, ASP.NET, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, Development, Software Development | Leave a Comment »

Re-adding a user to SQL Server 2000 and up when it was Orphaned

Posted by jpluimers on 2012/12/25

In SQL Server 2000 and up, the easiest way to re-add a user that got orphaned is with a script like below.

The script does not correct the SID, but in stead sets new permissions (in this case, db_datareader and db_datawriter). Most of the times that is not a problem.

The script uses these stored procedures:

  1. sp_dropuser – drops a user from the current database
  2. sp_droplogin – drops a login from the current server
  3. sp_addlogin – adds a login to the database server
  4. sp_adduser – adds a user to the current database (you can add both a SQL user – with name and password – and a Windows user)
  5. sp_addrolemember – adds a member to a certain role

More modern versions have alternatives to these stored procedures, but the stored procedures work with the widest ranges of SQL Server versions.

-- Execute this script as SA or DB Administrator

use MyDatabase -- the databae where you want the user to be re-added to

-- you cannot perform a 'use [MyDatabase]' without destroying the context (and declared variables)
-- http://stackoverflow.com/questions/9165513/sql-server-change-current-database-via-variable
-- it is possible with exec (@exec_stmt) (as sp_droplogin does it), but it is a bit cumbersome for a relatively simple script

declare @loginname sysname
declare @passwd sysname

set @loginname = 'MyUser'
set @passwd = 'MyPassword'

-- from current database
exec sp_dropuser @loginname

-- from server
exec sp_droplogin @loginname

-- to current server
exec sp_addlogin @loginname, @passwd

-- to current database
exec sp_adduser @loginname

-- roles to add the user to
exec sp_addrolemember db_datareader, @loginname
exec sp_addrolemember db_datawriter, @loginname

If the user didn’t exist in the database, or didn’t exist as a login on the server, you can get two errors like these: Read the rest of this entry »

Posted in Database Development, Development, SQL Server, SQL Server 2000, SQL Server 2005, SQL Server 2008, SQL Server 2008 R2, SQL Server 2012, SQL Server 7 | Leave a Comment »

 
%d bloggers like this: