我正在使用visual studio 2010(MVC3 Razor)和Windows 7进行Web项目.
我的默认浏览器是IE.当我运行该项目时,网站的工作与网址完全一致
当我复制相同的网址并尝试在Chrome或Firefox中运行网站时,它会显示以下错误.
错误
The requested URL could not be retrieved
The following error was encountered while trying to retrieve the URL: http://localhost:49824/
Connection to 127.0.0.1 failed.
The system returned: (111) Connection refused
The remote host or network may be down. Please try the request again.
Your cache administrator is webmaster.
Run Code Online (Sandbox Code Playgroud)
我重建了解决方案并将网址添加到允许的网站.但问题仍然存在.我该如何解决这个问题?
我在我的程序中收到此消息,但我不知道如何修复它我在网上搜索但没有找到任何可以帮助我的东西.
private double Price;
private int Count;
private double Vat;
private const double foodVATRate = 0.12, otherVATRate = 0.25;
private decimal Finalprice;
private decimal Rate;
public void Readinput()
{
Finalprice = (decimal)(Price * Count);
}
private void cal()
{
char answer = char.Parse(Console.ReadLine());
if ((answer == 'y') || (answer == 'Y'))
Vat = foodVATRate;
else
Vat = otherVATRate;
Rate = Vat * Finalprice;
Run Code Online (Sandbox Code Playgroud)
运算符'*'不能应用于'double'类型的操作数,'decimal'就是Rate = Vat*Finalprice; 我不知道我能解决它
下面是我用来显示div点击时的javascript代码button.
再次点击时如何隐藏它?然后单击它,div应该再次可见?
<script type="text/javascript">
var _hidediv = null;
function showdiv(id) {
if(_hidediv)
_hidediv();
var div = document.getElementById(id);
div.style.display = 'block';
_hidediv = function () { div.style.display = 'none'; };
}
</script>
Run Code Online (Sandbox Code Playgroud) 这应该很简单,但我刚开始使用matplotlib和python.我可以做一个直线或散点图,但我不知道如何做一个简单的步骤函数.任何帮助深表感谢.
x = 1,2,3,4
y = 0.002871972681775004, 0.00514787917410944, 0.00863476098280219, 0.012003316194034325
Run Code Online (Sandbox Code Playgroud) 任何人都可以解释如何在WinRT应用程序中检测简单的触摸手势?我尝试使用GestureRecognizer该类,但它不起作用:
public MainPage()
{
this.InitializeComponent();
Windows.UI.Input.GestureRecognizer gr = new Windows.UI.Input.GestureRecognizer();
gr.CrossSliding += gr_CrossSliding;
gr.Dragging += gr_Dragging;
gr.Holding += gr_Holding;
gr.ManipulationCompleted += gr_ManipulationCompleted;
gr.ManipulationInertiaStarting += gr_ManipulationInertiaStarting;
gr.ManipulationStarted += gr_ManipulationStarted;
gr.ManipulationUpdated += gr_ManipulationUpdated;
gr.RightTapped += gr_RightTapped;
gr.Tapped += gr_Tapped;
gr.GestureSettings = Windows.UI.Input.GestureSettings.ManipulationRotate | Windows.UI.Input.GestureSettings.ManipulationTranslateX | Windows.UI.Input.GestureSettings.ManipulationTranslateY |
Windows.UI.Input.GestureSettings.ManipulationScale | Windows.UI.Input.GestureSettings.ManipulationRotateInertia | Windows.UI.Input.GestureSettings.ManipulationScaleInertia |
Windows.UI.Input.GestureSettings.ManipulationTranslateInertia | Windows.UI.Input.GestureSettings.Tap;
}
void gr_Tapped(Windows.UI.Input.GestureRecognizer sender, Windows.UI.Input.TappedEventArgs args)
{
Debug.WriteLine("gr_Tapped");
}
void gr_RightTapped(Windows.UI.Input.GestureRecognizer sender, Windows.UI.Input.RightTappedEventArgs args)
{
Debug.WriteLine("gr_RightTapped");
}
void gr_Holding(Windows.UI.Input.GestureRecognizer sender, Windows.UI.Input.HoldingEventArgs args)
{
Debug.WriteLine("gr_Holding"); …Run Code Online (Sandbox Code Playgroud) 所以我一直在寻找为我的组合框设置一个默认值.我发现了一些东西但它们似乎都没有用.
实际上,如果我创建一个简单的组合框并使用它,comboBox1.SelectedIndex = comboBox1.Items.IndexOf("something")但是一旦我动态生成组合框的内容,它就无法工作了.
这是我填充我的组合框(位于类的构造函数中);
string command = "SELECT category_id, name FROM CATEGORY ORDER BY name";
List<string[]> list = database.Select(command, false);
cbxCategory.Items.Clear();
foreach (string[] result in list)
{
cbxCategory.Items.Add(new ComboBoxItem(result[1], result[0]));
}
Run Code Online (Sandbox Code Playgroud)
我似乎无法让它设置默认值,就像我放在cbxCategory.SelectedIndex = cbxCategory.Items.IndexOf("New")上面的代码下面,它将无法正常工作.
顺便说一句,WinForms.
先感谢您.
我有一个在创建对象后调用的方法
after_create :send_welcome_email
Run Code Online (Sandbox Code Playgroud)
有没有办法将此限制为条件,例如对象属性的值
after_create :send_welcome_email unless self.role == "Celebrant"
Run Code Online (Sandbox Code Playgroud)
例如?
我有一个应用程序,我需要打印一张票.每张票必须是唯一的.该应用程序是Windows窗体,完全用c#编写.对于我们的应用,我们使用的是三星ML-2525激光单色打印机.
流程基本上如下,操作员选择产品/票据(这是唯一的),然后按下一个按钮,执行以下两项操作:
出于某种原因,每隔一段时间,需要打印的图像不会被发送到打印机.这是一种罕见的情况,但它确实发生了.
我尝试使用Win32_Printer(http://msdn.microsoft.com/en-us/library/Aa394363)连接到打印机,但我无法获得当前打印机的状态(在线,离线,低碳粉,卡纸等).我只能检查打印机是否存在以及纸张尺寸是否正确安装.我尝试了类似以下的代码,但它没有用
private string MonitorPrintJobWmi()
{
var jobMessage = String.Empty;
var scope = new ManagementScope(ManagementPath.DefaultPath);
scope.Connect();
var selectQuery = new SelectQuery { QueryString = @"select * from Win32_PrintJob" };
var objSearcher = new ManagementObjectSearcher(scope, selectQuery);
var objCollection = objSearcher.Get();
foreach (var job in objCollection)
{
if (job != null)
{
jobMessage += String.Format("{0} \r\n", job["Name"].ToString());
jobMessage += String.Format("{0} \r\n", job["JobId"].ToString());
_jobId = Convert.ToInt32(job["JobId"]);
jobMessage += String.Format("{0} \r\n", job["JobStatus"].ToString());
jobMessage += String.Format("{0} \r\n", job["Status"].ToString()); …Run Code Online (Sandbox Code Playgroud) 我有一个从python生成的网页,它可以正常工作,使用:
print 'Content-type: text/html\n\n'
print "" # blank line, end of headers
print '<link href="default.css" rel="stylesheet" type="text/css" />'
print "<html><head>"
Run Code Online (Sandbox Code Playgroud)
我想在此网页上添加图片,但是当我这样做时:
sys.stdout.write( "Content-type: image/png\n\n" + file("11.png","rb").read() )
print 'Content-type: text/html\n\n'
print "" # blank line, end of headers
print '<link href="default.css" rel="stylesheet" type="text/css" />'
...
Run Code Online (Sandbox Code Playgroud)
我得到的只是图像,如果我将图像代码放在我的html /文本标题下面,我得到的只是图像中的文字,即:
<Ï#·öÐδÝZºm]¾|‰k×®]žòåËÛ¶ÃgžyFK–,ÑôéÓU½zuIÒ}÷ݧ&MšH’V¯^?üð¼1±±±zýõ×%IñññÚºu«*W®¬wß}W.—K3gÎÔÌ™ÿw‹Ú””I’¹w¤¥hdÒd½q÷X•Šˆ²m¿þfïÞ½*]º´éÈs;¥¤¤Ø¿ILLÔˆ#rÊ
Run Code Online (Sandbox Code Playgroud)
另外,如果我尝试:
print "<img src='11.png'>"
Run Code Online (Sandbox Code Playgroud)
我在浏览器中看到一个损坏的图像,直接浏览图像会产生500内部服务器错误,我的apache日志说:
8)Exec format error: exec of './../../11.png' failed Premature end of script headers: 11.png
Run Code Online (Sandbox Code Playgroud) 我有几个方法看起来像这样:
public void foo()
{
try
{
doSomething();
}
catch(Exception e)
{
Log.Error(e);
}
}
Run Code Online (Sandbox Code Playgroud)
我可以更改代码吗?
[LogException()]
public void foo()
{
doSomething();
}
Run Code Online (Sandbox Code Playgroud)
如何实现此自定义属性?这样做的利弊是什么?
-----编辑1 ------------
我可以自己实现它,我的意思是只写一个类,还是我需要使用postharp或其他解决方案?
c# ×5
html ×2
python ×2
winforms ×2
after-create ×1
attributes ×1
cgi ×1
combobox ×1
css ×1
http-headers ×1
javascript ×1
localhost ×1
matplotlib ×1
plot ×1
populate ×1
printing ×1
razor ×1
show-hide ×1
try-catch ×1
vb.net ×1
windows-8 ×1
xaml ×1