Search Results

Search found 7104 results on 285 pages for 'dynamic usercontrols'.

Page 69/285 | < Previous Page | 65 66 67 68 69 70 71 72 73 74 75 76  | Next Page >

  • Rails find_or_create by more than one attribute?

    - by tybro0103
    There is a handy dynamic attribute in active-record called find_or_create_by: Model.find_or_create_by_<attribute>(:<attribute> => "") But what if I need to find_or_create by more than one attribute? Say I have a model to handle a M:M relationship between Group and Member called GroupMember. I could have many instances where member_id = 4, but I don't ever want more than once instance where member_id = 4 and group_id = 7. I'm trying to figure out if it's possible to do something like this: GroupMember.find_or_create(:member_id => 4, :group_id => 7) I realize there may be better ways to handle this, but I like the convenience of the idea of find_or_create.

    Read the article

  • LINQ to Entities and Business / Validation Rules

    - by Chris
    We have a requirement where we need to allow users to dynamically create custom reports that will run against our database and return sets of data. It would be something similar to this: http://www.marcuswhitworth.com/2009/12/dynamic-linq-with-expression-trees/ but would ultimately contain the ability to create more complicated logic. I believe LINQ to Entities might possibly allow us to do something like we're attempting to achieve. I should note that these reports are going to need to run against multiple tables. Can anyone point me in the right direction for something like this? Has anyone done anything similar with LINQ to Entities?

    Read the article

  • using javascript setTimeout to see if div has loaded

    - by Matt
    I'm loading remote data using dynamic script tags and JSON. the remote page that I'm displaying on my website has a div in it that I use to load content into. The problem is the javascript functions do not see the div as the page loads because it is remote data. if I set a timeout of about 300 it usually works and my javascipt can see the div. But sometimes it takes longer and it breaks the javascript. I'm tring this: function load_content() { if(document.getElementById('remote_div')==null) { setTimeout('load_content()', 300); } else { document.getElementById('remote_div').innerHTML = 'Content goes here' } } but it just doesn't seem to work... what is wrong with it?

    Read the article

  • How to define a static array without a contant size in a constructor of a class? (C++)

    - by Keand64
    I have a class defined as: class Obj { public: int width, height; Obj(int w, int h); } and I need it to contain a static array like so: int presc[width][height]; however, I cannot define within the class, so it it possible to create a pointer to a 2D array (and, out of curiosity, 3, 4, and 5D arrays), have that as a member of the class, and intitalize it in the constructor like: int ar[5][6]; Obj o(5, 6, &ar); If that isn't possible, is there any way to get a static array without a contant size in a class, or am I going to have to use a dynamic array? (Something I don't want to do because I don't plan on ever changing the size of the array after it's created.)

    Read the article

  • C# 4.0 dynamics

    - by mehanik
    Hi. Code bellow is working well until I have class ClassSameAssembly in same assembly as class Program. But when I move class ClassSameAssembly to separate assembly I have runtime error. Is it posible to resolve it? using System; namespace ConsoleApplication2 { public static class ClassSameAssembly { public static dynamic GetValues() { return new { Name = "Michael", Age = 20 }; } } internal class Program { private static void Main(string[] args) { var d = ClassSameAssembly.GetValues(); Console.WriteLine("{0} is {1} years old", d.Name, d.Age); } } }

    Read the article

  • Can I add elements to a Java GUI?

    - by Asj
    I want to know how I can make a java program where an unknown amount of objects can be added to a GUI depending on user input. I can program in objects one at a time within the program, but I haven't seen a more dynamic program. Can I do that with Java? If not, what can I do it with? For more information, here's a picture. http://i6.photobucket.com/albums/y223/Asj127/CapProjIdea.jpg There can be more than one question per question block, and each question can have it's own question block.

    Read the article

  • Best approch to dynamically filter .net objects

    - by maxba
    The project i´m working currently on has a way to define a filter to filter objects from a database. This filter is a pretty straitforward class containing filtercriteria that will be combined to a sql where-clause. The goal now is to use this filter class to filter .net objects as well. So the filter for example defines, that the title property of the object that it is applied to must contain some userdefined string etc. What are ways to approch this problem? What should the filter return instead of the sql where-clause and how can it be applied to the object? I´m thinking about this for hours and don´t yet have even a slight idea how to solve this. Been thinking about reflection, dynamic code execution, building expressions but still haven´t found an acutal starting point.

    Read the article

  • are runtime linking library globals shared among plugins loaded with dlopen?

    - by conejoroy
    I've a C++ program that links at runtime with, lets say, mylib.so. then, the same program uses dlopen()/dlsym() to load a function from myplugin.so, dynamic library that in turn has dependencies to mylib.so. My question is: will the program AND the function in the plugin access the same globals defined in mydlib.so in the same memory area reserved for the program, or each will be assigned different, unrelated copies in its own memory space? if the latter is the default behaviour, is it possible to change that? Thanks in advance =)!

    Read the article

  • Adding buttons dynamically to a uitableviewcell - iPhone app

    - by alan
    I have a verb conjugation app that displays verb translations in the first cell of a table. At present the translation list is just a string (comma-separated list) but I'd like to change it to have clickable buttons. I had a play around adding buttons to the cell view without too much success but my only experience with custom cells has been using specific positioning so I'm unsure as to how to achieve a dynamic list of buttons (varying widths) within a cell. Any help greatly appreciated. Cheers.

    Read the article

  • Given a number N, find the number of ways to write it as a sum of two or more consecutive integers

    - by hilal
    Here is the problem (Given a number N, find the number of ways to write it as a sum of two or more consecutive integers) and example 15 = 7+8, 1+2+3+4+5, 4+5+6 I solved with math like that : a + (a + 1) + (a + 2) + (a + 3) + ... + (a + k) = N (k + 1)*a + (1 + 2 + 3 + ... + k) = N (k + 1)a + k(k+1)/2 = N (k + 1)*(2*a + k)/2 = N Then check that if N divisible by (k+1) and (2*a+k) then I can find answer in O(N) time Here is my question how can you solve this by dynamic-programming ? and what is the complexity (O) ? P.S : excuse me, if it is a duplicate question. I searched but I can find

    Read the article

  • How do I make a new div with a specific Id + n?

    - by Noor
    I've got a button and when it's pushed this code launches: var nrDivs = "1" var neuDiv = document.createElement("div"); neuDiv.setAttribute("Id","theDiv" + nrDivs); neuDiv.innerHTML = "Text"; $('#allDivs').append(neuDiv); newfeed.draw(neuDiv); I know that right now the script creates a new div with the ID: theDiv1. What I'm trying to do is when I click the button a second time, it creates a div with the ID: theDiv2. Each time the user presses the button there should be a new div drawn and I'm trying to target that new div and insert dynamic text. Thanks, Noor

    Read the article

  • Where does memory dynamically allocated reside?

    - by Summer_More_More_Tea
    Hello everyone: We know that malloc() and new operation allocate memory from heap dynamically, but where does heap reside? Does each process have its own private heap in the namespace for dynamic allocation or the OS have a global one shared by all the processes. What's more, I read from a textbook that once memory leak occurs, the missing memory cannot be reused until next time we restart our computer. Is this thesis right? If the answer is yes, how can we explain it? Thanks for your reply. Regards.

    Read the article

  • how to get a constant in java with class

    - by vincent
    basically I need to get a constant for a class however I have no instance of the object but only its class. In PHP I would do constant(XYZ); Is there a similar way of retrieving a constant in JAVA? I need it to facilitate a dynamic getMethod call Class parameterType = Class.forName(class_name); object.setProperty(field name, field value, parameterType); the set property method would then get the correct method and set the specified property, however I cant get a method which has int as parameter type without using Interger.TYPE

    Read the article

  • Can't access variables from dynamically loaded javascript

    - by Menno
    I'm using a fairly simple system to load javascript dynamically: include = function (url) { var e = document.createElement("script"); e.src = url; e.type="text/javascript"; document.getElementsByTagName("head")[0].appendChild(e); }; Let's say I have a file test.js which has the following contents: var foo = 4; Now, in my original script, I want to use include(test.js); console.log(foo); However, I get a 'foo has not been defined' error on this. I'm guessing it has to do with the dynamic script being included as the last child of the <head> tag. How can I get this to work?

    Read the article

  • Using database default values with Linq to SQL codewise

    - by Ivo
    I am using Dynamic Data with linq to SQL and SQL Server 2008. I have a GUID column that gets his value from the default value with newguid(). When I set IsDbGenerated to true in the designer it works like a charm. But when I renew table this property is set back to false again. So I added it to the metadata. For some reason it's not being pickup, "00000000-0000-0000-0000-000000000000" is being inserted in database. The displayname and readonly change are being pick up. What am I missing? [MetadataType(typeof(CMS_Data_HistoryMetadata))] public partial class CMS_Data_History { } [TableName("Content")] public class CMS_Data_HistoryMetadata { [DisplayName("Pagina Title")] public object pageTitleBar { get; set; } [ReadOnly(true)] [DisplayName("Versie")] public object version_date { get; set; } [ColumnAttribute(IsDbGenerated = true)] public object entity_id; }

    Read the article

  • dynamically create greasemonkey script

    - by qwertymk
    I'm trying to create a dynamic GM script. Here's what I thought would do it win = window.open('myScript.user.js'); win.document.writeln('// ==UserScript=='); win.document.writeln('// @name sample script'); win.document.writeln('// @description alerts hi'); win.document.writeln('// @include http://www.google.com/*'); win.document.writeln('// ==/UserScript=='); win.document.writeln(''); win.document.writeln('(function(){alert("hi");})()'); win.document.close(); Well it doesn't. Anyone have any ideas how to go about doing this?

    Read the article

  • Why does C++ allow variable length arrays that aren't dynamically allocated?

    - by Maulrus
    I'm relatively new to C++, and from the beginning it's been drilled into me that you can't do something like int x; cin >> x; int array[x]; Instead, you must use dynamic memory. However, I recently discovered that the above will compile (though I get a -pedantic warning saying it's forbidden by ISO C++). I know that it's obviously a bad idea to do it if it's not allowed by the standard, but I previously didn't even know this was possible. My question is, why does g++ allow variable length arrays that aren't dynamically allocated if it's not allowed by the standard? Also, if it's possible for the compiler to do it, why isn't it in the standard?

    Read the article

  • Disable Foreign Key Exposure in Entity Framework?

    - by davemackey
    When I originally created a Dynamic Data project I told it to expose the foreign keys, but now I can't make mappings between two entities b/c of the foreign keys. When I click on mapping details while focused on my association I receive the message: Mappings are not allow for an association over exposed foreign keys. So I'd like to disable the exposure of the foreign keys but am unsure how to do this without creating a new Entity Model from scratch. I'm not far along - so that wouldn't be hard, but I imagine there must be a programmatic switch for this?

    Read the article

  • Writing complex records to file

    - by DrSobhani
    Hi I have defined some records in my project which may be consisted of other records and also dynamic arrays of normal data types and other records , it is n example of a record type Type1=record x:integer; end; Type2=record Y:array of X; str:string; end; When I tried to save one of variables of these records type to file with blockwrite function like this : var Temp1:Type2; begin setlength(temp1.y,100); blockwrite(MyFile,Temp1,sizeOf(Temp1); it just wrote as much as the size of pure record is ,but temp1 has a dynmic arrays which is resized , Could someone please tell me how I can write a complex record to a file , I mean something like what is used in VB6 . Thanks

    Read the article

  • Adding code to the beginning / end of methods in runtime dynamically

    - by Irchi
    I know instrumentation is a technique to add trace code dynamically into the methods to enable tracing and debugging. I was wondering if this is only a "Trace" option, hard coded into the CLR to add only trace code, or is there the ability to add any code to the methods? For example, I want to check for a condition in the beginning of every single method call in a certain class (say for permissions). Can I do this via adding dynamic code to the beginning of the methods in execution time? I'm not sure how this trace "instrumentation" thing works, but I'm wondering if this can be used for other goals too, or not.

    Read the article

  • Rails - How do you dynamically call the request methods "get put destroy etc" at runtime in tests

    - by adam
    I'm always writing tests to check my controller restricts people from certain actions depending on their status i.e. logged in, admin? etc Regardless of whether its a get to :index or a puts to :create the code is always the same. I'm trying to refactor this so that i have one method such as should_redirect_unauthenticated_to_login_action(request, action) and call it like so should_redirect_unauthenticated_to_login_action(:get, :index) = get :index But not sure how to dynamically call the various response methods rails provides for functional tests which seem to live in the module ActionController I mucked around with module = Kernel.const_get("ActionController") module::TestProcess.get NoMethodError: undefined method `get' for ActionController::TestProcess:Module can anyone help (im very new to dynamic calling in ruby)

    Read the article

  • How to create custom CSS "on the fly" based on account settings in a Django site?

    - by sdolan
    So I'm writing a Django based website that allows users select a color scheme through an administration interface. I already have middleware/context processors that links the current request (based on domain) to the account. My question is how to dynamically serve the CSS with the account's custom color scheme. I see two options: Add a CSS block to the base template that overrides the styles w/variables passed in through a context processors. Use a custom URL (e.g. "/static/dynamic/css//styles.css") that gets routed to a view that grabs all the necessary values and creates the css file. I'm content with either option, but was wondering if anyone else out there has dealt with similar problems and could give some insight as to "Best Practices".

    Read the article

  • Browsing to Subversion repository location indicated in Apache conf file

    - by sonrael
    I have Subversion 1.6.6 and Apache 2.2.14 installed and working. I have made the following changes to the Apache httpd.conf file: #Uncommented by me for Subversion installation LoadModule dav_module modules/mod_dav.so LoadModule dav_fs_module modules/mod_dav_fs.so #Added by me for subversion installation LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so < Location /svn DAV svn SVNPath C:\Users\RED\Repositories < /Location ...When I navigate to localhost Apache is working properly, but if I try to go to localhost/svn the browser just hangs waiting for a response from the server. What is supposed to happen here? Does it have to do with the fact that I'm behind a wireless router on a dynamic IP address (although I can access localhost no problem so...)? As you can see I'm on windows (Vista)

    Read the article

  • Aside from performance concerns, is Java still chosen over Groovy/JRuby etc.?

    - by yar
    [This is an empirical question about the state-of-the-art: I am NOT asking if Java is cooler or less cool than the dynamic languages that work in the JVM.] Aside from cases where performance is a main decision factor, do companies/developers still willingly chose Java over Groovy, JRuby or JPython? Personal Note: The reason I am asking is that, while I do some subset of my professional work in Ruby (not JRuby, for now), in my personal projects I use Java. While I have written non-trivial apps in Groovy, I prefer Java, but I wonder if I should just get over it and do everything in Groovy. I like Java because I feel that static typing saves me time and aids refactoring. (No, I am not familiar with Scala.) However, I feel that this very empirical, on-topic programming question may inform my decision.

    Read the article

  • AppEngine: Can I write a Dynamic property (db.Expando) with a name chosen at runtime?

    - by MarcoB
    If I have an entity derived from db.Expando I can write Dynamic property by just assigning a value to a new property, e.g. "y" in this example: class MyEntity(db.Expando): x = db.IntegerProperty() my_entity = MyEntity(x=1) my_entity.y = 2 But suppose I have the name of the dynamic property in a variable... how can I (1) read and write to it, and (2) check if the Dynamic variable exists in the entity's instance? e.g. class MyEntity(db.Expando): x = db.IntegerProperty() my_entity = MyEntity(x=1) # choose a var name: var_name = "z" # assign a value to the Dynamic variable whose name is in var_name: my_entity.property_by_name[var_name] = 2 # also, check if such a property esists if my_entity.property_exists(var_name): # read the value of the Dynamic property whose name is in var_name print my_entity.property_by_name[var_name] Thanks...

    Read the article

< Previous Page | 65 66 67 68 69 70 71 72 73 74 75 76  | Next Page >