为了部署到Heroku,我使用git push heroku master.但是,如何查看我推送到heroku的版本?(如果我把最新的版本推上去,我经常会有疑问)
对于那些不熟悉它的人,Heroku的创建脚本会生成一个可以推送的远程git存储库.推送后,代码将神奇地部署.
Heroku在表单中为本地添加了一个远程存储库:
$ git remote add heroku git@heroku.com:appname.git
Run Code Online (Sandbox Code Playgroud)
Heroku手册"使用Git进行部署"中的详细信息
问题是:如何在Heroku存储库中查看最新版本?
在C#中,超类的静态成员被"继承"到子类范围中.例如:
class A { public static int M() { return 1; } }
class B : A {}
class C : A { public new static int M() { return 2; } }
[...]
A.M(); //returns 1
B.M(); //returns 1 - this is equivalent to A.M()
C.M(); //returns 2 - this is not equivalent to A.M()
Run Code Online (Sandbox Code Playgroud)
现在,你不能继承静态类,我唯一可以想象静态继承可能重要的地方完全忽略它:尽管你可以创建一个通用约束,它需要一个类型参数T作为子类A,你仍然无法调用T.M()(这可能简化了VM的事情,更不用说M在子类中编写不同的实现并使用它.
因此,静态成员的"继承"仅仅看起来像命名空间污染; 即使你明确限定名称(即B.M)A的版本仍然解决.
编辑与命名空间的比较:
namespace N1{ class X(); }
namespace N1.N2 …Run Code Online (Sandbox Code Playgroud) 我有一个应用程序需要具有类似的搜索功能,如Apple"地图"应用程序(包括在iPhone,iPod Touch和iPad中).
有问题的功能应该不是一件很难的事情,但我真的对如何在搜索栏中输入街道地址,然后获取该地址的坐标或者可以帮助我实际移动地图的东西毫无头绪在那个地方居中.
我的意思是,我需要查询什么,Apple是否提供"地址搜索API方法"?或者我需要直接使用谷歌地图API?
我很想知道应该怎么做.
我在代码隐藏中生成一个下拉列表,无法自动触发selectedindexchanged事件.它直接放入ASPX页面时工作正常,但我需要它在代码隐藏中.
这不起作用:
var deptList = new DropDownList
{
ID = "deptList",
DataSource = departments,
DataTextField = "deptname",
DataValueField = "deptid",
AutoPostBack = true,
EnableViewState = true
};
deptList.SelectedIndexChanged += new EventHandler(deptList_SelectedIndexChanged);
deptList.DataSource = departments;
deptList.DataTextField = "deptname";
deptList.DataValueField = "deptid";
if (!IsPostBack)
deptList.DataBind();
deptList.Items.Insert(0, new ListItem("---Select Department---", string.Empty));
writer.Write("Select a department: ");
deptList.RenderControl(writer);
Run Code Online (Sandbox Code Playgroud)
但这有效:
<asp:DropDownList ID="deptList" AutoPostBack="true" runat="server" OnSelectedIndexChanged="deptList_SelectedIndexChanged"></asp:DropDownList>
Run Code Online (Sandbox Code Playgroud) 参数字典包含非可空类型'System.Int32'的参数'appId'的空条目,用于'HLIT_TicketingMVC.Controllers.TicketController'中的方法'System.Web.Mvc.ContentResult CheckForInstaller(Int32)'.可选参数必须是引用类型,可空类型,或者声明为可选参数.
function SubmitAjax(url, message, successFunc, errorFunc) {
$.ajax({
type:'POST',
url:url,
data:message,
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success:successFunc,
error:errorFunc
});
};
Run Code Online (Sandbox Code Playgroud)
数据对象构建如下:
var message={"appId":application.val()};
Run Code Online (Sandbox Code Playgroud)
我也尝试了一个jsonified字符串:
var message="{'appId':"+application.val()+"}";
Run Code Online (Sandbox Code Playgroud)
和
var message="{'appId':'"+application.val()+"'}";
Run Code Online (Sandbox Code Playgroud)
我在尝试发布之前验证了消息是否带有正确的int值.鼠标在调试器上最近显示:{appId="6"}
控制器上的方法签名是:
public ContentResult CheckForInstaller(int appId)
Run Code Online (Sandbox Code Playgroud)
当我从方法签名中删除参数时,它确实触及了内部的断点,所以它是需要某种属性的签名,或者我认为消息没有正确构建.
这就是我所拥有的:
(category=="Ljud & Bild")?byId("nav_sub_ljud_bild").style.display='block' : byId("nav_sub_ljud_bild").style.display='none';
(category=="Datorer")?byId("nav_sub_datorer").style.display='block' : byId("nav_sub_datorer").style.display='none';
(category=="Telefoner & Fax")?byId("nav_sub_telefoner").style.display='block' : byId("nav_sub_telefoner").style.display='none';
(category=="Överlåtelser")?byId("nav_sub_overlatelser").style.display='block' : byId("nav_sub_overlatelser").style.display='none';
(category=="Fastigheter & Lokaler")?byId("nav_sub_fastigheter").style.display='block' : byId("nav_sub_fastigheter").style.display='none';
(category=="Inventarier/Inredning")?byId("nav_sub_inventarier").style.display='block' : byId("nav_sub_inventarier").style.display='none';
(category=="Tjänster")?byId("nav_sub_tjanster").style.display='block' : byId("nav_sub_tjanster").style.display='none';
(category=="Resor & Biljetter")?byId("nav_sub_resor").style.display='block' : byId("nav_sub_resor").style.display='none';
(category=="Sport & Träning")?byId("nav_sub_sport").style.display='block' : byId("nav_sub_sport").style.display='none';
(category=="Böcker & Litteratur")?byId("nav_sub_litteratur").style.display='block' : byId("nav_sub_litteratur").style.display='none';
(category=="Djur")?byId("nav_sub_djur").style.display='block' : byId("nav_sub_djur").style.display='none';
(category=="Musik-Instrument")?byId("nav_sub_musik_instrument").style.display='block' : byId("nav_sub_musik_instrument").style.display='none';
(category=="Hobby & Samlarobjekt")?byId("nav_sub_samlarobjekt").style.display='block' : byId("nav_sub_samlarobjekt").style.display='none';
(category=="Smycken & Klockor")?byId("nav_sub_juveler").style.display='block' : byId("nav_sub_juveler").style.display='none';
(category=="Leksaker & Barn-artiklar")?byId("nav_sub_leksaker_barn").style.display='block' : byId("nav_sub_leksaker_barn").style.display='none';
(category=="Vuxen-plagg")?byId("nav_sub_vuxen_plagg").style.display='block' : byId("nav_sub_vuxen_plagg").style.display='none';
Run Code Online (Sandbox Code Playgroud)
你会怎么写这个?以上看起来很"丑陋"!
谢谢
有时我在各种C++程序中看到,声明和使用的对象如下:
object *obj = new object;
obj->action();
obj->moreAction();
//etc...
Run Code Online (Sandbox Code Playgroud)
这样做有什么好处,而不是简单地做:
object obj;
obj.action();
obj.moreAction();
//etc
Run Code Online (Sandbox Code Playgroud) 我的任务是研究一些不属于我的.NET代码.这有点难以弄清楚,因为在不同的领域有很多钩子.换句话说,一切似乎都非常高度耦合.
我希望能够做到以下几点:
很容易看到项目的层次(树)视图及其直接依赖(不仅仅是引用)
能够轻松(直观地)跟踪特定API挂钩从依赖类返回到它的依赖关系.例如:如果ProjectA.ClassA.Method1()在方法中调用了ProjectB.ClassB.Method2(),我希望能够看到它
嘿,也许视觉上不是最好的方式.但这似乎对我来说总是更好.我当然会接受任何和所有的建议.
.net asp.net dependencies projects-and-solutions visual-studio-2008
我正在使用MVVM设计模式构建应用程序,我想使用ApplicationCommands类中定义的RoutedUICommands.由于View的CommandBindings属性(读取UserControl)不是DependencyProperty,因此我们无法将ViewModel中定义的CommandBindings直接绑定到View.我通过定义一个抽象的View类来解决这个问题,该类基于ViewModel接口以编程方式绑定它,该接口确保每个ViewModel都有一个ObBableCollection的CommandBindings.这一切都很好,但是,在某些情况下我想执行在不同类(View和ViewModel)相同命令中定义的逻辑.例如,保存文档时.
在ViewModel中,代码将文档保存到磁盘:
private void InitializeCommands()
{
CommandBindings = new CommandBindingCollection();
ExecutedRoutedEventHandler executeSave = (sender, e) =>
{
document.Save(path);
IsModified = false;
};
CanExecuteRoutedEventHandler canSave = (sender, e) =>
{
e.CanExecute = IsModified;
};
CommandBinding save = new CommandBinding(ApplicationCommands.Save, executeSave, canSave);
CommandBindings.Add(save);
}
Run Code Online (Sandbox Code Playgroud)
乍一看,前面的代码就是我想要做的,但是文档绑定到的View中的TextBox只在它失去焦点时才更新它的Source.但是,我可以通过按Ctrl + S保存文档而不会失去焦点.这意味着文档在源中更新的更改之前保存,实际上忽略了更改.但是,由于出于性能原因将UpdateSourceTrigger更改为PropertyChanged不是一个可行的选项,因此在保存之前必须强制更新其他内容.所以我想,让我们使用PreviewExecuted事件强制更新PreviewExecuted事件,如下所示:
//Find the Save command and extend behavior if it is present
foreach (CommandBinding cb in CommandBindings)
{
if (cb.Command.Equals(ApplicationCommands.Save))
{
cb.PreviewExecuted += (sender, e) =>
{
if (IsModified)
{
BindingExpression be = rtb.GetBindingExpression(TextBox.TextProperty);
be.UpdateSource();
} …Run Code Online (Sandbox Code Playgroud) 我有一个shell脚本循环遍历包含URL的文本文件:我想访问并截取屏幕截图.
这一切都做得很简单.该脚本初始化一个类,该类在运行时创建列表中每个站点的屏幕截图.有些站点需要非常长的时间来加载,有些站点可能根本没有加载.所以我想将screengrabber-function包装在一个超时脚本中,False如果它在10秒内无法完成,则使函数返回.
我满足于最简单的解决方案,也许设置一个异步计时器,无论在函数内部实际发生什么,它将在10秒后返回False?
asp.net ×2
c# ×2
.net ×1
allocation ×1
asp.net-mvc ×1
c++ ×1
cocoa-touch ×1
code-behind ×1
dependencies ×1
git ×1
git-remote ×1
heroku ×1
html ×1
inheritance ×1
ios ×1
iphone ×1
javascript ×1
jquery ×1
mkmapview ×1
php ×1
pointers ×1
python ×1
static ×1
wpf ×1