Search Results

Search found 6357 results on 255 pages for 'generic relations'.

Page 120/255 | < Previous Page | 116 117 118 119 120 121 122 123 124 125 126 127  | Next Page >

  • PostgreSQL, triggers, and concurrency to enforce a temporal key

    - by Hobbes
    I want to define a trigger in PostgreSQL to check that the inserted row, on a generic table, has the the property: "no other row exists with the same key in the same valid time" (the keys are sequenced keys). In fact, I has already implemented it. But since the trigger has to scan the entire table, now i'm wondering: is there a need for a table-level lock? Or this is managed someway by the PostgreSQL itself?

    Read the article

  • Trouble with ASP.NET MVC auto-scaffolder template

    - by DanM
    I'm trying to write an auto-scaffolder template for Index views. I'd like to be able to pass in a collection of models or view-models (e.g., IQueryable<MyViewModel>) and get back an HTML table that uses the DisplayName attribute for the headings (th elements) and Html.Display(propertyName) for the cells (td elements). Each row should correspond to one item in the collection. Here's what I have so far: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> <% var items = (IQueryable<TestProj.ViewModels.TestViewModel>)Model; // How do I make this generic? var properties = items.First().GetMetadata().Properties .Where(pm => pm.ShowForDisplay && !ViewData.TemplateInfo.Visited(pm)); %> <table> <tr> <% foreach(var property in properties) { %> <th> <%= property.DisplayName %> </th> <% } %> </tr> <% foreach(var item in items) { HtmlHelper itemHtml = ????; // What should I put in place of "????"? %> <tr> <% foreach(var property in properties) { %> <td> <%= itemHtml.Display(property.DisplayName) %> </td> <% } %> </tr> <% } %> </table> Two problems with this: I'd like it to be generic. So, I'd like to replace var items = (IQueryable<TestProj.ViewModels.TestViewModel>)Model; with var items = (IQueryable<T>)Model; or something to that effect. A property Html is automatically created for me when the view is created, but this HtmlHelper applies to the whole collection. I need to somehow create an itemHtml object that applies just to the current item in the foreach loop. I'm not sure how to do this, however, because the constructors for HtmlHelper don't take a Model object. How do I solve these two problems?

    Read the article

  • Any WSGI middleware to make HTTP redirect on specific status code?

    - by Evgenyt
    I'm using Pylons and want to add some middleware to it so that it catches 401 status codes and makes HTTP Redirect (302) to Signin page. I know there is built-in StatusCodeRedirect in Pylons that acts in a similar fashion, but it does not produce HTTP redirect, and rather redirects internally (this is what I do not want). Is there any existing middleware to add, or any generic middleware that can be easily modified to make HTTP redirects on specific status codes?

    Read the article

  • How can an object not be compared to null?

    - by ProfK
    I have an 'optional' parameter on a method that is a KeyValuePair. I wanted an overload that passes null to the core method for this parameter, but in the core method, when I want to check if the KeyValuePair is null, I get the following error: Operator '!=' cannot be applied to operands of type System.Collections.Generic.KeyValuePair<string,object>' and '<null>. How can I not be allowed to check if an object is null?

    Read the article

  • regular expression for challenge value

    - by Salman
    Hi what will be the regular expression to extract challenge var value i am interested in this vlaue 03AHJ_Vut9LJLOJuCsjF9PbSSMncTyUe7Y4dHX11eRLae3LGfDZ0hSfDR7jZq2ZrKJxyC-LRSSppv72oHKaQMsd-EnoVNL6p7liTh7siN26zzTA_E2rcC_JQ15613Azz4qm8HjPtAyksUdc7QZydszwolk92hBPrAAig this value changes every time we refresh it so the expression has to be generic enough to pick up what ever is the value var RecaptchaState = { site : '6LeKCL8SAAAAADV5Dr-lfY2eOEV8rubeN25BAKp2', challenge : '03AHJ_Vut9LJLOJuCsjF9PbSSMncTyUe7Y4dHX11eRLae3LGfDZ0hSfDR7jZq2ZrKJxyC-LRSSppv72oHKaQMsd-EnoVNL6p7liTh7siN26zzTA_E2rcC_JQ15613Azz4qm8HjPtAyksUdc7QZydszwolk92hBPrAAig', is_incorrect : false, programming_error : '', error_message : '', server : 'http://www.google.com/recaptcha/api/', timeout : 18000}; any help will be appreciated, or any method to extract this value in any server side lang

    Read the article

  • Translating from cURL to straight HTTP requests

    - by Joshua
    What would the following cURL command look like as a generic (without cURL) http request? feedUri="https://www.someservice.com/feeds\ ?prettyprint=true" curl $feedUri --silent \ --header "GData-Version: 2" For example how could such an http request be expressed in the browser address bar? Partucluarly, how do I express the --header information if I were to just type out the plain http request?

    Read the article

  • Get computed font size for DOM element in JS

    - by Pekka
    Is it possible to detect the computed font-size of a DOM element, taking into consideration generic settings made elsewhere (In the body tag for example), inherited values, and so on? A framework-independent approach would be nice, as I'm working on a script that should work standalone, but that is not a requirement of course. Background: I'm trying to tweak CKEditor's font selector plugin (source here) so that it always shows the font size of the current cursor position (as opposed to only when within a span that has an explicit font-size set, which is the current behaviour).

    Read the article

  • php OOP, full sample

    - by lolalola
    Hi, On this site I found a lot of cool examples of PHP OOP. Maybe you know where to find complete examples? Guest books, registration forms, blog... When I look at the full model is much easier to understand OOP PHP. As different classes interacting with each other, exchange data How to use the generic class for sending data to the database Thanks

    Read the article

  • How can I use Generics to create a way of making an IEnumerable from an enum?

    - by Samantha J
    Given an enum like this: public enum City { London = 1, Liverpool = 20, Leeds = 25 } public enum House { OneFloor = 1, TwoFloors = 2 } I am using the following code to give me an IEnumerable: City[] values = (City[])Enum.GetValues(typeof(City)); var valuesWithNames = from value in values select new { value = (int)value, name = value.ToString() }; The code works very good however I have to do this for quite a lot of enums. Is there a way I could create a generic way of doing this?

    Read the article

  • Can multiple wordpress's feed off one database?

    - by ThomasReggi
    I am a template designer and I want to create one wordpress with all generic posts, but I don't want to have to keep logging in and copy & pasteing the same wordpress posts everytime. Can I point multiple WP installs to one database? A harder way would be export a master db and importing it to each install. Before I go crazy and try to hack something together, does anyone have any advise? -Thanks in advance.

    Read the article

  • C# delegates problem

    - by Mick Taylor
    Hello I am getting the following error from my C# Windows Application: Error 1 No overload for 'CreateLabelInPanel' matches delegate 'WorksOrderStore.ProcessDbConnDetailsDelegate' H:\c\WorksOrderFactory\WorksOrderFactory\WorksOrderClient.cs 43 39 WorksOrderFactory I have 3 .cs files that essentially: Opens a windows Has an option for the users to connect to a db When that is selected, the system will go off and connect to the db, and load some data in (just test data for now) Then using a delegate, the system should do soemthing, which for testing will be to create a label. However I haven't coded this part yet. But I can't build until I get this error sorted. The 3 fiels are called: WorksOrderClient.cs (which is the MAIN) WorksOrderStore.cs LoginBox.cs Here's the code for each file: WorksOrderClient.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using WorksOrderStore; namespace WorksOrderFactory { using WorksOrderStore; public partial class WorksOrderClient : Form { LoginBox lb = new LoginBox(); private static WorksOrderDB wodb = new WorksOrderDB(); private static int num_conns = 0; public WorksOrderClient() { InitializeComponent(); } private void connectToADBToolStripMenuItem_Click(object sender, EventArgs e) { lb.ShowDialog(); lb.Visible = true; } public static bool createDBConnDetObj(string username, string password, string database) { // increase the number of connections num_conns = num_conns + 1; // create the connection object wodb.AddDbConnDetails(username, password, database, num_conns); // create a new delegate object associated with the static // method WorksOrderClient.createLabelInPanel wodb.ProcessDbConnDetails(new ProcessDbConnDetailsDelegate(CreateLabelInPanel)); return true; } static void CreateLabelInPanel(DbConnDetails dbcd) { Console.Write("hellO"); string tmp = (string)dbcd.username; //Console.Write(tmp); } private void WorksOrderClient_Load(object sender, EventArgs e) { } } } WorksOrderStore.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using WorksOrderFactory; namespace WorksOrderStore { using System.Collections; // Describes a book in the book list: public struct WorksOrder { public string contractor_code { get; set; } // contractor ID public string email_address { get; set; } // contractors email address public string date_issued { get; set; } // date the works order was issued public string wo_ref { get; set; } // works order ref public string status { get; set; } // status ... not used public job_status js { get; set; } // status of this worksorder within this system public WorksOrder(string contractor_code, string email_address, string date_issued, string wo_ref) : this() { this.contractor_code = contractor_code; this.email_address = email_address; this.date_issued = date_issued; this.wo_ref = wo_ref; this.js = job_status.Pending; } } // Declare a delegate type for processing a WorksOrder: //public delegate void ProcessWorksOrderDelegate(WorksOrder worksorder); // Maintains a worksorder database. public class WorksOrderDB { // List of all worksorders in the database: ArrayList list = new ArrayList(); // Add a worksorder to the database: public void AddWorksOrder(string contractor_code, string email_address, string date_issued, string wo_ref) { list.Add(new WorksOrder(contractor_code, email_address, date_issued, wo_ref)); } // Call a passed-in delegate on each pending works order to process it: /*public void ProcessPendingWorksOrders(ProcessWorksOrderDelegate processWorksOrder) { foreach (WorksOrder wo in list) { if (wo.js.Equals(job_status.Pending)) // Calling the delegate: processWorksOrder(wo); } }*/ // Add a DbConnDetails to the database: public void AddDbConnDetails(string username, string password, string database, int conn_num) { list.Add(new DbConnDetails(username, password, database, conn_num)); } // Call a passed-in delegate on each dbconndet to process it: public void ProcessDbConnDetails(ProcessDbConnDetailsDelegate processDBConnDetails) { foreach (DbConnDetails wo in list) { processDBConnDetails(wo); } } } // statuses for worksorders in this system public enum job_status { Pending, InProgress, Completed } public struct DbConnDetails { public string username { get; set; } // username public string password { get; set; } // password public string database { get; set; } // database public int conn_num { get; set; } // this objects connection number. public ArrayList woList { get; set; } // list of works orders for this connection // this constructor just sets the db connection details // the woList array will get created later .. not a lot later but a bit. public DbConnDetails(string username, string password, string database, int conn_num) : this() { this.username = username; this.password = password; this.database = database; this.conn_num = conn_num; woList = new ArrayList(); } } // Declare a delegate type for processing a DbConnDetails: public delegate void ProcessDbConnDetailsDelegate(DbConnDetails dbConnDetails); } and LoginBox.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; namespace WorksOrderFactory { public partial class LoginBox : Form { public LoginBox() { InitializeComponent(); } private void LoginBox_Load(object sender, EventArgs e) { this.Visible = true; this.Show(); //usernameText.Text = "Username"; //new Font(usernameText.Font, FontStyle.Italic); } private void cancelBtn_Click(object sender, EventArgs e) { this.Close(); } private void loginBtn_Click(object sender, EventArgs e) { // set up a connection details object. bool success = WorksOrderClient.createDBConnDetObj(usernameText.Text, passwordText.Text, databaseText.Text); } private void LoginBox_Load_1(object sender, EventArgs e) { } } } Any ideas?? Cheers, m

    Read the article

  • Dynamicall Rendering in a Scrollable Area

    - by James
    What is the generic algorithm or process that is commonly used to dynamically render portions of a scrolling area? For example, in Google Maps, when the user scrolls past the bounds of the currently rendered area, a grey checkerboard pattern is displayed within the not-yet-rendered portions while the application loads and renders those areas. I'm looking specifically for the approach, or the mathematics, related to filling a graphics area in chunks based on what has just come into view. If possible, I'm looking for anything relevant to the GDI+ process of doing so.

    Read the article

  • Behavior of virtual function in C++

    - by Summer_More_More_Tea
    Hi everyone: I have a question, here are two class below: class Base{ public: virtual void toString(); // generic implementation } class Derive : public Base{ public: ( virtual ) void toString(); // specific implementation } The question is: If I wanna subclass of class Derive perform polymophism using a pointer of type Base, is keyword virtual in the bracket necessary? If the answer is no, what's the difference between member function toString of class Derive with and without virtual?

    Read the article

  • Accessing the "super of this" in Java

    - by gerdemb
    This is what I'm doing now. Is there a better way to access the super class? public class SearchWidget { private void addWishlistButton() { final SearchWidget thisWidget = this; button.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { // A better way to access the super class? // something like "this.super" ...? workWithWidget(thisWidget); } } } } I'm programming with Google Web Toolkit, but I think this is really a generic Java question.

    Read the article

  • MSI Parameter Inspection

    - by Ben Breen
    With a windows MSI file, is there a way to grab all the possible installation parameters in .NET code? I need to make a generic user interface to configure multiple MSI files not known until run-time – then install them together in one go.

    Read the article

  • Force update in Hibernate

    - by gubrutz
    How can I force Hibernate to update an entity instance even if the entity is not dirty? I'm using Hibernate 3.3.2 GA, Hibernate Annotations and Hibernate EntityManager btw. I really want Hibernate to execute the generic UPDATE statement even if no property on the entity has changed. I need this because some event listeners need to get invoked to do some additional work when the application runs for the first time. Thanks!

    Read the article

  • Generics and anonymous type

    - by nettguy
    I understood,normally generics is for compile time safe and allow us to keep strongly typed collection.Then how do generic allow us to store anonymous types like List<object> TestList = new List<object>(); TestList.Add(new { id = 7, Name = "JonSkeet" }); TestList.Add(new { id = 11, Name = "Marc Gravell" }); TestList.Add(new { id = 31, Name = "Jason" });

    Read the article

< Previous Page | 116 117 118 119 120 121 122 123 124 125 126 127  | Next Page >