Posts

Showing posts from June, 2012

node.js - Express.get is getting variable name instead of it's value from AngularJS ui-router -

as mention in title, when send param url using ui-router, , try use express.get(url), :param name instead of it's value. here code: angularjs ui-router state: .state('post', { url: '/blog/:postid', templateurl: 'app/views/post.html', controller: 'postctrl' }) angularjs http request $http.get('/blog/:postid').success(function(data) { console.log(data); $scope.singlepost = data; }).catch(function(error) { console.log(err); }); html ui-router url <h1><a ui-sref="post({ postid: post._id })">{{ post.title }}</a></h1> express.get() method app.get('/blog/:id', function(req, res) { post.findbyid(req.params.id, function(err, singlepost){ console.log(singlepost); if (err) { console.log(err); } else { res.json(singlepost); } }); }); i following error in console { [casterror: cast objectid failed

ASP.net Page session timeout not working -

i having strange issue, no matter not stop page timing out. here scenario have couple of pages lots of data, client selects check boxes, select values various drop downs etc. times clients spend more 30 minutes selecting/setting values. when click on submit page timeouts , takes them login page. when login in set values gone. frustrating. 1 think selecting drop downs, entering data text boxes etc. considered doing activity on page should keep session alive. doesn't seem case. have tried increasing timeout value out success. here code web.config <authentication mode="forms"> <forms loginurl="~/public/login.aspx" slidingexpiration="true" timeout="200" protection="all" name="sampleapp"/> </authentication> <sessionstate mode="inproc" cookieless="false" timeout="200"/> <httpruntime maxrequestlength="204800" executiontimeout="

google app engine - Channel API overkill? -

hi using channel api project. client signage player receives data app engine server when user changes media content. appengine sends data client ones or twice day. think channel api on kill this? other alternatives? overall, i'd think not. how many clients connected? per https://cloud.google.com/appengine/docs/quotas?hl=en#channel free quota 200 channel-hours/day, if have no more 8 clients connected you'll within free quota -- no "overkill". even beyond that, per https://cloud.google.com/appengine/pricing , there's "no additional charge" beyond computational resources keeping channel open entails -- don't have exact numbers don't think resources "overkill" compared alternatives such reasonably frequent polling clients.

python - Trying to assign an str.find return to a variable -

i want assign str.find() return variable besides str.find, i'm not sure how go doing that. you use = assign it. mystr = '123.456' dotpos = mystr.find('.') now variable dotpos contain 3 .

angular - Angular2 Recursive Templates in javascript -

i have been trying follow this tutorial create nested tree view. tutorial in typescript while trying similar thing in javascript angular2. in typescript code, tree-view component looks so: import {component, input} 'angular2/core'; import {directory} './directory'; @component({ selector: 'tree-view', templateurl: './components/tree-view/tree-view.html', directives: [treeview] }) export class treeview { @input() directories: array<directory>; } in javascript should convert to: treeview = ng.core .component({ selector: 'tree-view', templateurl: './components/tree-view/tree-view.html', directives: [treeview], inputs: ['directory'], }) .class({ constructor: function() { }, }); however, javascript throws following error: exception: unexpected directive value 'undefined' on view of component 'function () {' i believe it's because i

r - ggplot2 positive/negative plot not rendering cleanly -

Image
i'm trying replicate top bottom plot example here it's not rendering correctly (the purple series has +ve , -ve values , green negative) leaving messy artifacts. i'm struggling create toy example replicates issue i'm hoping can despite lack of data my code is: negatives <- result[result$value < 0,] positives <- result[result$value >= 0,] ggplot() + geom_area(data = negatives, aes(x = datetime, y = value, fill=variable)) + geom_area(data = positives, aes(x = datetime, y = value, fill=variable)) the structure of data is: dput(droplevels(head(result))) structure( list( datetime = structure(c(1421751900, 1421751900, 1421752200, 1421752200, 1421752500, 1421752500), class = c("posixct", "posixt"), tzone = ""), variable = structure(c(1l, 2l, 1l, 2l, 1l, 2l), .label = c("v-s-mnsp1", "vic1-nsw1"), class = "factor"), value = c(9, 80.106180098, 9, 77.719632578, 9, 84.158868934

wifi - How do use the AdaFruit CC3000 library to send a simple HTTP Post of my Uno JSON sensor data to Bluemix (node red)? -

i clueless , after week of racking brains. background : out of memory on working arduino uno weather station , flawless internet connectivity using sample wifi sketches cc3000 wifi shield. mqtt samples work great well, but! can't fit mqtt client need bare bones. thinking http post bare bones based on advice received in forums. i can't figure out how send http post using adafruit cc3000 library bluemix node red app , display 300 or character json formatted string want send every 5 minutes. want strings display in node red debug area. absolutely clueless!!! this http code (cc3000 webclient sample) out adafruit way works , shown below know have work with. don't understand credentials use either relative bluemix. confusing new of being hardware product development engineer of life. loving learning experience though! essentially want convert post , pull in string on bluemix using node red. please helppp!!!! here basic functional code on uno using adafruit site test.

javascript - $http is undefined in service despite injecting it -

i trying create service provide js api integration between angular app , server talks to. however, whenever try use $http in service undefined. the service instantiated $scope.broker in main controller: function mainctrl($scope, $http) { $scope.broker = new broker(); ... angular .module('inspinia') .controller('mainctrl', ['$scope','$http',mainctrl]) the service used in controller attached same module: function locations($scope, $http){ console.log($scope.broker.ping); $scope.broker.ping(); angular.module('sentry.locations', []) .controller('locations', ['$scope','$http', locations]); service definition: function broker($http) { var baseurl = 'localhost:8000'; var broker = {}; broker.ping = function() { console.log(this); $http({ method: 'get', url: baseurl + '/hello' }) }; console.log($http); retur

c++ - gamma or log gamma function in C or C -

i seeking c or c++ version of gamma , log gamma functions. are there code pieces or libraries recommended? if possible, want know principle of implementations. thank you!!! if can't use c++11: gnu gsl has gamma function ever need: http://www.gnu.org/software/gsl/manual/html_node/gamma-functions.html#index-gsl_005fsf_005flngamma-583 or can have @ boost's math special functions: http://www.boost.org/doc/libs/1_53_0/libs/math/doc/sf_and_dist/html/math_toolkit/special/sf_gamma/lgamma.html

XSLT to remove duplicates completely -

i know there solutions plenty remove duplicates, 1 different. need remove element output if duplicate. input: <sanctionlist> <row> <personid>1000628</personid> <personid>1000634</personid> <personid>1113918</personid> <personid>1133507</personid> <personid>1113918</personid> </row> </sanctionlist> output expected: <sanctionlist> <row> <personid>1000628</personid> <personid>1000634</personid> <personid>1133507</personid> </row> </sanctionlist> here tried parser returns 1 each of groups. shouldnt return 2 personid 1113918 since appears twice in list? <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:xs="http://www.w3.org/2001/xmlschema" vers

visual studio - Resharper 10 autocomplete takes a fraction of a second to display after I finish typing - how do I make it instant? -

say example assigning value boolean variable. start typing 'fa' , hit return, , visual studio fills out 'false' - not need wait intellisense popup window. in resharper, autocomplete suggestions window takes split second appear. can't hit 'return' after type 'fa'. inserts new line. it doesn't sound huge issue coming built in intellisense annoying. is there way make 'return' function default intellisense?

java - Endless loop of redirection to changePassword page in spring security -

i assigned task of implementing force reset password page our application? new spring , spring security, have implemented force reset logic using custom filter. changepassword page caught in endless loop, dont know why? securitycontext.xml <http auto-config='true' use-expressions="true" access-decision-manager-ref="webaccessdecisionmanager"> <intercept-url pattern="/**" access="isauthenticated()" /> <intercept-url pattern="/changepassword.*" access="hasrole('role_changepassword')"/> <form-login always-use-default-target="true" login-page="/login.jsp" default-target-url="/home_director.do" authentication-failure-url="/login.jsp?error=authfail" authentication-success-handler-ref="loginsucesshandler" /> <logout logout-url="/logout&qu

c# - IIS did not load the latest changes in Visual Studio 2015 -

when run project, web page loads when tried make changes cshtml files, press refresh, , page did not load changes. have stop iis express , run again make changes happen, annoying , inefficient. microsoft visual studio 2015 windows 7 32bit edit: temporary solution have discovered: save (even without changes) applicationhost.config file, save file im working on (to reload page automatically using browsersync) first of need understand how caching works on iis level: when asp or asp.net page requested, "page output caching" stores response of dynamic page in memory. when subsequent requests arrive pages,instead of re-processing page,server sends cached response. please check link . should you

python - Pandas date_range to generate monthly data at beginning of the month -

i'm trying generate date range of monthly data day @ beginning of month: pd.date_range(start='1/1/1980', end='11/1/1991', freq='m') this generates 1/31/1980 , 2/29/1980 , , on. instead, want 1/1/1980 , 2/1/1980 ,... i've seen other question ask generating data on specific day of month, answers saying wasn't possible, beginning of month surely must possible! you can changing freq argument 'm' 'ms' : d = pandas.date_range(start='1/1/1980', end='11/1/1990', freq='ms') print(d) this should print: datetimeindex(['1980-01-01', '1980-02-01', '1980-03-01', '1980-04-01', '1980-05-01', '1980-06-01', '1980-07-01', '1980-08-01', '1980-09-01', '1980-10-01', ... '1990-02-01', '1990-03-01', '1990-04-01', '1990-05-01',

select _DONE_ report requests from amazon php -

here code select order report amazon using mws feed api.this working fine,but returns _get_orders_data_ type reports,but need reports having status _done_ .is possible php? here found option reportprocessingstatuslist unable set sdk,how set option? $parameters = array ( 'merchant' => merchant_id, 'maxcount' => 100 ); $request = new marketplacewebservice_model_getreportrequestlistrequest($parameters); $typelist = new marketplacewebservice_model_typelist(); $typelist->settype('_get_orders_data_'); $request->setreporttypelist($typelist); first, calling getreportrequestlist , part of reports api , not feeds api. can limit results specific report type requesting list this: $request = new marketplacewebservice_model_getreportrequestlistrequest(array( "reportprocessingstatuslist.status.1": "_done_" )); by way, besides api reference documentation, scratchpad helps lot finding , testing out paramet

mysql - PHP - Change value y,n in database -

i try change value y , n, input in database , database got problem, please me solve it. here code <label>get sponsored <span style="color:red">*</span></label> <select style="width:100px;" class="form-control" name="sponsor"> <?php $generic = array('no', 'yes'); for($i=0;$i<count($generic);$i++){ ?> <option value="<?php echo ($i); ?>" <?php echo (isset($row))?(($row->is_get_sponsored ='y'== 1)?"selected":""):"";?>> <?php echo $generic[$i];?> </option> <?php

c# Compiled Queries -

i'm trying make compiled query, following msdn example @ http://msdn.microsoft.com/en-us/library/bb896297.aspx here code static readonly func<newtestdbcontext, string, long, iqueryable<routequerymodel>> s_compiledquery2 = compiledquery.compile<newtestdbcontext, string, long, iqueryable<routequerymodel>>( (db, currentlocation, x) => b in db.routes let avg_rating = b.ratings.any() ? b.ratings.select(r => r.rating1).average() : 0 let coorcount = b.coordinates.count() let is_favorite = b.favorites.any(c => c.users_id == x) ? true : false let distance_to_first_from_me = b.coordinates. select(c => c.position). firstordefault(). distance(dbgeography.fromtext(currentlocation, 4326)) let distance_to_last_from_me = b.coordinates. orderbydescending(c => c.sequence). select(d => d.position). firstordefault(). distance(dbgeography

javascript - Retrieving cut data in Ckeditor -

i'm searching way data of cut event in ckeditor. , looking within sourcecode posted on github. after trying data on ie8, mozilla(mac) follow 2 examples editor.editable().on('cut', function (ev) { console.log(ev.datavalue); }); editor.editable().on('cut', function (ev) { console.log(ev.data.datavalue); }); i couldn't find out problem not retrieving data. know how retrieve data cut event in ckeditor? you can't. ckeditor utilizes native document.execcommand clipboard operations. doesn't store cut/copied browser does. browsers except ie won't let manipulate clipboard data (ie display prompt first). in fact, ckeditor has (almost) nothing cutting process. in ie , webkit, can try onbeforecut event listen on , access editor's selection editor.getselection() (i.e. editor.getselection().getselectedtext() ).

elasticsearch - Which custom search engine? -

i have website running on apache php , mysql . i wish implement custom search engine on text stored in mysql table , on .pdf , .docx documents. i not sure api go for. i have looked @ google's custom search engine (cse) , elastic search . elastic, have learnt, can run on java-based server , unable go down route. i know elastic can handle requirements through rest api. google cse able same, i.e. search through text stored in database tables , pdfs? other custom search apis out there possible? solutions such google custom search engine (in case google site search) or other web robot (such nutch ) read web-side of things: accessible browser (not being logged in) , classify url displaying web-pages (with title , text content’s extract). if pdfs, docx , web-pages accessible without login, works extremely well. web-app creator should enable that. not mean normal user has access all, robot (e.g. springer publisher invites google bot content not normal browser).

javascript - How to remove character from string by position number? -

i have string this: var str = "this **test"; now want remove 2 stars (positions 10 , 11 ). , want this: var newstar = "this test"; again, want remove them using number of position. how can that? you may use string.replace also. > var str = "this **test"; > str.replace(/^(.{10})../, '$1') 'this test' ^(.{10}) captures first 10 characters , following .. matches 11th , 12th character. replacing matched characters captured chars give expected output. if want satisfy position condition plus character codition regex must be, str.replace(/^(.{10})\*\*/, '$1') this replace 2 stars if placed @ pos 11 , 12. you may use variable inside regex using regexp constructor. var str = "this ***test"; var pos = 10 var num = 3 alert(str.replace(new regexp("^(.{" + pos + "}).{" + num + "}"), '$1'))

javascript - Can nextAll() skip any specified parent element and look for only child inside the parent? -

i have html ajax form structure below: <form name="vafform" id="vafform" method="get" action="urlfor ajax"> <input type="hidden" value="0" id="vafproduct"> <!--<div id="catalog-collection" class="select">--> <select class="catselect {prevlevelsincluding: 'cat'} cat" name="cat" id="catalog" data-level="0"> <option value="0">- select cat -</option> <option value="1"> federal </option> <option selected="selected" value="2"> california </option> </select> <!--</div>--> <!--<div id="year-collection" class="select">-->

Convert virtual spaces into real tabs in visual studio -

in visual studio when create newline sets caret indent want. it's not real tab indentation until type character @ line. empty lines still empty (without '\t') , want make vs convert virtual indentation real tabs. i saw this question pretty close want in differense don't write extension search existing solution. though if there's no other way have it.

Python nested parenthesis function parameter list invalid syntax -

the code page chaotic attractor reconstruction. returns error when running under python 3.4.4 follows: syntaxerror: invalid syntax at 2nd opening parenthesis in parameter part of function: def rossler_odes((x, y, z), (a, b, c)): return numpy.array([-y - z, x + * y, b + z * (x - c)]) i guessing python version issue e.g. code created version older 3.4.4. not know python wish run learn physics , of course language. tuple parameter unpacking has been removed in python 3, see pep 3113 , what's new in python 3.0 . suggested there, easiest way make code python 2/3 compatible use def rossler_odes(x_y_z, a_b_c): x, y, z = x_y_z a, b, c = a_b_c return numpy.array([-y - z, x + * y, b + z * (x - c)])

angular - Angular2 http.request not able to add headers -

Image
i have code in angular2 typescript trying add headers following. ['access-token', localstorage.getitem( 'token' )], ['client', localstorage.getitem( 'client' )], ['uid', localstorage.getitem( 'email' )], ['withcredentials', 'true'], ['accept', 'application/json'], ['content-type', 'application/json' ] while sending request can't see headers in request. working on cross domain setup. there other way it? private _request(url: string | request, options?: requestoptionsargs) : observable<response> { let request:any; let reqopts = options || {}; let index:any; if(!reqopts.headers) { reqopts.headers = new headers(); } for( index in this._config.authheaders ) { reqopts.headers.set( this._config.authheaders[index][0], this._config.authheaders[index][1] ); } request = this.http.request(url, reqopts); return request; } this

node.js - NodeJs, Mongoose: what's the best way to check auth before update? -

i want check if logged-in user(req.user) same person made post(post.author, it's objectid refering user) before update data. restrict route update form i'm double checking in case. this code working, want know if there simpler or better way this. app.put('/posts/:id', isloggedin, function(req,res){ post.findbyid(req.params.id, function (err,post) { if(!req.user._id.equals(post.author)) return res.json({success:false, message:"unauthrized attempt"}); post.findbyidandupdate(req.params.id, req.body.post, function (err,post) { res.redirect('/posts/'+req.params.id); }); }); }); i found better way. app.put('/posts/:id', isloggedin, function(req,res){ post.findoneandupdate({_id:req.params.id,author:req.user._id}, req.body.post, function (err,post) { res.redirect('/posts/'+req.params.id); }); });

jquery - sliding panel open/close on click -

how can have have sliding panel function "on click" instead of mouseover/mouseout <script> $("button.main").mouseover(function() { $("div.sliderinner").animate( {"width": "100px"}, "500"); }); $("button.main").mouseout(function() { $("div.sliderinner").animate( {"width": "0px"}, "700"); }); $("button.main").mouseover(function() { $("div.sliderinner") .html('example content'); }); $("button.main").mouseout(function() { $("div.sliderinner") .html(''); }); </script> thank you instead of mouseover .toggle , supply number of functions want toggle through including slideinner $(#buttonmain).toggle(function () { $('div.sliderinner').animat

angularjs - Test Cases for methods written in Angular js -

i'm absolute newbie angularjs. i've written below functions in angular js. $scope.clickoncegetprofilesbyenv = function () { $scope.ptpprofilelist = undefined; $scope.ptpperson = undefined; var params = { environment: $scope.ptpenvironment, searchcriteria: null, catalogname: null, catalogid: null, profileid: null, identityid: null }; channelservice.doapicall(channelapp.configdata.basedirectory + '/api/testharness/getprofiles/', 'post', params) .success(function (data) { if (data) { $scope.ptpprofiles = data; } else { $scope.ptpprofiles = {}; } }).error(function (data) { $scope.ptpprofiles = {}; }); }; $scope.clickoncegetidentities = function () {

floating point - C Program prints 0.00000 everytime but returns correct answer -

i have pretty simple code i'm having issues with. program calculates someone's weight in kilograms , displays it. however, every time run, printed answer comes 0.00000 returns correct answer. see wrong code? #include <stdio.h> #include <math.h> int main(void) { float w; float const wc=0.454; printf("enter weight in pounds "); scanf("%f", &w); float wk = w * wc; printf("your weight in kilograms is: %f", &wk); return(wk); } you don't need pass address of variable argument format specifier print value. need change printf("your weight in kilograms is: %f", &wk); to printf("your weight in kilograms is: %f", wk); that said, always check return value of scanf() . without that, in case scanf("%f", &w); fails, you'll invoking undefined behavior you'll end using unitialized local variable float wk = w * wc; in float wk = w

xaml - WPF Pie chart doesn't slice up -

Image
i using piechart control display 2 values database (used , available). output without slicing seen in image below, how slice pie chart? my keyvalue pair of type . getting values keyvaluepair datasource & retrieving using linq sql queries. xaml pie chart: <window.resources> <collectionviewsource x:key="ramview" source="{binding path=usagerams, source={staticresource serverview}}"/> </window.resources> <dvc:chart x:name="ram" background="white" foreground="black" margin="950,0,92,485" grid.column="1" grid.row="1"> <dvc:chart.series> <dvc:pieseries itemssource="{binding}" dependentvaluepath="available" independentvaluepath="used" > </dvc:pieseries> </dvc:chart.series> </dvc:chart> code behind private collectionviewsource serversusageramsviewsource; private void w

sql server - SQL - ID to date, multiple dates -

this table: date sssn myid hours 01012013 1234 8 01012013 2345 7 01012013 3456 8 02012013 1234 5 02012013 2345 12 02012013 3456 7 i want set myid table looks this: date sssn myid hours 01012013 1234 1 8 01012013 2345 1 7 01012013 3456 1 8 02012013 1234 2 5 02012013 2345 2 12 02012013 3456 2 7 i looking @ this: syntax of for-loop in sql server , sql : update id; according date didn´t there. seems easy job somehow not working desired. i cannot use alter table identity(1,1) clear. this when using sql server. solved using, dense_rank() instead of row_number() suggested bluefeet. depending on database product using, might able apply row_number() generate myid value: ;with cte ( select date, sssn, myid, hours, row_number() over(partition sssn order date) rn yourtable )

angularjs - Hosting multiple MEAN stack apps on one VPS -

i learning how develop mean stack applications , have gotten far deploying app aws ec2 instance running ubuntu. works, i'm wondering if there way host multiple apps on separate "directories". so example: domain.com/app1/#/ serve index view first app domain.com/app2/#/ same second app i know writing necessary routes single app.js file, i'm looking way keep app1 , app2 separated possible. is possible? or node apps suited live alone @ root of deployment location? as above. nginx job. each app: server { listen 80; server_name example.com; location / { proxy_pass http://127.0.0.1:8080; proxy_set_header host $host; } } more reading here: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-14-04

mobile - Adding Kinetise service on Bluemix answers with 500 error -

when trying add kinetise service bluemix catalog, pop-up appears saying: service broker error: {"description"=>"error 500 received broker url https://bluemix.marketplace.ibmcloud.com/api/custom/cloudfoundry/v2/service_instances/6b04405f-96d7-413a-91f2-92f036fc0bf7 "} i haven't found pb recorded on bluemix status page. i'm on us-south. this problem depends issues in responding @ broker side. please open ticket @ bluemix support using 1 of following methods: use support widget. available user avatar in upper right corner of main bluemix ui. after opening support widget panel, select > in touch, select type of assistance need, , fill out support form. use support site 'get help' form. form available on separate site made available ticket submission when cannot log bluemix , access support widget. go http://ibm.biz/bluemixsupport , fill in support request form.

winforms - Current selected value in DataGridView using C# -

i'm trying current selected value datagridview messagebox.show(""+datagridview1.selectedcells.tostring()+"") but never shows selected value. it shows system.windows.forms.datagridviewselectedcellcollection you should way messagebox.show(datagrdiview1.selectedcells[0].value.tostring()); try access value or text of single cell, , not entire collection you can iterate through entire selectedcells collection string text; foreach (datagridviewcell cell in datagridview1.selectedcells) { //messagebox.show(cell.value.tostring()); text +=cell.value.tostring(); } messagebox.show(text);

linux - Execute a command as a non super user in a sudo script -

this question has answer here: stop being root in middle of script run sudo 2 answers i developed script. this script should called sudo: $ sudo ./script in script have command in middle want execute non super user (like if it's executed without sudo) is posssible that? technical it's possible sudo -u plain_user command in script. way of scripting somehow strange me though.

c# - edit user profile image with usermanager -

i'm following this tutorial add profile picture once account create. that edit has following snippet, student student = db.students.include(s => s.files).singleordefault(s => s.id == id); in above example applied table call student in case want go aspnetuser table , have go usermanger feature , once try include file popping error in compile time. but in scenario i'm trying include in aspnetuser or usermanager so populate uploaded picture. need include following code in user manager var user = await usermanager.include(s => s.files).findbyidasync(userid); but getting following error 'applicationusermanager' not contain definition 'include' , no extension method 'include' accepting first argument of type 'applicationusermanager' how ignore , include files edit: these changes i've done in model classes file public class file { public int fileid { get; set; } .. public virtual app

How to clear dynamic memory? -

for example, have dynamic segment tree on pointers, memory clear if assign root of tree null? how clear efiiciently? assigning null change pointer's address, won't affect allocated memory. deallocation shall conform allocation. means if have allocated each inode of tree separately, need deallocate them separately (most in reverse order - depends on content of chunks). if memory allocated @ once, should deallocated @ once.

ubuntu - Docker: Is it necessary to mount a new partition -

i want install product on docker. installed on ec2-server of amazon. the installation starts creating mount point /product . partition disk fdisk , they're creating new partition. after create filesystem , mount new partition /product . i'm not familiar seems me main goal install product on 1 new disk. the installation performed on ubuntu:14.04 want start this: docker run -i -t ubuntu:14.04 /bin/bash performing same installation instructions , create image of container. is necessary perform of mount instructions or can start installation? perform of mount instructions not exactly. best practice define installation step in dockerfile , starting from ubuntu:14.04 , , including volume /mount in order declare /mount volume . this preferred docker run + (work) + (exit) + docker commit , because dockerfile, can repeat installation process simple docker build . , keep specification of installation written in dockerfile. the alternative go way,

java - Sort array containing null elements -

this question has answer here: how sort array of objects containing null elements? 4 answers i have string array of size 1000: string[] substrstore = new string[1000]; i have 6 elements in array. if sort using: arrays.sort(substrstore); i getting null pointer exception because tries compare null elements. how can solve problem? if strings first 6 elements can use arrays.sort(substrstore, 0, 6);

Why does Entity Framework select all tables, columns and other info -

after using profiler noticed our application load slower because of query entity framework executes. select [extent1].[table_name] [table_name], [extent1].[column_name] [column_name], [extent1].[table_catalog] [table_catalog], [extent1].[table_schema] [table_schema], [extent1].[ordinal_position] [ordinal_position], [extent1].[column_default] [column_default], [extent1].[is_nullable] [is_nullable], [extent1].[data_type] [data_type], [extent1].[character_maximum_length] [character_maximum_length], [extent1].[character_octet_length] [character_octet_length], [extent1].[numeric_precision] [numeric_precision], [extent1].[numeric_precision_radix] [numeric_precision_radix], [extent1].[numeric_scale] [numeric_scale], [extent1].[datetime_precision] [datetime_precision], [extent1].[character_set_catalog] [character_set_catalog], [extent1].[character_set_schema] [character_set_schema], [extent1].[character_

java - improving cypher query performance and find bottleneck in cypher with jdbc to neo4j server connection -

i'm looking methods improve answer time of neo4j server, respectively cypher querying. i've got server neo4j running. neo4j graph around 55gb. there 4 different node types, on each index. client i'm running java code jdbc connector lot(>1000) of queries, following: match (p0:page {title:'"+captionu+"'}), (p1:page {title:'"+labelu+"'}), p = ((p0)-[r:to_category*..4]-(p1)) return p according neo4j webconsole such query takes around 4000ms. using server shell, shows similar amount of time(~4000ms). when running java code of queries seem require more time 4000ms. setquerytimeout not have effect. so besides buying new hardware server, have idea of tweaking jdbc connector or cypher querying? does have idea how find bottleneck? in jdbc logs not find might give hint problem. on server permission denied warning appears $ echo 'deadline' > /sys/block/sda/queue/scheduler thanks in advance

android - How can I open a new activity inside of a new task and let it occur behind the current task? -

when using chrome on android 6.0, can long press link, select "open in new tab" , open task behind current task. now need familiar, can't find out how let activity start inside new task , let task start behind current task fancy animation. i found public static final int anim_launch_task_behind = 7; in activityoptions.java , there javadoc: /** * if set along intent.flag_activity_new_document task being launched not * presented user instead available through recents task list. * in addition, new task wil affiliated launching activity's task. * affiliated tasks grouped in recents task list. * * <p>this behavior not supported activities {@link * android.r.styleable#androidmanifestactivity_launchmode launchmode} values of * <code>singleinstance</code> or <code>singletask</code>. */ public static activityoptions maketasklaunchbehind() { final activityoptions opts = new activityoptions(); opts.manimationtype = an

Is it possible to detect if Android webview's goBack() will load content from cache? -

i'm having issue android webview's goback() not sending custom request headers , cookies. i'm trying fix reloading whole page on goback(), should done when goback() not going load content cache. there way programmatically detect webview's goback() going load content cache or not. thanks. if load isn't cache, go through webviewclient.shouldinterceptrequest . note in case of goback , shouldoverrideurlloading not called, not called navigations started via java api calls.

jquery - Get data from AJAX request in NodeJS and store in DB -

i have problem getting data client side in nodejs. on client side i've prepared json data can see in codepen on server side i'm trying these data client: var express = require('express'); var mysql = require('mysql'); var app = express(); app.use('/', express.static('../client/app')); app.use('/bower_components', express.static('../client/bower_components/')); var server = require('http').createserver(app); var bodyparser = require('body-parser'); app.jsonparser = bodyparser.json(); app.urlencodedparser = bodyparser.urlencoded({ extended: true }); //mysql connection setup var connection = mysql.createconnection({ host : "localhost", port: "3306", user : "root", password : "", database : "db", multiplestatements: true }); app.get("/cities", function(req, res) { console.log(res.body); //i'm getting nothing

objective c - UIDateTime Picker without minutes and seconds in iOS -

Image
how make uidatetimepicker date , hour , am/pm.(no minutes or seconds display !) change mode of datepicker storyboard. find attached screenshot. nsdate * date = picker.date; nsdateformatter *df = [[nsdateformatter alloc] init]; [df setdateformat:@"d:hh a"]; nslog(@"picker time: %@", [df stringfromdate:[nsdate date]]); here picker iboutlet reference uidatepicker .

javascript - how to scroll focus a particular div having same class name or same attribute -

how scroll focus particular div having same class name or same attribute, when click on li have class name list1 scroll need focus on div class list1 <ul> <li class="list1">list1</li> <li class="list2">list1</li> <li class="list3">list1</li> </ul> <div class="list1"></div> <div class="list2"></div> <div class="list3"></div> hi can try solution. <ul> <li class="list1"><a href="#list1">list1</a></li> <li class="list2"><a href="#list2">list2</a></li> <li class="list3"><a href="#list3">list3</a></li> </ul> <div id="list1">list1</div> <div id="list2">list2</div> <div id="list3">list3</div>

vb.net - Create, fill and resize WordTable before inserting it to instance -

i working on application gets data out of database , puts open word instance. currently it's doing following steps: find open word instance (if multiple opened user can select) dim odocs word.document = wordapplication.application.documents(filepath) create table on bookmark in word instance try wordtable = odocs.tables.add(odocs.bookmarks.item("nameofbookmark").range, datatable.rows.count + 1, datatable.columns.count) catch ex exception wordtable = odocs.tables.add(odocs.application.selection.range, datatable.rows.count + 1, datatable.columns.count) end try fill table, when it's in word instance looping each row , cell -> in loop happening lot, it's working , doesn't matter question not put code inside here i know speed can slow because of stuff happening in part fills table, not think it's much. my problem speed of that. while working fine, takes years execute. can see every cell being filled in opened word-document. t

php - how to print file path location in imce drupal? -

Image
i want display file location path in imce : opened imce-file-list.tpl.php , found : <tr id="<?php print $raw = rawurlencode($file['name']); ?>"> <td class="name"><?php print $raw; ?></td> <td class="size" id="<?php print $file['size']; ?>"><?php print format_size($file['size']); ?></td> <td class="width"><?php print $file['width']; ?></td> <td class="height"><?php print $file['height']; ?></td> <td class="date" id="<?php print $file['date']; ?>"><?php print format_date($file['date'], 'short'); ?></td> </tr> i want print $file[path] not working salaktarus, try use $imce['furl'] variable. from drupal.org/node/1738218#comment-10674360

c# - Menu and SubMenu in different frames -

i have little problem clicking on submenu, reason menu tag in 1 frame , submenu in other when switch other frame submenu invisible my code: driver.switchto().defaultcontent().switchto().frame("top"); actions actions = new actions(driver); iwebelement menuhoverlink = driver.findelement(by.partiallinktext("cons")); actions.movetoelement(menuhoverlink); actions.build().perform(); driver.switchto().defaultcontent().switchto().frame("content").findelement(by.id("elem3")).click(); exception unexpected error. element not visible , may not interacted with does have idea can in case? thanks. try use explicit wait driver.switchto().frame("content"); webdriverwaitwait wait = new webdriverwait(driver, timespan.fromseconds(10)); wait.until(expectedconditions.elementisvisible(by.id("elem3"))).click(); or use send keys actions.movetoelement(menuhoverlink).build().perform(); menuhoverlink.sendke

php - Laravel 5.2 shows "The Response content must be a string or object implementing __toString(), "boolean" given" when I try to use DB::statement -

i'm trying use db::statement() method run sql, can't work , shows "unexpectedvalueexception in response.php line 395: response content must string or object implementing __tostring(), "boolean" given." here's code: $students = db::statement('select stu_agency,avg(stu_rank1) avggrade students group stu_agency'); return $students; from docs : some database statements should not return value. these types of operations, may use statement method on db facade. you searching for $students = db::table('students') ->select('stu_agency', db::raw('avg(stu_rank1) avggrade')) ->groupby('stu_agency') ->get(); return $students;

Start Jboss with Ant. Command exec doesn't work -

i try start jboss ant. when execute script : <target name="start-jboss" > <exec executable="${jboss.bin.dir}\run.bat" > <arg line="--configuration=myserver -b localhost" /> </exec> </target> jboss blocking @ step : [exec] 15:52:55,373 info [ajpprotocol] initializing coyote ajp/1.3 on ajp-localhost%2f127.0.0.1-8009 but when run run.bat works... same when add spawn="true" in exec. i think problem comes eclipse... thanks to run batchfile use cmd executable, : <exec dir"yourworkingdir" executable="cmd" failonerror="true"> <arg line="/c ${jboss.bin.dir}\run.bat --configuration=myserver -b localhost"/> </exec> if arg line=... doesn't work, use arg value=... every parameter. edit : if have trouble using batchfile, why not rid of using addtional batchfile , use java task straightforw

javascript - How to implement error tracking in a polymer? -

is there way of error tracking in polymer? problem apparently vulcanize , polybuild processes couldn't provide source-maps (please correct me if i'm wrong). means if catch exception in vulcanized java script code using global window.onerror function not able map , find actual location of error in source files. any solutions/workarounds highly appreciated. here idea of done. please provide ideas , solutions aswell. solution not tested. according https://github.com/polymerlabs/polybuild polybuild tool same as: vulcanize --inline-css --inline-scripts --strip-comments index.html | polyclean | crisper --html index.build.html --js index.build.js the order is: 1) vulcanize produces 1 html formatted file. 2) polyclean uses uglifyjs internaly , perform cleaning 3) crisper used separate uglyfied , minified js html as far know uglifyjs doesn't work html files input polyclean manually cuts parts of js code', put through uglifyjs , paste (i hope unders

xtend - Count value in template expression -

i want count value inside template expression, in xtend, without printing out. this code: def generatetower(tower in) { var counter = 0.0; ''' 1 2 3 4 «for line : in.mytable» «counter» «line.val1» «line.val2» «line.val3» «counter = counter + 1» «endfor» ''' } so generate table 4 columns, whereas first column incremented starting @ 0.0. problem is, «counter = counter + 1» printed well. want expression above count up, without printing out. what best solution solve problem? you use simple , readable solution: «for line : in.mytable» «counter++» «line.val1» «line.val2» «line.val3» «endfor» if insist on separate increment expression , use block null value. works because null value converted empty string in template expression s (of course use "" well): «for line : in.mytable» «counter» «line.val1» «line.val2» «line.val3» «{counter = counter + 1; null}» «endfo

ios - dispatch_after equivalent in NSOperationQueue -

i'm moving code regular gcd nsoperationqueue because need of functionality. lot of code relies on dispatch_after in order work properly. there way similar nsoperation? this of code needs converted nsoperation. if provide example of converting using code, great. dispatch_queue_t queue = dispatch_queue_create("com.cue.mainfade", null); dispatch_time_t mainpoptime = dispatch_time(dispatch_time_now, (int64_t)(timerun * nsec_per_sec)); dispatch_after(mainpoptime, queue, ^(void){ if(dfade !=nil){ double incriment = ([dfade volume] / [self fadeout])/10; //incriment per .1 seconds. [self dodelayfadeout:incriment with:dfade on:dispatch_queue_create("com.cue.mainfade", 0)]; } }); nsoperationqueue doesn't have timing mechanism in it. if need set delay , execute operation, you'll want schedule nsoperation dispatch_after in order handle both delay , making final code nsoperation . nsoperation designed handle more-or-le

GIT - branches, what is branch? -

Image
i new git. want create new branch: have 3 files inside repository. if create new branch, have copy files; or copied automatically if create new branch? when want work on branch, have switch branch inside git, before start work (opening files)? thank help i want create new branch # checkout new branch based upon current branch git checkout -b <new branch name> if create new branch, have copy files; or copied automatically if create new branch? the new branch full copy current branch. in order understand why need know branch in git. what branch in git? a branch in git lightweight movable pointer commit. here short , simple post it in other words: branch in git pointer commit. can see in image below (taken post mentioned above), branches pointing commit b + delta added them. when create branch git creates file , writing commit id file. when want work on branch, have switch branch inside git, before start work (opening files

java - Adding Listeners to JButtons -

i trying add actionlisteners jbuttons new , delete , search . i've tried several things , ways still cannot work. p.s i've added action button new , seems work not add in array. every appreciated! in advance. package datingrun; import java.awt.event.actionevent; import java.awt.event.actionlistener; import java.util.arraylist; import javax.swing.jbutton; import javax.swing.jframe; import javax.swing.jlabel; import javax.swing.joptionpane; import javax.swing.jtextarea; import javax.swing.jtextfield; public class main extends javax.swing.jframe { public static void main(string[] args) { jframe frame = new jframe("onomata"); jlabel ll = new jlabel("Êáôá÷ùñÞóåéò"); ll.setbounds(150, 20, 300, 15); jlabel l2 = new jlabel("onoma"); l2.setbounds(155, 80, 300, 15); jlabel l3 = new jlabel("filo"); l3.setbounds(270, 80, 100, 15); jlabel l4 = new jlabel("ilik