#SharePoint Daily WTF: Complexity

November 11, 2011 Leave a comment

So yesterday I came accross a particular piece of code that I couldn’t accept. Not only that, I can’t really see how da hell someone has the ‘awesome’ idea of putting it together.
What amazes me the most is that it was clearly done by someone who had no idea what he/she was doing.
some people say I criticize too much but for god sake, I do that to myself and it is to keep on improving.

anyway, Have a look at the code:

<code>

private SPListItem GetPageDataByBrand()

{

if (string.IsNullOrEmpty(Brand))

{

Brand = new PolicyDao().FindByPolicyNumber(PolicyNo).Quote.Brand.Name;
bool catchADE;

foreach (SPWebApplication wa in SPWebService.ContentService.WebApplications)
{

foreach (SPSite sc in wa.Sites)
{

catchADE = sc.CatchAccessDeniedException;
sc.CatchAccessDeniedException = false;
try
{

SPFeature sf = sc.Features[new Guid("32b12f24-a926-4b66-92d6-43eb3011febd")];

}
catch (IndexOutOfRangeException) { continue; }
//Ignore the web apps which we do not have access to.
catch (SqlException) { continue; }

try
{

foreach (SPWeb sw in sc.AllWebs)
{

using (sw)

{

PublishingWeb pWeb = PublishingWeb.GetPublishingWeb(sw);
foreach (PublishingPage pp in pWeb.GetPublishingPages())
{

if (pp.Layout.Name.Contains(“QuickQuote”))
{

if (pp.ListItem["Brand"] as String == Brand)
{

return pp.ListItem;

}

}

}

}

}

}
catch (Exception e)
{

//TODO SP Logging

}
finally
{

sc.CatchAccessDeniedException = catchADE;
sc.Dispose();

}

}

}

}

}

}

</code>

As you can easily see it:
1) nests 4 loops which by itself is a big no! In this scenario it means that this code can potentially go through every single sharepoint page to find a particular one. My questions
- isn’t search meant to do that?
- what are you trying to acchieve? sadly enough I can’t ask the person who did it because this company is long gone from this environment.
- SharePoint environments can get quite big, that means this code could potentially iterate a million times.
2) What if a particular site isn’t a publishing web, is it going to work?
- why do you need a publishing web if you are just returning a list item anyway? Ok, I understood he/she wanted to see if layout was quickquote. So what?
3) Thanks for saying there must be logging….
4) What are you doing with that SPSiteCollection.Features????

5) Thanks for wrapping the SPSiteCollection with a ‘using’ statement

Sorry but I just can’t accept devs who do this kind of thing. Please, I reckon you should give up and become something else.

Two possible ways to solve that:
1) Replace that by search. Include your ‘Brand’ and ‘ContentType’ field as managed properties and that will do the trick just fine.
2) create a reference links list. That could allow some extra flexibility as you can add some other parameters to it and use it as a resources list. Given the nature of this solution I decided to go for that.

Categories: Daily WTF, SharePoint

SharePoint databases – Conflicts

October 25, 2011 2 comments

After I published my list with all SharePoint 2010 database information I decided to collate the information I can find on TechNet as of today(2011-10-25 – 25/10/2011 – 10/25/2011 :P ). The idea is to send it to the TechNet guys and Bill Baer to have a look.

Conclusion is that the information is inconsistent, as many other info about SharePoint in TechNet. Amazing that TechNet and MSDN are so prestigious for delivering all information the community needs but I am so used to find misleading information on TechNet that I often end up confirmind what there reading SharePoint related blogs. Not to mention all the situations where I can only find what I need in blogs.

Anyway, the comparison is attached and show conflicting information between all of them.

I was led to understand Bill’s material is the most up to date one so I am following his and therefore I suggest everybody doing so :)

After a careful analysis you’ll see that Bill’s is really the most updated one as most things are changing from unsupported to supported. That basically means MS has tested it properly after SP1.

Here you go a list of all conflicts I identified:

Mirror Async Log Shipping
Database  Bill    DB
Types
 Bill Db
Types
DR  Bill DB
Types
 DR
Log
WSS_usage yes yes no yes yes yes yes yes
Application_Registry_server_DB_ yes yes yes no no yes no no
WebAnalyticsServiceApplication_StagingDB_ yes no no yes yes yes yes yes
WebAnalyticsServiceApplication_ReportingDB_ yes yes no yes yes yes yes yes
User  Profile Service Application_SyncDB_ yes no no no no no no no
User Profile Service Application_SocialDB_ yes no no no no yes no no
Managed  Metadata Service_ yes yes yes no yes yes no yes
PerformancePoint Service  Application_ yes yes yes no yes yes no yes
DefaultPowerPivotServiceApplicationDB yes yes yes yes no 0 yes no

Just to make it clear:

DbTypes refers to http://technet.microsoft.com/en-us/library/cc678868.aspx

DR refers to http://technet.microsoft.com/en-us/library/ff628971.aspx

Bill refers to Bill Baer’s information.

The question then is: What about Web Analytics. Has it ever been supported?  Anyway, have a look the analysis and have your on conclusions :)

SharePointDbs grid

SharePoint databases

October 24, 2011 Leave a comment

So I decided to collate all the database information in a table that I can easily filter.

It lists all SharePoint databases and it matches the information found in  TechNet article Databases types and Descriptions(http://technet.microsoft.com/en-us/library/cc678868.aspx#Section1)

Good to mention that the information here doesn’t quite match with the information found in Plan for disaster recovery (http://technet.microsoft.com/en-us/library/ff628971.aspx). Differences around Log shipping, Asynch mirroring and Synch mirroring.

I have mapped the differences and I’ll publish the comparison as soon as I get some information about which one is the valid one.

SharePointDbs grid2

MCM–Second week starts but not well…

February 18, 2011 Leave a comment

Well, so the second week started. We had the first exam and the results were issued during the evening. Some of us had head to a restaurant to chill out.

During the dinner we found the results were issued and half of us had past. I was in the second half Sad smile

It is pretty frustrating to have put so much effort during so long even before the rotation  started to face a epic fail. I feel I lost to myself. I knew all what that exam was about but there were so many questions I couldn’t figure out the right answer. I’m not sure if I didn’t study enough or if I was just tired. Anyway. That exam is gone. I’ll have 2 more opportunities to attend it and I am now realizing that will  be hard for me to succeed on the Qual Lab.

So far my experience with SharePoint 2010 had been light weight studying. I was sure I knew everything and I just don’t.

The subjects this week are way more to do with my activities(dev) so I believe I’ll feel confortable and get over this result.

Categories: SharePoint 2010 Tags: ,

SharePoint MCM – The first week goes on

February 16, 2011 Leave a comment

Well, I did say that was impressive that there were so many people who were as into SharePoint as I am however I couldn’t expect it to be so intense. As the week goes I see we all getting madly into the labs and the readings. I pay little attention to my personal things and even calling my partner has became a less important thing to do.

The subjects are great, the approach we are presented is often unusual and that is the whole idea. We need to understand that to be a real expert on a given subject we need to understand that each scenario has got its particularities.

I did decide to have a little time off on the first saturday to then head back to my labs exercises. I believe that was terrible mistake but I just can’t cope with the fact I am struggling with some stupid little things.

I can already say that the knowledge I acquired so far is very valuable. I just don’t know how long I can cope with the pressure I am feeling on my shoulders. At least I am enjoying every moment I have with the  fellows here. Nice and damn smart people.

There is the first exam on monday. I am afraid my choice to fight against UPA/UPS will mean my score won’t be excellent but I still believe I can pass this one.

I’ll keep on writing…

Categories: SharePoint 2010 Tags: , ,

MCM First days–The madness start

February 15, 2011 Leave a comment

So I decided to write a bit about my experience during the SharePoint MCM R7. It is actually more a kind of back log of things that happened during the time there and I just could not write anything so I’m getting all the notes I have still got and see how it goes.

The very first days were all cool. Fun all the time but I could see things since the first second there.

The reality is, the rotation started with one of those very common ‘round the table’ presentation where we all introduced ourselves and talked about our expectations and how we ended up there.

That was enough for me to understand how not alone I am in my field. Hard to say that but many many times I see myself around people who want to know SharePoint but it is so hard to find people who really know it.

Brett said since the beginning, prepare yourselves for a marathon. This isn’t a sprint. Hard to believe. For me it was just not possible that I would struggle with this product I know(or I thought I knew) so well.

The first day started very light but already talking about something most people don’t really pay attention to. Governance. Ok, I’m not getting into academic discussions about Governance and neither expressing my opinion. It isn’t to focus here.

As the day went by we went to one of the many Microsoft Stores there are around Seattle. That one has got some special deals for employees. I didn’t go there to buy geek stuff. I went there to buy clothes given United Airlines took 4 days to deliver my baggage.

Anyway, After the first day we got the first Hands on labs to do. Sounded so easy. So simple to acchieve that I would finish by the first night. Brett said we should wait a bit to finish one specific bit(to do with user profiles) because that would get us stuck. I didn’t here.

So I finished the first day already going home late.  I reckon I got back to my room around 10. Ok, I did go out to have dinner but I went straight back.

That was the first day. Not easy!

Categories: SharePoint 2010 Tags: , ,

Setting up NLB using Windows 2008 R2 using Hyper-V VMs

December 8, 2010 1 comment

NLB cluster [192.168.10.155]: NLB will not attach to adapter ‘{254D8DFF-48D8-4229-9FA6-B6A74D3C2FD8}’ because it does not support dynamic changing of its MAC address. Replace the network adapter with one which supports that capability.

So I ended up spending some time setting up NLB one my SP Boxes.

Have to say, wasn’t the most straight forward thing.

There are mainly two requirements before getting to the NLB itself.

Your Network adapter needs to be set up using  “Static MAC address” and “Enable  spoofing of MAC Address”.

Once that is set everything should work fine.

The concerning bit is that if that isn’t setup NLB Manager throws exceptions like TCP/IP address not assigned while Event Viewer logs the right one:

NLB cluster [192.168.10.155]: NLB will not attach to adapter ‘{254D8DFF-48D8-4229-9FA6-B6A74D3C2FD8}’ because it does not support dynamic changing of its MAC address. Replace the network adapter with one which supports that capability.

News

December 8, 2010 Leave a comment

So today I received a call to say that MS accepted my MCM application.

That is a phenomenal news and it is likely the last BIG news this ever reserved me.

I understand the Timeframe I’ve got is pretty tight and I do need to acquire a hell lot of experience/knowledge regarding MOSS2007 Migration.  My real experience with that isn’t enough and that is certainly the most important thing there is lately.

I’ve got a bunch of Pre-Reading docs that I’ll go through. I’ve read some of them already but there are  a way too many that I haven’t got anywhere near.

So here we are. 6 weeks to go. A million pages to read/study/understand.

Can I make it? Won’t be easy….

Tough job

December 1, 2010 Leave a comment

So I got myself concerned with the timeframes I had defined.

Althought I’ve got many, many things already in place I had planned to prepare tutorials about everything which hasn’t happened yet.

Tutorial materials are captured as planned but there isn’t any tutorial release. I’ll end up as Wikleaks and released hundreds of thousands of documents at once.

Anyway, What I’ve got set up so far is:

  • AD
  • WSUS
  • NLB
  • DNS
  • Forefront Threat Management Gateway (formerly known as  ISA)
  • SQL Server – 1 Node only as supposed to my 2 clusters plan. It’ll be migrated afterwards
  • DNS
  • SP 2010(3 boxes fully setup)
  • DHCP
  • A Client Workstation

Boxes created but not fully set up

  • TFS
  • FIM
  • Lync Server
  • K2 [BlackPearl]
  • Exchange

I am assuming I am following best practices for everything. I am surely not the best person on all non SP/K2 tools but I am sure I can deploy them successfully if I follow google’s recommendations.

My server is still performing fine.

19 gigs are currently in use.

I/O speed started to decrease but still excelent. I might  split system partitions across 2 hard drives.

I am concerned that I do have snapshots of everything but I can’t feel that is enough back up. More on that will come.

Tomorrow I’ll talk to Microsoft about my MCM. I hope I get accepted.

Learnings

November 23, 2010 Leave a comment

Well, here I am now writing about my latest findings.

I have changed my initial idea of using RHEL given I was facing issues with one of my devices.

I changed it to a Windows 2008 R2 Datacenter. Funny games here. I had never set up a Hyper-V environments and it isn’t a hard to learn basics on how to create VMS, manage templates, V-Lans and network devices.

The things there are in this network so are:

  • 2 Networks (Litoral/Farrapos)
  • Windows System Update Services
  • DHCP
  • Active Directory
  • Forefront Gateway Management Services
  • Windows 7 as Client Machine
  • SQL Server 2k8(3 nodes)
  • DNS
  • Windows 2k8 Standard Template
  • Windows 2k8 Enterprise Template.

I’ve documented most of the steps so far. Next Products are: Exchange and Forefront Identity Manager.

After that I’ll finally install SharePoint 2010. I am pretty anxious to get there. Today I received a call about my #MCM.

Presentations/tutorials will be published as soon as decide their final layout.

Categories: SharePoint 2010
Follow

Get every new post delivered to your Inbox.