摘要:
PV原语通过操作信号量来处理进程间的同步与互斥的问题。其核心就是一段不可分割不可中断的程序。 信号量的概念1965年由著名的荷兰计算机科学家Dijkstra提出,其基本思路是用一种新的变量类型(semaphore)来记录当前可用资源的数量。有两种实现方式:1)semaphore的取值必须大于或等于0。0表示当前已没有空闲资源,而正数表示当前空闲资源的数量;2) semaphore的取值可正可负,负数的绝对值表示正在等待进入临界区的进程个数。 信号量是由操作系统来维护的,用户进程只能通过初始化和两个标准原语(P、V原语)来访问。初始化可指定一个非负整数,即空闲资源总数。 p原语和v原语 P原语. 阅读全文
摘要:
键盘上的符号用英语怎么读` backquote 反引号 ~ tilde! exclam@ at# numbersign,英语国家是hash,美语是pound,音乐里作sharp,如C#$ dollar% percent^ caret& ampersand* asterisk,star(美语),数学公式中作multiply( parenleft,opening parentheses) parenright,closing paretheses- minus;hyphen连字符,不读_ underscore+ plus= equal[ bracketleft,opening bracke 阅读全文
摘要:
[system.Reflection.Assembly]::LoadWithPartialName("System.ServiceProcess")|out-NullfunctionGet-ServiceStartupMode{param([string]$servicename,[string]$serverName)$startMode=gwmiwin32_service-filter"NAME='$servicename'"-computername$serverName|Select-PropertyStartMode$start 阅读全文
摘要:
#Declare location of the files to be copied $SourceShortcut = "UNC Path" $SourceBGInfoExec = "UNC Path" $SourceBGInfoBMP = "UNC Path" $ServerPath = "c:\Temp\2008Servers.txt"#Get List of Servers $servers = Get-Content -Path $ServerPath#Loop Through Servers Fore 阅读全文
摘要:
Snippet: Recursively Copy Folder (with excludes) in PowerShell (PowerShell) Title: Recursively Copy Folder (with excludes) in PowerShell Language: PowerShell Description: This function recursively copies a folder and all subfolders while allowing you to properly exclude certain items. Views: 431 Aut 阅读全文
摘要:
Restart-Service (recursively)http://bsonposh.com/archives/545I often need to restart services on multiple machines and one of the biggest issues is the dependent services that also need to be restarted. I finally found time to write a script that will recursively stop and start dependent services.Pa 阅读全文
摘要:
Restarting IIS (IIS 6.0)http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/95826e7a-bac4-4e1f-bcb6-c52d49c9d7f4.mspx?mfr=trueYou might need to restart Internet Information Services (IIS) before certain configuration changes take effect or when applications become unavailable. 阅读全文
摘要:
http://technet.microsoft.com/en-us/library/ee198770.aspxStopping and Starting Dependent Services Microsoft® Windows® 2000 Scripting GuideService dependencies are especially important when you try to stop services. To stop an antecedent service, you must first stop the dependent services. F 阅读全文
摘要:
文档类型定义(DTD)可定义合法的XML文档构建模块。它使用一系列合法的元素来定义文档的结构。DTD 可被成行地声明于 XML 文档中,也可作为一个外部引用。内部的 DOCTYPE 声明假如 DTD 被包含在您的 XML 源文件中,它应当通过下面的语法包装在一个 DOCTYPE 声明中:<!DOCTYPE 根元素 [元素声明]>带有 DTD 的 XML 文档实例(请在 IE5 以及更高的版本打开,并选择查看源代码):<?xml version="1.0"?><!DOCTYPE note [ <!ELEMENT note (to,from, 阅读全文
摘要:
SQL Server Express Management Studio Express 2008因要使用2008的新功能,就顺带装了一下,发现装完后没有SMSE,找到了这个文章。记录一下。I was recently doing a personal site and wanted to use VWD and SQL Express, this time all 2008.All happy and fine went to the site and downloaded and selected to install SQL Exrpress 2008.Went to look for 阅读全文
摘要:
代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--usingSystem;usingSystem.Threading;classCalculateTest{staticvoidMain(){Calculatecalc=newCalculate();Console.WriteLine("Result={0}.",calc.Result(234).ToString());Console.WriteLine("Result={0}.",calc.Res 阅读全文
摘要:
两个对象之间如果要进行通信,我们可以使用Event,或者是Action来解决,在实际的开发过程中,当需要在类A中调用类B中的一个异步执行的方法,然后又希望B中的方法执行完之后需要触发A类中的一些操作,这个时候我们就应该想到事件。通常情况下,我们了解最多的是控件的事件,然后控件的事件的触发一般都是通过外界输入来触发的,譬如鼠标点击控件触发,键盘有按键时触发。事件触发后我们就可以在注册事件的EventHandle中处理和响应事件。其实,完全也可以自己定义事件,通过代码的形式来触发事件。下面我通过下面的例子,介绍两种对象间通信的方法:例子非常简单1、新建一个Windows应用程序,在Form1上面拖 阅读全文
摘要:
代码 Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--usingSystem;usingSystem.Drawing;publicclassExample{publicstaticvoidMain(){//CreateanarrayoffivePointstructures.Point[]points={newPoint(100,200),newPoint(150,250),newPoint(250,375),newPoint(275,395),n 阅读全文
摘要:
Silvelight 的RIA Service 项目 OOB之后存在一个问题,就是不能够Debug。为了解决这个问题,我们需要在VS中将Silverlight应用程序附加到进程。debug-Attache to process-sllaucher.exe然后就可以进断点调试了。 阅读全文
摘要:
代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--usingSystem;usingSystem.ServiceModel;usingSystem.ServiceModel.Description;namespaceMicrosoft.ServiceModel.Samples{//Defineaservicecontract.[ServiceContract(Namespace="http://Microsoft.ServiceModel.Sam 阅读全文