Posts

Showing posts from July, 2014

.net - How does the compiler choose the target overload with two interface methods sharing the same signature except one is generic? -

system.collections.generic.list(of t) implements system.collections.ienumerable , system.collections.generic.ienumerable(of t) , each have getenumerator() method (respectively): function getenumerator() system.collections.ienumerator function getenumerator() system.collections.generic.ienumerator(of t) assume have mylist instance of system.collections.generic.list(of t) ; if call mylist.getenumerator() , compiler targets function getenumerator() system.collections.generic.ienumerator(of t) , function getenumerator() system.collections.ienumerator hidden intellisense list. indeed, if @ system.collections.generic.list(of t) using ilspy, latter overload missing. i want create own collection class implements 2 interfaces, have this: class myitemcollection implements system.collections.ienumerable, system.collections.generic.ienumerable(of item) private _items new system.collections.generic.list(of item) public function getenumerator() ienumerator(...

boost - Overloading of C++ functions with similar arguments -

i'm trying create 2 overloads of function takes handler argument: template <typename handler> void foo (handler h); the first overload should called if handler takes boost::asio::yield_context parameter, template <class handler> void foo (handler h, enable_if_t<is_same<result_of_t<handler (yield_context)>, void>::value>* = 0); and second 1 should called if handler takes boost::function parameter. using func_type = boost::function<void(int,int)>; template <typename handler> void foo (handler h, enable_if_t<is_same<result_of_t<handler (func_type)>, void>::value>* = 0); unfortunately not work: main.cpp:22:3: error: call 'foo' ambiguous foo ([] (func_type f) {}); ^~~ main.cpp:11:6: note: candidate function [with handler = (lambda @ main.cpp:22:8)] void foo (handler h, ^ main.cpp:16:6: note: candidate function [with handler = (lambda @ main.cpp:22:8)] void foo (handler h, ^ 1 error g...

invoke cplex variable from an other function in java -

how can invoke cplex (ilocplex cplexx = new ilocplex();) variable other function? because need use frequantly other functions cant because behaves local variable. make global variable? as such: public class myclass{ private ilocplex cplexx; public myclass(){ cplexx = new ilocplex(); } //use cplexx anywhere in myclass this.cplexx } if want use same cplex make getter adding method myclass: public ilocplex getcplexx(){ return this.cplexx; } and in other classes can go this: public class main{ public static void main(string args[]){ myclass mine = new myclass(); mine.getcplexx().solve(); //or other logic system.out.println(mine.getcplexx().getobjvalue()); } } hope helps

java - Visualize while recording using AudioRecord and Visualizer in Android Studio -

i creating android application records , saves wave file , plays back. have visualizer working when .wav file being played back. however, application visualize while recording user getting feedback , knows recording working. techniques have tried either cause program crash or don't work. appreciated. in following iteration, problem occurs when try , set visualizer while recording using recorder.getaudiosessionid(); in "setuprecordervisualizerfxandui()" method. makes program crash when hit record button. same technique works flawlessly on playback using mplayer.getaudiosessionid(); in setupplaybackvisualizerfxandui() method. the following main activity: package beebros.androidaudiovisualizer; import android.content.pm.packagemanager; import android.graphics.canvas; import android.graphics.color; import android.media.audioformat; import android.media.audiorecord; import android.media.audiotrack; import android.media.mediarecorder; import android.net.uri; imp...

c# - TreeNode stack Depth First Search -

i saw topic: depth first search without stack [closed]. have question related function. want use stack. c# beginner , wondering if can explain me in detail 1) following program goal , 2) expected output. void foo(treenode root) { stack nodes = new stack(); nodes.push(root); while (nodes.count > 0) { treenode node = (treenode) nodes.pop(); console.writeline(node.text); (int = node.nodes.count - 1; >= 0; i--) nodes.push(node.nodes[i]); } } try it. foo(new treenode() { text = "test", nodes = new list<treenode>() { new treenode(){text = "a"}, new treenode(){ text = "b", nodes = new list<treenode>() { new treenode(){text = "c"}, new treenode(){text = "d"}, ...

jsf - How to pre-select data in h:selectManyListbox -

this question has answer here: how uiselectone , uiselectmany components preselect defaults in f:selectitems 1 answer this common problem , saw basic solution (populate selectmanylistbox ). here code of jsf 1.2 page: <h:selectmanylistbox id="statusmenu" converter="statusconverter" value="#{aprvaction.ap.statuses}" > <f:selectitems id="statusitem" value="#{action.ap.statusitens}"/> <a:support event="onclick" ajaxsingle="true" immediate="true" eventsqueue="queuegeral" /> <a:support event="onchange" ajaxsingle="true" eventsqueue="queuegeral" process="statusmenu"/> </h:selectmanylistbox> the thing #{aprvaction.ap.statuses} instance of list<status> class. however, in tag <f:selectitems...

c# - EF Model First and Database First Alternatives? -

since msft has officially abandoned model first , database first, have alternative suggestions functionality? 1 considering devart entity developer. can else suggest other alternatives should consider? a while before msft announced dropping database first, considering using sparx ea maintain database, use ef database first update model database, refuse acknowledge need generate code first design model though database first no longer supported ef. ea generate poco classes, not codefirst variant, , don't want update hand. as per link, not removing database first design, code-first name means database represented set of poco c# objects, rather xml + designer. they have remvoed designer , .edmx file. can still ` reverse engineer database create entities. from link: for code first can re-run reverse engineer process , have regenerate model. works fine in basic scenarios, have careful how customize model otherwise changes reverted when code re-generated. there ...

JavaScript NaN with HTML -

i'm trying create small maths game code below, keep getting not-a-number error everytime prompt comes up. i'm not entirely sure problem is. have tried round number doesn't situation. point me in right direction? function start() { // define questions var question = []; // define answers var answer = []; // store user input var input = []; var score = 0; // when user enters answer stored input every prompt for(var = 0; < 10; i++) { var randnum = math.floor(math.random() * 100); var operator = [ '+', '-', '*', '/' ]; var ops = [math.floor(math.random() * operator.length)]; question[i] = randnum + ops[operator] + randnum; answer[i] = randnum + ops[operator] + randnum; input[i] = prompt(question[i]); } // check answer against stored answer, display 1 of either if statement for(var = 0; < answer.length; i++) { if (answer[i] == input[i]) { ...

JAVASCRIPT - "Code inside event" timeout? o.O -

i have event inside page window.addeventlistener("load", function(){ var load_screen = document.getelementbyid("load_screen"); document.getelementsbytagname("body")[0].setattribute("class", "loaded"); }) wich adds attribute body class="loaded" when page loaded because of added cool preloader effect i'd make event wait 3-5 seconds before showing real page, if loaded (but of course wait more if not loaded). possible in way? if want delay minimum of 5 seconds, can capture time @ point establish event handler (i.e., before "load" event has fired), , check time again in handler. var starttime = date.now(); window.addeventlistener("load", function(){ var load_screen = document.getelementbyid("load_screen"); settimeout(function() { document.getelementsbytagname("body")[0].setattribute("class", "load...

ruby on rails 4 - Can't get has_many & belongs_to in same model to work -

it has been while since asked around here. since have started playing around ruby, , can't head around this, decided come here guidance. i've read quite few examples now, don't find proper path walk solve problem. the idea following : you have : a family a person their relationship following : there 1 person 'head' of family every person part of family (be multiple persons or himself in it) now current validation makes impossible perform this, idea there no such thing family without head, , no person without family. i've tried express following way : family class class family < activerecord::base validates :head_id, presence: true belongs_to :head, :class_name => person, foreign_key: 'head_id' has_many :persons end person class class person < activerecord::base validates :family_id, presence: true validates :first_name, presence: true belongs_to :family end would soul kind offer me advice...

javascript - Get Z-index of each element on the page -

i trying find highest z-index on page. using this var getstyleprop = function(el, prop){ return window.getcomputedstyle(el, null).getpropertyvalue(prop); } var gethighestzindex = function(){ var highestzindex = 0, htmlelems = ["a","abbr","acronym","address","applet","area","article","audio","b","base","basefont","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em...

jquery - How to get JSON POST data in ASP.NET Web Forms? -

i have jquery posting data onto 1 of web pages. right i'm trying post json test out, can't figure out have data in back-end once it's posted. i've used request.params posted data, doesn't seem working time. this code i'm using post: // data testing purposes, doesn't var person = { name: "bob", address: "123 main st.", phone: "555-5555" } var jqxhr = $.ajax({ type: "post", url: "/example/mypage.aspx", contenttype: 'application/json; charset=utf-8', datatype: "json", timeout: 0, success: function () { alert("success"); }, error: function (xhr, status, error) { alert(error); }, data: person }); the post successful though, can see using fiddler, plus when check request.contentlength returns right number of bytes posted. but can't find actual data anywhere. ideas on i'm doing wrong? thanks i...

android - How to listen for HDMI-CEC media controls events in receiver -

google announced chromecast supports hdmi-cec controls. https://plus.google.com/+leonnicholls/posts/fygejavgmx3 i implement functionality in app. have tested youtube , tv , works. how can implement same thing in receiver portion of chromecast app? have tried listening key events, doesn't seem pick up. ideas? as long use media manager on receiver side (the recommended approach), shouldn't need special.

oop - What are the differences between Object Collections, Object Aggregates, Object Associations, and Object Composition? -

i'm seeing these terms used , i'm thinking own usage of them may incorrect. i'm wondering how different. object collection - ??? object aggregation - ??? object association - ??? object composition - ??? it seems these terms come lately when talking orms, data-mappers, , repositories. example, fowler mentions object collections here . these terms mean specifically, , how should use them in speaking? object collections is more broader term, "arrays", but, includes "arrays". collections objects themselves, main goal store several other objects, plus other features depends on each collection kind, such order of insertion, or order of extraction, if duplicated items allowed, , on. object association is also, generic term, implies there conceptual relationship between 2 objects. there also, several kinds of "associations", more specific goals. object aggregation is object association in object related object. can...

java - Intercept url in spring security -

i'm trying understand how uel-interception works in spring security. let assume write following rule in our security config: <security:intercept-url pattern="/secure/super/**" access="role_we_dont_have"/> my question is spring security going create object of abstractsecurityinterceptor or what? need understand because if assumption creation object each rule right i'm going create instances dynamically myself in order control authentication rule dynamically in runtime. basically spring security create 1 instance of filtersecurityinterceptor filter read url pattern , try protected mapped url more information here spring security core

java - give a default value for an attribute if the value is null in json by jackson -

suppose have class i.e. private class student { private integer x = 1000; public integer getx() { return x; } public void setx(integer x) { this.x = x; } } now suppose json "{x:12}" , doing deserialization x have value 12 . if json "{}" value of x = 1000 (get default value of attribute declared in class). now if json "{x:null}" value of x becomes null here in case want value of x 1000 . how via jackson . in advance. i deserializing via below method, if helps in anyway: objectmapper.readvalue(<json string goes here>, student.class); you should able override setter. add @jsonproperty(value="x") annotations getter , setter let jackson know use them: private class student { private static final integer default_x = 1000; private integer x = default_x; @jsonproperty(value="x") public integer getx() { return x;...

jenkins : cppcheck not running -

i trying launch cppcheck tepp project under jenkins environment, system win7-x64: i installed cppcheck.exe under c:\program files (x86)\jenkins\cppcheck jenkins config, shell exec path : c:\windows\system32\cmd.exe as documentation suggested, jenkins launches cppcheck analysis following : i add "execute shell script" task "c:\program files (x86)\jenkins\cppcheck\cppcheck.exe" -j 8 --enable=all --inconclusive --xml --xml-version=2 tepp 2> tepp/tepp-cppcheck.xml the ouput : [tepp] $ c:\windows\system32\cmd.exe -xe c:\windows\temp\hudson3799822801570258901.sh microsoft windows [version 6.1.7601] copyright (c) 2009 microsoft corporation. tous droits r‚serv‚s. c:\program files (x86)\jenkins\workspace\tepp>finished: success no xml output file, nothing in logs, quiet failed. when execute command line under cmd windows, works fine : bunch of logs, big xml file generated ... did missed ? cppcheck must invoked via "windows batch...

syntax - Can this be interpreted as an invocation expression in C#? -

according c# grammar, 1 can write (a)(b) which can interpreted either invocation expression or type cast. can please provide valid c# example interprets case invocation expression? this grammar rule i'm referring to: invocation-expression: primary-expression ( argument-list? ) and primariy-expression can parenthesised expression. like this? ((action<string>)console.writeline)("test"); or this, expression: ((func<int>)console.read)() edit: doubt there way primary-expression simple identifier, gets parsed cast (even (writeline)() ), it's not big deal, can remove parentheses.

android - Recyclerview make the last added item be the selected item? -

i have horizontal recyclerview displays bitmaps. way implemented have imageview , recyclerview underneath it. selected item displayed on image view. selected image view given blue background indicate selected. can choose images gallery , each time new image selected, want scroll last position , make item selected. the list of images maintained in array list , each time new image added, add image list , notifydatachanged(). currently when binding view, toggle visibility of blue background in public void onbindviewholder(final myrecyclerviewholder holder, int position) { } but problem is, if child off screen, bind view not called , dont scroll new position. read through documentation of recycler view , not figure out how scroll particular child view. not there smoothscrollto method question trigger ? there 1 solution: in recyclerview adapter, add variable selecteditem , methods setselecteditem() : private static int selecteditem = -1; ... ... public void ...

ember.js - How do I customize the view element for the application.hbs template? -

in app generated ember-cli, html generated application.hbs wrapped in view: <body class="ember-application"> <div id="ember284" class="ember-view"> </div> </body> if create component, have component-name.js file can specify options modify component: export default ember.component.extend({ tagname: 'nav', classnames: ['main-menu'], layout: layout }); how modify attributes of element wrapping application.hbs template? create file in app/views directory follows naming conventions , application.js import ember "ember"; export default ember.view.extend({ classnames: ['my-app-view'] // application view }); now confirm works inspecting html: <body class="ember-application"> <div id="ember287" class="ember-view my-app-view"> <h2 id="title">welcome ember.js</h2> </div> </body>

javascript - how to compare 2 times in 24 hour format to check if 1 time is before another time -

i have time strings in 24 hour format 20:50 , 23:00 now want make method in javascript determine if 1 time earlier othertime. have done in php so: function islater($time1, $time2) { $time1 = new datetime($time1); $time2 = new datetime($time2); if ($time1 > $time2) { return true; } return false; } function isearlier($time1, $time2) { $time1 = new datetime($time1); $time2 = new datetime($time2); if ($time1 < $time2) { return true; } return false; } my question is, best approach in javascript? using same structure have done in php, this: function islater(time1, time2) { if (time1 > time2) { return true; } return false; } function isearlier(time1, time2) { if (time1 < time2) { return true; } return false; } because javascript consider "a" less "b" , "2" less "3", there no need convert datetime. if want make code shorter, make function this: function islater(time1,...

(MongoDB Java Driver (3.0.0-rc0)) UnknownHostException & Authentication -

recently started using new mongodb java driver (3.0.0-rc0). @ moment have 2 problems. the serveraddress class isn't throwing unknownhostexception anymore, used exception determine if connection succeed or not, should use now? the db class became mongodatabase class. when db class wasn't deprecated used authenticate(string username, char[] password) authenticate, need use mongocredential class, how check if authentication succeed or not? with regards, julian v.d berkmortel the 3.0 java driver takes position host names aren't in dns unreachable hosts incorrect authentication credentials are severe application configuration errors require human intervention , therefore surfaced in api indirectly through exceptions thrown in course of normal use of driver. so in both these cases driver throw mongotimeoutexception method needs connect mongodb server. exception include message indicating root cause of connection failure. instance, following ...

XPath 1.0 date comparison with different date formats -

there several threads similar questions haven’t found one: what’s best way compare dates in xpath 1.0 when have different formats? example: <?xml version="1.0" encoding="utf-8"?> <entries> <entry date="2010-11-22" format="yyyy-mm-dd" /> <entry date="12.03.2014" format="dd.mm.yyyy" /> <entry date="09/30/14" format="mm/dd/yy" /> </entries> i want find entries date > 03/03/14. there tricks split strings , reorder chunks according format line , perform translate() trick afterwards?

javascript - Jquery .each, but only that current element -

i'm using following script $('.cat_glass_thumbs ul li').each(function(){ $(this).click(function(){ orig_src = $(this).attr('data-orig'); $('.cat_glass_thumbs img').attr('src', orig_src); }); }); i have loop outputs multiple divs, of them same structure, different content. right jquery works ".cat_glass_thumbs" div, if flick on li, update src in every .cat_glass_thumb, instead of updating 1 in. tips/pointers appreciated html of each reference: <div class="cat_glass_thumbs"> <a href="" title="black/silver" class="product-image thumbnail"> <span class="main_image"> <img src="t/2064-a-blk-slv-52-angle.jpg" alt="black/silver"> </span> </a> <ul id="thumbs_container"> <li class="img_thumbs" data-orig="...

javascript - SlickGrid w/ DataView not immediately reflecting changes in underlying data -

i have following code builds grid using slickgrid.js. var grid; var griddataview; var gridoptions = { enablecellnavigation: true, enablecolumnreorder: true, forcefitcolumns: false, toppanelheight: 25 }; function creategrid(data) { griddataview = new slick.data.dataview({ inlinefilters: true }); grid = new slick.grid("#grid", griddataview, data.columns, gridoptions); grid.setselectionmodel(new slick.rowselectionmodel()); var pager = new slick.controls.pager(griddataview, grid, $("#pager")); var columnpicker = new slick.controls.columnpicker(data.columns, grid, gridoptions); grid.onsort.subscribe(function (e, args) { sortdir = args.sortasc ? 1 : -1; sortcol = args.sortcol.field; // using native sort comparer // preferred method can slow in ie huge datasets griddataview.sort(comparer, args.sortasc); }); // if don't want items not visible (due being filtered out // o...

encode - Python string to bytearray and back -

how can convert human readable string bytearray , back? say have "hello world" , want bytearray , bytearray same string? you can use bytearray() : b_array = bytearray('yoyo') elem in b_array: print elem to convert b_array string format use .decode() : for elem in b_array.decode(): print elem

html - Flexslider viewport won't resize height when viewing shorter image in slideshow -

by default flexslider supposed resize viewport height according height of current image being displayed. on site flexslider fixed @ height of largest image in slideshow, leaving shorter images blank white space beneath them. doing override responsive height function of flexslider? there way fix this? live draft: http://parkerrichard.com/studiogreen/html/residential/project-01.html html: <div class="flexslider"> <div class="arrows"> <img src="../img/arrow-left.png" class="arrow-left pull-left"> <img src="../img/arrow-right.png" class="arrow-right pull-right"> </div> <ul class="slides" id="slideshow" ondragstart="return false;"> <li> <img src="../img/residential/proje...

c++ - Pointers to multidimensional arrays -

this question has answer here: c pointer array/array of pointers disambiguation 11 answers what difference between int *p1[m][n] and int (*p2)[m][n] also if define such pointer int (*p3)[m][n][k] what represent? if can explain differences between above three, helpful. it helps know can read c declaration using alternating right-and-left fashion. direct answer question is: int *p1[m][n] array of arrays of pointers-to-ints. int (*p2)[m][n] pointer array of arrays of ints. int (*p3)[m][n][k] pointer array of arrays of arrays of integers. you can think of these using standard "2d" or "3d" terminology, 2d array table first set of brackets indicating row , second set of brackets indicating column. not 100% faithful way computer works, it's highly effective mental model. going how decipher complicated c declarations: yo...

c# - How can I create instance of a type and set member values by name? -

i read xml list of commands, each command one <read id="3" locationid="21"/> or <transform transformid="45" source="string"/> and in xml deserializer i'm @ point i'm setting command objects , getting them ready execution. type ctype = assembly.getexecutingassembly().gettype("processing." + command.name.tostring()); icommand commandobject = activator.createinstance(ctype); when use activator.createinstance, there way assign members called 'id' , 'locationid' values 3 , 21? don't know in advance icommand on , each icommand has different members (except share 1 method) like maybe (pseudocode) commandobject = activator.createinstance(ctype); foreach( xmlattribute attribute in element){ commandobject <- setclassmember(attribute.name, attribute.value) } dynamic variable types resolved in runtime already, if know commands contain id , locationid properties can like: ...

How would I hide inno Ready MemoType? -

how can hide `readymemotype, not hide or disable whole ready page? can't find in docs. on ready install page, part says setup type: custom. part hide. text in default.isl "readymemotype", don't want edit says. want hide or disable it. on inno newsgroup, said: "in [code], event function updatereadymemo called individual text fragments. append these (with appropriate newlines) in whatever order wish, omitting whatever wish, , adding information wish." i have no idea means. you can build content of readymemo updatereadymemo event method, passed parameters information stuff installed. includes setup type, passed memotypeinfo parameter, exclude information memo can concatenate string without parameter, example: [code] function updatereadymemo(space, newline, memouserinfoinfo, memodirinfo, memotypeinfo, memocomponentsinfo, memogroupinfo, memotasksinfo: string): string; begin // memotypeinfo parameter value not included in stri...

r - Polygon to Raster not as expected: Missing Values and Polygon Border Retained? -

Image
folks, i'm in need of expert opinions. i've spent majority of day fighting problem , out of options. i trying create map depicts time since last fire across landscape obviously spots have never had fire, represented 0 here, it's arbitrary my code see below: data can found here #example library(rgdal) library(raster) library(plotkml) ##load data fire <- readogr(dsn="***yourpathhere******/h_fire_poly_jan3_2105", "fire_poly_kootclip") ##build raster1 r<-raster(res=300,extent(fire)) pop<-rasterize(fire,r,"fire_year",fun="max",na.rm=true,background=2015) pop<-projectraster(pop,res=300, crs="+proj=utm +zone=11 +ellps=grs80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs") plot(pop) ##build raster 2 background<-raster(extent(pop),res=300,vals=2015) projection(background)<-crs(proj4string(pop)) ##make sure plot(background) plot(pop,add=t) ##algebra final<-background-pop ##plot plot(final) #...

javascript string.replace $1 if it is a certain value? -

is there way check value of $1 , if equal "left" replace "newleft" ? something this: str.replace(re, 'blah blah $2, $1="left" ? "newleft": "something" '); if pass callback function second argument of the string place method , captured strings regular expression passed arguments callback function. can use these arguments return new string, , perform necessary logic on captured strings. example 1: 'left, right'.replace(/(.*),\s(.*)/, function(match, p1, p2) { return 'blah blah ' + p2 + ', ' + (p1 === 'left' ? 'newleft' : 'something'); }); response: "blah blah right, newleft" example 2: 'top, right'.replace(/(.*),\s(.*)/, function(match, p1, p2) { return 'blah blah ' + p2 + ', ' + (p1 === 'left' ? 'newleft' : 'something'); }); response: "blah blah right, something"

verilog - Synopsys Design Compiler and PrimeTime timing analysis report remain same -

i had done timing analysis of counter in both synopsys design compiler , primetime, got same output! problem ? then how primetime timing analysis become more accurate dc? design file used counter.v , given below. module counter ( out, clk, reset ) ; input clk, reset; output [3:0] out; reg [3:0] out; wire [3:0] next; // statement implements reset , increment assign next = reset ? 4'b0 : (out + 4'b1); // implements flip-flops @ ( posedge clk ) begin out <= #1 next; end endmodule // counter design compiler output generated giving input counter.v , , clock period of 2 .the design compiler output shown below. write_sdf ${name}.sdf information: annotated 'cell' delays assumed include load delay. (uid-282) information: writing timing information file '/home/student/labs/jithin_prjct/jith/count.sdf'. (wt-3) information: updating design information... (uid-85) 1 create_clock clk -period 2 1 re...

python - PyAPNs and the need to Sleep between Sends -

i using pyapns send notifications ios devices. sending groups of notifications @ once. if of tokens bad reason, process stop. result using enhanced setup , following method: apns.gateway_server.register_response_listener i use track token problem , pick there sending rest. issue when sending way trap these errors use sleep timer between token sends. example: for x in self.retryapnlist: apns.gateway_server.send_notification(x, payload, identifier = token) time.sleep(0.5) if don't use sleep timer no errors caught , entire apn list not sent process stops when there bad token. however, sleep timer arbitrary. .5 seconds enough while other times have had set 1. in no case has worked without sleep delay being added. doing slows down web calls , feels less bullet proof enter random sleep times. any suggestions how can work without delay between apn calls or there best practice delay needed? adding more code due request made below. here 3 methods inside of c...

semantics - Protege SWRL rules -

Image
i've been trying define rules in ontology infer if person has friends friends amongst each other friends, if 1 or more not friends each other ontology infer all, not friends. thank you you need intended semantics straightened out little bit more. from gather, want isfriendwith @ least symmetric, i.e. when isfriendwith(bob, alice) isfriendwith(alice, bob) . also, if want have friendsall have meaning, isfriendwith cannot transitive. capture natural meaning, friend of friend not friend. to elaborate: if isfriendwith symmetric , transitive every friend of bob automatically friend of of bob's friends (because isfriendwith(bob, alice) implies isfriendwith(alice, bob) . there on, isfriendwith(bob, carol) transitivity implies isfriendwith(alice, carol) . if isfriendwith symmetric , transitive, clique automatically. but stated, not, want. as formulating in swrl , let's give try, shall we? friendsall reflexive , i.e. let's assume his/her ...

ios - Passing data between View Controllers using segues. Not working -

i have attempted pass integer value using segue 1 view controller another. used thread me: passing data between view controllers . so followed steps top question, declared integer in view controller receiving info's header, , likewise imported header view controller sending info's header. created modal segue though both create integer's value , present second view controller. presents second view controller. in addition when close app freezes whole phone! -(void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender{ if([segue.identifier isequaltostring:@"usecheat"]){ begin *controller = (begin *)segue.destinationviewcontroller; // warning report here says, "unused variable 'controller'". not figure out fix. if (codeforallactive == yes) { score = 10; } else if (codeforoneactive == yes) { score = 9999975; } } } as can see, usecheat segue identifier. begin view ...

c++ - Having trouble formatting code to solve for Standard Deviation of a 2D array -

most of code program completed. need standard deviation. when run program, compiles , gives me values, think std value not correct. don't think using arr[rows][cols] best way go it, used anyway show of values in array. think giving me incorrect output. how fix it? use different way show each value, how? loop should run 24 times. each time use number[0] - average , keep , add number[1] - average way till hits max amount of numbers in array. here formula standard deviation. s standard deviation. m mean or average. -----> have double average m n number of values in array. -------> have max_values equal n. * x each value in array. 89 93 23 89 78 99 95 21 87 92 90 89 94 88 65 44 89 91 77 92 97 68 74 82 //to calculate standard deviation of 2-d array double getstandarddeviation(int arr[rows][cols], double &std, double average, int num, const int max_values) { double devsum = 0; //sum of every value in array minus average squared (int x = 0; x ...

Parse error: syntax error, unexpected '.1' (T_DNUMBER) in C:\webserver\function\GrabStatus.php on line 7 -

i'm getting error parse error: syntax error, unexpected '.1' (t_dnumber) in c:\webserver\function\grabstatus.php on line 7 in websites php minecraft server ping script here's code i'm using: <?php $settings = parse_ini_file('../db.ini',true); $ipandport = explode(':',$settings['mcserver']['ip']); if(empty($ipandport[1])) { $ipandport[1] = 192.168.1.33:27747; } // edit -> define( 'mq_server_addr', $ipandport[0]); define( 'mq_server_port', $ipandport[1]); define( 'mq_timeout', 1 ); // edit <- // display in browser, because people can't in logs errors error_reporting( e_all | e_strict ); ini_set( 'display_errors', true ); require __dir__ . '/minecraftserverping.php'; $timer = microtime( true ); $info = false; $query = null; try { $query = new minecraftping( mq_server_addr, mq_server_port, mq_timeout ); $info = $query->query( ); if( $info === false ) ...