使用Bootstrap 3,如何将下拉菜单放在光标处并从代码中打开?
我需要在表上使用它作为其行的上下文菜单.
如果我有这个方法:
public void doSomething (Dictionary<String, Object> data)
{
JObject jsonObject = new JObject(data);
...
}
Run Code Online (Sandbox Code Playgroud)
我得到了一个System.ArgumentException
我创建JObject的行.我正在使用Newton-King的Json.net包装器.
我得到的错误是:
Newtonsoft.Json.DLL中出现'System.ArgumentException'类型的第一次机会异常Newtonsoft.Json.DLL中出现类型'System.ArgumentException'的异常,但未在用户代码中处理
我在这做错了什么?
我想在我的android项目中尝试这个库.我使用的是Android Studio 0.4.6.
该README.markdown文件告诉我要插入这里面的pom.xml:
<!-- in the 'repositories' section -->
<repository>
<id>keytwo.net</id>
<name>Keytwo.net Repository</name>
<url>http://audiobox.keytwo.net</url>
</repository>
<!-- in the 'dependencies' section -->
<dependency>
<groupId>io.socket</groupId>
<artifactId>socket.io-client</artifactId>
<version>0.2.1</version> <!-- the desidered version -->
</dependency>
Run Code Online (Sandbox Code Playgroud)
问题是我没有任何pom.xml.我在我的项目根目录和同步的gradle设置中创建了一个,但它什么也没做.直到现在我只使用已编译的.jar文件或使用gradle编译功能.
如何在我的项目中使用此库?
看一下本教程,我在一条评论中看到了以下代码建议:
init:function(callback){
var that =this ;
return $http.jsonp(this.url).success(
function(data){
that.availableGenres = that.getGenres(data);
that.results = that.getResults(data);
if(callback)callback.apply(null,[].slice.call(arguments))
}
)
}
Run Code Online (Sandbox Code Playgroud)
但这条线callback.apply(null,[].slice.call(arguments))
对我来说很奇怪.
为什么不callback.apply(null, arguments)
呢:?因为我不喜欢,当我不理解我用这个小提琴玩的东西时,要理解slice
那里的功能需要.但它给了我相同的结果,我仍然没有得到它.
谁知道为什么slice
需要?
我的页面左侧有一个垂直的StackPanel,其中包含以下元素:
我试图使用ScrollViewer元素使第二个StackPanel可滚动但没有成功.如果我将ScrollViewer Height定义为某个值,它可以工作,但我不想,因为我希望它填充所有可用的垂直空间.
我想在代码读取StackPanel计算高度时应用ScrollViewer Height,但这似乎不是正确的方法.我还试图将Height和ActualHeight绑定到StackPanel Height属性但没有结果.
<ScrollViewer
Grid.Row="1"
VerticalAlignment="Top"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollMode="Enabled"
ScrollViewer.HorizontalScrollMode="Disabled"
ScrollViewer.ZoomMode="Disabled">
<StackPanel x:Name="sptest" Orientation="Vertical">
<TextBlock Style="{StaticResource PageHeaderTextStyle}">test1</TextBlock>
<TextBlock Style="{StaticResource PageHeaderTextStyle}">test2</TextBlock>
<TextBlock Style="{StaticResource PageHeaderTextStyle}">test3</TextBlock>
<TextBlock Style="{StaticResource PageHeaderTextStyle}">test4</TextBlock>
<TextBlock Style="{StaticResource PageHeaderTextStyle}">test5</TextBlock>
<TextBlock Style="{StaticResource PageHeaderTextStyle}">test6</TextBlock>
<TextBlock Style="{StaticResource PageHeaderTextStyle}">test7</TextBlock>
<TextBlock Style="{StaticResource PageHeaderTextStyle}">test8</TextBlock>
<TextBlock Style="{StaticResource PageHeaderTextStyle}">test9</TextBlock>
<TextBlock Style="{StaticResource PageHeaderTextStyle}">test10</TextBlock>
<TextBlock Style="{StaticResource PageHeaderTextStyle}">test11</TextBlock>
<TextBlock Style="{StaticResource PageHeaderTextStyle}">test12</TextBlock>
</StackPanel>
</ScrollViewer>
Run Code Online (Sandbox Code Playgroud)
除了我还有一个GridView填充水平可用空间,它自动有滚动条.我没有定义它,必要时它会出现.很奇怪,StackPanel的行为并不像我想要的那样.我究竟做错了什么?
编辑
我发现了这个问题.它是关于WPF而不是WinRT,但可能是同样的问题.它说:
你不能没有固定StackPanel的高度.它旨在无限制地向一个方向发展.我建议使用不同的面板
我将StackPanel更改为Grid(我不想因为行定义,因为我只需要一列),但ScrollViewer也不起作用.
当一个元素滑入时我需要另一个元素滑出.目前我已将其设置为fadeOut.这是我到目前为止的代码:
$('#contact').click(function () {
$('#contact-info').animate({
width: 'toggle'
});
$('#work-menu').fadeOut('100');
});
$('#menu').click(function () {
$('#work-menu').animate({
width: 'toggle'
});
$('#contact-info').fadeOut('100');
});
Run Code Online (Sandbox Code Playgroud)
如何更改此代码以使相对的元素向下滑动,而另一个元素滑入视图?
我正在使用套接字将数据发送到可能没有响应的服务器。所以我试图通过在 SO 中使用这个解决方案来定义超时。
socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, array('sec' => 1, 'usec' => 0));
socket_set_option($socket, SOL_SOCKET, SO_SNDTIMEO, array('sec' => 1, 'usec' => 0));
Run Code Online (Sandbox Code Playgroud)
当建立连接并且服务器响应时间过长时,此方法有效。但当无法创建连接时,socket_connect($socket, $addr, $port);
超时时间约为 20 秒。
为什么会发生 20 秒超时?如何强制连接创建在 1 秒后超时?
我有以下Html代码
<div id="team">
<h1>Team</h1>
<img src="assets/divider.png" id="divider">
<img src="assets/team.png" id="team_pic">
</div>
Run Code Online (Sandbox Code Playgroud)
以下CSS
div#team {
margin: 0 auto;
margin-left:auto;
margin-right:auto;
right:auto;
left:auto;
}
Run Code Online (Sandbox Code Playgroud)
但是,子元素分隔符和团队图片一直向左.我虽然保证金:汽车将中心的一切.
然后我将以下内容放入子元素中.
div#team img#team_pic {
width:704px;
height:462px;
margin-left:auto;
margin-left:auto;
}
Run Code Online (Sandbox Code Playgroud)
没有,没有任何事情发生,元素仍然留下而不是居中.
我正面临一个从我的服务器解析JSON响应的奇怪问题.在过去几个月以这种方式获得响应(使用Content-Type:text/html)时,它一直运行良好:
string response = "";
using (var client = new System.Net.Http.HttpClient())
{
var postData = new System.Net.Http.FormUrlEncodedContent(data);
var clientResult = await client.PostAsync(url, postData);
if(clientResult.IsSuccessStatusCode)
{
response = await clientResult.Content.ReadAsStringAsync();
}
}
//Parse the response to a JObject...
Run Code Online (Sandbox Code Playgroud)
但是当收到Content-Type:text/html的回复时; charset = utf8会抛出Content-Type无效的异常.
Exception message: The character set provided in ContentType is invalid. Cannot read content as string using an invalid character set.
所以我改变了这个:
response = await clientResult.Content.ReadAsStringAsync();
Run Code Online (Sandbox Code Playgroud)
对此:
var raw_response = …
Run Code Online (Sandbox Code Playgroud) 当我们创建控制器,服务等组件时,AngularJ中的方括号有什么用?我在示例中看到了['ngRoute','ngFileUpload']。有什么用?