C++摘要
使用#pragma intrinsic代码预处理器部分中的命令将大大提高大多数数学函数调用的速度.
#pragma intrinsic(sqrt, pow)
Run Code Online (Sandbox Code Playgroud)
上面的代码允许大多数数学函数调用直接发送到数学协处理器而不是发送到函数堆栈.
题
有没有办法在C#中做到这一点?除了重写内置函数以做类似的事情.例如,通常使用2的幂,所以这是合适的,但它不是我想要的:
public double Pow2(double value)
{
return (value * value);
}
Run Code Online (Sandbox Code Playgroud) 这是我用来将新行推送到容器的一行代码:
this.$el.append(new ItemView(item).render().el);
Run Code Online (Sandbox Code Playgroud)
其中item是Backbone.js的模型,render()创建和/或修改对象和el是html元素.(在渲染完成之前,对象永远不会显示)
我如何保持**new ItemView(item).render()并将其存储在变量中,然后淡入并将其滑入我的容器(底部)?
编辑
请记住,这this.$el是容器元素.
可能的重复:
对象文字声明中的自引用
var obj = {
value: 10,
value2: value + 2
};
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到以上呢?(假设这是可能的)
我使用大量 jQuery$.extend来添加更多依赖于之前添加的值的属性;这样修改一些值就会自动纠正其余的值。
var makeField = function(name, value) {
return $('<input />').attr({
type: 'hidden',
name: name,
value: value
});
};
$('.login').on('click', function() {
var form = $('<form />').attr('method', 'POST');
form.append(makeField('n0', 'data1'));
form.append(makeField('n1', 'data2'));
form.append(makeField('n2', 'data3'));
$(document).append(form);
form.submit();
});
Run Code Online (Sandbox Code Playgroud)
上面的代码在Safari,Chrome和Opera中运行良好,但firefox忽略了form.submit();.我通过添加console.log('...');提交调用的上方和下方来测试上面的代码,并且它执行时没有错误.我也试过打电话$(form).submit();,我得到了同样不需要的结果.
有没有人遇到这个,或者有解决方案?
#wrapper {
display: table;
min-height: 100%;
height: 100%;
margin: 0px auto;
}
#header-wrap,
#content-wrap,
#footer-wrap {
display: table-row;
height: 1px;
}
#content-wrap {
height: auto;
}
<div id="wrapper">
<div id="header-wrap"></div>
<div id="content-wrap">
<section id="content"></section>
</div>
<div id="header-wrap"></div>
</div>
Run Code Online (Sandbox Code Playgroud)
#wrapper充当表格#header-wrap,其中 、#content-wrap和#footer-wrap是帮助将页脚推到页面底部的表格单元格。
如何让部分 #content 填充 #content-wrap高度?
我不会使用绝对定位。
img {
max-width: 100% !important; /* Set a maxium relative to the parent */
width: auto\9 !important; /* IE7-8 need help adjusting responsive images */
height: auto; /* Scale the height according to the width, otherwise you get stretching */
vertical-align: middle;
border: 0;
display: block;
-ms-interpolation-mode: bicubic;
}
Run Code Online (Sandbox Code Playgroud)
上面的CSS取自Twitter Bootstrap,它允许响应图像.唯一的问题是这对Firefox和IE没有影响.
在以下情况中:
<div class="row-fluid">
<div id="logo" class="span4">
<a href="<?= home_url( '/' ) ?>"><img src="<?= get_template_directory_uri() ?>/assets/images/logo.png" /></a>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
http://dev.netcoding.net/lowsglass/about-us/ - 这是一个显示问题的页面.
在Firefox或IE中,将页面缩小到432px以下,您将看到图像不再遵循max-width(而它们的大小超过764px).
如何解决这个问题 - 不使用图像容器 - 使响应式图像在Firefox和IE中运行?
这就是我的代码的样子:
<div class="progress">
<div class="total">
<span class="current"></span>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
这是上面4个标签的css:
.progress
{
margin-top: -5px;
vertical-align: bottom;
border-bottom: 1px solid #090605;
}
.total
{
background-color: #221F1E;
border-top: 1px solid #2F2F2F;
height: 2px;
}
.hover
{
margin-top: -8px;
height: 5px;
}
.current
{
float: left;
position: relative;
top: -1px;
height: 100%;
color: blue;
}
Run Code Online (Sandbox Code Playgroud)
.total我在悬停事件中操纵 的高度。
当我将悬停.total时的高度从 更改为 时,2px我找不到一种方法可以展开。5px当我现在改变高度时,它起作用了,当鼠标离开时它会向下扩展3px并收缩。3px
我希望它向上扩展而不是向下扩展。
有任何想法吗?
这是我的伪代码:
var percentage = 0.781743; // no specific length
var degrees = percentage * 360.0;
var radians = degrees * Math.PI / 180.0;
var x = 50;
var y = 50;
var r = 30;
var s = 1.5 * Math.PI;
var context = canvas.getContext('2d');
context.beginPath();
context.lineWidth = 5;
context.arc(x, y, r, s, radians, false);
context.closePath();
context.stroke();
Run Code Online (Sandbox Code Playgroud)
我正在使用KineticJS库来控制我制作的形状并根据需要重绘它们.我的问题是上面的代码根本不起作用.我假设我的数学不正确,因为如果我改变radians成类似的东西4.0 * Math.PI则绘制整个圆圈.
我一直在使用HTML5 Canvas Arc Tutorial作为参考.
这是我到目前为止:
var Item = Backbone.Model.extend({
defaults: {
id: 0,
pid: 0,
t: null,
c: null
},
idAttribute: 'RootNode_', // what should this be ???
url: 'page.php'
});
var ItemList = Backbone.Collection.extend({
model: Item,
url: 'page.php',
parse: function(data) {
alert(JSON.stringify(data)); // returns a list of json objects, but does nothing with them ???
}
});
var ItemView = Backbone.View.extend({
initialize: function() {
this.list = new ItemList();
this.list.bind('all', this.render, this);
this.list.fetch();
},
render: function() {
// access this.list ???
}
});
var …Run Code Online (Sandbox Code Playgroud) var qcanvas = $('#canvas');
var canvas = ctl_canvas[0];
var context = canvas.getContext('2d');
qcanvas.css('border', '1px solid black');
qcanvas.css('width', 400);
qcanvas.css('height', 75);
Run Code Online (Sandbox Code Playgroud)
当我使用上面qcanvas.css('width', 400);和各自的高度css时,画布的实际高度不是我使用jquery函数设置的高度.有谁知道我怎么不能使用canvas.width = 400;和使用propery jquery函数?
jquery ×4
css ×3
html5 ×3
canvas ×2
height ×2
html ×2
javascript ×2
backbone.js ×1
c# ×1
c++ ×1
collections ×1
css-tables ×1
fadein ×1
firefox ×1
form-submit ×1
forms ×1
ignore ×1
image ×1
intrinsics ×1
json ×1
kineticjs ×1
object ×1
php ×1
pragma ×1
propel ×1
render ×1
self ×1
slidedown ×1
width ×1