Posts

c# - Drag file from WPF App -

i find lot of samples describe how drag file wpf app. need export .txt or .csv file app when user try drag listbox item. var filestream = file.create(@"c:\users\myuser\documents\test.txt"); var barray = encoding.unicode.getbytes("some text"); filestream.write(barray, 0, barray.length); //filestream.close(); dataobject data = new dataobject(dataformats.filedrop, filestream); dragdrop.dodragdrop(this, data, dragdropeffects.copy); //filestream.close(); but if release on desktop there isn't file copied. wrong? the reason file drop not working not providing list of files paths requirement clipboard format. fix this... var filename = @"c:\users\myuser\documents\test.txt" var filenames = new string[] { filename }; var filestream = file.create(filename); var barray = encoding.unicode.getbytes("some text"); filestream.write(barray, 0, barray.length); filestream.close(); dataobject data = new dataobject(dataformats.filedrop, filena...

javascript - Best way to resolve escaped characters in a database -

i have populated mysql database outputs json data consumed , displayed via angularjs. of text strings in database have escaped quotes , double quotes like: have @ least bachelor\'s degree in child development? or asking children address \"ma\'am\" or \"sir\" formalize things the problem angularjs still displays strings escaped quotes. best way avoid this? do search , replace on database substituting escaped substrings (\',\") else? outputs displayed in angularjs ng-model directive: ... <div class="bs form-group" ng-if="quiz.quizmanager.quiz.questions[quiz.activequestion].quiz_question_type === 'text'"> <input type="text" class="form-control" ng-model="quiz.quizmanager.quiz.questions[quiz.activequestion].answer" ng-change="quiz.selectanswer(0, quiz.quizmanager.quiz.questions[quiz.activequestion].quiz_question_type)" ...

javascript - type="number" but still requires a text to number conversion -

i've element (x) of type=number. in work verify it's value number before performing mathematical operations i've concluded elements of type "number", while having builtin validation , helpful input controls, still assign values text , require conversion number before performing mathematical operations. question - true or there wrong in code? here's work. entered number 6. x = document.createelement("input"); x.type = "number"; x.step = "0.1"; x.min = "0"; x.max = "9999"; x.defaultvalue = "1"; var p = document.getelementbyid(x.id).value; isthisnumber(p); function isthisnumber(z) { alert(typeof z + " --- " + typeof (z)); // returns "string --- string" if (z.isnan) { alert("it's not number"); } else { alert("it's number"); // returns false - it's number } ...

javascript - Waiting for ng-repeat to finish rendering before attempting to lookup element? -

i have seen this answer , have created similar directive can confirm does fire event, , data associated ng-repeat does contain data. (at first thought perhaps ng-repeat rendered once before data set, not seem case. i need reference element created in ng-repeat done rendering. selecting class angular.element(".some-class") . can confirm selector working running line on console after page has loaded. however, seems event not accurate because @ time event fired there no elements on page. possibly relevant: the ng-repeat repeating ng-include . the element i'm trying reference highest level element within ng-repeat element. event emitter: angular.module('onfinishrendermodule', []) .directive('onfinishrender', function ($timeout) { return { restrict: 'a', link: function (scope, element, attr) { if (scope.$last === true) { $timeout(function () { scope.$emit(attr.eventname ? attr.e...

elasticsearch - Using C# params with serilog -

just starting using serilog + elasticsearch , wondering if there elegant way log params object array in 1 log entry. far way have been able manage looping through each params creates separate log entry each one. way combine them 1 log entry? thanks! sample: public static void methodentry<t>(string methodname, params object[] parameters) { if (parameters.length > 0) foreach (var param in parameters) // create parameters.length number of log entries log.forcontext(typeof(t)).debug("entering {methodname} {@param}", methodname, param); else log.forcontext(typeof(t)).debug("entering {methodname}", methodname); } edit: sinks used: serilog serilog.sinks.elasticsearch (which includes file, periodicbatching, & rollingfile sinks) couple enrichers environment , threadid if know specific type of sender object can use following feature of serilog avoid logging of not required information: log.logg...

java - Can't Connect To Tomcat Manager Using Pivotal-tc-server -

i've been trying invoke tomcat manager linux vm, continue receive err_connection_timed_out. i can confirm process running , i'm using correct port tomcat started. status: running pid=13544 # netstat -pl | grep 13544 tcp 0 0 *:23900 *:* listen 13544/java i've added manager-gui role tomcat-users.xml still no luck. if helps followed steps here https://tcserver.docs.pivotal.io/docs-tcserver/topics/postinstall-getting-started.html#postinstall-deploy-apps

svn - Apache webserver Require valid-user leads to internal server error -

i'm setting svn server , want restrict access users have log in first before can view/modify files. dav_svn.conf looks this: <location /svn> dav svn svnparentpath /home/pi/repos # authentication: digest authname "subversion repository" authtype digest authuserfile /etc/apache2/svn-auth.htdigest # authorization: authenticated users require valid-user </location> when try access webpage shows "internal server error". looking inside "/var/log/apache2/error.log" shows following line: [mon sep 11 20:36:47.755229 2017] [authn_core:error] [pid 30331:tid 1972368432] [client 192.168.0.103:59263] ah01796: authtype digest configured without corresponding module, referer: http://192.168.0.100/svn/a/ i can "fix" error changing dav_svn.conf putting xml tag around "require valid-user": <limitexcept propfind options report> require valid-user </limitexcept> however, open viewing ri...