Posts

Showing posts from April, 2014

Negative Lookahead for Regex -

what difference between: ^(?!.*baa)[abc]*$ and ^(?!baa)[abc]*$ what role of .* . know means character 0 or more times why second 1 capture strings cccaabaa should discarded? the difference between them is: ^(?!.*baa) requires baa not anywhere in input ^(?!baa) requires baa not @ the start of input the .* allows between start ^ , baa .

php - Warning: mysqli_select_db() expects exactly 2 parameters, 1 given in -

im beginner , diploma student... have created database using localhost... im having problem viewing database... please me... hope u can me full code... error... warning: mysqli_select_db() expects 2 parameters, 1 given in c:\xampp\htdocs\slr\view s110 pc01.php on line 10 cannot select db this code... <?php $host="localhost"; // host name $username="root"; // mysql username $password=""; // mysql password $db_name="slr"; // database name $tbl_name="s110_pc01"; // table name // connect server , select databse. mysqli_connect("$host", "$username", "$password")or die("cannot connect"); mysqli_select_db("$db_name")or die("cannot select db"); $sql="select * $tbl_name"; $result=mysqli_query($sql); $count=mysqli_num_rows($result); ?> <table width="400" border="0" cellspacing="1" cellpadding="0"> <tr...

No database selected error mysql php -

i trying connect website database "no database selected" error, tried finding solution did not find anything. code is: <?php define('db_name', 'test'); define('db_uesr', '********'); define('db_password', '********'); define('db_host', '********'); $link = mysql_connect(db_host, db_uesr, db_password); if (!$link) { die('could not connect: ' . mysql_error()); } $db_selected = mysql_select_db(db_name, $link); if (!db_selected) { die('can\'t use name' . db_name . ' : ' . mysql_error()); } echo 'connected '; $value = $_post['naam']; $sql = "insert naam (test) values ('$value')"; if (!mysql_query($sql)) { die('error: ' . mysql_error()); } echo 'uploaded '; ?> the exact massage thad displayed on page is: connected error: ...

visual studio 2012 - Using ZeroMQ in VS2012 C++ -

so installed zeromq in python(and it's working) can't in visual studio 2012 c++. downloaded windows installer, installed , searched in installation folder is: -an "include" folder 2 header files copied vs include -a "lib" folder 3 lib files , 3 pdb files copied vs lib -a "bin" folder copied vs bin after this, tried use zmq::context_t... , zmq::socket_t... couldn't it, said zmq had class in order me use namespace. tried add libraries dependencies , still couldn't it. so, after, copied this zmqhpp.h file imported other header file want create socket. says "1>pythonplugin2.obj : error lnk2019: unresolved external symbol __imp__zmq_close referenced in function "public: void __thiscall zmq::socket_t::close(void)" (?close@socket_t@zmq@@qaexxz)" , bunch of other "unresolved" problems(12 more exact) what's happening guys? i'm on windows 7 x-64 , on visual studio 2012 c++ thank guys ed...

javascript - How to console.log in webgl shaders? -

i'm trying understand how simulate console.log in webgl shaders written in glsl. it's easy error messages can't how print custom messages. basically want print stuff in browser's console: <script id="shader-fs1" type="x-shader/x-fragment"> void main(void) { //console.log doesn't work here since it's glsl not javascript gl_fragcolor = vec4(0.0, 0.0, 0.0, 1.0); } </script> any suggestions? not sure if possible, may want check out the webgl inspector library debugging purposes.

php - ZF2 Navigation: Set UL id attribute -

i'm trying use navigation build menu. however, need set id tag <ul class="sf-menu" id="nav"> <li class="active"> <a href="/">home</a> </li> <li> <a href="/api">api</a> </li> <li> <a href="/a">baker , spice</a> </li> </ul> ' but, can't seem this. i tried build html using foreach <?php foreach ($this->container $page){ } ?> it not doing because $this->container showing null. please advice! thanks in advance, justin if in view can call echo $this->navigation('navigation')->menu(); and outputs menu correctly, must wanting create custom menu using partial view script (hence why you're using $this->container otherwise not set). make sure you've got this: echo $this->navigation('navigation')->menu() ...

Thymeleaf Neither BindingResult nor plain target object for bean name 'person' available as request attribute -

from can tell set correctly getting following error: java.lang.illegalstateexception: neither bindingresult nor plain target object bean name 'person' available request attribute form <form action="#" th:action="@{/person}" th:object="${person}" method="post" th:required="required"> <input type="text" th:field="*{subject}" class="contact col-md-6" placeholder="name *" th:required="required"/> <input type="text" th:field="*{name}" class="contact col-md-6" placeholder="name *" th:required="required"/> <input type="text" th:field="*{lastname}" class="contact col-md-6" placeholder="name *" th:required="required"/> <input type="email" th:field="*{email}" class="...

bash - How to Turn Off a Program Running from .bash_profile -

i working raspberry pi running linux, , have modified .bash_profile file in order run program i've made automatically upon login. works great, wondering how turn program off, since ctrl+c need running program in terminal. you can use kill terminate program process id, top command list processes, can use pkill, terminate process name. -9 option forces process shut down, commonly used. example: kill -9 "process id without quotation marks" pkill -9 "name quotation marks (case sensitive)" check this .

How to check if I have the username in database C#? -

this question has answer here: check if record in table exist in database through executenonquery 5 answers i'm new in c# , databases. made database in add data person. actually, data person create account. checked if email have email structure , checked if password same retype password. here have code: if (pass.text != rpass.text) { messagebox.show("password don't match!"); return; } string emailcheck = email.text; bool valid = false; int count_dot = 0; (int = 0; < emailcheck.length; i++) if (emailcheck[i] == '@') valid = true; else if (emailcheck[i] == '.') count_dot++; if (valid == false || count_dot == 0) { messagebox.show("invalid email!"); return; } con = new s...

python - Adding custom dir to PYTHONPATH -

i've been trying add custom directory pythonpath following advice on post permanently add directory pythonpath . i'm using bash on mac, if that's relevant. did: open ~/.bash_profile export pythonpath="${pythonpath}:/users/zhengnan/library/python/2.7/lib/python/site-packages" , save source ~/.bash_profile there 2 problems: when ran sys.path inside python ide, intended dir still didn't show up. when fired python in terminal , ran sys.path there, dir did show up, other directories didn't match got previous step. specifically, got running sys.path inside ide. intended dir couldn't found. sys.path ['', '/applications/spyder-py2.app/contents/resources', '/applications/spyder-py2.app/contents/resources/lib/python27.zip', '/applications/spyder-py2.app/contents/resources/lib/python2.7', '/applications/spyder-py2.app/contents/resources/lib/python2.7/pla...

amazon web services - Django translation does not work in deployment -

the translation works on own computer, when website deployed aws elastic beanstalk, not work anymore... i have followed django v1.9 documentation. mark translation string {% trans %}, generate message file , compile it, add locale path , middleware in settings.py file. middleware classes: middleware_classes = [ 'django.middleware.security.securitymiddleware', 'django.contrib.sessions.middleware.sessionmiddleware', 'django.middleware.locale.localemiddleware', 'django.middleware.common.commonmiddleware', 'django.middleware.csrf.csrfviewmiddleware', 'django.contrib.auth.middleware.authenticationmiddleware', 'django.contrib.auth.middleware.sessionauthenticationmiddleware', 'django.contrib.messages.middleware.messagemiddleware', 'django.middleware.clickjacking.xframeoptionsmiddleware', ] locale path: (i tried different path, directories contain identical message files.) locale_paths = [ os.path.join(base_d...

android - How to do sliding menu from right to left -

i searching sliding example, but still couldn't find right left sliding example. please can 1 give sample project sliding menu right left slide menu can done using animation classes //declare inside activity private linearlayout slidingpanel; private boolean isexpanded; private displaymetrics metrics; //private listview listview; private relativelayout headerpanel,menupanel; private int panelwidth; private imageview menuviewbutton; framelayout.layoutparams menupanelparameters; framelayout.layoutparams slidingpanelparameters; linearlayout.layoutparams headerpanelparameters ; linearlayout.layoutparams listviewparameters; //initialize inside oncreate metrics = new displaymetrics(); getwindowmanager().getdefaultdisplay().getmetrics(metrics); panelwidth = (int) ((metrics.widthpixels)*0.45); headerpane...

SQL Trigger showing error -

i created 2 tables 1 name courses create statement follows: create table courses ( cid int, cname varchar(25), depid int, no_sems int, primary key(cid), foreign key(depid) references departments ); another name departments follows: create table departments ( did int, dname varchar(20), hod_id int, no_courses int, primary key (did) ); i wanted increment no_courses when course added courses table. hence created following trigger: create trigger courseinc after insert on courses referencing new newcourse update department set no_courses = no_courses + 1 did = newcourse.depid but keep getting message this: error @ line 1: pls-00103: encountered symbol ";" when expecting 1 of following: begin case declare end exception exit goto if loop mod null pragma raise return select update while with << close current delete fetch lock insert open rollback savepoint set sql exec...

java - I don't know where my String index out of range: 0 error is coming from -

i'm trying take data out of txt file , create comparable objects out of data , add them array. after array created, want make 2d array stores 1 in slot if 2 options meet requirements. keep getting string index out of range: 0 error though , not know comes from. import java.util.*; import java.io.*; public class coursescheduler { public int numberofcourses; public int[][] adjacent; public course[] courses; public coursescheduler(string filename) { file file = new file(filename); try{ scanner scan = new scanner(file); numberofcourses = scan.nextint(); courses = new course[numberofcourses]; adjacent = new int[numberofcourses][numberofcourses]; scan.usedelimiter(",|\\n"); for(int = 0; < numberofcourses;i ++){ if(scan.hasnext()){ string dept = scan.next(); string num = scan.next(); string building = scan.next(); string room = scan.next(); string instruct = scan.next(...

vagrant - Laravel homestead git clone not working -

i have git cloned existing project vagrant homestead machine, have setup homestead.yaml , hosts file , run vagrant provision, first got error: warning: require(/home/vagrant/projects/myproject/bootstrap/../vendor/autoload.php): failed open stream: no such file or directory in /home/vagrant/projects/myproject/bootstrap/autoload.php on line 17 after looking around saw alot of times solution run composer install or composer update i did that, got error after that: whoops, looks went wrong. in console checked says: failed load resource: server responded status of 500 (internal server error) delete composer.lock , run composer install again.

java - Oauth2.0 auhtorization server configuration -

i'm creating protected rest apis based on oauth2.0 framework. i built authorization server , resource server successfully. the authorizationserver extends authorizationserverconfigureradapter , overrides methods, i'm facing problem extended method public void configure(clientdetailsserviceconfigurer clients) throws exception {} here explanation when i'm running version of config() authorization server @override public void configure(clientdetailsserviceconfigurer clients) throws exception { clients.inmemory().withclient("clientapp").authorizedgranttypes("password", "refresh_token") .scopes("read", "write").resourceids(resource_id).secret("123456"); } this method works fine , returns access_token when ask it. but when ran same method enhancements, got nothing when asked access_token 401 unauthorized http response. public void configure(clientdet...

rust - Error: not all control paths return a value [E0269] -

i newbie of rust. here code find indices of 2 numbers such add specific target. use std::collections::hashmap; fn two_sum(nums: &[i32], target: i32) -> [usize;2] { let mut map: hashmap<i32, usize> = hashmap::new(); in 0..nums.len() { let want = target - nums[i]; match map.get(&nums[i]) { some(&seen) => return [seen, i], _ => map.insert(want, i), }; } [0usize, 0usize]; } fn main() { let nums = [1,3,7,4]; let res = two_sum(&nums, 10); println! ("{},{}", res[0], res[1]); } i got error below src/bin/2sum.rs:3:1: 15:2 error: not control paths return value [e0269] src/bin/2sum.rs:3 fn two_sum(nums: &[i32], target: i32) -> [usize;2] { src/bin/2sum.rs:4 let mut map: hashmap<i32, usize> = hashmap::new(); src/bin/2sum.rs:5 src/bin/2sum.rs:6 in 0..nums.len() { src/bin/2sum.rs:7 let want = target - nums[i]; src/bin/2sum.rs:8 ...

magento2 - Magento 2 - How to add additional js files to product page only -

magento 2 use requirejs , different approach version 1. therefore, if want keep using default theme luna, extend product page adding 1 javascript file. best way do? should extend creating new module? --update-- after thinking question above, here, i'm listing in steps follow. need find way , solution. since i'm new magento 2, questions might simple you, please don't mind give help. thanks! create child theme , use luma theme parent. (i'm studying http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/themes/theme-create.html there many questions in detail on how locate js file) magento 2 use requirejs. best way put js file, such as, if have js file trigger events on product variation changes. , js file named custom-events.js. should put? --update-- created child theme of luna, ie: named as: vendor , lunachild: app/design/frontend/vendor/lunachild/theme.xml app/design/frontend/vendor/lunachild/registration.php app/design/frontend/vendor/lunachild/et...

hadoop - Locate Accumulo/HDFS and Zookeepers on same server? -

i have been working on project zookeepers colocated on same server accumulo cluster / hdfs. works in regards them communicating, going begin rework of other infrastructure , might more this. i wondering best practice, because had thought maintenance might easier if things broken up. know hdfs/accumulo need together, far zookeepers go, should remain on same machine, or placed on another, or separate ones each (probably no reason this)? there benefits in terms of autoscaling if hdfs/accumulo , 'uninterrupted' zookeepers could perform better? i assume you're talking master nodes (namenode, accumulomaster, etc). if so, theres no problem (with 2 caveats). if you're talking datanodes, pretty bad practice , zookeeper should moved (at least) master nodes. there 2 things absolutely kill zookeeper performance: swapping , seeking. so, long theres enough memory , dedicated device (not mount) zookeeper should fine.

.net - Building C++ Solution using MSBuild within C# Appliction -

i'm trying use microsoft.build.execution.buildmanager build c++ solution within c# winforms application. from other posts i've come following code, uses logger can see output. buildsubmission.buildresult.overallresult failure when trying build c++ application. string projectfilename = "mysolution.sln"; projectcollection pc = new projectcollection(); dictionary<string, string> globalproperty = new dictionary<string, string>(); globalproperty.add("configuration", "release"); globalproperty.add("platform", "win32"); buildparameters bp = new buildparameters(pc); bp.loggers = new[] { new consolelogger { verbosity = loggerverbosity.minimal, showsummary = true, skipprojectstartedtext = true } }; buildmanager.defaultbuildmanager.beginbuild(bp); buildrequestd...

python - Pandas DataFrame [cell=(label,value)], split into 2 separate dataframes -

Image
i found awesome way parse html pandas . data in kind of weird format (attached below). want split data 2 separate dataframes . notice how each cell separated , ... is there efficient method split of these cells , create 2 dataframes, 1 labels , 1 ( value ) in parenthesis? numpy has ufuncs , there way can use them on string dtypes since can converted np.array df.as_matrix() ? i'm trying steer clear of for loops , iterate through indices , populate empty array that's pretty barbaric. i'm using beaker notebook btw, it's cool (highly recommended) #set url destination url = "http://www.reef.org/print/db/stats" #process raw table df_raw = pd.pandas.read_html(url)[0] #get start/end indices of table start_label = "10 frequent species"; start_idx = (df_raw.iloc[:,0] == start_label).argmax() end_label = "top 10 sites species richness"; end_idx = (df_raw.iloc[:,0] == end_label).argmax() #process table df_freqspecies = p...

CSS selector notation -

maybe silly question far standards i'd know, how should write css selectors: .my-selector-for-div (breaks) .myselectorfordiv (camel case) is there standard of ( or other ) should used ? here website of css name convention (with examples): http://www.realdealmarketing.net/docs/css-coding-style.php

javascript - How do I create select menu in an external file and embed it in html to show the menu -

my website has individual pages members, have select menu used scroll 1 member other. have select menu coded in html on every page, need better solution since membership growing. i need able create same select menu in separate file ability, when selected jump member page, have embedded in body need have alter/ update external file , it'll done member pages. i've looked javascripting it, mysqling it, can't find (looking on youtube) code me in need. my typical code select //(select..... //(option value="http:www.website-profile-blahblah.html.... on , forth. i need pull external file use across board , place in body need it. thanks can offer. in general sounds should using end rendering engine for. far select goes, great place use dropdown menu such 1 provided bootstrap since clicking select won't move page. if dont want use/can't use end rendering engine render options, suggest looking @ angular.js has great ng-repeat , ng-option feature...

c - Why does a GDB watchpoint stop on an irrelevant line when swapping binary tree nodes? -

i trying swap 2 nodes a , b in binary tree places stored in memory change tree topology not changed. added special handling swapping node parent, still seems doesn't work. i'm using valgrind vgdb can catch memory errors , consistent addresses. if have tree like 78 \ 40 / \ 5c c5 and try swap a=40 , b=5c , links messed up. specifically, 40->right . setting watchpoint on ( watch -l ), found 40->right being set 5c->right ( null ) memcpy should be, being changed a later if(a_l.left == b){ impossible. i've had watchpoint report wrong line before when using movq instead of movb in assembly, i'm pretty sure have sizes right time because didn't @ first , didn't make through swaps fixed , makes through around dozen. sanity check tree after every operation error here. here simplest demonstration manage: #include <stdlib.h> #include <string.h> #include <assert.h> typedef struct avl_node avl_node; struct avl_...

ios - set cornerRadius and setbackgroundimage to UIButton -

Image
i trying set cornerradius of uibutton dont know how it. if this: button.layer.cornerradius = 5; works well, if : button.layer.cornerradius = 5; [button setbackgroundcolor:[uicolor colorwithpatternimage:radialgradient]]; the corners not rounded. i know solve whit [button.layer setmaskstobounds:yes]; but looking different solution, because add arrows button , if set mask bounds arrow masked. edit : radialgradient made whit func + (uiimage *)getradialgradientimage:(cgsize)size centre:(cgpoint)centre radius:(float)radius startcolor:(uicolor *)startcolor endcolor:(uicolor *)endcolor{ // initialise uigraphicsbeginimagecontextwithoptions(size, yes, 1); // create gradient's colours size_t num_locations = 2; cgfloat locations[2] = { 0.0, 1.0 }; const cgfloat *component_first = cgcolorgetcomponents([startcolor cgcolor]); cgfloat red1 = component_first[0]; cgfloat green1 = component_first[1]; cgfloat blue1 = component_first[2]; const cgfloat *component_second...

javascript - Backbone each undefined -

why item variable undefined in backbone example? var action = backbone.model.extend({ defaults: { "selected": false, "name": "first action", "targetdate": "10-04-2014" } }); var actions = backbone.collection.extend({ model: action }); var actioncollection = new actions( [new action(), new action(), new action(), new action()]); _.each(actioncollection, function(item) { alert(item); }); jsfiddle here: http://jsfiddle.net/netroworx/klyl9/ change to: actioncollection.each(function(item) { alert(item); }); and works fine. this because actioncollection not array, _.each(collection) not work collection.each because function build backbone collection. that being said, works: _.each(actioncollection.tojson(), function(item) { alert(item); }); because collection actual array.

Is there a way to check if a string is included in a Union type in TypeScript? -

consider following code: type foo = "foo" | "bar" | "baz" function isinfoo(str: string) boolean { // return foo.contains(str); ? } in typescript, there elegant way check if str in type foo ? type foo not compiled generated javascript. can not realized in elegant way. 1 option: use array specified strings, or @ these fields through enum.

php - Wordpress WPDB and Mysql strange behaviour -

i using $wpdb , following part of codes calls $wpdb->update. this code works if it's normal email@domain.com, when if users use + sign in username, e.g. email+something@domain.com, wpdb doesn't read + sign below variables $_get i'm putting in values readability. $open_email = 'something+addition@gmail.com'; $open_key = '2f1e4b16a9a882bbef9b00906fc5c8f563fd70a5'; $open_time = time(); if (strlen($open_key) == 40) { $status_update = $wpdb->update('status', array( 'invite_status' => 'opened', 'open_time' => $open_time ), array( 'invite_email' => $open_email, 'invite_token' => $open_key ), array( '%s', '%d' ), array( '%s', '%s' ...

tomcat - Dspace showing Blank Page -

Image
i've been using dspace 5 time not working properly. succesfully uploaded data dspace whenever log in , start navigate, minutes later goes blank , doesn't show anything. solution restart tomcat server. i checked error logs (dspace, tomcat, cocoon) couldn't find clue error. dspace running on vps has 1 gb ram , 80 gb ssd. know can find more info let me solve issue. considering information have given, namely fact occurs after few minutes of random browsing. guess due tomcat running out of (permgen) memory-space after amount of iterations. can check in logs. i suggest launching tomcat, , giving more memory, using launch options -xms128m -xmx2048m -xx:permsize=64m -xx:maxpermsize=256m you can see how memory need / can give it. when hit memory issue this, should visible in logs though. said not find it, quite sure in tomcat log somewhere. bit odd not find this, not impossible overlook assume.

html - 'Submit' button redirects to home page without submitting form (php error, perhaps) -

shortly after setting first wordpress website (i've been forums no luck), noticed error "contact us" page ( http://www.therealironworks.org/contact-us/ ). when first created page, supposed give errors if user didn't fill out form correctly. instead, when user clicks "submit" button, redirects home page without alerting user , without submitting information, if form filled out correctly. i decided rebuild website re-uploading base files had computer, when checked make sure working correctly, version on pc doing same thing (i'm using mamp windows emulate server). i'm wondering if maybe never did work correctly, in case wouldn't wordpress problem, php coding error on part. however, i'm puzzled page still loads , should, part button clicked. the page in 2 parts, actual meat of php being in "content-" template part file. i'm not sure if should upload both files here, bit long, if needed. or ideas appreciated! if ($_po...

mvvm - Silverlight OneWay binding -

let's assume have text box on form , enabled (user can type whatever want.) there oneway binding set string property when viewmodel changes property text box updates. happens when user changes value in text box manually. binding overwritten new value of text box? or remember value , keep binding, when update property next time in viewmodel change reflect in ui? public class vm : inpcbase { private string _mytext; public string mytext { { return _mytext; } set { _mytext = value; this.notifypropertychanged(()=>mytext);} } public void blup() { this.mytext = "blup"; } } public partial class mainwindow : window { private vm data = new vm(); public mainwindow() { initializecomponent(); data.mytext = "sdfjksj"; this.datacontext = data; } private void button1_click(object sender, routedeventargs e) { this.data.blup(); } } xaml <t...

curl - elasticsearch: wrong count in terms facet -

not sure if bug or missing something. terms facet returning wrong count number of terms. i have field have str_tag_analyzer . i want tag cloud from field. want top 20 tags along count (how many times appeared) . terms facet looked solution case. have understanding size parameter in terms facet query controls how many tags returned. when run term facet query different size, unexpected result. here few of queries , result. query 1 curl -xget 'http://server:9200/stage_profiles/wrapper_0/_search?pretty=1' -d ' { query : { "nested" : { "query" : { "field" : { "gsid" : 222 } }, "path" : "medals" } }, from: 0, size: 0 , facets: { "tags" : { "terms" : {"field" : "field_val_t", size: 1} } } }' { "took" : 1, "timed_out" : false, "_shards" : { "total" : 3, "successful...

objective c - How to get Size and free space of a directory in cocoa? -

i want access actual size of directory, , free space available in directory. used [nsfilemanager defaultmanager]attributesofitematpath:path error:&error] method. method works fine files directory, not provide actual value. please solve problem. in advance. you can calculate size of directory using particular method, fastest, using carbon, instead of nsenumerator : here to calculate free space, use method. make sure enter full path of volume : nsdictionary* fileattributes = [[nsfilemanager defaultmanager] filesystemattributesatpath:folder]; unsigned long long size = [[fileattributes objectforkey:nsfilesystemfreesize] longlongvalue]; where size you're looking for.

ruby on rails - Capybara is failing to find a checkbox by id / name -

Image
i have rails project using rspec 3.4.0 capybara 2.6.2 , capybara-webkit 1.8.0 i have form html follows: <form class="jsform padding " id="edit_seller_profile_20" enctype="multipart/form-data" action="/seller_profile" accept-charset="utf-8" method="post"><input name="utf8" type="hidden" value="✓"><input type="hidden" name="_method" value="patch"><input type="hidden" name="authenticity_token" value="rbjidirhsdapnrvmmfvbariql/mvjdwcm3897r5+gluekmwtwrolhslacvmgxyyde9ej6kgswdsgyxzvlqdc7g=="> <div class="row no-padding-bottom" id="first"> <!-- popover start --> <div class="helper"> <a tabindex="0" id="pop-trigger" role="button" data-toggle="popover" data-placement="bottom" data-t...

c++ - Box2D: Triangle causing "Polygon is degenerate" -

i porting small game engine linux ubuntu 14.04.4 . works great, have encountered problem box2d . use poly2tri triangulate shapes. library returns counter-clockwise triangles, create box2d fixtures with. some triangles work, @ least 1 not, 1 example: p1: (-0.135156, -0.042188) p2: (-0.136719, -0.050000) p3: (-0.131250, -0.053125) as can see, triangle counter-clockwise. when box2d attempts create shape these vertices using polygonshape->set() , polygon degenerate assert: /build/buildd/box2d-2.3.0+ds/box2d/box2d/collision/shapes/b2polygonshape.cpp:158: void b2polygonshape::set(const b2vec2*, int32): assertion `false' failed. i wondering why this? after doing research, have found polygons have counter-clockwise , not tiny (coords have greater 0.00001 or something), triangle respects both constraints . also, it worked fine on windows! it interesting note seems assert can thrown if box2d's convex hull algorithm breaks on polygon (or i've heard). box2d vers...

angular 2 master-detail share observable for update -

in angular2 example toh, master component retrieves data via web api. hero.service returns observable. and detail component retrieves data via web api id. i see observable immutable client storage. if update hero in detail component push change observable first , when user hit save button post updated observable (to json) api server. i thinking benefit reduce io traffic , keep master , detail in sync (i updated detail , automatically reflected in master). hero.service.ts import {injectable} 'angular2/core'; import {http, response, headers, requestoptions} 'angular2/http'; import {observable} 'rxjs/observable'; import {hero} './hero'; @injectable() export class heroservice { private _heroesurl = 'http://localhost:8081/api/hero/'; // url web api private _cachedheroes; constructor (private http: http) {} getheroes (): observable<hero[]> { if (!this._cachedheroes) { this._cachedheroes = this....

PHP - Iterate Though Additonial XML Node -

i working following xml response structure: <compressedvehicles> <f> <rs> <r> <vs> <v /> <v /> </vs> </r> <r> <vs> <v /> <v /> </vs> </r> </rs> </f> </compressedvehicles> so far, guidance fellow stack overflow member, able construct working json output based on following php code: header('content-type: application/json'); $xml = simplexml_load_file( 'inventory.xml' ); $compressedvehicles = $xml->compressedvehicles; $attributes = array(); foreach( $compressedvehicles->f->attributes() $key => $val ) { $attributes[$key] = $val->__tostring(); } $data = array(); foreach( $compressedvehicles->f->rs->r->vs->v $vehicle ) { $line = array(); foreach( $vehicle->attributes() $key => $val ) { $line[$attributes[$key]] = $val->__tostring(); } $data[] = $line; } ...