作为编写编译器的先驱,我正在尝试理解Windows(32位)可移植可执行格式.特别是我想看一个简单的可执行文件的例子,除了正确加载,运行和退出之外什么都不做.
我已经尝试编写和编译一个简单的C main函数,除了生成的.exe是〜22KB并且包含许多来自KERNEL32.DLL的导入(可能由LIBC用于设置环境,堆等).甚至DOS标题也可能更小(它当前打印默认的'此程序无法在DOS模式下运行').
最小的Windows 32位可执行文件的结构是什么?
我想有一个JUnit(或其他)系统,可以在模拟环境中测试企业bean,以便在本地注入所有资源/ bean等.企业bean不应该完成这个.应支持各种注射.
你知道这样的maven插件或测试框架吗?有经验吗?
我在我的Django应用程序中使用以下代码:
pictures = gallery.picture_set.annotate( score=models.Sum( 'picturevote__value' ) ).order_by( '-score' )
Run Code Online (Sandbox Code Playgroud)
有一张画廊的桌子.在他们每个人都是一些图片.当用户向上或向下投票时,插入"picturevote"中的新行并连接到图片.然后我可以得到图片的总分.现在我想按照他们的分数来订购一个画廊的图片.但是由于表连接,当没有投票时,得分值可以为NULL.然而,分数'NULL'应被视为'0'.
有任何想法吗?
编辑:好的,这里有一些额外的解释:问题是上面例子中的聚合设置score为NULL.当我想显示分数时,我会使用以下内容:
score = self.picturevote_set.aggregate( models.Sum( 'value' ) )[ 'value__sum' ] or 0
Run Code Online (Sandbox Code Playgroud)
然后聚合导致NULL(如果没有picturevote行)或某个值.如果为NULL,则or-expression将其转换为可显示的整数值.但这只解决了由NULL值引起的显示问题.当我想按照score第一个代码示例中的值对图片进行排序时,所有带NULL的条目都放在有序结果集的末尾.首先是有正分数的图片,然后有负值的图片,那么到目前为止没有投票或者没有投票的图片,因为它们是NULL score.
我的问题是如何改变这种行为,以便订单是正确的.
Marc Gravell建议我向本网站发布新的语言功能建议以收集关于它们的一般意见.
我们的想法是收集它们是否有用,或者可能已经有另一种方式来实现我所追求的目标.
因此编写VB.Net中的正常变量声明:
Dim SomeVariable as SomeType
Run Code Online (Sandbox Code Playgroud)
我建议允许以下表格
Dim SomeVariable1 as {SomeType, ISomeInterface}
Dim SomeVariable2 as {SomeType, ISomeInterface, ISomeOtherInterface}
Run Code Online (Sandbox Code Playgroud)
这种语法借鉴了Vb.Net的约束泛型的风格
我最初想到的具体情况是定义一个特定的控件子集.我希望为一系列Control工厂创建一个接口,它将根据一些业务规则提供控制.
这些控件的使用者需要通过接口创建所有控件,还应该实现一系列接口(在我的情况下只有一个),这些接口为所有这些控件提供了普通控件中通常不具备的附加功能.
值得注意的是,以下目前不起作用.
Public Interface ISpecialControl
End Interface
Public Interface IControlProvider
Function CreateControl(Of T As {Control, ISpecialControl})() As T
End Interface
Public Class SpecialTextBoxProvider
Implements IControlProvider
Public Function CreateControl(Of T As {Control, ISpecialControl})() As T Implements IControlProvider.CreateControl
Return New SpecialTextBox
End Function
End Class
Public Class SpecialTextBox
Inherits TextBox
Implements ISpecialControl
Public Sub New()
End Sub …Run Code Online (Sandbox Code Playgroud) 假设您有以下java bean:
public class MyBean
{
private List<String> names = new ArrayList<String>();
public void addName(String name)
{
names.add(name);
fireNamesPropertyChange(name);
}
}
Run Code Online (Sandbox Code Playgroud)
您通常如何为集合实现属性更改事件?您是否尝试使用索引属性,这对于数组而言似乎比集合更多?
我有一个像这样的缓存jquery对象设置
var comments = $('li.comment');
Run Code Online (Sandbox Code Playgroud)
在创建新元素时,是否有一种简单的方法来更新注释对象而不是重新定义它?我正在寻找类似的东西
comments += $('li.newcomment');
Run Code Online (Sandbox Code Playgroud)
这可能吗?
我有以下非常简单的代码
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:PlaceHolder ID="PlaceHolder1" runat="server">
</asp:PlaceHolder>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
</ContentTemplate>
</asp:UpdatePanel>
Run Code Online (Sandbox Code Playgroud)
而代码隐藏
protected void Button1_Click(object sender, EventArgs e)
{
Literal literal = new Literal();
literal.Text = DateTime.Now.ToString();
literal.ID = DateTime.Now.Ticks.ToString();
// These both work fine the first time the button is clicked
// but the second time nothing is added.
UpdatePanel1.ContentTemplateContainer.Controls.Add(literal);
PlaceHolder1.Controls.Add(literal);
}
Run Code Online (Sandbox Code Playgroud)
我的问题在于Literal控件只添加一次.我已经搜索了谷歌和博客网站(加上书籍),但没有任何运气.我错过了什么?
内部与外部CSS的优缺点是什么,考虑速度,请求,缓存等等.就个人而言,我不确定动态页面上的内部css是否会缓存..?
我想在我的C++应用程序中禁用异常,在MSVC下编译.我已经将选项启用C++异常切换为NO,但是我收到警告告诉我使用选项/ Ehsc,我不想这样做.
我的代码中没有try/catch块,但是我使用STL.我发现使用宏定义_HAS_EXCEPTIONS = 0应该禁用STL中的异常,但我仍然收到警告:
warning C4275: non dll-interface class 'stdext::exception' used as base for dll-interface class 'std::bad_typeid'
see declaration of 'stdext::exception'
see declaration of 'std::bad_typeid'
有没有办法如何关闭例外是STL?
注意:在我的代码中,我也想关掉RTTI选项.无论RTTI是打开还是关闭,我都会收到相同的警告.
在为使用AJAX的应用程序设计和构建UI时,您何时考虑优雅降级(对于禁用JavaScript或使用屏幕阅读器的用户)?
ajax ×2
java ×2
asp.net ×1
c# ×1
c++ ×1
constraints ×1
css ×1
database ×1
django ×1
ejb-3.0 ×1
executable ×1
java-ee ×1
javabeans ×1
jquery ×1
maven-plugin ×1
mocking ×1
model ×1
portability ×1
stl ×1
types ×1
updatepanel ×1
vb.net ×1
visual-c++ ×1
winapi ×1
windows ×1