我有一个矢量说vector<vector<int> > items不同大小的矢量,如下所示
1,2,3
4,5
6,7,8
Run Code Online (Sandbox Code Playgroud)
我想根据这些向量的笛卡尔积来创建组合
1,4,6
1,4,7
1,4,8
and so on till
3,5,8
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点 ?我查了几个链接,我也在这篇文章的末尾列出了它们,但我无法解释它,因为我不熟悉这种语言.有些人可以帮助我.
#include <iostream>
#include <iomanip>
#include <vector>
using namespace std;
int main()
{
vector<vector<int> > items;
int k = 0;
for ( int i = 0; i < 5; i++ ) {
items.push_back ( vector<int>() );
for ( int j = 0; j < 5; j++ )
items[i].push_back ( k++ );
}
cartesian ( items ); // I want some function here …Run Code Online (Sandbox Code Playgroud) 我试图让它成为当div.projectsgrid从顶部<100px 时,jQuery将看到是否div.selectedwork有css背景颜色#ffffff.如果没有,它会将其背景颜色设置为#ffffff.一旦用户向上滚动并且div.projectsgrid距离顶部超过100px,jQuery将删除背景颜色.我有以下代码,它不起作用:
$(window).scroll(function(e){
var el = $('.selectedwork');
var top = $('#projectsgrid').offset().top;
if ($(top) < 100 && el.css('background-color') != '#ffffff'){
$(el).css({'background-color': '#ffffff'});
}
if ($(top) > 100 && el.css('background-color') == '#ffffff'){
$(el).css({'background-color': ''});
}
});
Run Code Online (Sandbox Code Playgroud) 有没有办法在java中创建一个128位对象,可以像long或int那样进行位操作?我想做32位移位,我希望能够对整个128位结构进行一些OR运算.
我希望将UIPicker添加到半透明的灰色/蓝色选择栏中.目前它没有出现:
http://screencast.com/t/XvSqotIPXYJD
这是它应该看起来的截图:
http://www.screencast.com/users/jeffbubblet/folders/Jing/media/83a7c3d4-3f29-4e03-beb6-cf1118c9d91d
现在我正在使用委托方法pickerView:titleForRow:forComponent.我宁愿不必使用pickerView:viewForRow:forComponent:reusingView:如果可以避免则不必要.
我似乎无法在文档中找到任何关于它的内容,我不打算将它自定义一点 - 只是想要默认行为.
无法弄清楚如何主题ajax加载recaptcha.以下代码不起作用.
来自Google Recaptcha
看到这篇文章Recaptcha ajax API自定义主题不起作用,但我肯定在localhost中查看和recaptcha工作正常,只是没有改变主题.
任何人都有关于如何让白色主题工作的建议?
<script type='text/javascript'>
var RecaptchaOptions = {
theme : 'white'
};
</script>
<div id="recaptcha_content">
<noscript>
<iframe src="http://www.google.com/recaptcha/api/noscript?k=6Ldr7woAAAAAADa_69Mr-EZKAeYyEx9N08q" height="300" width="500" frameborder="0"></iframe><br />
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
<input type='hidden' name='recaptcha_response_field' value='manual_challenge' />
</noscript>
</div>
<script type="text/javascript">
$(document).ready(function() {
$.getScript('http://www.google.com/recaptcha/api/js/recaptcha_ajax.js',
function() {Recaptcha.create("6Ldr7woAAAAAADa_69Mr-EZKAeYyEx9N08q", "recaptcha_content");
});
});
</script>
Run Code Online (Sandbox Code Playgroud) 我是Android开发的新手,无法找到答案.我已经指定我需要android.permission.INTERNET我的清单文件中的权限,但是当我尝试在手机上运行应用程序时,它会给我一个java.lang.SecurityException: Permission Denial: starting Intent错误.我错过了什么?
我的应用程序是否需要签名才能在开发期间请求权限?
这是我的查询:
SELECT TIMEDIFF(end_time,start_time) AS "total" FROM `metrics`;
Run Code Online (Sandbox Code Playgroud)
这给了我:
116:12:10
Run Code Online (Sandbox Code Playgroud)
意思是116小时12分10秒.
相反,我希望它说4天20小时,12分钟等
路由文件中是否有一种方法可以检查和验证URL参数.我不是在谈论宁静的'/ controller/action /:id'参数,而是'controller/action?param1 = x¶m2 = y¶m3 = z'.我需要能够验证每个参数并要求它们.
让我用一个例子来解释 -
#include <iostream>
void foo( int a[2], int b[2] ) // I understand that, compiler doesn't bother about the
// array index and converts them to int *a, int *b
{
a = b ; // At this point, how ever assignment operation is valid.
}
int main()
{
int a[] = { 1,2 };
int b[] = { 3,4 };
foo( a, b );
a = b; // Why is this invalid here.
return 0;
}
Run Code Online (Sandbox Code Playgroud)
是因为,当传递给函数时,数组衰减到指针,可以进行foo(..) …
嘿,我开始使用bash shell脚本,我正在尝试为一个赋值创建一个脚本,当你输入两个目录时,它会检查它们是否存在并根据错误信息显示,如果两个目录都存在,它将列出之间的差异当前目录.
$ cd dir-1
$ myshellscript . dir-2 (comparing . aka dir-1 against dir-2)
Run Code Online (Sandbox Code Playgroud)
输出:
Files that are in . but not in dir-2
-rw------- 1 ddddd users 1 2011-03-1 01:26 123123123
Files that are in dir-2 but not in .
-rw------- 1 ddddd users 1 2011-03-1 01:26 zzzzzzzzzzzz
Run Code Online (Sandbox Code Playgroud)
到目前为止,我似乎没有检测目录是否存在,也没有列出差异:
dir-1=$1
dir-2=$2
if [ $# > 2 ]
then
echo "Usage: compdir dir-name1 dir-name 2"
exit 1
elif [ $# < 2 ]
then
echo "Usage: comdir dir-name1 dir-name …Run Code Online (Sandbox Code Playgroud) c++ ×2
jquery ×2
android ×1
arrays ×1
bash ×1
combinations ×1
getscript ×1
iphone ×1
java ×1
javascript ×1
linux ×1
mysql ×1
permissions ×1
recaptcha ×1
shell ×1
themes ×1
uipickerview ×1
vector ×1