我有一个绘制和旋转立方体的类.每次我旋转立方体时,我都会使用多维数据集的新值重新加载缓冲区.
public void LoadBuffer(GraphicsDevice graphicsDevice)
{
buffer = new VertexBuffer(graphicsDevice, VertexPositionNormalTexture.VertexDeclaration, triangles * 3, BufferUsage.None);
buffer.SetData<VertexPositionNormalTexture>(verts);
graphicsDevice.SetVertexBuffer(buffer);
}
public void Draw(GraphicsDevice graphicsDevice)
{
graphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, triangles);
}
Run Code Online (Sandbox Code Playgroud)
然后在Game.Draw中调用Cube.Draw方法
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(ClearOptions.DepthBuffer | ClearOptions.Target, Color.White, 1f, 0);
basicEffect.Parameters["WorldViewProj"].SetValue(world * view * projection);
EffectPass pass = basicEffect.CurrentTechnique.Passes[0];
if (pass != null)
{
pass.Apply();
cube1.LoadBuffer(GraphicsDevice);
cube1.Draw(GraphicsDevice);
cube2.LoadBuffer(GraphicsDevice);
cube2.Draw(GraphicsDevice);
cube3.LoadBuffer(GraphicsDevice);
cube3.Draw(GraphicsDevice);
}
base.Draw(gameTime);
}
Run Code Online (Sandbox Code Playgroud)
几分钟左右后,我得到一个OutOfMemory Exception就行了:
buffer.SetData<VertexPositionNormalTexture>(verts);
Run Code Online (Sandbox Code Playgroud)
有人可以解释为什么会发生这种情况以及我能做些什么来解决它.
下面是一个错误,由我的Rails应用程序中的表单引起:
Processing UsersController#update (for **ip** at 2010-07-29 10:52:27) [PUT]
Parameters: {"commit"=>"Update", "action"=>"update", "_method"=>"put", "authenticity_token"=>"ysiDvO5s7qhJQrnlSR2+f8jF1gxdB7T9I2ydxpRlSSk=", **more parameters**}
ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken):
Run Code Online (Sandbox Code Playgroud)
对于每个非get请求都会发生这种情况,正如您所看到的那样authenticity_token.
我的代码在IE中工作但在Safari,Firefox和Opera中断.(大惊喜)
document.getElementById("DropList").options.length=0;
Run Code Online (Sandbox Code Playgroud)
搜索之后,我了解到length=0它不喜欢它.
我试着...options=null和var clear=0; ...length=clear具有相同的结果.
我一次对多个对象这样做,所以我正在寻找一些轻量级的JS代码.
我在模板new.html.erb中有一个form_for,我正常保存到数据库,然后成功发送电子邮件.我希望邮件程序发送相同的new.html.erb作为正文并传递模型,以便完全填充表单.我收到以下错误:
undefined method `protect_against_forgery?' for #<#<Class:0x000000049d7110>:0x000000049d4690>
Run Code Online (Sandbox Code Playgroud)
在form_for标记之后的行上(因为它注入了我认为的auth令牌标记).有没有办法可以规避这一点,以便我可以在邮件中重复使用该模板?
这是邮件代码的样子
class MaintenanceMailer < ActionMailer::Base
helper :application
def request_email(maintenance)
mail :to => maintenance.community.email, :subject => "Maintenance" do |format|
format.html { render :layout => 'default', :template => 'maintenance/new' }
end
end
end
Run Code Online (Sandbox Code Playgroud) 我正在尝试用Java在HTML中用一些标记来包围一个单词.调用replaceAll时,此代码抛出ArrayIndexOutOfBoundsException.
Pattern pattern = Pattern.compile(wordToHighlight + "\\w{0,5}");
String replacement = "<span class='highlight'>$1</span>";
Matcher matcher = pattern.matcher(html);
if (matcher != null)
if (matcher.find())
retVal = matcher.replaceAll(replacement);
Run Code Online (Sandbox Code Playgroud) 从任意修订版中提取blob(文件)很容易git show,例如:
git show master:src/hello-world.c > /tmp/hello.c
Run Code Online (Sandbox Code Playgroud)
但是,我想知道在git中是否有类似的方法来提取树(目录)以及递归下的所有内容?
我已经编写了一个小脚本来执行此操作,因此我将其添加为可能的答案.看来这可能是git内置的那种东西,但我只是不知道如何找到它...
我想存储这样的字符串
"1,5,6,7,9,45,20,45,78,81 ......"
我应该使用什么数据类型来保存这些字符串的列?
我可以找到进程运行GetCurrentDirectory()的目录,但是找到executabke所在的目录呢?
java ×2
.net ×1
3d ×1
actionmailer ×1
actionview ×1
c++ ×1
form-helpers ×1
git ×1
html-select ×1
javascript ×1
mysql ×1
owl ×1
regex ×1
semantic-web ×1
task-queue ×1
winapi ×1
xna ×1