我想做的只是使用 CSS 将 div 居中。我无法理解它。它根本不起作用。我使用了以下代码:
<style type="text/css">
<!--
div.test {
width: 300px;
margin-right: auto;
margin-left: auto;
border: 1px solid black;
}
-->
</style>
<div class='test'>
hello
</div>
Run Code Online (Sandbox Code Playgroud)
这在 IE 上不起作用,但在其他任何东西上都起作用(包括我的 iPhone,这让它非常令人沮丧)。div 只是保持在右侧对齐。
现在来说说(简单!)解决方案,这花费了我很多时间,而且我无法在搜索引擎中搜索问题找到该解决方案。只需添加文档类型即可:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
Run Code Online (Sandbox Code Playgroud)
为什么解决了这个问题?
我创造了以下事件ListBox:
<ListBox x:Name="RecentItemsListBox" Grid.Row="1" BorderThickness="0" Margin="2,0,0,0" SelectionChanged="RecentItemsListBox_SelectionChanged">
<ListBox.Resources>
<Style TargetType="{x:Type ListBoxItem}"
BasedOn="{StaticResource {x:Type ListBoxItem}}">
<Style.Triggers>
<!--This trigger is needed, because RelativeSource binding can only succeeds if the current ListBoxItem is already connected to its visual parent-->
<Trigger Property="IsVisible" Value="True">
<Setter Property="HorizontalContentAlignment"
Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
<Setter Property="VerticalContentAlignment"
Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
</Trigger>
</Style.Triggers>
</Style>
</ListBox.Resources>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="0,2,0,0">
<TextBlock Text="{Binding Number}" />
<StackPanel Orientation="Vertical" Margin="7,0,0,0">
<TextBlock Text="{Binding File}" />
<TextBlock Text="{Binding Dir}" …Run Code Online (Sandbox Code Playgroud) 我见过这样的帖子,但不完全是我想做的.
如何提取和删除URL链接,然后从纯文本中删除它们.
例:
"Hello!!, I love http://www.google.es".
Run Code Online (Sandbox Code Playgroud)
我想提取"http://www.google.es",将其保存在变量上,然后将其从我的文本中删除.
最后,文本必须是这样的:
"Hello!!, I love".
Run Code Online (Sandbox Code Playgroud)
URL通常是文本的最后一个"单词",但并非总是如此.
我可以创建参数化控件模板,即创建可能包含不同控件的控件模板.例如,我可以使用带有标签或按钮的控制模板 - 无论我想要什么位置.
<ControlTemplate x:Key="MessageCTemplate">
<Grid …>
<Rectangle …/>
<Rectangle …/>
<Rectangle …/>
…
<!--I want to have here button, label or whatever I want-->
<label x:Name=”MsgLabel”>
<Grid/>
<Style x:Key="MsgStyle" TargetType="{x:Type Button}">
<Setter Property="Opacity" Value="0.6" />
<Setter Property="Template" Value="{StaticResource MessageCTemplate}" />
<Style/>
Run Code Online (Sandbox Code Playgroud)
我不喜欢编写相同的控件模板,它们的代码中只有一个不同的字符串.或者,也许,我误解了smth,另一种避免复制过去的方式存在.
我能够成功运行以下curl命令(在命令行中):
curl -XPOST --basic -u user:password -H accept:application/json -H Content-type:application/json --data-binary '{ "@queryid" : 1234 }' http://localhost/rest/run?10
Run Code Online (Sandbox Code Playgroud)
这是我到目前为止所做的事情,但它似乎没有使用我正在使用的REST服务:
$headers = array(
'Accept: application/json',
'Content-Type: application/json',
);
$url = 'http://localhost/rest/run?10';
$query = '{ "@queryid" : 1234 }';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "user:password");
curl_setopt($ch, CURLOPT_PUT, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
curl_setopt($ch, CURLOPT_POSTFIELDSIZE, strlen($query));
$output = curl_exec($ch);
echo $output;
Run Code Online (Sandbox Code Playgroud)
尝试使用PUT方法转换--data-binary时,正确的方法是什么?
我想将列表对象作为我的数据源,你能告诉我.jrxml文件我应该如何设计我的报告?
public class TestReport
{
public void runReport(String fileName, String outFileName)
{
try
{
List<R> list = new ArrayList<R>(5);
Map parameters = new HashMap();
list.add(new R("a1" ,"a2"));
list.add(new R("b1" ,"b2"));
list.add(new R("c1" ,"c2"));
/*parameters.put("my_name", "faisal khan");
parameters.put("my_addr", "address comes here");*/
JasperPrint print = JasperFillManager.fillReport( fileName, parameters, new JREmptyDataSource());
JRExporter exporter = new JRPdfExporter();
exporter.setParameter(
JRExporterParameter.OUTPUT_FILE_NAME,outFileName);
exporter.setParameter(
JRExporterParameter.JASPER_PRINT, print);
JasperExportManager.exportReportToPdfFile(print, outFileName);
print = null;
exporter = null;
} catch (Exception e) {
e.printStackTrace();
}
}
private class R{
private …Run Code Online (Sandbox Code Playgroud) 我写了这个脚本,但它没有按照我想要的方式工作:
$(document).ready(function(){
if ($('#map_container').find('#point').length == 0 ) {
$("#map_container").click(function (e) {
var relativeXPosition = (e.pageX - this.offsetLeft);
var relativeYPosition = (e.pageY - this.offsetTop);
//alert('left: '+relativeXPosition+', top: '+relativeYPosition);
$("#map_container").append('<img id="point" src="<?=url::base();?>images/city.png" alt="" />');
$("#point").css({ top: (relativeYPosition) + 'px', left: relativeXPosition + 'px', position: 'absolute' })
});
}
});
Run Code Online (Sandbox Code Playgroud)
它应该只放一个id ="point"的img,但是当我点击map_container两次我得到两个img时,为什么这个如果不起作用?
在软件架构 - 基础,理论和实践中,我可以找到两者的定义.问题是,我不能用简单的英语得到每个人的意思:
体系结构模式是体系结构设计决策的命名集合,适用于参数化的重复设计问题,以解决出现该问题的不同软件开发环境.
建筑风格是建筑设计决策的命名集合,(1)适用于给定的开发环境,(2)约束特定于该环境中特定系统的建筑设计决策,以及(3)在每个环境中引出有益的品质结果系统.
每个人的意思是什么,他们之间有什么区别?
var tr = document.createElement('tr');
tr.setAttribute("onclick",p.onrowclick+"("+row.id+")");
Run Code Online (Sandbox Code Playgroud)
嗨,以上在Firefox中对我来说很好.我在IE中找不到正确的解决方法语法.
我正在使用IE8.
我只是想知道在Java或C#中是否存在库或外部库中的任何构建,它允许我获取音频文件并解析它并从中提取文本.
我需要申请这样做,但我不知道从哪里可以开始.