Posts

cytoscape.js - How to wrap the text inside a shape using Cytoscape? -

Image
i'm trying build tiles using cytoscape. basically, each rectangle (tile) has title , want written within limits of rectangle. my code is: var cy = cytoscape({ container: document.getelementbyid('cy'), style: [ { selector: 'node', css: { 'shape': 'rectangle', 'width': '200', 'height': '150', 'content': 'data(name)', 'text-wrap': 'wrap', 'text-valign': 'center', 'text-halign': 'center', 'text-transform': 'uppercase' } }, /// and: elements: { nodes: [ { data: { id: 'f1', name: 'this long text long text long text long text long text long text long text'} }, { data: { id: 'f2' } }, { data: { id: 'c', parent: 'b' } }, { data: { id: 'd' } }, { data: { id: '...

difftime - get time diff for each group in R -

if have data this. 1 02-01-2015 08:08:00 1 b 02-01-2015 08:11:00 1 c 02-01-2015 08:12:00 1 d 02-01-2015 08:16:00 2 02-01-2015 09:08:00 2 b 02-01-2015 09:11:00 2 c 02-01-2015 09:13:00 2 d 02-01-2015 09:19:00 i want time difference each row in group. expect result this 1 b 3:00 1 c 1:00 1 d 4:00 2 b 3:00 2 c 2:00 2 d 6:00 plyr work well, base r, couple tapply's work. recreate data using numbers instead of dates. x <- data.frame(groups = c(1,1,1,1,2,2,2,2),id = rep(letters[1:4],2),data = c(1,3,4,7,2,7,15,24),stringsasfactors = f) find differences , appropriate id's. data.frame(groups = unlist(tapply(x$groups,index = x$groups,fun = function(x){x[-1]})), id = unlist(tapply(x$id,index = x$groups,fun = function(x){x[-1]})), difference = unlist(tapply(x$data,index = x$groups,fun = diff))) your dates might need different function calculate difference. don't know f...

sorting - MySQL Sort by two columns and the sort remaining records alphabetically -

i have 3 three columns in mysql table: title, featured, sort_order where title varchar , featured enum ("yes" or "no") , sort_order int . i return result set featured "yes" first , sort featured "yes" sort_order ascending (so, 0, 1, 2, 3, etc...) , then sort remaining records title asc (alphabetical). i've around @ group by , etc. having issues finding answer. hopefully i'm trying accomplish makes sense. appreciated :) you mean this? select *, if(featured = 'yes', 0, 1) ftsort, cast(if(featured = 'yes', sort_oder, title) char) nosort table order ftsort asc, nosort asc

node.js - NodeJS TCP Server Does Not Receive Data -

i'm trying create simple receive-only socket server, in nodejs v0.12.0, receive messages via tcp. seems no data received unless nodejs net server response line feed after each data event. var server = net.createserver(function( socket ) { socket .setencoding( 'utf8' ) .on( 'data', function( cdata ) { console.log( 'cdata' ); console.log( cdata ); // uncomment receive data. //socket.write( '\n' ); }); // uncomment receive data. //socket.write( '\n' ); }).listen( 84, '127.0.0.1' ); then client this... setinterval( function(){ client.write( 'test\n' ); }, 1000 ); unless send line feed when client connects , line feed each data event, no further data events triggered. missing something? have reply sort of message each data event, or there option receive data without sending response? test confirmed. problem origina...

byte - How to create BitArray for Code128Reader().decodeRow(...) method in Android, java? -

i have next issue. image camera ( android.hardware.camera ). crop image , leave 1 row of pixsels, horizontal row in middle of image. row represented byte array ( byte[] ) data in format nv21 (or ycbcr_420_sp). need submit row method code128redaer.decoderow(int rownumber, bitarray row, map<decodehinttype,?> ints) , zxing library. don't understand, how convert byte[] bitarray? or how decode row? don't want use decode(binarybitmap image) because think slowlier.

assembly - ASM under ARM - Instruction mov -

i'm biginner asm language , know how can set value -1894025488 register r0 ? if value "10", it's right mov r0, #10 hex -> 0a00a0e3 but, if value bigger "1024" "-1894025488", can't convert in hexa mov r0, #-1894025488 hex -> can't convert in hexa can me ? you need read on arm instructions in arm documentation, should become obvious that. first off if have computer can convert number hex, shouldnt need to. there 3 major arm instruction sets, arm, thumb , thumb2 extensions arm (ones have mov). each has different rules immediate values. if think wanting load 0x8f1b76f0 register, 32 bit number not ones or zeros. arm instructions 32 bits , thumb 16 or 16+16 (32). not possible put 32 bits of immediate plus opcode bits in mov , register , have fit in 32 bits, cant squeeze 32+n bits 32, mips have else. arm solution take advantage of barrel shifters have around 8 significant bits , can shift them various l...

ibm midrange - DB2 for IBM i (iSeries) Date - Need to Compare (Current Date - 1) -

i new db2 ibm (iseries) syntax. compare date field in table yesterday's date (current date - 1) auditing purposes. however, cannot work. receive "[sql0182] date, time, or timestamp expression not valid" error. appreciated. see code below. select decimal_field schema.table date(insert(insert(digits(decimal_field), 5, 0, '-'), 8, 0, '-')) > date(varchar_format(timestamp_iso(current date), 'yyyy-mm-dd')) - 1 , decimal_field <> 0 specify duration. select decimal_field schema.table date(insert(insert(digits(decimal_field), 5, 0, '-'), 8, 0, '-')) > date(varchar_format(timestamp_iso(current date), 'yyyy-mm-dd')) - 1 day , decimal_field <> 0 also comparison can simplified: select decimal_field schema.table date(insert(insert(digits(decimal_field), 5, 0, '-'), 8, 0, '-')) > current_date - 1 day , decimal_field <> 0 datetime arithmetic in sql ...