Posts

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>