Posts

c++ - How to get string data back using pointer? -

i can not string data using pointer char array. give me explanation doing wrong please. #include "stdafx.h" #include <conio.h> #include <string> using namespace std; string getstring() { return string("255"); } int _tmain(int argc, _tchar* argv[]) { char* str_p = const_cast<char*>(getstring().c_str()); printf("pointer : %s\n", str_p); string str; str = str_p[0]; str += str_p[1]; str += str_p[2]; printf("constructed : %s\n", str.c_str()); _getch(); return 0; } the console output : pointer : constructed : there lot wrong line: char* str_p = const_cast<char*>(getstring().c_str()); getstring() returns temporary string . gets destroyed @ end of line. end dangling pointer internal data deallocated. furthermore, const_cast should ever using if really really need - editing data directly asking trouble. if want pointer string, right thing is: string old = get...

java - Will Proguard or the Compiler Precalculate TimeUnit.Minutes.toMillis(120) -

currently have class following effectively constant field. private static final long activity_timeout_ms = 1 * 60 * 1000; this fine, still not readable code in world. i'd rather use following: private static final long activity_timeout_ms = timeunit.minutes.tomillis(1); which states want time 1 minute field milliseconds. my question either compiler or perhaps proguard fix there no performance hit? if there performance hit, can expect 1 time hit per instance of class? yes, one-time hit on class loading, , such tiny fraction of class loading it's not measurable against overhead of loading class in first place. no, compiler can't figure out, , surprised if proguard could, doesn't matter.

c# - Kendo UI TreeListDataSource Read() only works when running locally -

Image
i have kendo treelist datasource defined as var ds = new kendo.data.treelistdatasource({ transport: { read: { url: "/home/read/", type: "post", datatype: "json" }}, schema:... } my controller's read method is: [httppost] public string read() { log.info("start read()"); var vm = vmhelper.getclientorglistviewmodel(); var json = new javascriptserializer().serialize(vm.facilitylist); log.debugformat("json read returned: {0}", json); return json; } everything works great long run locally through vs once deploy our staging server, read() transport code never gets executed. 500 error. pressing f-12 view requests in ie shows 500 error any ideas or suggestions on why works locally not on server , how resolve is...

xsd - How to prevent service on Oracle Service Bus (OSB) from changing xmlns prefix/aliases to random things? -

we have requirement send specific namespace alias client , must use osb. proxy service changes name space aliases of exposed wsdl crafted. cannot find option prevent osb doing so. for example for namespace http://schemas.xmlsoap.org/wsdl/ , original wsdl start has <soap:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/"/> but osb exposes wsdl this <wl5g3n0:definitions xmlns:wl5g3n0="http://schemas.xmlsoap.org/wsdl/"/> the original alias "soap" automatically changed "wl5g3n0" osb , causing problem. same type of renaming happening many of referenced xsd files. how prevent renaming of aliases in osb? i got answer oracle community forum and closing this . seems knowledgeable osb said there no known way him turn auto renaming off. it seems answer "no, cannot turn off automatic renaming of xmlns prefix in osb"

How to dynamically set the local maven repo for a jenkins job -

i'm trying create jenkins job using jenkins remote access api[1]. want achieve is, want specify local maven repository job(instead of using global repository), using job configuration(config.xml) send create job api. how can achieve that? xml attributes should have added(or changed)? [1] https://wiki.jenkins-ci.org/display/jenkins/remote+access+api according api that: curl -x post -h "content-type:application/xml" -d @config.xml "http://jenkins_host/createitem?name=some_job_name"

Assigning variables in loop Python -

i have piece of: as, bs, cs, ds, es = ([] in range(5)) line in infile: line = line.rstrip() a, b, c, d, e = line.split('\t') += [a] bs += [b] cs += [c] ds += [d] es += [e] since have many more 5, want loop takes less lines of code writing of out. like: as, bs, cs, ds, es = ([] in range(5)) dynamic_variable_list = [as, bs, cs, ds, es] line in infile: line = line.rstrip() in range(len(line.split('\t'))): dynamic_variable_list[i] += line.split('\t')[i] which in case stores individual characters in list, whereas: dynamic_variable_list[i] += line.split('\t') stores tab delimited entries each of variables of dynamic_variable_list . need store of tab delimited entries in separate variables top example shows. dynamic_variable_list[i] += line.split('\t')[i] can rewritten as as += rather than as += [a] either surround in brackets before, or use append . or rat...

ember.js - Rendering models from an ember-data store, using a http-mock server and RESTAdapter fails -

i'm having issued hooking ember-data http-mock using simple model. want load api containing properties, , render them list on page. when navigating /properties/ route described below, error being thrown: error: not found @ ember$data$lib$system$adapter$$adapter.extend.ajaxerror (rest-adapter.js:714) @ ember$data$lib$system$adapter$$adapter.extend.ajax.ember.rsvp.promise.hash.error (rest-adapter.js:789) @ jquery.callbacks.fire (jquery.js:3143) @ object.jquery.callbacks.self.firewith [as rejectwith] (jquery.js:3255) @ done (jquery.js:9311) @ xmlhttprequest.jquery.ajaxtransport.send.callback (jquery.js:9713) and template doesn't render. here's i've done: added property model: import ds 'ember-data'; export default ds.model.extend({ title: ds.attr('string'), date_added: ds.attr('date') }); added 'routes/properties.js' looks this: import ember 'ember'; export default embe...