Posts

Showing posts from March, 2012

json - Serializing scala map with gson returns "key" with every key -

new scala , tried searching couldn't find solution it. i've scala map shown below: val mymap = map("foo" -> "baz") i want serialize using gson library , here's doing: val json = new gson() val serializedmap = json.tojson(mymap) when print serializedmap "{"key1":"foo", "value1":"baz"}" expecting "{"foo": "baz"}" what missing? gson java library, has no special treatment of scala collections. seeing there internal instance variables found through reflection. if want use gson, need convert java collections: import scala.collection.javaconverters._ mymap.asjava but may wish @ scala-specific json libraries also. there plenty of ones.

Object picking with Ray casting in elm-webgl -

Image
demo (?) working example: https://ellie-app.com/4h9f8fncrpya1/1 demo: click draw ray, , rotate camera left , right see ray. (as origin camera, can't see position created) context working on elm & elm-webgl project know if mouse on object when clicked. tried implement simple ray cast. need 2 things: 1) coordinate of camera (this 1 easy) 2) coordinate/direction in 3d space of clicked problem steps 2d view space 3d world space understand are: a) make coordinates in range of -1 1 relative view port b) invert projection matrix , perspective matrix c) multiply projection , perspective matrix d) create vector4 normalised mouse coordinates e) multiply combined matrices vector4 f) normalise result try far have made function transform mouse.position coordinate draw line to: getclickposition : model -> mouse.position -> vec3 getclickposition model pos = let x = tofloat pos.x y = tofloat pos.y normalizedpos

Insert several Autotext items in order - vba Word -

i working macro enable word 2016. have macro insert several autotext entries (4) entered in loop. portion working ok notice not entered in order. the reason why they're not entered in order because in each loop iteration reference specific bookmark (as range). wonder if there way update range @ each iteration autotext entries entered 1 after other ones? thank you! after trial , error, found way this. did following: moved selection (cursor) desired bookmark insert autotext @ selection.range location for next items, used selection.range instead of using bookmark, since selection (cursor) update i'm adding text.

SAS SQL: How to do (group base on Case) without pulling data first? -

i need count data of particular massive table without pulling data. group data , perform count... select a.type, a.color, count(a.claimnumber) count_of_claim mytable group a.type, a.color but in instance, color determined case when.. else statements. sort of this: (i made example, structure of production problem same). select b.type, b.color, count(claimnumber) claimnumber_count ( select a.type, case when a.company = 'honda' , substr(a.modelnum, 1, 5) <> 'aaaaa' 'red' when substr(a.modelnum, 1, 6) = 'bbbbbb' 'blue' when substr(a.modelnum, 1, 5) = 'ccccc' 'white' else 'black' end color, substr(a.claimnumber, 1, 10) claimnumber mytable ) b group b.type, b.color i pulling data down, determined color when

Removing the last value in the 2D array in Python -

i running code, outputs value of image array 4 values rgb , alpha, how remove last value rgb im dealing with. from pil import image, imagefilter import numpy np imagelocation = image.open("images/numbers/0.1.png") #creates array [3d] of image colours imagearray = np.asarray(imagelocation) print(imagearray) this output each pixel , want rgb output not 4th column. [[[255 255 255 255] [255 255 255 255] [ 0 0 0 255] [ 0 0 0 255] [ 0 0 0 255] [ 0 0 0 255] [255 255 255 255] [255 255 255 255]] you can slice numpy arrays so: rgb = my_array[:,:,:3] also since you're using pil: im = image.open("path/to/image") rgb = im.convert('rgb')

calendar - MS Outlook- Multiple All Day Meeting Template? -

is there way me make multiple all-day events @ weird intervals. if so, there way make template can faster? i have repetitive business has identical deadlines every project given. currently, have add of these deadlines outlook calendar manually. i'd short cut can select template or automatically programs various all-day calendar items create manually. for instance, project today , want make all-day reminder in 15 days remind me complete first task. 7 days later, need all-day reminder second task. 45 days later, need reminder third task. the other scenario deadlines. want add all-day event in outlook calendar final deadline project. i'd 15 day reminder , 5 day reminder appear on calendar all-day events. know there way add single reminder, if pops while i'm away desk, tend ignore reminder. all-day calendar item harder ignore. is there way automatically through macro or function of ms outlook of i'm unaware. keep life in outlook, i'd of deadlines appear ther

ionic2 - Inifinite Scroll distance property ionic 2 -

is there way handle distance tag adding distance="1%" ionic 1, want in ionic 2. if have @ docs see there threshold property listed under input properties. right next there explanation says distance can specified either in % or in px : <ion-infinite-scroll threshold="30%" (ioninfinite)="doinfinite($event)"> <ion-infinite-scroll-content></ion-infinite-scroll-content> </ion-infinite-scroll>

OSError: [Errno 8] when running selenium in python in a docker container -

i've learned basics of docker , how create , run images. i'm trying create image of python script scrapes webpages data , uploads server. i'm using selenium, chromium, , windows chromedriver. i'm trying build image on windows machine , able deploy on bunch of linux/windows servers. currently, i'm building , running on same windows machine, until running, keep getting same error, though script runs fine directly on machine itself. this error: traceback (most recent call last): file "my-app.py", line 796, in <module> startscraper(); file "my-app.py", line 92, in startscraper browser = webdriver.chrome(chrome_options = options, executable_path = path_to_chromedriver); file "/usr/local/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 62, in __init__ self.service.start() file "/usr/local/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 74, in start

android - CoordinatorLayout with multiple snapping points -

Image
here i've got quite complex animation may resolved (i believe) in simple way using coordinatorlayout . has 3 states: initial (left screen) - header view shown (orange background): toolbar, grey roundrect (it's photo there) plus other views below (textviews, ratingbar etc) scrolling content (middle screen) - roundrect zooming changing green foreground alpha level on it, becomes green while scrolling (well, not obvious these screens. green background zoomed roundrect green foreground on it, , cause header background becomes green , not orange) scrolling once more (right screen) - rest of header should scrolled up scrolling down content should lead appearing of views in reverse way accordingly. i had experience working coordinatorlayout, i'm not sure understand how handle 2 anchor points. understand how scroll flags work , zooming (p. 2) , changing foreground alpha need custom behavior implementation, cannot understand how shall handle of in comple

swift - how to catch data!-nil error in url request -

i think i'm confused do, catch , try. use following code information server, when turn of wifi, line after do{ throws nil-error. have script check reachability first, i'm looking way without that. "data!" must what's throwing error, because if there no internet connection, guess can't , data back. have no idea how fix this. ideally use urlrequest recognize there no wifi without using reachability function. im still pretty new swift , have no idea how fix this. urlcache.shared.removeallcachedresponses() let requesturl: nsurl = nsurl(string: "url")! let urlrequest: nsmutableurlrequest = nsmutableurlrequest(url: requesturl url) urlrequest.httpmethod = "post" let poststring = "club=bla" urlrequest.httpbody = poststring.data(using: string.encoding.utf8) let session = urlsession.shared let task = session.datatask(with: urlrequest urlrequest) { (data, response, error) -> void in do{ // next line causes error i

three.js - How to center a THREE.Group based on the width of its children? -

Image
i using three.js (r86) render group of spheres. i'm doing calling createspheregroup function external library: // external library code. function createspheregroup(spherecount) [ var group = new three.group(); (var = 0; < spherecount; i++) { var geometry = new three.spheregeometry(50); var material = new three.meshphongmaterial({ color: 0xff0000 }); var sphere = new three.mesh(geometry, material); sphere.position.x = * 150; group.add(sphere); } return group; } (assume external library opaque , can't modify code in it.) // code. var group = createspheregroup(5); scene.add(group); ...which looks this: as can see, group of spheres off-center. group centered, 3rd sphere @ point 2 lines intersect ( x=0 ). so there way can center group? maybe computing width of group , positioning @ x=-width/2 ? know can call computeboundingbox on geometry determine width, three.group doesn't have geometry, i'm not sure how this...

python - Read table from local sql-server from an ubuntu virtual machine (virtualbox) -

i on machine windows 10 host os , have ubuntu 16.04 virtual machine installed using virtualbox. have sql server running on windows , spark-2.1.1-bin-hadoop2.7 installed on virtual machine (ubuntu). on windows machine, can read tables server using pandas using following code: import pandas pd import numpy np import pandas.io.sql import pyodbc # parameters server = 'localhost' db = 'claro' # create connection conn = pyodbc.connect('driver={sql server};server=' + server + ';database=' + db + ';trusted_connection=yes') # query db sql = """ select * [claro].[dbo].[tmp_frd_ctv_total] """ # excute query here df = pd.read_sql(sql, conn, chunksize=10000) i want know if possible read same table sql server using pyspark virtual machine. if possible, have do? thanks lot! rodrigo. yes, won't localhost in code, need change public ip address ( can on google search find ip or that), if connecting r

android - Recording darkens preview and ratios -

this coded in nativescript, i'll try best adapt scenario java. have created in-app video view support record video. this done follows: first create surfaceview hold preview of camera: this.msurfaceview = new android.view.surfaceview(this._context); this.mholder = this.msurfaceview.getholder(); this.mholder.settype(android.view.surfaceholder.surface_type_push_buffers); then create instance of camera , , sets video surface: var mcamera = android.hardware.camera; var camera = mcamera.open(1); this.camera = camera; this.camera.setdisplayorientation(90); var parameters = camera.getparameters(); parameters.setrecordinghint(true); if( parameters.isvideostabilizationsupported() ){ parameters.setvideostabilization(true); } camera.setparameters(parameters); this.camera.setpreviewdisplay(_this.mholder); this.camera.startpreview(); this.camera.startfacedetection(); now, good. have camera preview in view want be. color , think image aspect ratio too. however

javascript - Typed.js Text Not Appearing -

i'm trying implement new es6 module version of typed.js (not jquery version), text isn't appearing - cursor (which remains stationary , doesn't blink.) i installed library without problem through npm , compiling webpack. when check compiled app.js library appears. app.js loading on page correctly , see no errors in console. stationary cursor dynamically-typed text should appearing. here's code (mostly example official site): typewriter.js import typed 'typed.js'; var typed = new typed('#typed-text', { strings: ["first sentence.", "second sentence."], typespeed: 30 }); index.html <div class="column"> <p id="typed-text"></p> </div>

javascript - Update select list with variable values when other select option is selected? -

i have php array called $programdates_items, contains values (school programs) multiple dates inside each program. have form select input "program of interest", options representing each program. i want build function when program of interest selected, select input called "dates" updated filled options made of corresponding date values programdates. the problem don't know how go marrying php , javascript in order accomplish this. below have included output $programdates_items array, , section of form array pertains to. $programdates_items = array ( [animation] => array ( [january 1, 2018] => january 1, 2018 [april 28, 2018] => april 28, 2018 ) [game design] => array ( [february 20, 2018] => february 20, 2018 [june 28, 2018] => june 28, 2018 [october 20, 2018] => october 20, 2018 ) <select id="program_of_interest" name="program_of_interest" required=""> <option value="">pro

Weblogic can't access admin console -

i've added new authentication provider under realm section. new provider custom ldap server, right not online, it's not reachable. problem if try access weblogic console gives me 500 internal server error. message shown in page: internal server error server encountered unexpected condition prevented fulfilling request. best thing start @ home page or try browser button. exception: root cause of servletexception. java.net.unknownhostexception: authservice.dd.aa.int @ java.net.abstractplainsocketimpl.connect(abstractplainsocketimpl.java:184) @ java.net.sockssocketimpl.connect(sockssocketimpl.java:392) @ java.net.socket.connect(socket.java:589) @ org.company.authservice.util.httpclient.protocol.bouncycastle.standardnamestlssocket.connect(standardnamestlssocket.java:269) @ org.company.authservice.util.httpclient.protocol.java5sslsocketwrapper.connect(java5sslsocketwrapper.java:64) truncated. see log file complete stacktrace how can access aga

asp.net - Insertion of Illegal Element C# Itextsharp -

i trying value show 3 of 9 font in itextsharp pdf document. here code have set barcode font: barcode39 whlsc = new barcode39(); whlsc.code = row.cells[13].text; whlsc.font = null; pdfcontentbyte cb = writer.directcontent; here add doc: p.add(whlsc.createimagewithbarcode(cb, null, null)); i insertion of illegal element: 35 i have tried doing code 3 of 9 windows/fonts folder no luck. suggestions? font barcode = fontfactory.getfont("3 of 9 barcode regular", 16f);

java - Google Drive API responds with 416 HTTP code -

for reason working code stopped working , server started respond 416. here logs of http client during failing interaction: -------------- request -------------- https://www.googleapis.com/drive/v3/files/0b02nopv3sqovovnkadiwtez3mhd?alt=media accept-encoding: gzip authorization: &lt;not logged&gt; range: bytes=0-33554431 user-agent: app google-api-java-client google-http-java-client/1.22.0 (gzip) -------------- response -------------- http/1.1 416 requested range not satisfiable alt-svc: quic=":443"; ma=2592000; v="39,38,37,35" server: uploadserver cache-control: private, max-age=0 content-range: bytes */0 x-guploader-uploadid: aenb2uqbx9b09lnr8tg761gdoz3dkhhsno_ozhh1lku6b2908v17rnbgqzsnw4zvtjbrdftvpwwiqzgdtsrto6zwn7yw9nxf6d vary: x-origin vary: origin expires: mon, 11 sep 2017 15:23:20 gmt content-length: 225 date: mon, 11 sep 2017 15:23:20 gmt content-type: application/json; charset=utf-8 i trying download file around 200000 bytes, thought meani

PHP Form with jQuery DatePicker -

i building mvc php web app mysql. using form collect information user. date input works when date information input in correct order want more user friendly less tech savvy coworkers (god bless'em). here form in 'index.php': if($action == 'add_order'){ $distributor_id = filter_input(input_post, 'distributor_id', filter_validate_int); $code = filter_input(input_post, 'code'); $name = filter_input(input_post, 'name'); $date = filter_input(input_post, 'date'); if($distributor_id == null || $distributor_id == false || $code == null || $name == null || $date ==null){ $error = "invalid order data: wrong"; include('../errors/error.php'); }else{ add_order($distributor_id, $code, $name, $date); header("location: .?distributor_id=$distributor_id"); } } ?> here form in 'order_add.php': <h1>add order</h1> <form a

android - add action in RecyclerView -

i have recyclerview , cardview cardview have checkbox i want check if checkbox check or no in each item in recyclerview and want delete item if checkbox not checked any method me ? this xml : <android.support.v7.widget.recyclerview android:id="@+id/rec" android:layout_width="match_parent" android:layout_height="match_parent"> </android.support.v7.widget.recyclerview> and adapter class : class adapter( private val cartlist: arraylist<card>,val context: context): recyclerview.adapter<adapter.myviewholder>() { override fun oncreateviewholder(viewgroup: viewgroup, viewtype: int): myviewholder { val view = layoutinflater.from(viewgroup.context).inflate(r.layout.tkt_all_station, viewgroup, false) return myviewholder(view) } override fun onbindviewholder(holder: myviewholder, position: int) { val cart:card = cartlist[position] holder.title.text = cart.station

android - Pass data after closing acticity -

i have application need pass data (using intent maybe) broadcastreceiver , broadcast send data service connect internet. problem want happen when close current activity! show in code: oncomplete send custome intent filter broadcastreciever. @override public void oncompleted(int serverresponsecode, byte[] serverresponsebody) { intent = new intent().putextra("title", title).putextra("username", username).putextra("spec", new_spec).putextra("link", link).putextra("desc", desc).putextra("abstract", abstract_); i.setaction("com.omaralmrsomi.masharee3app.upload_complete_notification"); sendbroadcast(i); } my service: @override public int onstartcommand(intent intent, int flags, int startid) { this.ctx = this; if (intent.getdata() != null) { upload(intent.getextras().getstring("title"), intent.getextras().getstring("username"), in

javascript - Test failing in locally built firefox -

i have built mozilla source code. performed xpcshell-test , tests failing. these tests failed :- dom/push/test/xpcshell/test_register_success_http2.js ----------------------------------------------------- fail [parent] dom/push/test/xpcshell/test_register_error_http2.js --------------------------------------------------- fail [parent] dom/push/test/xpcshell/test_unregister_success_http2.js ------------------------------------------------------- fail [parent] dom/push/test/xpcshell/test_notification_http2.js ------------------------------------------------- fail [parent] dom/push/test/xpcshell/test_registration_success_http2.js --------------------------------------------------------- fail [parent] netwerk/test/unit/test_immutable.js ----------------------------------- fail [parent] netwerk/test/unit/test_origin.js -------------------------------- fail [parent] netwerk/test/unit/test_protocolproxyservice.js ---------------------------------------------- fail [parent] netwerk/test/

Sort array using two thirds algorithm -

i came across uncommon sorting algorithm. algorithm sorts first 2/3rd of array next 2/3rd of array , again sorts first 2/3rd of array recursively. fun sort3(a: int list): int list = case of nil => nil | [x] => [x] | [x,y] => [int.min(x,y), int.max(x,y)] | => let val n = list.length(a) val m = (2*n+2) div 3 val res1 = sort3(list.take(a, m)) val res2 = sort3(list.drop(res1, n-m) @ list.drop(a, m)) val res3 = sort3(list.take(res1, n-m) @ list.take(res2, 2*m-n)) in res3 @ list.drop(res2,2*m-n) end the recursive relation algorithm written t(n) = 2t(n/3) + o(n) i dint understand how algo works. what understand is, 1.it recursively calls same function until array size 3 sort array using bruteforce. 2. merge arrays (like in merge sort) using o(n) time. am right? i dont understand language written in, not understand code.can me understanding algorithm. ps: not h

amazon web services - Elastic Beanstalk returning error - Gradle/Java Application -

Image
i'm trying upload new java application on aws using elastic beanstalk , rds, i've tested build , war file locally , working fine, how can solve problem? i'm new uploading java apps aws. here log https://drive.google.com/open?id=0b1o1g4huqdr7avdrlwj0auw1bku

ember.js - Can't load bootstrap js via ember-cli-build.js -

in project if include bootstrap's javascrpt file via app.import(app.bowerdirectory + '/bootstrap/dist/js/bootstrap.min.js'); in ember-cli-build.js bunch of js errors. if instead include in index.html works fine. idea causing this? error- syntaxerror: export declarations may appear @ top level of module i can think of 3 things try here: link full file. had line in (pretty old) app worked fine: app.import(app.bowerdirectory + '/bootstrap/dist/js/bootstrap.js'); make sure app.import inside of main module.exports declaration in ember cli build. you might try testing out different bower package see if problem bootstrap or app. if else fails (and if succeeds), highly recommend using ember bootstrap instead. handle stylesheets , provide ember friendly ways implement bootstrap components. won't need import anymore. overall, it's best avoid mixing libraries modify dom (like plain bootstrap) ember components. http://www.ember-bootstra

Validate method not found - Laravel -

laravel framework 5.4.35 contacts controller: <?php namespace app\http\controllers; use illuminate\http\request; use illuminate\routing\redirector; use illuminate\support\facades\mail; use app\mail\contactemail; class contactscontroller extends controller { public function index() { return view('contact.index'); } public function sendcontact (request $request) { $request->validate([ 'name' => 'required|min:3', 'email' => 'required|email', 'message' => 'required|min:5', ]); mail::to('bump@bumpy.net') ->send(new contactemail($request)); return redirect('/contact/success'); } public function success() { return view('contact.success'); } } the controller extends: <?php namespace app\http\controllers; use illuminate\foundation\bus\dispatchesjobs

Jscape MFT Server Windows Service Stopping -

i run computer functions server transferring files , out of company. runs jscape mft server. i've had migrate on new domain , since doing so, server service on computer goes through continuous start / stop process. does have experience this? suggestions on how resolve this? what information need assistance?

Python: How to parse places in place? -

does not have headers several columns such: john, 1, orange, chicken mary, 7, purple, hamburger joey, 2, yellow, chicken you don't need csv this, simple python. solution efficient regards memory, operates row row. with open('temp.csv', 'r') fin, open('temp2.csv', 'w') fout: row in fin: if row.split()[3] == 'chicken': fout.write(row) this more memory efficient list comprehension requires reading , storing in memory data written file out. timings # create sample data file of 30k rows, 2/3rds 'chicken'. open('temp.csv', 'w') f: _ in range(10000): f.write("john,1,orange,chicken\n") f.write("mary,7,purple,hamburger\n") f.write("joey,2,yellow,chicken\n") %%timeit open('temp.csv', 'r') fin, open('temp2.csv', 'w') fout: row in fin: if row.split()[3] == 'chicken':

python - Looking for a way to code a command cooldown for Discord Bot -

i using python. here sample command: @client.command(pass_context=true) async def enablesentience(ctx): await client.say(":desktop: | user not have sufficient permissions.") when command 'enablesentience' triggered, bot says in chat: :desktop: | user not have sufficient permissions. what looking way add cooldown command, person may use command once every how many seconds. if command attempted while cooldown active, want bot in chat remaining cooldown time. i have attempted: @client.command(pass_context=true) @commands.cooldown(1, 30, commands.server.user) async def enablesentience(ctx): await client.say(":desktop: | user not have sufficient permissions.") and async def cooldown(1, 5, type=server.default) @client.command(pass_context=true) async def enablesentience(ctx): await client.say(":desktop: | user not have sufficient permissions.") which gave "'command' object has no attribute 'cooldo

c# - Microsoft Bot Framework Bot duplicate responses in Slack -

i have simple code test bot responses in rooddialog.cs code: if (activity.text.trim().tolower() == "--hi") { imessageactivity replymessage = context.makemessage(); replymessage.text = $"hello {activity.from.name}"; await context.postasync(replymessage); } works expected in skype, emulator , facebook messenger, sends duplicate response messages ("hello {name}") in slack. i think either slack configuration or bot framework issue. seen , resolved this? thanks thanks howdy developers found issue. it happens when bot has been authorized team, , else comes in , authorizes bot again. when happens, seems there 2 bots running use same rtm connection post channel twice. i don't know how got 2 bots in same slack client. once removed , reinstalled bot started working expected. same issue causing other symptom: microsoft bot framework idialogcontext.call() not working when using slack

In Spring Cloud Server adds other properties to an existing environment -

we using spring cloud config server backed git repository provide properties test profile. have received requirement move our keys vault (hashicorp) , keep regular properties usual in our properties file. before having vault, passing keys through system property (using -dxxx=yyy ), loaded regular property source , app working expected. now must have composite property sources fetch property file , vault @ same time. i'm not sure how pull properties both vault , git @ same time , offered them spring cloud config clients. i've been digging in documentation , found can have composite environment repository, cannot make vault , git work @ same time. i've tried multiple things putting properties this: spring.cloud.config.server.git.uri=file:///e:/project/git/myappdata spring.cloud.config.server.vault.host=127.0.0.1 spring.cloud.config.server.vault.port=8200 spring.cloud.config.server.vault.scheme=http spring.cloud.config.server.vault.backend=secret spring.cloud.c

apache - Ampps Reverse Proxy Configuration To External Site -

i have ampps installed on windows server inside of personal network development projects, router configured allow external access hosted web sites. have raspberry pi 3 custom web app ( http://192.168.1.###:8080 ) i'd access via proxy externally using apache / ampps instance on windows server ( http://my_windows_server/myapp ). have enabled mod_proxy , mod_proxy_http , can't seem find way configure reverse-proxy in ampps install on windows server web app accessible. in advance assistance.

Fill in existing PDF form with radio button using POST data from HTML form and available PHP class -

i have pdf form want fill in post data sent php script html form. have used pdftk in past, server application not have pdftk installed, , admins refuse add server. since server shared hosting plan, cannot install software. these reasons thought 1 of available php classes job, since class not need "installed' server operating system. i found numerous posts using fpdf fill in pdf forms, in each of articles, seemed fpdm class being used. such, did not try learn fpdp. if mistake, perhaps let me know/ point me in right direction. fpdm seem job, when tried out, although text fields filled in properly, radio buttons in pdf not filled in. in fact, error generated if left radio button id in data array being provided fpdm. in 1 post, user "wizard" indicated solved problem writing custom code, did not share approach or code. compared pdf file unchecked radio group, , 1 yes , no checked. thought perhaps create hack, files different, radio button id in multiple

mysql - Placing all the grades of student1 -

i have table subject has columns subject code , user_id , grade . have table students. student table: | user_id | name | +---------+------+ | 17000 | elle | subject table: | subjcode | user_id | grade | +----------+---------+-------+ | os1 | 17000 | 90 | | micro | 17000 | 90 | what right query output this? | user_id | os1 | micro1 | +---------+-----+--------+ | 17000 | 90 | 90 | this requires combine results multiple line in 1 line, not handled sql query. plus cannot variable number of fields results (what if there 5 subject matters). best handled @ display level proper language. of course stored procedure that's whole other subject :-)

Javascript neural network not converging -

i've been trying evolve neural network prints values converging one, using genetic algorithm. i've tried debugging code don't know i've messed up. i'm using fitness chose best "brains" , cross them on (reproduce). at moment trying evolve "brains" return number. fitness function of difference between returned number , original number. "use strict"; function sigmoid(x) { return 1 / (1 + math.e ** -x); } function random(min, max) { return (max - min) * math.random() + min } function toss() { return random(-1, 1) } function brain(inputs, hiddens, outputs) { this.structure = [...arguments]; if (this.structure.length < 3) throw "invalid layer count"; this.layers = []; this.layers[this.structure.length - 1] = { nodes: [] }; (var = this.structure.length - 1; i--;) this.layers[i] = { bias: toss(), nodes: [] }; (var = 1; <

c# - How to display Model data with google charts? -

using net core 2 mvc, how can pass data model view display google charts? i have model/class statistics.cs data. have second class called statistic.cs statistic , third class called statisticdisplays.cs sets new list. here files: statistic.cs using system; using system.collections.generic; using system.text; namespace corefrontenddev.code.statistics { public class statistic { public statistic() { datapoints = new list<sdatapoint>(); } public string statistickey { get; set; } public string statistictitle { get; set; } public string statisticdescription { get; set; } public enum edisplaytype { bar = 1, line =2, pie = 3 } public edisplaytype displaytype { get; set; } public struct sdatapoint { public decimal value { get; set; } public string text { get; set; } } public list

Quicksort with swapping middle and first element in each partition -

assume have standard, two-way partition quicksort algorithm pivots on first element. however, in slight variant of quicksort, first swap first , middle elements, , pivot on 'new' first element. question is, change worst-case running time? my initial thinking no, in each sub-array elements still in random order relative each other, , switching first , middle elements not change overall runtime. interested in finding worst-case scenario, i'm not sure if there's 'special' array cause slight variant change worst-case runtime of original algorithm. quicksort’s worst case when pivot minimum or maximum. in mind, can build worst-case array: [1, 2] (every element in two-element array min or max) [3, 1, 2] post-swap produces above [1, 3, 2] pre-swap [4, 1, 3, 2] post-swap produces above [1, 4, 3, 2] pre-swap [5, 1, 4, 3, 2] post-swap produces above [4, 1, 5, 3, 2] pre-swap [6, 4, 1, 5, 3, 2] post-swap produces above [1, 4, 6, 5, 3, 2] pre-swap e

java - How can I "unroll" this sigma notation as a recursive method -

in java programming class, have lab assignment (not worth points) implement several recursive methods. have completed recursive method based on given recursive function, , have completed necessary factorial recursive method remaining portion, sigma series having hard time wrapping head around. we given formula: s(n) = sigma[(s(n - i) - 1) / i!, = 1, n] , s(0) = 0 and have written out results s(1)-s(5) (using graphing calculator verify answers go), having difficulty figuring out how correctly implement recursive process. i have built "sigma" method works appropriately best of knowledge, , think have issues "formula" method. worst of all, formula looks right (to best of thinking) , code getting stuck in infinite loop. // ... rest of code omitted brevity private static double sequence2(int i) { if (i <= 0) { return 0; } return (sequence2(max - i) - 1) / factorial(i); // max defined in other code } private static double sigma(int n) { if (n

Understand declaration of a terminal operation method -

this question has answer here: why java method appear have 2 return types? 3 answers what mean when generics function has 2 return types? 1 answer usually, method's declaration shows return type, method full path, , parameters. when @ method java.util.stream.stream.collect confused. it seems method has two return types: <list<integer>, object> list<integer> java.util.stream.stream.collect(collector<? super integer, object, list<integer>> collector) i understand real return type list<integer> , <list<integer>, object> mean? why 1 space before list<integer> , why key(if map?) same real return type? have @ declaration of method: public interface stream<t> extends basestream<t, stream<t>&

Wordpress redirecting to old frontpage after update -

i have wordpress multisite , on main site changed old front page in settings. on login it's redirecting old front page. updated permalinks , tried deleting old page leads 404. there else can try? you can go wp-config.php file , type in end: define('wp_home', 'http://' . $_server['server_name']); define('wp_siteurl', wp_home . '/'); it has worked me bunch of times.. hope helps ps: temporary decision. (taken from: " https://wordpress.stackexchange.com/questions/155471/when-moving-a-wp-site-why-does-wp-admin-redirect-to-old-site " )

xml - Adding elements to tag when conditions match in a loop using XSLT -

i'm trying achieve in xslt 1.0 , below conditions @ point of time occurrences of adt more occurrences of inf 1 adt should have 1 surname,firstname , dob details of inf tag if adt tags more inf tags first adt tags should tagged inf , rest should adt tags should not have inf attached it. no change child tag required should present in output. i'm trying achieve below output using xslt couldn't fix it, in appreciated. need in below xslt transformation <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:template match="/"> <travelergroup> <xsl:for-each select="/travelergroup/traveler"> <xsl:if test="travelerinfo/travelertypecode != 'inf' "> <traveler> <travelerinfo> <elementnumber> <xsl:v