From this article:
Notice that all XML nodes in the document are converted to standard PowerShell properties, whether a node has children (e.g. catalog) or is a leaf node (e.g. price), or whether a leaf node is an element (e.g. author) or an attribute (e.g. id). In particular (as the last two examples above illustrate), element values and attribute values are treated exactly the same with standard “dot” notation.
This sill also help us suck work with DataSets, converting them to XML and then accessing the data as properties.
Thursday, January 16, 2014
Tuesday, January 14, 2014
Microsoft encourages bad developer practices
Look at this: http://sdt.bz/content/article.aspx?ArticleID=65362&page=1
“To give you a concrete scenario or example, let’s assume that you’re working on building an Azure website during the day, and you go home in the evening and suddenly the one thing that was bugging you about your website you want to go fix, and you suddenly know in your head, ‘Hey, these are three lines of code that I need to go add to make it work the way I want it to make it work.’ You can fire up a browser, use Visual Studio Online, get access to the source code, which is stored in Visual Studio Online, and then be able to edit your project with those three lines of change that you want to make, and boom, you are there. And you can deploy using Visual Studio Online right from there.”
What could go wrong? The developer fixes the issue and introduces three more, without integrating with other developers, testing, etc. deploys the stuff from his Visual Studio Online to production, breaking the site.
Why is Microsoft investing into the tools for deployment from the Visual Studio? They only encourage bad coding practices... This ability should be removed from the Visual Studio, instead we should be only deploy from the drop folder, after the code is integrated and built, all tests passed and the code is certified to be ready for prod. Instead of building tools to deploy from the Visual Studio Microsoft should make it easy to build deployment pipeline.
“To give you a concrete scenario or example, let’s assume that you’re working on building an Azure website during the day, and you go home in the evening and suddenly the one thing that was bugging you about your website you want to go fix, and you suddenly know in your head, ‘Hey, these are three lines of code that I need to go add to make it work the way I want it to make it work.’ You can fire up a browser, use Visual Studio Online, get access to the source code, which is stored in Visual Studio Online, and then be able to edit your project with those three lines of change that you want to make, and boom, you are there. And you can deploy using Visual Studio Online right from there.”
What could go wrong? The developer fixes the issue and introduces three more, without integrating with other developers, testing, etc. deploys the stuff from his Visual Studio Online to production, breaking the site.
Why is Microsoft investing into the tools for deployment from the Visual Studio? They only encourage bad coding practices... This ability should be removed from the Visual Studio, instead we should be only deploy from the drop folder, after the code is integrated and built, all tests passed and the code is certified to be ready for prod. Instead of building tools to deploy from the Visual Studio Microsoft should make it easy to build deployment pipeline.
Wednesday, August 21, 2013
Fix the gvim encoding problem on Windows
Files, created in Notepad with unicode won't display correctly in gvim unless explicitly set the encoding explicitly. To do that I mapped F6 key in .vimrc as follows:
:map <F6> :set encoding=utf-8<CR>:e!<CR>
:map <F6> :set encoding=utf-8<CR>:e!<CR>
Wednesday, April 17, 2013
Macro to remove attachments
People in my organization often don't pay attention to the size of the email attachments. My habit is to save the emails to the PST files. Hence the problem: my PCT files are huge. The solution: remove attachments. Simple Marco does the trick:
Sub RemoveAttachments()
Dim oMailItem As MailItem
Dim objAttachments As Outlook.Attachments
Dim i As Integer
Set oMailItem = Application.ActiveExplorer.Selection.Item(1)
Set objAttachments = oMailItem.Attachments
If objAttachments.Count > 0 Then
For i = objAttachments.Count To 1 Step -1
objAttachments.Item(i).Delete
Next i
oMailItem.Close (olSave)
End If
Set oMailItem = Nothing
End Sub
Sub RemoveAttachments()
Dim oMailItem As MailItem
Dim objAttachments As Outlook.Attachments
Dim i As Integer
Set oMailItem = Application.ActiveExplorer.Selection.Item(1)
Set objAttachments = oMailItem.Attachments
If objAttachments.Count > 0 Then
For i = objAttachments.Count To 1 Step -1
objAttachments.Item(i).Delete
Next i
oMailItem.Close (olSave)
End If
Set oMailItem = Nothing
End Sub
Thursday, August 23, 2012
So true!!!
The effect of a broken build generally, and specifically a build left broken at the end of a day’s work, is magnified if you are working in a distributed development team with groups in different time zones. In these circumstances, going home on a broken build is perhaps one of the most effective ways of alienating your remote colleagues.
Farley, David; Humble, Jez (2010-07-27). Continuous Delivery: Reliable Software Releases through Build, Test, and Deployment Automation (Addison-Wesley Signature Series (Fowler)) (Kindle Locations 2024-2026). Pearson Education (USA). Kindle Edition.
Farley, David; Humble, Jez (2010-07-27). Continuous Delivery: Reliable Software Releases through Build, Test, and Deployment Automation (Addison-Wesley Signature Series (Fowler)) (Kindle Locations 2024-2026). Pearson Education (USA). Kindle Edition.
Tuesday, August 21, 2012
Really good advise on configuration management
Keep the available configuration options for your application in the same repository as its source code, but keep the values somewhere else. Configuration settings have a lifecycle completely different from that of code, while passwords and other sensitive information should not be checked in to version control at all.
Farley, David; Humble, Jez (2010-07-27). Continuous Delivery: Reliable Software Releases through Build, Test, and Deployment Automation (Addison-Wesley Signature Series (Fowler)) (Kindle Locations 1581-1583). Pearson Education (USA). Kindle Edition.
Farley, David; Humble, Jez (2010-07-27). Continuous Delivery: Reliable Software Releases through Build, Test, and Deployment Automation (Addison-Wesley Signature Series (Fowler)) (Kindle Locations 1581-1583). Pearson Education (USA). Kindle Edition.
Thursday, June 07, 2012
Tuesday, May 01, 2012
More performant way to add items to SharePoint List
SPList.Items.Add(); -this code actually attempts to retrieve all items of the list.
Actually, you may retrieve an empty SPListItemCollection without querying the database by calling SPList.GetItems() and passing an SPQuery object designed to return no rows. So to add an item to a SharePoint list, use the following code instead: SPListItem newItem = SPList.GetItems(new SPQuery(){Query = "0"}).Add();
Mann, Steven; Murphy, Colin; Gazmuri, Pablo; Wheeler, Christina; Caravajal, Chris (2012-01-31). SharePoint 2010 Field Guide (Kindle Locations 8516-8520). John Wiley and Sons. Kindle Edition.
Actually, you may retrieve an empty SPListItemCollection without querying the database by calling SPList.GetItems() and passing an SPQuery object designed to return no rows. So to add an item to a SharePoint list, use the following code instead: SPListItem newItem = SPList.GetItems(new SPQuery(){Query = "0"}).Add();
Mann, Steven; Murphy, Colin; Gazmuri, Pablo; Wheeler, Christina; Caravajal, Chris (2012-01-31). SharePoint 2010 Field Guide (Kindle Locations 8516-8520). John Wiley and Sons. Kindle Edition.
Monday, April 16, 2012
List of JavaScript MVC frameworks
http://www.hanselman.com/blog/TheBigGlossaryOfOpenSourceJavaScriptAndWebFrameworksWithCoolNames.aspx
Monday, February 27, 2012
Wednesday, January 11, 2012
My Powershell Profile
I updated my profile in .\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 to include SharePoint:
function prompt {
$Host.UI.RawUI.WindowTitle=$(get-location)
"$ ";
}
#Set environment variables for Visual Studio Command Prompt
pushd 'c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC'
cmd /c "vcvarsall.bat&set" |
foreach {
if ($_ -match "=") {
$v = $_.split("="); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])"
}
}
popd
write-host "`nVisual Studio 2010 Command Prompt variables set." -ForegroundColor Yellow
& ' C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration\\sharepoint.ps1'
write-host "`nSharePoint environment set." -ForegroundColor Yellow
function prompt {
$Host.UI.RawUI.WindowTitle=$(get-location)
"$ ";
}
#Set environment variables for Visual Studio Command Prompt
pushd 'c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC'
cmd /c "vcvarsall.bat&set" |
foreach {
if ($_ -match "=") {
$v = $_.split("="); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])"
}
}
popd
write-host "`nVisual Studio 2010 Command Prompt variables set." -ForegroundColor Yellow
& ' C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration\\sharepoint.ps1'
write-host "`nSharePoint environment set." -ForegroundColor Yellow
Thursday, June 30, 2011
Kill Projects and Develop Agile Programs
http://ctotodevelopers.blogspot.com/2011/06/kill-projects-and-develop-agile.html
Wednesday, June 29, 2011
Best practices of the past
Looks like SharePoint faithfully following the best practices of 10 years ago. Lots of XML files, XSLT - some of younger developers don't remember the hype surrounding these at the turn of the millennium. When I experienced pain of setting up BCS in SharePoint 2010, it reminded me of EJB as they were around 2000: lots of duplication in various XML and code files, typo-unforgiving environment, etc.
Come on! It's 2011! Everyone is talking about "convention over configuration", "view engine", Razr, code-first Entity Framework, etc. Are we going to see these in SharePoint 2020?
Come on! It's 2011! Everyone is talking about "convention over configuration", "view engine", Razr, code-first Entity Framework, etc. Are we going to see these in SharePoint 2020?
Tuesday, June 28, 2011
Evil security in Win2008R2
On Windows Server 2008 R2 there is no way to install assembly into GAC. Drag and drop - get "Access denied". Gacutil is not installed!
Had to copy gacutil.exe and gacutil.exe.config from my Windows 7 workstation to the server, then can install assemblies without any problems. Evil security again???
Had to copy gacutil.exe and gacutil.exe.config from my Windows 7 workstation to the server, then can install assemblies without any problems. Evil security again???
Development experience in SharePoint still sucks!
Struggling through BDC Model creation in Visual Studio: what a tedious and unforgiving process. Almost no feedback or error messages...
To create a List I have to edit an XML file...
To create a List I have to edit an XML file...
Wednesday, March 23, 2011
Aspect-oriented programming
AOP and policy injection has low adoption because the use cases suggested are not that important. After all, security and logging has already pretty robust frameworks in both .Net and Java, and other use cases seem just lame...
Instead, where AOP can actually help is to enforce the Open-Closed principle, because it gives you a better alternative to subclass the classes trying to avoid modification. Rather than create derived classes a developer can create aspects or policies that extend the behavior of the class without having to modify it or create a string dependency through rigid inheritance structure.
Instead, where AOP can actually help is to enforce the Open-Closed principle, because it gives you a better alternative to subclass the classes trying to avoid modification. Rather than create derived classes a developer can create aspects or policies that extend the behavior of the class without having to modify it or create a string dependency through rigid inheritance structure.
Wednesday, January 05, 2011
SQL Sentry Plan Explorer
Really good tool for exploring SQL Server execution plans.
http://sqlsentry.net/plan-explorer/sql-server-query-view.asp
Tuesday, January 04, 2011
Free FAST Search for SharePoint training
http://msdn.microsoft.com/en-us/sharepoint/ff960976.aspx
Monday, October 11, 2010
Two lessons
I learned two lessons last week:
1. Friends don't let friends use ASP.Net Login Control
2. JQuery is the best way to fix bugs in ASP.Net.
Wednesday, September 22, 2010
Subscribe to:
Posts (Atom)