Posts

Showing posts from April, 2013

r - Transforming a data.frame -

i appreciate suggestion on following : working data.frame (below) : exp ct row_names col_names 1 test -5 b4:b5:b6 b1:b2:b3 2 test -2 b7:b8:b9 b1:b2:b3 3 test -2 d4:d5:d6 h4:h5:h6 4 test -2 d10:d11:d12 f10:f11:f12 5 test -2 d10:d11:d12 h1:h2:h3 6 test -2 e10:e11:e12 g7:g8:g9 7 test -4 a1:a2:a3 d1:d2:d3 8 test -4 b10:b11:b12 b1:b2:b3 what easiest way consider unique elements in row_names or unique elements in col_names , print how many times these unique elements associate numbers -5, -2, or -4? (these numbers on column named ct.)

How to display average in C++? -

in c++ class, part of project have "compute student's current overall average , display it. midterm counts 20%, project average counts 40%, , homework average counts 15% "your current average xx%". there no numeric grades given calculate average in assignment percentages. have factor in these % average , if how do that. i'm beginner. here code have done part of project. average = ( _midtermgrade + _projectaverage + _homeworkaverage / 3); cout << "your currentaverage is" << average <<endl; to compute weighted average, sum each score multiplied weight , divide total total weight. for example: average = ((_midtermgrade * 20 + _projectaverage * 40 + _homeworkaverage * 15) / (20 + 40 + 15)); cout << "your currentaverage is" << average <<endl;

Delphi 7 - 2nd form can follow the position of the mainform -

Image
how can make second form can follow position of main form wherever main form shifted. example, can seen in gif image: i tried using delphidabbler tip, stop form moving, did not manage worked. handle wm_windowposchanging move other form(s) @ same time. ... public oldtop, oldleft: integer; procedure windowposchanging(var msg: twmwindowposchanging); message wm_windowposchanging; end; ... implementation ... procedure tform1.windowposchanging(var msg: twmwindowposchanging); var dtop, dleft: integer; begin // , here inside of put relationship of // want him move. // example of moving them in same sense can be... if (form2 = nil) or (not form2.visible) exit; // line avoid error of calling them when forms // creating or when not visible... dtop := top - oldtop; dleft := left - oldleft; form2.top := form2.top + dtop; form2.left := form2.left + dleft; oldtop := top; oldleft := l...

Swift Project Doesn't Recognize CocoaPod Library -

i created page-based project , created podfile in root of project following content: source 'https://github.com/cocoapods/specs.git' platform :ios, '8.0' use_frameworks! pod 'baasboxsdk', '~> 0.9' i ran pod install via terminal , opened new workspace. use_frameworks! it's understanding should able use library without creating , setting bridged headers. have tried , without bridged headers , xcode doesn't seem detect library or classes library. missing step? (this first swift project). are calling import baasboxsdk in files want use in

ajax - jQuery Forms ajaxsubmit refreshes before result returns, but during debug, result displayed briefly then page refreshes(not wanted) -

apache on windows 7. i want submit form perl cgi save data in mysql, returning json results (no "location" returns!). if don't put js break point in, page refreshes before response received. if breakpoint it, response received. results posted briefly, page refreshes, don't want happen! standard form, no file upload ajaxsubmit options: var formapplyoptions = { url: "/cgi-bin/saveapplicant.cgi", beforesubmit: formvalidate, datatype: "json", target: "#applyresponse", success: showreceivedapplicant, error: showerror }; form submit button function: $('#formdata').submit(function(e) { e.preventdefault(); e.stoppropagation(); alert("el oh!"); $('#formdata').ajaxsubmit(formapplyoptions); }) showerror: function showerror(xhr, ajaxoptions, thrownerror) { //showresponse(responsetext, statustext, xhr, $form); $('div#errormsg'...

objective c - Race conditions in iOS using GCD for UICollectionView -

i hoping can me out code , try figure out best way optimize don't have many race conditions. some things know happening: sometimes collection view not show up only items show in collection view i.e 3 out of 8 items the refresh graph function gets called anywhere 1-3 times randomly i think overall code can made more efficient. if has advice, appreciate it. i going post bulk of code here, have removed lot of processing save lines isn't hard read think left in enough can see gcd being utilized , if i'm doing wrong. link full code in gist if see whole thing. gist #import "dashboardcollectionviewcontroller.h" #import "dashboardlayout.h" #import "headerviewcell.h" #import "dashboardcell.h" #import "dashboarddetailviewcontroller.h" #import "preferencesmanager.h" #import "uicolor+hexcolors.h" #import "pnchart.h" @interface dashboardcollectionviewcontroller () <uicollectionviewde...

asp.net mvc - Loosing Session and cookies in IE for MVC -

my application working fine in chrome. in ie9 loosing session , cookies. token created in current session but not able retrieve ie (chrome works fine). if (httpcontext.current.request.cookies["token"] != null) { var memberidencrypted = httpcontext.current.request.cookies["token"].value; var auth = new customauthentication(); memberid = auth.decrypttoken(memberidencrypted); }

Create user on Owncloud -

i searched, not find correct way create new users on owncloud server. tried apply user provisioning api says, response: <ocs> <meta> <status>failed</status> <statuscode>999</statuscode> <message>invalid query, please check syntax. api specifications here: http://www.freedesktop.org/wiki/specifications/open-collaboration-services. debug output: debug output: http request method: post http request uri: /owncloud/ocs/v1.php/cloud/users%20-d%20userid=%22frank%22%20-d%20password=%22frankspassword%22</message> </meta> </ocs> my http post is: http://myuser:mypassword@ip_owncloud_server/owncloud/ocs/v1.php/cloud/users -d userid="frank" -d password="frankspassword" what wrong here? first, example given in owncloud documentation not complete. assumes you're using curl or other command line utility. got script work using jquery ajax: <script> function domake() { $.ajax({ t...

server - Telnet and passive FTP -

i've problem ftp test server. i've installed , configured filezilla server, it's listening control connection on port 21, can provide passive mode data connection on ports between 50100 , 51100. i'm trying local connection 127.0.0.1:21 , retrieve list of files , folders in root ftp directory. filezilla client: work !!! ftp in ms-dos: work !!! telnet in ms-dos: control connection , user authentication ok, switch passive mode, , when i'm trying retrieve files , folder command list respond "can't open data connection transfer of "/"". i've tried setting firewall rules ports 50100-51100 , filezilla server, it's still not working. thanks help. you cannot retrieve files on ftp protocol using telnet client. while can simulate ftp client typing ftp commands on telnet console, cannot file transfers way. it's because file transfer need separate data transfer connection, telnet client cannot do. that's why ftp se...

Parse large number of xml files in java -

i'll getting large number of xml files (numbering in tens of thousands every few minutes) mq. xml files aren't big. have extract information , save database. cannot use third party libraries unfortunately (except apache commons). strategies/techniques used in scenario? there xml parser in java or apache can handle such situations well? i might add i'm using jdk 1.4 based on comments , discussion around topic - propose consolidated solution. parsing xml files using sax - @markspace mentioned, should go sax built-in , has performance. use bulk inserts if possible - since plan insert large amount of data consider type of data reading , storing database. xml files contain same schema (which means correspond single table in database) or represent different objects (which means end inserting data multiple tables). in case schema of xml files needs inserted same table in database, consider batching these data objects , bulk-inserting them database. more perfo...

ibm bluemix - Using authentication with a hybrid app and Mobile Application Security -

i'm trying understand how authentication done w/ hybrid app (and crucial, hybrid app) , mas service. i've enabled "google sign-in". when go docs, http://mbaas-gettingstarted.ng.bluemix.net/javascript#get-started-with-security , tells when have token. so - wait - how token? there whole part missing here. supposed integrate w/ google login? build myself? , if so, supposed use token when making requests services? there not seem demo uses hybrid solution. i think need oauth credentials google in case. bluemix cannot request credential on behalf. see here how in google: https://developers.google.com/identity/protocols/openidconnect

java - Run one of two for loops -

suppose had 2 loops, each contains if , else statement, want work if first for loop achieved break , not run second loop. simple solution, help. the aim of program read user input , iterate on int given, if user doesn't input int value iterate on 100. as code working except doing both loops, want 1 or other. package coreprog; ... (...){ ... if (...) { ... } else system.out.println(...); } (...){ ... if (...) { ... } else system.out.println(...); keep boolean flag inside first loop , make true before break.based on whatever want do. example :- boolean firstconditionachieved= false; (...){ ... if (...) { firstconditionachieved = true; ... } else system.out.println(...); } second loop :- if(!firstconditionachieved){ ...... }

java - Get same field from different objects -

i want generic method in java receives object , same property no matter type of object is. for instance: have 2 objects, car , house , know these objects have attribute id . can write such method ? public void method(object x) { x.getid(); } you cannot unless use of reflection, pretty exception-prone. public void method(object o) throws nosuchfieldexception, securityexception { field idfield = o.getclass().getdeclaredfield("id"); int id = idfield.getint(o); } but common way solve such operation using polymorphism or generic method interface. public interface identifiable { public int getid(); } public <t extends identifiable> void method(t anidentifiableobject) { anidentifiableobject.getid(); } public void method(identifiable anidentifiableobject) { anidentifiableobject.getid(); }

jsf - Can we write like SQL IN clause (contains) in an EL expression -

i've below code find verbose: #{bean.value eq 's' || bean.value eq 'c'} can simplify using sql in clause? fictive example below: #{bean.value in ('s','c')} if you're using el 3.0 (java ee 7), can construct collection using #{[x,y,z]} syntax , perform contains() on it. provided desired bean property returns string (and not char or enum ), should do: #{['s','c'].contains(bean.value)} or if you're on el 2.2 (java ee 6), you've got hold values in collection (e.g. hashset ) bean property , perform contains() on it: #{bean.allowedvalues.contains(bean.value)} or if you're not on el 2.2 yet, then, well, stick initial approach, or create custom el function below: #{f:contains(bean.value, bean.allowedvalues)} see also: java ee 7 tutorial 9 expression language 9.4 operations on collection objects

How to set the legend icons of a google line chart as lines not squares -

i've been trying figure out how first chart in this jsfiddle has legend icons lines instead of squares. compared line chart legend here has squares icons. think has x axis being date, doesn't seem work data. does know how explicitly set icons of google line chart legend lines , not squares? these chart options correctly displaying line chart: var classicoptions = { title: 'average temperatures , daylight in iceland throughout year', width: 900, height: 500, // gives each series axis matches vaxes number below. series: { 0: {targetaxisindex: 0}, 1: {targetaxisindex: 1} }, vaxes: { // adds titles each axis. 0: {title: 'temps (celsius)'}, 1: {title: 'daylight'} }, haxis: { ticks: [new date(2014, 0), new date(2014, 1), new date(2014, 2), new date(2014, 3), new date(2014, 4), new date(2014, 5), new...

javascript - jquery Window Height getting same when Load and After Resize -

i trying adjust div height based on browser window height. getting same height when page/body being load , after resize browser window. function setdivheight() { var bodyheight = $(document).height(); document.getelementbyid('divname').style.height = (bodyheight - 180) + "px"; } function pageload() { setdivheight(); } window.onresize = setdivheight(); // returns height of browser viewport // use $( window ).height(); // returns height of html document $( document ).height(); example from: http://api.jquery.com/height/

r - Extract all information AFTER a comma in a data frame column -

how can extract information after comma data frame column in r? polyname south dakota,minnehaha colorado,larimer nebraska,adams nebraska,adams nebraska,adams i want return column like counties minnehaha larimer adams adams adams try df1$counties <- sub('^[^,]+,', '', df1$polyname)

ios - Uploading GPX file to Strava API with GTMHTTPFetcher POST in Objective-c -

after exploring use of strava api ( http://strava.github.io/api/v3 ) gtmhttpfetcher 2 days stuck @ uploading .gpx file account made decision ask answer here. received , stored access token necessary 'view_private,write' permission , server responding requests , managed receive , change data stored in account. when trying upload .gpx (xml) file error (bad request): the operation couldn’t completed. (com.google.httpstatus error 400.) there don't understand constructing http post request apparently , tried different approaches experimenting values in http header, changed fetch url after '/uploads?' file=... etc. no avail. authentication use gtmoauth2authentication. my code: - (void) uploadtostrava { nsstring *filepath = @"somefilepath.gpx"; nsurl *url = [nsurl urlwithstring:@"https://www.strava.com/api/v3/uploads?data_type=gpx"]; nsmutableurlrequest *request = [nsmutableurlrequest requestwithurl:url]; [request setht...

What can cause java.sql.Statement#executeBatch to return SUCCESS_NO_INFO as one of its values? -

in documentation of java.sql.statement#executebatch , states 1 of possible values of elements in returned int array can be: a value of success_no_info -- indicates command processed number of rows affected unknown so it's pretty clear value means if it. however, on particular set of queries trying execute batch (which perform updates, nothing fancy), result array of calling method contains only success_no_info values. inspires me beg question: causes successful query execution, leaves behind no information success? can't find documentation on particular topic.

c# - Compare List of Integers and add/remove the rows in database using the difference in result LinqtoSQL -

currently i'm working on project using linqtosql , simpler solution current problem. example: lets got table named example 3 rows (with values 1,2,4) in code(c#) got these values list of integer(lets name lstexisting ) in method got list of integer ( lstcurrent ) integers values (1,2,3) want compare both list , find difference of integers , update database, according example new row value 3 should added , existing row value 4 should deleted. ps:(the integer values unique , 1,2,3,4) linq solutions preferable don't mind other easier solutions. thanks you need find new items , deleted items using except like: var newitems = lstcurrent.except(lstexisting).tolist(); var tobedeleteditems = lstexisting.except(lstcurrent).tolist(); later can iterate each list , add/delete accordingly.

php - Page listing post_type pagination not working -

i created page template join posts specific post_type in 1 page, working except pagination. show right number of posts page but, in case, have 8 posts , show 5. did changes without success. ideas? <?php /* template name: news */ ?> <?php get_header(); ?> <!-- begin colleft --> <div class="container"> <main id="main" class="container" role="main"> <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts(array('paged' => get_query_var('paged'), 'posts_per_page'=>5, 'post_type'=>'our-work', 'order' => 'asc')) ?> <br><br><br> <!--header--> <div class="page-header"> <img src="www.wtk.com/img/3428245.png"> </div...

c# - Linq to SQL method defaults to ISingleResult -

i have stored procedure returns columns table (institutionentityip) maps dbml object of same name. return n number of records. however, codebehind defaults isingleresult. have return ienumerable. i'm getting error message 'the query results cannot enumerated more once.' my code looks this: //contentrepository.cs private readonly igiglobaldatacontext db; // .... public ienumerable<institutionentityip> getinstitutionentityips(long fromip, long toip) { return ip in db.institutionentityips ( (fromip >= ip.fromipinteger && fromip <= ip.toipinteger) || //from ip address parameter same or encompassed (toip >= ip.fromipinteger && toip <= ip.toipinteger) || //to ip address parameter same or encompassed (fromip <= ip.fromipinteger && toip >= ip.fromipinteger) || //any ips in db between parameters (fromip <= ip.toipinteger && toip >= ip...

java - getNextSibling() method does not return any results -

i writing code read xml files , labeling nodes. using dom java. method getnextsibling() not returning results other methods getparentnode do. problem? public node getnextsibling() the node following node. if there no such node, returns null. documentation. by way, question has been examined in topic .

qt - Add QML(QQuickView) to existing UI -

Image
currently, developing qt class needs integrated in c++ visual studio project. qt project - qt widgets application. build on qt creator 3.2.1 (opensource), based on qt 5.3.2. using visual studio 2013 professional, qt addin installed. i tried solutions on internet or other stack posts without success. don't see post duplicate since other posts didn't solve problem. i able run qml code, launches on different window. in first picture qml window (qt canvas) shown on program ui. i need integrate qml program ui. can use qgraphicsview if helps. simple qml example. canvas.qml import qtquick 2.0 rectangle { id: rectangle color: "red" width: 600 height: 600 } please have @ part of mvc implementation in project. here class visualize qml code in qt5.6. hope helps. qmlviewbase::qmlviewbase( qwindow* parent, const std::string& qmlfilepath) { this->m_pengine = qqmlengineptr( new qqmlengine() ); this->m_pview ...

.net - How to get data's from text file in c# -

i have textile contains big amount of data ,first thing have filter leaf cell data scattered on there , here.for first line filtered line beginning add gcell contains primary data,next have have related data same text file using cellid coming in same add gcell line.related datas coming in line beggining add gtrx , datas freq , trxno , ismainbcch , .in nutshell cellid common value both line add gcell , add gtrx . have done few coding in c# , got stuck somewhere here part of text file ........................... ........................... add gcell:cellid=13, cellname="nr_0702_07021_g1_a", mcc="424", mnc="02", lac=6112, ci=7021, ncc=6, bcc=0, exttp=normal_cell, iuotp=concentric_cell, eniuo=on, dbfreqbcchiuo=extra, flexmaio=off, csvsp=3, csdsp=5, pshpsp=4, pslpsvp=6, bspbcchblks=1, bspagblksres=4, bsprachblks=1, type=gsm900_dcs1800, opname="tester", vipcell=no .............................. add gtrx:trxid=11140, trxname="t_rak_j...

c# - Is it better to parse an XML at program startup, or as needed by method calls? -

i'm creating game right in c# uses xml build skills of different characters. (this file contains attributes, such damage, have been stripped in example brevity's sake.) <classes> <class name="mage"> <skill name="fireball"> </skill> </class> <class name="knight"> <skill name="slash"> </skill> </class> . . . </classes> i'm creating xmlparser class grab skills each character based on name ('xmlparser.getskillsbyname("mage")' returns list of skills). should xml file parsed @ startup of game , each set of skills assigned corresponding class type (mage, knight, etc.); or should parser called on need-to-know-basis? i.e. once player chooses class type, constructor class choice parse xml file skills associated it. currently, i've started implementing latter choice. each class type has base ty...

Scala Converting Each Array Element to String and Splitting -

i have array loaded in, , been playing around in repl can't seem work. my array looks this: record_id|string|false|1| offer_id|decimal|false|1|1,1 decision_id|decimal|false|1|1,1 offer_type_cd|integer|false|1|1,1 promo_id|decimal|false|1|1,1 pymt_method_type_cd|decimal|false|1|1,1 cs_result_id|decimal|false|1|1,1 cs_result_usage_type_cd|decimal|false|1|1,1 rate_index_type_cd|decimal|false|1|1,1 sub_product_id|decimal|false|1|1,1 campaign_id|decimal|false|1|1,1 when run command: for(i <- 0 until schema.length){ val convert = schema(i).tostring; convert.split('|').drop(2); println(convert); } it won't drop anything. not splitting on | strings immutable, , split , drop don't mutate string - return new one. you need capture result in new val val split = convert.split('|').drop(2); println(split.mkstring(" "));

javascript - How to get the value of custom HTML attribute using JQuery? -

i have repeater check boxes in each row. i'm trying check check box in row based on check box in same row. i'm executing function on onclick event of check box , function finds custom attribute of parent , checks if parent checked or not. if returned true checks check box same attribute name child class . th problem can't value of custom attribute of parent class. undefined. childid in jquery function undefined. tried using data property it's of no use . $(objid).data('chldname'); function check_view(objid) { var childid = $(objid).attr('chldname'); if ($(objid).is(':checked')) { $("[name=" + childid + "]").attr('checked', true); } } html: <td style="text-align: center"> <asp:checkbox id="cb_uploadaccess" runat="server" chldname='chld<%#eval("role_seq")%>' onclick='javascript:return check_view(this);' /> ...

dictionary - python dictionries when keys are numbers -

this question has answer here: why order in dictionaries , sets arbitrary? 5 answers i have question dictionary properties in python when keys number. in case when print dictionary number keys result of print sorted keys in other case (keys string) dictionary unordered. want know rule in dictionaries. l = {"one" : "1", "two" : "2", "three" : "3"} print(l) l = {1: "one", 2: "two", 3: "three", 4: "four", 5: "five"} print(l) l = {2: "two", 3: "three", 4: "four", 1: "one", 5: "five"} print(l) result: {'three': '3', 'two': '2', 'one': '1'} {1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five'} {1: 'one', 2:...

Twilio Bulk Messages with ShortCode throughput with C# -

i trying track down performance issue not allowing me send more 3 or message twilio c# api. in short, have windows service responds bulk 'join' messages. see following code: int = 0; datetime d = datetime.now; timespan ts = new timespan(0,0,1); foreach (customertextmessage t in o) { i++; threadinput ti = new threadinput { messageids = i, body = t.body, threadcreated = datetime.now, fromnumber = t.fromnumber }; threadpool.queueuserworkitem(new waitcallback(processresponselist), (object)ti); } the processresponselist method quick on customer, responds using method: public static void sendresponse(string number, string body) { string accountsid = configurationmanager.appsettings["accountsid"]; string authtoken = configurationmanager.appsettings["accounttoken"]; var twilio = new twiliorestclient(accountsid, authtoken); string ...

javascript - Replace multiple characters in one replace call -

very simple little question, don't quite understand how it. i need replace every instance of '_' space, , every instance of '#' nothing/empty. var string = '#please send_an_information_pack_to_the_following_address:'; i've tried this: string.replace('#','').replace('_', ' '); i don't chaining commands this, there way in one? shannon use or operator ( | ): var str = '#this #is__ __#a test###__'; str.replace(/#|_/g,''); // result: "this test" you use character class: str.replace(/[#_]/g,''); fiddle if want replace hash 1 thing , underscore another, have chain. however, add prototype: string.prototype.allreplace = function(obj) { var retstr = this; (var x in obj) { retstr = retstr.replace(new regexp(x, 'g'), obj[x]); } return retstr; }; console.log('aabbaabbcc'.allreplace({'a': 'h', 'b': ...

$location.path() vs $http.get() - AngularJS -

what difference between $location.path() , $http.get() in angularjs ? both seem working same way in application (i'm using calls in function of application's controller respond form submission) , feel i'm missing something. any appreciated. thanks. $http.get() used api call, typically retrieve data function. the $http service has functions post , put , delete , etc... http verbs included call external api. $location.path() used changing url of application, $location service can issue requests , reading/changing url of own, internal application

sockets - scan local network (router) ip addresses with computer name in android -

i saw apps scan local network computers (via router) , show computer name. when select on of them, app connects selected computer. i want make same thing. my android app(client) making connect server via tcp/ip socket ip , port put manually. but, user-friendly interface, want show them list of local computer names them select. how can make feature? if there way obtain local computer names each ip address, rest of things clear. thanks! look @ zero-configuration networking . there 2 popular implementations: microsoft upnp apple bounjour

javascript - Precompile json data and include with Ruby on Rails -

i trying precompile , use bootstrap toggle ruby on rails on heroku. here javascript console error getting when compile bootstrap-toggle.min.js.map file comes css , js files, uncaught syntaxerror: unexpected token : application-4df1877ce16cb310440b73a84d39fd58.js:14555 and error line long json object looks like, {"version":3,"file":"bootstrap-toggle.min.js", ... } why getting javascript error? and also, should have line in application.js file? //= require bootstrap-toggle.min.js.map update: if want why can't precompile json getting javascript console errors great. found work around not precompiling json @ @ including in public/assets folder. updated linked folder.

dependencies - Why the Meteor package ian:accounts-ui-bootstap-3 is behaving differently if is installed as a dependency? -

i'm trying create meteor package, has, dependency package ian:accounts-ui-bootstrap-3. added dependency in package.js this: package.onuse(function(api) { api.versionsfrom('1.1.0.2'); api.use(['ian:accounts-ui-bootstrap-3'], 'client'); api.addfiles('package-name.js'); }); after add package in console, following packages added project: accounts-base added, version 1.2.0 me:my-package-name added, version 0.0.1 handlebars added, version 1.0.3 ...

cdi - JSF Property not found exception. porperty not readable -

can out, don't it, other bean works fine, i'ts bean sucks: bean: import java.io.serializable; import java.util.list; import javax.enterprise.context.sessionscoped; import javax.inject.named; @sessionscoped @named class feedbackcontroller implements serializable { private static final long serialversionuid = 1l; private lecture lecture; private list<feedback> filteredfeedbacks; public lecture getlecture() { return lecture; } public void setlecture(lecture lecture) { this.lecture = lecture; } view: <p:datatable var="feedback" value="#{feedbackcontroller.lecture.feedbacks}" error: javax.el.propertynotfoundexception: class 'com.xxx.controller.feedbackcontroller' not have readable property 'lecture'. since i'm quite nooby subject, dont know i'm possibly doing wrong. dont get, why not possible access 'lecture' when controller @named , has pub...

image processing - 3D Feature extraction using Windows Kinect in MATLAB -

i trying extract 3d coordinates of object using kinect windows camera. object extracted highlighted either vivid color, or graphic can recognized using feature extraction. i have used matlab , kinect both feature extraction , 3d co-ordinate extraction before, having problem trying merge techniques together. a simple way highlight object, , extract feature in 2d image draw 5 circles close each other on object, put view of camera , use centercoords = imfindcircles(image, [15 20]); extract co-ordinates of circles (within radius range) in image. can remove circles in image don't have 5 similar circles in there immediate proximity, , extract co-ordinate of center circle. but how can extend idea 3d? how can extract 3d co-ordinates of highlighted object using kinect camera? to use 3-d have use depth values, , maybe combination of color edge filtering techniques well. idea use depth values of object, plus color edges feature selections. use machine learning algorithm ...

static methods - single dimensional array print through foreach loop -

how can print elements of single dimensional array via foreach loop method public class singlearrayprac { public static void main(string[] args) { int[] array = { 1, 2, 3, 4 }; // for(int row : array) way can print array want print through method, how? // system.out.println(row); (int print : array) { printrow(print); } } public static void printrow(int row) { (int print : row) { // error @ row system.out.println(print); } } } your problem lies declare printrow method. pass int should pass int[] array. causes error because trying on variable not collection of data. should so: public static void printrow(int[] row) { (int print : row) { system.out.println(print); } } now when want print array call printrow(array) array int[].

python - Pygame: Showing sprite without a group -

i have 2 sprites in class easier control (specifically: tank turret , suspension). if try launch program works without errors, doesn’t show anything. tried put both of sprites in group in class, threw error typeerror: draw() missing 1 required positional argument: 'surface' the code is: class bokstelis(pygame.sprite.sprite): def __init__(self,atvaizdas,centerx,centery,sukgreitis): pygame.sprite.sprite.__init__(self) self.nuotr=pygame.image.load(atvaizdas) self.image=self.nuotr self.rect=self.image.get_rect() self.rect.centerx=centerx self.rect.centery=centery self.sukgreitis=sukgreitis self.kryptis=0 def update(self): mousex, mousey=pygame.mouse.get_pos() self.angle = math.degrees(math.atan2(mousey - self.rect.centery, mousex - self.rect.centerx)) orig_rect=self.rect if self.angle - self.kryptis <self.sukgreitis: self.image=pygame.transform.rotate(se...

Transfer of image over network via TCP Socket in JAVA isn't working? -

i have following code. seems streaming content accurately. however, image not being captured correctly. new java. basically, c, c++, linux programmer. wondering problem reading buffer line line. missing here? here socket server code - import java.io.*; import java.net.*; public class imagesocketserver { public static void main(string args[]) throws ioexception { imagesocketserver imageserver = new imagesocketserver(); imageserver.run(); } private void run() throws ioexception { // todo auto-generated method stub serversocket serversock = new serversocket(1025); socket sock = serversock.accept(); inputstream imagetoshare = new bufferedinputstream(new fileinputstream("/export/home/joshis1/lizard.png")); printstream imagesend = new printstream( sock.getoutputstream()); imagesend.print(imagetoshare); } } here socket client code - import java.io.*; import java.net.*; public ...

d3.js - couchbase data replication elasticsearch -

i went through couchbase xcdr replication documentation, failed understand below point: 1. couchbase replicate data in bucket in batches elstic search. , elastic search provide indexing these data realtime statical data. question if data replicated elsastic search , in case elastic search database can hold huge amount of data. can replace couchbase elastic search? 2.how data in form json send d3.js display statical graph. all of data replicated elastic search, not held there default. indexes , such created, documents discarded. elastic search not database , not perform 1 , not on level of couchbase. take @ this presentation talks performance , stuff , why cochbas

php - Google Calendar API Time -

when try format 2015-05-29t19:30:00+08:00 google calendar api; return \carbon\carbon::createfromtimestamp( strtotime('2015-05-29t19:30:00+08:00') ); i result 2015-05-29 11:30:00 start date of event in google calendar 07:30pm 1 thing if try add ->diffforhumans(); result: 16 minutes ago (note: time run code 7:46pm) can me understand going on in here. instead of converting datetime unix timestamp, try directly creating datetime instance using original date format iso8601, should automatically take account timezone return carbon::createfromformat(carbon::iso8601, '2015-05-29t19:30:00+08:00');