Posts

r - Building and adjacency matrix -

i wondering if guys can me building adjacency matrix. have data in cvs format this: paper_id author 2 foster-mcgregor, n. 3 van houte, m. 4 van de meerendonk, a. 5 farla, k. 6 van houte, m. 6 siegel, m. 8 farla, k. 11 farla, k. 11 verspagen, b. as can see column "paper_id" has repeated value of 11, meaning "farla, k." , "verspagen, b." coauthors of publication. need build square weighted matrix using names of authors, counting times collaborating together. does following looking for? # simulate data. d <- data.frame( id=c(2,3,4,5,6,6,8,11,11,12,12), author=c("fn", "vm","va","fk","vm","sm","fk","fk","vb","fk","vb") ) d id author 1 2 fn 2 3 vm 3 4 va 4 5 fk 5 6 vm 6 6 sm 7 8 fk 8 11 fk 9 11 vb 10 12 fk 11 12 vb # create incidence matrix: m ...

c++ - Constant Buffer DirectX 11 -

getting frustrated cbuffer in hlsl d3d11 not updating, initial values set upon application launch updating no go, used updatesubresource, tried id3d11devicecontext::map & id3d11devicecontext::unmap. note: cbuffer setup d3d11_usage_dynamic & d3d11_cpu_access_write. my id3d11buffer (constant buffer) returning 4 bytes when it's size queried.... sounds part of problem struct vs_cbuffer_data { xmfloat4x4 world; xmfloat4x4 view; xmfloat4x4 projection; vs_cbuffer_data() { xmstorefloat4x4(&world, directx::xmmatrixidentity()); xmstorefloat4x4(&view, directx::xmmatrixidentity()); xmstorefloat4x4(&projection, directx::xmmatrixidentity()); } }; d3d11_buffer_desc cbufferdesc; memset(&cbufferdesc, 0, sizeof(cbufferdesc)); cbufferdesc.bindflags = d3d11_bind_constant_buffer cbufferdesc.usage = d3d11_usage_dynamic; cbufferdesc.bytewidth = sizeof(m_cbufferdata); cbufferdesc.cpuaccessflags = d3d11_cpu_access_write; c...

python - Collision Detection in a List -

i'm new collision detection , have been working on brick breaker style game tkinter. each of bricks created separately instead of creating if statements each of 30+ bricks put them in list, when run program collision detection function doesn't work. can please don't understand wrong in code. from tkinter import * root = tk() drawpad = canvas(root, width=600,height=600, background='white') player = drawpad.create_rectangle(260,590,340,595, fill = "blue") ball = drawpad.create_oval(293,576,307,590, fill = "white") brick1 = drawpad.create_rectangle(30,20,80,50, fill='green') brick2 = drawpad.create_rectangle(30,100,80,130, fill='green') brick3 = drawpad.create_rectangle(30,180,80,210, fill='green') brick4 = drawpad.create_rectangle(100,20,150,50, fill='green') brick5 = drawpad.create_rectangle(100,100,150,130, fill='green') brick6 = drawpad.create_rectangle(100,180,150,210, fill='green') brick7 =...

What does ">" mean in jQuery and how to use it? -

i'm new jquery code, , saw code this: var $pages = $('#main > div'); does mean $pages first div under #main or divs under #main? if have html code: <div id="main"> <div class="sub-div" id="1">1</div> <div id="1a">1a</div> <div class="sub-div" id="2">2</div> <div class="sub-div" id="3">3</div> </div> so, $pages array contain 3 divs or first one? additionally, can use var $pages = $('#main > div > div'); to "1a" ? many thanks! $pages immediate child divs of #main. if have <div id=main> <div id=1> <div id=2></div> </div> <div id=3></div> <div id=4></div> <span id=5> <div id=6></div> </span> </div> then $('#main > div') fetch 1,...

Why is my Point array only returning null in Java? -

i'm trying write method uses board , check see if @ given point on board, swap between 1 point right or below, causes "match" occur on board. points cause swap added point[] , returned. array returns, returns, [null],[null],[null]. why not returning points? thanks public static point[] findpossibleswaps(board b) { point[] swaps = new point[3]; int x = 0; int y = 0; point normal = new point (x,y); point hor = new point (x+1, y); point ver = new point (x, y+1); int count = 0; for(y = 0; y < b.getsize()-1; y++) { for(x = 0; x < b.getsize()-1; x++) { b.swapsquares(normal,hor); if (b.hasmatches() && (x)!=b.getsize()-1) { swaps[count] = new point(x+1,y); count++; } b.swapsquares(hor, normal); b.swapsquares(normal, ver); if (b.hasmatches() && y!=b.getsize()-1) { ...

r - Aggregate columns in data.table for descriptive statistics -

i looking @ student data set @ individual student level. what want do descriptive analysis @ faculty degree level. that students doing 2 degrees (double degrees eg bachelor of , bachelor of science) students generate 2 degrees. my data looks below. faculty assignments (whether fac1 or fac2) arbitrary. studid fac1 fac2 success sex ave_mark 1 arts 0 male 65 2 science 1 male 35 3 law 0 male 98 4 science 0 female 55 5 commerce 0 female 20 6 commerce 1 male 80 this generated students<-data.table(studid=c(1:6) ,fac1 = c("it","science", "law","it","commerce","commerce"), fac2 = c("arts","","","science","it","it"), success = c(0,1,0,0,0,1), sex=c("male","male","male...

html5 - Is it still an unline tag or does it mean something else? -

i looking use jssor slider , in looking through code found <span u="arrowleft"...> tag (which can seen in other question: how move span different position in div ) the <u> tag used indicate underline, i've never seen u= tag. whenever try google comes underline tag results. mean? it specifies usage of ui element. jssor slider recognizes usage of every element in slider. for more info. if pass html validation, here.