Posts

Showing posts from January, 2010

java - error: cannot access Referenceable class file for javax.naming.Referenceable not found -

i'm having error:(22, 15) error: cannot access referenceable class file javax.naming.referenceable not found in connection mssql using stored procedure , custom username , password code connection class: class connectds { boolean b = false; void conn(string user, string pass) { // declare jdbc objects. connection con = null; callablestatement cstmt = null; resultset rs = null; try { // establish connection. sqlserverdatasource ds = new sqlserverdatasource(); ds.setuser("sa"); ds.setpassword("123"); ds.setservername("localhost"); ds.setportnumber(1433); ds.setdatabasename("db_diglib"); con = ds.getconnection(); // execute stored procedure returns data. string db_user, db_pass, call = "{call [dbo].[usp_logininfo](" + user + "," + pass + ")}&qu

javascript/highchart append value to an existing series -

i have highchart potentially receives data duplicate keys, wondering how can build logic that'll merge 2 key/values 1 series. this data var dataarray = [{ errordate: "2017-09-07", brand: "toyota", count: 3 }, { errordate: "2017-09-02", brand: "ford", count: 258 }, { errordate: "2017-09-03", brand: "ford", count: 239 }, { errordate: "2017-09-04", brand: "ford", count: 197 }, { errordate: "2017-09-05", brand: "ford", count: 187 }, { errordate: "2017-09-06", brand: "ford", count: 418 }, { errordate: "2017-09-07", brand: "ford", count: 344 }, { errordate: "2017-09-03", brand: "mercedes", count: 43 }, { errordate: "2017-09-04", brand: "mercedes", count: 220 }, { errordate: "2017-09-03", brand: "chrysler", count: 3 }, { errordate: "2017-09-04"

[VBA]How to delete all useless 0 in the end of a column -

my purpose needs find out time gap between every row. should go 1 second 1 second, see until 11:40, there large one. example, time a3-a2=b1. solved problem already, code following. it runs ok, in end of column b, there long list of 00:00:00. want match last number of column b column a, means column b , should have same length. thousands of 00:00:00 in end. sub calculatetimegap() columns("b:b").insert shift:=xltoright, copyorigin:=xlformatfromleftorabove range("a1").value = "time" columns("a:a").numberformat = "hh:mm:ss" columns("b:b").formula = "=a2-a1" range("b1").value = "time difference(s)" columns("b:b").numberformat = "hh:mm:ss" lrow = cells(rows.count, 1).end(xlup).row end sub time time difference(s) 11:28:37 00:00:01 11:28:38 00:00:01 11:28:39 00:00:01 11:28:40 00:11:35 11:40:15 00:00:01 11:40:16 00:00:01 11:40:17 00:00:01 11:40:

java - Keycloak extension with dependencies -

i'm creating keycloak extension dependencies. added entry on pom.xml this: <dependency> <groupid>org.json</groupid> <artifactid>json</artifactid> <version>20160810</version> </dependency> then deployed keycloak: mvn clean install wildfly:deploy but when run it, got error: org.jboss.resteasy.spi.unhandledexception: java.lang.noclassdeffounderror: org/json/jsonobject caused by: java.lang.noclassdeffounderror: org/json/jsonobject caused by: java.lang.classnotfoundexception: org.json.jsonobject [module "deployment.keycloak-authenticator.jar" service module loader] @ org.jboss.modules.moduleclassloader.findclass(moduleclassloader.java:198) @ org.jboss.modules.concurrentclassloader.performloadclassunchecked(concurrentclassloader.java:412) @ org.jboss.modules.concurrentclassloader.performloadclass(concurrentclassloader.java:400) @ org.jboss.modules.concurrentclassloader.loadclass(concurren

spark structured streaming aggregation without timestamp on data (aggregation based on trigger) -

i need perform aggregation on incoming data based on spark driver timestamp, without watermark. data doesn't have timestamp field. the requirement is: compute average of data received every sec (it doesn't matter when have been send) for example need aggregation on data received every trigger, previous rdd streaming api. is there way ? you can create own sink , operation on each addbatch() call: class customsink extends sink { override def addbatch(batchid: long, data: dataframe): unit = { data.groupby().agg(sum("age") "sumage").foreach(v => println(s"result=$v")) } } class customsinkprovider extends streamsinkprovider datasourceregister { def createsink( sqlcontext: sqlcontext, parameters: map[string, string], partitioncolumns: seq[string], outputmode: outputmode): sink = { new personsink() } def shortname(): string = "person&qu

c++ - Why can't I connect my Slider Signal with my Label in Qt? -

i trying solve code in qt: qlabel * laslider = new qlabel("100"); //initial label value laslider->setalignment(qt::aligncenter); layouttop->addwidget(laslider); qslider * slider = new qslider(qt::horizontal); slider->setminimum(1); slider->setmaximum(200); slider->setvalue(100); layouttop->addwidget(slider); qobject::connect(&slider, &qslider::valuechanged, laslider, static_cast<void(qlabel::*)(int)>(&qlabel::setnum)); i got following error: c:***\qt_project\qt_interaction\interaction\main.cpp:60: error: no matching function call 'qobject::connect(qslider**, void (qabstractslider:: )(int), qlabel &, void (qlabel::*)(int))'laslider, static_cast(&qlabel::setnum)); i don't understand wrong code...

python - Obtain JSON request in Bokeh server application -

i direct user page hosted bokeh server along bit of metadata. example might want direct user to http://my-server/my-page?var=value i {'var': 'value'} request in bokeh server application code on python side can respond accordingly. is possible? if so, how? a bokeh core dev pointed me documentation page: https://bokeh.pydata.org/en/latest/docs/user_guide/server.html#accessing-the-http-request in particular, available on document object: # request.arguments dict maps argument names lists of strings, # e.g, query string ?n=10 result in {'n': [b'10']} args = curdoc().session_context.request.arguments try: n = int(args.get('n')[0]) except: n = 200

What is the reason for not having one-time binding in Angular -

i have tried googling long time not find valid answer. why there no 1 time binding in angular 2. dont think changedetectionstrategy 1 time binding solution. why did angular team did not consider include feature? did see no performance benefit implementing this. if binding data once titles , headers etc 1 way binding great go right? since have less watchers 1 time binding did ignore it? please let me know. edit 1 time binding @ property level possible in angular 1 using {{::name}} not included in angular 2. why syntax removed. appreciated i believe it's because of difference in implementation of change detection mechanism. in angularjs can dynamically add or remove watchers update dom. example, if have following template: {{name}} you can add watcher: const unwatch = $scope.$watch('name', () => { updatedom() }); what's interesting angularjs returns reference function can call remove watcher dynamically. , angular uses possibility remove wat

python - How to use namespaces with xml.sax package -

i trying parse xml file, including namespaces, python xml.sax package, doesn't work. below find example internet, extended namespace "abc". can show me way work it? this xml file: <collection shelf="new arrivals"> <movie title="enemy behind"> <type>war, thriller</type> <format>dvd</format> <abc:year>2003</abc:year> <rating>pg</rating> <stars>10</stars> <description>talk us-japan war</description> </movie> <movie title="transformers"> <type>anime, science fiction</type> <format>dvd</format> <abc:year>1989</abc:year> <rating>r</rating> <stars>8</stars> <description>a schientific fiction</description> </movie> <movie title="trigun">

Java how to persist a value abstractly? -

i'm trying figure out best way persist value in java, i'm new using. i'm used in cocoa using nsuserdefaults persist small amounts of data ints or strings. benefit of no matter app launched or nsuserdefaults writes data, know i'll able retrieve same data. is there way in java? use java preferences api: https://docs.oracle.com/javase/8/docs/technotes/guides/preferences/index.html

html - svg issue with safari when zooming in -

i have svg using values pixels (cx, cy, r). when open in safari , cmd + "+" or cmd + "-" messes up. don't know how fix this. problem doesn't happen chrome. the computed values styles change when doing 1 of 2 actions. don't want them change. body { background-color: black; } .container { width: 28%; height: 28%; position: absolute; top: 50%; left: 50%; transform: translatex(-50%) translatey(-50%); } .circle { transform-origin: center center; } .circle-1 { transform: rotatez(0deg) translatez(0); stroke-dasharray: 220; stroke-dashoffset: 20; } .circle-2 { transform: rotatez(540deg) translatez(0); stroke-dasharray: 176; stroke-dashoffset: 20; } .circle-3 { transform: rotatez(72deg) translatez(0); stroke-dasharray: 132; stroke-dashoffset: 30; } <!-- reproduce, open in safari e.g. safari 10.1 , click command + "+". positioning circles changes. doesn't happen in chr

android - AsyncTask Calling itself multiple Times -

i have asynctask working except calls doinbackground multiple time. i'm calling broadcastreceiver asynctask broadcastreceiver calls service service executes background works calls broadcastreceiver 3 times why ? ideas? hint : onreceive in logcat refers onreceive method in mybroadcastreceiver , oncommandstart refers myservice uploadfileasync.java: public class uploadfileasync extends asynctask<string, integer, string> { private int serverresponsecode = 0; private string sourcefileuri, link, spec, username, title, abstract_, desc; private intent intent; private context ctx; private notificationcompat.builder mbuilder; private notificationmanager mnotifymanager; public uploadfileasync(intent intent, string sourcefileuri, context ctx) { this.intent = intent; this.sourcefileuri = sourcefileuri; this.ctx = ctx; } private void prepareparams() { this.title = intent.getextras().getstring(

asp.net core - Azure AD Authentication error: failed_to_acquire_token_silently -

at random intervals, asp.net mvc core application throws error while attempting authenticate users via azure ad openidconnect: failed_to_acquire_token_silently and workaround has been truncate adal's database table usertokencache . not sure doing wrong in owin pipeline configuration. once user authenticated, want acquire token graph api in order retrieve additional claims azure ad. exception gets thrown catch block accesstoken = authenticationcontext.acquiretoken("https://graph.windows.net", clientcredential).accesstoken; here complete method: /// <summary> /// method has been adapted generated code new asp.net mvc 5 project template /// when using organisational accounts authentication. /// method acquires token azure ad in order call graph api. /// token acquired using logged in user's refresh token. /// </summary> /// <param name="context"></param> /// <retur

android - Trying to submit a URL with the '*' symbol in a Retrofit 2 API call and it won't accept it -

i trying conduct following api call, seen in postman, , successful (get call " https://www.reddit.com/subreddits/search/.json?q=nb *"): api call image however, when try same thing in android application using retrofit 2, api call not give desired result, instead returning empty json object (taken log): search response subreddit string nb* , url https://www.reddit.com/subreddits/search/.json?q=nb*: {"kind":"listing","data":{"modhash":"","children":[],"after":null,"before":null}} here retrofit interface: @get("/subreddits/search/.json") call<jsonobject> searchsubreddits(@query(value = "q") string subredditstring); i have tried adding encoded = true query annotation, not make difference. update: i have researched encoding urls , have found issue think retrofit not encod

javascript - Auto populate Comma and Decimal in Text Box -

i have text box of dollar amount ( html below ). trying add css or jquery auto populate comma , decimal when user enters value in text box. eg , if user enters 123456789 , should automatically become 12,345,667.89 . <html:text styleid="incomeperperiod" styleclass="textbox" property="employment.incomeperperiod" maxlength="10" /> i added below class html code above it's not working. can please me on how achieve ? class="form-control text-right number" it might or might not simpler pure js string functions here regexp version. the thing is, couldn't find way group entered number string ??n nnn ... nnn nnn nn matches regexp. relatively simple groups nn nnn nnn ... nnn n?? . regex; /(^\d{2})|(\d{1,3})(?=\d{1,3}|$)/g so reverse string start follows; array.prototype.reduce.call(str,(p,c) => c + p) then applying regex reversed string .match(rex) work like, "123456789" yield [ '98

java ee - How to get UI instance in CDIView in Vaadin? -

i have myui class @theme("mytheme") @cdiui("") public class myui extends ui { @inject loginview loginview; @override protected void init(vaadinrequest vaadinrequest) { setcontent(loginview); } ... i have view init method annotated @postconstruct @uiscoped @cdiview(loginview.viewname) public class loginview extends verticallayout implements customview { @postconstruct public void initview() { //initializations elements component loginform = buildloginform(); addcomponent(loginform); setcomponentalignment(loginform, alignment.middle_center); notification notification = new notification("demo"); notification.setdescription("<span>demo</span>"); notification.sethtmlcontentallowed(true); notification.setstylename("tray dark small closable login-help"); notification.setposition(position.bottom_center); notification.setdel

java multithreading. sharing data in a thread-safe manner -

i'm programming tcp socket application in java , have doubt regards how in thread-save manner. in eample, static method startserver(int port) creates passive tcp socket. in main, wait incoming connection, managed dedicated thread. firs of all, understand interaction between threads. let a, b 2 instance of same class: instance attributes of not visibile b; static attributes visible both , b. let t1 , t2 2 threads of same class: does attributes visibility works in same manner instance? in other words, static attributes can shared thread? non static attributes thread-safe? in code thread-safe? import java.io.*; import java.net.*; import java.util.*; public class multithreadserver extends thread { private socket client; private string nonstaticattribute; private static volatile vector<string> clientsvector; public multithreadserver(socket c, string enc) {client = c; nonstati

reactjs - react-navigation: Include a Component in each screen -

i'm using stacknavigator redux below. cleanest way include component screens? i've tried adding child component both appwithnavigationstate , appnavigator no luck. <provider store={store}> <appwithnavigationstate /> </provider> const appnavigator = stacknavigator({ login: { screen: login }, main: { screen: main }, }, { headermode: 'none', } }) const appwithnavigationstate = ({ dispatch, router }) => { return( <appnavigator navigation={addnavigationhelpers({ dispatch, state: router })} /> ) }; const mapstatetoprops = (state) => ({ state, }); export default connect(mapstatetoprops)(appwithnavigationstate); you can try add sibling component rather adding child component. try example below. example const appwithnavigationstate = ({ dispatch, router }) => { return( <view> <appnavigator navigation={addnavigationhelpers({ dispatch, state: router })} /> <defau

c# - web url validator to class level validation -

i have simple class , corresponding properties. add validation rules (to web property). want check web address valid. types of conditions need check for? my thinking: have require format www.example.sometext should check valid .sometext endings (i.e. .com, .org, etc.) problem there unlimited of these now. so question add validation rule on class level handle this? public string webaddress { get; set; } you can use uri.iswellformeduristring method. return true if string well-formed, if not return false. link msdn: iswellformeduristring

Disable spacing between items in TextFlow in JavaFX -

Image
i'm trying make line of text consists of name , string of text. want name hyperlink , rest plain text. i thought textflow this, problem automatically puts single space between hyperlink , text. if want textflow example jane 's awesome the textflow make a jane 's awesome is there method or css property disable behaviour? solution you can remove padding via css style: .hyperlink { -fx-padding: 0; } or can in code if wish: link.setpadding(new insets(0)); background the default setting can found in modena.css file in jfxrt.jar file packaged jre distribution , is: -fx-padding: 0.166667em 0.25em 0.166667em 0.25em; /* 2 3 2 3 */ sample application in sample screenshot second hyperlink has focus (hence dashed border). import javafx.application.application; import javafx.geometry.insets; import javafx.scene.scene; import javafx.scene.control.hyperlink; import javafx.scene.layout.pane; import javafx.scene.text.text; import j

java - LibGDX primitive keyboard with a listener for each key -

trying make simple typing game. i've created keyboard consisting of libgdx scene2d textbuttons , putting them in 3 scene2d tables (for each row of keys) , wrapping them in table. here's code far: gdx.input.setinputprocessor(stage); table keyboard = new table(); table keystop = new table(); table keysmid = new table(); table keysbot = new table(); final char ascii[] = {'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'z', 'x', 'c', 'v', 'b', 'n', 'm'}; // create keys in order of ascii[] table above (int index = 0; index < ascii.length; index++) { keys[index] = new textbutton("", skin); string letter = character.tostring(ascii[index]); keys[index].settext(letter); keys[

java - Max Zero Binary Gap colidity practice test StringOutOfBounds Exception -

this colidity binary gap problem. restrictions o(logn) runtime , o(1) space complexity. write function: class solution { public int solution(int n); } that, given positive integer n, returns length of longest binary gap. function should return 0 if n doesn't contain binary gap. for example, given n = 1041 function should return 5, because n has binary representation 10000010001 , longest binary gap of length 5. i liked trying go solution , wondering if there way ignore out of bounds exception. tried try catch didn't work. there way out of or have different approach? here code: import java.util.*; // can write stdout debugging purposes, e.g. // system.out.println("this debug message"); class solution { public int solution(int n) { int maxzero = 0; int j =0; int tempzero=0; //convert number binary string b = integer.tobinarystring(n); boolean zeroflag = false; //iter

vsts - Team member unable to connect in Visual Studio -

Image
i have project @ myname.visualstudio.com/myteam/myproject. added contributor team, , able clone project. after upgrading vs2017, myname.visualstudio.com no longer appears in list of available servers when click manage connections . can see code through project's portal, clicking on "open in visual studio" results in message box visual studio saying "you not allowed access https://myname.visualstudio.com/defaultcollection ". don't know if it's expected should have access defaultcollection, since have permissions see 1 of many projects. either way, if can see code in portal, cannot see in visual studio, seems bug. i have verified same microsoft account being used in both places. happens inherited account used log windows 10. we've tried removing login in vs logging in again. doesn't ask credentials due inheriting windows 10. i've tried removing permissions project reapplying. they've tried adding server address manually. that&

css - Drupal 7 print.less editing issue -

drupal 7 bootstrap module installed sites/all/libraries/bootstrap/ i'm running issue editing css style page printing. when looking @ css through chrome dev tools shows css file: sites/all/libraries/bootstrap/css/less/print.less, file not exist. adding css style can't unset , need changed. when grep css causing me issues turns in: sites/all/libraries/bootstrap/bootstrap.min.css.map, when edit css in file not change. i have cleared cache using button in development > performance , using drush cc all, css not update. i have tried adding less/print.less folder/file in hopes override, no success. the specific css causing me problems this: *, *:before, *:after { background: transparent !important; color: #000 !important; // black prints faster: h5bp.com/s box-shadow: none !important; text-shadow: none !important; } the !important tag on background messing me up. if tip me off how edit print.less i'd obliged.

Haskell: Higher Order function to use to group an increasing decreasing list -

given list [1,2,31,23,22,1,43] use higher order function group elements [[1,2,31], [23,22,1], [43]] . increasing / decreasing list, elements elements in increasing order , in decreasing order. groupincdec :: ord => [a] -> [[a]] each element in output list [[a]] should either increasing or decreasing, in example above, first element [1,2,31] increasing, second [23,22,1] decreasing , because there single element left , previous state decreasing, [43] can classified increasing. could not figure out if/how use groupby . hints appreciated. thanks. [edit: added more description, clarify question further.] here's approach. moment, let's assume list has no adjacent equal elements, example. if list lst compared own tail, element-by-element: > let lst = [1,2,31,23,22,1,43] > let dir = zipwith compare lst (tail lst) > dir [lt,lt,gt,gt,gt,lt] then dir represents whether adjacent elements increasing or decreasing. if repeat head of list:

java - LiveData vs Handler and LocalBroadcast -

i have old android/java code, contains 2 derives intentservice , , these services not run in separate processes. the question way return result these intentservice . one service return result using handler + runnable , run code in main loop: new handler(looper.getmainlooper()).post(new runnable() { @override public void run() { myapplication.get().setfoo(something); } }); the other 1 uses localbroadcastmanager.getinstance(this).sendbroadcast(in); send message activity , , activity subscribe via broadcastreceiver on message in onresume , , unsubscribe in onpause . am right, , in both case possible use livedata simplify things? intentservice should create livedata , want result should observe it, , when new data arrives intentservice should call postvalue , or may there reefs prevent usage of livedata here? both methods work using livedata since purpose of livedata have on thread , still notify users when has changed. seems replace

tensorflow - Tensorboard: Plot loss curves of mutiple models together -

in tensorboard, easy display loss curve of single cnn model. if trained 2 models seperately (inception-v4 , resnet, example) , want plot loss curves of @ same time(like figure shown below), should do? enter image description here i think can achieve creating 2 separate filewriter s - 1 each model: inceptionwriter = tf.summary.filewriter('/tmp/tensorboards/example/inception4') resnetwriter = tf.summary.filewriter('/tmp/tensorboards/example/resnet') and using writers add summaries inpection , resnet models respectively. inceptionwriter.add_summary(loss_summary, step) * * * resnetwriter.add_summary(loss_summary, step) the thing left run tensorboard using command tensorboard --logdir=/tmp/tensorboards/example tensorboard automatically combine data in 1 plot in case looks this btw there interesting demo of basic tensorboard capabilities presented 1 of google's developers https://www.youtube.com/watch?v=ebbedrscmv4&t=773s

php - Laravel database - how to return results as arrays by default? -

how can make sure laravel database return array default? for instance: $data = $this->database->table('user')->get(); result: illuminate\support\collection object ( [items:protected] => array ( [0] => stdclass object ( [uuid] => jondo [email] => barz@bar.com [name] => jondo [created_on] => 1505239603 [updated_on] => 0 ) ) ) if use toarray: print_r($data->toarray); result: array ( [0] => stdclass object ( [uuid] => jondo [email] => barz@bar.com [name] => jondo [created_on] => 1505239603 [updated_on] => 0 ) ) i still stdclass object don't want @ all. any ideas? it returns array. try make dd($data); can see array information , elements on it.

audio - How to create sound devices for debian in docker? -

i'm using various docker containers which, under covers built on debian sid. these images lack /dev/snd , /dev/snd/seq , pretty makes sense since have no hardware audio card. several pieces of software i'm using generate midi files require these sequencer devices present. they're not used send out audio, code dies in init if sound devices not exist. clear, don't need generate audio signal within docker, rather need these exist make other software happy. so far, i've tried endlessly installing various alsa packages ( alsa-utils , alsa-oss , , others) , trying modprobe way out of this, no luck. within docker container, needs happen have valid audio devices if dummy?

Setting up more than one MQTT broker with Docker -

using docker, able use eclipse-mosquitto set mqtt broker app, subscribes messages. i'm learning docker right now, wanted try adding 2 brokers docker-compose different ports mapped this: version: '3' services: myapp: ... links: - mqtt - mqtt2 depends_on: - mqtt - mqtt2 mqtt: image: eclipse-mosquitto:latest container_name: mqtt-iot ports: - 1883:1883 mqtt2: image: eclipse-mosquitto:latest container_name: mqtt2-iot ports: - 1884:1883 from outside of myapp container (i.e. os x terminal), both mqtt , mqtt2 working; can publish , subscribe messages expected. const mqtt = require('mqtt') mqtt.connect('mqtt://mqtt', {port: 1883}) // success mqtt.connect('mqtt://mqtt2', {port: 1884}) // success however, when i'm inside container of myapp , can connect mqtt . mqtt2 connection fires offline event right away, , no connection fails. need myapp using both of brok

javascript - For ServiceWorker cache.addAll(), how do the URLs work? -

i see lot of example code this: (slightly shortened version of this mozilla doc ) this.addeventlistener('install', function(event) { event.waituntil( caches.open('v1').then(function(cache) { return cache.addall([ '/sw-test/', '/sw-test/index.html', '/sw-test/style.css', '/sw-test/gallery/', '/sw-test/gallery/bountyhunters.jpg', ]); }) ); }); i don't understand why add both /sw-test/ and /sw-test/index.html . seems either first folder url should autoload underneath, or, if doesn't that, why there? same /sw-test/gallery/ , /sw-test/gallery/bountyhunters.jpg . the docs "the addall() method of cache interface takes array of urls, retrieves them, , adds resulting response objects given cache". isn't helpful. what want cache *.html files few folders , image files (in various formats) folder. listing them one-by-one fragile (w

ios - How can I transform String from a TextField to Int in Swift 3? -

this question has answer here: what “fatal error: unexpectedly found nil while unwrapping optional value” mean? 4 answers i have function introduces new number using textfield: //first node var root = treenode(7) @ibaction func introducirnumero(_ sender: any) { var d = int(entrada1.text!) print(d) var call = treenode(d!) root = treenode(d!) //let numero: int? = (int(entrada1.text!)!) } this function should cast type , send int class: class treenode { var value : int var left : treenode? = nil var right : treenode? = nil //incia como val init(_ rootvalue:int) { value = rootvalue } @discardableresult // if don't use method can send warning func addvalue( _ newvalue:int) -> treenode { if newvalue == value // exclude duplicate entries { return self } else if newvalue <

java - Can't add multiple of same rectangle -

Image
i want make multiple of same rectangle on borderpane make walls game. each wall going same , same size. know image works , there no other errors. use following code add rectangles: public class antz extends application{ public borderpane borderpane; public scene scene; public image wallimage = new image("/recources/images/walls.png"); public rectangle wall = new rectangle(); public int[][] walls = {{1,0,0,0,0,1,1,1,0,1,0,0,0,0,0,1,0}, {1,1,1,1,0,1,0,0,0,1,0,1,1,1,0,1,0}, {0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0}, {0,1,0,1,1,1,0,1,0,1,1,1,0,1,0,1,0}, {0,0,0,0,1,0,0,1,0,0,0,1,0,1,1,1,0}, {1,0,1,1,1,1,0,1,1,1,1,1,0,1,0,0,0}, {1,0,1,0,0,1,0,0,0,0,0,1,0,0,0,1,1}, {1,0,1,1,0,1,0,1,0,1,0,0,0,1,0,0,1}, {1,0,0,0,0,0,0,1,1,1,0,0,1,1,1,0,1}, {0,0,1,0,1,1,0,1,0,1,1,0,1,0,0,0,0}, {1,1,1,0,1,0,0,0,0,0,1,0,1,1,0,

c# - model validation rule starts with and ends with -

i need add validator property of class enforces following: must start "tr" or "we" , end 3-4 digit number. have additional validating rules such length , required can't figure out how enforce 1 outlined above. suspect have regex in someway i'm not sure of syntax. public string tree { get; set; } try following: [regularexpression("^(tr|we)[a-z,a-z]*[0-9]{3,4}$")] public string tree { get; set; } you can read docs examples/more info: https://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.regularexpressionattribute(v=vs.110).aspx

java - Adding hashmap keys to my arraylist -

i have arraylist <string> , hashmap<string, object> , i'm trying add keys arraylist. iterating through, add key in arraylist. my code: for (string key: hmap.keyset()) { string l = ("key: " + key + "\n"); if(!array.contains(l)) array.add(l); }

excel - VBA Macro Printing loop -

[update below] i have been trying write printing macro production sheet. everything actual printouts work great. if use .zoom = false instead of .zoom = 50, printarea ends tiny on printout sheet. if use zoom=50, these inch wide margins left , right. suspect somehow doesn't process actual printarea line, have no clue why since other command lines seem work fine. tried strip code down pretty printarea, fittopagesxx, , got same issue. i tried rewriting code multiple times , either error prompt or same results other code found on web. sub printjob() dim ws worksheet dim long set ws = sheets("filtered_list") = 2 ws.cells(rows.count, "f").end(xlup).row if ws.cells(i, "f").value = 0 exit sheets("print_page") .range("c8").value = ws.cells(i, "f").value worksheets("print_page").pagesetup.printarea = "$c$2:$l$60"

javascript - Realtime Database Records Working Design in Web Application -

i have question, how design/achieve design pattern web application in existing erp system in such way if 1 user fetches record(s) in browser editing purpose , same record being used user, how tackle changes made first user or wise versa , keep updated information both users. trying work on webapp under mvc+c#+angularjs+javascript there loading of records(say 500 nos.) on first form load, binding first record based on id form fields , when user searching record first looking buffered/loaded records if found binds record form fields otherwise goes database search , fetches there, bind fetched record form fields , appends same buffered/loaded records list(array of objects) browsers. yes, here real situation, suppose if user visits form loads 500 records on load, user waits 10 minutes without doing particular record (say id 144) , if other user visits same form , loads same no of records includes record no 144 , make changes , saves db how previous user if tries update record no 144 ch

Javascript - Adding objects to an object - how to handle arrays? -

working javascript object, struggling figure out how add new data (specifically more objects) it. when comes adding data, not sure how turn existing value array of objects. here example of object: it's pretty straight forward, doesn't contain arrays @ point. stuck. var obj = { "data": { "versionfortarget": "1", "rulescontainer": { "rule": { // <--- new rule goes here "ruleparentid": "1", "ruleversionid": "1", "mappedvalue": "1", "processingorder": "1", "metainsertutc": "2017-03-03t17:54:34.643", "value": "omaha", "isruleretired": "0", "userimpactcount": "2277", "attributecontainer": { "attribute": { // <--- new attribute goes here

soda (socrata) NYPD Motor Vehicle Collisions API Cross-origin resource sharing -

i'm trying create mashup using nypd motor vehicle collisions api , google maps javascript api. i'd know if can load data directly nyc api maps api using cross-origin resource sharing. you can! here more details: https://dev.socrata.com/docs/cors-and-jsonp.html

scala - Am I safely mutating in my akka actors or is this not thread safe? -

i little confused if safely mutating mutable maps/queue inside of actor. can tell me if code thread-safe , correct? class someactor extends actor { val userq = mutable.queue.empty[user] val tranq = mutable.map.empty[int, transaction] def receive = { case blank1 => if(userq.isempty) userq ++= getnewusers() case blank2 => val companyprofile = { company <- api.getcompany() // future[company] location <- api.getloc() // future[location] } yield companyprofile(company, location) companyprofile.map { cp => tranq += cp.id -> cp.transaction // tranq mutatated here } } } since mutating tranq futures, safe? it understanding each actor message handled in serial fashion, although maybe frowned upon can use mutable state this. i confused if using inside of future call tranq safe or not. no, code not safe. while actor processes 1 message @ time, lose guarantee future s in

Docker stopped all of sudden in CentOS 7 -

Image
i running docker on centos 7 machine. today trying upgrade container. stopped container , tried pull new image. i got below error error getting v2 registry: https://registry-1.docker.io/v2/: proxyconnect tcp: dial tcp: lookup https_proxy=http: no such host" i checked proxy setting machine in cat /etc/environment , docker in cat /etc/systemd/system/docker.service.d/http-proxy.conf it set correctly. enabled daemon logs docker , logs says sep 14 10:43:18 mycentosserver kernel: [4913751.074277] docker0: port 1(veth1e3300a) entered disabled state sep 14 10:43:18 mycentosserver kernel: [4913751.084599] docker0: port 1(veth1e3300a) entered disabled state sep 14 10:43:18 mycentosserver kernel: [4913751.084888] docker0: port 1(veth1e3300a) entered disabled state sep 14 10:43:18 mycentosserver networkmanager[794]: <info> [1505349798.0267] device (veth1e3300a): released master device docker0 sep 14 10:44:48 mycentosserver dockerd[29136]: time="2017-09-14t10:44:48.8

Unexpected Token = on event handle on reactjs v15 -

i playing reactjs v15 on copen. got unexpected token = error on line _handleclick = (e) => { console.log(reactdom.finddomnode(this.refs.input)); } here react code on codepen: https://codepen.io/dotku/pen/qqwgvv?editors=1010 class welcome extends react.component { _handleclick = (e) => { console.log(reactdom.finddomnode(this.refs.input)); } render() { return <div> <h1>hello, {this.props.name}</h1> <button onkeypress={this._handleclick}>click</button> <input ref="input"/> </div>; } } const element = <welcome name="sara" />; reactdom.render( element, document.getelementbyid('root') ); anyone has idea why? change code this. use conventional function instead of arrow function , bind either in constructor, or inside render function. // class input extends react.component { // render() { // return <input type="text" val

SSAS:Dynamic security is not working unexpectedly -

the problem when inserted new users user table .dynamic security based on dimuser , well-known mdx scripts on state attribute nonempty( [state].[state].members, (strtomember([users].[username].&[+username()+]),[meaures].[userstatecount])) this used 9 months , worked fine . 2 week security has weird behavior , show empty report users , reports .visual studio 2015 , sql 2016 . a screenshot error or error description lot, consider this, in domains, analysis services may perceive user name expected domain\username or localcomputer\username, in cases may return upn formatting of user's name such username@domain.com . therefore may need accommodate upn possibility if write mdx code relies upon username() mdx function. another consideration, verify system administrator don't migrate on ad or on cloud services. hope helps!

nsuserdefaults - How to unarchive data in swift 3? -

i have app save array of cncontact userdefaults such: var contactsarray = [cncontact]() let defaults = userdefaults() func (contact: cncontact){ contactsarray.append(contact) let contactarrayarchive = nskeyedarchiver.archiveddata(withrootobject: contactarray) //archive data defaults.set(contactarrayarchive, forkey: "contactarray") defaults.synchronize() } this archives data allow saved defaults . issue how can convert data array of cncontact in viewdidload . have seen many answers online suggest use nskeyedarchiver.unarchiveobjectwithdata typing xcode, swift 3, says .unarchiveobjectwithdata not member of nskeyedarchiver . keep looking stuff how in swift 3 have been unsuccessful. how can unarchive value? you can use nskeyedunarchiver.unarchiveobject(with: data) you have used nskeyedarchiver . cannot use unarchive object.

android - SQLite exception in Jelly bean but not in marshmallow -

i upgraded app marshmallow , getting sqlite database full exception. db code is, package com.app; import java.io.file; import android.content.contentvalues; import android.content.context; import android.database.cursor; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqliteopenhelper; import android.os.environment; import android.util.log; public class sqlitedb extends sqliteopenhelper{ private static final string database="appname"; private static final int version=8; private static final string create_table_todo = "create table user (" + "id" + " integer," + "value" + " integer" + ")"; private static final string create_table_todo1 = "create table trend (id integer,url text,image text,title text,count integer,height text,width text,points integer,sourceavail text)"; private static final string create_table_todo2 = "create table random (id integer,url text,i