dynamic-data

What's the best and easiest way to Populate a dropdown based on another dropdown

蹲街弑〆低调 提交于 2019-11-26 21:44:11
问题 Very simply, I have one dropdown menu dynamically populated with data: SQL Code $querycourse = "SELECT course, COUNT(course) AS count FROM acme WHERE course IS NOT NULL GROUP BY course "; $procc = mysqli_prepare($link, $querycourse); $queryc = mysqli_query($link, $querycourse) or die(mysqli_error($link)); PHP Code echo "<select name='course[]' value='' multiple='multiple' size=10>"; // printing the list box select command echo "<option value=''>All</option>"; while($ntc=mysqli_fetch_array(

How do I name variables dynamically in C#?

江枫思渺然 提交于 2019-11-26 20:31:52
Is there a way to dynamically name variables? What I need to do is take a list of variable names from an input file and create variables with those names. Is this possible? Something like: Variable <dynamic name of variable here> = new Variable(input); Assume that I already have the Variable class taken care of, and the name of the variable is contain in a string called strLine . Use a Dictionary<string, Variable> . e.g. var vartable = new Dictionary<string, Variable>(); vartable[strLine] = new Variable(input); C# 4.0, using the dynamic objects: dynamic d = new ExpandoObject(); ((IDictionary

How to give dynamic file name in the appender in log4j.xml

萝らか妹 提交于 2019-11-26 19:54:11
I am using log4j to log information. I have used a log4j.xml file for creating log files. I have given the absolute path for each log file as a param tag value. E.g.: <appender name="FA" class="org.apache.log4j.DailyRollingFileAppender"> <param name="DatePattern" value="'_'yyyyMMdd"/> <param name="File" value="D:/logFiles/GPreprocessor.log"/> <layout class="com.dnb.genericpreprocessor.common.log.AppXMLLayout"/> </appender> I do not want to write "GPreprocessor.log" directly. Actually, that file name is dynamic, based on my project's name. For example, if I run the program ABC.java, logging

Dynamic Database Schema

别等时光非礼了梦想. 提交于 2019-11-26 19:21:03
What is a recommended architecture for providing storage for a dynamic logical database schema? To clarify: Where a system is required to provide storage for a model whose schema may be extended or altered by its users once in production, what are some good technologies, database models or storage engines that will allow this? A few possibilities to illustrate: Creating/altering database objects via dynamically generated DML Creating tables with large numbers of sparse physical columns and using only those required for the 'overlaid' logical schema Creating a 'long, narrow' table that stores

getElementsByClassName not working [duplicate]

僤鯓⒐⒋嵵緔 提交于 2019-11-26 17:45:56
This question already has an answer here: What do querySelectorAll and getElementsBy* methods return? 9 answers I coded a php page that displays information from a mysql database neatly into tables. I would like to hide empty table rows with an onLoad event handler. Here is a sample table with code that hides a <td> when it has no content. but i can only get it to work with different IDs: <script type="text/javascript"> function hideTd(id){ if(document.getElementById(id).textContent == ''){ document.getElementById(id).style.display = 'none'; } } </script> </head> <body onload="hideTd('1')

Why does jQuery UI's datepicker break with a dynamic DOM?

徘徊边缘 提交于 2019-11-26 17:37:04
问题 I'm working with a dynamic DOM here, and have called the jQuery UI datepicker to all inputs with a specific class name, in this case .date It works great with the first, static, construct but when I clone it the event handlers don't seem to want to move over. I get the Firebug error: inst is undefined I tried looking into jQuery's new live() function but couldn't combine the two. Any ideas? 回答1: Ah, got it. Right after I append the HTML to the DOM I run this on all the inputs I'd like to have

AngularJS dynamic form from json data (different types)

不羁的心 提交于 2019-11-26 15:35:46
问题 I try to create a dynamic form in AngularJS using the data from a JSON. I have this working: HTML <p ng-repeat="field in formFields"> <input dynamic-name="field.name" type="{{ field.type }}" placeholder="{{ field.name }}" ng-model="field.value" required > <span ng-show="myForm.{{field.name}}.$dirty && myForm.{{field.name}}.$error.required">Required!</span> <span ng-show="myForm.{{field.name}}.$dirty && myForm.{{field.name}}.$error.email">Not email!</span> </p> <button ng-disabled="myForm.

Pivots with dynamic columns in SQL Server

て烟熏妆下的殇ゞ 提交于 2019-11-26 14:46:06
问题 I am working on an SQL Query using pvots with dynamic columns in SQL Server (T-sql). Rather than submitting my lengthy query, I’m illustrating my problem with a simplified model. I create 2 tables: Table1 and Table2 and populate them with a few entries as follows: Table1: Col_ID1...............Col_Name 1.........................Jan-11 2.........................Feb-11 3.........................Mar-11 Table2: Col_ID2......Account.....AccountName......Amount 1...............121..........

How do I name variables dynamically in C#?

╄→尐↘猪︶ㄣ 提交于 2019-11-26 12:17:22
问题 Is there a way to dynamically name variables? What I need to do is take a list of variable names from an input file and create variables with those names. Is this possible? Something like: Variable <dynamic name of variable here> = new Variable(input); Assume that I already have the Variable class taken care of, and the name of the variable is contain in a string called strLine . 回答1: Use a Dictionary<string, Variable> . e.g. var vartable = new Dictionary<string, Variable>(); vartable[strLine

How do you dynamically allocate a matrix?

牧云@^-^@ 提交于 2019-11-26 12:12:00
问题 How do you dynamically allocate a 2D matrix in C++? I have tried based on what I already know: #include <iostream> int main(){ int rows; int cols; int * arr; arr = new int[rows][cols]; } It works for one parameter, but now for two. What should I do? 回答1: A matrix is actually an array of arrays. int rows = ..., cols = ...; int** matrix = new int*[rows]; for (int i = 0; i < rows; ++i) matrix[i] = new int[cols]; Of course, to delete the matrix, you should do the following: for (int i = 0; i <