Posts

xcode - Manually Compile Metal Shaders -

i'm interested in moving away xcode , manually compiling metal shaders in project mixed-language application. i have no idea how this, though. xcode hides details of shader compilation , subsequent loading application @ runtime (you call device.newdefaultlibrary() ). possible, or have use runtime shader compilation purposes? generally, have 3 ways load shader library in metal: use runtime shader compilation shader source code via mtldevice newlibrarywithsource:options:error: or newlibrarywithsource:options:completionhandler: methods. although purists may shy away runtime compilation, option has minimal practical overhead, , viable. primary practical reason avoiding option might avoid making shader source code available part of application, protect ip. load compiled binary libraries using mtllibrary newlibrarywithfile:error: or newlibrarywithdata:error: methods. follow instructions in using command line utilities build library create these individual binary l...

D3.js Stacked Bar Chart, from vertical to horizontal -

i make vertical bar chart ( http://bl.ocks.org/mbostock/3886208 ) horizontal bar chart. thanks help! code examples nice. it's matter of reversing domains, axis , rect calculations: var y = d3.scale.ordinal() .rangeroundbands([height, 0], .1); // y becomes ordinal var x = d3.scale.linear() .rangeround([0, width]); // x becomes linear // change state group positioned in y instead of x var state = svg.selectall(".state") .data(data) .enter().append("g") .attr("class", "g") .attr("transform", function(d) { return "translate(0," + y(d.state) + ")"; }); // rect calculations become state.selectall("rect") .data(function(d) { return d.ages; }) .enter().append("rect") .attr("height", y.rangeband()) // height in rangeband .attr("x", function(d) { return x(d.y0); }) // horizontal position in stack .attr("w...

matlab - How to remove that digit/non character which is at farthest distance from remaining characters in binary image -

Image
i want remove digit/non character @ farthest distance remaining characters in binary image. renaming characters , digits have fixed distance. in image: i want remove "5" , in image: i want remove non-characters. i want when image have 2 rows (like image1 , image2). in single row image don't want anything. couldn't quite figure out mark doing, decided create own method. if have statistics toolbox, i'd apply kmeans clustering of centroids of characters , remove centroid has least amount of characters - namely isolated island 1 character. given first image, had pre-processing remove green bounding box surrounded each character. when read in image stackoverflow, had associated colour map , read in indexed image. had convert indexed image colour image, extracted out green channel light green bounding box removed. [x,map] = imread('http://s17.postimg.org/5quw8e6m7/plate2.png'); out = ind2rgb(x,map); im = out(:,:,2); i invert im...

actionscript 3 - Is there a difference between MovieClip(X) and X as Movieclip? -

this question has answer here: as3: cast or “as”? 8 answers maybe in performance. i'm using movieclip(getchildbyname("x")).stop(); better (getchildbyname("x") movieclip).stop(); ? results: (ui.getchildat(0) spectrumanalyzer) = 174 ms spectrumanalyzer(ui.getchildat(0)) = 200 ms for programmer it's same - don't know if code doing same thing in 2 different ways. anyways difference 26 ms 1 mio iterations. var sa:spectrumanalyzer = new spectrumanalyzer() var ui:uicomponent = new uicomponent() ui.addchild(sa) addelement(ui) var start:number = new date().gettime() for(var i:int=0; i<1000000; i++){ (ui.getchildat(0) spectrumanalyzer) } var end:number = new date().gettime() trace(end-start) start = new date().gettime() for(var i:int=0; i<1000000; i++){ spectruma...

javascript - why do my onClick functions take two clicks -

i've noticed few different projects of mine whenever click add onclick function to, takes 2 clicks them going when page freshly loaded. general structure use them is: function pagechange(){ var welc_p = document.getelementbyid("welcome");/**gathers page divs**/ var page01 = document.getelementbyid("page01"); var page02 = document.getelementbyid("page02"); var start = document.getelementbyid("start_btn");/**gathers buttons**/ var p1_back = document.getelementbyid("p1_back"); var p1_next = document.getelementbyid("p1_back"); var p2_back = document.getelementbyid("p2_back"); var p2_next = document.getelementbyid("p2_back"); start.onclick=function(){ page01.style.display="block"; welc_p.style.display="none"; window.location="#page01"; }; }/**function**/ then way call in html is <div class...

javascript - Jquery Jtable listAction not working -

i have jtable this: $("#encuestastablacontenidos").jtable({ title: "tabla de encuestas", paging: true, pagesize: 10, actions: { listaction: '../../srvencuestas?paraction=listarencuestas', updateaction: '../../srvencuestas?paraccion=editarencuestas' }, fields: { numeroencuesta: { title: 'numero de pregunta', width: '5%' }, preguntaencuesta: { title: 'pregunta', edit: true } } }); my problem listaction not being put in servlet. tested url it's not that. think it's jtable plugin, need help. comment nice. i can not add comment, did add load function call after jtable conf...

javascript - Make a draggable rectangle appear with click of a button on google maps API -

i playing google maps api , trying make rectangle pop when user clicks button. working through examples given of api in use , came jsfiddle . not rectangle appear when button clicked. wanted appear @ center of users screen when click select region button. here poorly patched together: #map { width: 500px; height: 500px; center: true; } <!doctype html> <html> <head> <title>user-editable shapes</title> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <meta charset="utf-8"> </head> <body> <div id="map"></div> <script> var map; var rectangle; var infowindow; var selectregion = null; var penang = {lat: 5.466277, lng: 100.289981}; /** * centercontrol adds control map recenters map on chicago. * constructor takes control div argument. * @constructor */ fun...