Friday, September 26, 2025

Vibe Coding for Architects: From Idea to Impact

Vibe Coding for Architects: From Idea to Impact

🚨 The Problem: How Do Architects Enable Speed Without Sacrificing Safety?

In today’s enterprise environments, architecture teams are under pressure to deliver faster — but without compromising on security, scalability, or operational resilience. The tension is real:

  • Delivery velocity demands rapid experimentation, short feedback loops, and lean processes.
  • Governance demands compliance, traceability, and architectural integrity.

Traditional architecture practices — heavy modeling, gated reviews, and rigid documentation — often slow down innovation. Meanwhile, agile teams want autonomy and speed. The result? Either governance is bypassed, or delivery is delayed.

Enter vibe coding — a generative AI-powered approach that lets architects and developers co-create solutions rapidly, while still embedding guardrails and governance into the software development lifecycle (SDLC).

🎯 What Is Vibe Coding?

Vibe coding is a lightweight, AI-assisted approach to software ideation and prototyping. You chat with an AI assistant, sketch code, explore infrastructure options, and validate ideas — all in minutes.

For developers, it’s liberating. For architects, it’s a superpower — if used wisely.

This post shows how architects can use vibe coding to:

  • Frame problems clearly.
  • Prototype fast.
  • Codify guardrails.
  • Empower teams.
  • Maintain governance across the SDLC.

🧩 Step 1: Inception — Frame the Problem, Lightly

Start with clarity, but keep it lean.

Scenario: “We need a Notification Orchestration Service that sends alerts to customers across email, SMS, and push channels — triggered by business events like payment failures or fraud detection.”

  • Business Capability: Multi-channel notification orchestration.
  • Value Stream: Event-driven customer communication.
  • Non-Negotiables:
    • Security: Microsoft Authentication Library (MSAL) integration.
    • Latency: Less than 200 milliseconds for push notifications.
    • Observability: Azure Application Insights with correlation IDs.
    • Cost: Less than $0.01 per notification.

🧱 What Is an Architecture Decision Record (ADR)?

An Architecture Decision Record (ADR) is a lightweight document that captures a key technical decision made during the design of a system. It helps teams understand the rationale behind choices — especially when revisiting them months or years later.

A skeleton ADR is a simple, early-stage version of this document. It’s not meant to be exhaustive — just enough to set direction and spark alignment.

Basic structure:

  • Problem Statement: What are we solving?
  • Constraints: What must be respected?
  • Success Criteria: What does “done” look like?

🤖 Step 2: Vibe Ideation — Explore With AI

Treat your AI assistant like a pair-programming partner. Ask it to generate scaffolding:

  • “Create a .NET 8 Durable Function orchestrator with retry and App Insights logging.”
  • “Generate a Helm chart & Azure DevOps pipeline for Elastic Kubernetes Service (EKS).”
  • “Compare Azure App Service vs Azure Functions vs Azure Kubernetes Service (AKS) for cost and reliability.”

Explore what-ifs:

  • “What’s the latency difference between Azure Notification Hubs and Twilio?”
  • “How would retries work with exponential backoff?”

⚡ Step 3: Spike & Proof of Concept — Fast Reality Check

Take the AI-generated output and spin up a thin spike — a minimal implementation that tests feasibility.

  • Minimal domain entities (e.g., NotificationEvent, ChannelConfig).
  • Logging and telemetry baked in.
  • Quick CI/CD to a sandbox.

Run checks:

  • Latency under load.
  • Cost per notification.
  • Deployment friction.

🛠️ Step 4: Architect Review & Hardening

Convert proof-of-concept learnings into hardened reference implementations:

  • Clean repository structure (e.g., domain-driven design, queue-triggered durable functions).
  • Updated Architecture Decision Records (ADRs) with rationale.
  • Architecture diagrams: context, deployment, flow.
  • Security and operations reviews.

🧱 Step 5: Codify Guardrails

🧠 Gold-Standard Prompt for Generative AI

You are a Principal Enterprise Architect leading the digital transformation for a Fortune 500 company. Your task is to generate the gold-standard boilerplate for a secure, highly resilient, event-driven .NET 8 Minimal API that will serve as the foundation for a global-scale Notification Orchestration Service.

The response must not just list components, but provide demonstrable, production-ready code snippets and justifications for the architectural decisions.

Core Requirements (Elevated)

  • Authentication & Authorization (Zero Trust):
    • Microsoft Identity Platform (Azure Active Directory): Secure the API using Microsoft Identity Web for robust token validation (JSON Web Token Bearer).
    • Role-Based Access Control (RBAC): Implement a sample policy for authorization that checks for a specific application role (e.g., Notification.Admin).
    • Managed Identities: Define how the API will use Azure Managed Identity for secure, password-less access to Azure Key Vault and other Azure resources.
  • Data Access (Modern & Performant):
    • Entity Framework Core (EF Core) 8: Use modern EF Core features like compiled queries and raw SQL execution for critical paths.
    • Sample Model: Include NotificationEvent entity with an Optimistic Concurrency token (e.g., a RowVersion or timestamp).
    • Transactional Outbox Pattern: Integrate a basic mechanism (e.g., a dedicated table/repository) for supporting the transactional outbox pattern to ensure atomicity between database writes and event publishing.
  • Protocol & Querying:
    • Open Data Protocol (OData) v4: Integrate OData for resource querying.
    • API Design: Utilize Minimal APIs for routing and handling, but encapsulate logic within Endpoint Handlers (Mediator pattern via MediatR or Carter).
  • Resilience & Observability (Site Reliability Engineering Focus):
    • OpenTelemetry: Use OpenTelemetry for logging, metrics, and tracing, integrating with Azure Application Insights.
    • Correlation & Structured Logging: Implement middleware to ensure a consistent correlation ID across all logs and traces. Use Serilog for structured logging.
    • Health Checks: Include Liveness and Readiness endpoints using Microsoft.Extensions.Diagnostics.HealthChecks.
  • Dependency Injection (DI):
    • Utilize the built-in .NET DI container.
    • Demonstrate Scrutor usage for automatic service registration of interfaces and implementations within the Clean Architecture layers.
  • Performance & Asynchrony:
    • Asynchronous Patterns: Ensure all I/O bound operations use async/await correctly, including IAsyncEnumerable for streaming results.
    • Performance Constraints: All service logic must be cancellation-token aware.
  • Project Structure (Enterprise Clean Architecture):
    • Strict adherence to Clean Architecture: Domain, Application (Commands/Queries and Handlers), Infrastructure (Persistence, External Services), and API (Presentation/Endpoints).
    • Use Project References to enforce dependency rules (e.g., Domain cannot reference Infrastructure).
  • DevOps & Infrastructure-as-Code (IaC):
    • GitHub Actions CI/CD: Provide a multi-stage sample workflow (Build, Test, Publish, Deploy).
    • IaC (Bicep or Terraform): Provide a snippet for deploying the API to Azure Container Apps or Azure App Service, configuring a Virtual Network and Azure SQL Database.
  • Documentation & Governance:
    • README.md: Detailed setup guide, explaining the use of Managed Identity and Key Vault for configuration.
    • Architecture Decision Record (ADR): Justify the choice of Minimal APIs with Carter/MediatR over traditional Controllers.
  • Extras & Advanced Patterns:
    • Unit & Integration Tests: Provide a sample unit test using a mocking framework and an integration test using WebApplicationFactory and an in-memory database (SQLite).
    • API Contracts/Versioning: Define a sample Request/Response Data Transfer Object (DTO) and show how API versioning would be managed.

Required Output Format:

  • GitHub-Style Repository Layout (Zipped folder structure is too cumbersome).
  • Key Code Snippets for the most complex/opinionated components (e.g., Program.cs for setup, CorrelationMiddleware, an Endpoint Handler, and the HealthCheck setup).
  • Concise Commentary explaining the purpose and enterprise-grade nature of each architectural choice (e.g., Why OpenTelemetry? Why Transactional Outbox?).

🚚 Step 6: Delivery — Empower Teams

Give teams a ready-to-go starter pack:

  • Repositories with orchestration samples.
  • Pipelines wired for tests and security scans.
  • Clear prompts and ADRs.

Let developers vibe-code new features inside a safe, governed frame.

🔁 Step 7: Continuous Feedback & Evolution

After first releases:

  • Review Azure Application Insights, cost dashboards, and Azure Advisor recommendations.
  • Update ADRs and templates with new lessons.
  • Host architecture office hours to guide teams and answer questions.

🧭 The Takeaway

Vibe early, govern late.

Architects don’t have to choose between speed and safety. With generative AI, you can prototype fast, validate early, and lock down standards as you move toward delivery.

This is the future of enterprise architecture: Lean, agile, AI-augmented, and business-aligned.

⚠️ Responsible Use of AI

While generative AI can accelerate development and ideation, it is essential to:

  • Always review and vet AI-generated code for security, performance, and compliance.
  • Ensure sensitive data is not exposed in prompts or outputs.
  • Validate architectural decisions with human oversight and domain expertise.
  • Use AI as a collaborative assistant, not a replacement for critical thinking and governance.

Responsible AI usage ensures that innovation remains safe, ethical, and aligned with enterprise standards.

Monday, September 22, 2025

From Ivory Tower to Value Enabler: Reimagining Enterprise Architecture for Agile Value Streams

For years, Enterprise Architecture (EA) has carried the reputation of being an ivory tower discipline — producing elegant diagrams and enforcing standards, but often disconnected from the realities of delivery. In today’s fast‑moving environment, that model no longer works.

Organizations need EA to be something different: an embedded enabler of agility, value delivery, and strategic alignment.

This post is the result of a deliberate exercise. I explored multiple frameworks, tested different models, and reflected deeply on what truly works in practice. The conclusion? A hybrid model—anchored in business capability mapping and structured through value streams—is what delivers the most impact.


🔗 Business Capabilities: The Stable Backbone

What They Are:
Business capabilities describe what an organization does to deliver value, independent of its internal structure, processes, or the systems it uses. Think of them as fundamental building blocks – "Customer Relationship Management," "Product Development," or "Risk & Compliance." They are inherently stable, evolving slowly over time, if at all.

Why They Matter:
This stability makes business capabilities the perfect anchor for any transformation. They provide a common, business-centric language that bridges the gap between technology teams and business stakeholders. By mapping capabilities, organizations can clearly see where to invest, identify areas of duplication or gaps, and prioritize modernization efforts based on actual business needs.

EA's Mandate:
Enterprise Architects are the curators and maintainers of the capability map. This map becomes the "north star" for critical decisions: guiding investment, shaping Agile Release Train (ART) design, and setting strategic modernization priorities. Capabilities aren't just a reference; they're the foundational anchor point for achieving true organizational agility.


🌊 Value Streams: The Flow of Value

What They Are:
Value streams represent the end-to-end series of steps an organization takes to deliver value to a customer or stakeholder. They are dynamic and process-oriented, illustrating the flow of work from initial trigger (like a customer request) to the final outcome. Examples include "Order-to-Delivery" or "Customer Support Resolution."

Why They Matter:
While capabilities provide stability, value streams provide the context of movement and outcome. They force a focus on the customer's journey and help to identify bottlenecks, waste, and opportunities to improve efficiency. Value streams ensure that teams are not just working on tasks, but are directly contributing to a tangible, valuable outcome.

EA's Hybrid Model:
This is where the power of the hybrid model becomes clear. EA overlays value streams onto the stable capability map. This process identifies the intersections where value is delivered and allows teams to be structured around these intersections. It ensures that Agile Release Trains (ARTs) are aligned to customer value, not legacy systems, enabling strategic alignment, modular delivery, and scalable agility.


🤝 From Gatekeeper to Embedded Partner

What It Looks Like:
The traditional EA model positions architects as a separate review board—a "gatekeeper" that approves or rejects solutions. In the new model, EA shifts to an "embedded partner," integrated directly into the day-to-day cadence of delivery teams.

Why It Matters:
This fundamental shift transforms EA from a bottleneck into a force multiplier. Instead of slowing down delivery with rigid approvals, architects provide guardrails, reusable patterns, and reference architectures that accelerate a team’s ability to build sound solutions. Success is measured by flow efficiency and time-to-market, not by documents signed off.

EA's New Role:
Architects become active participants in Agile Release Train ceremonies like PI Planning and backlog refinement. They act as mentors and partners, guiding teams and ensuring compliance by design. This continuous engagement means architectural integrity is built in from the start, not checked for at the end.


🔁 Keeping Vision Alive Under Pressure

The Problem:
Delivery teams often begin an initiative aligned to the architectural vision, but under tight timelines and external pressure, they can drift toward tactical fixes and shortcuts. This "architectural drift" degrades the long-term health and coherence of the system.

Why It Matters:
Preventing drift is crucial for maintaining a system that is resilient, scalable, and easy to maintain. A reactive approach, where architectural issues are only addressed at the end, is both costly and inefficient. Proactive, continuous alignment is essential for preserving the integrity of the vision.

EA's Solution:
EA combats this drift by creating continuous feedback loops. System demos serve as checkpoints for architectural enablers, not just features. Lightweight architecture syncs allow architects and delivery leads to review progress. By making architectural work part of the backlog and sharing OKRs, EA ensures that architectural integrity is preserved incrementally and is never optional.


⚡ Dynamic Team Formation

The Challenge:
Some initiatives—like a cybersecurity uplift, a new regulatory change, or a data modernization effort—cut across multiple value streams. A rigid, siloed organizational structure struggles to respond to these cross-cutting needs.

Why It Matters:
An organization's ability to respond to these types of initiatives is a key indicator of its agility. It requires the flexibility of a startup with the discipline of an enterprise. Static, fixed teams can't effectively handle work that spans different parts of the business.

EA's Enabler:
EA provides the model for dynamic team formation. Temporary squads are "spun up" for focused outcomes, anchored in capabilities to prevent the creation of new silos. Once the uplift is complete and embedded, the squads are dissolved. This model provides the flexibility to respond to enterprise-wide needs without creating permanent, disconnected teams.


📈 Governance Through Outcomes

The Shift:
Modern governance is no longer about a series of rigid approvals and documentation. It's about empowering teams and measuring success based on actual outcomes.

Why It Matters:
Outcome-based governance is directional and enabling, not restrictive. It aligns all work directly to business goals and a strategic vision. Metrics that truly matter—like flow efficiency, business outcomes, and compliance by design—replace bureaucratic checklists.

EA's Role:
EA ensures that portfolio epics align to both value streams and the architectural runway, connecting the work of delivery teams to the strategic themes of the organization. This guarantees that every project ladders up to key modernization goals—like becoming cloud-native, API-first, or data-driven—and drives the enterprise toward its desired future state.

🧠 The Leadership Imperative

For senior leaders, the message is clear:

  • EA is no longer a cost center — it’s a value enabler.
  • Capabilities provide stability, value streams provide flow, and EA provides coherence.
  • The result is an operating model that is both agile and strategically aligned.

This hybrid model is not just a framework—it’s a mindset shift that positions architecture as a core business capability.


💬 Closing Thought

The real test of modern Enterprise Architecture is not the elegance of its diagrams, but its ability to stay alive in the trenches of delivery. By embedding architects in ARTs, creating continuous feedback loops, and making architecture part of the backlog, organizations can ensure the vision is realized incrementally.

This is how EA stops being an ivory tower and becomes the bridge between strategy and execution—the enabler of value at scale.


Thursday, September 4, 2025

The Role of Architecture in an Agile Release Train

In agile delivery, architecture isn’t just about structure — it’s about enabling flow, clarity, and reuse. When embedded into the Agile Release Train, architecture delivers three things that matter most:

  • Robustness — scalable, secure foundations that support transformation
  • Utility — reusable assets, clear traceability, and business-aligned design
  • Elegance — solutions that teams understand, extend, and take pride in
“Firmness, commodity, and delight.”
— Vitruvius

That quote has endured for centuries, and it still applies. Architecture must deliver all three — not just in buildings, but in systems, platforms, and delivery frameworks.

🔍 Why Architecture Must Be Embedded in Agile

Agile delivery without architecture is like a train without tracks — fast-moving, but directionless. In large-scale agile environments like SAFe, architecture isn’t a peripheral concern; it’s a foundational enabler of flow, alignment, and business agility.

When embedded properly, architecture:

  • Aligns delivery with strategic business capabilities
  • Enables reuse through shared APIs, data models, and frameworks
  • Surfaces contradictions early between business cases and delivery scope
  • Supports compliance, security, and scalability without waterfall overhead
  • Empowers teams to make decisions with guardrails, not gatekeeping

Architecture must shift from being a checkpoint to being a co-pilot — shaping backlogs, guiding design, and enabling flow.

🧩 The Five Roles of Architecture in the ART

Architecture Type Role in the ART Embedded Practices
Enterprise Architecture Sets strategic direction, capability maps, and transformation goals Capability-based planning, OKR traceability, reusable reference models
Business Architecture Aligns delivery to business capabilities, value streams, and outcomes Value stream modeling, business case validation, capability-to-feature mapping
Solution Architecture Designs cross-team solutions aligned to business outcomes SAFe-aligned design templates, collaborative handoffs, architecture reviews
System Architecture Implements technical patterns, APIs, and infrastructure DevSecOps enablement, async patterns, reusable components, telemetry
Data Architecture Enables trusted, reusable, and governed data across solutions and teams Canonical models, data contracts, lineage mapping, compliance-by-design

🛠️ Embedding Architecture into Agile Practices

To make architecture a living part of the ART, we must:

  • Use SAFe-aligned solution design templates that map capabilities to features, trace decisions, and define measurable outcomes
  • Collaborate early with feature analysts to shape epics and stories with architectural context
  • Run architecture reviews as learning forums — focusing on trade-offs, reuse, and alignment
  • Operationalize architecture metrics that show value: reuse rates, flow efficiency, compliance coverage
  • Create reusable assets — APIs, data models, correspondence services — that teams can plug into with minimal friction
  • Embed data lineage and telemetry into delivery pipelines to drive continuous improvement
  • Align architecture with business outcomes, not just technical patterns

Architecture isn’t a phase. It’s a mindset, a set of practices, and a shared language across business and technology.

🧠 Architecture as a System of Enablement

When embedded properly, architecture becomes a strategic enabler of agility, not a constraint. It guides without dictating, enables without obstructing, and evolves with every PI.

Here’s how the domains interlock:

  • Enterprise Architecture ensures strategic alignment and transformation traceability
  • Business Architecture connects delivery to value streams and capabilities
  • Solution Architecture designs for outcomes, reuse, and cross-team cohesion
  • System Architecture delivers scalable, secure, and observable implementations
  • Data Architecture fuels insight, trust, and compliance across the ecosystem

This isn’t architecture as documentation — it’s architecture as flow.

🚀 Conclusion: Leading with Architecture in the ART

In a high-performing ART, architecture isn’t just present — it’s pervasive. It’s embedded in planning, backlog refinement, design, and delivery. It’s visible in metrics, reusable in assets, and traceable to business outcomes.

As we modernize legacy estates and shift toward modular, API-first ecosystems, the role of architecture will only grow in importance. It’s time to stop asking whether architecture fits into agile — and start showing how it leads it.

Thursday, December 8, 2022

SYNTHETIC CRASH 500 RSI INDICATOR

Hi and thank you for visiting my blog. 

Let's talk EA's and strategy, the easiest EA to use with Crash 500 is the RSI, and simply put, you can sell based on the value, I created a simple EA which monitors the RSI value and then in turn would print a simple arrow on the chart when the RSI reaches specific levels. 

You may find it useful, but you also may not find it useful. 

What I can say, is that most of the BOTS I have seen for Crash 500 uses this simple strategy and sells with a wide SL when the RSI reaches specific levels. 

You could take this EA and turn it into a simple BOT by simply adding in the trade function together with trailing stops. 

You can download the EA here, simply add it to your chart and you are good to go. A word of warning, this EA simply uses RSI, so ensure you are analyzing the charts in conjunction with this EA in order to take entry. If you simply follow this EA you will lose money. 

In my next post, let me know if I should discuss how to create a simple BOT using this strategy. 

I can also show you how you can simply leverage market direction in order to make this EA more accurate. 

*NB, trading is risky, many people lose money when trading forex pairs.
*NB, this is not financial advice, nor am I qualified to provide it.

Wednesday, November 30, 2022

SYNTHETIC CRASH 500 INDEX

Hi, and thank you for coming over to my blog. 

First off, do you understand Forex? Do you understand what a synthetic indices are and which broker offers these as tradeable.

So if you are new, a sythetic indice in a nutshell is an indice that is not affected by fundamentals.These are typically offered by a broker called DERIV. The most common traded pairs are VIX 75 which offers a great ROI. 

But, let's chat about Crash 500, there are many strategies available on the internet and many videos which show different types of trading strategies. The easiest and most common is to use price action and then the RSI indicator, the simplest method is to sell when RSI hits 90 (using 1m timeframe) and hold based on different levels. 

Go have a look at the chart 90% of the time Crash 500 fall after it its the 80 or 90 levels on the RSI, its a simple way to get you started with a synthetic index and Deriv.

If you have not registered a Deriv Account, you can register by following this link

Monday, July 18, 2022

Loading appsettings.json in a different project type

So I found myself in a situation where I needed to access data stored in a configuration file for a DOTNET Core project, so I dug around and found that a few steps are required which are listed below: 

  • Add references to the following Nuget packages 

  • Add your empty appsettings.json file to the root of your project 
  • Add the below code entry:


Once complete you should be able to access the appsettings as you usually do in any dotnet core web project. 

Thursday, June 6, 2013

Deleting a WebPart from the WebParts Gallery using PowerShell

So you have a requirement to remove a webpart or multiple webparts from the webparts gallery in SharePoint and you need to do this with Windows PowerShell. One thing to remember is that the webparts gallery is the same as any other gallery in SharePoint and your task can easily be achieved using PowerShell. The below code will remove a webpart from the webparts gallery:

function RemoveWebPartsFromGallery([string]$siteUrl)
{
# an array of the custom webparts that were built;
$customWebPart = New-Object System.Collections.ObjectModel.Collection[System.String]
$customWebPart.Add("CustomWebPart")

$site = Get-SPSite $siteUrl

# the default SP type for a webpart gallery;
$wpCatalog = [Microsoft.SharePoint.SPListTemplateType]::WebPartCatalog

$list = $site.GetCatalog($wpCatalog)

$wpID = New-Object System.Collections.ObjectModel.Collection[System.Int32]

foreach ($item in $list.items)
{
foreach ($wps in $customWebPart)
{
if ($item.Name.ToLower().Equals($wps))
{
$wpID.Add($item.ID)
continue
}
}
}

foreach ($i in $wpID)
{
$wpitem = $list.GetItemById($i)
$wpItem.Delete()
}

$list.Update()

Write-Host "WEBPARTS REMOVED FROM GALLERY" -ForegroundColor Green
}

You can check out the original script here a big thanks to Srinivas Challagolla for the script. 

The script has greatly helped me I hope that it has helped you. Happy scripting guys :-)

Wednesday, May 29, 2013

STSADM VS POWERSHELL SOLUTION DEPLOYMENT

PowerShell Deployments

So everyone is familar with STSADM command prompt and we have all learned to love it. So now we have PowerShell, so to get you started please have a look at the following links which are great resources to get you started for deploying a "WSP" Package using powershell.
There are many more resources available out there - but those are the two I decided to use. You can see the basic commands for deployment below:


Add Solution

ADD-SPSOLUTION [SOLUTION LOCATION]

Deploy Solution

INSTALL-SPSOLUTION -IDENTITY [SOLUTION NAME] -GACDEPLOYMENT -WEBAPPLICATION [URL]

You can also check out a few MSDN articles:


Hope these articles help you out :-)

SharePoint Timer Jobs

How to create a SharePoint 2010 Timer Job...

So I have finally found sometime to create a post on how to create a SharePoint 2010 timer job. I had a look around and found many, many post already out there and they are awesome.

Please have a look at Andrew Connels blog post as it is a great resource to use for creating SharePoint timer jobs.

Another resource that I found very useful was SharePoint Tips for creating various timer job schedules.

So happy coding everyone, I hope these resources can help you.

Tuesday, May 14, 2013

Deploy SharePoint 2010 master page using a module

So this post may or may not be a bit overdue, but deploying various files with a module makes life for us as developers pretty simple. In this post I will detail the steps to deploy your custom developed SharePoint 2010 master page into the master page gallery.

So the first step is to create a new module in Visual Studio





















By default the following files below are you created for you when a module is created, you can go ahead and delete the "Sample.txt" file as we will add our master page shortly.










You can down download a fantastic starter master create by Randy Drisgill from the following link.

Once you have downloaded the master page, add the master into the module.

Now once the master page has been added - open the "Elements.xml" file and add replace with the following:












And it is as simple as that - you can now deploy your custom built master page into the master page gallery with ease. I hope that this post has helped you. 

Happy Branding :-)

SharePoint 2010 Test Cases including Test Matrix

In the last few months we were tasked to create test cases including a test matrix for what was developed in our SharePoint 2010 solution. So I started out on my Google Search trying to find a generic test document which I can reuse across my site as I did not want to write any test cases for the OTB functionality that SharePoint offers.

I found this link to provide good guidance in formulating a test plan as well as a test matrix document.

There are various other sources available on the Internet, but I have found the one mentioned above most useful for my specific requirements.

I hope this helps :-)

Thursday, May 9, 2013

How to create a site collection and specify the content database

So pretty much everyone knows how to create a new site collection, but what is not so simple is creating a new site collection in a content database which you specified. This can easily be achieved using some powershell, as shown below:


$SITECOLLECTION = Read-Host "What is the name of the site collection you wish to add?"
$SITEDESCRIPTION = Read-Host "What is the site collection description?"
$SITEURL = Read-Host "What is the URL of the site you wish to add?"
$SITEADMINISTRATOR = Read-Host "Who is the site collection administrator?"
$DATABASENAME = Read-Host "In which content database do you wish to add this site collection?"
$SITETEMPLATE = "CMSPUBLISHING#0" # --> THIS IS SITE TEMPLATE FOR PUBLISHING SITE

# CHECK IF CONTENT DATABASE EXIST

$CONTENTDB = Get-SPContentDatabase -identity $DATABASENAME

# IF CONTENT DB EXISTS WE WILL ADD SITE COLLECTION AND USE CONTENT DB SPECIFIED ELSE DISPLAY ERROR MSG

If (!$CONTENTDB)
{
Write-Host "The specified content database has not been found - PLEASE TRY AGAIN"
}
else
{
Write-Host "SITE COLLECTION CREATION STARTED"

New-SPSite -Name $SITECOLLECTION -Url $SITEURL -Template $SITETEMPLATE -OwnerAlias $SITEADMINISTRATOR -ContentDatabase $CONTENTDB -Description $SITEDESCRIPTION

Write-Host "SITE COLLECTION CREATION COMPLETE"

}

I hope this helps you as it did me.

Wednesday, May 8, 2013

How to retrieve s user profile in SharePoint 2010

The below code will show how to retrieve a user profile using the SharePoint object model

The following references are required:
  • Microsoft.Office.Server
  • Microsoft.Office.Server.UseProfiles
  • Microsoft.SharePoint
  • System.Web  
        private UserProfiles.UserProfile GetCurrentUserProfile(SPUser currentUser, string siteCollectionUrl)
        {
            try
            {
                using (var site = new SPSite(siteCollectionUrl))
                {
                    var serverContext = SPServiceContext.GetContext(site);
                    var profileManager = new UserProfileManager(serverContext);
                    var userProfile = profileManager.GetUserProfile(currentUser.RawSid);

                    return userProfile != null ? userProfile : null;
                }
            }
            catch (Exception ex)
            {
                // Handle error and write them to a log
                return null;
            }
        }


I hope this has helped you, please feel free to drop me a note if you have any questions.

Default user profile properties

If you ever need to figure out what are the default user profiles properties provided by SharePoint 2010 - you can follow this link.

You may also want to have a look at the Microsoft.Office.Server.UserProfiles.PropertyConstants class, you may find it here. 

I hope this has helped you as it did me.

Saturday, July 14, 2012

How to loop through all SPWeb object in your SharePoint site using Powershell

If ever you need to loop through all your SPWeb object in a SharePoint site for whatever reason and you want to do it in powershell. Try out the below code snippet. It worked for me, hope it can help you.

Remove-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue

$siteUrl = read-host "What is your site url? Eg: http://mysharepointpotal"
$site= Get-SPSite $siteURL
$webs= $site.AllWebs
try
{
    foreach ($web in $webs)
    {
        Write-Host $web.url
       
        # Perform operation
    }
}
catch
{
    write-host -f Red "error" $_.exception
    $errorlabel = $true
}
And that's it, you can now loop through all SPWeb objects in your site.

Happy scripting :-)

Tuesday, July 3, 2012

Programatically creating a SharePoint publishing page

Creating a new SharePoint publishing page is pretty simple, we just got a couple of things to remember.

First check if the page already exists, if so you can edit that page. If it does not exist we need to pass a filename and a page layout which are pretty important.

Once the page is created you can do pretty much anything with it.

        private static PublishingPage CreatePage(string filename, string title, string siteUrl, string pageLayout)
        {
            try
            {
                using (SPSite s = new SPSite(siteUrl))
                {
                    using (SPWeb w = s.OpenWeb())
                    {
                        PublishingWeb pWeb = PublishingWeb.GetPublishingWeb(w);

                        PageLayout[] ls = pWeb.GetAvailablePageLayouts();
                        var layout = ls.ToList().Find(x => x.Title.Equals(pageLayout, StringComparison.InvariantCultureIgnoreCase));

                        if (layout == null)
                            return null;

                        var p = pWeb.GetPublishingPages().ToList().Find(x => x.Name.Equals(filename, StringComparison.InvariantCultureIgnoreCase));

                        if (p == null)
                            p = pWeb.GetPublishingPages().Add(filename, layout);
                        else
                            return p;

                        p.Title = title;
                        p.Update();

                        return p;
                    }
                }
            }
            catch
            {
                return null;
            }
        }

And there you have it you have successfuly created a new SharePoint publishing page.

Monday, June 11, 2012

How to serialize and deserialize any object to a compressed string

How to : Serialize and Deserialize a object into a compressed string

If you have ever needed to serialize some sort of object to a string for whatever reason we always trying to google some example of how to do it correctly. In the example below, I am going to serialize and compress a generic list to a string.

Serialization and Compression

        private static string CompressValue(object serializedValue)
        {
            try
            {
                BinaryFormatter bf = new BinaryFormatter();

                using (MemoryStream ms = new MemoryStream())
                {
                    bf.Serialize(ms, serializedValue);

                    byte[] inbyt = ms.ToArray();

                    using (MemoryStream objStream = new MemoryStream())
                    {
                        using (DeflateStream objZS = new DeflateStream(objStream, CompressionMode.Compress))
                        {
                            objZS.Write(inbyt, 0, inbyt.Length);
                            objZS.Flush();
                            objZS.Close();

                            byte[] b = objStream.ToArray();

                            return Convert.ToBase64String(b);
                        }
                    }
                }
            }
            catch { return string.Empty; }
        }

Deserialize object

        private List DeSerializeStringToObject(string serializedContent)
        {
            List retval = new List();

            byte[] bytCook = Convert.FromBase64String(serializedContent);

            using (MemoryStream inMs = new MemoryStream(bytCook))
            {
                inMs.Seek(0, 0);

                using (DeflateStream zipStream = new DeflateStream(inMs, CompressionMode.Decompress, true))
                {
                    byte[] outByt = ReadFullStream(zipStream);

                    zipStream.Flush();
                    zipStream.Close();

                    using (MemoryStream outMs = new MemoryStream(outByt))
                    {
                        outMs.Seek(0, 0);

                        BinaryFormatter bf = new BinaryFormatter();

                        retval = (List)bf.Deserialize(outMs, null);
                    }
                }
            }

            return retval;
        }

        private static byte[] ReadFullStream(Stream stream)
        {
            byte[] buffer = new byte[32768];

            using (MemoryStream ms = new MemoryStream())
            {
                while (true)
                {
                    int read = stream.Read(buffer, 0, buffer.Length);
                    if (read <= 0)
                        return ms.ToArray();
                    ms.Write(buffer, 0, read);
                }
            }
        }
And that is it, you can now serialized any object into a string and deserialize into your object again.

Happy coding guys...

ASP.NET Update Panel not reloading jquery

Issue: asp.net update panel not reloading custom jquery after a partial post back occurs.

Cause: The asp.net update panel reloads all the content within the content template tags, thus your custom jquery is not reloaded and never fired.

Solution: Add your custom jquery at the end of the request by using the page request manager object:

    var prm = Sys.WebForms.PageRequestManager.getInstance();

    prm.add_endRequest(function () {
        DOSTUFF();
    });

And problem solved, it's as easy as that.

I hope this helped you, it solved my problem.

Wednesday, November 9, 2011

How to Deploy Silverlight XAP file to a Document Library

Okay, so you have developed your silverlight application in SharePoint and you now want to deploy it. So you take your XAP file add it your document library and then reference it from your Silverlight Web Part right? Seems kind of like a long process, if you also had to deploy a whole bunch of web part with.

So we can make it simple by deploying our XAP with the rest of the web parts, lists, etc. All you need to do is follow a few simple steps and your XAP file will be deployed to your site with the rest of your customisations.

Step 1
Add a new module to your solution




Step 2

Right Click on the module you have just added and select properties.
Look for "Project Output References" click on the elipsis and click add.
Set the deployment type to a "ElementFile" and select your project name





Click ok and you should notice your Elements.xml has been modified to something like the following:


You can now proceed to change it to look like the below:

 

Happy coding guys I hope this helps make your deployment alot simpler.