Mapping json to multiple Pojo classes

So I'm working on a project for a Java class and I need to fetch weather data. I'm using the weather underground api. I haven't really learned yet how to do APIs so I'm self taught. I've gotten a location API working by using JsonSchemaToPojo to cre...
more »

2017-11-29 21:11 (0) Answers

class lookup function python

I have a class class Kaart: def __init__(self, rows = 10, colls = 10): self.rows = rows self.colls = colls self.matrixRC = [] for _ in range(rows): self.matrixRC.append([2 for _ in range(colls)]) and I was wondering if th...
more »

2017-11-29 09:11 (2) Answers

Java - Class<? extends Collection>

I would like to add multiple class in below jackson deserialize. But how do i do that? below is the sample code. XmlMapper mapper = new XmlMapper(); JaxbAnnotationModule module = new JaxbAnnotationModule(); mapper.registerModule(module); AnnotationI...
more »

2017-11-23 16:11 (1) Answers

Java 9: How to find every new method added

With the release of Java 9, numerous methods have been added to many classes, most (if not all) of which contain the following in their documentation: Since: 9 Does a collection of these new methods exist? If so, where is it located? If not, ...
more »

2017-11-08 19:11 (2) Answers

Private access in inheritance

class Person { public $name; private $age; //private access } class Employee extends Person{ public $id; public $salary; //class property } $emp = new Employee(); $emp->name="ABCD"; $emp->age = 30; $emp->id=101; $emp-...
more »

2017-11-08 11:11 (5) Answers

Add Constructor To Integer

I'm trying to learn how to use Constructors and I wanted to test myself so I made a little program. It asks for your name and your age then after you give said results it prints your full name and the year you were born in. The constructor automatica...
more »

2017-10-21 10:10 (1) Answers

NameError for defined class variable

Below, the artifact_urls class variable is clearly defined, and there is no problem referencing it in a print statement or dict constant, but referencing it from within a list comprehension raises a NameError. Why?!?! Here's the code and output. fro...
more »

2017-10-19 22:10 (0) Answers

Extend Laravel class used by vendor

What I want Extend Laravel class used by vendor, specifically this one: https://github.com/laracasts/flash and the Flash/Message.php class. Why I want In order to add some class parameters for customization purposes. What have I tried Everything...
more »

2017-10-18 03:10 (1) Answers

Pass event through classes C#

I have a first class that raises an event when some changes occur: public class MyFirstClass { public event EventHandler ChangesHappened; public MyFirstClass() { } public void MyMethod() { //Thing happened Changes...
more »

2017-10-14 01:10 (3) Answers

python __init__ vs class attributes

I am very new to programming. I just started for couple weeks. I spent hours reading about class but I am still confused. I have a specific question. I am confused on when to use class attributes, and when to use initializer (__init__). I understan...
more »

2017-10-13 02:10 (4) Answers

How to use a member function with std::bsearch

I have a C++ class but I'm also using some low level C and need to use the bsearch function. The last argument of bsearch is a comparison function, and I want to implement said function in a way that will allow it to access const private variables of...
more »

2017-10-10 09:10 (2) Answers

__add__ two class objects

I've been learning Python 2 by searching for tutorials. I'm discovering things about class. I have some trouble in __add__ dunder-method. I don't know how to add 2 objects of a class. To be clearer: class Add_obj: def __init__(self, *num): ...
more »

2017-09-25 16:09 (2) Answers

Converting model class to XML

I have the next classes in vb.net: Class A Public Property Bs As New List(Of B) End Class Class B Public Property D As String Public Property E As String End class I wish to convert them in xml using next code: Dim sw1 = New StringW...
more »

2017-09-13 12:09 (1) Answers

property() returns different values

I am trying to fill the gap in my understanding of Pythons property(). Below is the code that I have come up with, to understand property(): class Temperature: def __init__(self, temp = 10): self.set_temp(temp) def to_farenheit(self...
more »

2017-09-10 21:09 (3) Answers

New dart file doesn't use flutter?

I'm using classes from a new dart file in flutter, but it doesn't use the same dependencies and autocompletes as my main.dart file even after importing import 'package:flutter/material.dart'; and import 'package:flutter/services.dart';. What am I do...
more »

2017-08-28 06:08 (1) Answers

Python: Iterator returns None

Here is my code: class Prizes(object): def __init__(self, purchases, n, d): self.p = purchases self.n = n self.d = d self.x = 1 def __iter__(self): return self def __next__(self): print(s...
more »

2017-08-28 02:08 (2) Answers

python class methods and inheritance

I would expect the following code to print 012345 but it prints 012012. Why? I would expect the calls to incr to be accessing the same variables since they are inherited from the same class but they are clearly different variables. class a(object): ...
more »

2017-08-26 20:08 (2) Answers