Posts

java - How to cast to run superclass method -

this question has answer here: overriding methods in java , casting object parent class behavior 5 answers is there way use casting m1() method run in i1 class print in i1 class ? don't want run overridden method. class testclass extends i1 implements i2{ public void m1() { system.out.println("hello"); } public static void main(string[] args){ i1 tc = new testclass(); tc.m1(); } } class i1{ int value = 1; public void m1(){system.out.println("in i1 class");} } interface i2{ int value = 2; void m1(); } no, can't this. part of point of polymorphism able hide implementation detail classes lower down in hierarchy. can invoke superclass method, call inside overridden method. think this. maybe testclass important inside method m1 maintains in...

Thinktecture Identity Server 3 Asp.Net Identity Sample, constantly getting 401 authorization denied -

i trying asp.net identity sample of identity server working in web api project, , beginner trying work on getting tokens , sending request apis using the bearer tokens. so using fiddler, can send request https://localhost:44333/core/connect/token following content: client_id=roclient&client_secret=secret&grant_type=password&username=bob&password=mypass&scope=read write offline_access , works fine, access token , refresh token. then have web api project in solution, has code use bearer token: app.useidentityserverbearertokenauthentication(new identityserverbearertokenauthenticationoptions { authority = "https://localhost:44333", validationmode = validationmode.validationendpoint, requiredscopes = new[] { "api1" } }); and test controller in api protected using [authorize] decorator. as said, fetching token works fine, when use fiddler send request api "401 authorization deni...

c# - Using ComTypes.ITypeInfo.CreateInstance object's information to expose interfaces within a coclass -

i'm working unmanaged type libraries , reference files in c# (.net) application information out of them, such interfaces, functions, enums, etc, contain. have object of type comtypes.itypeinfo represents coclass. i've written code coclass's name, want list of names of interfaces contained within coclass. couldn't find "easy-access" properties in system.runtime.interopservices.comtypes namespace, meet end, i'm using itypeinfo.createinstance . understanding, doing can out com object of type object , desired information (i'm beginner @ com feel free point out i'm incorrect). i can way i've made call on coclass , got out object of type "object {system.__comobject}", i'm not sure go there. how can use coclass com object obtain names of interfaces contains? here's code i'm using coclass com object: //assume ti object below initialized object of typekind.tkind_coclass comtypes.itypeinfo ti; if(//condition know ti coclass)...

How to I parse JSON list of dictionaries in javascript -

i'm new javascript , need iterate through json list of dictionaries create list each key. here's json: [ { "date": "aug. 14, 2015", "reel": "reel 1", "job": "color correction", "status": "in progress", "completion": "60" }, { "date": "aug. 14, 2015", "reel": "reel 1", "job": "conform", "status": "in progress", "completion": "70" }, { "date": "aug. 14, 2015", "reel": "reel 2", "job": "scanning", "status": "complete", "completion": "100" }, { "date": "aug. 12, 2015", "reel": "reel 1...

objective c - May I implement one function of protocol in subclass? -

i modified it. problem if want have subclass inherit baseparticipant, may re-implement func performevent inside subclass? example: class cyclingparticipant: baseparticipant, participant { init(name: string) { super.init(name: name, preferredevent: event.cycling) } func performevent(event: event, distance: distance) throws { } } but compiler said "redundant conformance of cyclingparticipant protocol participant . class baseparticipant: participant { var name: string var preferredevent: event var racetime: int var couldnotfinish: bool //var performedevent: event // in swift, class accepts protocol must impletment funcs inside protocol init(name: string, preferredevent: event) { self.name = name self.preferredevent = preferredevent self.racetime = 0 self.couldnotfinish = false } func getname() -> string { return self.name } func getpreferredevent() -> event { return self.preferredevent } func isdisqualified() -> bool { ...

Java code - number of files in a JAR -

i want find number of files jar contains. there way without looping through this: while (enumentries.hasmoreelements()) { enumentries.nextelement(); count++; } i want have number of files before loop through entries. seems not elegant loop through them twice. you can use size() count number of entries that's loop return. uses jarfile f = new jarfile(new file("path.jar")); system.out.println(f.size());

javascript - Highcharts addPoint function show nothing -

in first case apologize bad english i'm french :d so tried show timed data on highchartsjs. i try receive data using ajax , made function add point want. but when try load see information on cursor no point shown ! :/ here success function on ajax request : success: function(resultat){ function addpoint(){ var chart = $('#graphresult').highcharts(); for(i in resultat){ chart.series[0].addpoint([date.utc(year, month, day, resultat[i]["time"].split(":")[0]), resultat[i]["value"]], true); } } $('#graphresult').highcharts({ chart: { type: 'spline', events: { load: addpoint } }, title: { ...