Posts

c++ - opencv: single pixal assignment confusion -

i working opencv , c++ project , found weird thing: when try access single pixal value in iplimage , assign other value, run result can operate part of whole image. relevant code: iplimage* output_frame = cvcreateimage(size, ipl_depth_8u, 1); iplimage* current_frame = cvcreateimage(size, ipl_depth_8u, 1); while((current_frame = cvqueryframe(video_gray)) != 0 ) { (int row=0;row<height;row++) { uchar* ptr_current_frame = (uchar *)(current_frame->imagedata+current_frame->widthstep*row); uchar* ptr_output_frame = (uchar *)(output_frame->imagedata+output_frame->widthstep*row); (int cols=0;cols<width;cols++) { //other codes... ptr_output_frame[cols]=ptr_current_frame[cols]; } } } the result left part of image copied output_frame. , when run following code: iplimage* output_frame = cvcreateimage(size, ipl_depth_8u, 1); iplimage* current_frame = cvcreateimage(size, ipl_depth_8u, 1); while((curr...

livecode - How i write file into home(In linux system) -

i trying write file in home folder(i using linux operating system) while writing file temp it's working put shell("echo $home") last1 the above code getting home folder , place path variable last1 put text of field "bash1" url "file:last1/dic.sh" here bash1 text field , it's contains shell script want write home directory the below code works put text of field "bash1" url "file:/tmp/dic.sh" how rewrite code as last1 variable enclosed in quotes, it's getting treated literal string rather variable. following work: put field "bash1" url ("file:" & last1 & "/dic.sh") note not have refer explicitly text property when putting texts fields - can above. furthermore, if you're on linux, can use ~ shortcut refer user's home directory: put field "bash1" url "file:~/dic.sh"

floating point - significant decimal digits of binary32 and binary64 -

accourding wikipedia binary32 format has 6 9 significant decimal digits precision , 64 format has 15 17. i found these significant decimal digits have been calculated using mantissa didn't how can 1 calculate it? idea ? mantissa of 32bit format = 24bits ,mantissa of 64bit format = 53bits first, question better use total significand sizes 24 , 53. fact leading bit not represented aspect of encoding. if interested in vague explanation, each decimal digit contains log2(10) (about 3.32) bits of information. when have encode 1 digit, need 4 bits, here talking encoding several consecutive decimal digits efficiently, figure of 3.32 do. 53 bits / log2(10) -> 15.95 (16ish decimal digits) 24 bits / log2(10) -> 7.22 (7ish decimal digits) if want properly, need consider fact not same numbers representable in binary , in decimal. people ask decimal precision of binary floating-point assumed mean either decimal precision can round-trip through binary forma...

database - mysql suddenly ignoring table indices for a time -

on our mysql 5.1 server innodb table called central our web application. has around 150,000 rows , far many columns due bad implementation. lately we've been running task updates table (insert or update) once every few seconds. when task running, database periodically (every 1 - 3 hours) become slower process client read requests. during times slow_log points table culprit , request looks it's doing full table scan. eventually, within 5-20 minutes work out , go processing normally. my assumption constant table updates throwing mysql's query optimizer statistics out of whack every once in while. don't know how prove or find solution it. can following causes? too many secondary indices on table (there ~45, many unnecessary take time , care prune away) bad configuration parameters (query_cache on , innodb_buffer @ 5g) mysql 5.1 outdated , should upgraded the database server needs more ram/cpu handle load i more happy provide additional information m...

h.264 - Decoding H264 stream with ID3D11VideoDecoder -

i'm trying decode (and render) h264 raw stream directx11 , interface https://msdn.microsoft.com/en-us/library/windows/desktop/hh447766%28v=vs.85%29.aspx . unfortunately got stuck @ sumbitting dxva pictureparameters buffer: namely id3d11videocontext::submitdecoderbuffers returns e_fail. enigmatic, there somewhere example of using interface decode h264 bitstream becasue error code e_fail might never able conclude i'm doing wrong? such example helpful. currently, don't think there sample id3d11videocontext h264 decoding. there idirectxvideodecoder (directx9). update the source code mpc- be start. (under src->filters->transform->mpcvideodec). (ffmpeg has use of id3d11videocontext, not detailed).

regex - .htaccess rewrite subdomain to directory or to file depending on path -

when navigate sub.domain.com/path gets me domain.com/site.php?site=sub&page=path . when path text.text want point domain.com/subdomains/sub/text.text can't work together. rewritecond %{http_host} ^(.*)\.domain\.com$ [nc] rewritecond %{request_uri} !^(.*\..*)$ [nc] rewriterule ^(.*)$ site.php?site=%1&page=$1 [l] when path contains text.text apply rule: rewriterule ^(.*)$ http://domain.com/subdomains/%1/$1 [p,l,nc,qsa] also how can make rule above work relative path (without http://domain.com/ )? update: sub.domain.com -> site.php?site=sub sub.domain.com/path -> site.php?site=sub&page=path sub.domain.com/path.ext -> subdomains/sub/path.ext all above works, 1 more left: sub.domain.com/constant/text.text -> constant/text.text that 1 above should apply if after constant text dot. if not rule should apply: sub.domain.com/path -> site.php?site=sub&page=path you can use these 2 rules: rewriterule ^(constant|site\.ph...

sumologic - Can't divide field by number in Sumo Logic -

i have sumo logic query i'm taking numeric field , summing it, fields value milliseconds want divide field 1000 number seconds. parse "downloadduration=*," downloadtime | sum(downloadtime / 1000) totaldownloadtime but sumologic gives me error: parse error: ')' expected '/' found. when try (even though help docs seem suggest totally legit . i had add parse statement alter fields value. parse "downloadduration=*," downloadtime | (downloadtime / 1000) downloadtime | sum(downloadtime) totaldownloadtime works perfectly!