Menu
  • HOME
  • TAGS

Basic C++ dynamic allocation issue

c++,dynamic

You're defining a local variable prCont, which hides your member variable. It's very rare to dynamically allocate std::sets, and you probably shouldn't. If you declare the member as set<Property*> prCont, it will be default-constructed automatically when your PropertyContainer is created. ...

Give arguments to function in a dynamic way

php,dynamic

It looks like call_user_func_array is what you need. http://php.net/manual/en/function.call-user-func-array.php...

Abstract class not generating with CodeDom

c#,.net,dynamic,metaprogramming,codedom

You need to use CodeTypeDeclaration.TypeAttributes instead of MemberAttributes: CodeTypeDeclaration helloWorldClass = new CodeTypeDeclaration("HelloWorld") { TypeAttributes = TypeAttributes.Abstract | TypeAttributes.Public }; Why did they add a Attributes property if it does nothing when defining a type? That is specified explicitly in the documentation: Some of the flags such as Abstract overlap...

Grails Form Submission Fails with Dynamic Fields using JQuery

jquery,forms,grails,dynamic

I got your problem. This is not related to the Grails actually instead of this is a Browser implementation. One may easily get confused in this problem. Basically, when you are hiding your field using jQuery, you are not actually removing it from the DOM and you have marked that...

Deleting dynamic char** in C++

c++,arrays,dynamic,delete,char

It is similar to allocating, but in reverse order, and using delete[] instead of new[]: for(int i = 0; i < LENGTH; i++) delete[] strings[i]; // delete each pointer in char** strings delete[] strings; // finally delete the array of pointers I assumed here that LENGTH is the length of...

Asp.net MVC 4 dynamic connection string

asp.net-mvc-4,dynamic,connection-string

For those of you looking for a solution to this issue as well, here is my solution (which is just one possible solution). In my Web.config class I used a configSource for my connection string: <connectionStrings configSource="connections.config"/> Then I created a class in my App_Start folder with a static method:...

I am getting error in this code as “invalid indirection”

c,memory,dynamic,indirection

ptr[i] means the value at address (ptr+i) so *ptr[i] is meaningless.You should remove the * Your corrected code should be : #include<stdio.h> #include<stdlib.h> #include<conio.h> int main() { int i; int *ptr; ptr=malloc(sizeof(int)*5); //allocation of memory for(i=0;i<5;i++) { scanf("%d",&ptr[i]); } for(i=0;i<5;i++) { printf("%d",ptr[i]); //loose the * } return 0; } //loose...

Make dynamic links (with ?) return error 404 not found

apache,.htaccess,dynamic,hyperlink,http-status-code-404

I assume you're asking for any request containing a query string to return a 404. If that is what you want, use the below: RewriteEngine On RewriteCond %{QUERY_STRING} .+ RewriteRule .* - [R=404,L] This will use the regex .+ to check if there are one or more characters in the...

Getting index of clicked row that's dynamically created

jquery,events,table,dynamic,row

Use .on event: $("#myTable").on('click', 'tr', function(){ alert('Clicked row '+ ($(this).index()+1) ); }); http://jsfiddle.net/4wa5kfpz/1/...

How do i create a dynamic array of function pointers?

c,function,dynamic

Clearest way is to use typedef #include <stdlib.h> typedef int (*functype)(void *a, void *); functype funcs[100]; // static array functype *moreFuncs; int main() { int capicity = 16; // initial capacity int n = 0; // initial size moreFuncs = malloc(capacity*sizeof(functype)); // heap dynamic array // ... // adding element...

Javascript dynamic inputs calculation

javascript,jquery,dynamic

You need to refer the current element row id by adding x as follows wrapper.append('From &rarr; <input type="text" name="fromhours" id="fromhours' + FieldCount + '" onblur="cal(x)" /> ... function cal(x) { var fromhours = parseInt(document.getElementById('fromhours'+x).value) * 60; ... $(document).ready(function() { var max_fields = 10; //maximum input boxes allowed var wrapper =...

How to Dynamically name a Hash key in Ruby

ruby,dynamic,hash,key,erb

One solution is to use the => notation for that entry in the hash e.g. model_id: @model.id object_type_abbr[i].to_sym => orphan, .... The standard way to map keys to values in a hash is using the key => value (rocket) notation. When you write model_id: @model.id this is shorthand for :model_id...

Insert Dynamic PHP form into MySQL

php,mysql,dynamic

you can use a foreach(), using the key to bind the input groupings together foreach($_POST['hours1'] as $key => $value) { // could use any of the fields in $_POST['hours1'] //$_POST['hours1'][$key]; //$_POST['hours2'][$key]; //$_POST['durationh'][$key]; //$_POST['hrscode'][$key]; //$_POST['remark'][$key]; //INSERT INTO table (columns) VALUES (your $_POST values) } ...

FieldBuilder - Ho do you set the default value?

c#,dynamic,default-value,typebuilder

When in doubt, ask Roslyn, in IL mode :-) http://goo.gl/NebcEP The default field is set in the constructor(s) of the object: .method public hidebysig specialname rtspecialname instance void .ctor () cil managed { // Method begins at RVA 0x2061 // Code size 15 (0xf) .maxstack 8 IL_0000: ldarg.0 IL_0001: ldc.i4.s...

What are the limits on dynamic/double dispatch in Kotlin?

dynamic,dispatch,kotlin

So here's a version of your code that actually compiles: fun main(vararg args: String) { val h:Animal = Horse val d:Animal = Donkey val child = h + d println(child) } open class Animal { fun plus(x:Animal) = Animal() } object Horse : Animal() object Donkey : Animal() object Mule...

IDynamicMetaObjectProvider set property using literal name

c#,dynamic

In some cases like ExpandoObject, then you can use the IDictionary<string,object> API instead: ExpandoObject obj = ... var dict = (IDictionary<string, object>)obj; object oldVal = dict[memberName]; dict[memberName] = newVal; In the more general case of IDynamicMetaObjectProvider: you could borrow the CallSiteCache from FastMember: internal static class CallSiteCache { private static...

Create a new dynamically named list in groovy

list,variables,dynamic,groovy

You can dynamically add variables but you will need to use this (being the instance of the object you are setting the variable on), e.g.: this."${items[i]}" += value[i] This should give you what you need or at least point you in the right direction....

Comparing dates using Dynamic Action on DatePicker Oracle Apex

oracle,dynamic,datepicker,action,oracle-apex

As @ScottWe mentions: you're trying to apply PLSQL logic in HTML/javascript. The 'When - Condition' is evaluated at runtime and thus you can't use PLSQL there. The date arithmetic is a bit annoying in javascript though, so if you're a unfamiliar with it, here is a way you can perform...

Dynamic UI & Accessing Data (Shiny)

r,dynamic,shiny

After some discussion with AndriyTkach : I have a working program : output$PowerAnalysisANOVA <- renderPlot({ allmean = c() for (i in 1:values$numGroups) eval (parse (text = paste0("allmean[", i, "] <- input$group_" ,i))) qplot(allmean) }) And I had forgotten to make a reactive variable : values <- reactiveValues() output$hmgroupsmean <-renderUI({ values$numGroups...

Extjs building form on metadata

json,extjs,model-view-controller,dynamic

Surely possible. Basically you use your metadata as items and create the form at any time: var metadata = [ { "allowBlank": false, "fieldLabel": "labelText1", "name": "labelName1", "emptyText": null }, { "allowBlank": false, "fieldLabel": "labelText1", "name": "labelName1", "emptyText": null } ]; Ext.create('Ext.form.Panel', { defaultType: 'textfield', width: 300, bodyPadding: 10, renderTo:...

Oracle Apex dynamically enable/disable text field depending on LOV selected value

javascript,dynamic,action,oracle-apex,lov

Create a Dynamic Action with the following parameters: Event: Change Selection Type: Item Item: Condition: in list Values: < The LOV values that should disable the other items separated by comma > True Action: Action: Disable Selection Type: Item Item: < Choose the item(s) to disable > False Action: Action:...

Android : Creating GUI programmatically at run time in java

java,android,user-interface,dynamic

Add a Linear/Relative layout in xml and on run time according to given number add view(buttons and text views) in this layout. See this tuts: https://androiddesk.wordpress.com/2012/08/05/creating-dynamic-views-in-android/ http://www.javacodegeeks.com/2012/09/android-dynamic-and-xml-layout.html

Convert Apache VirtualHost to nginx Server Block for Dynamic Subdomains

apache,dynamic,nginx,vhosts

Use a named regex capture in the server_name that you can refer to later. server { listen 8080; server_name ~^(?<subdir>.*)\.localhost\.com$ ; set $rootdir "/var/www/clients"; if ( -d "/var/www/clients/${subdir}" ) { set $rootdir "/var/www/clients/${subdir}"; } root $rootdir; } What your are doing is setting your default root directory to a variable...

How to dynamically pull MYSQL date queries?

mysql,date,dynamic

You can use DATE_ADD() or DATE_SUB() like this: SELECT ProductID, ProductIDintarget, DATE_FORMAT(Date,'%m/%d/%Y'), SUM(Rev) FROM datatable WHERE `Date` < (DATE_ADD(CURDATE(), INTERVAL 1 MONTH)) AND `Date` > (DATE_SUB(CURDATE(), INTERVAL 2 MONTH)) GROUP BY ProductID, ProductIDintarget, `Date` Note:- You should backticks if you have keywords as column names....

Winforms RadPageView find control

c#,winforms,dynamic,telerik,tabcontrol

I have found this example over the internet and its working perfectly. public Form1() { InitializeComponent(); TabControl tb = new TabControl(); tb.Width = 500; TabPage tp = new TabPage("Tab 1"); Label lb = new Label(); lb.Text = "Test"; lb.Name = "lblTest"; lb.Location = new Point(10, 10); TextBox txt = new...

dijit/Tree is not updated when connected to a dojo/store/JsonRest

dynamic,dojo,notify,dijit.tree,jsonreststore

Using jquery instead of dojo was the solution. I found that I could solve in a few hours of learning jquery all problems that occurred when using dojo. This is mostly due to the quality of the documentation of both libraries and also because dojo seems to have too many...

Trying to dynamically create divs that can also be closed

javascript,html,dynamic

The issue is in your for loop. It's really unnecessary as far as I can tell. The code could be cleaned up a bit, but to solve your issue I believe the following changes will work. For some reason the code has been copied twice, use the first code snippet...

Passing pointer to dynamically allocated array by copy to function has unexpected result

c++,arrays,pointers,memory,dynamic

Try changing your foo() like this and see the result: void foo(t* s) { delete[] s; // Additional memory allocation t* u = new t[2]; s = new t[2]; s[0].x = "FOO.X"; s[1].y = "FOO.Y"; } By adding another memory allocation, I moved s to another location in the memory,...

Meteor helper function exception when retrieving the count of all users

javascript,html,dynamic,meteor,helper

Try using this as the helper instead: Template.Home.helpers({ UserAmount: function() { return Meteor.users.find().count(); } }); The idea is this helper is called UserAmount so the value it returns on the Home template should replace itself into the handlebars expression {{UserAmount}} You don't have to do the heavy lifting in changing...

Generating Custom Object from ArrayList in C# at runtime

c#,asp.net,.net,dynamic,functional-programming

Ok guys I figured out how to do that and just in case someone who would face this problem here is the solution : you have to tokenize each line using dot(.) and pointer to keep track of the index, you should use pointer with ref keyword in order to...

AngularJS : How to make dynamic field button only for last button?

javascript,angularjs,dynamic,angularjs-ng-repeat

You can use $last inside ng-repeat which is true if the repeated element is last in the iterator. Or you can do it with css only with .row:last-of-type {/**/}.

Dynamically access methods from scala object

scala,dynamic,reflection

You could still use scala runtime reflection: import scala.reflect.runtime.{universe => ru} val m = ru.runtimeMirror(getClass.getClassLoader) val ccr = m.staticModule("my.package.name.ObjName") // e.g. "CC" or "CD" type GetC = { def getC(name:String): CC } val cco = m.reflectModule(ccr).instance.asInstanceOf[GetC] now you could use it as cco.getC ......

How to check in python if some class (by string name) exists?

python,class,dynamic

Using eval() leaves the door open for arbitrary code execution, for security's sake it should be avoided. Especially if you ask for a solution for such a problem here. Then we can assume that you do not know these risks sufficiently. import sys def str_to_class(str): return reduce(getattr, str.split("."), sys.modules[__name__]) try:...

Dynamic forecasting (arima) with multiple regressors in Stata

dynamic,stata,forecasting

The problem seems to be you are including independent variables, and therefore, estimating an ARMAX model. For the out-of-sample forecasts, you need also values for the independent variables AvgPov and AvgEnrol. The model doesn't estimate them; recall the dependent variable is D4.AvgU5MR.

Compiler says dynamic property is missing but I can see it

c#,.net,dynamic,reflection,metaprogramming

There are one or perhaps two problems with your code: You are using an internal class, and trying to access it with dynamic. The two things don't play well together. See http://stackoverflow.com/a/18806787/613130. Use public clasas You need to cast the value before assigning it to wabeCount, like: obj.WabeCount = (int)wabes[ndx]...

AS3 Dynamic variable naming

actionscript-3,flash,variables,dynamic

You should use an array for this kind of list of variables. While you can create properties dynamically, you usually want to avoid it. Especially in your case, where the actual identifier of each variable is not a String, but a number. So why not use something that does exactly...

How to use Dynamic Variables?

excel-vba,variables,dynamic

Y10 cannot be the name of variable (because it could be confused with cell Y10). Code that attempts to use such variable names will not work. Try other name, for example y_10 will be fine.

C++: Two dynamic arrays causes memory allocation error

c++,arrays,dynamic

You are allocating an int not an array: int* H = new int(length); should be: int* H = new int[length]; same with your double case: double* dos = new double(length); should be: double* dos = new double[length]; what you are doing if it were allocated on the stack is int...

How to handle different event handlers with same parent?

c#,winforms,dynamic,parent

Why don't you just calculate the sum of your "point" labels at the end of both events? It is nice and simple(You could do it more efficiently but i don't this there is a reason... ) Just call TotalPoints() at the end of checkBox_CheckedChanged,txtBox_CheckedChanged int TotalPoints() { int total =...

Set value for Spinner with custom Adapter in Android

android,dynamic,android-arrayadapter,android-spinner

@Haresh Chhelana example is good, However if you want to show both name and code in spinner after selecting, check this out. List<Map<String, String>> items = new ArrayList<Map<String, String>>(); for (int i = 0; i < JA.length(); i++) { json = JA.getJSONObject(i); mapData = new HashMap<String, String>(); mapData.put("name", json.getString("Name")); mapData.put("code",...

Method declared with dynamic input parameter and object as return type in fact returns dynamic

c#,.net,dynamic,visual-studio-2013

The problem is that you're calling a method with a dynamic argument. That means it's bound dynamically, and the return type is deemed to be dynamic. All you need to do is not do that: object dObj = "123"; var obj = Convert(dObj); Then the Convert call will be statically...

Hook into wpf xmlns namespace import

c#,wpf,xaml,dynamic,xmlns

I believe you could solve this nicely using a MarkupExtension. I generated the following psueocode based upon this guide. The end goal will be something like this. <ContentControl Content="{ipc:IronPythonControl IronTextBox}"/> We define our Markup Extension as so: namespace IronPythonControlsExample { public class IronPythonControl : MarkupExtension { public string Name {...

Call dynamic method from string

c#,dynamic,methods,reflection

you can write your method as follows - public void CallMethod(dynamic d, string n) { d.GetType().GetMethod(n).Invoke(d, null); } ...

Creating dynamic amount of components in FXML

java,dynamic,javafx,fxml

No you cannot do this in FXML. There is no way to write a LOOP in fxml. If you are just considered about a Button, then you may use SceneBuilder and drag-drop multiple buttons. Though, if you are considered about a more complex UI and want to repeat them, you...

Angular range input value changing with seconds

angularjs,dynamic,range

When you bind anything using scoped function call angular cannot keep a watch on it so the value will not be updated. You will have to change it to a property and set using ng-model and update the property value using angular's $interval passing the required interval in milliseconds. Html...

How to deal with value of text input created dynamically?

javascript,jquery,dynamic,input

$('#submit') doesn't exist in your example. I replaced it with $('#itemform').submit() instead, and it seems to be logging a giant object. See the updated jfiddle here. $('#itemform').submit(function(e){ e.preventDefault(); var item = {}; $('input[type=text]').each(function(){ var key = $(this).attr('name'); var value = $(this).val(); item [key] = value; }); console.log(item) }); Also, if...

Linux C++ Dynamic Libs and static initialization order

c++,linux,dynamic,initialization,shared-libraries

This is a fairly standard problem: you have global data, with no way to control when it is initialized. There is also a standard solution to that problem: indirect this data intialization through a function call. Instead of having global std::map<...> DBFactory, do this: // database.cpp DBFactory_t& getDBFactory() { static...

Adding event code to checkbox in PowerPoint VBA

vba,dynamic,powerpoint,powerpoint-vba,buttonclick

Do you have to use a label? (I understand the size thing but you can maybe add a shape which would be easier.) Something based on: This can only work if you allow access to the VBE in Security (cannot be done in code) Sub makeBox() Dim strCode As String...

Delete item “Object required” excel VBA

excel,vba,excel-vba,dynamic,delete

The reason why your code is throwing object required is because it cannot find the Button. So to correct that we need to set the button again after the first deletion. Here I have added 3 more variables as public introw, selnum, colnum. There is no change in the AddSceneButton...

getting an div ID, passing to a variable, then unhiding that div using jquery

javascript,jquery,dynamic

You're not using the jQuery library in your codepen` Your level IDs have an additional "z" like level_1az so you might want to: Demo that uses jQuery function set_path(clicked_id) { var divX = ('#' + clicked_id); $('fill-in').html( divX ); $(divX+'z').css("background-color", "yellow"); // use that 'z' } Demo in pure...

Defining Stack dynamically in class constructor, which is private member

c++,dynamic,stack

To fix the compiler error, you have two options as mentioned in my comment: Change stack* myData; to stack myData; Change myData.push(u); to myData->push(u); Preferable design is the 1st option. To make the 1st option work you should use the member initializer list of your constructor: class uses{ private: stack...

Django 1.8.1 load template file with dynamic javascript

javascript,django,dynamic

If you just want to include a static javascript file, you can do it the same way that you load any other javascript file in HTML: <script src="jquery-1.11.2.min.js"></script> However, if what you want to do is pass in a javascript file that the template will load, depending on some backend...

Initialize array of structures

c,arrays,dynamic,struct,initialization

You can simply initialize your array with: EDITED: Voie voies[12] = { {1,{0,16,1},{4,7,8}}, {2,{2,3,},{4,5,}}, {3,{0,},{0,}}, {4,{4,17,5},{7,10,11}}, {5,{6,7,},{7,8,}}, {6,{0,},{0,}}, {7,{8,17,9},{10,1,2}}, {8,{10,11,},{10,11,}}, {9,{0,},{0,}}, {10,{12,16,13},{1,4,5}}, {11,{14,15,},{1,2,}}, {12,{0,},{0,}} }; ...

Dynamically assigning sub class dependent decorators

python-3.x,dynamic,decorator

A decorated function or method is usually a different object than the function or method it decorates [*] - so, you can just wrap the original class' method in an explict way. This is rather straightforawrd, and rather boring - but it will work if you need to decorate just...

Dynamic navigation links with Mysql, Php and Javascript

javascript,php,mysql,dynamic,navigation

You can set the src attribute of the iframe. function goto(url) { document.getElementById("contentFrame").src = url; } UPDATED: You have an error in your PHP code. Change the A tag with this code: onclick=\"goto('imagegallery.php?category=".$myRow['productcategory']."')\" Take care of slashes.. If you have slashes into product category, you have to add some backslashes...

How to build dynamic controls in angular js using json?

html,json,angularjs,dynamic,controls

This is pretty easy using the ng-repeat directive. Note how I assign the value of the model back to the scope variable in the ng-repeat. This allows me to retrieve it later. angular.module('formModule', []). controller('DynamicFormController', ['$scope', function($scope) { //Set equal to json from database $scope.formControls = [{ name: "Name", type:...

How can I set a Button's type to “Button” (as opposed to the default “Submit”) in C#?

c#,dynamic,sharepoint-2010,submit-button,htmlbutton

Use HtmlButton instead of Button if you want the "HTML button tag" var btn = new HtmlButton(); btn.Attributes["class"] = "bla"; btn.Attributes["type"] = "button"; Button renders <input type="submit" /> and Button.UseSubmitBehavior renders <input type="button" />. HtmlButton will render <button type="YOUR_DEFINITION"></button>....

Int& to const int -static vs dynamic-

c++,dynamic,reference,const

It is telling you that you can't return a non-const lvalue reference to a data member from a const member function. You need const int& f() const {return x;} You may decide to provide a non-const overload if needed: int& f() {return x;} As for operator[], it does not return...

At most k adjacent 1s (Maximum Value limited neighbors)

arrays,algorithm,dynamic,dynamic-programming

M[i, j] is max sum from 1 to i, with j adjacent 1s The answer we need is M[n, k] which can be computed as the max of 3 situations: a[i]=0 => S=M[i-1, j] a[i]=1 and a[i-1]=0 => S=M[i-2, j]+a[i] a[i]=1 and a[i-1]=1 => S=M[i-1, j-1]+a[i] so the recursive rule...

How to alter dynamic/live element attributes - (replaceWith()) used

jquery,dynamic,replace,live

I think the only thing you're maybe not wrapping your head around is the idea of callbacks and asynchronous methods. You're currently running your console.log statements before the replaceWith occurs. The function() { } block (your "callback") passed as the second parameter to $.get doesn't execute until the AJAX call...

R Knitr PDF: Is there a posssibility to automatically save PDF reports (generated from .Rmd) through a loop?

r,pdf,dynamic,report,knitr

Adapting your example: You need one .rmd "template" file. It could be something like this, save it as template.rmd. This is a subgroup report. ```{r, echo=FALSE} #Report Analysis summary(subgroup) ``` Then, you need an R script that will load the data you want, loop through the data subsets, and for...

How can I convert a hierarchical tree to parent-child relationships?

php,dynamic,menu,nested,hierarchical

For those who are interested in my final code. It works for storing the data in the database and build it again into a hierarchical tree + a printable tree for HTML. JavaScript code for the nestable plugin: var nestable_update = function(e){ $(".dd-item").each(function(index){ $(this).data("id", index+1); }); var list = e.length...

Java dynamic, static casting

java,dynamic,static,polymorphism

The idea behind static cast and dynamic cast is related to the moment a type decision needs to be made. If it needs to be made by the compiler then it's static cast. If the compiler postpones the decision to runtime then it's dynamic cast. So, your first observation is...

Multiple UILabels in UITAbleViewCell with dynamic height

uitableview,swift,dynamic,ios8,autolayout

Add a (lower priority) fixed height constraint for the cell (e.g. = 40). Add a top and bottom constraint for each label. Make the top constraint a fixed margin (e.g. = 8). Make the bottom constraint a (higher priority) greater than or equal constraint (e.g. >= 8). The cell's height...

What is the good way to create dynamic check boxes in list view and write click event in Android?

android,listview,dynamic,listactivity

This Android ListView Checkbox Example - OnItemClickListener() and OnClickListener() might provide some idea for your problem.

Android : Unable to change width of dynamic button

java,android,button,dynamic,layoutparams

Only This You have to do to change Button Dynamically First I get Button Button btn = (Button) findViewById(R.id.button1); Then Button Click event I put This Code Only TableRow.LayoutParams lp = new TableRow.LayoutParams(70, 70); btn.setLayoutParams(lp); And Works Fine. Try It. Will solve your Problem...

get value from the dynamic create textbox

c#,dynamic,value

Create an array or list of textboxes: private TextBox[] textBoxes = new TextBox[30]; And assign a new textbox to each position: for(int i =0; i<30; i++){ TextBox txt = new TextBox(); txt.Text = "ASDASDASD"; txt.ID = "txt - " + i.ToString(); textBoxes[i] = txt; data.Controls.Add(txt); } To get the value...

Dynamically create compiled binary with go

dynamic,go,compilation,dynamically-generated

So you have 2 sub-tasks which together do what you want: Perform a text substitution to acquire the final source code. Compile the final source code into executable binary. 1. Text substitution The first can be easily done using the text/template package. You can either have the source templates as...

How to define events dynamically in backbone.js

javascript,events,backbone.js,dynamic

you can do Something like this: Single Event: events:{ 'click .link':'showDetails', } function showDetails: showDetails : function(e){ var _type = $(e.target).attr("id").toUpperCase(); var _callbackName = "show"+_type+"Details"; if(typeof this[_callbackName] !== "function") return console.log("No callback named:",_callbackName); this[_callbackName].call(this,e); }, showAESDetails : function(e){ console.log("Do something!"); } Edited to respond to OP comment: whit this procedure...

saving matlab file (.mat) with dynamic name

matlab,dynamic,save

If distance is a variable in your workspace, you will have to call save(str, 'distance');. You have to enter the name of the variable, not the variable itself.

Adding subview to cell dynamically is causing layout constraint error output

ios,dynamic,autolayout

To answer my own question, the problem boils down to the interaction between the following highlighted constraints: The top two are added automatically by (I think) UITableViewCell. They are of the highest priority (1000). The other two highlighted constraints are the first two (top and bottom) I added with this...

EDIT/UPDATE comma seperated values into mysql rows and add new

php,jquery,ajax,dynamic,mysqli

You could Pull --- Check --- Update --- Delete Psudo Code, Non-working! This is to show the flow: // Get the current database rows that are being edited $results = mysql_query('SELECT * FROM entries WHERE table_id=10'); $itemsInDB = []; while($itemsInDB[] = mysql_fetch_row($results)) {} // Iterate over the fields sent to...

How to find and check all dynamic child checkboxes in tree using jquery?

javascript,jquery,dom,dynamic,tree

Try this: var json = { Asia: [{ regionList: [{ regionName: "Eastern Asia", Countrylist: [{ countryName: "China", subCountryList: [{ subCountryName: "Southern China" }] }, { countryName: "Hong Kong" }] }, { regionName: "Southern Asia", Countrylist: [{ countryName: "India" }, { countryName: "Pakistan" }] }] }] }; var html = '';...

How to create popup's for dynamic tables

javascript,jquery,html,css,dynamic

You can assign unique ID's to the table like this. <!--To display JSON data in the tables--> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> <script> $(function() { var dmJSON = "data.json"; $.getJSON( dmJSON, function(data) { var idx=1; $.each(data.records, function(i, f) { var myid = 'mytable'+String(idx); idx++; var $table="<table id='"+myid+"' class='mystyles' table border=5><tbody><tr>" + "<td>"...

Create list of runtime-known type from object list and call generic method

c#,linq,dynamic,reflection

Quite easy: public static class DynamicLinqExtensions { public static IEnumerable<TSource> FilterByUniqueProp<TSource> (this IEnumerable<TSource> query, TSource model) { // Do something accourding to this type var type = typeof(TSource); return null; } public static IEnumerable<TSource> FilterByUniqueProp2<TSource> (this IEnumerable<object> query, TSource model) { // We use Cast<>() to conver the IEnumerable<> return...

Team Page With Dynamic Content - Need Help Using JQuery to Pull Image Content

javascript,jquery,html,css,dynamic

I think this is what you are looking for. $(function(){ $('.profilepic').on('click', function(e){ var $biginfo = $('#teamcontent'); var $bigname = $('#bigname'); var $bigjob = $('#bigjob'); var $bigdesc = $('#bigdesc'); var $pic = $(this).attr('src'); $('.bigimg').attr('src', $pic); var newname = $(this).attr('alt'); var newrole = $(this).siblings('.job').eq(0).html(); var newdesc = $(this).siblings('.desc').eq(0).html(); $bigname.html(newname); $bigjob.html(newrole); $bigdesc.html(newdesc); if($biginfo.css('display')...

Deallocating member pointer

c++,pointers,memory,dynamic,heap

Below pointerToPointer = new char[3]; char y[3] = {'x', 'y', 'z'}; pointerToPointer = y; you allocate memory to pointerToPointer (first line), then make pointerToPointer point to the beginning of the array y (third line). When you try to delete pointerToPointer, you effectively try to delete a pointer that points to...

SQL Server - Can I dynamically create multiple parameters from the results of a SELECT query on another table?

sql-server,variables,dynamic,parameters

Can you check this Declare @sql varchar(max) = '' set @sql = 'SELECT RotaDate, DateDay, SlotTypeID, SlotDescription AS Hours,' select @sql = @sql + ' ' + 'max(case when ChaplainName = '''+ChaplainName+''' then AvailabilityDescription end) '+LEFT(ChaplainName, CHARINDEX(' ', ChaplainName+ ' ') - 1)+' ,' FROM Chaplaincy_Chaplains SET @sql = LEFT(@sql,...

TypeBuilder - Adding attributes

c#,dynamic,properties,custom-attributes,typebuilder

An instance of an attribute isn't helpful here you need to define the constructor and the values that should be called. A simple solution might be to change the AddProperty Signature and exchange the params Attribute Parameter with a params CustomAttributeBuilder Parameter and construct Builder instances instead of attributes. var...

add data before sending in android dynamic listview

android,json,listview,dynamic,android-listview

Write a method in your adapter to add new items in existing list of items. and call that method in your async task when you are getting new dataset from your services/APIs.. Do not forget to put notifyDataSetChanged() in that method inside adapter.

Dynamic lambda wrapped with try catch

c#,linq,dynamic,lambda

After some more tries I got this working. The solution was to use the trycatch to wrap the expression's body and not the expression itself then create the resulting lambda using the expression parameters. Otherwise I got something like (not sure there) a Func<ModulelItem, bool, bool> So the final code...

how to loop through a four level json array using jquery

javascript,jquery,arrays,json,dynamic

Try this, using some code of @dimitar: var json = { "Asia": [{ "continentCode": "GT113", "regionList": [{ "regionName": "Eastern Asia", "regionCode": "GR128", "Countrylist": [{ "countryName": "China", "countryCode": "GC302", "subCountryList": [{ "subCountryName": "Northern China", "subCountryCode": "GR207" }, { "subCountryName": "Southern China", "subCountryCode": "GR206" }] }, { "countryName": "Hong Kong", "countryCode": "GC303"...

Query mongodb collection as dynamic

c#,mongodb,dynamic

You can use the string-based syntax, since the expression doesn't offer any advantages with dynamic anyway: var cursor = db.GetCollection<dynamic>("foo"). Find(Builders<dynamic>.Filter.Eq("_id", someId)); ...

C#: Call overloaded method in external assembly from generic

c#,generics,dynamic

If you don't want to check typeof(T) and call the respective method manually then reflection can work. Something like this... public class MyVendorLibWrapper { private readonly VendorLib vendorLib; public MyVendorLibWrapper() { this.vendorLib = new VendorLib(); } public T GetValue<T>() { MethodInfo method = typeof(VendorLib) .GetMethod("GetVal", new Type[] { typeof(T).MakeByRefType() });...

Dynamic CTE's as part of a SProc in DB2/400

sql,dynamic,common-table-expression,ibm-midrange,db2400

The basic problem is in the EXECUTE. You can't "execute" the prepared SELECT. Instead, you'll need to DECLARE CURSOR for S1 and FETCH rows from the CURSOR. Note that 'executing' a SELECT statement wouldn't actually do anything if it was allowed; it would just "SELECT", so EXECUTE doesn't make much...

How can I restrict the number of characters entered into an HTML Input with CSS (or jQuery, if necessary)?

jquery,html,css,dynamic,restrict

jsFiddle First, set maxlength like: <input type="text" id="txtbxSSNOrITIN" maxlength="5"> $(document).on("change", '[id$=ckbxEmp]', function () { var ckd = this.checked; // ckd is now a boolean $('[id$=txtbxSSNOrITIN]') .attr("maxlength", ckd? 2 : 5) // 2 characters if checked, else 5 .css({ background: ckd? '#ffff00' : "green", // yellow if checked, else green width:...

Ripple effect over colored ImageButton?

java,android,android-layout,dynamic

Maybe try something like this: bar.getBackground().setColorFilter(Color.RED, Mode.MULTIPLY); You need to check what MODE would be apopriate, because i don't have big experience with this....

Can I dynamically set the recipient of mailto: using only HTML and JavaScript depending on URL used to access the site?

javascript,html,email,dynamic,mailto

var l=window.location+''; l=l.replace(/http(s*):\/\/(www\.)*/,''); l=l.split('/')[0]; //get the domain var mailto='privacy-'+l+'@example.com'; ...

Instantiate JS Object that take array of arguments from String name

javascript,class,object,dynamic

Thank you all for the wonderful suggestions. I combined part of the answers here in addition to this SO answer: var className = new window['MyClassName'] var instantiatedClass = className.bind.apply(className, [null, arg1, arg2, ...]); ...

AngularJS - Dynamic URLs for new page

angularjs,url,dynamic

First of all you need to include angular-route.js file for angular. Refer this. https://docs.angularjs.org/misc/downloading angular.module('myapp',[]). config(['$routeProvider', function ($routeProvider) { $routeProvider.when('/', { templateUrl: '/menu/Noodle.html', controller: HomeController }); $routeProvider.when('/about', { templateUrl: '/pages/about.html', controller: AboutController }); $routeProvider.when('/privacy', { templateUrl: '/pages/privacy.html', controller: AboutController }); $routeProvider.when('/terms', { templateUrl:...

C# Delete Row with Dynamic Textbox/Button/Grid

c#,wpf,button,dynamic,textbox

WPF's ItemsControl is the correct way to show items in your views when the number of items can change. Many controls inherit from ItemsControl, like the ComboBox itself, or the DataGrid, or the ListBox... But in this example I'll use ItemsControl directly, since what you're trying to do doesn't need...

javascript dynamic structure with array or object

javascript,arrays,object,dynamic

You can first create an empty object and fill it as and when the data comes like users[user.id] = {}; For an example: var users = {}; var user = {id : 1}; //Data received(Just an example) users[user.id] = {}; var session = {id1 : 1.1}; //Data received users[user.id][session.id1] =...

How can I rewrite this LINQ query with reflection

c#,linq,dynamic,reflection

Use the reflection to create the query, not in the query. Consider: public static IQueryable<Profile> Filter( this IQueryable<Profile> source, string name, Guid uuid) { // .<name>UUID var property = typeof(Profile).GetProperty(name + "UUID"); // p var parExp = Expression.Parameter(typeof(Profile)); // p.<name>UUID var methodExp = Expression.Property(parExp, property); // uuid var constExp =...

Dynamic Array Size in C++

c++,arrays,dynamic,int,sizeof

You cannot create an array with run-time size, it must be known at compile time. I would recommend a std::vector instead. One solution would be to count the characters after converting to a string #include <string> int MyFunction(int number) { std::vector<int> myarr(std::to_string(number).size()); } Mathematically, you can take the log (base...

How to wrap 2 dynamic html element using jquery?

jquery,dynamic,wrap

Try utilizing $.each() , .appendTo() , .append() ; setting ol li , b class to code property of data $(function() { var data = [{ "name": "Afghanistan", "code": "A" }, { "name": "Bouvet Island", "code": "B" }, { "name": "Cook Islands", "code": "C" }]; $.each(data, function(key, val) { if (!$("#aZContent...

why does the following code crash. (dynamic memory)?

c++,memory,dynamic

int* array = new int(10); This creates one int with value 10... for 10 ints you want [10] not (10). Then I suggest you put in... std::cerr << "j " << j << '\n'; // add some trace array[j] = counter; ...and learn to debug. When you've got it working,...

Can I access a control by the last portion of its ID in jQuery?

jquery,dynamic,sharepoint-2010

$(document).on("change", '[id$=ckbxEmp]', function () { ...