Posts

javascript - Angularjs $http cant get data but can get from $jquery.ajax -

i tired data off api using jquery.ajax() , works fine here code that: $.ajax({ url: "http://api.somesite.com/api?format=json", type: "get", //it works post datatype: 'jsonp', }) .done(function( data ) { if ( console && console.log ) { console.log( "sample of data:", data ); } }); now wanted same angularjs did following first did this: var req = { method: 'get', url: "http://api.somesite.com/api?format=json", headers: { 'content-type': "application/json", }, } $http(req).then(function(response){ console.log(response.data); }); i in console: xmlhttprequest cannot load http://api.somesite.com/api?format=json. no 'access-control-allow-origin' header present on requested resource. origin 'http://localhost:8100' therefore not allowed access. then tried this: $http.jsonp('http://api.somesite.com/api?format=json',...

java - Connect two boxes with a line via drag and drop -

selenium rookie here question regarding drag , drop. i have 2 boxes , 1 of boxes can drag line , connect other box. i have tried various ways none of them seem work. actions action = new action(driver); action.draganddrop(box1 , box2).perform(); // did not work action.clickandhold(box1).movetoelement(box2).release().perform(); //did not work either action.clickandhold(box).movebyoffset(coordonates of box2).release().perform(); // did not work this knowledge of selenium stops , there other way can this? i know xpath because when perform element.click(); access not that. selenium's actions drag , drop not play nice html5, when trying move element frame , in several other situations. possibly can solve problem using jquery solution: [c#][selenium] how drag-hover-drop element

sql - Writing a query for multiple fields using IN -

select a.first_name,b.empid,c.phn name a,emp b,phone c b.emptype = 'new' , a.first_name,b.last_name,c.phn = (select a.first_name,b.last_name,c.phn name a,emp b,phone c b.emptype = 'old') basically, want search new customers have same details (first name, last name , phone) old customers. old customer can converted new customer details retained. hence, thing changes emptype. eg. (john mcenroe 47589876 old) when converted becomes (john mcenroe 475898876 new) [first_name,last_name,phone,emptype] dude, here's query uses exists. main difference between exists , in exists queries using index in goes lot of or toghether. select a.first_name ,b.empid ,c.phn name ,emp b ,phone c b.emptype = 'new' , exists (select top 1 1 name x ,emp y ,phone z x.first_name = a.first_name , y.last_name = b.last_name , z....

c++ - Inverse FFT in OpenCV gives different result than Matlab -

using opencv, want same result of matlab's ifft2 function. in matlab get: a = [1 2 0; 4 5 0; 7 8 9; 10 11 12]; inverse = ifft2(a); inverse = 5.7500 + 0.0000i -0.1250 + 0.3608i -0.1250 - 0.3608i -1.7500 - 2.0000i -0.3080 + 0.4665i 0.5580 + 0.0335i -1.2500 + 0.0000i -0.1250 - 0.2165i -0.1250 + 0.2165i -1.7500 + 2.0000i 0.5580 - 0.0335i -0.3080 - 0.4665i in opencv, when do: cv::mat paddeda; int m = cv::getoptimaldftsize(a.rows); int n = cv::getoptimaldftsize(a.cols); cv::copymakeborder(a, paddeda, 0, m - a.rows, 0, n - a.cols, cv::border_constant, cv::scalar::all(0)); cv::mat planes[] = { cv::mat_<float>(paddeda), cv::mat::zeros(paddeda.size(), cv_32f) }; cv::mat complexa; cv::merge(planes, 2, complexa); cv::mat inverse; cv::idft(complexa, inverse, cv::dft_scale | cv::dft_complex_output); this gives me: inverse = [1, -0, 2, -0, 0, -0; 4, -0, 5, -0, 0, -0; 7, -0, 8, -8, 9, 0; 10, -0, 11, -0, 12, -0] and type of a cv_32f . ho...

sql - sqlalchemy: select specific columns from multiple join using aliases -

this has stumped more day , examples find have not worked. new sqlalchemy , find documentation not enlightening. the query (so far): prey = alias(ensembl_genes, name='prey') bait = alias(ensembl_genes, name='bait') query = db.session.query(tap,prey,bait).\ join(prey, tap.c.tap_prey_ensembl_gene_id==prey.c.ensembl_gene_id).\ join(bait, tap.c.tap_bait_ensembl_gene_id==bait.c.ensembl_gene_id).\ filter(\ or_(\ tap.c.tap_prey_ensembl_gene_id=='ensg00000100360',\ tap.c.tap_bait_ensembl_gene_id=='ensg00000100360'\ )\ ).\ order_by(desc(tap.c.tap_unique_peptide_count)) tap refers table of interacting genes. 1 interactor designated 'bait' , other 'prey'. prey , bait aliases same table holds additional information on these genes. objective select interactions given gene 'ensg00000100360' either bait or prey. the problem: this query returns 20 or columns, need 6 specific ones, 2 ea...

java - One statement to select data from two MySQL tables. Show name instead of/by ID -

i have 2 tables the table .issues looks this: id tracker_id project_id 22 1 218 in second table .trackers: id name 1 error is possible make 1 select request receive result names of trackers instead of/with ids? need simplify java request. i want smth this: id (tracker_id) project_id tracker_name 22 (1) 218 error i tried this, know doesn't make sense: statement stmt1 = conn.createstatement(); resultset ticketsrows = stmt1.executequery("select * issues tracker_id in (select id trackers)"); join trackers table , select name column table instead tracker_id select i.id, t.name tracker_name, i.project_id issues join trackers t on i.tracker_id = t.id

angularjs - how to use element attribute value to show / hide div in angular js -

i want show div based value of div's attribute values. <div ng-show="" data-views="{{viewstate}}" id="question_id_{{questionid}}" >aaa</div> i want below <div ng-show="data-views" data-views="{{viewstate}}" id="question_id_{{questionid}}" > how pass data-views attribute value ng-show="" is possible better way show hide take scope variable in controller , use below if value boolean otherwise use conditions in ng-show. $scope.viewstate =true/false; <div ng-show="viewstate" data-views="{{viewstate}}" id="question_id_{{questionid}}" >