This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//truncate string | |
function strTruncate(str, n) { | |
var r = /[^\x00-\xff]/g; //the chinese char,or r = [\u4e00-\u9fa5]; | |
if (str.replace(r, "mm").length > n) { | |
var m = Math.floor(n / 2); | |
for (var i = m, l = str.length; i < l; i++) { | |
var _l = str.substr(0, i).replace(r, "mm").length; | |
if (_l >= n) { | |
return str.substr(0, i + n - _l) + "..."; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// 根据字符长度截断字符串 | |
/// </summary> | |
/// <param name="str"> | |
/// 需要截断的字符串 | |
/// </param> | |
/// <param name="maxLength"> | |
/// 字符串允许的最大长度(包含的byte数) | |
/// </param> | |
/// <param name="isDetectChinese"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Data.Objects; | |
using System.Linq; | |
namespace TestCoreService | |
{ | |
public class FackIObjectSet<T> : IObjectSet<T> | |
where T : class | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IDictionary<int, string> EnumToIDictionary<T>() where T : struct,IConvertible | |
{ | |
if (!typeof(T).IsEnum) throw new ArgumentException("T must be an enumerated type"); | |
IDictionary<int, string> dictionary = new Dictionary<int, string>(); | |
foreach (var enumobj in (T[])Enum.GetValues(typeof(T))) | |
{ | |
string text = enumobj.ToString(); | |
int value = enumobj.ToInt32(null); | |
dictionary.Add(value, text); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$filepath="C:\SourceCode\FCSLN\FCProperty\FCProperty\Content" | |
$compile="C:\Temp\google-closure\compiler.jar" | |
$jsfiles = ls $filepath -Recurse -Include *.js -Exclude *.min.js | |
Foreach($js in $jsfiles){$i=$js.FullName.LastIndexOf(".js") | |
$compressjs= $js.FullName.Remove($i)+".min.js" | |
java -jar $compile --compilation_level SIMPLE_OPTIMIZATIONS --js_output_file $compressjs $js.FullName | |
} | |
ls $filepath -Recurse -Include *.min.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cell theCell = worksheetPart.Worksheet.Descendants<Cell>().Where(c => c.CellReference == addressName).FirstOrDefault(); | |
if (theCell != null) | |
{ | |
if (theCell.DataType != null && theCell.DataType == CellValues.SharedString) | |
{ | |
var sharedStringTable = document.WorkbookPart.SharedStringTablePart.SharedStringTable; | |
var element = sharedStringTable.ChildElements[int.Parse(theCell.InnerText)]; | |
if (string.IsNullOrEmpty(element.InnerText)) | |
{ | |
SharedStringItem sst = new SharedStringItem(new Text(text)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var styleSheet = document.WorkbookPart.WorkbookStylesPart.Stylesheet; | |
Fill fill = new Fill() { PatternFill = new PatternFill { ForegroundColor = new ForegroundColor { Rgb = fgcolor }, PatternType = PatternValues.Solid } }; | |
styleSheet.Fills.Append(fill); | |
//or use the method Count(),not need to plus 1,but slowly. | |
var fid = styleSheet.Fills.Count++; | |
CellFormat cellFormat = null; | |
if (theCell.StyleIndex.HasValue) | |
{ | |
var originalCellFormat = document.WorkbookPart.WorkbookStylesPart.Stylesheet.CellFormats.ToList()[(int)theCell.StyleIndex.Value] as CellFormat; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$files = Get-Item -Path C:\SourceCode\PMDProj\PDMApplication\* -Include "bin","Scripts","Views","Content" ` | |
| Get-ChildItem -Recurse -Force -Exclude "*.pdb" -ErrorAction:SilentlyContinue ` | |
| Where {(($_.CreationTime -gt "2013-1-24") -or ($_.LastWriteTime -gt "2013-1-24")) -and !$_.PSIsContainer} ` | |
| Select FullName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Copy-Item -Recurse -Force -Path C:\SourceCode\PMDProj\PDMApplication\* -Include "bin","Scripts","Views","Content" C:\Users\Wen\Desktop\PMD | |
$items = Get-ChildItem -Path C:\Users\Wen\Desktop\PMD\* -Recurse -Force -ErrorAction:SilentlyContinue ` | |
| Where {(($_.CreationTime -lt "2013-1-24") -or ($_.LastWriteTime -lt "2013-1-24 09:00:00") -or ($_.Extension -eq ".pdb")) -and !$_.PSIsContainer} | |
ForEach($item in $items) | |
{$item.Delete() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALTER TRIGGER [dbo].[CM_ApprovalMatrix_Settings_Trigger] | |
ON [dbo].[CM_ApprovalMatrix_Settings] | |
FOR INSERT,DELETE,UPDATE | |
AS | |
BEGIN | |
-- SET NOCOUNT ON added to prevent extra result sets from | |
-- interfering with SELECT statements. | |
SET NOCOUNT ON; | |
DECLARE @del INT,@ins INT,@status NVARCHAR(50) | |
SET @del = (SELECT COUNT(ID) FROM deleted) |
OlderNewer