Posts

octave - Saving image in plot window after placing points in plot -

Image
using octave, able show image , plot red circles on it, follow: tux = imread('tux.png'); imshow(tux); hold on; plot(100,100,'r','markersize', 10); plot(150,200,'r','markersize', 10); the above code display window: my question is: how can save image being showed inside window? thank much! pretty simple. use: print -djpg image.jpg print command in octave allows capture what's seen in current figure window. -d specifies output device want write to. there multiple "devices" can use save file... eps, ps, tex, etc. device can image writer, , here chose jpeg. can choose other valid image formats supported octave. take @ link provided above more details. after, specify file name want save plot to. in case, chose image.jpg . you can take @ saveas . make sure handle current figure first before doing so: h = gcf; saveas(h, "image.jpg"); also... more point-and-click approach go file -> s...

functional programming - Scala combine Seq of Timestamps -

hello i'm learning scala , have seq of object of following case class: case class historycounter(time: datetime, counter:int) now combine value of counter based on timestamp time . sum of counters time on same day or same week. how can this? 1 of collection functions fold or map capable of doing this? if had list of these case classes called list , 1 way so: val counts = list.groupby(_.time).map{ case (k, v) => (k, v.map(_.counter).sum) } or more succinctly: list.groupby(_.time).mapvalues(_.map(_.counter).sum)

php - Laravel homestead laravel-elfinder install error -

i'm using homestead @ localhost. have followed instructions install did: composer require barryvdh/laravel-elfinder , run composer update , throws me error: your requirements not resolved installable set of packages. problem 1 - intervention/image 2.1.3 requires ext-fileinfo * -> requested php extension fileinfo mi ssing system. - intervention/image 2.1.2 requires ext-fileinfo * -> requested php extension fileinfo missing system. .. - intervention/image 2.0.11 requires ext-fileinfo * -> requested php extension fileinfo missing system. - intervention/image 2.0.10 requires ext-fileinfo * -> requested php extension fileinfo missing system. - intervention/image 2.0.1 requires ext-fileinfo * -> requested php extension fileinfo missing system. - intervention/image 2.0.0-beta.2 requires ext-fileinfo * -> requested php extension fileinf o missing system. - intervention/image 2.0.0-beta requires ext-fileinfo * -> requested php e...

jquery - Using cropper.js before Dropzone.js send image to server -

what want here before dropzone.js send dropped image server, modal appears cropper.js (fengyuanchen script) user can crop image, , when image cropped, send dropzone.js server. so when change image src of #cropbox function filetobase64 , replace image of cropper function cropper('replace'), keeps showing default.jpg image, instead of new 1 uploaded user html <div class="wrapper-crop-box"> <div class="crop-box"> <img src="default.jpg" alt="cropbox" id="cropbox"> </div> </div> js: function filetobase64(file) { var preview = document.queryselector('.crop-box img'); var reader = new filereader(); reader.onloadend = function () { preview.src = reader.result; } if (file) { reader.readasdataurl(file); } else { preview.src = ""; } } $(function() { dropzone.options.avtdropzone = { acceptedfiles: 'image/*', ...

c++ - Is it possible to use operator new to allocate from elsewhere than the heap? -

here context of application : i'm working on embedded system uses ram different devices. 1 part in internal ram of microcontroller (128kb) , other part external ram (1mb). these memories mapped address space of microcontroller, in non contiguous regions. the internal ram used system stack, tasks stacks , heap. external ram used statically allocated data (pools, buffers, , " static ... " stuff) i trying implement simple memory management structure, , part of able create allocator use allocation algorithm of operator new using memory source, not system heap memory region elsewhere. know if possible ? an example of use reserve 100kb of external ram , create allocator manage it, , give specified task need memory. static const uint8_t* rambase = reinterpret_cast<uint8_t*>(0x80000000); static const uint32_t ramareasize = 0x19000; //100kb bufferallocator allocator(rambase, ramareasize); //... //assuming operator new overloaded use bufferallocator myobject * o...

Working with Aliased Columns in SQL Server 2012 -

Image
okay, know this question why cannot reference aliased column where , group by , or having statements. my problem have query being moved teradata database sql server 2012. in teradata, referencing aliased column in where, group by, having, , join statements valid. my question is, how can perform query, , others it, in sql server, without having resort populating temporary table select first. (this example single part of large tsql script containing 10 separate transactions, many of or more complex example provided) select max(case when field_name = 'parent brand cd' , datalength(field_val)>1 substring(field_val, 1, datalength(field_val) - 1) else null end ) parent_brand_cd, max(case when field_name = 'brand id' , datalength(field_val)>1 substring(field_val, 1, datalength(field_val) - 1) else null end ) hotel_cd, @src_s...

How to subset from a 4 dimensional array in R, based on value -

basically have 4 dimensional array of various radar variables named pol has dim (5,1191,360,11) for part of analysis want subset analysis pixels below height, note pol[2,,,] contains height information ideally this newpol<-pol[pol[2,,,]<5,] the issue construct not 4 dimensional features, have tried newpol[,,,]<-pol[,,,][pol[2,,,]<5,,,] but results in error "logical subscript long" my goal obtain 4 dimensional array consisting of elements of pol pol[2,,,]<5. thanks in advance assistance. two things here: adding ,drop=false indexing, , which(..., arr.ind=true) . some data: set.seed(42) pol <- array(sample(20, size=3*4*5*6, replace=true), dim=c(3,4,5,6)) this simple subsetting, lose dimensionality c(3,4,5,6) c(4,5,6) , not good: pol[2,,,] < 5 ## , , 1 ## [,1] [,2] [,3] [,4] [,5] ## [1,] false false false false false ## [2,] false false false false false ## [3,] true false false false false ## [4,] false false ...