当我在终端中打开.profile'时,我有以下内容:
export PATH=$PATH:/usr/local/git/bin
Run Code Online (Sandbox Code Playgroud)
现在我为Mac安装了node.js,它说,
确保/ usr/local/bin在$ PATH中.
如何添加/usr/local/bin导出PATH=$PATH:/usr/local/git/bin?
我偶然发现了一个非常烦人的问题.
当我调试我的软件时,一切运行正常,但如果我点击断点并编辑代码,当我尝试继续运行时,我收到一个错误:
Metadata file 'XYZ' could not be found
看了一会儿之后,我发现了一些类似的问题,但它们都是关于构建失败的,这不是我的情况(这只发生在edit-continue之后).
到目前为止我尝试了什么:
一些额外的信息:
Debug配置运行它时,不会发生错误.有任何想法吗?
c# configuration edit-and-continue visual-studio visual-studio-2012
当我尝试调用包含SELECT语句的存储过程时,我收到以下错误:
该操作对交易状态无效
这是我的电话结构:
public void MyAddUpdateMethod()
{
using (TransactionScope Scope = new TransactionScope(TransactionScopeOption.RequiresNew))
{
using(SQLServer Sql = new SQLServer(this.m_connstring))
{
//do my first add update statement
//do my call to the select statement sp
bool DoesRecordExist = this.SelectStatementCall(id)
}
}
}
public bool SelectStatementCall(System.Guid id)
{
using(SQLServer Sql = new SQLServer(this.m_connstring)) //breaks on this line
{
//create parameters
//
}
}
Run Code Online (Sandbox Code Playgroud)
我在问题中创建了另一个与同一数据库的连接的问题吗?
我遇到了下一个问题:
我正在尝试运行.NET MVC站点以使用ViewBag将一些数据传递给我的View.这是我设置VeiwBag的方法.
[HttpGet]
[AllowAnonymous]
public ActionResult Start()
{
ViewBag.BanReason = null;
int userId;
//Request with UserId, display ban reason if necessary
if (Request.Params["UserId"] != null && int.TryParse(Request.Params["UserId"], out userId))
{
ViewBag.BanReason = CheckIfUserBanned(userId);
}
ViewBag.Users = MvcApplication.Users;
return View();
}
Run Code Online (Sandbox Code Playgroud)
当我为ViewBag赋值(例如ViewBag.BanReason = null;)时,我得到了带有消息的RuntimeBinderException
'System.Dynamic.DynamicObject'不包含'BanReason'的定义.
我正在使用带有.NET 4.5的Visual Studio 2012和带有.NET 4.0的ApplicationPool的本地IIS服务器.在具有相同配置的另一台计算机上,所有工作都很好,并且不会抛出任何异常.
请不要建议使用其他技术,如ViewData [""]和创建单独的模型,我不想更改在其他机器上运行良好的代码.
我认为这是错过配置问题.任何猜测将不胜感激.谢谢
创建WinForm应用程序时,您将Program在Program.cs文件中获得自动生成的类模板.
看起来像这样:
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
Run Code Online (Sandbox Code Playgroud)
我的问题是,为什么这个Program类被声明为static?
如果我删除static声明它仍然可以正常工作.
问题的原因是我认为Program从基类继承可能会很好,它将实现Application.ThreadException和AppDomain.CurrentDomain.UnhandledException的处理,而不是对我的所有项目实现或多或少相同.
对于每个控件都有很多事件,两个非常相似,如Text Update和Text Changed,唔是不同的?
我的计算机在处理项目时关闭,当我再次打开C#并恢复它时,我收到一个错误说
"for filename.cs"没有可用的编辑器
确保安装了文件类型(.cs)的应用程序
而现在我根本无法访问我的代码.
我正在使用Visual C#2010 express.
我尝试直接打开它,它会调出C#,但.cs文件会在记事本中打开.文件大小为30kb,因此不会被删除.并且在上次运行的调试文件夹中仍然有一个工作的.exe.有没有办法恢复代码?
我是xamarin app开发的新手,我有一些问题:
让我解释清楚.
我有一个页面XFView.xaml,XFView.xaml.cs并XFViewModel.cs在PCL(Xamarin.Forms)项目中,XFView.xaml.cs或者 XFViewModel.cs我想调用项目中的MAActivity.cs页面Xamarin.Andriod
我尝试了很多,但得到了任何想法.
我是android的新来者而不是java.我一直在通过XML文件在android中设计UI,在那个页面我有3个线性布局,在我的顶部布局(第一个LinearLayout)我保留了一些图像,在最后的布局中我保留了一些按钮,现在我需要放置一个在我的中心布局中使用canvas的圆圈(红色),我已经编写了一个单独的类,它扩展了View在onDraw(Canvas画布)中的位置,我画了一个圆圈.
package com.project.TargetTrackr3;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.view.View;
public class DrawCanvasCircle extends View{
public DrawCanvasCircle(Context mContext) {
super(mContext);
}
public void onDraw(Canvas canvas) {
Paint paint = new Paint();
paint.setStyle(Paint.Style.FILL);
canvas.drawColor(Color.WHITE);
paint.setColor(Color.BLUE);
canvas.drawCircle(20, 20, 15, paint);
}
}
现在我必须将这个画布带到第二个布局,我的main.xml如下所示
package com.project.TargetTrackr3;
import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
public class TargetTrackr3Activity extends Activity {
/** Called when the activity is first created. */
protected LinearLayout ll; … 可以说我有两节课:
public abstract class Foo
{
static Foo()
{
print("4");
}
}
public class Bar : Foo
{
static Bar()
{
print("2");
}
static void DoSomething()
{
/*...*/
}
}
Run Code Online (Sandbox Code Playgroud)
我希望在调用之后Bar.DoSomething()(假设这是我第一次访问Bar类),事件的顺序将是:
42DoSomething在底线,我希望42打印出来.
经过测试,似乎只是2在打印.
这甚至都不是答案.
你能解释一下这种行为吗?
c# ×8
.net ×1
android ×1
asp.net-mvc ×1
editor ×1
git ×1
macos ×1
node.js ×1
path ×1
profile ×1
razor ×1
sql-server ×1
static ×1
textchanged ×1
transactions ×1
winforms ×1
xamarin.ios ×1
xaml ×1