Search Results

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

Page 170/255 | < Previous Page | 166 167 168 169 170 171 172 173 174 175 176 177  | Next Page >

  • How to check with PHP does a SQL database already have

    - by Dan Horvat
    I've tried to find the answer to this question but none of the answers fit. I have two databases, one has 15.000.000 entries and I want to extract the necessary data and store it in a much smaller database with around 33.000 entries. Both databases are open at the same time. Or at least they should be. While having the big database open and extracting the entries from it, is it possible to check whether the value already exists in the smaller database? I just need some generic way which checks that.

    Read the article

  • Best Practice for CouchDB Document Versioning

    - by Groundwater
    Following my question here I am exmploring ideas for a generic approach to document versioning in CouchDB. While I imagine there may be no canonical approach, I had the following idea and am looking for feedback. I would like to maintain readable document ids as much as possible, so a document existing at /document1 would contain a pointer document to all existing versions on the system. The actual revision documents would be at something like /document1/308ef032a3801a where 308ef032a3801a is some random number or hash. Example The pointer document { "_id" : "document1", "versions" : [ "document1/308ef032a3801a" ] } The version document { "_id" : "document1/308ef032a3801a", ... actual content }

    Read the article

  • Retreiving data from grid view cell to a text box

    - by Bader
    Hello , i am trying to retrieve a cell data to a textbox , that will happen when i select any row in the grid view , the textbox will take the new value i already enabled auto post back to the textbox here is my code protected void GridView2_SelectedIndexChanged(object sender, EventArgs e) { TextBox3.Text = GridView2.Rows[GridView2.SelectedIndex].Cells[2].Text; } however , there is not error in the syntax , it doesn't retrieve any thing in the textbox , any suggestions ? i am using using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.SqlClient; using System.Data.Sql; i work in C# , Visual studio 2010 express web developer

    Read the article

  • jquery ajax call errors in chrome onenter with no responseText

    - by wham12
    I've built a login page that uses a .ajax call to a generic c# handler (.ashx) to validate the username and password before allowing the user to log in. If you click on the login link <a href="#" class="ui-state-default ui-corner-all CustomButton" onclick="goLogin();return false"> the .ajax call returns successfully and it logs the user in. I am trying to make it so the user can also just press the "enter" key from the password box: $("#pword").keydown(function(e) { if (e.keyCode == 13) { goLogin(); } }); Using Firefox, both ways work just fine and the user is logged in. With Chrome however, pressing "enter" hits the error function of my .ajax call and will not log the user in. The parameters and responses look identical through Firefox's console, as expected. What would be causing this and/or how can I debug it in Chrome?

    Read the article

  • C# Elegant way to handle checking for an item in a collection.

    - by JL
    I've posted a code sample below. Firstly let me explain termStore.Groups in the code below is a collection of Group Objects (The exact class is irrelevant). Checking for null : if (termStore.Groups[groupName] == null) seems like a logical (clean) approach, but if the Groups collection is empty then an exception is produced. using the termStore.Groups.Contains is not an option either because this expects a strong type i.e: .Contains(Group)... not .Contains(GroupName as string) Can someone recommend a clean / generic way I can check for if an item exists in collection . Thank you.... TermStore termStore = session.TermStores.Where(ts => ts.Name == termStoreName).FirstOrDefault(); if (termStore.Groups[groupName] == null) { termStore.CreateGroup(groupName); termStore.CommitAll(); } Update: The exact class Sharepoint Taxonomy Classes. http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.taxonomy.group.aspx

    Read the article

  • Which .NET exception to throw for invalid database state?

    - by jslatts
    I am writing some data access code and I want to check for potentially "invalid" data states in the database. For instance, I am returning a widget out of the database and I only expect one. If I get two, I want to throw an exception. Even though referential integrity should prevent this from occurring, I do not want to depend on the DBAs never changing the schema. I would like to use the System.IO.InvalidDataException, except that I am not dealing with a file stream so it would be misleading. I ended up going with a generic applicationexception. Anyone have a better idea?

    Read the article

  • Creating parameterized type object using annonymous class

    - by Andrei Fierbinteanu
    This might be a stupid question, but I just saw a question asking how to create a Type variable for a generic type. The consensus seemed to be that you should have a dummy method returning that type, and then use reflection to get it (in this case he wanted Map<String, String>). Something like this : public Map<String, String> dummy() { throw new Error(); } Type mapStringString = Class.forName("ThisClass").getMethod("dummy").getGenericReturnType(); My question is, not having used reflection that much, couldn't you just do something like: Type mapStringString = new ParameterizedType() { public Type getRawType() { return Map.class; } public Type getOwnerType() { return null; } public Type[] getActualTypeArguments() { return new Type[] { String.class, String.class }; } }; Would this work? If not, why not? And what are some of the dangers/problems if it does (besides being able to return some Type like Integer<String> which is obviously not possible.

    Read the article

  • Clean way in GWT/Java to wait for multiple asynchronous events to finish

    - by gerdemb
    What is the best way to wait for multiple asynchronous callback functions to finish in Java before continuing. Specifically I'm using GWT with AsyncCallback, but I think this is a generic problem. Here's what I have now, but surely there is cleaner way... AjaxLoader.loadApi("books", "0", new Runnable(){ public void run() { bookAPIAvailable = true; ready(); }}, null); AjaxLoader.loadApi("search", "1", new Runnable(){ public void run() { searchAPIAvailable = true; ready(); }}, null); loginService.login(GWT.getHostPageBaseURL(), new AsyncCallback<LoginInfo>() { public void onSuccess(LoginInfo result) { appLoaded = true; ready(); } }); private void ready() { if(bookAPIAvailable && searchAPIAvailable && appLoaded) { // Everything loaded } }

    Read the article

  • How do you set a cookie to be accessible across the entire domain in Javascript

    - by Tzarkov
    I suppose there should be a way to set a cookie to be accessible from the entire domain nevermind from which directory you are setting the cookie. Say in mypage.com/blue/index.php y set the cookie "colour=blue;" this way: document.cookie = "colour" + "=" + "blue" + "; expires=" + expireDate.toGMTString() + "; path=/"; Using this code, the cookie retrieval function in mypage.com/home.php can't access the content of the cookie. If it was just from first level directories that the cookie needs to be set, we would be ok by doing path=../ instead of path=/ But how do you go about writing generic code that sets a cookie that is accessible from any page in that domain not minding how deep in the file structure is the page the cookie is being set from?

    Read the article

  • git merge different repositories?

    - by baloo
    I've been using SVN for all my projects. Sometimes project B is originating as a copy from project A. When project A has a generic change, I can use svn merge A within directory B and it will merge those changes. Now, if I wanted to use git. I don't like having all my projects in the same repository since I then have to clone everything and can't pick just one project like in SVN. But having one repository for each project, how do I go about doing the same like I did earlier with SVN? The question is: What's the best way to structure it if I want several subprojects that really all relates to one original project and to keep them in sync? And that I also want to be able to check them out separately

    Read the article

  • How to show ajax loading gif only for a specific request?

    - by innerJL
    How do you show ajax gif only for a specific request? For example my page is calling a web-service every 30 seconds in a background, and I don't want to show the gif during this callback. On the other hand I want to show the gif, when I'am making manual ajax requests. I am using jQuery. edit: I didn't setup the global handler as shown here http://api.jquery.com/ajaxStart/, just by attaching to the .ajaxStart event. But I don't want to show/hide the gif manually on every request too. I need some generic solution.

    Read the article

  • is there some lightweight tecnique for adding type safety to identifier properties?

    - by shoren
    After using C++ I got used to the concept of Identifier which can be used with a class for the type, provides type safety and has no runtime overhead (the actual size is the size of the primitive). I want to do something like that, so I will not make mistakes like: personDao.find(book.getId());//I want compilation to fail personDao.find(book.getOwnerId());//I want compilation to succeed Possible solutuions that I don't like: For every entity have an entity id class wrapping the id primitive. I don't like the code bloat. Create a generic Identifier class. Code like this will not compile: void foo(Identifier book); void foo(Identifier person); Does anyone know of a better way? Is there a library with a utility such as this? Is implementing this an overkill? And the best of all, can this be done in Java without the object overhead like in C++?

    Read the article

  • How to normalize a database where different user groups have different kinds of profiles?

    - by Stephen
    My application database has a Groups table that separates users into logical roles and defines access levels (admin, owner, salesperson, customer service, etc.) Groups has many Users. The Users table contains login details such as username and password. Now I wish to add user profiles to my database. The trouble I'm having (probably due to my relative unfamiliarity with proper database normalization) is that different user groups have different kinds of profiles. Ergo, a salesperson's profile will include his commission percentage, whereas an admin or customer service would not need this value. So, would the proper method be to create a unique profile table for each group? (e.g. admin_profiles, or salesperson_profiles). or is there a better way that combines certain details in a generic profile, while some users have extended info. And if so, whats a good example of how to do this with the commission example given?

    Read the article

  • How to write different implicit rules for different file names for GNU Make

    - by anupamsr
    Hi! I have a directory in which I keep adding different C++ source files, and generic Makefile to compile them. This is the content of the Makefile: .PHONY: all clean CXXFLAGS = -pipe -Wall -Wextra -Weffc++ -pedantic -ggdb SRCS = $(wildcard *.cxx) OBJS = $(patsubst %.cxx,%.out,$(SRCS)) all: $(OBJS) clean: rm -fv $(OBJS) %.out: %.cxx $(CXX) $(CXXFLAGS) $^ -o $@ NOTE: As is obvious from above, I am using *.out for executable file extensions (and not for object file). Also, there are some files which are compiled together: g++ file_main.cxx file.cxx -o file_main.out To compile such files, until now I have been adding explicit rules in the Makefile: file_main.out: file_main.cxx file.cxx file.out: file_main.out @echo "Skipping $@" But now my Makefile has a lot of explicit rules, and I would like to replace them with a simpler implicit rule. Any idea how to do it?

    Read the article

  • I would like to learn C++, what is the first step ?

    - by Cesar
    My actual experience comes from PHP and Delphi(Borland) and recently also from Obj-C (iPhone sdk). In the past I also used Java, Python, VB 6 and some other scripting language. I would like to learn C++ because i need a standard tool for write compiled applications with good performance but i have no idea about witch environment i have to choose (Ex: Borland, Microsoft, Eclipse+MinGW, ...). Based those parameters: Most useful more opensource project or work requests Most standard not a proprietary versions Biggest community documentation, manuals, tutorials, forums... Better IDE add-ons, highlight, debug, cross platform, autocomplete... Easy setup A simple setup, to focus on learning the basics Actually I'm on OSX but I can use a VM if needed. Advices about tutorial or books are welcome. I hope it's not too generic as question.

    Read the article

  • Does Apache allow to authorize an HTTP request based on a result of a subrequest?

    - by Jan Wrobel
    I'm looking for an equivalent of nginx http auth request module but for Apache. For each incoming HTTP requests, the module sends a subrequests to authentication/authorization back-end. Th auth request carries a path and all headers of the original request. Based on the result of the auth request, the original requests is allowed (HTTP code 200), denied (HTTP code 403) or login is requested (HTTP code 401). Such a generic mechanism allows to build really flexible authentication and authorization schemes. Is something like this possible in Apache (likely with a help of some third party module)?

    Read the article

  • A gridview for debugging collections?

    - by Llewellyn
    Hi Guys, I'm working with fairly large generic collections and I need a quick way to view all the items and their properties in these collections while debugging. When I say view all the items, I mean I would like to view the collection as if it was bound to say.. a gridview. That was I could see all all the item properties listed. Currently VS2010 displays the collection object during debugging, but it takes several clicks before I can view any item's properties within the collection. As I'm using collection with 50 to 100 items in them, I've having a hard time getting a feel for the collection data because of having to click through to view each individual item's properties during debugging. Do you have any ideas or know of a visual studio plugin that can help display collections in a table format or gridview format? Thanks for you time

    Read the article

  • How to generilize view?

    - by MexicanHacker
    Hey guys, I'm in the process of designing a set of views that use the same model in my app, the difference is that some views will differ in Read Only and Modifiable fields. So for example for view A I want to be able to modify A.One but no A.Two properties and for view B I want to have B.One and B.Two as modifiable fields. I was thinking in having a map that will hold this information and iterate both the modifiable and non-modifiable lists in a generic view, but I was thinking that maybe I can get feedback from you guys. What do you think?

    Read the article

  • Interview Programming Questions - In house Exam

    - by David McGraw
    I have a company that would like to bring me in to serve me an hour long exam. No resources other than a pencil and paper. I really couldn't get any sort of feedback on the type of exam (implementation or generic) beside that it would test a few specific areas. Have you done anything like this? What sort of questions did they ask? What's a good way to prepare? I'll probably go in a couple weeks before school starts back up. A time sensitive exam structure is a weak point for me, so what should I absolutely focus down on? If they like the exam, that's when I'll get a face-to-face meeting. An advance thanks goes to everybody who provide their time.

    Read the article

  • Regular expressions in java

    - by rookie
    String s= "(See <a href=\"/wiki/Grass_fed_beef\" title=\"Grass fed beef\" " + "class=\"mw-redirect\">grass fed beef.) They have been used for " + "<a href=\"/wiki/Paper\" title=\"Paper\">paper-making since " + "2400 BC or before."; In the string above I have inter-mixed html with text. Well the requirement is that the output looks like:- They have been used for paper-making since 2400 BC or before. Could some one help me with a generic regular expression that would produce the desired output from the given input? Thanks in advance!

    Read the article

  • C# - Why can't I enforce derived classes to have parameterless constructors?

    - by FrisbeeBen
    I am trying to do the following: public class foo<T> where T : bar, new { _t = new T(); private T _t; } public abstract class bar { public abstract void someMethod(); // Some implementation } public class baz : bar { public overide someMethod(){//Implementation} } And I am attempting to use it as follows: foo<baz> fooObject = new foo<baz>(); And I get an error explaining that 'T' must be a non-abstract type with a public parameterless constructor in order to use it as parameter 'T' in the generic type or method. I fully understand why this must be, and also understand that I could pass a pre-initialized object of type 'T' in as a constructor argument to avoid having to 'new' it, but is there any way around this? any way to enforce classes that derive from 'bar' to supply parameterless constructors?

    Read the article

  • Asp.net project is not recognising one of the folders in my class library.

    - by Rachel
    I am developing a project using Visual Studio 2008 in C#, I have added the class library within the project and set up the relevant references and used the relevant using statements. It seems to be a problem with just this one folder. can anyone help? this is the error message: Error 28 The type or namespace name 'Domain' does not exist in the namespace 'Forestry.SchoolLibrary' (are you missing an assembly reference?) C:\Projects\SchoolofForestry\trunk\Source\School\Account\Presenter\EditAccountPresenter.cs 26 40 School these are my using statements: using System; using System.Collections.Generic; using System.Configuration; using System.Linq; using System.Data.Linq; using System.Text; using System.Xml; using Forestry.SchoolLibrary.Core.Domain; using Forestry.SchoolLibrary.Properties;

    Read the article

  • haskell sorting

    - by snorlaks
    Hello, How can it be done in most simply way to write (or maybe there is something embedded in haskell) function which takse as arguments list of tuples (String, Int) and Int x and return top x tuples as list according to x value. I wonder if its possible to write a function which also takes 3 argument which is the name of (or index) of filed in tuple according to which sorting has to be done. What are best solutions to make it quite generic, Im new to haskell I would do somethink like that in imperative languages without any problems but I want to know how to write it in quite good way in haskell, thanks for help

    Read the article

  • How to bind to foreach context ?

    - by Rebol Tutorial
    Currently I have this snippet of code: save-blocks: func[file /local f out][ foreach [field1 field2 field3 field4 field5 field6 field7 field8 field9] blocks [ out: copy "" repeat n 9 [ part: get bind to-word rejoin ["field" n] 'field1 out: rejoin [out part ";"] ] remove back tail out write/lines/append f out ] It's not generic enough, I'd like to pass this block: [field1 field2 field3 field4 field5 field6 field7 field8 field9] as parameter and write something like this: save-blocks: func[block file /local f out][ foreach block blocks [ out: copy "" repeat n 9 [ part: get bind to-word rejoin ["field" n] 'field1 out: rejoin [out part ";"] ] remove back tail out write/lines/append f out ] But I don't know how to bind in this case too hard for me :(

    Read the article

  • Rails has_one vs belongs_to semantics

    - by Anurag
    I have a model representing a Content item that contains some images. The number of images are fixed as these image references are very specific to the content. For example, the Content model refers to the Image model twice (profile image, and background image). I am trying to avoid a generic has_many, and sticking to multiple has_one's. The current database structure looks like: contents - id:integer - integer:profile_image_id - integer:background_image_id images - integer:id - string:filename - integer:content_id I just can't figure out how to setup the associations correctly here. The Content model could contain two belongs_to references to an Image, but that doesn't seem semantically right cause ideally an image belongs to the content, or in other words, the content has two images. This is the best I could think of (by breaking the semantics): class Content belongs_to :profile_image, :class_name => 'Image', :foreign_key => 'profile_image_id' belongs_to :background_image, :class_name => 'Image', :foreign_key => 'background_image_id' end Am I way off, and there a better way to achieve this association?

    Read the article

< Previous Page | 166 167 168 169 170 171 172 173 174 175 176 177  | Next Page >