我想将视图分为四个部分.顶部的标题,使用整页宽度和固定高度.剩下的页面被分成两个相同高度的块,它们的上面包含两个相同大小的块,彼此相邻.
我尝试的是(没有标题):
#wrap {
width: 100%;
height: 100%;
}
#block12 {
width: 100%;
max-height: 49%;
}
#block1,
#block2 {
width: 50%;
height: 100%;
float: left;
overflow-y: scroll;
}
#block3 {
width: 100%;
height: 49%;
overflow: auto;
/*background: blue;*/
}
.clear {
clear: both;
}
Run Code Online (Sandbox Code Playgroud)
而CSS:
<div id="wrap">
<div id="block12">
<div id="block1"></div>
<div id="block2"></div>
<div class="clear"></div>
</div>
<div id="block3"></div>
</div>
Run Code Online (Sandbox Code Playgroud)
显然,使用高度的百分比值将无法正常工作.为什么会这样?
在 Docker 容器中安装 apache Web 服务器后,我想显示一个示例页面以确保其正常工作。但是我总是得到 404 Not found。
这是泊坞窗文件
FROM ubuntu:14.04
MAINTAINER <mail@example.org>
RUN DEBIAN_FRONTEND=noninteractive
# Install required packages
RUN apt-get -y update
RUN apt-get install -y apache2 libapache2-mod-php5 php5-gd php5-json php5-mysql php5-curl php5-intl php5-imagick bzip2 wget
# Enable the php mod
RUN a2enmod php5
# Configuration for Apache
ADD ./apache.conf /etc/apache2/sites-available/
RUN ln -s /etc/apache2/sites-available/apache.conf /etc/apache2/sites-enabled/
RUN a2enmod rewrite
RUN mkdir /var/www/test && echo "<html><body><h1>Yo</h1></body></html>" >> /var/www/test/index.html
EXPOSE :80
CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
Run Code Online (Sandbox Code Playgroud)
阿帕奇配置文件
<VirtualHost *:80>
ServerAdmin webmaster@localhost …Run Code Online (Sandbox Code Playgroud) colResizable似乎是一个可调节列宽的好插件.
不幸的是,它删除了最初设置的宽度.我正在使用,whitespace: nowrap因为我有一些小柱子和一些较大的柱子.现在使用colResizable插件,所有列都会调整为相同的大小.
我尝试通过在插件占用之前读取col宽度来解决,然后重置它们.起初它看起来不错,但随后发生了一些奇怪的事情.夹具当然留在他们使用相同尺寸的柱子的地方.
var columnWidths = new Array();
// store original col widths in array
$.each($("th", table), function () {
columnWidths.push($(this).width());
});
// Make cols resizable
$(function () {
table.colResizable({
liveDrag: true,
gripInnerHtml: "<div class='grip'></div>",
draggingClass: "dragging"
});
});
// reset columns to original width
for (var i = 0; i < columnWidths.length; i++) {
$('th:nth-child(' + (i + 1) + ')', table).css({ width: columnWidths[i] + "px" });
}
Run Code Online (Sandbox Code Playgroud)
谁能想到更好的解决方案?
是否有方法或方法从流中获取每个下一个元素?
例如,如果有一个流看起来像
def natural: Stream[Long] = {
def naturalHelper: Long => Stream[Long] = {
n => n #:: naturalHelper(n+1)
}
naturalHelper(1)
}
val s = natural
Run Code Online (Sandbox Code Playgroud)
我正在寻找类似的东西s.next(),在第一次调用时返回2,在下次调用时返回s.next()= 3,依此类推......不使用var.
在Entity Framework中,我想使用两个外键作为另一个实体类型的主键.
public class CustomerExtensionValue {
// Values for extended attributes of a customer
[Key]
[Column(Order = 0)]
public Customer Customer { get; set; }
[Key]
[Column(Order = 1)]
public CustomerExtension Extension { get; set; }
[Required]
public string Value { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
但是,这给了我一个错误,即密钥丢失. \tSystem.Data.Entity.Edm.EdmEntityType: : EntityType 'CustomerExtensionValue' has no key defined. Define the key for this EntityType.
我知道我可以定义两个包含引用实体类型主键的属性.Visual Studio是否不够智能,无法自己使用主键?
在控制器类中,我有很多方法可以输出格式正确的JSON数据。它们全都执行数据库查询。例如
// GET api/User
public IEnumerable<Object> GetUsers()
{
var query = from user in db.Users
orderby user.Name
select new { Name = user.Name};
return query.AsEnumerable<Object>();
}
Run Code Online (Sandbox Code Playgroud)
现在,我想返回我的一个类的属性。
public IEnumerable<Object> GetProperties()
{
return typeof(MyClass)
.GetProperties(BindingFlags.Public | BindingFlags.Instance)
.Select(p => p.Name).ToList();
}
Run Code Online (Sandbox Code Playgroud)
但是,与其输出JSON实体框架,不如给我一些XML,例如
<ArrayOfstring xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<string>Property1</string>
<string>Property2</string>
</ArrayOfstring>
Run Code Online (Sandbox Code Playgroud)
我试图在控制器方法中转换输出。
public string GetProperties()
{
var results = typeof(ComplexInfo)
.GetProperties(BindingFlags.Public | BindingFlags.Instance)
.Select(p => p.Name).ToList();
return JsonConvert.SerializeObject(results, Formatting.Indented,
new JsonSerializerSettings {
PreserveReferencesHandling = PreserveReferencesHandling.Objects
});
}
Run Code Online (Sandbox Code Playgroud)
不幸的是,它仍在输出XML。
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">[
"Property1",
"Property2",
]</string>
Run Code Online (Sandbox Code Playgroud)
如何确保从控制器检索JSON对象?
asp.net-mvc json entity-framework xml-serialization xmlserializer
当鼠标悬停在某个类的元素A上时,应出现另一个包含链接的浮动divB。鼠标离开A和B后,B应该消失。
我该如何使用jQuery? jsFiddle
var container = $('#container');
var area = $('.area'); // this is A
var position = area.offset();
var floating = $("<div />", {
css : { "position" : "absolute",
"top" : position.top - 30,
"left" : position.left + 20,
"border" : "1px solid #000",
"padding" : "5px",
"display" : "none",
"z-index" : "100",
"background-color" : "#F00"
}
})
.text('Hello World'); // this is B
container.css('position', 'relative');
container.append(floating);
function show() {
floating.show();
}
function hide() {
floating.hide();
}
area.on('mouseenter', …Run Code Online (Sandbox Code Playgroud)