This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
def __main(): | |
kwargs={ | |
'source_directory' :r'D:/bin/completeddownloads/docs' | |
,'search_pattern' :'*Success*' | |
,'dest_directory_root' :r'D:/Users/qwerty/Documents/_user/Programming/Reference' | |
,'dest_leaf_directory' :'Success' | |
} | |
move_matches_to_folder(**kwargs) | |
def move_matches_to_folder(source_directory, search_pattern, dest_directory_root, dest_leaf_directory=""): |
def __main(): | |
kwargs={ | |
'source_directory' :r'D:/bin/completeddownloads/docs' | |
,'search_pattern' :'*Success*' | |
,'dest_directory_root' :r'D:/Users/qwerty/Documents/_user/Programming/Reference' | |
,'dest_leaf_directory' :'Success' | |
} | |
move_matches_to_folder(**kwargs) | |
def move_matches_to_folder(source_directory, search_pattern, dest_directory_root, dest_leaf_directory=""): |
import os,glob | |
def __main(): | |
kwargs={ | |
'source_directory' :r'D:/bin/completeddownloads/docs' | |
,'search_pattern' :'*Success*' | |
,'dest_directory_root' :r'D:/Users/qwerty/Documents/_user/Programming/Reference' | |
,'dest_leaf_directory' :'Success' | |
} | |
move_matches_to_folder(**kwargs) |
#Here's an implementation that doesn't use recursion, and only memoizes the last two values instead of the whole sequence history. | |
#nthfib() below is the direct solution to the original problem (as long as imports are allowed) | |
#It's less elegant than using the Reduce methods above, but, although slightly different that what was asked for, it gains the ability to to be used more efficiently as an infinite generator if one needs to output the sequence up to the nth number as well (re-writing slightly as fibgen() below). | |
# from itertools import imap, islice, repeat | |
# nthfib = lambda n: next(islice((lambda x=[0, 1]: imap((lambda x: (lambda setx=x.__setitem__, x0_temp=x[0]: (x[1], setx(0, x[1]), setx(1, x0_temp+x[1]))[0])()), repeat(x)))(), n-1, None)) |
//Is there a way to programmatically determine if a SharePoint 2007 web application is using Forms authentication? I guess one way might be to read it from the web.config but I was wondering if there is some property exposed in the API. | |
protected override void OnLoad(EventArgs e) | |
{ | |
base.OnLoad(e); | |
string g = base.Request.QueryString["WebAppId"]; | |
this.webApp = (SPWebApplication) SPConfigurationDatabase.Local.GetObject(new Guid(g)); | |
this.zone = (SPUrlZone) Enum.Parse(typeof(SPUrlZone), base.Request.QueryString["Zone"]); | |
this.lb_Zone.Text = SPHttpUtility.HtmlEncode(SPAlternateUrl.GetZoneName(this.zone)); | |
SPIisSettings iisSettings = this.webApp.IisSettings[this.zone]; |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
import os,shutil | |
def __main(): | |
kwargs={ | |
'source_directory' :r'\\host\everyone\s\GTCom' | |
,'file_types' :['.jpg', '.gif', '.png', '.tif'] | |
,'dest_directory_root' :r'\\host\everyone\staticfiles' | |
} | |
copy_matches_to_folder(**kwargs) | |
$ErrorActionPreference='stop' | |
function Remove-DuplicateWebparts | |
{ | |
param([System.String] $siteurl, [System.String] $filename) | |
$site = new-object Microsoft.SharePoint.SPSite($siteurl) | |
$items = $site.GetCatalog([Microsoft.SharePoint.SPListTemplateType]::MasterPageCatalog).Items | |
$webParts = new-object 'System.Collections.Generic.List[string]' |
Attribute VB_Name = "ShowAddress" | |
Public Function ShowAddress(rng As Range) As String | |
If rng.Cells.Count > 1 Then | |
ShowAddress = CVErr(xlErrValue) | |
Else | |
ShowAddress = rng.Hyperlinks.Item(1).Address | |
End If | |
End Function |