dynamic

Write a class using a two-dimensional dynamic array

六眼飞鱼酱① 提交于 2019-12-12 14:13:19
问题 I have a homework assignment. I'm not looking for anyone to do the work for me, I'm just having trouble with one little aspect, although I'd accept advice on other bits as well. The assignment is: Write a class using a two-dimensional dynamic array. The constructor passes in the dimensions of the array. The constructor also intializes all values in the dynamic array to the row index multiplied by the column index. Swap two columns of the two-dimensional array, where the column indexes are

Dynamically change size of multiple textview from code (without a “on disk” xml theme)?

此生再无相见时 提交于 2019-12-12 12:38:34
问题 I have 10 TextViews in my code and i would like to change font size on all of them. On my layout i have used a @style to define common properties however i don't know how to change them all from code once layout is on screen. What i dont want to do is update N objects but write only in one place. I know that i could use applyTheme but this assumes that you have an XML theme somewhere on disk, i want to be able to scale fonts to any size so this solution is not practical. Any idea? 回答1: See

How do I format date literals in dynamic linq?

白昼怎懂夜的黑 提交于 2019-12-12 12:30:05
问题 I am using dynamic Linq to return data for user-input search criteria. My query is working fine except for the user selected dates. My current code is: StringBuilder whereClause = new StringBuilder(); if (startDate.HasValue || endDate.HasValue) { DateTime searchStartDate = startDate.HasValue ? startDate.Value : DateTime.MinValue; DateTime searchEndDate = endDate.HasValue ? endDate.Value : DateTime.MaxValue; whereClause.AppendFormat("Date >= {0} && Date <= {1}", searchStartDate.Date

DYnamic SQL examples

依然范特西╮ 提交于 2019-12-12 12:17:11
问题 I have lately learned what is dynamic sql and one of the most interesting features of it to me is that we can use dynamic columns names and tables. But I cannot think about useful real life examples. The only one that came into my mind is statistical table. Let`s say that we have table with name, type and created_data. Then we want to have a table that in columns are years from created_data column and in row type and number of names created in years. (sorry for my English) What can be other

Create Tables with Dynamic Names via Stored Procedure

本小妞迷上赌 提交于 2019-12-12 11:25:10
问题 I am trying to create tables with dynamic names. The code I am getting errors from is a piece of dynamic SQL. I am unsure what the issue is. I am new to dynamic SQL and stored procedures. PREPARE stmt FROM "CREATE TABLE `?` SELECT lat, lon, nfldtime FROM position_reports where mmsi = ? ORDER BY id DESC LIMIT 100"; EXECUTE stmt USING CONCAT("mmis", FORMAT(vesselID,0)), vesselID; The Error I get while trying to create the procedure is: Script line: 4 You have an error in your SQL syntax; check

How to OFFSET from a dynamic named range and use that range in SUMPRODUCT?

痴心易碎 提交于 2019-12-12 11:19:31
问题 Situation: I am getting #Value! when trying to pass the OFFSET of a dynamic named range to SUMPRODUCT . Setup: I have the following data in range A2:B4 of Sheet1. | TextA | 1 | |-------|---| | TextA | 2 | |-------|---| | TextB | 3 | I have created a dynamic named range, textRange , of the values in column A with the formula: =OFFSET(Sheet1!$A$2,0,0,COUNTA(Sheet1!$A$2:$A$1048576),1) As shown in image: Note: textRange will pick up all required rows. It can be assumed to be pulled from a

Android - Saving state of dynamically changed layout

独自空忆成欢 提交于 2019-12-12 10:59:18
问题 I have a layout where users can add buttons and place them where they want. I want to allow the user to save their layout so that it is loaded the next time they open the app. Does anyone know if I can save the file on the sdcard? Alternatively I could use some kind of layout.getXml() method and put it in the database my app uses. Thanks in advance 回答1: There is no file to save when you are generating a layout via code. You will have to create your own file format, which could be saved to the

How to dynamically add a layout ?

馋奶兔 提交于 2019-12-12 10:18:15
问题 Here is my xml <TextView android:id="@+id/itemNameTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#000000" android:textSize="30sp" android:layout_centerVertical="true" android:drawableLeft="@drawable/doller" android:drawablePadding="30dp" android:layout_marginLeft="30dp"/> <Button android:id="@+id/buttonAdd" android:layout_width="wrap_content" android:layout_height="fill_parent" android:textColor="#000000" android:background="#00000000"

How can I make Meteor subscriptions dynamic?

依然范特西╮ 提交于 2019-12-12 09:54:07
问题 I am looking to make my meteor subscriptions dynamic/reactive. Right now, I have a page that subscribes to a collection of templates based on a template ID that is assed to it: Meteor.subscribe('templates', templateId) On the same page, I have a dropdown list of template names and ID's: <p><label>Select Template</label></p> <select id="templateSelect" name="templateSelect"> <option disabled selected> Select Template </option> {{#each orderTemplates}} <option value="{{this._id}}">{{this

RestKit: Dynamic Nested Attributes with an Array

。_饼干妹妹 提交于 2019-12-12 09:52:33
问题 I'm struggling to find a way to map some JSON into RestKit. This is an example of what I'm looking at: "results":{ "Test1":[ { "id":1, "name":"Test 1 here.", "language":"English", "type: "Test1" } ], "Test2":[ { "id":3, "name":"Another test 2", "language":"English", "type":"Test2" }, { "id":8, "name":"More test 2", "language":"English", "type":"Test2" }, { "id":49, "name":"foo", "language":"English", "type":"Test2" } ] } Ideally, the JSON wouldn't include the extra redundant layer of "type"