dynamic

Dynamically change view inside view in Android

假装没事ソ 提交于 2019-12-18 05:11:32
问题 I have this RelativeView with 3 radiobuttons on top. I want to change the bottom part of the view when the user clicks on one of the buttons. The blue part is the place i want to load different Views in. @Override public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == iVerzekeringen){ layout.removeView(body); // THIS PART IS layout.addView(testview); // NOT WORKING } else if (checkedId == iPersoonlijk){ } else if (checkedId == iNotities){ } } How can i load different

Dynamic java bean from xsd

核能气质少年 提交于 2019-12-18 05:07:11
问题 I have two applications, one acting as client and the other as server. In server application I generate ObjectFactory and classes using xjc from Eclipse. As a result, one of this classes is called widgetEvenCall. From the xsd: ... <xs:element name="widgetEventCall"> <xs:complexType> <xs:sequence> <xs:element minOccurs="1" maxOccurs="1" ref="tns:widgetEventDescriptor" /> <xs:element minOccurs="0" maxOccurs="unbounded" ref="tns:widgetParameter" /> </xs:sequence> </xs:complexType> </xs:element>

Creating dynamic variable names in C#

孤街醉人 提交于 2019-12-18 04:23:12
问题 I am trying to write a simple role playing game in C# to become more familiar with the language. I have a class that loads data from CSV file, creates an object, and places it in a dictionary. Because every aspect of the game has different data (items, actors, skills, etc), I have set up each of these as a class, but this requires me to re-implement a Load() method for each one. After doing this 5 or 6 times, I am wondering if there isn't a better way to implement this. Basically, what I

Proper way to pass dynamic arrays to other functions

落花浮王杯 提交于 2019-12-18 04:12:51
问题 What's the most "proper" way to pass a dynamically sized array to another function? bool *used = new bool[length](); I've come up with a few ways that compile but I'm not too sure on what the correct way is. E.g. Would these pass by value? static void test(bool arr[]) static void test(bool *arr) Would this one pass by reference? static void test(bool *&arr) Thanks 回答1: Actually, the two first ideas pass the array by address and the third passes the array by reference . You can devise a little

Objective C: Why do we declare ivars in the .h member area if @property seems to do it automatically?

夙愿已清 提交于 2019-12-18 04:01:30
问题 In implementing an interface it seems the common method in tutorials and literature is to declare an ivar and then set the @property then @synthesize . @interface MyClass : NSObject { NSString *myString; } @property (nonatomic, retain) NSString *myString; @end However, omitting the explicit declaration and just putting @property has the same effect. @interface MyClass: NSObject { } @property (nonatomic, retain) NSString *myString; @end So how come most people use @property and an explicit

Does C# pick the wrong type for var when parsing a dynamic object?

三世轮回 提交于 2019-12-18 03:58:16
问题 I am using the following code to convert some Json into a dynamic object. When I use DateTime.Parse on a property of my dynamic type I would expect the var to guess that it's type is a DateTime... instead, it stays as a dynamic. This can't be right, can it? Full example below. var settings = new JavaScriptSerializer().Deserialize<dynamic>(json); var startDate = DateTime.Parse(settings.startDate); var endDate = DateTime.Parse(settings.endDate); var userId = int.Parse(settings.userId);

Dynamically Create Instance Method in PHP

自闭症网瘾萝莉.ら 提交于 2019-12-18 03:40:30
问题 I'd like to be able to dynamically create an instance method within a class' constructor like so: class Foo{ function __construct() { $code = 'print hi;'; $sayHi = create_function( '', $code); print "$sayHi"; //prints lambda_2 print $sayHi(); // prints 'hi' $this->sayHi = $sayHi; } } $f = new Foo; $f->sayHi(); //Fatal error: Call to undefined method Foo::sayHi() in /export/home/web/private/htdocs/staff/cohenaa/dev-drupal-2/sites/all/modules/devel/devel.module(1086) : eval()'d code on line 12

Ruby Dynamic Classes. How to fix “warning: class variable access from toplevel”

╄→尐↘猪︶ㄣ 提交于 2019-12-18 02:40:14
问题 I'm trying to write a program that dynamically defines ruby classes based on configuration read from a file. I know I can use Class.new to do this. Here's an example program: x = [1,2,3] Test = Class.new do @@mylist = x def foo puts @@mylist end end Test.new.foo When I run this I get the following output (running with ruby 1.9.3p0): c:/utils/test.rb:4: warning: class variable access from toplevel c:/utils/test.rb:7: warning: class variable access from toplevel 1 2 3 Does anyone know what

Have I implemented Y-combinator using C# dynamic, and if I haven't, what is it?

徘徊边缘 提交于 2019-12-18 02:28:26
问题 My brain seems to be in masochistic mode, so after being drowned in this, this and this, it wanted to mess around with some DIY in C#. I came up with the following, which I don't think is the Y-combinator, but it does seem to manage to make a non-recursive function recursive, without referring to itself: Func<Func<dynamic, dynamic>, Func<dynamic, dynamic>> Y = x => x(x); So given these: Func<dynamic, Func<dynamic, dynamic>> fact = self => n => n == 0 ? 1 : n * self(self)(n - 1); Func<dynamic,

IOS 8 UITableView self-sizing cells jump/shift visually when a new view controller is pushed

社会主义新天地 提交于 2019-12-18 02:18:05
问题 Here's how I set my table: self.tableView = [[UITableView alloc] initWithFrame:self.view.bounds]; self.tableView.delegate = self; self.tableView.dataSource = self; self.tableView.estimatedRowHeight = 150; [self.view addSubview:self.tableView]; Within my cells, I call - (CGSize)sizeThatFits:(CGSize)size to programmatically return the height (which is set in - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath . I'm not using constraints or