dynamic

C++11 dynamically allocated variable length multidimensional array

人盡茶涼 提交于 2019-12-11 09:37:58
问题 I've been trying to create a variable length multidimensional array. As I understand, you can't create variable length arrays on the stack, but you can create 1D variable length arrays in C++ using dynamic allocation. Correct me if this is a compiler extension, but it seems to work fine on clang and gcc with --pedantic set. int size = 10; int *ary = new int[size](); I tried to extend the concept to multidimensional arrays. Here are my results. The problem with possiblity 1 and 2 is that they

Dynamic C/C++ lib for Android 2.2: error Symbol not found

那年仲夏 提交于 2019-12-11 09:34:20
问题 I have two projects. One of them is Android app with native code, which just loads dynamically library android_lib.so. Another project is that library (android_lib.so). Code of this library is simple just for learning how things are going. It has only one function. Here is it: int calculate (int x, int y) { return (x*x+y*y); } In Makefile I use cross-platform compilator from Android 2.2 toolchains (/usr/local/android-ndk-r8/toolchains/arm-linux-androideabi4.4.3/prebuilt/linux-x86/bin/arm

Pass value and unique identifier to function with ng-change with dynamic content

夙愿已清 提交于 2019-12-11 09:33:23
问题 It's a huge title, but it tells about everything, but let me clarify. I have generator that produces a HTMLstring for an input field (range, checkbox, ...). This massive string then gets placed in the HTML via $templateCache.put('dynamicSettings, htmlString) Example of a possible string: var htmlString = "<input type='range' min='0' max='10' value='5' ng-model='sliderBrightness' ng-change='settingsInputChanged(sliderBrightness, 'sliderBrightness')'>"; When I hardcode this string in my HTML

Accessing dynamic property names in Jquery/Javascript

痞子三分冷 提交于 2019-12-11 09:31:57
问题 In a plugin I'm writing, the dev can specify options, which I'm storing and referencing like so: (function( $, window) { $.widget("mobile.plug", $.mobile.widget, { options: { menuWidth: '25%', middleWidth: '25%', mainWidth: '25%' }, some: function(){ var self = this, o = self.options; console.log( o.menuWidth ); } }) }) (jQuery,this); My Question : Say I want to loop through all three elements (main, menu, middle) and get the respective option value, how would I construct o.[elem]Width

Create a Dynamic Site Address in a Wordpress Menu

痴心易碎 提交于 2019-12-11 09:29:21
问题 I'm doing some work on an existing site that is based on the Wordpress theme, but uses about 15 plugins (Including Buddypress). One in particular is the WP Sliding Login|Dashboard plugin, which has a link to the user's activity feed. I found the code that creates that link in the wp-sliding-login-dashboard.php file: <?php if ( is_user_logged_in() ) { global $current_user; $username = $current_user->user_login; echo ' <li><a href="http://www.mywebsitename.com/members/' . $username . '/activity

Binding exception with dynamic keyword in c#

耗尽温柔 提交于 2019-12-11 09:27:58
问题 I am loading my assemblies at run time and I am also using Instance Activator to get the code at the runtime. Following code will summerize what I am doing: dynamic powerTool; System.Reflection.Assembly assembly = System.Reflection.Assembly.LoadFrom( @"C:\Users\c_desaik\Desktop\PowerTool.exe"); Type type = assembly.GetType("PowerTool.Automation"); powerTool = Activator.CreateInstance(type); Now, as you have noticed, Powertool has been declared as dynamic because I do not want my code to fail

VBS for excel: Using a script variable in Range selection

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 09:11:30
问题 I've seen similar questions asked for using VBA in excel, but I'm using VBScript so it's a bit different. The answers to the other questions gave me some clues, but I just don't know how to fix this. I'm using .SetSourceData to define a range to use in a graph. It works fine to define the range from the first to the last row (whole sheet) but I want to define a dynamic range using a variable defined earlier. So this works: .SetSourceData objWorksheet.Range("E1","F" & LastRow), xlColumns where

Is it possible to access Expandoobject properties by index?

扶醉桌前 提交于 2019-12-11 09:11:25
问题 It is possible to override the TryGetIndex method of a dynamic object to access the dynamic object properties by index however I am dealing with an Expandoobject (of the System.dynamic namespace) which you can't inherit from. Is there a way around this? Thanks 回答1: ExpandoObject is nothing but a fancy IDictionary which leverages the DLR. There is no way you can access a IDictionary<TKey,TValue> via index. You may find ElementAt method of linq useful, but it is not. There is no ordering in

Create a list of objects that directly represents an Excel sheet

余生颓废 提交于 2019-12-11 09:07:58
问题 Using LinqToExcel, I'm trying to create a dynamic list of objects that have a dynamic number of properties (with values). Essentially, the list of objects should directly represent the contents of an Excel sheet. However, I don't know the header names or the number columns before hand. The code below does not work, it doesn't even compile, but I'm hoping it will show what I'm trying to do. Also it is missing a way to loop and add the correct number of properties. The names and number of

C++ dynamic array, increasing capacity

三世轮回 提交于 2019-12-11 09:00:26
问题 I'm trying to implement a dynamic array and here is my function for increasing the capacity int* changeCapacity(int *arr, int length, int newCapacity) { int *newArr = new int[newCapacity]; if(length > newCapacity){ return 0; } else { for(int i = 0; i < length; i++){ newArr[i] = arr[i]; } delete[] arr; arr = newArr; return arr; } } This is the error i get: speicher(2465,0x7fff7cfc2310) malloc: * error for object 0x7f9742403910: pointer being freed was not allocated * set a breakpoint in malloc