Posts

web services - Set Jackson DeserializationContext Attribute in per-request, thread-safe manner -

i'm looking able add request-scoped attribute (a jax-rs containerrequestcontext because rather use jackson convert parameters objects jax-rs's ill conceived , clunky parameterconverterproviders ) deserializationcontext can obtained within jsondeserializer . must call convertvalue() rather readvalue() (not dealing actual json) not able create objectreader in each thread unless willing serialize map json string first , read -which incredibly inefficient. i'd able accomplishes following in per request manner: objectmapper om = new objectmapper(); //in request-scoped context: om.getdeserializationcontext().setattribute("requestcontext",containerrequestcontext) map<string,object> mapofrequestparameters = ... beanofvastimportance bean = om.convertvalue(mapofrequestparameters,beanofvastimportance.class) how can achieve without massive, superfluous overhead of needing create new objectmapper each individual request thread? this can achieve...

How do I embed 2 css in 1 Html? -

head section <head> <meta charset="utf-8"> <title>kaffehaus mannfredo | home</title> <link rel="shortcut icon" href="../1_pics/favicon.ico" /> <link rel="stylehseet" type="text/css" href="../2_css/general.css"> <link rel="stylesheet" type="text/css" href="../2_css/nav.css"> <link href='fonts.googleapis.com/css?family=open+sans' ; rel='stylesheet' type='text/css'> first css ul { position: fixed; top: 0; left: 0; width: 100%; list-style-type: none; margin: 0; padding: 0; overflow: hidden; background-color: #333; } li { font-family: 'open sans', sans-serif; margin:0px; float: none; display: inline-block; } li { display: block; color: white; text-align: center; padding: 15px 17px; text-decoration: none;} li a.active { background-color: #4caf50;} li a:hover:not(.active) { background-color: #...

hibernate - is it possible to get a property by its value in c# -

i have code compare values of oldstate object currentstate in fluent inhibernate, want log property has been changed , value,here new , old values waant property name. if reflect @event.entity can properties , values there way property name value. public void onpostupdate(nhibernate.event.postupdateevent @event) { var entitytoaudit = @event.entity iauditable; string path = path.combine(appdomain.currentdomain.basedirectory, "auditlog.txt"); using (streamwriter sw = file.appendtext(path)) { (int = 0; < @event.oldstate.length; i++) { if (@event.oldstate[i] != null) { if (!@event.oldstate[i].equals(@event.state[i])) { sw.writeline("the value has ben changed " + @event.oldstate[i] + " " + @event.state[i]); } } else { if (@event.state[i] != null) { ...

r - Pipe a data frame to a function whose argument pipes a dot -

how can 1 pipe data frame function argument pipes dot? mpg %>% rbind(., . %>% rev()) error in rep(xi, length.out = nvar) : attempt replicate object of type 'closure' another example: mpg %>% { . %>% arrange(manufacturer) } functional sequence following components: arrange(., manufacturer) use 'functions' extract individual functions. wrap dot piped in parentheses (.) : mpg %>% rbind(., (.) %>% rev()) or, lambda function: mpg %>% { (.) %>% arrange(manufacturer) }

cordova - PhoneGap 2.9.0 Loading External Scripts -

preface: i'm using coffeescript , haml , testing on android phone using phonegap build. i attempting load external script being compiled on server phonegap app. when testing page locally works when testing on actual device doesn't seem getting script. have tried loading script in index.html: %script{:type => 'text/javascript', :src => "http://192.168.5.112:3000/assets/mobile.js"} i have tried using jquery's getscript, get, , ajax calls: $.getscript('http://192.168.5.112:3000/assets/mobile.js', alert('success')) $.get 'http://192.168.5.112:3000/assets/mobile.js', (data) -> alert 'success server' + data $.ajax 'http://192.168.5.112:3000/assets/mobile.js', error: (jqxhr, textstatus, errorthrown) -> alert('localerror: ' + jqxhr + textstatus + errorthrown) success: (data, textstatus, jqxhr) -> alert('localsuccess: ' + data + textstatus + jqxhr) all of give me succ...

Get non-matching data when comparing python dicts and store them -

i have 2 python dicts... i'm checking if match. how can non-matched keys , values items , store them? data1 = {'first_name': 'john', 'last_name': 'doe', 'username': 'johndoe'} data2 = {'first_name': 'john', 'last_name': 'doe', 'username': 'johohoho'} (key, value) in set(data1.items()) & set(data2.items()): print(key, value) # returns matching data. how can grab non matched? thank in advance! you can use xor non matching entries catching matched entries: >>> (key, value) in set(data1.items()) ^ set(data2.items()): ... print(key, value) ... ('username', 'johndoe') ('username', 'johohoho') note: won't work nested dictionaries

javascript - ng-click not working in dynamic html of a directive -

my problem seems relatively similar ng-click not working in dynamically created content solution posted there not working me. the entire goal have directive generate html based on variable in controller's scope. generated html have replaced ${foobar} clickable span text foobar execute function on controller's scope when clicked. i have directive: .directive('markup', function($compile) { var convertparameters = function(text) { var matches = text.match(/\${.*}/); if(!matches) { return text; } for(var i=0;i<matches.length;++i) { var match = matches[i]; var label = match.substring(2,match.length-1) text = text.split(match).join('<span ng-click="expose(\'' + label + '\')">' + label + '</span>'); } return text; } var link = function(scope, element, attrs) { var text; if (scope.markup) ...