Dynamics 365: Three way to get organization unique name

We have three ways to get organization unique name in Microsoft Dynamics 365.

A. Just click on the top right corner of the user avatar, and right here (org64e4ed31).

B. Get it with PowerShell, At first, you need to download the Dynamics 365 SDK to local, and then Run the PowerShell as administrator, cd to the SDK folder, and run .\RegisterXRMTooling.ps1

Add-PSSnapin Microsoft.Xrm.Tooling.Connector
Add-PSSnapin Microsoft.Xrm.Tooling.PackageDeployment

$Cred = Get-Credential
Get-CrmOrganizations -Credential $Cred -DeploymentRegion NorthAmerica –OnlineType Office365

C. Get it from the settings page of the Dynamics 365

Click Settings -> Customization -> Developer Resources -> Unique Name

Quick Tips: Open CMD here | 在当前位置打开命令行


We can right-click the mouse with Shift key to find the "Open command here" or "Open PowerShell window here" item to open the command line at current location.

But we often need to run the command line as an administrator, so you could register the following value to Windows Register to add a new item "Open command (as Admin) here" to Windows Explorer right-click menu.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\runas]
"Icon"="c:\\windows\\system32\\cmd.exe"
"MUIVerb"="Open command (as Admin) here"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\Directory\Background\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\""

[HKEY_CLASSES_ROOT\folder\shell\runas]
"Icon"="c:\\windows\\system32\\cmd.exe"
"MUIVerb"="Open command (as Admin) here"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\folder\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\""

Open the Notepad and paste the text of above, save the file as OpenCMDHere.reg, and then double click this file, and click the "Yes" button in the message box.

The meaning of the above code is that we will create a new Windows shell item called "runas" at folder and the empty space in a folder, and set the Icon and propmt text.

HKEY_CLASSES_ROOT\Directory\shell, the context menu when you right-click on a folder
HKEY_CLASSES_ROOT\Directory\background, the context menu when you right-click on the "background" empty space while in a folder 

Then to define the running command of "runas" item:

cmd.exe /s /k pushd \"%V\"

That means to run the cmd.exe at the current working folder, the /k carries out the command specified by the following string so it executes the command pushd %V and since the only argument pushd accepts is a path it follows that %V a variable delivered by explorer that contains the path of the folder right clicked.

See more:
cmd command, https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-xp/bb490880(v%3dtechnet.10)
Pushd command, https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-xp/bb490978(v=technet.10)


我们可以在 Windows 的任意位置,通过 按下 Shift + 鼠标右键,来在当前位置启动 CMD 或 PowerShell。

但是,我们经常需要以管理员身份取运行 CMD,所以我们可以通过加载上述的值到注册表,来为右键菜单添加一个新的选项。将上述值保存到一个记事本中,并保存为 .reg 文件,然后双击运行,在后续提示中都选择 是,即可。

SQL Server 下 K-V 形式存储 1亿条 数据对于查询效率的影响

这是一篇2年多以前带过的实习生 Peflapos 所整理的小文,拿出来缅怀下,也希望他在新的公司一切顺利。


对1亿条 K-V 型记录查询效率的验证

关于 K-V 型存储

1. 为什么考虑 K-V 存储形式?

假设有一个 Request 类如下:

	public class Request
	{
		public Guid RequestId {get; set;};
		public string RequestName {get; set;};
		public string RequestOwner {get; set;};
	}
	

我们可以按照如下的结构把它存入数据库:

Continue reading

JavaScript: 注册粘贴事件,将剪切板中的内容去除HTML标签,并粘贴到光标位置

$("#Subject").bind('paste', function (e) {
        var pasteData = "";
        if (e.originalEvent.clipboardData) {
            pasteData = e.originalEvent.clipboardData.getData('text');
        } else {
            // for IE
            pasteData = window.clipboardData.getData("Text");
        }
        var self = this;

        // 在等待一段时间后,在当前光标位置,粘贴处理后的文本
        setTimeout(function () {
            var selection = document.getSelection();
            var cursorPos = selection.anchorOffset;
            var oldContent = selection.anchorNode.nodeValue;
        // 通过 Jquery的text() 去除所有样式
            var toInsert = $("<div>" + pasteData + "</div>").text();
            var newContent = oldContent.substring(0, cursorPos) + toInsert + oldContent.substring(cursorPos);
            selection.anchorNode.nodeValue = newContent;            
        }, 200);
        return false;
    });

2016 年度总结

这是我入职第四年的年终总结(2016年,有删节,项目及公司敏感信息已隐去),这一年真的很精彩。

 2016 年度总结

2017年1月6日

感谢 2016

2016年对于我来说是不平凡的。

2016年一切都是新的。我作为一个新人,带着一批更新的人,面对新的DEV 8。然后一起学习新的技术、新的项目、新的合作环境。

2016年一切都是陌生。面对新的部门,我不敢怠慢却又对如何才能让它拥有执行力、凝聚力而担忧、疑惑。面对新的项目,我们又该如何与别人有效、友好的合作、相处?2016年一切都是责任。作为部长、作为学长、作为兄长,是否应该无尽地扮演一名保护者的角色?泛滥的负责会不会反而成为一种不负责任呢?我又怎样才能变化自己?

2016年一切都是坚持。面对XX项目的任务,如何同大家一块儿在学习如何开发的同时,按时完成我们的开发任务?如何面对压力、如何权衡度量?当异常紧张的工作逐渐舒缓以后,我们又该如何面对自己?

“能得到锻炼能力的机会”本身就是一项极其稀缺的资源。对我自己而言,我只想用无比幸运来形容这一年,我得到了那么多的机会,然后由此或为此去尝试改变,这是最难得的经历。

Continue reading