Posts

Showing posts from August, 2010

php - Laravel multiple many to many relationships? -

so using laravel , running issue, have relational model adsale, have setup hasone relationship adimpressions. example grab adsale records userid = 1. 5 different rows back, each of 5 rows have 5 adimpression rows match , have info clicks , impressions. end goal adimpression rows. when run has 1 impressions() method undefined method. if foreach on adsale records individually , run impresssions() method works. here code class adsale extends eloquent{ protected $table = 'adsale'; public function impressions() { return $this->hasone('adimpression','adsaleid','id'); } } here connecting adsale respective adimpression via adsaleid in adimpression table. this running in controller. $sales= adsale::where('userid','=', 1)->get(); $impressions = $sales->impressions(); now expect $impressions variable have adimpressions entry correlates adsaleid, getting undefined function since there multiple val

java - Getting the coordinates of the panel -

using mouseevents, able x , y coordinates of frame, yet unable x , y coordinates of panel. below codes me getting x , y coordinates of frame. public void mousemoved(mouseevent e) { x = e.getx(); y = e.gety(); text = integer.tostring(x) +","+integer.tostring(y); frame.frame.repaint(); } the below codes me trying x , y coordinates of panel, it's painting out 0's instead. paint.paint name of jpanel. don't know i'm doing wrong. please if can. public void mousemoved(mouseevent e) { x = paint.paint.getx(); y = paint.paint.gety(); text = integer.tostring(x) +","+integer.tostring(y); frame.frame.repaint(); } if understand right, mouselistener registered jframe, , wish x/y relative jpanel contained within jframe. x , y within mouseevent refer component in mouselistener registered. if have mouselistener registered on parent container, , coordinates of mouseevent relative child component, can using swinguti

Meteor Collections schema not allowing Google authentication -

i'm building simple user account using meteorjs. user given option login/register using google. if registering first time, users prompted fill out profile information after authenticating user account. i'm using collections2 manage schema user account , attaching meteor.users, seen here: var schemas = {}; schemas.userprofile = new simpleschema({ firstname: { type: string, regex: /^[a-za-z-]{2,25}$/, optional: true }, lastname: { type: string, regex: /^[a-za-z]{2,25}$/, optional: true }, gender: { type: string, allowedvalues: ['male', 'female'], optional: true } }); schemas.user = new simpleschema({ username: { type: string, regex: /^[a-z0-9a-z_]{3,15}$/ }, _id : { type: string }, createdat: { type: date }, profile: { type: object }, services: { type: object, black

string - How to get a character from an extended ascii number -

the ascii code charts "ü" @ 129 (decimal). when trace("ü".charcodeat(0)) ... answer 252 - wrong. seems string.charcodeat() works 0-127. how convert between char , charcode values ranges 128-255? since there more 1 character set call "extended ascii," there isn't meaning term. ascii used. as you've found, important know character set , encoding using. although libraries flexible in adapting "the platform default," programs aren't written way and, if read or write data across systems, flexibility moot. there no text encoded text. when pass text, have data loss if don't give encoding metadata. actionscript strings sequences of unicode/utf-16 code units. see charcodeat() . unlike character sets, unicode has several encodings; utf-16 being 2 of them. (integers stored big endian or little endian , utf-16 code unit. utf-16 means either utf-16be or utf-16le, depending platform, through use of bom in string, data can s

javascript - How to do dropdown item on navbar with material angular -

i'm using angularjs googles material angular library https://material.angularjs.org/ they have drop down items in navbar on site, can't find object or example make 1 of own. how can achieve this? thank you! angular material side menu use below code markup <md-sidenav layout="column" class="md-sidenav-left md-whiteframe-z2" md-component-id="left" md-is-locked-open="$mdmedia('gt-md')"> <md-list> <md-item ng-repeat="item in menu"> <a> <md-item-content md-ink-ripple layout="row" layout-align="start center" ng-click="$parent.navigate(item.icon)"> <div class="inset"> <ng-md-icon icon="{{item.icon}}" ></ng-md-icon> <md-tooltip md-direction="right">{{item.title}}</md-tooltip> </div> </md-item-content> <

audio - C# How does the following code for Low Pass Filter run? -

i have following c# code low pass filter found on naudio site: public void setvalues(isampleprovider sourceprovider,int cutofffreq) { this.sourceprovider = sourceprovider; this.cutofffreq = cutofffreq; filter_lowpass(); } private void filter_lowpass() { channels = sourceprovider.waveformat.channels; filters = new biquadfilter[channels]; (int n = 0; n < channels; n++) if (filters[n] == null) filters[n] = biquadfilter.lowpassfilter(44100, cutofffreq, 1); else filters[n].setlowpassfilter(44100, cutofffreq, 1); } public waveformat waveformat { { return sourceprovider.waveformat; } } public int read(float[] buffer, int offset, int count) { int samplesread = sourceprovider.read(buffer, offset, count); (int = 0; < samplesread; i++) buffer[offset + i] = filters[(i % channels)].transform(buffer[offset + i]);

jdeveloper - Oracle ADF: af:selectOneChoice Hierarchy changes -

Image
i developing web application using oracle adf. in have page follows in above image have 2 select lists. first 1 country , second 1 state. requirement when user select value country list have add appropriate states states list programatically. suppose user has selected india need states in india ap, ka, mh, tn that. i have tried this post . fixed , need add values dynamically. please me in achieving this. in advance. tthe way approach though programatic view objects. adf build work best adf bc more exactly: create simple vo based on sql statement: select '' country, '' state dual for country attribute, need create programatic view object : countrylov. same thing state attribute - statelov. this not simple task, can find quite few examples around: http://andrejusb.blogspot.co.uk/2013/12/detail-view-object-instance.html http://adfpractice-fedor.blogspot.co.uk/2011/01/adf-bc-programmatically-populated-vo.html http://www.jobinesh.com/201

Android.mk - what toolchain used by default? -

what toolchain used default when compile through android.mk ? , how change toolchain ? the default toolchain gcc-4.6 long time. has changed gcc-4.8 in ndk r10d version (currently latest version). you can choose use toolchain through modifying ndk_toolchain_version variable, through ndk-build call (example: ndk-build ndk_toolchain_version=clang3.4 , or setting inside application.mk file. example: ndk_toolchain_version := clang3.4

signature - outlook 2010 including weblink image inline -

i have noticed on laptops once has booted , open outlook compose message, email signature picture takes long time load. 10seconds. during time believe outlook download , trying make local copy within email itsself. how can prevent happening. below code sent outlook email <v:shape id="picture_x0020_2" o:spid="_x0000_s1026" type="#_x0000_t75" alt="https://www.spectrumgeo.com/wp-content/uploads/spectrum_logo_email-171w.jpg" style='position:absolute;margin-left:74.8pt;margin-top:0;width:126pt;height:34.5pt;z-index:251659264;visibility:visible;mso-wrap-style:square;mso-width-percent:0;mso-height-percent:0;mso-wrap-distance-left:0;mso-wrap-distance-top:0;mso-wrap-distance-right:0;mso-wrap-distance-bottom:0;mso-position-horizontal:right;mso-position-horizontal-relative:text;mso-position-vertical:absolute;mso-position-vertical-relative:line;mso-width-percent:0;mso-height-percent:0;mso-width-relative:page;mso-height-relative:page' o:all

c# - Sockets: Only one usage of each socket address is normally permitted -

Image
i want reuse socket after used once, subj exception. found multiple questions same issue no working solution. tried using code, tried manual closing - without success a little sample using system; using system.net; using system.net.sockets; using system.text; namespace sockettest { class program { static void main() { (int = 1; <= 2; i++) { var encoding = new utf8encoding(false); var host = dns.gethostentry("localhost"); var endpoint = new ipendpoint(host.addresslist[0], 11322); console.writeline("iteration #{0}\tenpdoint = {1}", i, endpoint); try { var client = new tcpclient(endpoint); const string message = "hello world!"; byte[] data = encoding.getbytes(message); client.connect(endpoint); var stream

set difference - JQ: setdiff of two arrays -

if have object 2 arrays containing unique values in it {"all":["a","b","c","abc"],"some":["b","c"]} how can find .all - .some ? in case looking ["a","abc"] @jeff mercado blew mind! didn't know array subtraction allowed... echo -n '{"all":["a","b","c","abc"],"some":["b","c"]}' | jq '.all-.some' yields [ "a", "abc" ]

Calling derived class overriden function from parent. C++ -

i have parent class p, derived class d, , function show() in both of them. also, have array of p objects, , in array assigning objects derived p, d. , i'm calling show() function array. seems calls p empty function, not derived overriden function. my code: //parent.h class p { public: p(){ } ~p(){ } virtual void show(){ } }; //derived.h #include "parent.h" class d : public p { public: d(){ } ~d(){ } void show(); }; //derived.cpp #include "derived.h" void d::show() { std::cout<<"showing derived function\n"; } //main.cpp #include "derived.h" #include <vector> int main() { vector<p> objectz; for(int i=0; i<8; i++) { d derp; objectz.insert(objectz.begin(), derp); } for(int i=0; i<8; i++) { objectz[i].show(); //call here !! } return 0; } this because didn't declare array array of p pointers. make sur

python - Paramiko - Running commands in "background" -

i've implemented paramiko using exec_command, however, command i'm running on remote machine(s) can take several minutes complete. during time python script has wait remote command complete , receive stdout. my goal let remote machine "run in background", , allow local python script continue once sends command via exec_command. i'm not concerned stdout @ point, i'm interested in bypassing waiting stdout return script can continue on while command runs on remote machine. any suggestions? current script: def function(): ssh_object = paramiko.sshclient() ssh_object.set_missing_host_key_policy(paramiko.autoaddpolicy()) ssh_object.connect(address, port=22, username='un', password='pw') command = 'command run' try: stdin, stdout, stderr = ssh_object.exec_command(command) stdout.readlines() except: else thank you! use separate thread run command. threads should cleaned join command (the

ios - Is there any way to disable the Touch ID prompt (UIAlertview)? -

Image
trying integrate touchid in application, , successful too. the question can customize default touchid uialertview ? can disable it? no, cannot. popeye said in comment, system controls prompt, not app – request system display you. due obvious security concerns. for example, if initiated $100 in-app purchase, changed prompt say, "place thumb on home button start game!" not go on well.

jsf - Display amount in format $1,560.00 and $ 50.00 -

i have 2 fields in screen need display amounts in format this amount : $1,560.00 tax : $ 10.00 in code using <h:outputtext value="#{mbean.amount}" > <f:convertnumber currencysymbol="$" type="currency" maxfractiondigits ="2" /> </h:outputtext> and output is amount : $1560.00 tax : $10.00 how right align amount , comma (,) these amount fields?

FireMonkey Component Execution Error -

i tried create simple component(tgraph) using firemonkey platform (xe7). first of create 2 new classes: 1) tgraph (anchestor type tlayout); 2) tmyplot1d(anchestor type tpanel); saved 2 units , created package called 'mypackage'. compiled , installed in "samples" page. opened new firemonkey project , drag , drop tgraph instance in form. works well. @ designtime,i can see component defined, , relevant units visible main unit. relevant code in following: first class unit umyplot; interface uses system.sysutils, system.classes, fmx.types, fmx.controls, fmx.stdctrls; type tmyplot1d = class(tpanel) private { private declarations } protected { protected declarations } public { public declarations } published { published declarations } end; procedure register; implementation procedure register; begin registercomponents('samples', [tmyplot1d]); end; end. second class unit umygraph; interface uses system.sysutils, system

deployment - What options are available for creating multiple cloud instances of a web-app for different customers -

i have web-app, in production, need sold different companies. th idea create new instance of application each customer, example: lets our app has site @ thing.com: a company sing instance of application the system receives signup , (automatically?) creates new instance of web app @ yourcompany.thing.com i wondering options available "system"? how can create multiple instances of web-app when company signs up? an example of looking can seen when signing youtrack in-cloud instance.

c++11 - Template specialization with constexpr non POD data initialization results in linker error when used in constructor as default value -

consider this: struct teststruct { uint16_t m_a : 8; uint16_t m_b : 8; }; template<typename t> struct some_trait { constexpr static const teststruct value = {0,0}; }; template<> struct some_trait<int> { constexpr static const teststruct value = {1,1}; }; template<class t> class obj { public: obj(teststruct t = some_trait<t>::value) : m_t(t) { } teststruct m_t; }; int main(int argc, const char * argv[]) { // linker error here -> undefined symbol some_trait<int>::value obj<int> o; teststruct t = some_trait<int>::value; obj<int> o1(t); // -> works } the following produces linker error, complaining some_trait not defined. have 2 questions: why happening? i'm guessing has either constexpr specifier or non-pod type of teststruct ? is there way make work, while still keeping default value in constructor? thanks!

vagrantfile - Share a single file in vagrant -

how share single file, instead of sharing whole folder like config.vm.synced_folder "host/folder", "box/folder" ? in other words there way have like: config.vm.synced_folder "host/folder/file.conf", "box/folder/file.conf" use include flag in rsync args array: config.vm.synced_folder "host/folder/", "box/folder/", type: "rsync", rsync__args: ["--include=file.conf"]

oop - How to do logic based on object ID -

suppose have game, there buildings sorted type. each type represented separate class, have uncommon logic buildings of same type. how 1 implement kind of behaviour? for example, can identify buildings id, can have giant switch or command pattern inside building type class. think not right approach. another approach have different class divergent logic. proposes lot of small classes. this polymorphism aims solve, , 1 of big differences between procedural , oop programming. can achieve through extending base class, or implementing interface. here extending base class: public abstract class building { abstract void destroy(); } public brickbuilding extends building { @override public void destroy() { bricks.falltoground(); } } public haybuilding extends building { @override public void destroy() { straw.blowinwind(); } } in places in code have used switch statement switch on building type, hold reference abstract buildin

c# - GetIndexParameters() empty on Dictionary property -

Image
i'm using reflection info class i'm exporting excel. loops through properties values. i want able handle indexed types list s , dictionary s. however, getindexparameters() method on property returning none. using wrong? here can see prop.property (which propertyinfo ) showing value dictionary<int, decimal> , indexparams has 0 length. loop logic (slightly modified so, partially pseudocode) foreach (var prop in exportingpropertiesinorder) { //detect if needs have indexing applied. var indexparams = prop.property.getindexparameters(); var isindexed = indexparams.any(); if (!isindexed) { //get value property export }else{ //loop through indeces, each value } the property shown on screenshot dictionary<int, decimal> tiervalues it not indexer, getindexparameters() method on property returning empty array dictionary<int, decimal> type has indexed property item

javascript - multiple select get recently selected option value -

i want know last or selected option value dropdown i have tried following code in django : <script type="text/javascript"> django.jquery(document).ready(function(){ django.jquery("#id_emuhibah_issue").on("click", function(e){ console.log(" click -------"); console.log(django.jquery(this).val()); console.log(this.value); }); }); django.jquery(document).ready(function(){ django.jquery("#id_emuhibah_issue").on("change", function(e){ console.log(" chage -------"); console.log(django.jquery(this).val()); console.log(this.value); }); }); </script> seems there no luck find out last selected value can suggest solution above case? just remove click function , use on.("change" function..) 1 function 1

linux - Monitor for trigger file and copy all files in that directory -

i'm new unix scripting. sorry if question sounds stupid. i have script copies files landingzone archive directory. now, want write script checks test.txt file (which trigger file), if found copy files arrived before test.txt files landingzone archive. please let me know how this? i'm mentioning script because i've couple more commands apart copying. this should work archive=... # archive directory cd landingzone if [ -f test.txt ]; find . -type f -maxdepth 1 ! -name test.txt ! -newer test.txt -exec cp {} $archive ';' fi explanation: if [ -f ... ]; performed if test.txt exists. call find to search normal files ('-f') exclude subdirectories (-maxdepth 1) exclude test.txt (! -name test.txt) exclude files newer test.txt (! -newer test.txt) copy files found archive directory (-exec ...)

C# Azure Storage Blob Upload TransactionScope -

is there somewhere class allow roll transactionscope on azure blockblob actions ? i make works: cloudblockblob blockblob; private void uploadpicture(stream istream) { using(var ts = new transactionscope()) { blockblob.uploadfromstream(istream); throw new exception(); ts.complete(); } } when exception raise, uploaded file not cancelled. if not possible transaction scope, how should proceed ? azure storage client library not provide support. if, however, cancellation support acceptable scenario, can use uploadfromstreamasync api cancellationtoken . while asynchronously uploading blob, can cancel operation. depending on operation's current progress, try abort upload.

class - c++ no suitable conversion function from "Camera" to "Actor *" -

fairly new c++ so, please gentle. getting str8 point: first actor class: class actor { vec3 location; vec3 rotation; } then camera class: class camera: public actor { float fov; } and controller class: class controller { actor* pawnactor; void setpawnactor(actor* actor); } now problem... considering camera derives actor tried like... controller.setpawnactor(camera); ...but... compiler says: no suitable conversion function "camera" "actor *" exists. of course use: void setpawnactor(camera* camera); seems pointless me create function each possible actor become 'pawnactor'. ideas??? again i'm new whole c++ thing so... thanks time everyone. pass &camera if camera object function expecting pointer not object .

php - Send data to url in form handler -

i have salesforce form, sends form data salesforce_url. implementing form handler. how send data salesforce-url in form handler. in basic form sent via <form action="salesforce-url" method="post" role="form"> now form handler have action set to: <form action="/form-handler.php" method="post" role="form"> in form handler @ form-handler.php how can push data https://www.salesforce.com . ps: using google captcha , auto populating form variables add complexity. below form-handler... <?php $email;$comment;$captcha; if(isset($_post['email'])){ $email=$_post['email']; }if(isset($_post['g-recaptcha-response'])){ $captcha=$_post['g-recaptcha-response']; } if(!$captcha){ echo '<h2>please check the captcha form.</h2>'; exit; } $response=file_get_contents("https://www.example.com/recaptcha/api/si

java - TestNG and Powermockito - cannot mock static void -

i can't powermock work testng. same code adjusted junit works fine, somehow in testng fails. testng version 6.8.21 powermockito version 1.6.1 package p; import org.mockito.mockitoannotations; import org.powermock.api.mockito.powermockito; import org.powermock.core.classloader.annotations.preparefortest; import org.powermock.modules.junit4.powermockrunner; import org.testng.assert; import org.testng.annotations.beforetest; import org.testng.annotations.test; import static org.powermock.api.mockito.powermockito.mockstatic; @preparefortest({footest.class}) public class footest { @beforetest public void setup() { mockstatic(footest.class); mockitoannotations.initmocks(this); } @test public void test() throws exception { powermockito.donothing().when(footest.class,"foo"); footest.foo(); assert.assertequals(1, 1); } public static void foo() throws exception { throw new exception("huh?

html - dynamic div container with multiple content -

i try make kind of banner css. div contain 2 images , bit text splittet 2 lines. looks on display if load side on other display smaller resolution and/or 4:3 whole container "falling appart" :( have tried different methodes nothing seems work. may of can point me in right direction :) here css , html: css: #head_box_banner { position: absolute; height: 150px; width: auto; right: 13px; left: 13px; top: 4px; background-color: #dbdbdb; border-radius:3px; } .logo1 { margin-top: 19px; margin-left: 139px; } .logo2 { margin-top: -112px; margin-left: 1380px; } .text_banner_1 { margin-top: -125px; margin-left: 426px; font-size: 46px; color: #062916; font-weight:bold; font-family: comic, serif; font-style: oblique; text-shadow: 0 1px 0 #ccc, 0 2px 0 #c9c9c9, 0 3px 0 #bbb, 0 4px 0 #b9b9b9, 0 5px 0 #aaa, 0 6px 1px rgba(0,0,0,.1), 0 0 5px rgba(0,0,0,.1), 0 1px 3px rgba(0,0,0,.3), 0 3p

Android App is not searchable by tablets on Google Play -

when uploaded apk, got warning on developer console: design app tablets your apk not seem designed tablets. i know there questions targeting same issue cases different, i'm putting here permissions & features i'm requesting in androidmanifest.xml hoping more specific answer case: <uses-permission android:name="android.permission.read_contacts" /> <uses-permission android:name="android.permission.read_profile" /> <uses-permission android:name="android.permission.get_accounts" /> <uses-permission android:name="android.permission.read_phone_state" /> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_network_state" /> <uses-permission android:name="android.permission.camera" /> <uses-permission android:name="android.permission.read_external_storage" /> <uses-p

mongodb - efficient way to transform a playframework JsValue to a MongoDBObject -

i'm receiving json graph (payload) client, @ web api jsvalue. want take that, decorate couple of fields , store in mongo. this: case class plan(_id: objectid, name: string, payload: jsvalue) { "_id" = 12345, "name" : "test model", "payload" : {a json graph} } from jsvalue database... builder += "payload" -> json.parse(json.stringify(model.payload)) from database jsvalue... payload = json.parse(dbo.as[mongodblist]("payload").tostring)) while works go jsvalue -> string -> mongodbobject, have 2 valid typed objects , have use untyped intermediate format go 1 another. if want store graph string "payload", can of course that. you may want consider using reactivemongo instead of casbah, along play-reactivemongo , provides direct-to-json capability. have not used play-reactivemongo.

c# - How to handle a NULL value in reader.GetByte(x)? -

i've got following block of code: //check see if unique_id 10 or 11 , process accordingly //10 = both boxes, 11 = rework if (reader.getbyte(16) == 10) { int es = convert.toint32(reader["escalated"]); if (es == 0) { chkescalated.checked = false; } else { chkescalated.checked = true; chkescalated.visible = true; lblescalated.visible = true; chkrework.visible = true; lblrework.visible = true; } } else if (reader.getbyte(16) == 11) { } else { } the problem have is, sometimes, reader.getbyte(16) null. , when happens, error: data null. method or property cannot called on null values. i'm still of novice, i'm sure there's obvious i'm missing, can't find it. use isdbnull method : //check see if unique_id 10 or 11 , process accordingly //10 = both boxes, 11 = rework if (reader.isdbnull(16)) { //add here code handle null value } else { //use switch read value 1 time s

c - Socket connect returns errno ETIMEOUT -

i have 1 tcp/ip ssl server enabled epoll can handle ten thousand connections simultaneously. when tried test server,i created thousand clients using thread. when tried connect server,after time connect() return etimeout. how overcome error? you change socket attributes recv , xmit timeout values same way set keepalive attribute

Qlikview folder list using QMS api -

Image
i able list of qlikview files using following code qms api. string key = client.gettimelimitedservicekey(); servicekeyclientmessageinspector.servicekey = key; serviceinfo[] qvservice = client.getservices(servicetypes.qlikviewserver); documentnode[] alldocs = client.getuserdocuments(qvservice[0].id); but lists qlikview files. folders? can kindly suggest me code folders well? there sample in qms api documentation under getsourcedocumentfolders method. example writes name of documents , folders console using recursion navigate through sub folders. this not need, can adapt store these in array, etc. have attempted change variable names match code supplied: list<documentfolder> sourcedocumentsfolders = client.getsourcedocumentfolders(qvservice[0].id, documentfolderscope.general | documentfolderscope.services); foreach (documentfolder sourcedocumentfolder in sourcedocumentsfolders.orderby(x => x.general.path)) { // print names of source d

F#: Using a F# indexed property from C# -

i have written class in f# implementing interface in order build c#-friendly interface f#-assembly. i have written of properties indexed properties. however, when try use type c#, synthetic get_propertyname methods in intellisense , compiler likewise complains in case want use indexed properties c# ones. code reference: type imyinterfacetype = abstract myproperty : mytype1 abstract myindexedproperty : mytype2 -> mytype3 abstract mytwodimensionalindexedproperty : (mytype4 * mytype5) -> mytype6 type myinterfacetype = new () = { } interface imyinterfacetype member this.myproperty () = new mytype1 () member this.myindexedproperty parameter = new mytype3 () member this.mytwodimensionalindexedproperty pair = new mytype6 () when trying access class c#, methods get_myindexedproperty(mytype2 parameter) get_mytwodimensionalindexedproperty(tuple<mytype4, mytype5>) instead of indexed properties had hoped for. am doi

c# - Parse for Universal Apps -

i'm trying implement parse push notification on windows phone 8.1 (windows runtime app) searching around found need download sdk parse website , add reference parse.dll , parse.winrt manualy. i'm able use library, when try subscribe channel after while throws exception. i'm not able find proper tutorial :( anyway line of code reise exception: parsepush.subscribeasync("testchannel"); and stacktrace: at system.threading.tasks.task.throwifexceptional(boolean includetaskcanceledexceptions) @ system.threading.tasks.task 1.getresultcore(boolean waitcompletionnotification) @ system.threading.tasks.task 1.get_result() @ parse.parseinstallation.b__d(task 1 t) @ system.threading.tasks.continuationtaskfromresulttask 1.innerinvoke() @ system.threading.tasks.task.execute() --- end of stack trace previous location exception thrown --- @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) @ system.runtime.compilerservi

javascript - Smoothing arcs/plot points in D3.js/GeoJSON/TopoJSON/Shapefile (somewhere along the way) -

Image
i've been looking around while answer this, , haven't been able figure out. i'm creating topojson file grid based data (grib files). i can pretty interpolate data down finer resolution grid plot points appear smoother when zoomed out, when zoomed in, it's inevitable see blocky grid points. i've looked simplification, a bit not quite smoothing. i'm using d3 render data. is can done on front end or should/can done in raw topojson data? i don't want able tell it's grid, if zoom in 10,000%. here's example of i'm after: is can done on front end or should/can done in raw topojson data? this should done on front end. if smooth data before wrote json file, file needlessly big.

c++ - Interrupt an arbitrary wait operation -

in boost.thread , have boost::thread::interrupt . however, usage limited. in particular, applies wait operations listed here . so, example, common mutex::lock operation cannot interrupted using method. boost support no full-range interruption capabilities, , there no way interrupt mutex::lock operation? know that, in windows api, wait operation can interrupted using alertable wait functions . you correct boost::thread::interrupt limited, , in fact not promoted std::thread in c++11 @ all. recommendation use condition variable.

iOS Trying to call web service and I'm getting a NSURLErrorDomain error -

i'm trying connect web service if hit through safari json, when hit through code nsurlerrordomain error following description. "the certificate server invalid. might connecting server pretending "url" could..." here code: nsurl *url = [nsurl urlwithstring:@"webservice_url"]; nsmutableurlrequest *request = [nsmutableurlrequest requestwithurl:url]; [request sethttpmethod:@"get"]; nserror *error = nil; nshttpurlresponse *responsecode = nil; nsdata *oresponsedata = [nsurlconnection sendsynchronousrequest:request returningresponse:&responsecode error:&error]; can explain how around this? also, https web service. the website doesn't have https certificate. try looking this: https://stackoverflow.com/a/15011030/4716039

javascript - Displaying a dialog from within a Polymer component -

i've polymer component, inside of 1 of function want display dialog user. tried dialog-paper follows: <template> <link rel="stylesheet" href="../themes/the-graph-dark.css"> <link rel="stylesheet" href="../themes/the-graph-light.css"> <div id="svgcontainer"></div> <paper-dialog heading="title dialog" id="dialog"> <p>lorem ipsum ....</p> <p>id qui scripta ...</p> <paper-button label="more info..." dismissive></paper-button> <paper-button label="decline" affirmative></paper-button> <paper-button label="accept" affirmative autofocus></paper-button> </paper-dialog> </template> ... eventhandler: function(event) { this.$.dialog.toggle(); console.log(event); }, when try toggle dialog when eventhandler invoked nothing shown , uncaught typee

java - Spring form input can't be disable -

i want disable <form:input> attribute disabled, it's not working. <td class="value"> <sec:authorize access="hasanyrole('role_edit_device_install_date')"> <form:input path="installdt" maxlength="10" size="10" cssclass="installdatepicker" /> <form:errors path="installdt" cssclass="errormsg" /> </sec:authorize> <sec:authorize access="!hasanyrole('role_edit_device_install_date')"> <form:input path="installdt" maxlength="10" size="10" cssclass="installdatepicker" disabled="disabled" /> <form:errors path="installdt" cssclass="errormsg" /> </sec:authorize> </td> does have idea solve ?

java - I need help on regular expression to allow number with character -

condition: 123 not valid 123 valid abc123 valid abc123ab valid i have apply regular expression compulsory character number? this match string starting optional set of digits followed combination of white spaces, letters , digits. still matches 123_ (that's 123 followed space `) ^\d*[\sa-za-z0-9]+$ the following check if have @ least 1 letter in string combined optional digits, white spaces , letters. [a-za-z\s\d]*[a-za-z]+?[a-za-z\s\d]* [a-za-z\s\d] match single character present in [] . quantifier * : between 0 , unlimited times, many times possible, giving needed [greedy] quantifier: +? between 1 , unlimited times, few times possible, expanding needed [lazy]

xml - Java config storage choice -

first of all, i'm new here writer, not reader. used stackoverflow years find lot of useful information, decided join community. now question java config storage choice. the application currently i'm working on java (fx) project myself. java application used on few desktop machines. goal of application power on/off linux devices on ssh (for example server). i want make possible user add 5/10 devices information of device (name , ip), ssh credentials power on command , ssh credentials power off command (user, host, key, port, timeout, command). there javafx gui, gui have menu bar menu called devices select, add, edit or delete device. in center of gui there 2 buttons, used power on/off commands (or switch). design the programming language java. the gui based on javafx. for power on/off commands use command design pattern. storage i tried different storage options (sqlite, properties , xml) storing information of devices. didnt found out option fits best

android - Run Unit Test Before Launch -

i have created first unit test part of android project. followed guide found here . now include unit tests in "test" package before app launched phone. how include in gradle file?

android - Gradle: How to execute task after create lib.aar file? -

i have gradle task unbacks lib-debug.aar need execute task after crate lib-debug.aar file task unzip<<{ copy { def aarfile = file("${builddir}/outputs/aar/lib-debug.aar") def outputdir = file("${builddir}/outputs/eclipse") ziptree(aarfile) outputdir } you can do: unzip.dependson assemble that make whenever run unzip task, assemble task has have run before.

javascript - How to get all directive names in a given angular app? -

say have angular app, has modules , directives. want list of defined directives in app. for example: var mymodule = angular.module('mymodule', [function(){...}]); mymodule.directive('mydirective', [function () {...}]); mymodule.directive('myotherdirective', [function () {...}]); var myothermodule = angular.module('myothermodule', [function(){...}]); myothermodule.directive('thirddirective', [function () {...}]); i want write function getalldirectives() return ['mydirective','myotherdirective','thirddirective'] . also if possible know module each directive belongs to: { 'mymodule': ['mydirective','myotherdirective'], 'myothermodule':['thirddirective'] } how can done? please note need outside app , after has loaded. have access publicly available on page, such angular object , dom . you can directives defined in each module using custom function one

c# - What is a NullReferenceException, and how do I fix it? -

i have code , when executes, throws nullreferenceexception , saying: object reference not set instance of object. what mean, , can it? what cause? bottom line you trying use null (or nothing in vb.net). means either set null , or never set @ all. like else, null gets passed around. if null in method "a", method "b" passed null to method "a". the rest of article goes more detail , shows mistakes many programmers make can lead nullreferenceexception . more specifically the runtime throwing nullreferenceexception always means same thing: trying use reference, , reference not initialized (or once initialized, no longer initialized). this means reference null , , cannot access members (such methods) through null reference. simplest case: string foo = null; foo.toupper(); this throw nullreferenceexception @ second line because can't call instance method toupper() on string reference pointing null . debu

cordova - phonegap navigator.app.exitApp in windows, advice sought -

i have phonegap app working in both ios , android , planning release on windows phone. have used navigator.app.exitapp in android not in ios heard apple interpret crash. is there such advice using in windows phone? i didn't encounter problems using it, our app approved , still in store. it's alright use it.

domain driven design - The placement of utility classes in DDD -

i'm trying figure out put utility classes in ddd based project. case follows: i have class called cookieawarewebclient required core work. form i've read online seems class belongs in infrastructure tier, 1 not supposed refer infrastructure tier core tier. means cannot place functionality core tier depends on in infrastructure tier. should cookieawarewebclient class placed? without understanding need do, believe @plalx sums in comments: establish interface provides functionality core tier requires implement interface in cookieawarewebclient use dependency inversion allow core use cookieawarewebclient here's code (c# in case) constructor injection example: the interface: namespace core { public interface iblah { int somethingcoreneeds(); } } the implementation cookieawarewebclient: namespace services { public class cookieawarewebclient : iblah { // ... rest of class private int _somethingcookieawarewebclienthasthatcorene

Edit HTML Comment Text using JQuery or Javascript -

is possible edit text enclosed inside html comment using javascript or jquery. example if have comment like: <!-- comment --> then possible change text 'this comment' using jquery or javascript? thanks. you can iterate through childnodes of comment's parent element, filter commentnode , change it's value resetting nodevalue property: $('#parent').contents().each(function() { if ( this.nodetype === 8 ) { this.nodevalue = 'changed value'; } }); using vanilla javascript : var parentnode = document.getelementbyid('parent'); [].foreach.call(parentnode.childnodes, function(el) { if ( el.nodetype === 8 ) { el.nodevalue = 'changed value'; } });

How to send error in laravel response? -

i writing code changing password. code follows: public function changepassword(changepasswordrequest $request) { $credentials = ['email'=>auth::user()->email, 'password'=>$request['old_password']]; if (auth::validate($credentials)) { password change code; } else { should there? } } without using ajax can return redirect view errors. should error sending code in else part when using ajax, if old password wrong? can match old password in changepasswordrequest.php well? return response()->json(['old_password'=> ["your old password not correct."] ], 403);

statistics - R - print outlier from a datafram -

i want extract outliers data frame. 10 out of 1000 data points possible outliers or doesn't fall in 95% confidence interval. there ways find value largest difference between , sample mean. > <- c(1,3,2,4,5,2,3,90,78,56,78,23,345) > require("outliers") > outlier(a) [1] 345 i don't want remove outliers dataframe or boxplot. want print or subset them. any ideas? given data: a <- c(1,3,2,4,5,2,3,90,78,56,78,23,345) if want values not within 95% confidence. have keep in mind confidence concept of probability of "true mean". in case: > mean(a) [1] 53.07692 first question answer: 53 "normal" value expect? why ask it? because if want print values not within 95%: a[a > mean(a) + qt(0.975, df = length(a) - 1) * mean(a) / sqrt(length(a)) | < mean(a) - qt(0.975, df = length(a) - 1) * mean(a) / sqrt(length(a))] [1] 1 3 2 4 5 2 3 90 345 you might more expect, in case.

Changing IP with PowerCLI in Powershell -

i've created script makes clone of vm in vcenter, renames it, changes ip of vm once has powered (from ip of template). having prompt ask ip should be. issue, need enter required ip twice. once label vm, , again change ip of box. is there way of carrying on variable '$newvmip' entered here: add-pssnapin vmware.vimautomation.core connect-viserver -server vcenter01 -user myusername -password password1 start-sleep -s 6 $templatevm = "windows qa - 172.30.30.110 - template" $newvmip = read-host "please input ip of new vm" $newvmfor = read-host "please input vm for?" $newvmdate = read-host "please input todays date" $newvmname = "windows qa - $newvmip - $newvmfor - $newvmdate" new-vm -name $newvmname -vm $templatevm -vmhost "esx01.coname.local" move-vm -vm $newvmname -destination testing start-vm -vm $newvmname start-sleep -s 200 to second part of script: $username = "vmadmin" $password = "