Posts

Featured post

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

i'm combining 3d content three.js html , svg content. three.js cssloader pretty job synchronizing placement of html , svg content in 3d world. but svg/html coordinate systems 'left-handed', whereas three.js coordinate system 'right-handed'. means y-axes reversed. in svg/html, y / top goes go down screen, , three.js uses more standard mathematical convention of y going down go down screen. i have continually convert 1 other, pretty error prone. know not first run (for example, look here ). has come general solution? here's tried: do in object3d .scale.y = -1 . may suspect, turns out disaster. turns inside-out, , don't try put camera in there. do in object3d .rotate.x = math.pi . more promising, z axis no longer consistent html concept of z-index. still, i'm using now. in html, don't use top , use bottom . in svg , inside <g transform="scale(1, -1)"> inside <g transform="translate(0, imageheight)"> . h...

java - Reading data from multiple zip files and combining them to one -

i want read data lets 4 zip files called zip1, zip2, zip3, zip4. of these zip files split 1 big zip file called "bigzip". want combine zip files 1 , compare bytes if 1 bigzip file matches size of bytes combined zip file of (zip1+zip2+zip3+zip4). getting small file size when combine size of 4 zip files. doing wrong? here code same: targetfilepath1, targetfilepath2, targetfilepath3, targetfilepath4 belongs path of 4 zip files. sourcefilepath path bigzip file class test { public static void main(string args[]) { zipoutputstream outstream = new zipoutputstream(new fileoutputstream(sourcebigzip)); readzip(sourcefilepath, targetfilepath1); readzip(sourcefilepath, targetfilepath2); readzip(sourcefilepath, targetfilepath3); readzip(sourcefilepath, targetfilepath4); outstream.close(); } static void readzip(string sourcebigzip, string targetfile) throws exception { zipinputstream instream = new zipinputstream(new file...

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

as title says, have website text inside div, there way highlight part of , know occurence is? if text has 4 occurences of word "something", , highlight 3rd, how information using javascript/jquery? http://jsfiddle.net/g09g35xa/6/ here's method seems work. highlight string want , when click button alert index of highlighted word in div. markup: <div id="thediv"> <p>the quick brown quick fox jumps on lazy dog</p> </div> <br /> <input id="findindex" type="button" value="find index of highlighted string" /> and js: function getselectedhtml() { try { if (window.activexobject) { var c = document.selection.createrange(); return c.htmltext; } return getselection().getrangeat(0).tostring(); } catch (e) { if (window.activexobject) { return document.selection.createrange(); } else { return ...

PHP sort array of associative arrays by element size / string size -

is there way sort array of associative arrays length of 1 of elements? trying order arrays largest smallest description length. $some_array = []; $some_array[0] = ['name'=>'a name','description'=>'a description']; $some_array[1] = ['name'=>'a name1','description'=>'a description 1']; $some_array[2] = ['name'=>'a name2','description'=>'a description 2 third array element']; $some_array[3] = ['name'=>'a name3','description'=>'a description three']; with above example $some_array[2] should come first followed 3 1 0 . php >= 5.5.0 needed array_column : array_multisort(array_map('strlen', array_column($some_array, 'description')), sort_desc, $some_array);

node.js - Redirect loop when activating CloudFlare -

i trying put website behind cloudflare unfortunately when activate cloudflare start getting redirect loop (i using chrome). i have tried clear cookies, recommended, not solve issue , not having issue when cloudflare not activated. what causing , how solve in node.js application? apparently, configuration issue. on flexible ssl , changed full ssl. my node.js app receiving http requests cloudflare , redirected https, cloudflare converted http, etc...

sql - Oracle result without group by -

i'm running below query on oracle exadata. oracle database 11g enterprise edition release 11.2.0.4.0 - 64bit production partitioning, real application clusters, automatic storage management, olap, data mining , real application testing options select sum (t.sum_edw_trx_cnt) ( select max(x.edw_trx_cnt)sum_edw_trx_cnt, x.prctr_cell_nbr p_prctr_smpl_pf_sp3 x mdld_prctr_flg = 'y' )t; i expecting oracle return error since - can see there's no group by clause in inner query “t” , expecting query fail. there millions of records , each prctr_cell_nbr want max count , outer query should sum max counts every prctr_cell . it's simple query. however, query runs , returns output of 112 max count inner query. i'm puzzled behavior since not correct result returned query. don't think known behavior, has seen ? thanks what see effect of applying "select list pruning" opti...

Rails 4: strong_params,nested_attributes_for and belongs_to association trouble -

i can't head around rails 4 strong parameters, belongs_to association , form fields_for. imagine have model quoting price: class quote < activerecord::base belongs_to :fee accepts_nested_attributes_for :fee now, have seeded fees db, , have put radiobuttons on form_for @quote using fields_for. values of radiobuttons ids of records. here troubling part, controller: def create @quote = quote.new(quote_params) ... end def quote_params params.require(:quote).permit(:amount_from, fee_attributes: [:id]) end from understanding, automagically rails should fetch fee record id, there mystic error instead. params hash is: "quote"=>{"amount_from"=>"1200", "fee_attributes"=>{"id"=>"1"}} log tail: completed 404 not found in 264ms activerecord::recordnotfound (couldn't find fee id=1 quote id=) app/controllers/quotes_controller.rb:14:in `create' i don't understand going on ...