dynamic

How to conditionally filter on a column in a WHERE clause?

末鹿安然 提交于 2019-12-08 15:00:50
问题 OK, the umpteenth conditional column question: I'm writing a stored proc that takes an input parameter that's mapped to one of several flag columns. What's the best way to filter on the requested column? I'm currently on SQL2000, but about to move to SQL2008, so I'll take a contemporary solution if one's available. The table queried in the sproc looks like ID ... fooFlag barFlag bazFlag quuxFlag -- ------- ------- ------- -------- 01 1 0 0 1 02 0 1 0 0 03 0 0 1 1 04 1 0 0 0 and I want to do

How can I get working dynamic ToggleButton text under android?

泪湿孤枕 提交于 2019-12-08 14:46:21
问题 I've got a ToggleButton that's set up like: final ToggleButton filterButton = (ToggleButton) findViewById(R.id.filterTags); filterButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (filterButton.isChecked()) { // pop up the list of tags so the user can choose which to filter by // once one is chosen, the spinner will be updated appropriately showDialog(DIALOG_TAGS); } else { // going unpressed, set the the spinner list to everything updateSpinner(db

How to read in data into d3.js from multiple javascript arrays? And dynamically updating chart without refreshing the page

不问归期 提交于 2019-12-08 13:54:17
问题 Currently I have two arrays, one is a list of numbers titled nums, and the ms is a list of strings titled places. Ex. nums=[1,2,3,4,5] places = ["house","gym", "work", "school", "park"] both arrays are the same length. I want to make a bar chart with these arrays that looks similar to http://bl.ocks.org/mbostock/3885304, but the data is coming from these arrays rather than a tsv file. In Bostock's code the data is read in from a tsv file, the code is below. d3.tsv("data.tsv", type, function

Dynamic upsert in postgresql

本小妞迷上赌 提交于 2019-12-08 13:52:25
问题 I have this upsert function that allows me to modify the fill_rate column of a row. CREATE FUNCTION upsert_fillrate_alarming(integer, boolean) RETURNS VOID AS ' DECLARE num ALIAS FOR $1; dat ALIAS FOR $2; BEGIN LOOP -- First try to update. UPDATE alarming SET fill_rate = dat WHERE equipid = num; IF FOUND THEN RETURN; END IF; -- Since its not there we try to insert the key -- Notice if we had a concurent key insertion we would error BEGIN INSERT INTO alarming (equipid, fill_rate) VALUES (num,

ASP.NET MVC dynamically load user control, like in ASP.NET Web Forms

点点圈 提交于 2019-12-08 13:34:55
问题 Hallo, my team and I are about to start a project, and we would really like to use ASP.NET MVC, not the Web Forms. Why? Nothing special, just we want to learn it well and to measure what would be better to use in future projects. But, our project has important request. We need ability to dynamically load user controls, that can be created and uploaded in runtime. With ASP.NET Web Forms and it's LoadControl method it's simple. Can we do something like that with MVC? Tnx 回答1: Partial views are

Serialize/Deserialize a dynamic object

冷暖自知 提交于 2019-12-08 13:29:14
问题 I have the following classes: public abstract class Animal { public Animal() { _myType = getAnimal(this.GetType().Name); } private dynamic _myType; public dynamic myType { get { return _myType; } } } public class Cat : Animal { public Cat() : base() { } } And its helper functions: public static T CreateAnimal<T>(string animal) { Type type = Type.GetType(typeof(Form1).FullName + "+" + animal); return (T)Activator.CreateInstance(type); } public static dynamic getAnimal(string name) { dynamic

create Dynamic where in sql SP

穿精又带淫゛_ 提交于 2019-12-08 13:01:52
问题 I am trying to create a stored that will some values, one of the value is column name and a value. I've tried the following code create PROC SelectDynamic @DateFrom DATETIME, @DateTo DATETIME, @ColumName NVARCHAR(50), @ColumID INT AS DECLARE @Sql NVARCHAR(MAX) SET @Sql= ' SELECT * FROM Ticket t WHERE t.TicketDate BETWEEN '+ @DateFrom +' AND' + @DateTo+' AND' + @ColumName +'='+ @ColumID EXEC sp_executesql @Sql it give me this error Conversion failed when converting date and/or time from

Open a file with user Input in Excel VBA

旧时模样 提交于 2019-12-08 13:01:44
问题 I am currently writing a Programm using VBA, which opens particular excel files from the folder C:Reports. I Need to be able to open the file dynamically from user input in this folder such as; 1)User gets an Dialog box and sees the first question "What is the Name of the file" where he/she has to type the Filename without seeing the folder of the file. The file Name he typed has to be in C:Reports, else it should print "File not Found" 2)After entering file Name, he gets another question

Easiest way to dyanmically load a DIV on button click?

半世苍凉 提交于 2019-12-08 12:52:43
问题 I have a relatively simple question here. What I require is this; I need to have a page with 5 buttons at the top and a DIV beneath them (initially hidden). When a button is clicked, it loads content into the DIV (in the form of another DIV) eg. [Button 1] [Button 2] [Button 3] [Button 4] [Button 5] //5 buttons or links <div id="content"> // area for content to be loaded </div> <div id="content1"> //could be a table or image </div> <div id="content2"> //could be a table or image </div> <div

Dynamically create java bytecode and runnable jar

一笑奈何 提交于 2019-12-08 12:24:57
问题 I am making software that will need to dynamically create java bytecode, and possibly even make it a runnable jar. My current idea is to create a new .java file and compile it at runtime. I can create the file, but I'm not sure how to compile it at runtime, and make it a runnable jar. Any help would be greatly appreciated. public static String generate(String filePath) { try { File file = new File("Test.java"); if(!file.exists())file.createNewFile(); FileWriter write = new FileWriter(filePath