Apple and the new programming language Swift


As a developer myself I am exited about this news. Apple just announced yesterday a new programming language named Swift which to my understanding in the long run will replace Objective-C. For me this is great news because Objective-C is kind of a hurdle to learn mostly because I’ve done so much development on C/C++, Java and C# languages that the syntax in Objective-C was a bit strange to me. I did some small apps a while ago but never really felt like this was easy. Anyway my preferences are my own thing :).

What is great about the new Swift language is that it is very VERY similar to C# or Java also. Taking a quick glance at the language guide and the syntax and functionality are very similar to those of C# and Java. Although Apple has chosen to use some rather strange notations and syntax naming in some part BUT compared to Objective-C it is great. I know this will lower my bar to making some new apps for the iOS environment.

For me as a developer this is a great news for two reasons:

1. I do not have to spent that much time learning Objective-C and avoiding mistakes that someone who already knows it knows to avoid.

2. And as the second reason it is time and cost effectiveness. IF I want to make an app for iOS now I can do it faster (based on what Apple says and what I’ve noticed). Also I do not have to buy third party tools like Xamarian to do the development faster in a language that is more familiar to me. Ofcourse using Xamarian you could theoretically deploy your application on multiple platforms BUT the license fees are rather big if you are a one man team or a small company with little or no real funds.

Anyways greats news from a developers perspective. Here are a couple of links to Swift:
Swift Language Guide

Apple Swift Developer Page

Well Time will tell what is Apple planning and how it will affect developers who are interested in Apple’s ecosystem.

SharePoint problems fixed – Code tricks – Part 1


Wanted to post some code tricks regarding SharePoint. Tricks which I have had to do more than once and tricks that are not so common but hard and useful:

Retrieve available web templates from a web:

SPWebTemplateCollection wtc = topNewsSite.GetAvailableWebTemplates(1035);

Set web default page layout(when you create new pages):

PublishingSite pubSite = newPublishingSite(yourSiteCollection);


                            PublishingWeb pubWeb = PublishingWeb.IsPublishingWeb(yourPublishingWeb) ? PublishingWeb.GetPublishingWeb(yourPublishingWeb) : null;

                            if(pubWeb != null)


                                PageLayout pageLayout = pubSite.PageLayouts.FirstOrDefault( item => item.Name == “yourpagelayout.aspx”);

                                if(pageLayout != null)


                                    pubWeb.SetDefaultPageLayout(pageLayout, false);






Copy(Add), Modify a webpart from one page to another with changes to webpart display template

// temp variable for a MS webpart which we will copy from one page to another page

                    Microsoft.Office.Server.Search.WebControls.ContentBySearchWebPart newsWP = null;

                    // Get the needed page from your site and get that pages web part manager

                    using (var wpm = topNewsSite.Lists["Pages"].Items[0].File.GetLimitedWebPartManager(PersonalizationScope.Shared))


                        // Search for the right webpart(you could use LINQ instead of a foreach)

                        foreach (var wp in wpm.WebParts)


                            // Check the type of the webpart

                            if ((wp is Microsoft.Office.Server.Search.WebControls.ContentBySearchWebPart))


                                // Make sure it is a ContentBySearchWebPart

                                newsWP = wp as Microsoft.Office.Server.Search.WebControls.ContentBySearchWebPart;


                                // Check that we have the right webpart

                                if (newsWP != null && newsWP.Title.Contains(“My News Webpart”))


                                    // Get the page you need where you want the web part to be copied

                                    SPListItem page = newWeb.Lists["Pages"].Items[0];

                                    SPFile file = page.File;


                                    // Get the web part manager of the destination page where to copy the webpart

                                    using (var wpmNewsWeb = file.GetLimitedWebPartManager(PersonalizationScope.Shared))


                                        // Change the web part display template for a listing with paging

                                        newsWP.RenderTemplateId = “~sitecollection/_catalogs/masterpage/Display Templates/Content Web Parts/Control_ListWithPaging.js”;

                                        // Add the web part to the page

                                        wpmNewsWeb.AddWebPart(newsWP, “CenterZone”, 0);

                                        // Make sure to call this to save the changes to the webpart












Good to Know: Windows Server 2012 – Part 4

Hi this is my part four of resources for Windows Server 2012(and older ones also):

Adding a Reverse Lookup Zone
Authorize a DHCP server in Active Directory
Block Inheritance
Configure a Server Core Server with Sconfig.cmd
Configure Memory and Processors
Delegate Control of an Organizational Unit
Deploy Clustered Storage Spaces 
Deploying a GlobalNames Zone
Deploying Microsoft RemoteFX on a Single Remote Desktop Virtualization Host Server Step-by-Step Guide
Deploying Network Load Balancing (NLB) and Virtual Machines on Windows Server 2008 R2
Deployment Image Servicing and Management Command-Line Options
Enforce a Group Policy Object Link
Evaluation Versions and Upgrade Options for Windows Server 2012
Evaluation Versions and Upgrade Options for Windows Server 2012
Grant a Member the Right to Logon Locally
How to remove data in Active Directory after an unsuccessful domain controller demotion
How User Account Control Works
Hyper-V Dynamic Memory Configuration Guide
Hyper-V Virtual Switch Explained, Part 2 
Hyper-V Virtual Switch Overview
ImageX Command-Line Options
Internet Protocol Version 6 Address Space
Link a Group Policy Object
Loopback processing with merge or replace
Manage Multiple, Remote Servers with Server Manager
Managing a Server Core installation: Overview
Migrate Print and Document Services to Windows Server 2012
Operations master roles
Print and Document Services Overview
Remote Desktop Gateway Manager
Sc config
Security Tools to Administer Windows Server 2012
Set up recovery actions to take place when a service fails
Storage Pools… Dive right in!
Switching Between the GUI and Server Core in Windows Server 2012
Troubleshooting Windows Firewall with Advanced Security in Windows Server 2012
Updating root hints
Using System Configuration (msconfig)
Using the Set-Service Cmdlet
Verifying Your Basic DNS Configuration
What’s New in Hyper-V for Windows Server 2012
What’s New in Hyper-V for Windows Server 2012
Windows and GPT FAQ

SharePoint Excel Services debugging



I was surprised to find this but this is a gem for anyone struggling with Excel Services errors. Microsoft made a flow chart of what Excel Services does during a data refresh. This helped me debug errors that made no sense at one point.

Quote from the link above:

“Use this flowchart to better understand how Excel Services in Microsoft SharePoint Server 2010 refreshes data or to troubleshoot data connection errors from Excel Services.

The Excel Services Data Refresh Flowchart shows the sequence of actions performed by Excel Services when it refreshes data in a data-connected Microsoft Excel workbook that is being rendered by Excel Services. This includes sequences for the three available authentication options (Windows, Secure Store Service, and None), plus sequences for embedded connections and connections that use Office Data Connection files. The flowchart also includes the connection errors that can occur at each step, and it suggests configuration steps to avoid or correct the errors.”

Hope this helps someone.

Good to know!?: .NET – Accessing, Querying and Manipulating data with Entity Framework


I gathered some links and resources on data manipulation with the .NET Framework. Hope this helps and works as a reference card what is available:

Entity Framework
Configuring Parameters and Parameter Data Types
.NET Framework Data Providers
DataSet Class
Retrieving Data Using a DataReader
Entity Framework – Database First
Entity Framework- Code First to a New Database
ADO.NET Entity Data Model Designer
Entity Data Model Wizard
Create Database Wizard (Master Data Services Configuration Manager)
Update Model Wizard (Entity Data Model Tools)
Using the DbContext API
Table-per-Type vs Table-per-Hierarchy Inheritance
Relational database management system
ObjectContext Class
DBContext vs ObjectContexts
DbContext Class
ObjectContext management
How to: Use Lazy Loading to Load Related Objects
EntityObject Class
EdmEntityTypeAttribute Class
SerializableAttribute Class
DataContractAttribute Class
Entity Framework (EF) Documentation
OData protocol
Open Data Protocol by Example
WCF Data Services Overview
Using the REST Interface
Understanding Service-Oriented Architecture
WCF Data Services 4.5
Advanced using OData in .NET: WCF Data Services
ObjectCache Class
HttpContext.Cache Property
ASP.NET Application State Overview
ASP.NET Session State Overview
Understanding ASP.NET View State
CacheItemPolicy Class
CacheItemPriority Enumeration
ChangeMonitor Class
CacheDependency Class
System.Transactions Namespace
EntityTransaction Class
EntityCommand Class
EntityConnection Class
SqlTransaction Class
System.Data.EntityClient Namespace
IsolationLevel Enumeration
TransactionScope Class
System.Xml Namespaces
XmlWriter Class
XML Documents and Data
XmlDocument Class
XmlReader Class
XPath Examples
LINQ to XML [from BPUEDev11]
LINQ to XML Overview
XElement Class
LINQ (Language-Integrated Query)
DbContext.SaveChanges Method
DbContext.Set<TEntity> Method
Object-relational impedance mismatch
Loading Related Entities (Eager Loading,  Lazy Loading, Explicitly Loading)
Demystifying Entity Framework Strategies: Loading Related Data (Eager Loading,  Lazy Loading, Explicitly Loading)
Precompiling LINQ Queries
Entity Framework 5: Controlling automatic query compilation
Improve Performance with Entity Framework 5
Queries in LINQ to Entities
LINQ to Entities: Basic Concepts and Features
LINQ to Objects
SqlConnectionStringBuilder Class
ObjectQuery<T> Class
ObjectQuery Class
ObjectQuery.ToTraceString Method
System.Data.SqlClient Namespace
SqlConnection Class
SQL Server Connection Pooling (ADO.NET)
DataTable Class
DataSet Class
DataAdapter Class
SqlCommand Class
SqlCommand.CommandText Property
CommandType Enumeration
SqlDataAdapter Class
SqlCommand.ExecuteScalar Method
SqlCommand.ExecuteReader Method
SqlDataReader Class
SqlDataReader.Read Method
DbDataAdapter.Fill Method (DataSet)
DbDataAdapter.Update Method (DataSet)
DataAdapter.AcceptChangesDuringFill Property
Working with Datasets in Visual Studio
SqlParameter Class
EF Designer TPT Inheritance
Walkthrough: Mapping Table-per-Hierarchy Inheritance in Dynamic Data
Code First to an Existing Database
Model-First in the Entity Framework 4
ADO.NET Entity Data Model Designer
The ADO.NET Entity Framework Overview
ADO.NET Entity Data Model Tools
Plain Old CLR Object(POCO)
Working with POCO Entities

SharePoint SummeryLinks Webpart JQuery modifications – Make it into a “drop down” menu

Here is a small JQuery piece of code that you can use to minimize the space required on a page with summary links webpart. This will collapse the links listing under the webpart title. To make the links visible again you have to press the webpart title again.


jQuery(“table .dfwp-list”).slideUp();

jQuery(“table .dfwp-list”).closest(‘table’).hover(

The JQuery code above is tested on SharePoint 2010. The most important piece in this code is the CSS class named dfwp-list. When targeting this class you are targeting an UL LI HTML structure where the links exist. With a little modification you can use this code to add the each LI borders, colors and other styling to make it look more like a drop down menu.

Microsoft Forefront Unified Access Gateway a.k.a UAG modifications – custom look and styling


A simple post to those who are wondering how to modify the look of your UAG pages. The simplest tip is that seach under the UAG folder any folder named as “CustomUpdate”. Each web related attribute has its own CustomUpdate folder. Look below for example. Just navigate to that location and modify the files you need to. If the related file such as the template.css is missing you can use as your base the MS out of the box tempalte.css found one level up from the CustomUpdate folder.

Sample locations:

C:\Program Files\Microsoft Forefront Unified Access Gateway\von\InternalSite\css\CustomUpdate

C:\Program Files\Microsoft Forefront Unified Access Gateway\von\InternalSite\Languages\CustomUpdate

C:\Program Files\Microsoft Forefront Unified Access Gateway\von\InternalSite\Images\CustomUpdate

C:\Program Files\Microsoft Forefront Unified Access Gateway\von\InternalSite\CustomUpdate (this for ASP pages)

Related links on more information on how to do modifications: