Deserialize json with abstract class

I want to deserialize json messages via json.net, and I have the following json object (which might not be optimal!!!) { "deviceId":"XXXX", "messages": [ { "type":"messageType1", "version":1, "content": { "p...
more »

2017-02-22 17:02 (0) Answers

PHP Class and Function return

I have problem with PHP class and function. My class file is: <?php class EF_IP{ public function ip_adresa(){ // dobivanje IP adrese if (!empty($_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP']; return $ip...
more »

2017-02-22 15:02 (2) Answers

Requesting Api Call using cURL

Someone could help me ? I'm trying to do a request by the code bellow, but anything happen, any message appears. I believe my code it's right: public function subscribe(){ $json_url = 'https://apisandbox.cieloecommerce.cielo.com.br/1/sales/'; ...
more »

2017-02-22 15:02 (2) Answers

how to create a class built on file.io

I am writing a module that converts between several different file formats (e.g. vhdl to verilog, excel table to vhdl etc). Its not so hard but there is a lot of language specific formatting to do. It just occurred to me that an elegant way to do t...
more »

2017-02-22 10:02 (2) Answers

Game Entity Update Methods

I am writing a game in C++ with the SDL2 graphics library. I am using classes with inheritance to define entities in my game. Entity -> Player -> BadGuy -> Bullet In this example, Player, BadGuy, and Bullet are all subclasses of Entity. I...
more »

2017-02-22 05:02 (1) Answers

Modifying variables in subclass instances

I've become hopelessly addicted to Screeps recently, and I refactored some code to make a task-based implementation. Tasks are things like "walk to and then harvest until you are at full capacity" and are based off of a single base task template writ...
more »

2017-02-21 20:02 (1) Answers

Strange object counting in Python

I am trying to experiment with objects -- I want an object that can count the number of instances there are. My code: class Location: count = 0 def __init__(self, column, row): self.column = column self.row = row se...
more »

2017-02-21 12:02 (1) Answers

yii2 detailview conditional row class

I would like to change class for one single attribute in detailview, based on a condition: If I wouldn't want to make it conditional, it would be working like so: [ 'attribute' => 'ungueltig', 'format' => 'boolean', 'contentOption...
more »

2017-02-21 09:02 (1) Answers

Class inheritance

Consider the following code: class A(object): a = [] @classmethod def eat(cls, func): print "called", func cls.a.append(func) class B(A): @A.eat def apple(self, x): print x A.eat(lambda x: x + ...
more »

2017-02-21 06:02 (2) Answers

Python main function in class

I'm new to python and the main() method and class def's are confusing me. I'm trying to create a bloom filter and my program keeps terminating because I don't think I'm calling things correctly. class BloomFilter(object): def __init__(s...
more »

2017-02-20 21:02 (2) Answers

Setting Class Object Array Property

I'm trying to set a property of an object which is part of a class object array, for excel in VBA. The code looks like this: Dim myClass(5) as class1 Dim i as integer For i = 0 to 5 set myClass(i) = New class myClass(i).myProperty = "SomeV...
more »

2017-02-20 16:02 (1) Answers

C++ How to Trigger Class Destructor

I'm developing a class to process config files, which consist of a number of segments, each segment with a number of key:value elements. I have the following code (pared down to just the basic issue): class cfgElement { public: char ...
more »

2017-02-20 16:02 (1) Answers

Delete from list for a certain value

I have mini class, which I save in List. Now I must delete in list, lines where numRect = -1. How can I do it? double pointX, pointY; int numRect; public PointsSelectedSources(double x, double y, int numRect) { pointX = x; pointY = y; t...
more »

2017-02-20 06:02 (1) Answers

CSS Hover doesn't accept class name

I'm trying to make an accordian like menu to work. I've found a nice one here https://www.script-tutorials.com/css3-onclick-vertical-metal-menu, and now I'm trying to make adjustments. The ideia is to change the color of sub menu options, with CSS ho...
more »

2017-02-20 01:02 (1) Answers