Posts

Showing posts from July, 2011

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

javascript - Adding Google accounts with third-party authentication in iOS Settings -

we're university using google apps education. google defers our central authentication service (cas) server when people log in on web. (i.e., if john smith goes gmail.com , enters @example.edu email address in login page, google sends him our site enter username , password before letting him in.) we changed our website template morning , found when people tried set accounts in ios' settings app (e.g. settings -> mail, contacts, , calendars -> add account -> google), enter email address , sent our login page, usual, page finished loading, authentication screen go away , they'd bumped screen of account type options (icloud, exchange, google, etc) - before had chance put in username , password. i disabled of javascript running on page. (i left typekit, modernizr, , google analytics, , commented out jquery , of our custom code.) seems have fixed problem, i'm guessing sort of event being triggered made ios think flow complete. know how ios determines authen

c# - Launching a FilePicker or FolderPicker from a UICommand / MessageDialog -

when windows store app starts want prompt user choose local storage folder using folderpicker , saving futureaccesslist . prompt use messagedialog . protected async override void onnavigatedto(navigationeventargs e) { base.onnavigatedto(e); var messagedialog = new messagedialog("please pick folder you'd store documents", "choose storage"); messagedialog.commands.clear(); messagedialog.commands.add(new uicommand("ok", async (command) => { await pickfolder(); }); await messagedialog.showasync(); } private async task pickfolder() { folderpicker folderpicker = new folderpicker(); folderpicker.suggestedstartlocation = pickerlocationid.desktop; folderpicker.filetypefilter.add(".txt"); folder = await folderpicker.picksinglefolderasync(); // lets ignore cancellations storageapplicationpermissions.futureaccesslist.addorreplace("myfolder", folder); } this code doesn'

swift - UiTableViewCell Dynamic height works on iphone not ipad size class -

so have any size class using iphone , regular regular ipad. being said have custom uitableviewcell , have cell auto sizing iphone. laid out constraints vertically know size cell should be. the problem on ipad size class doing same thing, layout little different checked every element , has top , bottom , height constraint on yet uitableviewcell high iphone layout. here code scene: import uikit class trucklistmainviewcontroller: uiviewcontroller, uitableviewdatasource, uitableviewdelegate { var trucknames = ["this truck test"] var truckimages = ["default-truck.png"] var oneaverages = ["5.02"] var twoaverages = ["6.02"] var threeaverages = ["7.02"] var fouraverages = ["8.02"] var onelabels = ["30 day mpg"] var twolabels = ["60 day mpg"] var threelabels = ["90 day mpg"] var fourlabels = ["lifetime mpg"] @iboutlet weak var trucklisttable: uitableview! @iboutlet weak var openmen

python - Weighted random selection with and without replacement -

recently needed weighted random selection of elements list, both , without replacement. while there known , algorithms unweighted selection, , weighted selection without replacement (such modifications of resevoir algorithm), couldn't find algorithms weighted selection replacement. wanted avoid resevoir method, selecting significant fraction of list, small enough hold in memory. does have suggestions on best approach in situation? have own solutions, i'm hoping find more efficient, simpler, or both. one of fastest ways make many replacement samples unchanging list alias method. core intuition can create set of equal-sized bins weighted list can indexed efficiently through bit operations, avoid binary search. turn out that, done correctly, need store 2 items original list per bin, , can represent split single percentage. let's take example of 5 equally weighted choices, (a:1, b:1, c:1, d:1, e:1) to create alias lookup: normalize weights such sum 1.0 .

javascript - How do I obtain a Chart instance for Chart.js -

i using python/django default django templates. have in head (other django static files in location work fine): <script type="text/javascript" src="{% static "js/chart.min.js" %}"></script> naturally, have chart.min.js extracted master chart.js download static js directory. in body have: <div class="graph"> <canvas id="dgraph" width="600" height="400"></canvas> </div> also in body have: <script type="text/javascript" src="{% static "js/stuff.js" %}"></script> in stuff.js have: var data = [ { value: 20, color:"#878bb6" }, { value : 40, color : "#4acab4" }, { value : 10, color : "#ff8153" }, { value : 30, color : "#ffea88" } ]; // context of canvas element want sele

center progress-bar in Twitter Bootstrap -

the progress bar, blue shading, left aligned, i'd centered: <link rel="stylesheet" href="//cdn.jsdelivr.net/bootstrap/latest/css/bootstrap.css"> <link rel="stylesheet" href="//cdn.jsdelivr.net/bootstrap/latest/css/bootstrap-theme.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> <div class="progress"> <div class="progress-bar progress-bar-primary text-center" style="width: 25%">25%</div> </div> <div class="progress text-center"> <div class="progress-bar progress-bar-primary" style="width: 25%">25%</div> </div> <div class="progress" align="center"> <div class="progress-bar progress-bar-primary" style="width: 25%">25%</div> </div> <div class="progress&

r - Documentation about Rinternals's "VECTOR_SEXPREC" -

in rinternals.h, vector_sexprec struct defined as: typedef struct vector_sexprec { sexprec_header; struct vecsxp_struct vecsxp; } vector_sexprec, *vecsexp; struct vecsxp_struct { r_len_t length; r_len_t truelength; }; #define sexprec_header \ struct sxpinfo_struct sxpinfo; \ struct sexprec *attrib; \ struct sexprec *gengc_next_node, *gengc_prev_node typedef union { vector_sexprec s; double align; } sexprec_align; and said 2 last pointers in sexprec_header "used maintain colector's linked list structures". unlike sexprec struct, node data seems represented u union member of struct, in 1 can't see of it's members represent 'node data'. the dataptr(x) (which data access macro) defined as: #define dataptr(x) (((sexprec_align *) (x)) + 1) where seems data correspond pointer following x, don't understand how work. there documentation explained? (i've searched in r internals haven't found ) thanks.

c++ - Why can templates only be implemented in the header file? -

quote the c++ standard library: tutorial , handbook : the portable way of using templates @ moment implement them in header files using inline functions. why this? (clarification: header files not only portable solution. convenient portable solution.) it not necessary put implementation in header file, see alternative solution @ end of answer. anyway, reason code failing that, when instantiating template, compiler creates new class given template argument. example: template<typename t> struct foo { t bar; void dosomething(t param) {/* stuff using t */} }; // somewhere in .cpp foo<int> f; when reading line, compiler create new class (let's call fooint ), equivalent following: struct fooint { int bar; void dosomething(int param) {/* stuff using int */} } consequently, compiler needs have access implementation of methods, instantiate them template argument (in case int ). if these implementations not in header, wouldn

android - How to use one activity for 5 buttons with an image value -

i have 1 activity 5 buttons. when user clicks on 1 of buttons, want picture shown. don't want 5 activities 5 of buttons instead want them in 1 activity 1 imageview. example button1 > imageview1 >image1 example button2 > imageview1 >image2 please me. read tutorial , answer:- pass bitmap between activities

cross browser - Run at document start -

i writing extension need run @ document start. tried placing code outside appapi.ready in extension.js file it's still running late. in chrome use "run_at": "document_start" option. how can same in crossrider extension. to run code document start, inject script via background.js code using [appapi.dom.ondocumentstart.addjs][1] method. example: appapi.dom.ondocumentstart.addjs({ js:"alert('hello world!');" }); [ disclosure : crossrider employee] [1] http://docs.crossrider.com/#!/api/appapi.dom.ondocumentstart-method-addjs

hadoop - how to order and limit after group by in pig latin without crashing the job -

many times interested in taking top or bottom of set (after order by) has been grouped on keys before ordering. a = foreach data generate x,y,z; b = distinct a; c = group b (x,y) parallel 11; d = foreach c { orderd = order b z desc; first_rec = limit orderd 1; generate flatten(first_rec) (x,y,z); }; store d 'xyz' using pigstorage(); the foreach generate above takes 'forever' finish , getting killed after 12 hours or so. mapreduce job responsible spawned 3maps, 4reducers 1 reducer remains processing entire day , kills off due error 6017, file error. is there way solve or better way of doing want ? what volume of data involved ? sure datanode(s) big enough handle amount of data ? if so, instead of order, go max. way, 1 tuple have kept in memory , sufficient because group contains other needed information: d = foreach c generate group, max (b.z);

c# - In ASP.NET, how can I get an image from the code behind and display it in a <div> section? -

boss gave me webpage work with, , i've never done webpages before. when got there image need replace <div> <!--<img style="padding-top:5px;" class="featured" src="path/name.jpg" />--> html text i had go in .cs file of .aspx file , path image image image = new image(); image.imageurl = path; and old image was <div> <asp:image style="padding-top:5px;" class="featured" runat="server" id="image" /> html text but i'm not sure how new image display correctly old 1 was, since i've never worked asp files before. suggestions on do? in asp code, give image element id: <asp:image id="setincode" width="250" runat="server" /> in code-behind, retrieve control id, can set url: image img = (image)findcontrol("setincode"); img.imageurl = "images/butterfly.jpg";

Seen the rest of the layout when using the ScrollView in android studio -

i have android studio. when using scrollview design layout , etc in inside screen, have problem , when want add additional tools greater screen, can not action.also have android studio old version. you need edit xml of view want put out of screen. example put outside right bound. add android:layout_marginright="-250dp"

python 3.x - Insert words into string starting from specific index -

i have string looks : 'foo dooo kupa trooo bar'. i know start , end point of word kupa , need wrap : <span> </span>. after operation want string like : foo dooo <span>kupa</span> trooo bar i cannot find built-in methods can nice. basically there 2 options: import re strg = 'foo dooo kupa trooo bar' match = re.search('kupa', strg) print('{}<span>{}</span>{}'.format(strg[:match.start()], strg[match.start():match.end()], strg[match.end():])) or (the first expressioin regex, if pattern little more complicated): print(re.sub('kupa', '<span>kupa</span>', strg))

xcode - ECG plotting in IOS using Core Plot library. -

Image
i'm trying plot ecg on ios application using core plot library this video .i have tried plot ecg in video in ios app.i got following result. in general ecg graph should plotted left end of graph( lead 1 in screen shot ) after specific time interval.when i'm plotting ecg in app after specified time interval, each graph gets plotted on top of previous graph . how can solve this ? you can implement similar "real time plot" demo in plot gallery example app, although application little simpler since don't need update plot space after each frame of new data. can leave gap in plot line inserting data point nsnull or nan value between points on either side of break. the plot must redraw after every change plot data, need balance size (pixel dimensions) of plot , number of data points desired update rate. note ranges specified start location , length of range. add new data point , move blank space on 1 spot, reload range starting @ arrayindex ,

javascript - Send Cropped image to database ajax On client and PHP on server -

Image
i trying upload image database using javascript on client , php on server. first image selected gallery. after zooming , cropping image passed database the problem when iam trying submit cropped image value not passed php actual uploaded input "file" value being passed, need cropped areas value passed php. for testing purpose if js required can provide it. js: crops image $(function() { $('.image-editor').cropit({ exportzoom: 1.25, imagebackground: true, imagebackgroundborderwidth: 40, }); $('.export').click(function() { var imagedata = $('.image-editor').cropit('export'); window.open(imagedata); }); }); html: <form id="uploadform" class="image-editor"> <input type="file" class="cropit-image-input"> <!-- .cropit-image-preview-container needed background image work --> <div clas

python - How to create a random 4 digit number and store it as a variable -

this question has answer here: python: how generate 12-digit random number? 6 answers i working on guess-the-4-digit-number game in python 2.7.10. cannot find how randomly make 4 digit number, , store variable. digit has somewhere between 1111 , 9999 hard part is, want store variable, , not print out player see. if want to, i'll post code when i'm finished. the code here! import random number = random.randint(1111,9999) tryagain = 'yes' print ('hello! ') print ('------------------------------------------------------------- ') print ('try , guess 4 digit number in least number of tries ') print ('------------------------------------------------------------- ') while tryagain == 'yes': lowoutput = none highoutput = none guess = none guess = input('guess: ') if guess == number:

javascript - Change the size of an existing d3 tree -

i attempting make tree viewing web application. using d3 tree layout generate trees. able scale size of tree in either axis. in otherwords being able scale x , y axis of viewer. increase either vertical distance between nodes or increase length of branches. i have been unable accomplish this. have attempted change nodesize() of tree layout, , update had no effect. have attempted modify x or y coordinate of each node again had no effect. have been unable modify physical layout of tree once has been rendered. i have read , attempted fixes in following threads: dynamically resize d3 tree layout based on number of childnodes d3 tree layout separation between nodes using nodesize but did not solve problem. i implementing treegenerator object, handles of rendering of svg, using prototyped functions. going full screen feeling, treegenerator appends svg div width: 100%; height: 100% . should node have implemented both zooming , panning functionality. here constructor:

winapi - In MFC RegisterHotKey function don't respond -

in mfc registerhotkey function don't respond dll works fine if put same code in exe. using same code works in exe , putting in dll. making sure dll gets load , othere changes reflecting when run exe. you using same code registering hotkey in dll in exe. problem. see documentation registerhotkey : an application must specify id value in range 0x0000 through 0xbfff. a shared dll must specify value in range 0xc000 through 0xffff (the range returned globaladdatom function). avoid conflicts hot-key identifiers defined other shared dlls, dll should use globaladdatom function obtain hot-key identifier. to use registerhotkey shared dll, need generate id value. value in correct range, call globaladdatom string parameter (see about atom tables: string atoms ). create unique id, pass string representation of guid.

php - sprintf new line not working -

i trying format array of string data using sprintf reason can't print new line. want new line started after line_1 returned. here code have. appreciated. new using sprintf may doing wrong. function format_address($address_array) { return sprintf( "%s \n %s %s %s \t %s", $address_array['line_1'], $address_array['city'], $address_array['state'], $address_array['zip'], $address_array['line_5'] ); } just formalize answer question may marked "solved" based on liam's suggestion: function format_address($address_array) { return sprintf( "%s <br/> %s %s %s \t %s", $address_array['line_1'], $address_array['city'], $address_array['state'], $address_array['zip'], $address_array['line_5'] ); }

angularjs - Angulajs: Share http response with all pages without loading 2nd time -

i hope thread finds healthy. my app has 2 pages , using same controller both pages. i doing dozen of http requests @ page load , share data both pages. each time visit 1 of pages http requests sent server again. how can request server 1 time , share data between pages. i tried create factory 1 of http requests still request sent each time visit 1 of pages. my code: app.controller('maincontroller', function ($scope, translation) { //methos 1 $http.get('types/'). success(function (data, status, headers, config) { $scope.types = data; }); //methos 2 translation.list(function(tr) { $scope.trans = tr; }); } app.factory('translation', function ($http) { return { list: function (callback) { $http.get('trans/').success(callback); } }; }); what doing wrong here? heres example: app.factory('translation', function ($http,$q) { var types_q = $q.defer(); var s

python - pandas/seaborn - plot heatmap data distributions on a square grid -

Image
i plot spatial 2d distribution of data on heatmap through pandas , seaborn. let's have simple codes.csv file: code,value 2,4 5,6 7,1 9,2 10,1 plotting simple heatmap in seaborn easy, just: df = pd.read_csv('codes.csv',index_col='code') then sns.heatmap(df) returns what plotting whole 5 x 5 square grid, index of dataframe represents cell number, i.e. starting 0, of codes of 5 x 5 grid following (top bottom): 20,21,22,23,24 15,16,17,18,19 10,11,12,13,14 5,6,7,8,9 0,1,2,3,4 and resulting heatmap should map code column of dataframe grid representation (so cells 11 25 should colored in white, no values there). the plot looks bit strange. :-) anyway, key steps first set background color white via sns.set(style="white") , , plot heapmap mask parameter remove unwanted values. # data # ============================================================== df code value 0 2 4 1 5 6 2 7 1 3 9 2

Can't install NuGet package on a blank solution in Visual Studio 2015 -

at company have nuget package that, when applied on blank visual studio solution, generate solution template predefined set of named , configured projects. install package executing regular install-package command in package manager console. however seems have been stopped working in visual studio 2015. if try install package error: install-package : project 'default' not found. @ line:1 char:1 + install-package (the package name) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : objectnotfound: (default:string) [install-package], itemnotfoundexception + fullyqualifiederrorid : nugetprojectnotfound,nuget.packagemanagement.powershellcmdlets.installpackagecommand what puzzles me working fine in visual studio 2013. have been looking information behavior haven't seen mentioned nor reported bug anywhere. does know happening here? bug? change in way nuget works in vs 2015? by way, if matters, vs 201

database - Identical messages committed during a network partition -

i'm working on distributed database. i'm in situation where, during healing of partition (nodes beginning recognize ones split from) 2 different clients try , commit compare-and-set of 3 4, , both successful. logically, should not possible, i'm curious if there functional problem both returning successful. both clients correctly believe final state is, , command sent out successful. can't think of serious problems. there any? the "standard" definition of cas (to extent there such thing?) guarantees @ 1 writer see successful response particular transition. couple examples depend on guarantee: // generating unique id while (true) { unique_id = read(key) if (compare_and_set(key, unique_id, unique_id + 1)) { return unique_id } } if 2 clients both read 3 , execute compare_and_set(key, 3, 4) , they'll both think they've "claimed" 3 unique id , may end colliding down road. // distributed leases/leader election while (tr

batch file - Task Scheduler Error (0x1)? -

i created batch file curl script task scheduler in windows. reason i'm keep getting error 0x1 after script runs in scheduler. here batch file script: dir c:\curl.exe %%# in ("e:\one\two\*.txt") curl.exe -t "%%~f#" -u username:password ftp://ftp.test.com/hello/%%~nx# if can tell me wrong script or how should create call in task scheduler. thanks in advance.

android - Google playstore, dublicate declaration of permissions -

Image
just wanted small update in app , got message. didn't change in gradle/manifest file last time updated. could library conflict? in order deal dublicates above can use manifest merger. in case had use tools="replace" along permission keeps permission , doesn't rty merge permissions other libraries. e.g <uses-permission android:name="android.permission.write_external_storage" tools:node="replace" /> this link helped me understand merger better

javascript - Lodash _.filter function must only meet ONE condition -

i using lodash _.filter() function filter objects meet specific condition based on user search, either street address, town or country. i have extracted search string , want filter against several values within each object , must return object if string found in of keys. to explain want use example website. var users = [ { 'user': 'barney', 'age': 36, 'active': true }, { 'user': 'fred', 'age': 40, 'active': false }, { 'user': 'pebbles', 'age': 1, 'active': true } ]; // using `_.matches` callback shorthand _.result(_.find(users, { 'age': 1, 'active': true }), 'user'); in example, how filter users either 36 years of age or active? according documentation seems both conditions needs met, per above example object returned. you can pass function _.filter : _.filter(users, function(user) { return user.age === 36 || user.active; });

common lisp - define-modify-macro with operator argument -

in section 12.4 of on lisp , paul graham writes, "unfortunately, can't define correct _f define-modify-macro , because operator applied generalized variable given argument." but what's wrong this? (define-modify-macro _f (op operand) (lambda (x op operand) (funcall op x operand))) (let ((lst '(1 2 3))) (_f (second lst) #'* 6) lst) => (1 12 3) has there perhaps been change made define-modify-macro in ansi common lisp wasn't valid @ time on lisp written? or there reasons other 1 stated not using define-modify-macro here? it appears graham want's able make call such as (_f * (second lst) 6) rather than (_f #'* (second lst) 6) but surely that's not in keeping lisp2 such common lisp? according both lispworks's hyperspec , cltl2 (look define-modify-macro ), function assumed symbol (to function or macro). far know, following definition might not conforming specification: (define-modify-macro _f (

c# - Check time after a mousebuttondown before the mousebuttonup -

i think must little problem, can't clear thought on that. idea? i have borders on canvas (filled images) , want click border (i onmouseleftbuttondown) border gets red (so user knows sure object had clicked) , then, after 1 or 2 seconds, when mousebutton still pushed down, drag'n'drop should start. at first had borders inside buttons, clickevent seems conflict dragevent. got rid of buttons , did inside borders directly, works also. how can start drag after mousebuttondown , stop when mousebuttonup happens before time runs out. someone idea clean solution? private void onmouseleftbuttondown(object sender, mousebuttoneventargs e) { _source = sender border; mouse.capture(_source); } private void onmouseleftbuttonup(object sender, mousebuttoneventargs e) { _source = null; mouse.capture(null); } and in event onmousemove can modify border margins depends on mouse position after checking if _source type of border. var position = e.getposition

c - MATLAB(linux) cannot find the gcc -

i try compile in matalab, seems matlab cannot find gcc: error using mex no supported compiler or sdk found. options, visit http://www.mathworks.com/support/compilers/r2014a/glnxa64. error in compile (line 439) mex(args{:}); >> mex -setup mex configured use 'gcc' c language compilation. warning: matlab c , fortran api has changed support matlab variables more 2^32-1 elements. in near future required update code utilize new api. can find more information at: http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html. choose different language, select 1 following: mex -setup c++ mex -setup fortran but have installed gcc using apt-get install gcc , , type gcc -v can following information: using built-in specs. collect_gcc=gcc collect_lto_wrapper=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper target: x86_64-linux-gnu configured with: ../src/configure -v --with-pkgversion='ubuntu 4.8.2-19ubuntu1' --with-bugurl=file:///

c++ - Problems with Async_Read function -

introduction i'm studying c++ , boost/asio implement distributed system, need create asynchronous tcp server. server works echo-server need make request first (for example, send text through socket) , server responds pi number. tcp-connection class used in main-server class class tcp_connection : public boost::enable_shared_from_this <tcp_connection> { public: typedef boost::shared_ptr<tcp_connection> pointer; static pointer create(boost::asio::io_service &io_service){ return pointer(new tcp_connection(io_service)); } tcp::socket &socket(){ return socket_; } void start(){ for(;;){ boost::asio::async_read(socket_, boost::asio::buffer(buffer_), boost::bind(&tcp_connection::handle_read, shared_from_this(), boost::asio::placeholders::error, boost::

REGEX in OQL Query -

i wanted use regexp while querying oql objects, select statement be: select o testobject o ((o.name regexp '^d') ) but here getting exception like 2015-07-23 15:53:50,081 error [workerthread#2[127.0.0.1:36335]] centina.sa.server.common.object.session.readonlyobjectsessionbean object java.lang.illegalargumentexception: org.hibernate.hql.ast.querysyntaxexception: unexpected token: regexp near line 1, column 74 [select o centina.sa.model.topology.networkelement o ((o.name regexp '^d') ) ] @ org.hibernate.ejb.abstractentitymanagerimpl.throwpersistenceexception(abstractentitymanagerimpl.java:603) @ org.hibernate.ejb.abstractentitymanagerimpl.createquery(abstractentitymanagerimpl.java:96) @ org.jboss.jpa.tx.transactionscopedentitymanager.createquery(transactionscopedentitymanager.java:139) @ centina.sa.server.common.object.session.readonlyobjectsessionbean.getallobjects(readonlyobjectsessionbean.java:1905) @ centina.sa.server.common.object.s

java - The library 'sqlite-native-driver.jar' contains native libraries that will not run on the device -

i'm trying running old app newer plugins , api , following errors. [2015-07-23 16:13:54 - demopia] dx trouble writing output: prepared [2015-07-23 16:13:58 - demopia] library 'sqlite-native-driver.jar' contains native libraries not run on device. [2015-07-23 16:13:58 - demopia] additionally of libraries interfer installation of application because of location in lib/ [2015-07-23 16:13:58 - demopia] lib/ reserved ndk libraries. [2015-07-23 16:13:58 - demopia] following libraries found: [2015-07-23 16:13:58 - demopia] - lib/arm64-v8a/libsqlc-native-driver.so [2015-07-23 16:13:58 - demopia] - lib/armeabi/libsqlc-native-driver.so [2015-07-23 16:13:58 - demopia] - lib/armeabi-v7a/libsqlc-native-driver.so [2015-07-23 16:13:58 - demopia] - lib/x86/libsqlc-native-driver.so [2015-07-23 16:13:58 - demopia] - lib/x86_64/libsqlc-native-driver.so i tried follow this link still receive same error. can please me this? thank you if continue same error library sqli

android - FloatingActionButton Unable to start activity ComponentInfo -

i want use floating action button in application ,to got latest support library 22.2.1 , add application library. cleaned project , there no more errors . put code in xml layout , when run application ,i ran error couldn't solve . this xml code : <?xml version="1.0" encoding="utf-8"?> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:padding="4dp" > <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <android.support.design.widget.floatingactionbutton android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity=&quo