Could not load file or assembly 'Microsoft.VisualStudio.Web.PageInspector.Loader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The module was expected to contain an assembly manifest. Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll Running under executable C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\11.0\WebDev.WebServer40.exe --- A detailed error log follows. === Pre-bind state information === LOG: User = TTLWIN2K\miralp LOG: DisplayName = Microsoft.VisualStudio.Web.PageInspector.Loader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (Fully-specified) LOG: Appbase = file:///C:/SVN/temp/components/src/MasterpassProxy/src/Webservice/ LOG: Initial PrivatePath = C:\SVN\temp\components\src\MasterpassProxy\src\Webservice\bin Calling assembly : (Unknown). === LOG: This bind starts in default …
尝试从任何REST客户端触发Jenkins作业时,我收到以下错误
Run Code Online (Sandbox Code Playgroud)Authentication required <!-- You are authenticated as: anonymous Groups that you are in: Permission you need to have (but didn't): hudson.model.Hudson.Read ... which is implied by: hudson.security.Permission.GenericRead ... which is implied by: hudson.model.Hudson.Administer --> </body> </html>
从终端使用curl时会触发请求
我使用以下语法
http:// user:apiToken@jenkins.yourcompany.com/job/your_job/build?token = TOKEN [ref:https ://wiki.jenkins-ci.org/display/JENKINS/Authenticating+scripted+clients ]
即.curl -X POST http:// user:apiToken@jenkins.yourcompany.com/job/your_job/build?token = TOKEN
今天,git开始表现得很有趣(好吧,比平时更有趣),坚持git gc
每次合并后都要跑,即使他们是背靠背.
C:\Projects\my-current-project>git pull
remote: Counting objects: 31, done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 16 (delta 11), reused 0 (delta 0)
Unpacking objects: 100% (16/16), done.
From git.company.com:git/
e992ce8..6376211 mybranch/next -> origin/mybranch/next
Merge made by recursive.
Auto packing the repository for optimum performance. You may also run "git gc" manually. See "git help gc" for more information.
FIND: Parameter format not correct
Counting objects: 252732, done.
Delta compression using up to 2 threads.
Compressing objects: …
Run Code Online (Sandbox Code Playgroud) 我正在编写一个小命令行实用程序,其目的是解析另一个实用程序的输出.我希望它可以通过两种方式调用:
c:\> myutility filewithoutput.txt
Run Code Online (Sandbox Code Playgroud)
要么,
c:\> otherutility -args | myutility
Run Code Online (Sandbox Code Playgroud)
所以,基本上,标准或文件参数.我对此的第一次尝试看起来像这样:
TextReader reader;
if (args.Length > 1) {
reader = new StreamReader(new FileStream(args[1], FileMode.Open));
} else {
reader = Console.In;
}
Process(reader);
Run Code Online (Sandbox Code Playgroud)
文件参数工作正常,并将实用程序的输出传递给我的实用程序工作正常,但如果您只是正常调用它(没有参数和没有管道数据),它会挂起.或者说,它阻止等待从标准读取.
我的第二稿看起来像这样:
TextReader reader;
if (args.Length > 1) {
reader = new StreamReader(new FileStream(args[1], FileMode.Open));
} else {
if(Console.KeyAvailable) {
reader = Console.In;
} else {
Console.WriteLine("Error, need data");
return;
}
}
Process(reader);
Run Code Online (Sandbox Code Playgroud)
虽然KeyAvailable
修复了"无输入"问题,但如果您尝试管道数据> _ <,则会引发异常
Unhandled Exception: System.InvalidOperationException: Cannot see if a key
has been …
Run Code Online (Sandbox Code Playgroud) 我正在使用此参考,并尝试实施OAuth协议,以允许用户通过Facebook登录我的网站.然而,Facebook的文档非常糟糕,并且在一些关键部分还不清楚.
它说授权需要三个步骤:
用户身份验证(将用户重定向到https://facebook.com/dialog/oauth?client_id=...&redirect_uri=...
,并期望redirect_uri
使用a回调页面code
).效果很好!
应用授权(由Facebook等处理).效果很好!
应用程序身份验证(在回调页面上,抓住code
你得到并调用https://graph.facebook.com/oauth/access_token?client_id=...&redirect_uri=...&client_secret=...&code=...
.响应的主体将包括access_token
我们需要做的事情)
据我所知access_token
,我可以调用API等.但是,当它到期时会发生什么?我可以得到一个新的,但到了这一点,以后会有很多HTTP请求,我不再拥有code
我以前得到它的东西.我是否必须存放在code
旁边access_token
?或者,我是否必须告诉用户再次登录,以便我code
获得一个新的access_token
?
或者,我在这里错过了一个关键部分吗?我不需要offline_access
令牌,因为我只会轮询数据以响应用户操作.
我最近将我们的构建平台从一个古老的构建平台迁移到rake之上(不要严肃地问),使用msbuild.因为我们的许多团队成员不使用Visual Studio(再次,不要问),他们习惯于将.cs文件放入项目文件夹中,并且只是将其作为构建的一部分神奇地出现.
因此,此项目的.csproj文件包括以下行:
<ItemGroup>
<Compile Include="**\*.cs" Exclude="obj" />
</ItemGroup>
Run Code Online (Sandbox Code Playgroud)
这通过msbuild直接编译时效果很好.但是,当我在Visual Studio中打开项目时,它决定"有用"地将通配符扩展为完整的文件列表,似乎只要我打开它:
<ItemGroup>
<Compile Include="Controller.cs" />
<Compile Include="MyClass.cs" />
<Compile Include="MyClass2.cs" />
<Compile Include="etc/etc/Something.cs" />
<!-- and so forth -->
</ItemGroup>
Run Code Online (Sandbox Code Playgroud)
虽然从技术上讲这仍然有效,但它也会导致悲伤,因为它会消除通配符.
我尝试实现了这个页面上显示的技术,但我无法使用简单的编译.
以前有人有这个问题吗?有什么方法可以解决这个问题吗?
编辑:澄清我的意思是"无法让它工作",这就是我所做的:
在Main.csproj中,我有这个:
<!-- References in here -->
</ItemGroup>
<Import Project="Imports.proj" />
<ItemGroup>
<!-- ProjectReferences down here -->
Run Code Online (Sandbox Code Playgroud)
然后,我用这个创建了Imports.proj:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Compile Include="**\*.cs" Exclude="obj" />
</ItemGroup>
</Project>
Run Code Online (Sandbox Code Playgroud)
当我在Visual Studio中打开Main.csproj时,它不显示任何文件.可能是这<Import>
条线错了?
编辑2:有趣的是,它仍然通过Visual Studio构建,它只是不显示文件作为项目的一部分.
我正在接受带有char**
(即指向字符串的指针)的代码:
int DoSomething(Whatever* handle, char** error);
Run Code Online (Sandbox Code Playgroud)
基本上,它需要处理其状态,如果出现问题,它会返回错误代码和可选的错误消息(内存分配在外部并通过第二个函数释放.这部分我已经发现:)).
但是,我不确定如何处理C#.我目前有什么:
[DllImport("mydll.dll", CallingConvention = CallingConvention.Cdecl)]
private static unsafe extern int DoSomething(IntPtr handle, byte** error);
public static unsafe int DoSomething(IntPtr handle, out string error) {
byte* buff;
int ret = DoSomething(handle, &buff);
if(buff != 0) {
// ???
} else {
error = "";
}
return ret;
}
Run Code Online (Sandbox Code Playgroud)
我已经戳了戳,但我无法弄清楚如何把它变成一个byte[]
适合喂食的UTF8Encoding.UTF8.GetString()
我是在正确的轨道上吗?
编辑:为了更明确,库函数分配内存,必须通过调用另一个库函数释放.如果一个解决方案没有给我一个指针,我可以释放,解决方案是不可接受的.
额外问题:如上所述,此库使用UTF-8作为其字符串.我是否需要在P/Invokes中做任何特殊操作,或者仅string
用于正常const char*
参数?
我正在使用GDI +(C#)进行一些图像缩放,并且已经注意到我正在缩放的图像沿着左边缘和顶边缘切割的问题.
要重现这一点,请创建一个新的表单项目,将此图像保存到bin\debug文件夹中,并将以下代码添加到表单(以及相应的事件):
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
int scale = 1;
Image img = Image.FromFile("circle.png");
private void Form1_Paint(object sender, PaintEventArgs e) {
//this makes the glitch easier to see
e.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
RectangleF srcRect = new RectangleF(0f, 0f, img.Width, img.Height);
RectangleF destRect = new RectangleF(0f, 0f, img.Width * scale, img.Height * scale);
e.Graphics.DrawImage(img, destRect, srcRect, GraphicsUnit.Pixel);
}
private void Form1_Click(object sender, EventArgs e) {
scale++;
if (scale > 8) …
Run Code Online (Sandbox Code Playgroud) 为了这个问题,让我们假设这个表结构:
People:
PersonID int PK
Name varchar(50)
Place int NULL FK -> Places.PlaceID
MovedIn datetime
Places:
PlaceID int PK
Name varchar(50)
Run Code Online (Sandbox Code Playgroud)
我想确定每个地方住多少人:
SELECT pla.PlaceID, COUNT(*)
FROM Places AS pla
LEFT JOIN People as peo ON peo.PlaceID = pla.PlaceID
GROUP BY pla.PlaceID
Run Code Online (Sandbox Code Playgroud)
此查询将省略没有人居住的地方.有没有办法让它算0?
(我的目标是SQL Server 2005,重要的是它很重要)
编辑:在尝试调整Steve的解决方案后,这是我的真实(匿名)查询:
SELECT
ft.FooTypeID, COUNT(f.FooID)
FROM FooType as ft
LEFT OUTER JOIN Foo f ON ft.FooTypeID = f.FooTypeID
LEFT JOIN FooConfig fc ON ft.NotificationConfigID = fc.FooConfigID
WHERE
DateDiff(day, GetDate(), f.Date) > 0 AND
DateDiff(day, GetDate(), f.Date) …
Run Code Online (Sandbox Code Playgroud) 我继承了使用DynamicMethod在运行时生成方法的代码.我还需要修改一些正在生成的代码.
因为我是MSIL的n00b,所以我希望能够在Reflector中加载生成的代码,并确保代码执行我祈祷的功能;)
只是,我无法弄清楚如何将"Anonymousously Hosted DynamicMethods Assembly"序列化到磁盘.这可能吗?如果是这样,怎么样?