Categories
Business Intelligence SQLServerPedia Syndication

SSRS Report – No Page Breaks For You!

One thing I usually run into when creating SQL Server Reporting Services (SSRS) Reports is this: You have a smallish size dataset back, maybe somewhere between 50 and 150 rows, but if it hits that row limit on the page break, you get 3 records on the next page. Annoying. What I usually do for reports like this is just make them all one big page. How? Pretty simple actually. Set the “Interactive Height” to 0 on the report.

Open up Report Builder (or BIDS) and get to your “Report” Properties, and then under “Interactive Size” set the height property to zero. Thats it.

Once you make this minor change, you report will just list your row with no page breaks. Pretty useful for that report with 3 more rows than a page!

Categories
Geeky/Programming SharePoint SQLServerPedia Syndication

SharePoint 2010: Track User Profile Changes Over Time Using MERGE

I recently blogged about a report you can write to see what users don’t have managers in SharePoint 2010 (get your Org Browser fixed!). Well, how about tracking who get’s added or deleted every day, or edited? You could probably look at the ForeFront Identity Manager that SharePoint 2010 uses and do some logging or use the API to log things, but that is.. well, harder than this.

What I wanted to do was keep logs for debugging and reporting. Who is getting added to SharePoint 2010 user profile sync? Is last user added to Active Directory a valid user, or a system account? Now, you could query Active Directory (just like finding users without managers) but I am guessing that most SharePoint Admins don’t have AD access, so they need another way.

What I did was create another database on my database server where the SharePoint content and profile databases are stored, so I can use it as a dumping ground.

What you need to do is create a table to dump the profile table and then every day do a SQL MERGE into it and save the changes. This is where it gets interesting

First, create your table (for this example I am only tracking NTName and PreferredName, so “domainusername” and “Name, User”, but you could easily add other columns.)

CREATE TABLE [dbo].[SharePointUserTracking](
	[RecordId] [bigint] NOT NULL,
	[NTName] [nvarchar](400) NULL,
	[PreferredName] [varchar](256) NULL,
 CONSTRAINT [PK_SharePointUserTracking] PRIMARY KEY CLUSTERED
(
	[RecordId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

Once you have your table, you are ready to create your MERGE query, track the changes, and the get it scheduled up. So what we want to do is MERGE our UserProfile_Full data from our ProfileDB into our new table, tracking INSERT, UPDATE, and DELETE’s as well, in a tracking table. Let’s create our “tracking changes” table:


CREATE TABLE [dbo].[SharePointUserProfileDelta](
	[ExistingRecordId] [bigint] NULL,
	[ExistingNTName] [nvarchar](400) NULL,
	[ExistingPreferredName] [varchar](256) NULL,
	[ActionTaken] [nvarchar](10) NULL,
	[NewRecordId] [bigint] NULL,
	[NewNTName] [nvarchar](400) NULL,
	[NewPreferredName] [nvarchar](256) NULL,
	[LogDate] [datetime] NULL
) ON [PRIMARY]

GO

Notice the column “ActionTaken” to track what we do, INSERT, UPDATE, DELETE.

Now, for the super merge (note, the profile DB might not be named the same, also note the collation thing you need to do.. may or may not to do this in your environment)

  MERGE dbo.SharePointUserTracking AS target
    USING
            (SELECT RecordId,NTName,PreferredName FROM SP2010_ProfileDB.dbo.UserProfile_Full) AS source
            (RecordId,NTName,PreferredName) ON (target.RecordId = source.RecordId)
    WHEN MATCHED AND target.NTName  source.NTName COLLATE SQL_Latin1_General_CP1_CI_AS OR target.PreferredName  source.PreferredName COLLATE SQL_Latin1_General_CP1_CI_AS THEN
        UPDATE SET
                  NTName = source.NTName,
                  PreferredName = source.PreferredName
      WHEN NOT MATCHED THEN
          INSERT (RecordId,NTName,PreferredName)
          VALUES (source.RecordId,source.NTName, source.PreferredName)
      WHEN NOT MATCHED BY SOURCE THEN
            DELETE
      OUTPUT deleted.*, $action, inserted.*,GETDATE() INTO dbo.SharePointUserProfileDelta;

Now, you can schedule that to run after your daily user profile sync job in SharePoint and then you have a running log of changes, which you could make an SSRS report off of easily or do whatever you want with it. Pretty cool! Just know, you can use this method to track changes to any table.. slowly changing dims and even more.

Categories
Geeky/Programming

LINQPad to MS CRM 2011

This morning I blogged about using LINQPad to query an XML file. Well did you know you can also query a Microsoft Dynamics CRM 2011 (in the cloud?!?) version directly from LINQPad? Pretty sweet.

The use of LINQ has become more and more prevelant in the last few years, from .NET Developers using LINQ2SQL, and just using LINQ for object queries, and everything in between (when is there going to be a LINQ2OLAP??)

First, you need to install LINQPad, and then you need to download and configure the
LINQPad Plugin for Microsoft Dynamics CRM 2011.

Once you have that all set you can go and get your LINQ Query on.

The possibilities are pretty much endless here, but yeah, now you can run ad-hoc queries against your CRM installation, which is pretty cool. If you want more samples, install the CRM SDK and do some code diving, you will find some LINQ queries they do in the SDK, which is how I initially got the idea to try using LINQPad.

Categories
Geeky/Programming

Create a Word Cloud From Your Twitter Feed

I love playing with data. My data makes it even more fun. Wordle has been around for a long time, and so has Twitter (in Internet years anyways). I have always been fascinated by word clouds and visualizing text patterns, etc.

I figured that hey, there has got to be some analyzer for your twitter stream, and I am sure there are a ton, but I didn’t stumble upon any with some easy Googling, so I did it the hard way.

First goal? Get your Twitter feed and/or data somehow. Multiple ways to do this, but I stumbled upon a pretty cool site. http://tweetbook.in that let’s you create an eBook from your Twitter feed and favorites. It let’s you publish out as a PDF or XML file, so I figured that would work. It is a busy site and you may have to wait to get in but once you do you just oAuth it up to Twitter and grab your data.

Now, once you have your data, you need to do something with it. The data would be in XML so you need to parse out the data you want, for instance, I wanted to analyze my “favorites” so I wanted to get the text out of the XML. Here is my first favorite on Twitter (by the way, it will only go back 3200, I think – I only have 2600 or so faves)

  881539697
  A "Manager" class is like my grandmother's junk drawer.
  Fri Aug 08 14:23:56 +0000 2008
  web
  jeremydmiller
 

Well I just want to grab that <text> value, and without having to do any programming or powershell or C#, I fired up trusty old LINQPad (more on this tool in future posts for sure). I then just wrote a quick little query against the XML file like so:

var xml = XElement.Load (@"c:fave.xml");

var query =
  from e in xml.Elements()
  select e.Element("text").ToString().Replace("","").Replace("","").Replace("RT ","");

query.Dump();

As you can see, I am just loading up the xml file and doing some text cleanup (removing the xml text blocks and removing RT’s, the old syntax which muddies up the results). Note in LINQPad you need to change the query type to C# Statements instead of the default C# Expression.

Once I had my values in the results I wanted, I did a quick CTRL+A, CTRL+C (it still baffles me how many people don’t know CTRL+A is “Select All”) and then pasted it into notepad++, to view, and cleaned up some html characters there (quotes, etc) and then pasted it into Wordle. Here is what I got back:

wordle_of_my_favorites

You can see I really like to favor SQL Server, Microsoft, iPhone, Blogs, sqlpass, Google, SharePoint, Twitter, and pretty much everything geeky. Pretty dang cool. Why doesn’t Twitter offer something like this? I think it would be cool. What other cool things have you done with your “data” – what cool things would you like to see?

Categories
Geeky/Programming SharePoint

SharePoint Report – Missing Managers

Trying to roll out SharePoint at an org can have it’s hard times. One is trying to get User Profile sync working well and making sure the Org Browser works well goes along with that. You can sync over the manager from AD and everything falls into place, but their might be users you are pulling that don’t have a manager set. Now of course you can query AD for this, but you would have to already know the filters and OU’s you are pulling into SharePoint. Another way to do this (and of course, disclaimer here, don’t try this at home if you are scared of querying SharePoint databases, and yes, it probably isn’t recommend, but I am doing it anyways). Here is a query you can use to get the User’s with no manager, and also join it back to get some other attributes such as department, office, and title so you can figure out where they are and who their manager might be (helpful in a larger org). You can easily throw this in an SSRS report, and have it email whomever maintains the managers in AD or in your organization. (Note, SP2010_ProfileDB might not be the name of your actual profile DB, you would have to change that in the query below)

SELECT up.RecordId,PreferredName,NTName,Email, office.Office, titles.JobTitle, dept.Department
	FROM dbo.UserProfile_Full up
	LEFT OUTER JOIN (SELECT [RecordID]
      ,[PropertyVal] AS 'Office'
  FROM [SP2010_ProfileDB].[dbo].[UserProfileValue]
  WHERE PropertyID = 11) office ON up.RecordId = office.RecordId

	LEFT OUTER JOIN (SELECT [RecordID]
      ,[PropertyVal] AS 'JobTitle'
  FROM [SP2010_ProfileDB].[dbo].[UserProfileValue]
  WHERE PropertyID = 13) titles ON up.RecordId = titles.RecordId

	LEFT OUTER JOIN (SELECT [RecordID]
      ,[PropertyVal] AS 'Department'
  FROM [SP2010_ProfileDB].[dbo].[UserProfileValue]
  WHERE PropertyID = 14)dept ON up.RecordId = dept.RecordId

	WHERE
	Manager IS NULL
	ORDER BY Office
Categories
Agile

Agile: Day of Autonomy, 20% Time, etc

A about a year ago or so, I watched the RSA Animate short on YouTube,

httpv://www.youtube.com/watch?v=u6XAPnuFjJc

RSA Animate – Drive: The surprising truth about what motivates us

Go ahead, watch it, pretty good and just a little over 10 minutes.

One takeaway I got from the short was this: The “Day of Autonomy”. If I remember, they talk about a place where once a quarter or something they let everyone have a day of autonomy, to do whatever they want, but the goal is, at the end of that day, they need to show the group what they did. They saw people doing things that were probably never on any agenda or plan, but some things could help the company and spurred other ideas.

Google is infamous for their “20% time”, which has created things like Gmail, and more.

Just recently, I decided to give this a go in the Business Intelligence group, a day of autonomy. Our velocity for that sprint would be slightly lower, but I was intrigued to see what would come out of it.

The results are still being analyzed, but yeah, seeing some cool things. I think for the next one (if we do it), we will need to plan it a little better to get the results shown to everyone. We are a semi-distributed team, so there are some challenges there.

Overall though, I think the Day of Autonomy is probably a good thing, as long as it isn’t taken advantage of. The players on the team should just be bursting with ideas that they should have no problem coming up with something to do. If you don’t have ideas always swirling on something you could crank out or improve, then you probably need to start there and think a bit differently on how you approach your work.

To me, it almost adds on to the Agile way, being able to do things like this yet still adjust and be flexible, and get some great output on regular stories as well. Always keep improving.


Categories
Blogging

Dusting off the Blog Theme

Most people that might follow this blog probably hit it though RSS readers, or a post here or there from a Google search, so the changes aren’t probably noticeable to many, but they are to me.

Having started blogging back in 2004, on Blogger, and then a year or so in moving to WordPress (self hosted) – but moving it and changing it over time, you get some cruft. Back in the day, things weren’t so “easy”. You wanted a change, it meant PHP time. Over the years WordPress has become more and more “drag and drop” if you want it to be, of course you can still code whatever you want in your themes, etc, but the “widget” concept is pretty cool.

I think the last time I changed my theme in a major way was around 2006 or 2007, (if I remember, it was a “code camp” Saturday with Joel Dahlin at G Allens). It didn’t change too much but I think I started with Google AdSense after the last theme change. In order to do what I wanted it was code code code

Fast forward to today, where the theme is looking outdated, hard to update, etc. I wanted something new. Without totally jacking everything I had, I wanted to start fresh but yet be able to continue what I am doing and how I want to do it. The ads on the site pay the bills, for the hosting and other tools I use. By no means am I living high off the hog, but it is nice to have the site pay for itself and also allow me to do other projects online.

I searched around a bit, and was looking at WooThemes and others, but then stumbled into Headway. It really isn’t a “theme” in the sense that most other themes are, but a framework/system to be able to do whatever you want easily, visually, etc.

I set it up and I am really liking it so far, I have some ideas where I can go at my own pace yet keep things they way I want them easily, fully extensible and the “code” I might use isn’t at all embedded in the PHP files of the theme, but configurable like a modern CMS.

I hope to get more pictures and article, magazine type look as I move forward, that’s the goal anyways. It’s fun to dust off the site and theme and get back into it a little bit, so much out there to learn and use, pretty cool, also is making me rethink all my plugins I have been using, etc.

Another minor changes? I changed the favicon to my current avatar, which is kinda cool.

Another minor note, I am approaching 1000 posts on this blog. I should amend my 2011 goals and try to get to 1000 by the end of the year.

More to come as time goes on, as always.


Categories
Geeky/Programming Product Reviews

Winforms DevExpress Grid

In the current agile sprint for the dev team I manage, we decided to start replacing ListViews (custom ones at that) and grids with the XtraGrid from DevExpress.

Now, normally I shy away from 3rd party controls, or want to vet them, but I knew there was no way we could do the same functionality in the default grid in .NET. One of the guys on the team did a story the sprint before to do a proof of concept comparing various grids and showing the pros and cons. DevExpress came out ahead, functionality and performance.

What we are seeing now is huge gains. We can use the new grid and functionality we couldn’t even begin to think of, is there by default. Grouping, searching, filtering, FAST performance, print preview and formatting, etc, etc, etc. Tons of options.

In fact, there are TOO many options. It makes it hard for us to digest all the possibilities in what we want to turn off, or how to integrate with existing forms, etc. A good problem to have.

All I know, is if you are doing any serious .NET work (Winforms, WPF, even Web/Silverlight) – it might make some sense to take a look at DevExpress. Focus on your business rules and integrating other parts of your systems, not reinventing the wheel with a crazy custom grid.

In the coming months I will try to talk about other areas that you can “outsource” to 3rd parties, where it makes sense. (And no, I don’t get anything from DevExpress for this post. Just calling it how I see it).

Categories
Life

1st Quarter Goal Update – 2011

Holding myself accountable here..

where are we at from the Jan 1st goal list?

  • Blog More – have been trying to! Could do more here. (14 in March, 2 in Feb, 3 in Jan)
  • Complain Less – same here.
  • Lose Weight – down 10 lbs, was down 15, want to keep going.
  • Spend more Time with Ella and Emily – been trying to do this, need to do more
  • Learn to Cook (more) – signed up for a class through MATC was supposed to be in March, was cancelled, going to have to look into this one more..
  • Develop a cool application/site/thing and ship it – got a wp7, now just need to “build” something
  • Drink less coffee, and beer – failing at this one 🙂
  • Purge things I don’t use – spring cleaning is coming up, sold stuff on ebay too.
  • Organize things physical and digital – need help on this one, or time
  • Consolidate Services I use – working on it
  • Take more pictures – failing at this one
  • Ride my bike more, maybe start running again – did some running in Jan/Feb (lost weight remember) but have been slacking. Bike riding season is right around the corner.
  • Go camping often – camping season is coming up, hopefully will get out more.
Categories
Geeky/Programming Product Reviews

Windows Phone – Samsung Focus

Picked up a Samsung Focus yesterday, device only, no contract. Testing it out. Going to do some development and what not. More to come on this front, but after using it for the first few hours..

1. Can’t connect to hidden wifi networks.

If you have your wireless network hidden, you are out of luck, you need to have the SSID broadcast

2. Facebook Sync doesn’t work (or work well) when you have Facebook account settings set to HTTPS

I can see this happening right now as Facebook just turned that on recently and the phone doesn’t know how to handle, but it should.

3. It’s light.

Can hardly feel it in my pocket

4. I like the UI but seems very “jumpy”

seems like you bounce around a lot.

Other than that, still getting to know it. I haven’t moved my SIM card over yet (btw, the iPhone 4 is a mini SIM, so you need an adapter), but I might, we will see.