Posts

caching - ColdFusion Client Variable Showing Outdated Value Intermittently -

we have legacy coldfusion application using 150 client variables manage session state. client variables centrally stored in sql server database within 6 application server clustered environment using round-robin load balancer. the problem when code updates client variable new value, old value still being used , displayed though new value updated appropriately in cdata table. happens intermittently in average of 1 out of 1000 updates being made client variable using cfset tag. race conditions , caching issues possible explanations. “suspect” old value still being cached on 1 of 6 application servers. adobe's documentation states client variables cached memory not go further details. 1) has experienced issue , found resolution? 2) implications of moving sticky session while keep using client variables? i think first take closely @ database commits. client vars retrieved @ "beginning" of request , updated @ "end" of request changes. consider ...

web services - GET Request with Content-Type and Accept header with JAX-RS Jersey 2.2 -

i try access open data web service gives me traffic infos. documentation says requests have get , need contain accept: application/json , content-type: application/json . don't understand why need content-type ok: i tried retrieve data accept: header i'm getting 415 unsupported media type . trying way (but i'm not sure if setting both headers correctly): string entity = clientbuilder.newclient().target(livedatauri) .path(livedatapath) .request(mediatype.application_json) .accept(mediatype.application_json) .get(string.class); as see using jersey 2.2 , i'm still getting 415 unsupported media type . edit so got work don't understand why. isn't accept(mediatype.application_json) , header("content-type","application/json") same? string responseentity = clientbuilder.newclient() .target(livedatauri) .path(livedatapath) .request(mediatype.application_json) .header("content-type", ...

sql - Rails with postgres - activerecord query: sort by column ASC, then group by column -

i have model laps, belongs :car so each car has many laps, need query pull in top 10 fastest laps, pull in fastest lap per each car. in other words, not want 1 car allowed have 5 of top 10 fastest laps in list. each lap has :car_id field. want group on column, , pull out lap min(lap.time) row grouping. (aka fastest lap time unique :car_id). so postgres, best approach this? can order laps first, group, , pull first group. or grouping not keep sort order? here schema lap model: create_table "laps", force: true |t| t.decimal "time" t.string "video_url" t.integer "car_id" t.datetime "created_at" t.datetime "updated_at" t.integer "user_id" t.boolean "approved" end do have use 2 combined queries this? i can unique car id's lap doing this: select('distinct on (car_id) *') but, need order laps gets min(lap.time) per car_id. when throw on order ...

linux - Kernel Modul and SSL -

at moment working on kernel module of ccn-lite ( http://www.ccn-lite.net/ ). need security functionality (sha1 , public/private key authentificaton). user-space use openssl library, cannot use library in kernel module. it hard pick functions out of openssl , add them kernel module, because of them have dependencies libc. is there any security function in linux kernel, use? edit: can compute hash function of data received on ethernet: struct scatterlist sg[1]; struct crypto_hash *tfm; struct hash_desc desc; tfm = crypto_alloc_hash("sha1", 0, crypto_alg_async); desc.tfm = tfm; desc.flags = 0; crypto_hash_init(&desc); sg_init_table(sg, array_size(sg)); sg_set_buf(&sg[0], input, length); crypto_hash_digest(&desc, sg, length, md); crypto_free_hash(tfm); and want verify signature field of data using function digsig_verify. verified = digsig_verify(keyring, sig, sig_len, md, md_len); as far can see, second parameter signature, third len of signatu...

objective c - Singleton pattern with parameter -

in iphone application, i'm using subclass of afhttpclient access rest web service. want requests handled 1 instance of api client use singleton pattern. this works fine when service running on once url. can use constant value set url. now, in final version of application, each app talk service installed in corporate network. so getting service url remote configuration. singleton pattern still choice here? how supposed parameterise if url change during runtime of app ? cheers #import "fooapiclient.h" #import "afjsonrequestoperation.h" static nsstring * const kfooapibaseurlstring = @"http://192.168.0.1"; @implementation fooapiclient + (instancetype)sharedclient { static fooapiclient *_sharedclient = nil; static dispatch_once_t oncetoken; dispatch_once(&oncetoken, ^{ _sharedclient = [[self alloc] initwithbaseurl:[nsurl urlwithstring:kfooapibaseurlstring]]; }); return _sharedclient; } - (id)initwithbaseurl...

floating point - Why do doubles work how they do -

i know may common question, have never found answer (and maybe has not knowing how search google correctly, if can point me reference, remove question). why doubles work how in terms of representing right side of decimal inverse power of 2, , left side of decimal power of 2? know allows large numbers represented, there other advantages? .net framework has decimal data structure available, seems more logical use becuase how represent numbers in human notation. really, question why doubles created way instead of creating decimal instead (which seems far less common). your confusion seems unfounded. right side of decimal point always represented in inverse power of base , left side always represented power of base. true base 10 , base 2 well. binary floating point numbers store exponent controls decimal point on mantissa. as why exist: binary floating point notation has 2 convenient properties: it relatively fast, because uses binary arithmetic it can represent e...

matlab - Get index of current element of a 2-D matrix within arrayfun -

let m matrix: m = rand(1000, 2000); consider following code example: a = zeros(size(m)); row = 1:1000 col = 1:2000 a(row, col) = m(row,col)*(row + col); end end how compute matrix a without for loops? there arrayfun function, don't know how index of current element: a = arrayfun(@(x)(x*(index(1) + index(2))), m); %// how index??? perhaps there other solutions (and without loops)? you can simple follows matrix represent row+col , multiply m m = rand(1000, 2000); rowpluscol = bsxfun(@plus,(1:size(m,1)).',1:size(m,2)); = m.*rowpluscol; from experience bsxfun extremely powerful function , can save run time, , perfect example of that.