Posts

php - Symfony3 / Doctrine - function: adding row with foreign key -

i starting adventure symfony3 (and php) , encountered problem. at moment application supposed allow user crud projects. displaying works fine, have problem creating. i have got 2 tables: users , projects. project table contains project data including project owner id of user. symfony docs managed map both tables: part of "project" entity: /** * @orm\manytoone(targetentity="user", inversedby="projects") * @orm\joincolumn(name="uid", referencedcolumnname="id") */ private $uid; /** * set uid * * @param \appbundle\entity\user $uid * * @return project */ public function setuid(\appbundle\entity\user $uid = null) { $this->uid = $uid; return $this; } /** * uid * * @return \appbundle\entity\user */ public function getuid() { return $this->uid; } part of 'user' entity: private $projects; public function __construct() { $this->projects = new arraycollection(); } at point i...

React Native | Firebase authentication | Impossible to trigger navigator -

i’ve been stuck since 3 days problem. i’ve migrated app firebase , react native working charm except user authentication. i’m trying trigger navigator when user logs in. i’m using following method : componentdidmount() { firebase.auth().onauthstatechanged(function(user) { if (user) { global.userid = user.uid alert(‘test’) var naviref = this.refs.navref naviref.push({ ident: ‘home’ }) } else { // no user signed in. } }); } i alert(‘test’) navigator nothing. if put naviref.push outside « onauthstatechanged » working. have no idea can now. there better solution using navigator ? i think should trick: componentdidmount() { firebase.auth().onauthstatechanged((user) => { if (user) { global.userid = user.uid alert(‘test’) var naviref = this.refs.navref naviref.push({ ident: ‘home’ }) } else { // no user signed in...

Django formset error: select fields cause partially filled forms -

i have form utilizes choices argument i've created formset. when page containing formset rendered, fields uses choices argument display drop-down select widgets. forms filled user have no errors. however, forms not filled user have 'this field required' errors other fields fields used select widget. it appears select field's initial values causing form treated half-filled form , form validation process throws errors required fields not filled. # form: class ownerform(forms.form): name = forms.charfield(label = 'name', max_length = 20) owner_entity = forms.choicefield(label = 'owner entity', choices = owner_entities) num_of_shares = forms.decimalfield(label = 'number of shares' , min_value = 0.0, max_digits = 5, decimal_places = 2) share_class = forms.choicefield(label = 'share class', choices = share_classes) joined_date = forms.datefield(label = 'joined date', help_text = 'mm/dd/yyyy') # v...

r - Cannot find function readDICOM, though oro.dicom is installed -

i struggeling reading dicom files in r. have installed oro.dicom package, using: install.packages("oro.dicom", repos="https://cran.cnr.berkeley.edu/") i have set working directory files located. when trying read dicom file, using... slice=readdicom("im-0001-0011.dcm") ... following error message: error: not find function "readdicom" can help? thank you, lena you should load package library(oro.dicom) fisrt before use functions package,

arrays - Javascript - Collection of objects with parent properties in common -

i'd create collection of objects works array. time ago, made this question , came following solution of people helped me: newobj.collection = function(){ array.apply(this); for(var = 0; < arguments.length; i++){ for(var j = 0; j < arguments[i].length; j++){ this.push(arguments[i][j]); } } return } newobj.collection.prototype = object.create(array.prototype); newobj.collection.prototype.push = function(o){ array.prototype.push.call(this, new newobj.element(o)); } however, leaves children unconnected parent. example, imagine collection has render() function, makes children print html onto page. well, i'd able like: newobj.collection.html_container = '#cont'; newobj.collection.render = function(){ $.each(this, function(i, el){ el.render() }) } newobj.element.render = function(){ $(parent.html_container).html('.......') } it should able set different collections in 1 page, m...

excel - On making MATCH function like FIND function -

i'm trying make match function work find function. first of all, generate dummy data use testing. here routine use: sub data_generator() randomize dim data(1 100000, 1 1) dim p single = 1 100000 p = rnd() if p < 0.4 data(i, 1) = "a" elseif p >= 0.4 , p <= 0.7 data(i, 1) = "b" else data(i, 1) = "c" end if next range("a1:a100000") = data end sub now, create sub-routine find string a in range data . there 2 methods use here employ match function. first method reset range of lookup array following code: sub find_match_1() t0 = timer dim long, j long, k long, data range dim output(1 100000, 1 1) on error goto finish set data = range(cells(j + 1, 1), "a100000") 'reset range of lookup array = worksheetfunction.match("a", data, 0) j = j + output(j, 1) = j 'label position of k = k + 1 ...

PHP Combine Associative Arrays If Specific Key Matches Inside For-Loop -

i working combine 2 different arrays based on comparison of key if values match, otherwise combine not occur. here short example of each array begin with, both array 1,000 items: vehicle array ( [vehicle] => 2016 ford transit 250 cargo van [stockno] => 153721 [msrp] => 32195 [price] => 32195 [payment] => 359 [type] => new [bodystyle] => van [mileage] => 6 [year] => 2016 [make] => ford [model] => transit 250 [trim] => cargo van ),( [vehicle] => 2016 ford f150 xlt [stockno] => 153723 [msrp] => 36195 [price] => 36195 [payment] => 429 [type] => new [bodystyle] => truck [mileage] => 6 [year] => 2016 [make] => ford [model] => f150 [trim] => xlt ) special array ( [vehicle] => 2016 ford transit 250 cargo van [store] => baxter ford [offertype] => $ off msrp [offervalue] => $10,000 [disclaimer] => *valid on in-stock models. based on stock #1616...