Source:Get current node as IPublishedContent
var currentNode = UmbracoContext.Current.PublishedContentRequest.PublishedContent;
Or
UmbracoHelper umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
# 日期格式是 dd/MM/yyyy HH:mm | |
dir -file -recurse | % { $_.LastWriteTime = '11/19/2015 14:20' } |
# inspire from https://rcmtech.wordpress.com/2010/08/12/powershell-find-files-modified-after-a-certain-date/ | |
dir -File -recurse | Sort-object LastWriteTime -desc | format-table lastwritetime, fullname -autosize | |
# 匯出到檔案 files.txt | |
dir -File -recurse | Sort-object LastWriteTime -desc | format-table lastwritetime, fullname -autosize | out-dir files.txt |
SELECT | |
t.NAME AS TableName, | |
s.Name AS SchemaName, | |
p.rows AS RowCounts, | |
SUM(a.total_pages) * 8 AS TotalSpaceKB, | |
SUM(a.used_pages) * 8 AS UsedSpaceKB, | |
(SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS UnusedSpaceKB | |
FROM | |
sys.tables t | |
INNER JOIN |
var find = 'abc'; | |
var re = new RegExp(find, 'g'); | |
str = str.replace(re, ''); |
DECLARE @versionDate date; | |
SET @versionDate = CONVERT(DATETIME, 11/26/2015, 102); -- delete data older than provide date | |
SELECT nodeId, published, documentUser, versionId, text, releaseDate, expireDate, updateDate, templateId, newest into #tmp | |
FROM cmsDocument WHERE versionID NOT IN | |
(SELECT D.versionId FROM cmsDocument D WHERE D.versionId IN |
Source:Get current node as IPublishedContent
var currentNode = UmbracoContext.Current.PublishedContentRequest.PublishedContent;
Or
UmbracoHelper umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
public class Global : HttpApplication | |
{ | |
public void Application_Start() | |
{ | |
// Clears all previously registered view engines. | |
ViewEngines.Engines.Clear(); | |
// Registers our Razor C# specific view engine. | |
// This can also be registered using dependency injection through the new IDependencyResolver interface. | |
ViewEngines.Engines.Add(new RazorViewEngine()); |
public static double WeightedAverage<T>(this IEnumerable<T> records, Func<T, double> value, Func<T, double> weight) | |
{ | |
double weightedValueSum = records.Sum(x => value(x) * weight(x)); | |
double weightSum = records.Sum(x => weight(x)); | |
if (weightSum != 0) | |
return weightedValueSum / weightSum; | |
else | |
throw new DivideByZeroException("Your message here"); | |
} |
using System; | |
using System.Data.Entity.Core.Objects; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Text; | |
namespace Fenton.Example | |
{ | |
public static class IQueryableExtensions | |
{ |
This script is a suggestion from the umbraco community for creating index for tables.
The main script came from:
This is a bit dirty...but I need to mess with the database
Other similar topics: