Posts

javascript - Using Angular formatters / parsers -

can't seem angular formatters , parsers working: app.js: var itemapp = angular.module('itemapp', []); itemapp.controller('itemcontroller', ['$scope', function($scope) { $scope.some_value = 'abcefg'; }]); itemapp.directive('changecase', function () { return { restrict: 'a', require: 'ngmodel', link: function (scope, element, attrs, ngmodel) { ngmodel.$formatters.push(function(value){ return value.touppercase(); }); ngmodel.$parsers.push(function(value){ return value.tolowercase(); }); } }; }); view.html: <input ng-model="some_value" changecase> it doesn't work- no errors, nothing happens values in input or model. i'm newish angular, having trouble figuring out how i'd debug this. try write: <input ng-model="some_value" change...

creating shapefiles in R from large dataframes -

i use shapefiles() library in r create shapefile dataframe. the dataframe contains 300,000 rows. ddtable contains 1 attribute. shapefile has esri shape type 1 (points). neither dd nor ddtable contain missing values. i have run convert.to.shapefile() create shapefile, process still not complete after 5 hours. when @ task manager, 3.51 gb of memory in use (out of 8 gb), , of time, 37% of cpu used. i use windows7enterprise , r 3.1.0. i have used shapefiles() create shapefiles of road network on 140,000 links, , creation of shapefile never took more 5 minutes. does have idea of may going wrong?

c# - Programmatically creating Hangfire cron expression based on user input -

i have c# .net web application ui looks similar http://www.cronmaker.com/ . user can select frequency of job many options. need able create cron expression represent user's desired frequency, , must compatible hangfire. ideas either: find existing library it. haven't been able to. heard quartz (though overkill), seemed create cron expressions cases not others. make own tool, using cronmaker.com figure out format. however, cronmaker creates cron expressions in format hangfire considers invalid. "every hour," cronmaker says "0 0 0/1 1/1 * ? *" hangfire said invalid. found "0 */1 * * *" works. i need able dynamically generate cron expression. surely there's library out there can cronlibrary.getcronexpression(frequency.everyndays, 3, "12:00") options cover every conceivable situation. know of such library ? i didn't find library, site http://crontab.guru/ tremendously helpful creating cron expressions valid hangfi...

javascript - Apache HTTPClient sends no client cert during mutual authentication -

i'm getting handshake_failed exception when making restful post call api requires mutual authentication. have verified engineer on other side watching stack trace server-side certs exchanged , accepted client without issue, when server requests client-side cert side doesn't provide , handshake terminates. the thing have no idea how verify whether sslsocketfactory unable identify right certificate or isn't looking in first place. here code, js leveraging apache httpclient library. importpackage(packages.org.apache.http.client); importpackage(packages.org.apache.http.client.methods); importpackage(packages.org.apache.http.impl.client); importpackage(packages.org.apache.http.message); importpackage(packages.org.apache.http.client.entity); importpackage(packages.org.apache.http.util); importpackage(packages.org.apache.commons.httpclient); importpackage(packages.org.apache.http.params); importpackage(packages.org.apache.http.ssl); importpackage(packages.org.apache.http...

vim - Show line numbers only on command mode -

i ever use line numbers when want switch line on screen, use command mode (e.g. :82) is there way show line numbers when switch command mode? yes. can use map that. : nnoremap : :set nu<cr>: this set line numbers when enter command line mode. the following command not show line numbers when leave command-line mode. :nnoremap <cr> :set nonu<cr> but needs 2 enters pressed. ** andrew suggests, following command des same , avoids typing enter twice.** :cnoremap <silent> <cr> <cr>:set nonu<cr> put these 2 lines in ~/.vimrc file.

Appending to a Path Java us -

is there easy way append path created this: final path path = files.createtempdirectory(...); suppose creates temp dir in /tmp/xyx_123/. want path create folder under /tmp/xyz_123/ called foo path.createdirectory("foo"); or path.appenddirectory("foo"); is there easy way this? you can this: path path = files.createtempdirectory("xyx_123"); file fpath = path.tofile(); file addeddir = new file(fpath, "foo"); addeddir.mkdir();

How should I handle concurrency in mongodb? -

i working on web service writing data records mongodb. service reads document mongodb, performs calculations , updates data in document , overwrites document mongodb. need make sure before write data mongodb, no other process has updated document, otherwise may experience data loss when replacing document. how can ensure data integrity @ application level? can lock document while performing calculations? should check version number on document before replacing document? strategies industry uses handle situations this? in advance you can query value in document updated part of call update() check document still in state expect, , confirm no-one else updated since last read document. similar optimistic lock approach. see https://docs.mongodb.com/manual/core/write-operations-atomicity/#concurrency-control