我有一个下拉菜单,在它下面打开一排图标(见图1,名称和图片被删除以保持隐私)

我试图让这个菜单打开到选择孩子的右边,而不是在它下面(见图2,我想要得到的东西.图像将打开到下拉的右边而不是下面)

我目前的代码是:
<div class="span4">
<div class="btn-group">
<a class="btn btn-link dropdown-toggle" data-toggle="dropdown" href="#">
<h3>Choose Child</h3>
<img id="mainIcons" src="boyStudent.png" alt="boyStudent">
<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>
<div class="btn-group">
<a href="parent_homepage_2.html" style="text-align:center;" class="btn btn-link operationsButtons">
<h5>A</h5>
<img id="mainIcons" src="boyStudent.png" alt="boyStudent"></a>
<a href="parent_homepage_2.html" style="text-align:center;" class="btn btn-link operationsButtons">
<h5>J</h5>
<img id="mainIcons" src="girlStudent.png" alt="girlStudent"></a>
</div>
</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
我尝试使用以下示例,这有助于将下拉向左推如何在左侧 打开twitter bootstrap子菜单? 但我想不出办法将这个用于我想做的事情
谢谢
我试图将一个真/假值设置为rails 4中表单中的单选按钮.我在stackoverflow上发现了一个帖子,并相应地实现了我的单选按钮,但我总是将其作为值.
我的代码
<div><%= label :access_rights, 'Read Only', :value => "false" %></div>
<%= f.radio_button :access_rights, "Read Only", :checked => true , false%></div>
<div><%= label :access_rights, 'Read and Write', :value => "true" %></div>
<%= f.radio_button :access_rights, "Read and Write", true %>
Run Code Online (Sandbox Code Playgroud)
是否有不同的方法为rails 4中的单选按钮设置值?
编辑:
在我的控制器中
def access_params
params.require(:accessor).permit(:email, :access_rights)
end
Run Code Online (Sandbox Code Playgroud)
参数:
{"utf8"=>"?",
"authenticity_token"=>"t/da2RRBi4KsyndnHx4WNZLoOHu9DVlAWtl/59NPiMc=",
"accessor"=>{"accessor_id"=>"email",
"access_rights"=>"Read and Write"},
"commit"=>"Grant Permission"}
Run Code Online (Sandbox Code Playgroud) 我试图通过以下方法从网站获取一个favicon.我试图避免//问题并决定使用URL对象.
public static Bitmap getBitmapFromURL(URL src) {
try {
URL url = src;
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
Bitmap myBitmap = BitmapFactory.decodeStream(input);
return myBitmap;
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
Run Code Online (Sandbox Code Playgroud)
我在跑步
Bitmap faviconBitmap = getBitmapFromURL(new URL("http", "www"+url, "/favicon.ico"));
Run Code Online (Sandbox Code Playgroud)
我的网址设置为: url = imdb.com
但我失败并收到以下错误:
01-24 20:01:33.702: W/System.err(8678): java.io.IOException: Illegal character in authority at index 22: http://www.nytimes.com
01-24 20:01:33.702: W/System.err(8678): /favicon.ico
Run Code Online (Sandbox Code Playgroud)
对于如何解决这个问题,有任何的建议吗?
我正在尝试使用css 3制作方形图片循环.
每个请求发布我的整个代码html
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Hello</title>
<link type="text/css" href="home_page.css" rel="stylesheet" />
</head>
<body>
<span class="image-wrap " style="display:inline-block; background:url(pic1.png);">
<img src="pic1.png" style="opacity: 0;"></span>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
css:在home_page.css里面
.image-wrap {
-webkit-border-radius: 50em;
-moz-border-radius: 50em;
border-radius: 50em;
}
Run Code Online (Sandbox Code Playgroud) 是否有可以作为 JUnit 测试的一部分集成的 Java 分析器。
例如,我想要一个条件,如果测试中的某个方法使用了超过 X% 的 CPU,则测试应该失败/通过。
或者,如果某个方法运行了超过 X 分钟,它应该会失败。
我在这里查看了 YourKit、JVM 监视器和其他建议的工具,以及运行 java -Xrunhprof:cpu=samples,file=myprogram.hprof
但所有这些都不能用作测试的一部分。
我也可以从测试中调用分析器,将结果(自动)保存到 csv/txt/任何其他文件,并编写一些代码来提取信息。
如果存在开源/免费工具会更好
我试图检测jar中哪个类包含main或提供的方法名称(如果可能).
目前我有以下代码
public static void getFromJars(String pathToAppJar) throws IOException{
FileInputStream jar = new FileInputStream(pathToAppJar);
ZipInputStream zipSteam = new ZipInputStream(jar);
ZipEntry ze;
while ((ze = zipSteam.getNextEntry()) != null) {
System.out.println(ze.toString());
}
zipSteam.close();
}
Run Code Online (Sandbox Code Playgroud)
这将允许我在这些包下获取包和类,但我不知道是否有可能在类中获取方法.此外,我不知道这种方法是否适用于jar中的几个pkgs的情况,因为每个包都可以有一个带有main的类.
我很感激任何想法.
我有一个包含整数和日期时间对象的元组列表。我想按整数排序。例如:
list = (45, datetime.datetime(2014, 7, 25, 13, 20, 8, 332000)), (43, datetime.datetime(2014, 7, 25, 13, 17, 47, 873000)),...
我目前的代码是不正确的:
var sort = {{list|sort(reverse = True)}}
Run Code Online (Sandbox Code Playgroud)
我看到 jinja 中有一个属性选项,但无法使用它仅按第一个元素排序。
我的json对象有一个列表,我想遍历列表的元素我看到以下帖子迭代JsonCpp中的对象,但这对我不起作用
我的json对象:
{
"name": ["str1",str2" ... ]
}
Run Code Online (Sandbox Code Playgroud)
我拥有和不工作的代码
Json::Value names= (*json)["name"];
for( Json::ValueIterator itr = names.begin() ; itr != names.end() ; itr++ ) {
string name = *itr.asString();}
Run Code Online (Sandbox Code Playgroud)
我收到以下错误
cannot convert from 'Json::Value' to 'std::basic_string<_Elem,_Traits,_Ax>
Run Code Online (Sandbox Code Playgroud)
我确信元素是字符串,因为调用string name = names= (*json)["name"][0].asString()正在工作
我试图使用onCreateContextMenu OnCreateContextMenu和ListView项目从列表视图中复制项目文本, 并 从Android上的TextView复制文本, 但我不知道如何将菜单中的副本上的点击与listView相关联.
我当前的代码,打开一个带有副本的菜单,我不知道如何在单击副本后获取文本
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
menu.add(0, v.getId(), 0, "copy");
}
@Override
public boolean onContextItemSelected(MenuItem item) {
if(item.getTitle()=="copy"){}
else {return false;}
return true;
}
Run Code Online (Sandbox Code Playgroud)
谢谢您的帮助
我正在尝试将图像放在画布上。我阅读了以下教程
https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Canvas_tutorial/Using_images
并尝试做一些与我的画布类似的事情<canvas id="canvas" width="400" height="400"></canvas>
,我已经创建了该功能
function putImage(){
var img = new Image();
img.src = "./path.png";
var ctx = document.getElementById('canvas').getContext('2d');
ctx.drawImage(img,8,8);
}
Run Code Online (Sandbox Code Playgroud)
但图像没有出现在画布上。我已经打印了图像路径并且它是正确的,所以我能够消除这个问题。有什么建议?
谢谢
我试图提取属于特定旅行中的用户的所有成本,并根据其类型(exchange_id)对其值求和.例如,用户可以增加5美元的成本,另外10美元的成本和50欧元的第三个成本.我想要[15 $,50欧]
我有以下代码@trip.costs.where(user_id: current_user).group("exchange_id")),但我不知道如何从这里开始,只提取成本的价值并总结它
谢谢
我有一个内部的行之一以下ID表
<td class="firstRow"> <span id="randomWordToTranslate"></span></td>
的firstRow类只包括CSS填充偏好.
在我的java脚本类中,我调用两个函数,第一个随机为此id分配一个值,所以当我加载页面时,每次都会得到一个不同的单词:这部分工作正常
$("#randomWordToTranslate").html(current_dict[listOfKeys[Math.floor(Math.random() * listOfKeys.length)]]);
按钮监听器中的第二个,只要单击该按钮,就会尝试在该字段内获取单词的值
var spanishWord = $("#randomWordToTranslate");
var inputValue = $(spanishWord).val();
Run Code Online (Sandbox Code Playgroud)
但是当我在做console.log(inputValue)时,我在我的日志中打印一个空行.有任何想法吗?
谢谢
我正在尝试使用ajax从我的控制器获取信息.基本上我想知道数据库中是否已存在数据,因此我的控制器将返回true或false.目前我只是想设置基本的ajax调用
在我的js文件中,我有以下ajax调用,因为你现在可以看到我并没有真正做任何逻辑,因为我的数据只是一个占位符.稍后我将添加我想要查询的信息
$.ajax({
type: "GET",
url: "/locations/exists",
dataType: "JSON",
data: { 'locition_exist': loc_exit },
success: function(data) {
console.log(data);
}
});
Run Code Online (Sandbox Code Playgroud)
在我的控制器中我有
def exists
location_exists = true
respond_to do |format|
format.html
format.json {render json: location_exists }
end
end
Run Code Online (Sandbox Code Playgroud)
以后的值将进入模型中的一个方法,该方法将查询DB并返回true/false.
在我的路线我有
resources :locations
get 'locations/exists', to: 'locations#exists'
Run Code Online (Sandbox Code Playgroud)
此代码导致以下错误
The action 'show' could not be found for LocationsController
Run Code Online (Sandbox Code Playgroud)
我是rails和ajax的新手,我的代码基于我在这里阅读的不同示例,所以我可能只是做了一个愚蠢的noob错误.非常感谢您的帮助