Posts

unity3d - Unity: Prefab parenting in code -

Image
let's want multiple prefab object called childtile , parenting single prefab object called parenttile . whenever parenttile rotates, childtiles rotated around parenttile . basically wrote: public gameobject childprefab; public gameobject parentprefab; void update() { for(int = 0; < 10; i++) { gameobject clone = instantiate(childprefab, /*psuedocode: random position*/ , quaternion.identity) clone.transform.parent = parentprefab; } } the expected result during runtime, if rotate parentprefab @ scene, 10 childprefabs should rotate. i've tried many ways failed, unless manually drag childprefabs parentprefab on hierachy bar. are sure want instantiate 10 child prefabs on each frame ( update called once per frame). i think problem is, did not instantiate parent prefab. if take code, , fix it, works charm me. public gameobject childprefab; public gameobject parentprefab; void start() { gameobject parent = instantiate(pa...

How to reject or accept an incoming call to my GSM modem using AT commands in Python? -

i've wrote below python program wait incoming calls , accept or reject them. based on this document , this document, appropriate @ commands accept incoming call ata or ats0 or ats0<n> . , appropriate commands reject incoming call ath or at h . i tried above commands, incoming call neither answered nor rejected! my python program : import time import serial phone = serial.serial("com10", 115200, timeout=5) try: time.sleep(1) while(1): x = phone.readline() print(x) if (x == b'ring\r\n'): phone.write(b'at h') # replaced 'at h' above # commands, nothing changed # incoming call. ringing. time.sleep(2) finally: phone.close() results at h : >>> ================================ restart ================================ >>> b'' b'' b'\r\n' b'ring\r\n' b...

Deploying failed when I am trying to deploying applicaion in mule 3.4.2 server -

deploying failed when trying deploying applicaion the below error getting. please me out on this? warn 2015-06-19 15:02:42,393 [[bmrs_mule_phase2_2.0.12].http.request.dispatch.7051.01] com.mulesoft.mule.throttling.throttlingphase: failure processing throttling phase null error 2015-06-19 15:02:42,394 [[bmrs_mule_phase2_2.0.12].http.request.dispatch.7051.01] org.mule.exception.defaultsystemexceptionstrategy: caught exception in exception strategy: null java.lang.nullpointerexception @ com.mulesoft.mule.throttling.throttlingphase.runphase(throttlingphase.java:76) @ com.mulesoft.mule.throttling.throttlingphase.runphase(throttlingphase.java:1) @ org.mule.execution.phaseexecutionengine$internalphaseexecutionengine.phasesuccessfully(phaseexecutionengine.java:54) @ org.mule.execution.validationphase.runphase(validationphase.java:36) @ org.mule.execution.validationphase.runphase(validationphase.java:15) @ org.mule.execution.phaseexecutionengine$internalphaseexe...

QLineEdit Qt in c++ removing QLineEdit -

i'm trying make adress book in qt , using following code: #include "mainwindow.h" #include "ui_mainwindow.h" int counter = 1; mainwindow::mainwindow(qwidget *parent) : qmainwindow(parent) , ui(new ui::mainwindow) { ui->setupui(this); } mainwindow::~mainwindow() { delete ui; } void mainwindow::on_pushbutton_clicked() { qlineedit* voornaam = new qlineedit(this); voornaam->setobjectname(qstring::fromutf8("lineedit_4")); voornaam->setgeometry(qrect(10, 65+ 33*counter, 113, 24)); voornaam->show(); qlineedit* achternaam = new qlineedit(this); achternaam->setobjectname(qstring::fromutf8("lineedit_5")); achternaam->setgeometry(qrect(140, 65+ 33*counter, 113, 24)); achternaam->show(); qlineedit* adres = new qlineedit(this); adres->setobjectname(qstring::fromutf8("lineedit_6")); adres->setgeometry(qrect(270, 65+ 33*counter, 113, 24)); adres->sho...

javascript - It is possible to code `if(($(document).onmouseup) && (value_ == 1))`? -

yesterday asked question. fiddle my problem is, values passing function in every mouse event dragging , resizeable not correcty working. so write var value_ = 1; div_mainscale.onmousedown = function(event) { var mousecoords = getcoords(event); startx = mousecoords.x - offset[0]; starty =1 ;//mousecoords.y - offset[1]; rect = mainscale.rect(startx, starty); document.onmousemove = dodraw; rect.attr({fill: 'rgba(255, 6, 6, 0.41)', stroke: 'red'}); value_ = 1; }; if(($(document).onmouseup) && (value_ == 1)) // here make mistake { selectable_area(width,startx); rect.remove(); } instead of code document.onmouseup = function() { if(rect) { selectable_area(width,startx); rect.remove(); } document.onmousemove = null; }; but if(($(document).onmouseup) && (value_ == 1)) condition not satisfied? how can fix problem? $(document).on("mouseup" , function(e) { if (value_ == 1) { ...

AngularJS watching an expression -

say have expression $scope.showbutton = users.is_admin() && !document.is_provided; and in same controller have button updates value of document.is_provided : <button ng-click="document.is_provided = true;">provide document</button> the problem $scope.showbutton should changed it's not changing. updated: plnkr showing simplified issue: http://plnkr.co/edit/qk2jnhamqsrnxsajdyek?p=preview i'd add on squiroid's answer , explain why works. i'll provide simple way understand, common problem me when started. angular has called digest cycle. series of functions called successively make sure if variable two-way bound variable b (using ng-model example), stay in sync (that is, have same value). functions angular provides (or services, start $, $timeout etc), automatically start digest cycle so let's have variable , you've bound $scope variable b, equal variable c. expect c bound too, right? because think when chan...

c# - SQL Server Database not working due to server version issue on testing machine -

my development pc has sql server 2008. have database created , running on sql server 2008. instance name of sql server 2008 sqlexpress default one. connection string like: <add name="db1entities" connectionstring="metadata=res://*/model1.csdl|res://*/model1.ssdl|res://*/model1.msl;provider=system.data.sqlclient;provider connection string=&quot;data source=.\sqlexpress;attachdbfilename=|datadirectory|\db1.mdf;integrated security=true;user instance=true;multipleactiveresultsets=true;app=entityframework&quot;" providername="system.data.entityclient" /> working nicely on development pc. tried run on pc it's not working, instead showing error : system.data.entityexception: underlying provider failed on open. ---> system.data.sqlclient.sqlexception: database '..\db1.mdf' cannot opened because version 655. server supports version 612 , earlier. downgrade path not supported. first test pc has sql server 200...