Posts

arrays - Vector Subscript out of range in C++ -

i facing problem while loading vector array vector rgb array. after rgbv = pointcloud_rgb[i]; getting error "vector subscript out of range". can guide me please. regards suhas const std::vector<cv::vec3b>& pointcloud_rgb; (unsigned int i=0; i<points.size(); i++) { cv::vec3b rgbv(255,255,255); if (pointcloud_rgb.size() >= i) { rgbv = pointcloud_rgb[i]; } } you have off-by-one error. if pointcloud_rgb.size() == i , i 1 element past end of vector. to fix this, change condition this: if (pointcloud_rgb.size() >= i) { to this: if (pointcloud_rgb.size() > i) {

python - Accessing Google Cloud Endpoints from php - 403 forbidden -

i'm trying access python based google cloud endpoints api php-server, without using php client library (simply making post-request, don't need authorization). worked fine few week, doesn't work anymore, in server logs following error: <!doctype html><html lang=en><meta charset=utf-8><meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width"><title>error 403 (forbidden)!!1</title><style>*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen , (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google....

swift2 - Cannot invoke `join` with an argument list of type (String, [String]) in Swift 2.0 -

var specializationtitles = ["a", "b", "c", "d"] let outputstring = join(" / ", specializationtitles) got error: cannot invoke join argument list of type (string, [string]) how solve this? let separator = " / " let outputstring = separator.join(specializationtitles) with xcode7beta6: specializationtitles.joinwithstring(" / ") with xcode7 release version: specializationtitles.joinwithseparator(" / ")

ruby - Run method class within block -

how can use instance variables , method within block in ruby? class foo @var = "my var" def meth() "my method" end module.something |variable| p @var #=> undefined p meth() #=> undefined end end i not sure understand context, might help: class foo def initialize @var = "my var" end def meth() "my method" end def fee amodule.something |variable| p @var p meth() p variable end end end # test: module amodule def self.something yield "bar" end end foo = foo.new foo.fee

ios - Linking to J2ObjC from another CocoaPod -

we use j2objc , trying make switch xcode 6's dynamic frameworks in order incorporate swift project. adding use_frameworks! our podfile works great in case we're just using j2objc, problem comes when adding other libraries reference it. in particular example, have 2 pods in podfile, j2objc , other pod uses it. let's call whatever . current j2objc podspec can found here . here's podspec whatever : pod::spec.new |s| s.ios.deployment_target = '8.0' s.requires_arc = true s.source_files = '**/*.{h,m}' s.dependency 'j2objc' s.xcconfig = { 'header_search_paths' => '${pods_root}/j2objc/dist/include', 'library_search_paths' => '${pods_root}/j2objc/dist/lib' } end so far good. now, if want reference java class, javautilarraylist inside app, can that. @implementation viewcontroller - (void)viewdidload { [super viewdidload]; javautilarraylist *arraylist = [[javautilarraylist alloc]ini...

json - Jquery DataTables : Not able to make dynamic header -

have 2 json files json1 callback({ "docs":[ { "a":"qwe", "b":"asd", "c":"zxc", "d":"mnb", }] }) json2 callback({ "docs":[ { "1":"123", "2":"456", "3":"789", "4":"012", }] }) reading json file , displaying in table using jquery datatables plugin. i want "a","b","c","d" , "1", "2", "3", "4" used table headers or column names each json file called based on different check box click, there different column headers each json want columns/table headers dynamic. here datatable initialization var table = $('#example').datatable({ "data": items, ...

mysql - How to structure/normalize this database? -

Image
i need make database should hold 50 questions, 3 possible answers each question , value of each answer. this first guess feels wrong , i'm not sure how access values properly. suggestions on how structure this? this seems correct way: questions table --------------- id title ... answers table ------------- id question_id answer value one way be questions table --------------- id title ... values table ------------ id value answers table ------------- id question_id answer value_id then answers of specific question do select a.*, v.value answers join questions q on q.id = a.question_id join values v on v.id = a.value_id q.title = 'what name of dr. who'