Posts

Showing posts from February, 2014

Write a map with key as int to json in scala using json4s -

i trying write map in key int json string not able so: import org.json4s._ import org.json4s.jackson.jsonmethods._ import org.json4s.jsondsl._ object myobject { def main(args: array[string]) { // works fine //val mymap = map("a" -> list(3,4), "b" -> list(7,8)) // not work val mymap = map(4 -> map("a" -> 5)) val jsonstring = pretty(render(mymap)) println(jsonstring) } i receiving following error: [error] /my_stuff/my_file.scala:14: overloaded method value render alternatives: [error] (value: org.json4s.jvalue)org.json4s.jvalue <and> [error] (value: org.json4s.jvalue)(implicit formats: org.json4s.formats)org.json4s.jvalue [error] cannot applied (scala.collection.immutable.map[int,scala.collection.immutable.map[string,int]]) [error] val jsonstring = pretty(render(mymap)) [error] ^ [error] 1 error found [error] (compile:compileincremental) compilation failed i vaguely

javascript - communicate between a server and a client with node.js -

i have node.js server:- // *********** server receives orders ************ // // use features of http protocol. // var http = require('http'); // initialize empty string. // var req = ""; // create server receive order request. // var server = http.createserver(function(req,res) { res.writehead(200, {'content-type': 'text/plain'}); // when data received, success message displayed. // res.on('data', function(data){ req += data; // received data appended. // console.log("we have received request successfully."); }); }); // error message displayed - error event. // server.on('error', function(e){ console.log("there problem request:\n" + e.message); }); // server listens @ following port , localhost (ip). // server.listen(8000, '127.0.0.1'); and have node.js client:- var http = require("http"); var querystring = require("querystring"); var postor

mysql - Addition of COUNT to query causes query to get stuck -

Image
edit: simplifying it's trivial example: select count(*) a_table use index(contract) left join b_table on a_table.contract = b_table.contract also, nothing. explain : i have 2 queries identical ( b_table temporary table): select if (b.contract null, 1, null) c a_table left join (select contract b_table) b on a.contract = b.contract this query returns reliably in below .25 seconds. here explain : here same query, count() around if : select count(if (b.contract null, 1, null)) c a_table left join (select contract b_table) b on a.contract = b.contract this 1 shows 'sending data' , @ least after several minutes, seems hang , nothing. here explain : (note d == a_table a , eric_tmp == b_table . not confusing.) this original query caused kerfuffle, above attempt rewrite it: select count(*) a_table not exists (select 1 b_table b a.contract = b.contract) which of course hung. heck going on here? i've tried adding , using non-unique index, do

com - Executing cscript using IActiveScript with C++ -

i'm trying execute script using cscript iactivescriptparse , parsescripttext reason error: e_unexpected . this article has helped me lot. i'm using getengineguid function in code. the code below i've tried. prints: -2147418113 -2147418113 meaning activescriptparse->parsescripttext returns e_unexpected . doing wrong? #include <iostream> #include <windows.h> #include <objbase.h> #include <activscp.h> using namespace std; int main(int argc, char* argv[]) { coinitialize(null); guid guidbuffer; // find script engine use files end .js extension. // implemented in article linked to. getengineguid(".js", &guidbuffer); iactivescript *activescript; cocreateinstance(guidbuffer, 0, clsctx_all, iid_iactivescript, (void **)&activescript); iactivescriptparse *activescriptparse; activescript->queryinterface(iid_iactivescriptparse,

angularjs - Angular ng-table sorting not working in fixed header -

i new angularjs. have created table using ng-table, problem table header sorting not working. sample code attached here. html : (sample ng-table) <table ng-table="tableparams" show-filter="true" class="table"> <thead> <tr>row 1</tr> <tr>row 2</tr> <tr>row 3</tr> <tr>row 4</tr> <tr>row 5</tr> <tr>row 6</tr> </thead> <tbody> <tr ng-repeat="user in $data"> <td sortable="'value1'">{{user.value1}}</td> <td sortable="'value2'">{{user.value2}}</td> <td sortable="'value3'">{{user.value3}}</td> <td sortable="'value4'">{{user.value4}}</td> <td sortable="'value5'">{{user.value5}}&

multipartform data - How to handle FineUploader POST request in Java in PlayFramework? -

i trying integrate fineuploader in play framework code. view part set , working fine. i not clear how retrieve file in controllers upload method. , other query parameters, qquuid, qqfilename, content-type e.tc. following dump of file upload request sent fileuploader:- request headers accept:application/json accept-encoding:gzip, deflate accept-language:en-us,en;q=0.8 cache-control:no-cache connection:keep-alive content-length:1021645 content-type:multipart/form-data; boundary=----webkitformboundaryk8bzisbkkjjqiwq6 dnt:1 host:localhost:9000 origin:http://localhost:9000 referer:http://localhost:9000/computers user-agent:mozilla/5.0 (macintosh; intel mac os x 10_9_4) applewebkit/537.36 (khtml, gecko) chrome/42.0.2311.152 safari/537.36 x-requested-with:xmlhttprequest request payload ------webkitformboundaryk8bzisbkkjjqiwq6 content-disposition: form-data; name="id" 593 ------webkitformboundaryk8bzisbkkjjqiwq6 content-disposition: form-data; name="qquuid" ba

php - How to get the value from array -

here array i.e., i have given print_r($result); , given below so output given below, here can take fullname by echo $result['structuredxmlresume']['contactinfo']['personname']['fullname']; but while try take employerorg i tried loop i.e., foreach($result['structuredxmlresume']['employerorg'] $x){ echo $x['employerorgname'] . '<br />'; } but don't values even tried print_r $result['structuredxmlresume']['employerorg'][0]; and $result['structuredxmlresume']['employerorg'] both returning empty. how can ? formatted array : /1430714172resume.docxarray ( [resumeid] => array ( [@attributes] => array ( [resumeparserproductname] => recruitplus resume parser ) [resumeparserorgname] => itcons e-solutions private limited ) [structuredxmlresume] => array ( [contactinfo] => array ( [personname] => array ( [fullname] => debra al

How to join Two tables of two non relashinship defined columns using Nhibernate QueryOver -

using nhibernate queryover , want join 2 tables using 2 columns not defined in mapping relationship. e.g. not exact scenario can explain that tables: employee(id, name, departmentid, somecode,address) department (id, name, ,code) select select * employee e join department d on d.code = e.somecode can please tell me how query using nhibernate queryover . note "somecode" in employee , "code" in department not defined relationship. departmentid foreign key , can join these using joinalias want in different way. there similar questions, e.g. nhibernate (+ fluentnhibernate) : join 2 detached tables hibernate criteria projection without mapped association of tables and answer is: either use hql , cross join (with where) there no way how queryover / criteria ) see doc: 14.2. clause multiple classes may appear, resulting in cartesian product or "cross" join. from formula, parameter formula form, pa

ios - Using UIPageViewController in UIScrollView -

Image
i have uipageviewcontroller placed in uiscrollview, pageview scrolling in horizontal direction, scrollview in vertical. scrollview works fine, when swipe horizontal in pageview area nothing happend. i tried add every scrollview gesture recognizers requiregesturerecognizertofail gesture recognizers pageview, off scrolling on pageview area: uiscrollview sv; (uiview *view in self.pageviewcontroller.view.subviews) { if ([view iskindofclass:[uiscrollview class]]) { sv = (uiscrollview*)view; } } (uigesturerecognizer *gesturerecognizer in sv.gesturerecognizers) { (uigesturerecognizer *gesturerecognizerforfail in self.scrollview.gesturerecognizers) { [gesturerecognizerforfail requiregesturerecognizertofail:gesturerecognizer]; } } the every controllers in pageview works fine, when change them buttons in scrollview, swipe doesn't work.

php - How to decode SCC file? -

after severals researches on google , github, i'm coming here ask help. i'm creating scc file parser in order convert dfxp file. nevertheless, can't find information obtain plain text scc file. scc file example : scenarist_scc v1.0 00:59:59;26 9420 9420 94f2 94f2 ad20 cd61 e973 206e ef6e 2c20 e3a7 e573 f420 e661 75f8 ae80 942c 942c 942f 942f 01:00:01;22 9420 9420 9454 9454 9723 9723 4aa7 61e9 2061 e96d dc2c 94f2 94f2 97a2 97a2 e3a7 e573 f420 f4f2 91ba 91ba 7320 64e9 e6e6 dcf2 e56e f4ae 942c 942c 942f 942f 01:00:04;07 9420 9420 94d0 94d0 97a1 97a1 4aa7 61e9 2061 e96d dc20 64e5 75f8 20ef 7520 f4f2 efe9 7320 e6e5 6d6d e573 94f4 94f4 97a2 97a2 6461 6e73 206d 6120 76e9 e5ae 942c 942c 942f 942f its translation in plain text : dans une pièce à la lumière tamisée, un homme en complet assis sur un fauteuil s'adresse à un interlocuteur hors champ. homme : mais non, c'est faux. j'ai aimé, c'est très différent. j'ai aimé deux ou trois femmes dans

PHP date("w", $timein) returns wrong value with a valid date -

this question has answer here: convert 1 date format in php 12 answers i have function runs on server , want different output based on day of week, saturday , sunday should give weekend message , different weekdays. $timein = date("y-m-d h:i:s"); $dw = date("d", $timein); $tm = date("e", $timein); echo "current date: ".$timein."<br>"; echo "day of week: ".$dw."<br>"; echo "timezone: ".$tm."<br>"; and output: current date: 2015-05-15 06:07:12 day of week: wed timezone: america/denver we friday , expecting fri , using w instead of d getting 3 in results. you need use strtotime function convert unix timestamp. update code into. $dw = date("d", strtotime($timein)); $tm = date("e", strtotime($timein));

Email Security Exception in ASP.NET -

security exceptiondescription: application attempted perforanoperation not allowed by`the security policy. grant application required permission please contact system administrator or change application's trust level in configuration file. exception details: system.security.securityexception: request permission of type 'system.net.mail.smtppermission, system, version=2.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089' failed. source error: line 45: { line 46: smtp.host = "smtp.gmail.com"; line 47: smtp.port = 587; line 48: smtp.enablessl = true; line 49: smtp.deliverymethod = system.net.mail.smtpdeliverymethod.network; source file: d:\inetpub\vhosts\softsoftware.in\designscentre\asktheexpert.aspx.cs line: 47 stack trace: [securityexception: request permission of type 'system.net.mail.smtppermission, system, version=2.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089' fai

android - loading of 1000 images effectively from network to GridView -

in application have show many images (say >1000). all these images comes network. now, downloading images , passing them adapter set gridview . my problem downloading images @ once occupies lot of runtime memory. want change design. is there way handle images/bitmaps in large number effectively? downloading 100 images, again 100 erasing previous 100 (as per need). you can try these optimisations: decrease number of images, really need 100 in 1 go? download image thumbnails, really need full-sized non-compressed images? cache next images, pre-load images before user asks them profile app, see time consumed use several threads, @ least 1 pulling data , 1 ui

jquery - Why it doesn't fade out? -

why doesn't fade out? <!doctype html> <html> <head> <link rel="stylesheet" type="text/css" href="stylesheet.css"/> <script src="http://ajax.googleapis.com/ajax/libs/jquery/latest/jquery.js"></script> <script type="text/javascript" src="script.js"></script> </head> <body> <p>asdasds</p> </body> </html> my script.js external file $(document).ready(function() { $('p').fadeout(500); }); error 404 when open in new tab http://ajax.googleapis.com/ajax/libs/jquery/latest/jquery.js use below code in script tag. <script src="//code.jquery.com/jquery-1.11.3.min.js"></script> or per kmsdev suggested add newest version <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>

jquery - How to display JSON data according to URL parameter(year) passing (if it is 2015, 2015 data only should display not 2016 data)) -

i creating hybrid application using intel xdk , using jquery mobile ui, trying display json data label, first let me tell ui design how need. have 2 buttons (increment, decrement) in between these 2 buttons have 1 label. ex: let consider set label value "2015"(current year), if click increment button value increasing 2016,2017 , on. same decrement button if click values go 2014,2013 , on. header ui design ok, let me come content side, in content side going display json data url according above year displaying ex: suppose 2015 there in label, have display 2015 data("sports day" refer below(message)json) content div tag. if increment 2016 using increment button, have display 2016 data("culturals" refer below(message)json) same content page , should not display previous value data(2015 data). attached requirement images how need check these 2 links https://drive.google.com/file/d/0b9rwnanuuwndqlg5aviwsklax3m/view https://drive.google.com/file/d/0b9rwn

android - How do i implement an endless scroll to onResume()? -

how implement endless scroll onresume(), oncreateview, implement endless scroll , works fine when comes onresume(), doesn't work in shows blank data. here's code oncreate public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { onrestoreinstancestate(savedinstancestate); view rootview = inflater.inflate(com.barakah.camel.r.layout.browse_fragment_layout, container, false); setupfloatingactionmenu(getactivity()); recyclerview = (recyclerview) rootview .findviewbyid(com.barakah.camel.r.id.my_recycler_view); layoutmanager = new linearlayoutmanager(getactivity()); recyclerview.setlayoutmanager(layoutmanager); recyclerview.setonscrolllistener(new endlessrecycleronscrolllistener( layoutmanager) { @override public void onloadmore(int current_page) { int limit = cur

java - Get current day Caldroid calendar -

how current day on day click using caldroid calendar in application in string format "dddd mm yy" is possible? you try caldroidlistener , date on select public string currentdate; final caldroidlistener listener = new caldroidlistener() { @override public void onselectdate(date date, view view) { currentdate = (string) android.text.format.dateformat.format("yyyy-mm-dd", date); } ... }

svn - Replacing directory with external results in "working copy locked" on `update` -

(related to: svn externals repo "is locked" on update ) i started off repository structure this: ^/ ├ module1/ │ ├ foo/ │ ├ bar/ │ ├ baz/ ├ module2/ the directory ^/bar antiquated copy of module2 , , decided better external modern version, instead of byte-wise copy: ^/ ├ module1/ │ │ (external: "^/module2 bar") │ ├ foo/ │ ├ baz/ ├ module2/ setting went smoothly: svn co svn://module1 module1 cd module1 svn delete bar svn propset svn:externals "^/module2 bar" . now want update working directory can perform build & test new code before committing. however, svn update result in following error: fetching external item 'module1/bar' svn: warning: working copy 'module1/bar' locked i tried svn cleanup in each directory, subsequent update still failed same error. is because i'm trying replace directory external same name, in same commit? want possible? i using svn 1.8. yes, cause. directory being locke

android - Convert min per km to display on TextView -

i developing run tracker app, calculated average pace gives me minute per km time. cant understand how convert value show in format 00:00. this relevant method: private void setpace(double distanceinmeters) { double totaltimeinsec = (timer.gettimeinseconds() + (timer.min * 60)); double meterspersecond = (distanceinmeters / totaltimeinsec); double minperkm = 16.6666667 / meterspersecond; // convert minperkm } the values gives me example duration time: 00:13:07 , distance of 2.02 : totaltimeinsec = 787.0 meterspersecond = 2.5607004323181384 minperkm = 6.508635875424163 i need convert minperkm real time show in average pace. can please? found solution! corrected code, maybe anyone: private void setpace(double distanceinmeters) { double totaltimeinsec = (timer.gettimeinseconds() + (timer.min * 60)); double meterspersecond = (distanceinmeters / totaltimeinsec); double minperkm = 16.6666667 / meterspersecond; double secondsperkm

c# - Missing Referenced Components during Build -

Image
problem solvers: i working windows phone 8 application. introduced product project has reached level. pulled codes computer , when tried building app, getting "the referenced component 'xxxxxxxxxx' not found." (snips shown below). here algorithm: if joined project , cannot build project: goto a if want fix yourself: do use nuget, if not mention other fellow devs. it's idea pick up. nuget re-download binaries central repository(ies) when rebuild project open project file in notepad (.csproj) , references point to. it's point /bin or /obj folder developers shouldn't commit , didn't commit. right binaries other developers or elsewhere, create folder, libs in solution, put binaries there , reference vs these binaries. ensure libs folder committed source control start using build server catch sort of trouble == a == poke fellow developers (other project committers) fix references , commit source control, can pick them

c - Dynamically allocate and free memory in local functions -

consider following function: void free_or_not ( int count ) { int ; int *ip = malloc ( count * sizeof ( int ) ) ; ( = 0 ; < count ; ++ ) ip[i] = ; ( = 0 ; < count ; ++ ) printf ( "%d\n" , ip[i] ) ; free ( ip ) ; } will cause memory leak if don't call free() inside free_or_not() ? yes,when function finishes, lose pointer allocated memory free() it.

json decode in php -

i have following json string , want retrieve email address it. how do in php? {"communications":{"communication":[{"@array":"true","@id":"23101384","@uri":"xyz/v1/communications/1111","household":{"@id":"111111","@uri":"xyz/v1/households/5465465"},"person":{"@id":"","@uri":""},"communicationtype":{"@id":"1","@uri":"xyz/v1/communications/communicationtypes/1","name":"home phone"},"communicationgeneraltype":"telephone","communicationvalue":"1111","searchcommunicationvalue":"2693240758","listed":"true","communicationcomment":null,"createddate":"2008-11-10t12:31:26","lastupdateddate":"2009-08-11t23:40:02"},{&q

How to set custom row layout for android searchView suggestion list -

i using searchview , searchable.xml search phone contacts. searchable.xml android:searchmode="queryrewritefromtext" android:searchsuggestauthority="com.android.contacts" android:searchsuggestintentaction= "android.provider.contacts.search_suggestion_clicked" android:searchsuggestintentdata= "content://com.android.contacts/contacts/lookup" so, when search keyword, displays suggestion list of matched contacts of phone (matched keywords highlighted in blue color). i did not use custom adapter or custom list item layout. displays result list in default android style. how can change style of searchview (background, hint text color, hint text font, search icon etc.) , how apply custom layout result list items. note: getting matching contact names native contacts database. did not write query fetch result.

java - How to generate concentric layers in a matrix -

Image
i need generate matrix aspect: but more layers , can't find way it. understand, each color has n layers (in example, n=2 ), , there can m colors (in example, m=3 ). inner matrix, green one, should follow same spiral pattern others, in image wrong. next color, yellow in case, needs start "surrounding" previous matrix starting in top left, filling 1 layer , continuing next "layer" in top left too, , on. colors aren't important, important numbers in each cell. any ideas? ps: forget 10 , 34 in green, modifications. ps2: example filled hand, can size of matrix, 256x256 impossible. one strategy start innermost layer, , fill them while going outwards. way, core loop becomes particularly simple, because can walk through relevant part of matrix, , fill fields not filled yet. the "relevant" part of matrix can computed within loops on colors layers: each layer, total size (width , height) of rectangle covered 1 layer increases 2. w

javascript - toggleClass in jquery dosent work when i use id selector in Css -

i'm new @ jquery , have problem when use id selector in css jquery code doesn't work. here html: <body> <div id="fm"> </div> </body> here javascript code: $(function () { $("#fm").click(function () { $(this).toggleclass("cm"); }); }); this css ok , works: body>div{ height:100px; background-color:blue; transition:all ease 0.5s; position:fixed; top:0; left:0; bottom:100px; right:0; z-index:1000; } but if use #fm in css selector doesn't work. think may because of cascading behavior don't know how fix it. here css doesn't work: #fm{ height:100px; background-color:blue; transition:all ease 0.5s; position:fixed; top:0; left:0; bottom:100px; right:0; z-index:1000; border:1px solid black; } and cm class .cm { background-color:red; height:150px; } i appreciate if help

benchmarking - Rails 3.2.21 and Ruby 2.0 Performance Test Issues -

running rails performance test unsupported memory , objects in output. ruby 1.9x 1 can install gcdata patch. however, can't figure out how install ruby 2.0. when run: bundle exec rake test:benchmark rails_env=test i get: browsingtest#test_homepage (247 ms warmup) wall_time: 3 ms memory: unsupported objects: unsupported gc_runs: 0 gc_time: 0 ms = 1.42 sfinished tests in 1.500688s, 0.6664 tests/s, 0.0000 assertions/s. 1 tests, 0 assertions, 0 failures, 0 errors, 0 skips i have rails 3.2.21 , ruby 2.0: ruby 2.0.0p598 (2014-11-13 revision 48408) [x86_64-darwin14.1.0] the gcdata patch available latest version of 1.9.3. there no gcdata patch ruby >= 2.0.0. in opinion, have 2 options issue: keep branch of application running patched version of rails 1.9.3, , run tests there. downside results may not 100% accurate , if use ruby 2 syntax branch break. find way test memory usage , created objects

javascript - Jade template code editor -

looking convenient , fast jade http://jade-lang.com template code editor highlighting , block folding. know eclipse not choice. mac , windows great. sublime text 3. download package manager , jade syntax plugin. it's excellent editor. , recommend prepros compiling compile sass if using it. i tried posting links each resource says it's unformatted code so. .

android - how do you clone a project from github into the same project -

in android studio how git clone project github same project? if got question correctly, want check out library , add dependency (gradle based?) project. prefered way checkout separately , built library project. , if have maven can install local repository. the other way (and trying achieve) add submodule of local repository. git submodule add git://repourl.git yoursubmodulefolder then can add library module dependency application module. (you don't have use git submodules, can repo zip , extract project) if put library under libraries folder in project can this. add settings.gradle include ':libraries:yourlibrarymodulename' add build.gradle dependencies { compile project(':libraries:yourlibrarymodulename') } you should able build application submodule please note quick answer, can find more info on both gradle submodules , gradle module dependencies here on stackoverflow. guess should enough point in right direction.

What is the double percentage sign (%%) mean in R -

what double percent ( %% ) used in r? from using it, looks if divides number in front number in of many times can , returns left on value. correct? out of curiosity, when useful? the "arithmetic operators" page (which can via ?"%%" ) says ‘%%’ indicates ‘x mod y’ which helpful if you've done enough programming know referring modular division , i.e. integer-divide x y , return remainder. useful in many, many, many applications. example (from @gavinsimpson in comments), %% useful if running loop , want print kind of progress indicator screen every nth iteration (e.g. use if (i %% 10 != 0) { #do something} every 10th iteration). since %% works floating-point numbers in r, i've dug example if (any(wts %% 1 != 0)) used test of wts values non-integer.

firebreath - Can I get chrome's web page's HWND in Windows? -

i want port web game firebreath ppapi, old implemention is: firebreath plugin pass window's hwnd other process in other process,render , update game i read doc of ppapi, seems there no way hwnd, can 1 give me idea? there couple of important things know this: 1) ppapi supported built-in plugins, such flash. can enable additional ones using command-line flages, it's not viable real use. 2) 1 place can use ppapi in nacl/pnacl plugin, talk using nacl (native client) rather worrying name of api; nacl designed not allow access system apis such hwnd or use hwnd. so short answer "no, there no way want". longer answer want require rewriting needed use opengl es w/ nacl. news same opengl available on mobile platforms, game might able leverage that.

c - Does malloc() have a maximum return value? -

does size_t value of virtual memory pointer returned malloc() have upper boundary? i wondering whether can safely set significant bit of 64 bits pointer indicate not pointer literal integer instead. as @datenwolf's answer states, can't make assumptions how malloc providing memory address. msb may contain important bits overwrite, if attempted use them store meta data. have worked on 32-bit system returned addresses bits set in msb of addresses (not malloc , other system specific memory allocation functions). however, is guaranteed malloc return address suitably aligned system. example, on 32-bit system, you'll 4-byte aligned pointer, , on 64-bit, you'll 8-byte aligned pointer. means guaranteed lower 2 or 3 bits respectively will zero. increase number of guaranteed bits using memalign instead. same effect storing meta data in significant bit. get/set literal, can up/down shift remaining bits. however, wouldn't suggest either method. save hea

ubuntu - docker apt-get multiple gets (can it be reduced?) -

i living in netherlands , each apt-get update , that's why got translations of program dutch. the trouble there many gets needed achieve full list of packages needed updated. how can reduce these many (apparently same) gets? i've looked in docker.list , contains deb https://get.docker.com/ubuntu docker main when run apt-get update , long list of gets of packagelists: ophalen:1 https://get.docker.com docker inrelease genegeerd https://get.docker.com docker inrelease geraakt https://get.docker.com docker release.gpg geraakt https://get.docker.com docker release geraakt https://get.docker.com docker/main amd64 packages geraakt https://get.docker.com docker/main i386 packages ophalen:2 https://get.docker.com docker/main translation-nl_nl ophalen:3 https://get.docker.com docker/main translation-nl [77,0 kb] ophalen:4 https://get.docker.com docker/main translation-en_gb [77,0 kb] ophalen:5 https://get.docker.com docker/main translation-en [77,0 kb] ophalen:6 https://get.d

Reactjs: Prevent re-rendering of relocated nodes -

i have gallery of 160 items being rendered. user able sort , group items in gallery. sorting instantaneous none of items re-rendered. however, when group items react thinks every item needs re-rendered (it doesn't shouldcomponentupdate called) taking few seconds. here basic structure looks like: <div key="gallery"> <div key="item1" ... /> <div key="item2" ... /> <div key="item3" ... /> </div> then after grouping becomes: <div key="gallery"> <div key="group1" .../> <div key="group1-gallery"> <div key="item1" ... /> <div key="item2" ... /> </div> <div key="group2" .../> <div key="group2-gallery"> <div key="item3" ... /> </div> </div> the items not changed @ all. there anyway convince react re-use existing ite

html - Jquery scrolldown css not working -

Image
ok, after fixing dissapear problem ( element disappearing on click ) have new problem that, think, related problem. when click on header link page scrolls down, jquery, right article. function works great. other function changes css of according button on position on page ( scrolltop() ). function works. when clicked button css not change. makes button white link gray "clicked" border arround (done browser). when click anywhere else on screen (to remove "active" button state) button changes color. i not replicate problem jsfiddle ( fiddle ) here images describing problem above: this menu: this when hover menu: this when selected "over ons": and when unselect button: now question is, how can give selected button (image 3) same css unselected button (image 4)? this style text-decoration:none not work. using :active css attribute not work. i cannot seem find solution on internet. missing something? solution thanks drops an

c# - Webbrowser in ASP.Net - accessing DOM of loaded page -

i'm trying screen scrape web page " http://reading.beatthestreet.me/ " type in card number , displays point score - done via ajax (try card number 123456) i trying via webbrowser control in asp.net page. seems load ok bit scrape ajax generated results doesn't work - return blank the class here using system; using system.collections.generic; using system.linq; using system.web; using system.threading; using system.windows.forms; namespace beat_the_street { public class customwebbrowser { protected string _url; protected string _cardnumber; string score = ""; public string getcardscore(string cardnumber) { _url = "http://reading.beatthestreet.me/"; _cardnumber = cardnumber; // webbrowser activex control must run in // single-threaded apartment create thread create // control , generate thumbnail thread thread = new thread(new threadstart(getcardscoreworker)); t

python - Why can't SyntaxError be caught by user code? -

this question has answer here: failed catch syntax error python 2 answers i want catch every program error can display errors in gui program, find i'm not able catch kinds of error syntaxerror , indenterror. for example: import traceback 0 = 0 try: print "start..." v = 3/zero # deliberately no indention, syntaxerror cannot caught except: print "oooooooooooooops" traceback.print_exc() exit(1) print "run ok" the console output is: file "d:\w\personal\chj\python-try\catch-syntaxerror\catch_syntax_err.py", line 8 v = 3/zero # ``syntaxerror: invalid syntax``, cannot catched user ^ syntaxerror: invalid syntax so, know did not catch exception myself. how can catch it? syntaxerror thrown before code run. in particular error handlers haven't been created executed yet. (you not

My facebook app is not showing in timeline manage section -

i've created simple facebook app managing books read, , want app visible in facebook timeline manage section. instance can see other apps in timeline section goodreads , others. how can achieved? this feature while ago, facebook has since removed it. some “legacy” apps implemented feature when available still able use it; new apps can not use more.

java - android bluetoothadapter.startLeScan, filter by UUID -

i want scan ble device startlescan(uuid[] serviceuuids, lescancallback callback) method, have uuid, it's 16-bits value, example, 00000000-0000-1000-8000-00805f9b34fb . how can use uuid in startlescan method, write this, uuid[] uuid = new uuid[1]; uuid[0] = uuid.fromstring("00000000-0000-1000-8000-00805f9b34fb"); mbluetoothadapter.startlescan(uuid, mlescancallback); but can scan nothing. how can resolve problem.

android - Manifest Merger tools:replace failure -

i using library uses own android:theme, , therefore receive following error while building: error:(55, 9) execution failed task ':contacit:processdebugmanifest'. manifest merger failed : attribute application@theme value=(@style/theme.maintheme) androidmanifest.xml:55:9 present @ com.github.florent37:materialviewpager:1.0.3.2:11:18 value=(@style/apptheme) suggestion: add 'tools:replace="android:theme"' element @ androidmanifest.xml:49:5 override i've modified app's androidmanifest.xml follows: <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.example.main" android:versioncode="19" android:versionname="2.5" > ... <application android:name="com.example.application.mainapplication" tools:replace="android:theme" android:allowbackup

jQuery Attach handler for validation -

i need field validation(required field) using jquery. using existing jquery code(3rd party). current scenario: input control name input control phone(required, regex) input control email(required, regex) here passing div id , 3rd party code loop through child elements , validation , returns true if pas else false.(no validation message) but regex have mentioned function validateusingregularexpression() { // construct jquery object out of element changed. var $element = jquery(this); var validatesuccess = false; var value = $element.val(); //do regex validation if returns true set validatesucess = true; triggerresult(validatesuccess, $element); } function triggerresult(validatesuccess, $element) { if (validatesuccess) { $events.trigger('validatorsuccess', [$element]); } else {`enter code here` // if 1 validation fails fails group. me.isvalid = false; var mes

java - Bean discovery problems when using weld-se with Gradle application plugin -

i building gradle-based java se application built on top of hibernate orm of choice. plan use weld-se able use cdi annotations injections of entitymanagers throughout application. based on common hibernateutil helper class found in hibernate documentation, moved towards jpa interfaces , added @produces annotations provide producer methods (i have added empty meta-inf/beans.xml well): package dao; import javax.enterprise.inject.disposes; import javax.enterprise.inject.produces; import javax.persistence.entitymanager; import javax.persistence.entitymanagerfactory; import javax.persistence.persistence; public class hibernateutil { private static final entitymanagerfactory emf = buildentitymanagerfactory(); private static entitymanagerfactory buildentitymanagerfactory() { try { return persistence.createentitymanagerfactory("persistenceunit"); } catch (throwable ex) { system.err.println("initial entitymanagerfact

css - Bootstrap glyphicon shows up but IE11 throws CSS3111 error -

Image
bootstrap glyphicon shows fine ie11 console reports css3111: @font-face encountered unknown error these files: glyphicons-halflings-regular.eot glyphicons-halflings-regular.woff glyphicons-halflings-regular.ttf this bootstrap override in stylesheet (only url paths changed): @font-face { font-family: 'glyphicons halflings'; src: url('../../vendor/bootstrap/fonts/glyphicons-halflings-regular.eot'); src: url('../../vendor/bootstrap/fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../../vendor/bootstrap/fonts/glyphicons-halflings-regular.woff2') format('woff2'), url('../../vendor/bootstrap/fonts/glyphicons-halflings-regular.woff') format('woff'), url('../../vendor/bootstrap/fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../../vendor/bootstrap/fonts/glyphicons-halflings-regular.svg#glyphicons_h

mysql - Error when trying to use aliased column name in where clause -

i have problem sql query. want select records debt amount. amount counted relation 2 tables. this works fine: select `i`.*, (i.amount_netto + (i.amount_netto * i.vat / 100)) - (sum(p.amount_netto)) `debt`, `e`.`name` `user_name`, `e`.`surname` `user_surname`, `c`.`name` `contractor_name` `invoices` `i` inner join `payments` `p` on i.id = p.invoice_id inner join `employees` `e` on i.employee_id = e.id inner join `contractors` `c` on i.contractor_id = c.id group `i`.`id` order `debt` asc but when add clause debt error: unknown column 'debt' in 'where clause' query looks this: select `i`.*, (i.amount_netto + (i.amount_netto * i.vat / 100)) - (sum(p.amount_netto)) `debt`, `e`.`name` `user_name`, `e`.`surname` `user_surname`, `c`.`name` `contractor_name` `invoices` `i` inner join `payments` `p` on i.id = p.invoice_id inner join `employees` `e` on i.employee_id = e.id inner join `contractors` `c` on i.contractor_id = c.id `debt` > 1 group `i`.

c# - Optimistic Concurrency -

i have entity framework project several linked entities. since utilized multiple users @ once i've set rowversion-field entities edited several users @ once. unfortunately optimisticconecurrencyexception every time try save new entity, linked existing entity. store update, insert, or delete statement affected unexpected number of rows (0). entities may have been modified or deleted since entities loaded. see http://go.microsoft.com/fwlink/?linkid=472540 information on understanding , handling optimistic concurrency exceptions. the problem error doesn't give pointers error lies. either underlying model modified in meantime, there validation error on new model or else. the code use add new entity follows: using (ctx = new dbcontext()) { try { ctx.samples.add(model); ctx.savechanges(); } catch (dbupdateconcurrencyexception ex) { logmanager.handleexception(ex.innerexception); } } model model want add database ed