Posts

c# - AspNet MVC - return RedirectToAction is not working with image upload (if file.SaveAs gets called) -

return redirecttoaction not working if imageupload.saveas(path); executed otherwise working (i mean if not select image not reach line imageupload.saveas(path); ). here code: [httppost] public actionresult createnewemployee(employee emplview, httppostedfilebase imageupload) { if (!modelstate.isvalid) { var mod = new personaldetailsviewmodel(emplview); return view("addemployee", mod); } if (imageupload != null && imageupload.contentlength > 0) { var filename = emplview.employeeid + "_" + path.getfilename(imageupload.filename); var path = path.combine(server.mappath("~/content/images/"), filename); imageupload.saveas(path); emplview.photograph = filename; } _dbcontext.employees.add(emplview); _dbcontext.savechanges(); return redirecttoaction("personaldetails", new { id = emplv...

c# - Multiple UI threads for page (speed up slow individual controls) -

i writing kiosk style app in uwp (windows iot core), use on embedded devices (e.g. pi3, etc.). the device has several sensors, being output in real time various graphs/charts in single screen in app, i'm running performance problems. sensors being read in separate threads (using task.run() => {}), after analysis, doesn't seem cost cpu time @ all. seems updating graphs take time , isnt being distributed on cores, since there single ui thread. cpu usage doesnt past 25%, ui responsiveness gets slow. i tried several optimizations (e.g. reducing amount of data points, etc.), helps, not enough. maybe there faster chart components out there (currently using telerik uwp component), looking approach. so summary of question: there way have charts each render in separate ui threads (and distributed on other cores somewhat)? can't speak strictly uwp experience of wpf having multiple ui threads hassle should avoid if @ possible (not speak of limitations introduce)...

python - How can I predict an image using a set of physically related images? -

Image
i'll explain question better figure: what i'd predict top left image 'depth' (actually map of real snow depths) using or of other images in figure. other images type of elevation-based product. can see figure, there strong link between landscape pattern , snow depth pattern. my hypothesis there mixture of other images can predict pattern in depth image @ least degree. i know i'll need extract scalar features images , perform type of regression. sort of algorithms or techniques might me started? thanks!

android - Toolbar transparent with navigation drawer -

Image
i trying make toolbar transparent navigation drawer. working fine til api<21, above api 21 toolbar not transparent. have added theme v-21 style folder well. adding theme image. <style name="apptheme.noactionbar"> <item name="windowactionbar">false</item> <item name="windownotitle">true</item> <item name="colorprimary">@android:color/transparent</item> <item name="colorprimarydark">@color/colorprimarydark</item> <item name="drawerarrowstyle">@style/drawerarrowstyle</item> </style> <style name="drawerarrowstyle" parent="widget.appcompat.drawerarrowtoggle"> <item name="color">@color/colorprimary</item> </style> moreover, have created background selector toolbar in colors transparent xml <?xml version="1.0" encoding="utf-8"?> <android...

Locking a file in Python -

i need lock file writing in python. accessed multiple python processes @ once. have found solutions online, fail purposes unix based or windows based. alright, ended going code wrote here, on website ( also available on github ). can use in following fashion: from filelock import filelock filelock("myfile.txt"): # work file locked print("lock acquired.")

xcode - Is it possible to edit IOS UI in text mode/non-gui -

i starting out learning ios development hobby in spare time - please patient if question seems dumb. but how edit ui without using xcode graphical user interface? there underlying xml definition android has in android studio? the reason ask if ever need change 1 dimension, means have manually go every single storyboard element, , change hand opposed editing them efficiently main config file dimens.xml if select storyboard in xcode, right click, , choose open -> source code, see xml. it's not simple work in form (in opinion), it's available.

javascript - Smooth jagged pixels -

Image
i've created pinch filter/effect on canvas using following algorithm: // iterate pixels (var = 0; < originalpixels.data.length; i+= 4) { // calculate pixel's position, distance, , angle var pixel = new pixel(affectedpixels, i, origin); // check if pixel in effect area if (pixel.dist < effectradius) { // initial method (flawed) // iterate original pixels , calculate new position of current pixel in affected pixels if (method.value == "org2aff") { var targetdist = ( pixel.dist - (1 - pixel.dist / effectradius) * (effectstrength * effectradius) ).clamp(0, effectradius); var targetpos = calcpos(origin, pixel.angle, targetdist); setpixel(affectedpixels, targetpos.x, targetpos.y, getpixel(originalpixels, pixel.pos.x, pixel.pos.y)); } else { // alternative method (better) // iterate affected pixels , calculate original position of current pixel in o...