dynamic

C# get all property conditionally from dynamic collection (which looks like tree)

青春壹個敷衍的年華 提交于 2019-12-24 18:26:55
问题 let's say I have a dynamic collection, which consists set of key-values. for example: [ { key: test1, value: [ { key:c1level1, value: [ { key:settings-key, value: c1level2Val }, { key: types, value: typesVal } ] } ] }, { key: test2, value: [ { key:c2level1, value: [ { key:settings-key, value: c2level2Val }, { key: types, value: typesVal } ] } ] } ] and I want to get all the objects which have a key named "settings-key" and "types" and save them together in a List for example. How can I

Update index dynamically doesn't work (Spring Data Elasticsearch)

折月煮酒 提交于 2019-12-24 18:18:49
问题 I have a model which is: @Document(indexName = "index", type = "logs") public class Log { @Id private String id; private String test_no; private String entire_log; private String method; private String timestamp; private String thread_name; private String level; private String logger_name; private String formatted_message; // CONSTRUCTORS, GETTERS AND SETTERS... } I have an applicationContext.xml file which contains a bean, used to save the value of the dynamic index. The location of this

Populating a form dynamically based on user input in ASP.Net MVC

元气小坏坏 提交于 2019-12-24 18:11:16
问题 My question is similar to Engram's here, but my question goes a bit further. The way i intend it to work is I have a textbox asking how many entries a user is going to make. After they input the number, I need to create that many more textboxes to allow for entries (and then repeat the same process with those textboxes, but baby steps first...) I tried collecting the keys on the post, but it only returns the initial textbox asking for the number of entries. I'm still trying to get a grasp on

Dynamically allocated 2d array

不羁的心 提交于 2019-12-24 17:17:16
问题 I'm trying to create a 2d array, specifically an adjacency matrix for directed graphs. I've never tried this with dynamic memory allocation before and I've hit a snag. Here's the code: int n, i; printf("Number of nodes is: "); scanf("%d", &n); int ** array = malloc(n * sizeof(int*)); for(i = 0; i < n; i++) array[i] = malloc(n * sizeof(int)); printf("Number of edges is: "); scanf("%d", &m); int x, y; for(i=0;i<m;i++) { scanf("%d %d", &x, &y); array[x][y]=1; } As soon as I finish entering all

SSRS matrix pivot

不想你离开。 提交于 2019-12-24 16:54:38
问题 I have following structure: Col1 Col2 Col3 --------------- F P R1 F P R2 F P R3 F P R4 Col3 values can be anything. Now I want, in following format, only the top 3: Col1 Col2 Res1 Res2 Res3 ------------------------------ F P R1 R2 R3 I tried it using Matrix, but I m not able to separate the result as 3 columns. Basically, the end user opens this report in Excel and applies filter and sorting to it. 回答1: I suggest editing the filter on the grouping of col3 - as follows: Right-click on the

jquery: load values from external html and populate many local <div> fields, with one read of the html

牧云@^-^@ 提交于 2019-12-24 16:53:23
问题 I'm using this code now, works great except that it makes three requests to the webserver: var refreshspeed=1000 function moreSnow() { $("#uptimedynamic").load("index.html #uptimedynamic"); $("#cpuloaddynamic").load("index.html #cpuloaddynamic"); $("#meminfodynamic").load("index.html #meminfodynamic"); setTimeout("moreSnow()", refreshspeed); } Can someone tell me how to make it do the same thing, but with only one read of index.html? It needs to stay in the same repeating loop setup :) 回答1:

Run unit tests on dynamically created DLL

≯℡__Kan透↙ 提交于 2019-12-24 16:32:00
问题 I am thinking on how to implement this , and seems like my knowledge is too poor to understand the implementation. I have a code that compiles source code to DLL. Then I need somehow to run Unit test on this Dll , and check 3-4 methods inside. I am trying to run unit tests this way. CompilerResults compileResults = codeProvider.CompileAssemblyFromSource(compilerParameters, new string[] { sourceCode }); Assembly myAssembly = compileResults.CompiledAssembly; TestPackage testPackage = new

finding numbers of days between two date to make a dynamic columns

狂风中的少年 提交于 2019-12-24 16:19:58
问题 Dear all, I have a select query that currently produces the following results: DoctorName Team 1 2 3 4 5 6 7 ... 31 Visited dr. As A x x ... 2 times dr. Sc A x ... 1 times dr. Gh B x ... 1 times dr. Nd C ... x 1 times Using the following query: DECLARE @startDate = '1/1/2010', @enddate = '1/31/2010' SELECT d.doctorname, t.teamname, MAX(CASE WHEN ca.visitdate = 1 THEN 'x' ELSE NULL END) AS 1, MAX(CASE WHEN ca.visitdate = 2 THEN 'x' ELSE NULL END) AS 2, MAX(CASE WHEN ca.visitdate = 3 THEN 'x'

Using dynamically created classes in a Single Table Inheritance mechanism

与世无争的帅哥 提交于 2019-12-24 15:52:07
问题 I have an ActiveRecord class called 'DynObject' which can be used for inheritance.. On initialization I dynamically create some Classes that inherit from it: classes_config = { foo: 'foo', bar: 'bar' } classes_config.each do |name,options| klass = Class.new( DynObject ) do end self.klasses[name] = const_set( "#{name.camelize}DynObject", klass ) end This is all good, these classes are created just fine.. But when ActiveRecord tries to load created records the STI mechanism failes..

Finding MIN and MAX Values for All Table Columns

流过昼夜 提交于 2019-12-24 14:38:59
问题 This query works as intended, but it's just really slow. Does anyone here have recommendations to improve performance? I essentially just creating a temp table to store all the table and column names, and cycling through them via a WHILE statement, to create dynamic inserts into another table with the details I want. My latest run took about 21 minutes, which isn't entirely terrible (considering the task), but I'd love to get some input on how/where it can be fine tuned. USE <DATABASE>; IF