Posts

matrix - Camera PreviewView is streched in some android devices -

right im playing api2 camera of google , im having problems code. had 2 different camerasessions, 1 video , 1 images. more efficient change code use unique session , make app more efficient. after this, camera preview not working adequately. when im using 4:3 aspect ratio preview become streched @ height. in other way looks fine when im using 16:9 ratio. in both cases pictures looks fine, mean, preview doesnt work correctly pictures taked, have correct aspect ratio. i check different post same problem: camera preview stretched on few android devices camera display / preview in full screen not maintain aspect ratio - image skewed, stretched in order fit on screen but different answers didnt me. know problem inside onmeasure() , settransformmatrix() or onlayoutchangelistener() methods, dont know iḿ doing wrong. ignore code rotation, right dynamic. enter @ else condition. here code: private onlayoutchangelistener mlayoutlistener = new onlayoutchangelistener() { @ov...

javascript - How to setup simple static server where path '/' points to index.html within dirrectory? -

there might simple solution question, not able find answer online , due practice node can't figure out either. i'm trying set simple server.js file listens on port 80 , serves /dist/index.html file when users enter root address, example.com this project structure dist/ index.html bundle.js node-modules/ package.json server.js you can create static server express : server.js var express = require('express'); var app = express(); app.use(express.static(__dirname + '/dist')); app.listen(8080, function() { console.log('listening on port: ' + 80); }); you run node server.js static server. app can deployed.

Special characters in R plots -

i have code in use plot(1, 1, type="s", ylab="log â„“") that equivalent to plot(1, 1, type="s", ylab="log \u2113") produces nice slanted l representing likelihood in y-axis . why capital script version of l (\u2112) gives me box in place of l? i'm running r on mac.

dictionary - Building up a list of dictionaries from a few lists in Python -

i have few lists this: pargs = [args.pee, args.pem,...,args.pet] # 9 elements of boolean type indices = [(0,0),(0,1),...,(2,2)] # 9 possible combinations (i,j), = 0,1,2; j = 0,1,2 d = [{},{},...,{}] # 9 dictionaries, desired result the result want see should this: d = [{event:args.pee,i:0,j:0},{event:args.pem,i:0,j:1},...{event: args.pet,i:2,j:2}] the dictionaries must ordered shown above. i tried for d in d: in range(3): j in range(3): d['i'],d['j'] = i,j but not trick. i've tried numerous algorithms zip(),product(),dict(), no avail... with comprehension , ordereddict , demo: from collections import ordereddict pargs = ['arg1', 'arg2', 'arg3', 'arg4', 'arg5', 'arg6', 'arg7', 'arg8', 'arg9'] indices = ((x,y) x in range(3) y in range(3)) result = [ordereddict([('event',p), ('i',i), ('j',j)]) p,(i,j) in zip(pargs, indices...

python 3.x - Python3 split character list into words from a template -

i'm having problems after mixed language text segmentation, not sure how go doing this. "template": '新闻 wang arrange soon. 在电视' segmentation output: '新闻 w n g w l l r r n g e s o o n. 在 电视' the desired output is: 新闻 wang arrange soon. 在 电视

Rails 4 Inventory Application: database design and use of nested forms -

i built application , works nicely , quite simple: https://github.com/ornerymoose/devicecount . allows create new entry device specify count (ie, inventory amount) of device. now though works, i've been told needs on 'per location' basis. ie, create entry , have 10 textfields (if there indeed 10 devices. amount never change nor devices change) devices, , each device text field, enter count device. choose location dropdown menu. when entry created, have: -1 location -10 devices listed, own count. i'm struggling wrapping head around how design these models. should have entry , device model? separate count model? would nested form best approach here? any , input appreciated. sounds you'd best inventory join model (with has_many :through ): #app/models/inventory.rb class inventory < activerecord::base # id | device_id | location_id | qty | created_at | updated_at belongs_to :device belongs_to :location end #app/models/device....

python - String preprocessing -

i'm dealing list of strings may contain additional letters original spelling, example: words = ['whyyyyyy', 'heyyyy', 'alrighttttt', 'cool', 'mmmmonday'] i want pre-process these strings spelt correctly, retrieve new list: cleaned_words = ['why', 'hey', 'alright', 'cool', 'monday'] the length of sequence of duplicated letter can vary, however, cool should maintain spelling. i'm unaware of python libraries this, , i'd preferably try , avoid hard coding it. i've tried this: http://norvig.com/spell-correct.html more words put in text file, seems there's more chance of suggesting incorrect spelling, it's never getting right, without removed additional letters. example, eel becomes teel ... thanks in advance. if download text file of english words check against, way work. i've not tested idea. iterates through letters, , if current letter matches last...