Posted by Adam Buenz

Recently I was working on a SharePoint timer job for some data synchronization across numerous WebParts. In order to do this I had to load through code the pertinent assemblies from the GAC (I know, I know. I should be using the bin for security purposes, but it is a client request to be in this form) so that I could get access to the various types dynamically.

I found an assortment of sundry techniques that people shared, however I didn’t really dig the sum of string literals that they were using to do it. I am finding that using reflection is much more efficient and clean, so I thought I would post the code snippet for others consumption:

C#:
  1. private static string GacPath()
  2. {
  3. PropertyInfo pi = typeof (Environment).GetProperty("GacPath", BindingFlags.Static | BindingFlags.NonPublic);
  4. if (pi == null)
  5. {
  6. return null;
  7. }
  8. MethodInfo mi = pi.GetGetMethod(true);
  9. return (string) mi.Invoke(null, null);
  10. }

Posted by Adam Buenz

One of my friends had a slight dilemma in his code this morning where he had a recursive loop, subject and constrained by some limit logic, which iterated through SPList objects in an arbitrary SPWeb and returned a large typed collection of SPList objects. The collection was afterward used for massaging out some specific SPField values, assimilated later by a detached business application.

One difficulty that he was running into was the occurrence of duplicates that were taking place during the generation of the collection. He was questioning if it was workable to inspect and eliminate duplicate SPList objects that occur before returning the final SPList collection.

In order to do this, we of course necessitate a unique identifier for each object, so it makes sense to use the SharePoint generated SPList.ID property which guarantees a unique value. Within the method, we are creating two other collections, a temporary typed dictionary object which will hold the ID values to later act as a guard clause, as well as a provisional SPList collection which will provide return allocation.

C#:
  1. public static List<SPList> CheckAndRemoveDuplicateSPList(IEnumerable<SPList> inputList)
  2. {
  3. Dictionary<Guid, int> tempDictonary = new Dictionary<Guid, int>();
  4. List<SPList> tempListCollection = new List<SPList>();
  5. foreach (SPList list in inputList)
  6. {
  7. if (!tempDictonary.ContainsKey(list.ID))
  8. {
  9. tempDictonary.Add(list.ID, 0);
  10. tempListCollection.Add(list);
  11. }
  12. }
  13. return tempListCollection;
  14. }

That should do the trick!

:)

Posted by Adam Buenz

Yeah, I am an MVP in Windows SharePoint Services for another year.

:)

Posted by Adam Buenz

There are numerous initiatives within the greater Columbia area at present to procure and sustain ample industrial augmentation. While this is unquestionably the case in practically every U.S. city, it is outstandingly palpable in Columbia because the city itself can be described at best as deprecated and scarcely extant so the administration is doing their best to counter it. Commendable.

If you scrutinize the achievements of these endeavors however, they may initially appear promising. However, numerous sponsorships disappoint in generating durable growth. While the present Columbia administration seems to be baffled as to why this is the case, I feel that I can sum it up pretty effortlessly and save the residents of the city I love some tax dollars. I am a nice guy.

The funding for these programs adheres to fundamentally identical external and internal processes subject by any government grants. It is not especially remarkable. And quite honestly, I don’t think it is an internal issue which is the problem. I guard with this because most of the articles I have read dealing with this seem to revolve around this being the massive bottleneck.

Simply put, it is the programs that are chosen to be funded. The result of the malformed selection process results in the proposed economic development not benefiting the residents of the Columbia with long term growth.

The programs that are selected target explicit populations, habitually not being directed at progressive, bleeding edge industries. In addition, the programs selected generally don’t lead to supplementary jobs that are clerical in nature, or if we want to put it how Uptown Sinclair put it, white-collar workers with a high ratio of disposable income (was that blatant?). This sole fact alone generates a stagnate as opposed to economically dynamic society and environment. When there is relatively little disposable income that is being enjoyed by a select few, there is no real possibility of creating a mass domestic market for new development. While the median income of South Carolina would immediately observe that current decisions would actually be the most pragmatic action, all it does is lead to cyclic behavior that keeps Columbia in economic shambles.

This is a constant truth and presented in some of the most studied economic works. For example, examine one of the most celebrated economist / authors / urbanists, Jane Jacobs in “The Economy of Cities”. She clearly indicates when there is more disposable income available for domestic investment it will in turn lead to a more prosperous economy. Not very shocking. If the current administration desires to grow and maintain Columbia the focus must be shifted from strictly manufacturing and low-level service industries in order to make the city more viable. It’s as simple as that. To be blunt to the administration, you are investing in the wrong shit.

I am in no way saying that the conventional and time-honored brick-and-mortar industries that are terrifically southern cliché can’t play any role with this process. That would be obtuse and rigid. However, I am professing that the focus needs to be shifted onto more progressive industries with what some may consider an unfair balance in order to really cultivate the city with long-term growth. When this crops and further businesses start to use Columbia as an economic hub, it will bring new population, more disposable income, and in turn more domestic investment. I mean really, this is not astonishing or pioneering stuff I am encouraging. You are equipping the wrong type of businesses and really putting the residents that you are responsible in a self-defeating situation. You are asphyxiating, not promoting expansion.

I believe there this is physical evidence that this is indeed the case as well. If you walk down the greater Columbia area, you will notice Main Street which leads to the Capital building, quite a site! If you walk further away from the capital building (East), I am guessing around 4 blocks, all of a sudden you feel like you are walking in a dying area sponsored by a 1940’s Humphrey Bogart film. And I am not exaggerating, I believe that the median amount of buildings up for lease on that one street must be near 70%, while the other businesses that are currently open look so deprecated you would have to be mad to consider them actually applicable. And this is Main Street. Although the lack of growth here makes it clear of misdirection of the administration, it would also make the point that most government direction is leaning towards manufacturing. I have never seen any larger offices for some of the manufacturing organizations (although I just looked for brick producing enterprises) and generally plants and other such faculties are not held directly within a downtown area. There is adequate space to use though if they wanted to. What I am trying to emphasize is the intended chief street in Columbia is destitute. And that’s where businesses SHOULD be congregating.

To sum it up, I am not promoting innovative economic creed; a majority of what I have put in here is taught in introductory undergraduate economics classes. That part that I find most wearisome is that Columbia administration ostensibly skipped that day that basic economics was covered. And then forgot to pick up a book. And then kinda sucked at their jobs.

:(

You make me sad Columbia administration.

Posted by Adam Buenz

You know, part of me loathes switching hosting providers because of the quantity of energy it would take to do so, but man, these problematic issues over the previous two days have thoroughly chapped my ass. First, they tell me that it isn’t a considerable difficulty, they just switched my site root, i.e. the _SERVER["SITE_ROOT"] and _SERVER["SITE_HTMLROOT"] variables, so I might just have to reconfigure some scripts or change said values in the database. Well, that’s no problem. Except when I go through and make the required changes, the site is still failing to handle any requests fittingly.

So, then I write some debug scripts, and find out that as a substitute they copied over the database structure when moving the site, leaving most of the content. I mean who does that? Observably the consequence of this inaptitude was that the site was incapable of delivering anything.

Regardless, it is all resolved now. It was just some time on a Sunday that I didn’t really enjoy spending on something that I already pay someone to make certain doesn’t happen.

Outside of that, TechEd went well. Thanks if you came to my session on SharePoint security! I will be posting the code from that session this afternoon into separate posts.

Posted by Adam Buenz

Generally that is what I am discovering is the case, however terse that may appear. I normally don’t peruse recruiter sites, except I got this outlandishly awesome job offer housed in one. Before I knew it, I was searching for absolute randomness on the site for fun. As I was browsing for SharePoint jobs, I established what looked to be the average SharePoint job ad, and I chuckled a bit.

I will in fact copy and paste it directly from the offered advertisement text:

SharePoint Programmer / Developer / Architect: Must have at least 7 years practical work experience in C# with building solutions on top of SharePoint. 7 years Java experience to support conversions of J2EE to .NET solutions. To support this role, 5 years of Oracle and Delphi experience preferred. 5 years experience required with MFC/ATL and Crystal Reports.

Must have 5 years of deep architectural experience with building large SharePoint farms, and administrating them in the same capacity including deployed custom development. Several years architecting and developing against ISA and MIIS preferred and encouraged, however not required.

Interestingly enough, on recruiter sites you are able to spot precisely when the job was posted. The antiquated date appended to this made sense to me since this particular position has been open for over half a year, borderline 8 months. And I will wager that no sensible applicant has dared to apply to this gobbledygook.

Why?

Because not only does the ad undoubtedly convey that the posting recruiter did inadequate technical research because of the erroneousness of technical dating (which offends job seekers btw), but they must be looking for the fabled nine armed, four brained mythical programmer that they prophecies foretell of, because for all intents and purposes those requirements are outrageous.

First, let’s pick apart the ad.

7 years of C# development experience, while being feasible, is marvelously atypical since the establishment of the C# language in common commercial markets is roughly in late 2000. So, this organization is most likely looking for a C# beta tester for when Anders Hejlsberg was still calling it code name “Cool”. Needless to say, this would be exceptional and uncommon.

7 years of .NET development on top of SharePoint I can see being a qualification, if STS (2001) development actually used .NET. Then it would be cool. But it didn’t. So the basic arithmetic of the recruiter sucks. Even then, you would be subject to the same time considerations as described above, making it not necessarily common.

5 years experience with MFC/ATL? Huh? I mean, I did MFC / ATL programming for a long time (it paid for college), and I have to admit I really don’t use that skill set outside of the far reaching development concepts very often. It just isn’t obligatory for ordinary SharePoint business development (note the use of the word ordinary there).

I actually can understand the Crystal Reports one. I guess. I mean I don’t use it, but it seems like in some circles it could be interpreted as a pragmatic requirement. I guess.

The conversions requirement made me sort of laugh, since that is a pretty specific skill set to want out of a developer. Because of this, as well as the larger noted SharePoint development experience, I think the organization might be more successful with breaking this into two separate jobs. To me, it’s kind of like walking into a barbershop, getting a haircut, and then asking why the barber didn’t go wash your car and walk the dog. Lazy bastard. I think coupling a C# developer that has rudimentary Java skills with a Java developer with basic C# skills would produce higher quality code conversion, most likely in a more reasonable time frame since those two programming schools tend to stay siloed in their language of choice. Even though in my experience code conversions just end up being a software rewrite anyways.

When the recruiter starts to talk about wanting the SharePoint developer, architect, and administration full package, I start to get a little frustrated. While there are certainly people that can wear all these hats, very well too, generally they become too busy divvying themselves up between tasks spawned from owning those assorted roles habitually those tasks never near completion. Only little increments are accomplished, never leading to closing. People often times like to specialize in a certain aspect additionally, and pride themselves in knowing all the ins and outs of that niche. I like doing architecture, but I love doing development. Furthermore, I simply loathe administration. It doesn’t mean I can’t do it; I just don’t enjoy it as a job role. It doesn’t blow my hair back.

The ISA and MIIS requirements are asinine if it is anything but a proof of concept or a small deployment. This should be principally noted with the MIIS requirement; the recruiter should be looking for someone that continually focuses on identity management systems when standing that up. Knowing those concepts to the metal vastly increases chance of project success. Like I said in a previous point, you don’t ask your barber to cut your grass. Unless your barber is just genuinely charitable and bored.

Consequently what happens when you are the recruiter that placed this ad out into the wild? You do a dance of joy because low and behold you found a hidden genius that satisfies hopeless requirements (not just meaning that they are hard, they really are impossible)! Yeah! Diamond in the rough! You rule! And he is willing to do it for 40k a year!

But what does your organization end up with?

The quintessential, yesss-sssir guy, whom only has the qualification of being a professional impostor and habitual liar. Fundamentally you have someone with an archetypal psychological complex tailored around satisfying people even though that satisfaction is bogus. Meaning, they are full of shit. I am not saying that to satisfy all the requirements is impossible (assuming that technology timeframes were right). It’s not, however it is decidedly unlikely. More than likely, they might *know* these buzzwords, read about it a bit, but don’t have deep experience. I have minimal Delphi experience, and very, very brief Oracle experience. Although I have used these, I don’t list them as skill sets of mine. I am not proficient enough. If they were mentioned at a job interview as required, I would throw sand in the interviewer’s eyes and flee on foot.

So I propose the following to SharePoint recruiters…

Firstly, be sensible with your project needs. I know it would be nice to have a methamphetamine IV feed developer that consistently practiced other technology facets locked in the closet that only required fish heads for substance doing your project work. I wouldn’t mind one of those myself. But it isn’t rational. When defining roles for a SharePoint implementation during the project planning process, it is healthier to have more jobs divvied up based on specialization rather than constrained numbers trying to overexert themselves out of their specialty. The former has proven, at least in my personal experience, while taking a large toll on budget tends to lead to enhanced quality of deliverables and probability of aggregate project success.

Secondly, tailor their SharePoint job ads to be more specific. Don’t be so vague. You clearly have a project, with a defined project scope (hopefully), project WBS’s (even though you are mocking people), and other project documentation. I don’t understand why this isn’t kept in mind when you are making your staffing decisions. I appreciate keeping it ambiguous because who doesn’t like the brain-surgeon-that-worked-charities-while-saving-puppies-from-burning-houses-but-now-does-awesome-SharePoint-development-guy, but your advertisement requirements are not practical. One of the most important portions of project planning is to define the roles filled by project team members and the responsibility of each role. I really doubt that there is just one role defined as “everything besides the project manager”.

Lastly, for Christ’s sake, research the technology that you are advertising for. You don’t have to know it very well, you just have to know it enough to *find* someone that knows it a whole lot more than you do. If I wanted to find a good dairy farmer to get some milk, I don’t have to know how to milk a cow or manage a farm, I just have to know the basics of the milk I want. The same goes when you are building technology requirements. Kinda.

Posted by Adam Buenz

When programmatically working with data that is collected in SharePoint lists, you are undoubtedly going to employ SharePoint views, denoted by SPView objects. When working with multiple views, there may come a time when it is necessary to do rudimentary field comparison between two views.

In order to do this, you can use this simple method below:

C#:
  1. public static bool ViewFieldComparison(SPView firstView, SPView secondView)
  2. {
  3. if (!Equals(firstView.ViewFields.Count, secondView.ViewFields.Count))
  4. {
  5. return false;
  6. }
  7. string[] firstViewArray = new string[firstView.ViewFields.Count];
  8. string[] secondViewArray = new string[secondView.ViewFields.Count];
  9. firstView.ViewFields.ToStringCollection().CopyTo(firstViewArray, 0);
  10. secondView.ViewFields.ToStringCollection().CopyTo(secondViewArray, 0);
  11. for (int i = 0; i <firstViewArray.Length; i++)
  12. {
  13. if (!Equals(firstViewArray[i].CompareTo(secondViewArray[i]), 0))
  14. {
  15. return false;
  16. }
  17. }
  18. return true;
  19. }

If you wanted to firstly test whether the view exists, you can implement this as well based on what types of guards you wanted to realize:

C#:
  1. public static bool DoesViewExist(string view, SPList list)
  2. {
  3. foreach (SPView view in list.Views)
  4. {
  5. if (Equals(view.Title, view))
  6. {
  7. return true;
  8. }
  9. }
  10. return false;
  11. }