Posts

Showing posts from June, 2011

Javascript - Finding in subarray by value from another array -

i have 2 javascript objects: var classroom = { "number" : "1", "student" : [ { "number" : 1, "items" : [ { "key" : "00000000000000000000001c", "date" : "2016-04-21t17:35:39.997z" } ] }, { "number" : 2, "items" : [ { "key" : "00000000000000000000001d", "date" :"2016-04-21t17:35:39.812z" }, { "key" : "00000000000000000000002n", "date" :"2016-04-21t17:35:40.159z" }, { "key" : "00000000000000000000002Ñ", "date" :"2016-04-21t17:35:42.619z" } ] } ], } and var items = [ { "fields"

sql server - SQL Error of Cannot perform an aggregate function on an expression containing an aggregate or a subquery -

i executing query in sql giving me error "cannot perform aggregate function on expression containing aggregate or sub query." there can me it. stuck. thank here query. select [id] ,[name] ,sum(case when [code] = 1 case when exists(select * [sampletab] [id] = [id]and [code] = 2) case when exists(select * [sampletab] [id] = [id] , [code] = 4) 100 else 100 end else 100 end when [code] = 8 200 when code = 2 100 when code = 4 100 end ) "totl" [test].[dbo].[sampletab] group id , name my data here's version of query should results. select id, name, sum(scorepercode) ( select id, name, case when code = 1 100 when code = 2 50 when code = 4 20 when code = 8 200 end scorepercode [test].[dbo].[sampletab] ) x group id,

Generic fluent Builder in Java -

i'm aware there've been similar questions. haven't seen answer question though. i'll present want simplified code. have complex object, of values generic: public static class someobject<t, s> { public int number; public t singlegeneric; public list<s> listgeneric; public someobject(int number, t singlegeneric, list<s> listgeneric) { this.number = number; this.singlegeneric = singlegeneric; this.listgeneric = listgeneric; } } i'd construct fluent builder syntax. i'd make elegant though. wish worked that: someobject<string, integer> works = new builder() // not generic yet! .withnumber(4) // , here "lifted"; // since it's set on integer type list .withlist(new arraylist<integer>()) // , decision go string type single value // made here: .withtyped("something") // we've gathered type info along way .create();

css - 3-column layout with non-scrolling fluid-width sidebars (jsFiddle) -

i looking create three-column layout left column fixed width , middle , right columns each 50% of remaining width. want left , right columns non-scolling. i have achieved partial success in 2 different ways. the first creates fulfils dynamic columns goal right sidebar scolls page. did fixed position left column , fixed position container take whole page. put right sidebar in second container width set 50%. <section id=leftsidebar> <p> leftsidebar </p> </section> <div id=main> <section id=middle> <article> middle </article> <article> middle </article> <article> middle </article> <article> middle </article> <article> middle </article> <article> middle </article> <article> middle </article> <article> middle </article> <article> middle </article> <

atlassian sourcetree - git - apply a commit on another branch to the working copy -

Image
so have commit has helpful code change, on branch. i apply commit in other branch working copy on current branch (not commit). is possible? how this? thought i'd share related previous question specific working copy: git cherry picking 1 commit branch how add desired commit(s) different branch. git cherry-pick <sha-1>...<sha-1> --no-commit apply change introduced commit(s) @ tip of master branch , create new commit(s) change. the syntax of ... commit range. grab commits start (exclude) last one. if want single commit use single sha-1 read out full git cherry-pick documentation options can use

sqlite - Having trouble saving image to entity field on IOS -

on server have table want on ios sqllite table. my server table has field called data of type image. way populated field wrote c# app converts image byte array , write byte array sql image column. in ios, make soap request wcf service , data table. made sure data received. problem writing received image data entity's binary data field. use following code that. nsstring *key = (nsstring *) [keys objectatindex:i]; // made sure key valid nsdata *data = (nsdata *) [rowdata getvalue:key]; // made sure data retrieved [tblrow setvalue:data forkey:key]; // after calling this, data key nil. portion of image data content /9j/4aaqskzjrgabaqeayabgaad/2wbdaaggbgcgbqghbwcjcqgkdbqndasldbksew8uhrofhh0ahbwgjc4nicisixwckdcpldaxndq0hyc5ptgypc4zndl/2wbdaqkjcqwldbgndrgyirwhmjiymjiymjiymjiymjiymjiymjiymjiymjiymjiymjiymjiymjiymjiymjiymjiymjl/waarcamda2odasiaahebaxeb/8qahwaaaqubaqebaqeaaaaaaaaaaaecawqfbgcicqol/8qatraaagedawieawufbaqaaaf9aqidaaqrbrihmuege1fhbyjxfdkbkaeii0kxwrvs0fakm2jyggkk

javascript - Leaflet toggle buttons only work on the first click -

i have button want use toggle map layer on , off. click once , layer adds map, click again , goes away (and on). right button works on first click , none thereafter. i think has fact it's written if/else statement. condition satisfied, function ends, , that's end of it. looking guidance... how modify code make functional toggle button? my button: <button id="buttona" onclick=="onoff();">button a</button> then, within function $.getjson("mydata.json", function(data) {...}); have following: function onoff(){ currentvalue = document.getelementbyid('onoff').value; } document.getelementbyid("buttona").addeventlistener("click", function(){ if (currentvalue = "off"){ layera.addto(map); document.getelementbyid("onoff").value="on"; } else{ map.removelayer(layera); document.getelementbyid("onoff").value="off&

java - Why doesn't my temperature conversion calculate correctly? -

this question has answer here: simple division in java - bug or feature? 5 answers i trying take temperature in fahrenheit , convert celsius. when call tocelsius() method calculates temperature 0 degrees celsius. here conversion method public temperature tocelsius() { temperature answer = new temperature(); switch(temptype) { case 'c': answer = new temperature(this.temp,'c'); return answer; case 'f': answer = new temperature(((this.temp-32)*(5/9)),'c'); return answer; case 'k': answer = new temperature((this.temp-241.15),'c'); return answer; default: system.out.println("error!"); break; } return answer; } here demo public class tempdemo { public static void main(string[] ar

php - Calling a REST API from an MVC Web Application -

i have mvc php web application needs call rest api. i'm unclear on whether should calling api controller or model? looking @ various resources i'm getting mixed information. assume should model since i'm doing dealing data , passing controller correct? some more details clarify. have full control on rest api i'm in process of building , in php well. api leveraged ios , android companion app built team , few other apps running on proprietary devices. the original plan web app not going leverage api , go straight db cut out overhead, several debates later , i'm leaning toward using api. you should call web api controller . model how data passed controller view . model should have data , no business logic. when response web api, data should put model , passed view . the model , view , controller make mvc pattern. controller responsible putting data in model, passes view. view takes model , displays data, has been told to. there no business lo

Camel app on Liberty - JAXB Marshalling -

i'm running camel application on liberty profile server. i'm taking message queue, unmarshalling, mapping marshalling. working fine i'm getting error jaxbdatabinding method getcontextualnamespacemap not found. think because there older version of jar in server libs don't know why started using it. ibm jar: com.ibm.ws.org.apache.cxf-rt-databinding-jaxb.2.6.2_1.0.12 the issue resolved if switch parent last class loading hacky way fix , not great option. other ideas? i'm thinking feature or other dependency in build may have pulled jar in. so getcontextualnamespacemap available in newer versions of org.apache.cxf-rt-databinding-jaxb jar available in liberty. it might parentlast best option then. (you know how it's documented ( here ). if leads other issues follow-up question. i suppose it's conceivable might able @ whatever packaged within application , try removing set of things , picking them liberty runtime, avoid running in paren

Unterminated string literal for db data in javascript -

here code output passing data console: console.log(' fun, friendly, * new private party room stage, 70" satellite tv, comfortable lounge seating exciting bachelor parties, unique surprise birthday parties, divorce, retirement....you own it! party includes: 90 minutes open bar, dedicated waitress, complimentary dance of choice guest of honor, '.trim()); my result is: syntaxerror: unterminated string literal . i understand issue breaking new lines in javascript , need use \ dynamic data follows: var b = '<xsl:value-of select="./description"/>'; <--- output above gets assigned here so, how resolve issue? the application not outputting text on log. showing blank should replace \n \ ? not quite sure of solution. the easy solution escape newlines. want keep \n , in string literal form. let me give example... you have "\n", literal newline. want "\n", first slash escapes second. you can't repl

gulp karma issue browser never start -

i have node 4.4.3 npm 3.8.6 protractor: 3.2.2 installed globally gulp 3.9.1 installed globally , locally link package.json "devdependencies": { "connect": "3.4.1", "gulp-load-plugins": "1.2.0", "gulp-protractor": "2.1.0", "serve-static": "1.10.2", "karma":"0.13.22", "karma-chrome-launcher": "0.2.3", "karma-jasmine": "0.3.8" } gulpfile.js var server = require('karma').server; gulp.task('test3', function (done) { server.start({ configfile: __dirname + '/karma.conf.js' }, done); }); when run task feedback [11:10:03] starting 'test3'... 21 04 2016 11:10:04.008:warn [karma]: no captured browser, open http://localhost:9876/ 21 04 2016 11:10:04.016:info [karma]: karma v0.13.22 server started @ http://localhost:9876/

spring - Understanding REST java server with database -

goal: set java server maintains high-score list java client using rest. programming experience: beginner closer intermediate spectrum hope. i have been told last night rest practice goal. have been reading morning afternoon , getting more confused more read, figured ask few basic questions ideally me studying in right direction. have run spring hello world success , understanding ( http://spring.io/guides/gs/rest-service/ ) not sure next step in learning process. i know need save high-scores , possibly other information database not sure type of database, how create it, , how store , retrieve data it. i wondering client side implementation, how make client send , receive data , server. i found spatial learner , learn best through examples, relative code examples helpful. book recommendations appreciated. when decided learn javafx, here recommended pro javafx 8 book apress , found reference. thank taking time novice out, have start somewhere. cheers 1 . database

c# - Empty Path Name Is Not Legal -

this question has answer here: empty path name not legal 2 answers so i'm trying compile asteroids game. it's working, files in place etc etc... the issue comes when hits code. filestream myfilestream = new filestream(filename, filemode.open, fileaccess.read, fileshare.read); string mytempfile = @"f:\documents\junior school\computer programming (java 1)\asteroidswithsound\asteroidswithsound\temp\mysound" + i.tostring() + ".wav"; it gives me error/warning, not sure called says argumentexception unhandled. empty path name not legal. i've read online chunks of code causing issue never find resolution. awesome. edit: filename defined in chunk. string filename = this.player.filename; this.player.open(""); file.delete(filename); this.isready = true; that suggests filename variable refers empty string. you

MATLAB: periodogram Showing Error "Invalid Value for Data" for Certain Input -

i trying use command periodogram in matlab 15a. my periodogram code: periodogram(ts_outside) when replace ts_outside ts_inside , working. above code, showing following set of errors (please note errors in in-built files of matlab): error using dspdata/validatedata (line 14) invalid value data. data must vector or matrix containing real, positive values. error in dspdata.abstractps/validatedata (line 8) dspdata.validatedata(this,data); error in dspdata.abstractfreqresp/initialize>validate_data (line 77) validatedata(this, data); error in dspdata.abstractfreqresp/initialize (line 23) [data, datalen] = validate_data(this, data); error in dspdata.psd (line 82) initialize(this,varargin{:}); error in periodogram (line 197) hdspdata = dspdata.psd(pxx,w{:},'spectrumtype',options.range); i have checked imaginary values in ts_outside , using command imag . following result of that: any(imag(ts_outside)) ans = 0 as can see, imaginary part has

git - Use Jupyter together with file share or mounted folder -

how can synchronize notebooks between jupyter service , other services (google cloud storage or git repository)? some background on question: currently on way moving google's datalab own container. motivation have more control on data region (datalab beta offered in us) , packages want use current tensorflow version. based on ideas google ( see github ), build own docker image , run on kubernetes cluster in google container engine. gcp package can installed i have explained . google uses node.js server sync git datalab instance - not able running self-deployed container in eu. second try gcsfuse driver . 1 not work non-priviliged containers of kubernetes v1.0 , google container engine. full stop. my docker file (based on google's gce datalab image): from debian:jessie # setup os , core packages run apt-get clean run echo "deb-src http://ftp.be.debian.org/debian testing main" >> /etc/apt/sources.list && \ apt-get update -y && \

java - DISA STIG Comparison -

is there automated way compare old stigs new stigs? example, if i'm using java 7 , newer version java 8 comes out, want compare 2 see what's changed. i'm doing manually , it's painful. there automated way of doing this? i know old, figured i'd answer anyway. there saas tool called vaulted ( https://vaulted.io ) released allows compare disa stigs. contains library of current stigs , srgs, , allows @ versions of stigs/srgs , compare them. need free account it, if you're still interested might out.

php - Display product list from same selected subcategory for this product on product detail page -

Image
i struggling last 2 days display product list (only product name link) @ product detail page have same subcategory detailed product has. in detail, have 2 level category:please take @ image: now suppose when user goes prodcut "zest" item detail page can see "zest" , "exotic" items list. not other items subcategory (e.g. indonesian... blue border color). here aam able category id of "pods" (its main category) cannot id of "house blend(2)" subcategory. can please these product list? in advance. to subcategories of category: $children = mage::getmodel('catalog/category')->getcategories(50); $searchincategories = ''; foreach ($children $category) { //add , after every id if (strlen($searchincategories) > 0) $searchincategories .= ','; $searchincategories .= $category->getid(); } where 50 category id, in case pods id. now need alter search query products: -&g

c++ - Compiling OpenCV on Raspberry Pi 2 -

i compiling opencv on raspberry 2 , jammed on step, [ 18%] building cxx object modules/highgui/cmakefiles/opencv_highgui.dir/src/cap_ffmpeg.cpp.o with returned lot of error, take 2 of begining, other of them same different on { codec_id_h264, mktag('h', '2', '6', '4') }, in file included /home/pi/opencv/modules/highgui/src/cap_ffmpeg_impl.hpp:60:0, /home/pi/opencv/modules/highgui/src/cap_ffmpeg.cpp:45: /home/pi/opencv/modules/highgui/src/ffmpeg_codecs.hpp:104:7: error: 'codec_id_h264' not declared in scope { codec_id_h264, mktag('h', '2', '6', '4') }, ^ /home/pi/opencv/modules/highgui/src/ffmpeg_codecs.hpp:105:7: error: 'codec_id_h264' not declared in scope { codec_id_h264, mktag('h', '2', '6', '4') }, ^ and final part about /home/pi/opencv/modules/highgui/src/cap_ffmpeg_impl.hpp: in member function 'double

c# - A file or folder with the name already exists when unit test project added -

large edit make more appropriate "vs has bug" complaint. if add unit test project vs2012 solution, can't add item @ project in solution. vs complains file or folder name, whatever name choose, exists. cannot add existing items projects. if remove unit test project, problem goes away. know dumb way set solution trigger problem? since unable reproduce in vs2013, , vs2012 totally old now, i'll "acceptable" solution (hopefully not one) upgrade. assistance.

apache - How to exclude a URL from HTTPS -

i have tried different links see if works, doesn't seems work. have configured https on redhat el6. wanted have exception 1 of ip. i wanted have https enabled except 1 ip 192.168.1.1. when access url ip 192.168.1.1, should redirected or rewritten http://cab.abc.com , not https://cab.abc.com snip of /etc/httpd/conf/httpd.conf : <virtualhost *:80> documentroot /opt/app/cr/public servername cab.abc.com rewriteengine on rewritelog /var/tmp/rewrite.log rewriteloglevel 5 rewritecond %{remote_addr} ^192\.168\.1\.1 # rewriterule .* http://cab.abc.com%{request_uri} [r] # rewriterule ^/(.*) http://cab.abc.com%{request_uri} [r] rewriterule .* http://cab.abc.com [l] rewritecond %{the_request} ^(.*) rewriterule .* https://cab.abc.com%{request_uri} [r] # proxypass / https://cab.abc.com/ # proxypassreverse / https://cab.abc.com/ </virtualhost> i have tried multiple options , checked rewrite.log file : 192.1681.1 -

python - How to calculate the sum of numbers divisible by 3 and 5 using lambda's range, map, filter and reduce -

i need calculating sum of numbers divisible 3 or 5 within given range. far i've gotten this; print filter(reduce(map(lambda x, y: x % 3 == 0 or y % 5 == 0, x + y, range(30)))) which throws error traceback (most recent call last): file "<pyshell#65>", line 1, in <module> print filter(reduce(map(lambda x, y: x % 3 == 0 or y % 5 == 0, x + y, range(30)))) nameerror: name 'x' not defined i don't think i'm close finding solution or on right track, if point me in direction great, cheers. after defining a , b b > a : reduce(lambda x, y: x + y, filter(lambda x: x % 3 == 0 or x % 5 == 0, range(a, b))) in case: reduce(lambda x, y: x + y, filter(lambda x: x % 3 == 0 or x % 5 == 0, range(30))) or without reduce , filter : sum(x x in range(30) if x % 3 == 0 or x % 5 == 0) if range of values large (not 30 ) use xrange if on python 2 returns generator instead of list. if want include map function can use identity func

javascript - Determine whether an event is invoked by .trigger() -

is there way determine whether or not .change function below being called jquery .trigger ? $('input[name=transactiontype]').change(function () { //clear out values $('input:text').val(''); $('input:text').text(''); //display input fields var radiovalue = $(this); $('#rightdiv').children().each(function () { if (radiovalue.attr('id') == $(this).attr('id')) { $(this).show(); } else { $(this).hide(); } }); }).filter(':checked').trigger('change'); you can use event.istrigger $('input[name=transactiontype]').change(function (e) { if(e.istrigger){ //this triggered using trigger('change') or .change() etc } } demo this flag set when triggered mentioned above otherwise may undefined. not able find documentation though. but see

class - Organize instances of Classes C# -

i'm new c# , object oriented programming (mostly used c , assembly). question: there standard way of organizing instances of of custom class? have created class called "products" in separate class file , want instances of products in 1 location future programmer can jump straight code, locate "products" , add new ones in same location. wouldn't basic initiators like: products newproduct = new product(); but member data , such: products newproduct = new product(); newproduct.models.add("model#1"); newproduct.revisions.add("rev a"); which 30+ lines long. didn't want clutter main code. not sure if there clean way this. in advance.

html - Removing space between vertical div -

<div class="flex-33"> <div class="menu-container"> <img class="menu-image" src="img/bocadillobody.png" alt="sandwitch"> <div class="menu-description"> <h4>sandwitch</h4> <p>powder marshmallow marshmallow brownie carrot cake candy bonbon. sweet sugar plum gummies caramels tart carrot cake tiramisu cheesecake. cheesecake biscuit jelly beans. jelly-o icing chocolate macaroon. </p> </div> </div> </div> can 1 please me eliminate white space between 2 divs img , .menu-description please? i reckon in last 3 hrs tried explained here , had partial luck, white-space disappeared, reappeared on changing browser width . because img inline level element, set img display:block became block level therefore whitespace removed. .flex-33 div { border: red solid 1px } img { displ

haskell - react to SIGTERM with yesod application -

when start yesod application, create connection rabbitmq server store in app datatype access during requests. when deploy new version of app or restart server, want gracefully close connection. along lines of: import system.posix.signals(sigterm, installhandler, handler(..)) appmain :: io () appmain = settings <- loadappsettingsargs [configsettingsymlvalue] useenv foundation <- makefoundation settings app <- makeapplication foundation --install shutdown handler here installhandler sigterm (catch (closeconnection (rabbitmqconn app))) nothing runsettings (warpsettings foundation) app however if process won't exit @ all(and heroku send sigkill eventually. import system.posix.signals(sigterm, installhandler, handler(..)) import system.exit(exitsuccess) appmain :: io () appmain = settings <- loadappsettingsargs [configsettingsymlvalue] useenv foundation <- makefoundation settings app <- makeapplication foundation --i

C++ Binary Search Tree Insertion Algorithm -

i trying finish c++ project have insert array of integers binary search tree. have use particular insertion algorithm: insert(t, z) 1 y = nil 2 x = t.root 3 while x != nil 4 y = x 5 if z.key < x.key 6 x = x.left 7 else x = x.right 8 z.p = y 9 if y == nil 10 t.root = z 11 else if z.key < y.key 12 y.left = z 13 else y.right = z here code far: main.cpp #include <iostream> #include "binarytree.h" using namespace std; int main() { binarytree tree; int array [10] = {30, 10, 45, 38, 20, 50, 25, 33, 8, 12}; (int = 0; < 10; i++) { tree.add(array[i]); } tree.inordertreewalk(); return 0; } void binarytree::insert(node *&t, node *&z) { node *y = nullptr; y = new node; y->key = 0; y->left = y->right = y->parent = nullptr; node *x = t; while (x != nullptr) { y = x; if (z->key < x->key) x = x->left;

ios8 - How can I binding an object to JS when using the WKWebview -

i met problem. i replaced uiwebview wkwebview ,but how can pass oc object js. can object conform jscontext protocol? before -(void)webviewdidfinishload:(uiwebview *)webview { [self.webview.scrollview.mj_header endrefreshing]; _jscontext = [webview valueforkeypath:@"documentview.webview.mainframe.javascriptcontext"]; _jscontext.exceptionhandler = ^(jscontext *context, jsvalue *exceptionvalue) { context.exception = exceptionvalue; nslog(@"%@", exceptionvalue); }; _jscontext[@"token"] = self.token; [self.webview stringbyevaluatingjavascriptfromstring:@"getuser()"]; } now how can inject token js

jquery - Bootstrap horizontal drop down menu with sliding animation -

so regular bootstrap drop down menu, want customize it'd have sliding animation , display horizontally, both @ same time. found solution the former : // add slidedown animation dropdown $('.dropdown').on('show.bs.dropdown', function(e){ $(this).find('.dropdown-menu').first().stop(true, true).slidedown(); }); // add slideup animation dropdown $('.dropdown').on('hide.bs.dropdown', function(e){ $(this).find('.dropdown-menu').first().stop(true, true).slideup(); }); and the latter : .dropdown-menu > li{ display: inline-block; float:left; } .open> ul { display: inline-flex !important; } but when tried combine both solutions things went wrong . in milliseconds animation happens when opening drawer, height of menu larger should be, , likewise width of dropdown menu shrinks when closing drawer. seems should solved after overriding height somewhere, i'm unsure class exactly. possible have both these features o

core data - Swift NSManagedObjects do not support mutableSetValueForKey -

i practicing tute task on swift coredata. reminder app, have these entities in core data file: and error in viewdidload() function: var reminderlist: nsmutablearray //in viewdidload() { super.viewdidload() //fetchrequest code blocks self.reminderlist = nsmutablearray(array: (currentreminders?.members?.allobjects) as! [reminder]) i got error message: 'nsmanagedobjects of entity 'reminderlist' not support -mutablesetvalueforkey: property 'members'' , app crashed. this problem because of mistake in setting relationship between entities in coredata. check see if constraints set to-one/many.

php - Laravel - Foreach loop - Show a specific message for types of result -

so have messages table messages. want pinned messages @ top , normal ones follow after. have been able orderby() method in query. however, want display specific messages pinned messages. have header @ top of pinned messages , header @ top of normal messages let users know pinned , normal messages there. example: my query: $rows = messages::where('active', true)->orderby('pinned', 'desc')->get(); my view @foreach ($rows $row) {{ $row->message }} @endforeach what see message text 3 message text 1 message text 2 i have few messages "pinned" in column in database. want pinned ones show @ top descriptions. this: pinned ---------- message text 3 ---------- normal ---------- message text 1 message text 2 i have tried orderby() , it's working pretty good, in terms of ordering pinned normal, can't show "pinned" , "normal" message. how can this? try (change 1/0 true/false or whatever

windows - How to check python version using C++? -

i want use c ++ confirm local windows system python version installed, not know how determine? if python directory has been added path environment variable, can _popen python --version argument, , parse out version number standard output (which e.g. python 2.7.6 ). another option use regedit see if version appears somewhere in registry can read from. lots of existing s.o. q&a on how read registry values.... if stuck implementing either option, post code , specific problem.

sas - Split a dataset into two new dataset based on percentage of split -

i want split large dataset randomly 2 new dataset in ratio of 70% - 30%. basically need allocate 70% of random values large dataset newdataset1 , 30% of random values largedataset newdataset2. can please sas code me achieve it. a dummy code help.. proc sql or sas statement. work me. for complex sample design (like stratified randomization, e. g.) proc surveyselect way go, @keith said. simple random splitting rantbl -function trick: data newdataset1 newdataset2; set have; flag=rantbl(-1, 0.7, 0.3); if flag=1 output newdataset1; else output newdataset2; run;

php - Course Completion is stuck at pending status how ever the student passed all the activites and Quizzes in Moodle -

after creating course , checking completion tracking settings correctly modified in course settings , in activity settings. , after student passed activities , quizzes, course completion status still pending , not completed. after adding self completion block, same issue, course stuck @ pending state only. course completion updated via system cron process. make sure cron process running or trigger manually via [site]/admin/cron.php (if web running enabled in site settings) or on commandline via: php [site path]/admin/cli/cron.php

java - Branch And Bound not working in OptaPlanner -

i have directed acyclic graph, arcs entities , weights associated each arc planningvariables. use: @valuerangeprovider(id = "bufferrange") public countablevaluerange<integer> getdelayrange() { return valuerangefactory.createintvaluerange(1, 1000); } to assign values variables. also, i've come across issue: exhaustive search in optaplanner not work on simple example , solved setting variables int integer , checking null values in score calculation. now problem solver seems not backtraking when assigning values. i've used print check values being attributed each arc. in beginning of solving process can see values being set different arcs. after time attributions solver stucks in assigning values same arc. checking prints see attributions going 1 1000 , starting again. since values domain tested 1 time, why solver not backtrack instead of assigning same values again? i tested <nodeexplorationtype> options , created class use <entitysor

html - Font displays different in Chrome and in Firefox -

Image
i bit new when comes web development. i have created menu buttons width different depending on browser (firefox or chrome) in firefox, can see end of last button of menu aligned div below. can appreciate width of button 136.5px however, in chrome fonts bolder , menu end pushed bit forward. here, width of button 139.281px this site, menu on top: http://www.metagame.gg/champions/ this html , css code menu .navigator { margin: 0; padding: 0; display: flex; padding-left: 39px; background: #8c9baa; } .navigator li { display: inline-block; position: relative; z-index:100; } .navigator li { text-decoration: none; font-size: 15px; display: block; line-height: 50px; padding: 2px 27.75px 0px; -webkit-transition: 0.2s ease-in-out 0s; -moz-transition: 0.2s ease-in-out 0s; -o-transition: 0.2s ease-in-out 0s; -ms-transition: 0.2s ease-in-out 0s; transition: 0.2s ease-in-out 0s; } .navigator li a:hover, .navi

css nth-child selector formula -

i have list of html items , need select every 3 on 3. (1,2,3,7,8,9,13,14,15 e.t.c) please suggest me, possible using css nth-child selector , formula should in parentheses? or way javascript? hooray! i've found solution! answers! version is: .item:nth-child(1+6n), .item:nth-child(2+6n), .item:nth-child(3+6n) { /* styles */ }

core data - NSPredicate and KVC collection operators -

assume have core data class employer 1-n relationship called employees. this employees relationship maps nsset . far good. i want create nsfetchrequest of employer predicate requieres employees > 0 . how can create predicate? i tried "employees.@count" , seems consider whole thing keypath. you got syntax backwards: @count.employees

Can react-native be used with Java and Tomcat, without node? -

my team familiar java , don't have time learn "nodejs" , related "express" framework. want use react-native develop application. i'm frustrated, since don't know whether can use react-native java , apache tomcat backend. if possible, should make work? if not, how make possible? using node request dispatcher? any ideas appreciated! sure can! react native backend-agnostic technology. write backend in way want , expose api can consumed application! for communication backend can use "fetch", "websocket" or "xmlhttprequest". can find more information , examples in official documentation: https://facebook.github.io/react-native/docs/network.html

Matlab recursion -

need little understanding happening in function particularly line 7 [fnm1,fnm2] = fibrecurmemo(n-1); don't understand how new variable can declared here in array. example of happening appreciated. function [fn,fnm1] = fibrecurmemo(n) % computes fibonacci number, f(n), using memoized recursion if n <= 2 fn = 1; fnm1 = 1; else [fnm1,fnm2] = fibrecurmemo(n-1); fn = fnm1 + fnm2; end end say start with: fibrecurmemo(3) %// n 3 the else statements run (since n > 2 ): [fnm1,fnm2] = fibrecurmemo(2); %//statement 1 fn = fnm1 + fnm2; %//statement 2 before statement 2 can run, fibrecurmemo(2) must first run. the if statements in fibrecurmemo(2) run (since n <= 2 ): fn = 1; fnm1 = 1; as result, fibrecurmemo(2) returns 1, 1 . contininuing statement 1 above, [1,1] = fibrecurmemo(2); %//statement 1 fn = 1 + 1; %//statement 2 finally, [2, 1] = fibrecurmemo(3);

angular - Auth0 API Request -

i'm trying make patch request auth0 api endpoint, myaccount.auth0.com/api/v2/users/:id . i've set headers application/json , still following error: _body: "{"statuscode":400,"error":"bad request","message":"invalid request payload json format"}" the request made looks this: headers.append('content-type', 'application/json'); var data: = { "app_metadata": { "ward": "99999" } }; return this._http.patch('https://pjlamb12.auth0.com/api/v2/users/auth0|571844c894efdc0a5b6a4144', data, {headers: headers}).map(res => res.json()); i matched data i'm sending docs shows here . why getting error when posting json object docs show? missing?

ruby - Searching webpage with regex -

i'd search through webpage sentences including 'small business' , , same every link on page, 3 or 4 layers deep. my attempt this: def get_sentences sentences = [] doc = nokogiri::html(open("http://www.brampton.ca/en/business/pages/top-links.aspx")) @sentences = doc.search(/[^.]*small business[^.]*\./i) links = doc.search('a[href]').select{ |n| n['href'][/\.html$/] }.map{ |n| n['href'] }) doc1 = links.each { |x| nokogiri::html(open(x)) } @sentences << doc1.search(/[^.]*small business[^.]*\./ig) links1 = links.each { |x| x.search('a[href]').select{ |n| n['href'][/\.html$/] }.map{ |n| n['href'] } doc2 = links1.each { |x| nokogiri::html(open(x)) } @sentences << doc2.search(/[^.]*small business[^.]*\./ig) links2 = links1.each { |x| x.search('a[href]').select{ |n| n['href'][/\.html$/] }.map{ |n| n['href'] }

c# - Why would I not use SqlBulkCopy.EnableStreaming? -

the documentation says uses less memory, , ad hoc performance tests show faster. why ever choose not enable streaming? reference: sqlbulkcopy.enablestreaming property

php - Unable to connect to gmail smtp using zend -

i trying send email using zend smtp. i have configured zend , credential of google. when try send mail getting error. a connection attempt failed because connected party did not respond after period of time, or established connection failed because connected host has failed respond. i not sure mistake did. can 1 me out. code. indexcontroller.php public function indexaction() { $mail = new zend_mail(); $mail->addto('chaitanya5a2@gmail.com', 'chaitanya kanuri') ->setfrom('chaitanya@gmail.com', 'myself') ->setsubject('my subject') ->setbodytext('email body') ->send(); } bootstrap.php class bootstrap extends zend_application_bootstrap_bootstrap { protected function _initdefaultemailtransport() { $emailconfig = $this->getoption('email'); $smtphost = $emailconfig[&#

Mysql : Match Against query -

due bigdata want use match against in place of like. column full indexed. alternate of query, in match against. mysql query is: select count(*) keywords sb_keyword 'a%' is query is? select count(*) keywords sb_keyword 'a%' that should benefit index(sb_keyword) . fulltext index not practical query, either stands or using where match(sb_keyword) against(+a* in boolean mode) . it take time walk through values starting count them. index suggested helps because , index (usually) smaller entire dataset due having fewer 'columns'.

mysql - SQL: using UNIQUE for column pokemon_master_id -

edited: recognize of might wonder why have 2 'id' values in sql code. have addressed why in particular case seems needed in comment below question. given following sql code creating table pokemon_users: create table pokemon_users ( user_id bigint not null auto_increment, pokemon_master_id bigint not null unique, message varchar(255), primary key (user_id) ) question 1: would index created column pokemon_master_id? question 2: if so, difference between index created primary key (user_id), , pokemon_master_id index? question 1 : yes. unique index. question 2 : primary key user_id unique index. difference can have 1 primary key many unique indexes on table.

How to sum up all the employee salaries and update it to one attribute in the array embedded doc in mongodb -

i want sum emp_salary = (9000)2000+3000+4000 , i'm trying update value 9000 total_employee_salary attribute.how can in mongo shell.can please me out regarding ... { "_id" : objectid("571898dbc000041fe0b921eb"), "organization" : "abc", "total_employees" : 10, "total_employees_salary" : 0, "employees" : [ { "emp_name" : "vijay", "emp_salary" : 2000, }, { "emp_name" : "vishnu", "emp_salary" : 3000, }, { "emp_name" : "vishal", "emp_salary" : 4000, } ] } if doing in bulk collection, best way iterate .bulkwrite() write back:

c# - UDP server fails to respond multiple request. -

i using functionality , developed udp server access request multiple device simultaneously .my server code handle request , process request using business logic sql database , response device received.and whole process work on wifi network.this working when there approx 15-20 device when device increase (50-60) fail response.can 1 tell me issue.

java - Hibernate - HibernateTemplete saveOrUpdate Vs saveOrUpdateAll -

in hibernatetemplete class, why saveorupdate provide api of signature saveorupdate(entityname, entity) . saveorupdateall has saveorupdateall(entities) ? as hibernate allows 1 class multiple entities, how can save collection of objects of specified entity? for ref.: hibernatetemplate documentation

orientdb Invalid keyword 'EXPAND' Command -

i on orientdb2.1.0 , getting particular error fatal error: uncaught exception 'phporient\exceptions\phporientexception' message 'com.orientechnologies.orient.core.sql.ocommandsqlparsingexception: error on parsing command @ position #354: invalid keyword 'expand' command: select *, count(@rid) mutual from( select expand(inv()) from( select expand(oute('follows')) from( select expand(out('follows')) #12:0 ) ) ) @rid not in( select expand(out('follows', 'dismissed')) #12:0 ) , @rid <> #12:0 group @rid order mutual desc skip 0 limit 10 how resolve ?

java - JtextEditorPane - How to prevent copy and paste from wrapping text in html paragraph tags? -

i have: htmldocument document = new htmldocument(); jtextpane htmleditorpane = new jtextpane(document) htmleditorpane.setcontenttype("text/html"); i select text in middle of sentence , call (wrapped in appropriate actionlisteners): htmleditorpane.copy(); htmleditorpane.paste(); for whatever reason whenever text copy , pasted wrapped in <p> tags. how can keep formatting <p> tags seem added? use getdefaultrootelement() , investigate children of root. there should head , body. go deeper , check children of children. you can use tool check document's , view's structure.

symfony - Manually editing and deleting an entity - Symfony2 -

how manually edit , delete entity in symfony2? i creates class, how edit everything? i'm guessing can't change php class file. so files create when use automatic entity generator , there automated-edit command? use yaml. i know bundles there 3 files automated console command creates/changes, can't see info how entities. i use automation save time, still know being done etc. modify php code ( entities code ) run php app/console doctrine:generate:entities bundlename:entityname you may want update db running php app/console doctrine:schema:update --force