dynamic

JSF : dynamically loaded page commandButton not working

隐身守侯 提交于 2019-12-22 23:20:52
问题 I have a page that contains a PrimeFaces accordion panel, in each panel is a PrimeFaces datatable. Below the datatable is a button "Add study" for example and when this button is click I want to dynamically load a page into a <h:panelGroup> using a <ui:include> . When the button is being click I want to dynamically change the src value from the <ui:include> so that my page is loaded in the <h:panelGroup> . Now the problem is the following: My managed bean is set to @RequestScoped and when I

How I deserialize a dynamic json property with RestSharp in C#?

喜你入骨 提交于 2019-12-22 21:37:12
问题 I have a web service (I can't edit) with this structure: /users { "response" : { "users": [{"name": "John"},{"name": "Jack"}] }, "page" : { "current":1, "total":1} } /pets { "response" : { "pets": [{"name": "Fido"},{"name": "Tweety"}] }, "page" : { "current":1, "total":1} } As you can see the property name in the "response" property changes. How can deserialize a generic response with RestSharp? I don't want to write a Response class for every resource. I have written the following generic

How I deserialize a dynamic json property with RestSharp in C#?

南笙酒味 提交于 2019-12-22 21:36:59
问题 I have a web service (I can't edit) with this structure: /users { "response" : { "users": [{"name": "John"},{"name": "Jack"}] }, "page" : { "current":1, "total":1} } /pets { "response" : { "pets": [{"name": "Fido"},{"name": "Tweety"}] }, "page" : { "current":1, "total":1} } As you can see the property name in the "response" property changes. How can deserialize a generic response with RestSharp? I don't want to write a Response class for every resource. I have written the following generic

C# dynamic compilation of string and .cs file

怎甘沉沦 提交于 2019-12-22 18:37:16
问题 I'm working on a website where a user can implement a C# code solution to a problem in a browser text area and submit it. The server will then compile that code together with a predefined interface I provide on the server. Think of it as a strategy design pattern; I provide a strategy interface and users implement it. So I need to compile a string and a predefined *.cs file together at run-time. Here's the code I have now that compiles only the string portion: CodeDomProvider codeProvider =

Adding fields to Django form dynamically (and cleanly)

a 夏天 提交于 2019-12-22 18:08:54
问题 Hey guys, I know this question has been brought up numerous times, but I'm not quite getting the full implementation. As you can see below, I've got a form that I can dynamically tell how many rows to create. How can I create an "Add Row" link that tells the view how many rows to create? I would really like to do it without augmenting the url... # views.py def myView(request): if request.method == "POST": form = MyForm(request.POST, num_rows=1) if form.is_valid(): return render_to_response(

Can an app give its permission to another application in android?

让人想犯罪 __ 提交于 2019-12-22 18:03:10
问题 I have an application say A that have all the permissions enabled at installation. Another app Say B don't have a permission and want to get that permission. Can B communicate with A, So that A can transfer its permission to B. PLS reply, I'm stuck here. I want to get some permissions dynamically. Is this the best idea or any other idea? 回答1: As far as I know, apps can't necessarily give permissions to other apps, BUT AppB could inherit permissions from AppA IF you are the developer of both

How to dynamically open a method in Ruby

霸气de小男生 提交于 2019-12-22 17:20:14
问题 I want to dynamically open a method and return a value based on the input field. I am trying to ask what I want with an example here. If I could succeed this example, I would do what I want. Assume I have a class called Greetings which has a method called greet() which takes message as argument. class Greetings def self.greet(message) return "good morning" if message=="gm" return "evening" if message=="ge" return "good afternoon" if message=="ga" end end When I do a Greetings.greet("ge") , I

PetaPoco stored procedure error “Incorrect syntax near the keyword 'FROM'.”}

纵然是瞬间 提交于 2019-12-22 16:43:11
问题 I'm using C# with TSQL and SQL Server 2005 I'm trying to use PetaPoco to return a dataset as a list of objects. this is the code I'm using just now var s = PetaPoco.Sql.Builder.Append("USE [BI] EXEC [dbo].[TestProcedure2];"); var result = db.Query<dynamic>(s); var result2 = db.Query<dynamic>("USE [BI] EXEC [dbo].[TestProcedure2];"); I think the error message is a generic sql error for when petaPoco fails. At first I was using a stored procedure with paramaters and the @ character was causing

Get value of dynamically created textbox

风流意气都作罢 提交于 2019-12-22 16:37:01
问题 I'm in a bit of a pickle at the moment, I've created a bit of code that creates 4 textboxes and adds them to a table layout at run time (code below) but I'm struggling with getting text from it, I tried getting the value from it as you would string s = TxtBox1.Text.ToString(); but it just gets a null reference, then I tried txt.Text.ToString(); and this just gets the text from the last text box that was created. private void button2_Click(object sender, EventArgs e) { int counter; for

How can one to dynamically parse a CSV file using C# and the Smart Format Detector in FileHelpers 3.1?

*爱你&永不变心* 提交于 2019-12-22 15:00:49
问题 As per in this FileHelpers 3.1 example, you can automatically detect a CSV file format using the FileHelpers.Detection.SmartFormatDetector class. But the example goes no further. How do you use this information to dynamically parse a CSV file? It must have something to do with the DelimitedFileEngine but I cannot see how. Update: I figured out a possible way but had to resort to using reflection (which does not feel right). Is there another/better way? Maybe using System.Dynamic? Anyway, here