Posts

In spray for scala, get a FromRequestUnmarshaller from an ordinary Unmarshaller -

in scala spray, there way convert unmarshaller[t] fromrequestunmarshaller[t] . i'm stuck trying make entity directive work without using implicits. example: ... } ~ post { path("mypath") { entity(sprayjsonunmarshaller[mycaseclass](mycaseclassrootjsonformat)) { mycaseclass => complete { handle(mycaseclass) } } } ~ ... compiler error: multiple markers @ line - type mismatch; found : spray.httpx.unmarshalling.unmarshaller[mycaseclass] (which expands to) spray.httpx.unmarshalling.deserializer[spray.http.httpentity,mycaseclass] required: spray.httpx.unmarshalling.fromrequestunmarshaller[?] (which expands to) spray.httpx.unmarshalling.deserializer[spray.http.httprequest,?] - type mismatch; found : spray.httpx.unmarshalling.unmarshaller[mycaseclass] (which expands to) spray.httpx.unmarshalling.deserializer[spray.http.httpentity,mycaseclass] required: spray.httpx.unmarshalling.fromrequestunmarshaller[?] (which...

c# - Fast parallel adding to dictionary when keys never collide -

i have situation, dictionary created, key-value pairs added, , after point dictionary used reading values. i'm trying implement quickest way of adding dictionary in initialization phase. concurrentdictionary has slow tryadd method (and getoradd) - on 6 core cpu (12 threads), cpu usage stays @ 25%, indicating 3 threads used. it faster add keys (around 25 million) dictionary sequentially, using concurrentdictionary , parallel.for. how can improve speed here? easy separate key-value pairs, keys never collide when added dictionary, using code below creates problems: dictionary<long,string> d = new dictionary<long,string>(); d[key] = value; it seems this, when used in multi-threaded environment, fails because dictionary internal changes (resizing?). would work instead? capacity = 250000000 //basically big enough store data dictionary<long,string> d = new dictionary<long,string>(capacity); d[key] = value; i prefer using dictionary on concurre...

How can you distinguish onPause() due to onNewIntent vs user action in android -

if have set activity in android fire onnewintent() when receives intents when in stopped or paused state. goes through following sequence if receives intent while running: onpause() -> onnewintent() -> onresume() but if paused due user action onpause(). now if want in case user hid app not in case getting new background intent. doing example cancelling recording when app gets hidden, seems screwed. you wont know until sometime in future whether got onpause because user hid app or because of incoming background intent. am missing or broken? why don't send onnewintent callback if intent while running. rather pause, onnewintent, resume sequence? if stumbles upon again - not possible detect if onpause() called due new intent onresume() can detected. add bundle_key_new_intent_called when onnewintent() called , check flag in onresume() , take required action. @override protected void onnewintent(intent intent) { super.onnewintent(intent); ...

java - Source of project errors in Eclipse IDE -

Image
very often, case there compilation error in project, yet can't find source of error. for instance: this web project has error, yet it's guess error is. why isn't there way right-click option called "find source of compilation error"? there's no quick fix option available. this simple question. don't understand why issue, because eclipse knows problem is, why won't eclipse tell me? press ctrl + 3 type problems , hit enter . should show list of issues in project.

objective c - How to make a "within window" transparent/blurry title bar using a custom base color in Yosemite? -

Image
i've been playing around nsvisualeffectviews in yosemite , transparent titlebars wondering if it's possible have custom title bar, own base color (not gray), act apple's. here's current nswindow : achieved setting following code on custom nswindowcontroller : self.window.stylemask = self.window.stylemask | nsfullsizecontentviewwindowmask; self.window.titlevisibility = nswindowtitlehidden; self.window.titlebarappearstransparent = yes; that blue color custom nsview that's painting rect particular color. content below nstableview . so, goal have titlebar work like, let's say, maps instead of having "base" color gray color, "base" color blue 1 , when nstableview scrolls, content appears below title bar. any ideas on how achieve this? thanks have tried setting blue color transparency of, e.g., 0.75 in blue view, , nsvisualeffectview underneath it?

Grails export plugin strange behavior, errs only on PDF, others fine -

i using exporter plugin 1.6 grails 2.3.8 , controller's list method: def list () { println "*** list method called." println "*** params: " + params if(!params.max) params.max = 10 if(params?.exportformat && params.exportformat != "html"){ response.contenttype = grailsapplication.config.grails.mime.types[params.exportformat] response.setheader("content-disposition", "attachment; filename=chairs.${params.extension}") list fields = ["constructionmaterials"] map labels = ["constructionmaterials": "construction materials"] // formatter closure def uppercase = { domain, value -> return value.touppercase() } map formatters = [constructionmaterials: uppercase] map parameters = [constructionmaterials: "cool chairs", "column.widths": [0.2, 0.3, 0.5]] println "**...

c# - Calling Web Method in Web Service -

basically trying consume web service methods in javascript class in asp.net. here methods in web service: [webmethod] public dataset getfirestation() { sqlconnection sqlconnection1 = new sqlconnection(configurationmanager.connectionstrings["dbconnectionstring"].connectionstring); string select = "select * dbo.firestation "; sqlconnection1.open(); // create adapter sqldataadapter da = new sqldataadapter(select, sqlconnection1); // create new dataset dataset ds = new dataset(); // fill dataset contents of stock table da.fill(ds, "firestation"); sqlconnection1.close(); // return ds dataset return (ds); } then here html code call function in javascript class: case "accident": if (type == 'accident') { symbol = new esri.symbol.picturemarkersymbol('img/accident.gif', 25, 20); ...