Posts

pass by value in java (primitive and arrays) -

this question has answer here: is java “pass-by-reference” or “pass-by-value”? 73 answers are arrays passed value or passed reference in java? [duplicate] 7 answers suppose have following code: public static void main(string[] args) { int x = 5; int [] array = new int[10]; swtich (x, array); system.out.println("x = " + x); system.out.println("y[0] = " + y[0]); } public static void switch(int number , int[] array){ number = 10; array[0] = 150; } why program prints 5 (doesn't change value) , prints number ordered in array[0] 150? thanks.

UBER with SSO using uber rides-android-sdk -

i'm trying data all_trips scope. i'm running few issues. 1) once add scope.all_trips .setscopes redirected verse being able login obtain token, therefore necessary data currentride() method. configuration = new sessionconfiguration.builder() .setclientid(client_id) .setredirecturi(redirect_uri) .setscopes(arrays.aslist(scope.history, scope.profile, scope.ride_widgets, scope.all_trips)) .setenvironment(sessionconfiguration.environment.sandbox) .build(); validateconfiguration(configuration); error: webpage not available webpage @ market://details?hl-en&id=com.ubercab&referrer=mat_cli%3 and goes on , one. once remove all_trips scope ability sign in. any great can move forward getting details driver, vehicle, rideid. private void loadalltrips(){ session session = loginmanager.getsession(); ridesservice alltrips = uberridesapi.with(session).build().create...

Is this interface being instantiated? (Java 8) -

as far know, interfaces cannot instantiated directly. however, whenever compile following code: interface {}; public class test { public static void main(string[] args){ a = new a() {}; system.out.println(a); it outputs tostring() of object of class test: test$16d06d69c and when change a = new a() {}; to a = new a(); it doesn't compile. why happening? interface being instantiated, or else happening behind scenes? you defining new anonymous inline class implements interface statement: a = new a() {}; and in same statement constructing new instance of new anonymous class definition. so no not instantiating interface.

xaml - StaticResource into MarkupExtension -

i'm trying use static resource extension entry's fontsize property. have code piece of code: <?xml version="1.0" encoding="utf-8" ?> <contentpage x:class="project.sources.pages.extras.editprofilepage" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:control="clr-namespace:project.sources.controls;assembly=project" xmlns:extension="clr-namespace:project.sources.extensions;assembly=project" xmlns:sys="clr-namespace:system;assembly=mscorlib"> <contentpage.resources> <resourcedictionary> <color x:key="nl_bluenight">#0e1728</color> <color x:key="nl_orangebeer">#e87e07</color> <color x:key="nl_orangesky">#bd4327</color> <color x:key="nl_white">#ececec...

javascript - Listening for specific DOM element insertion -

i wrote script lets me delete iframes page pressing button: window.addeventlistener('load', function() { var addbutton = document.createelement("button"); addbutton.innerhtml = "delete iframes"; addbutton.onclick = removealliframes; document.body.appendchild(addbutton); }); function removealliframes() { var iframes = document.getelementsbytagname("iframe"); (var frame of iframes) { frame.parentnode.removechild(frame); } } while works, wondering if possible listen iframe insertions , delete them appear on page. there sort of window.listentoelementinsertionbytag() method can automate this? otherwise use setinterval() , execute removealliframes() method on interval.

jersey - Map JAX-RS @PathParam to POJO Constructor With Annotations -

i want create endpoint has pathparam automatically calls constructor of object injected, has constructor of string argument. spell out in code: here resource @get @path("/{apiversion}" + "/item") public response version(@pathparam("apiversion") apiversion apiversion) { return response.ok().build(); } i want string automatically used in call apiversion constructor. in apiversion class public apiversion(string apiversion) { this.versionstring = apiversion; } is possible access annotations? not have access resourceconfig . yes, possible, without annotations other @pathparam , example you've given should work as-is. see https://jersey.github.io/documentation/latest/jaxrs-resources.html#d0e2271 (emphasis mine) : in general java type of method parameter may: be primitive type; have constructor accepts single string argument; have static method named valueof or fromstring accepts single string argument...

ruby on rails - How to create record in console - ROLLBACK TO SAVEPOINT active_record_1? -

i'm new rails , not sure error here when trying create cost code: [21] pry(main)> costcode => costcode(id: integer, biller_type: text, biller_id: integer, position: integer, parent_id: integer, code: text, name: text, updated_at: datetime, long_name_helper: text, deleted_at: datetime, sortable_code: text, created_at: datetime, standard_cost_code_id: integer) [22] pry(main)> costcode.create(code: '87678', name: "hex") (0.3ms) savepoint active_record_1 (0.2ms) set local procore.user_id=''; set local procore.company_id=''; set local procore.project_id=''; costcode exists (0.4ms) select 1 one "cost_codes" ("cost_codes"."code" = '87678' , "cost_codes"."biller_type" null , "cost_codes"."biller_id" null , "cost_codes"."parent_id" null , "cost_codes"."deleted_at" null) limit...