Search Results

Search found 2372 results on 95 pages for 'relational theory'.

Page 14/95 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • doctrine findby relation

    - by iggnition
    I'm having trouble selecting a subset of data with doctrine. I have 3 tables Location Contact Contact_location The contact and location tables hold a name and an id the other table holds only ID's. For instance: Location loc_id: 1 name: detroit Contact contact_id: 1 name: Mike Contact_location loc_id: 1 contact_id: 1 In doctrine there is a many to many relation between the location and contact tables with contact_location as the ref_class. What i want to do is on my location page i want to find all contacts where for instance the loc_id = 1. I tried: $this->installedbases = Doctrine::getTable('contact')->findByloc_id(1); hoping doctrine would see the relation and get it, but it does not. How can i make doctrine search in relevant related tables? I read it can be done using Findby but i find the documentation unclear.

    Read the article

  • How are hash functions like MD5 unique?

    - by Aly
    Im aware that MD5 has had some collisions but this is more of a high level question about hashing functions. If MD5 hashes any arbitrary string into a 32-digit hex value, then according to the Pigeonhole Principle surely this can not be unique as there are more unique arbitrary strings than there are unique 32-digit hex values

    Read the article

  • Data validation best practices: how can I better construct user feedback?

    - by Cory Larson
    Data validation, whether it be domain object, form, or any other type of input validation, could theoretically be part of any development effort, no matter its size or complexity. I sometimes find myself writing informational or error messages that might seem harsh or demanding to unsuspecting users, and frankly I feel like there must be a better way to describe the validation problem to the user. I know that this topic is subjective and argumentative. StackOverflow might not be the proper channel for diving into this subject, but like I've mentioned, we all run into this at some point or another. There are so many StackExchange sites now; if there is a better one, feel free to share! Basically, I'm looking for good resources on data validation and user feedback that results from it at a theoretical level. Topics and questions I'm interested in are: Content Should I be describing what the user did correctly or incorrectly, or simply what was expected? How much detail can the user read before they get annoyed? (e.g. Is "Username cannot exceed 20 characters." enough, or should it be described more fully, such as "The username cannot be empty, and must be at least 6 characters but cannot exceed 30 characters."?) Grammar How do I decide between phrases like "must not," "may not," or "cannot"? Delivery This can depend on the project, but how should the information be delivered to the user? Should it be obtrusive (e.g. JavaScript alerts) or friendly? Should they be displayed prominently? Immediately (i.e. without confirmation steps, etc.)? Logging Do you bother logging validation errors? Internationalization Some cultures prefer or better understand directness over subtlety and vice-versa (e.g. "Don't do that!" vs. "Please check what you've done."). How do I cater to the majority of users? I may edit this list as I think more about the topic, but I'm genuinely interest in proper user feedback techniques. I'm looking for things like research results, poll results, etc. I've developed and refined my own techniques over the years that users seem to be okay with, but I work in an environment where the users prefer to adapt to what you give them over speaking up about things they don't like. I'm interested in hearing your experiences in addition to any resources to which you may be able to point me.

    Read the article

  • Database structure - To join or not to join

    - by Industrial
    Hi! We're drawing up the database structure with the help of mySQL Workbench for a new app and the number of joins required to make a listing of the data is increasing drastically as the many-to-many relationships increases. The application will be quite read-heavy and have a couple of hundred thousand rows per table. The questions: Is it really that bad to merge tables where needed and thereby reducing joins? Should we start looking at horizontal partitioning? (in conjunction with merging tables) Is there a better way then pivot tables to take care of many-to-many relationships? We discussed about instead storing all data in serialized text columns and having the application make the sorting instead of the database, but this seems like a very bad idea, even though that the database will be heavily cached. What do you think? Thanks!

    Read the article

  • Strategy and AI for the game 'Proximity'

    - by smci
    'Proximity' is a strategy game of territorial domination similar to Othello, Go and Risk. Two players, uses a 10x12 hex grid. Game invented by Brian Cable in 2007. Seems to be a worthy game for discussing a) optimal strategy then b) how to build an AI Strategies are going to be probabilistic or heuristic-based, due to the randomness factor, and the high branching factor (starts out at 120). So it will be kind of hard to compare objectively. A compute time limit of 5s per turn seems reasonable. Game: Flash version here and many copies elsewhere on the web Rules: here Object: to have control of the most armies after all tiles have been placed. Each turn you received a randomly numbered tile (value between 1 and 20 armies) to place on any vacant board space. If this tile is adjacent to any ally tiles, it will strengthen each tile's defenses +1 (up to a max value of 20). If it is adjacent to any enemy tiles, it will take control over them if its number is higher than the number on the enemy tile. Thoughts on strategy: Here are some initial thoughts; setting the computer AI to Expert will probably teach a lot: minimizing your perimeter seems to be a good strategy, to prevent flips and minimize worst-case damage like in Go, leaving holes inside your formation is lethal, only more so with the hex grid because you can lose armies on up to 6 squares in one move low-numbered tiles are a liability, so place them away from your main territory, near the board edges and scattered. You can also use low-numbered tiles to plug holes in your formation, or make small gains along the perimeter which the opponent will not tend to bother attacking. a triangle formation of three pieces is strong since they mutually reinforce, and also reduce the perimeter Each tile can be flipped at most 6 times, i.e. when its neighbor tiles are occupied. Control of a formation can flow back and forth. Sometimes you lose part of a formation and plug any holes to render that part of the board 'dead' and lock in your territory/ prevent further losses. Low-numbered tiles are obvious-but-low-valued liabilities, but high-numbered tiles can be bigger liabilities if they get flipped (which is harder). One lucky play with a 20-army tile can cause a swing of 200 (from +100 to -100 armies). So tile placement will have both offensive and defensive considerations. Comment 1,2,4 seem to resemble a minimax strategy where we minimize the maximum expected possible loss (modified by some probabilistic consideration of the value ß the opponent can get from 1..20 i.e. a structure which can only be flipped by a ß=20 tile is 'nearly impregnable'.) I'm not clear what the implications of comments 3,5,6 are for optimal strategy. Interested in comments from Go, Chess or Othello players. (The sequel ProximityHD for XBox Live, allows 4-player -cooperative or -competitive local multiplayer increases the branching factor since you now have 5 tiles in your hand at any given time, of which you can only play one. Reinforcement of ally tiles is increased to +2 per ally.)

    Read the article

  • identation control while developing a small python like language

    - by sap
    Hello, Im developing a small python like language using flex, byacc (for lexical and parsing) and C++, but i have a few questions regarding scope control. just as python it uses white spaces (or tabs) for identation, not only that but i want to implement index breaking like for instance if you type "break 2" inside a while loop thats inside another while loop it would not only break from the last one but from the first loop as well (hence the number 2 after break) and so on. example: while 1 while 1 break 2 end end #after break 2 it would jump right here but since i dont have an "anti" tab character to check when a scope ends (like C for example i would just use the '}' char) i was wondering if this method would the the best: i would define a global variable, like "int tabIndex" on my yacc file that i would access in my lex file using extern. then everytime i find a tab character on my lex file i would increment that variable by 1. when parsing on my yacc file if i find a "break" keyword i would decrement by the amount typed after it from the tabIndex variable, and when i reach and EOF after compiling and i get a tabIndex != 0 i would output compilation error. now the problem is, whats the best way to see if the identation got reduced, should i read \b (backspace) chars from lex and then reduce the tabIndex variable (when the user doesnt use break)? another method to achieve this? also just another small question, i want every executable to have its starting point on the function called start() should i hardcode this onto my yacc file? sorry for the long question any help is greatly appretiated. also if someone can provide an yacc file for python would be nice as a guideline (tried looking on google and had no luck). thanks in advance.

    Read the article

  • cleaning up noise in an edge detection algoritum

    - by Faken
    I recently wrote an extremely basic edge detection algorithm that works on an array of chars. The program was meant to detect the edges of blobs of a single particular value on the array and worked by simply looking left, right, up and down on the array element and checking if one of those values is not the same as the value it was currently looking at. The goal was not to produce a mathematical line but rather a set of ordered points that represented a descritized closed loop edge. The algorithm works perfectly fine, except that my data contained a bit of noise hence would randomly produce edges where there should be no edges. This in turn wreaked havoc on some of my other programs down the line. There is two types of noise that the data contains. The first type is fairly sparse and somewhat random. The second type is a semi continuous straight line on the x=y axis. I know the source of the first type of noise, its a feature of the data and there is nothing i can do about it. As for the second type, i know it's my program's fault for causing it...though i haven't a hot clue exactly what is causing it. My question is: How should I go about removing the noise completely? I know that the correct data has points that are always beside each other and is very compact and ordered (with no gaps) and is a closed loop or multiple loops. The first type of noise is usually sparse and random, that could be easily taken care of by checking if any edges is next that noise point is also counted as an edge. If not, then the point is most defiantly noise and should be removed. However, the second type of noise, where we have a semi continuous line about x=y poses more of a problem. The line is sometimes continuous for random lengths (the longest was it went half way across my entire array unbroken). It is even possible for it to intersect the actual edge. Any ideas on how to do this?

    Read the article

  • C or C++ to write a compiler?

    - by H.Josef
    I want to write a compiler for a custom markup language, I want to get optimum performance and I also want to have a good scalable design. Multi-paradigm programming language (C++) is more suitable to implement modern design patterns, but I think that will degrade performance a little bit (think of RTTI for example) which more or less might make C a better choice. I wonder what is the best language (C, C++ or even objective C) if someone wants to create a modern compiler (in the sense of complying to modern software engineering principles as a software) that is fast, efficient, and well designed.

    Read the article

  • SqlCommandBuilder.DeriveParameters(command) and IsNullable

    - by Andrey
    I have written an O/R database wrapper that generates some wrapper methods for stored procs it reads from the database. Now I need to produce some custom wrapper code if an input parameter of a stored proc is defaulted to NULL. The problem is - I get stored proc parameters using: SqlCommandBuilder.DeriveParameters(command) and it doesn't bring parameter defaults. Is there any way to look up those defaults? Are they stored anywhere in the database? BTW, I'm using SQL Server 2008

    Read the article

  • mysql Delete and Database Relationships

    - by Colin
    If I'm trying to delete multiple rows from a table and one of those rows can't be deleted because of a database relationship, what will happen? Will the rows that aren't constrained by a relationship still be deleted? Or will the entire delete fail? Thanks, Colin

    Read the article

  • How to spread changes in oriented graph?

    - by joseph
    Hello. I have oriented graph. Graph can be strongly connected. Every vertix can have a set of anything, for example letters. The set is user editable. Every vertix makes intersection of sets in previous vertices (only one step back). But now, there is problem: When I update set of one vertex, the change should expand to all vertices and uptate their intersection of sets of previous vertices. How to do every vertex have correct intersection after update of any vertex? Restriction: algorithm must avoid to stick in infinity. Any idea how to solve it?

    Read the article

  • Retrieving Data related to a top-level object from parse.com using PHP

    - by Albeert Tw
    I am retrieve related data using parse.com and PHP I get the top-leve object without problems but I can't access related data. ([myRelation] => stdClass Object ( [__type] => Relation [className] => other)) Please refer to my code below: $className = "myClass"; $url = 'https://api.parse.com/1/classes/' . $className; $appId = 'xxxxxx'; $restKey = 'xxxxxxx'; $relatedParams = urlencode('include=people'); $rest = curl_init(); curl_setopt($rest, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($rest, CURLOPT_URL, $url .'/io1GzkzErH/'.$relatedParams); curl_setopt($rest, CURLOPT_HTTPGET, true); curl_setopt($rest, CURLOPT_RETURNTRANSFER, true); curl_setopt($rest, CURLOPT_HTTPHEADER, array("X-Parse-Application-Id: " . $appId, "X-Parse-REST-API-Key: " . $restKey, "Content-Type: application/json")); $response = curl_exec($rest); echo $response; I want to see related objects into myRelation. Current answer is: I get this answer: stdClass Object ( [Altres] => loremipsum. [Cartell] => stdClass Object ( [__type] => File [name] => f29efff4-5db1-451a-ab42-7569fbb955a7-cartell.jpg [url] => loremipsum.jpg ) [CartellURL] => [Categoria] => Comedia [Durada] => 120min [Estat] => Al teatre [Final] => stdClass Object ( [__type] => Date [iso] => 2014-06-18T22:00:00.000Z ) [Inici] => stdClass Object ( [__type] => Date [iso] => 2014-04-25T22:00:00.000Z ) [Nom] => Losers [Prioritat] => 0 [Sala] => loremipsum [Sinopsis] => loremipsum [TrailerURL] => loremipsum.com [URLEntrada] => loremipsum.com [URLProductora] => http://www.loremipsum.com [Visible] => 1 [createdAt] => 2014-05-20T12:01:06.094Z [objectId] => io1GzkzErH [people] => stdClass Object ( [__type] => Relation [className] => persones ) [updatedAt] => 2014-05-20T12:07:22.758Z ) loremipsum But I need to know what are in [people] = stdClass Object ( [__type] = Relation [className] = persones )

    Read the article

  • ORM market analysis

    - by bonefisher
    I would like to see your experience with popular ORM tools outhere, like NHibernate, LLBLGen, EF, S2Q, Genom-e, LightSpeed, DataObjects.NET, OpenAccess, ... From my exp: - Genom-e is quiet capable of Linq & performance, dev support - EF lacks on some key features like lazy loading, Poco support, pers.ignorance... but in 4.o it may have overcome .. - DataObjects.Net so far good, althrough I found some bugs - NHibernate steep learning curve, no 100% Linq support (like in Genom-e and DataObjects.Net), but very supportive, extensible and mature

    Read the article

  • P6 Architecture - Register renaming aside, does the limited user registers result in more ops spent

    - by mrjoltcola
    I'm studying JIT design with regard to dynamic languages VM implementation. I haven't done much Assembly since the 8086/8088 days, just a little here or there, so be nice if I'm out of sorts. As I understand it, the x86 (IA-32) architecture still has the same basic limited register set today that it always did, but the internal register count has grown tremendously, but these internal registers are not generally available and are used with register renaming to achieve parallel pipelining of code that otherwise could not be parallelizable. I understand this optimization pretty well, but my feeling is, while these optimizations help in overall throughput and for parallel algorithms, the limited register set we are still stuck with results in more register spilling overhead such that if x86 had double, or quadruple the registers available to us, there may be significantly less push/pop opcodes in a typical instruction stream? Or are there other processor optmizations that also optimize this away that I am unaware of? Basically if I've a unit of code that has 4 registers to work with for integer work, but my unit has a dozen variables, I've got potentially a push/pop for every 2 or so instructions. Any references to studies, or better yet, personal experiences?

    Read the article

  • How do you solve the 15-puzzle with A-Star or Dijkstra's Algorithm?

    - by Sean
    I've read in one of my AI books that popular algorithms (A-Star, Dijkstra) for path-finding in simulation or games is also used to solve the well-known "15-puzzle". Can anyone give me some pointers on how I would reduce the 15-puzzle to a graph of nodes and edges so that I could apply one of these algorithms? If I were to treat each node in the graph as a game state then wouldn't that tree become quite large? Or is that just the way to do it?

    Read the article

  • computing "node closure" of graph with removal

    - by Fakrudeen
    Given a directed graph, the goal is to combine the node with the nodes it is pointing to and come up with minimum number of these [lets give the name] super nodes. The catch is once you combine the nodes you can't use those nodes again. [first node as well as all the combined nodes - that is all the members of one super node] The greedy approach would be to pick the node with maximum out degree and combine that node with nodes it is pointing to and remove all of them. Do this every time with the nodes which are not removed yet from graph. The greedy is O(V), but this won't necessarily output minimum number super nodes. So what is the best algorithm to do this?

    Read the article

  • Find optimal strategy and AI for the game 'Proximity'?

    - by smci
    'Proximity' is a strategy game of territorial domination similar to Othello, Go and Risk. Two players, uses a 10x12 hex grid. Game invented by Brian Cable in 2007. Seems to be a worthy game for discussing a) optimal algorithm then b) how to build an AI. Strategies are going to be probabilistic or heuristic-based, due to the randomness factor, and the insane branching factor (20^120). So it will be kind of hard to compare objectively. A compute time limit of 5s per turn seems reasonable. Game: Flash version here and many copies elsewhere on the web Rules: here Object: to have control of the most armies after all tiles have been placed. Each turn you received a randomly numbered tile (value between 1 and 20 armies) to place on any vacant board space. If this tile is adjacent to any ally tiles, it will strengthen each tile's defenses +1 (up to a max value of 20). If it is adjacent to any enemy tiles, it will take control over them if its number is higher than the number on the enemy tile. Thoughts on strategy: Here are some initial thoughts; setting the computer AI to Expert will probably teach a lot: minimizing your perimeter seems to be a good strategy, to prevent flips and minimize worst-case damage like in Go, leaving holes inside your formation is lethal, only more so with the hex grid because you can lose armies on up to 6 squares in one move low-numbered tiles are a liability, so place them away from your main territory, near the board edges and scattered. You can also use low-numbered tiles to plug holes in your formation, or make small gains along the perimeter which the opponent will not tend to bother attacking. a triangle formation of three pieces is strong since they mutually reinforce, and also reduce the perimeter Each tile can be flipped at most 6 times, i.e. when its neighbor tiles are occupied. Control of a formation can flow back and forth. Sometimes you lose part of a formation and plug any holes to render that part of the board 'dead' and lock in your territory/ prevent further losses. Low-numbered tiles are obvious-but-low-valued liabilities, but high-numbered tiles can be bigger liabilities if they get flipped (which is harder). One lucky play with a 20-army tile can cause a swing of 200 (from +100 to -100 armies). So tile placement will have both offensive and defensive considerations. Comment 1,2,4 seem to resemble a minimax strategy where we minimize the maximum expected possible loss (modified by some probabilistic consideration of the value ß the opponent can get from 1..20 i.e. a structure which can only be flipped by a ß=20 tile is 'nearly impregnable'.) I'm not clear what the implications of comments 3,5,6 are for optimal strategy. Interested in comments from Go, Chess or Othello players. (The sequel ProximityHD for XBox Live, allows 4-player -cooperative or -competitive local multiplayer increases the branching factor since you now have 5 tiles in your hand at any given time, of which you can only play one. Reinforcement of ally tiles is increased to +2 per ally.)

    Read the article

  • How do you use the LINQ to SQL designer to generate accessor methods for subclasses?

    - by Pricey
    Above is the LINQ to SQL designer view for my data context. Below is the relevant code: public System.Data.Linq.Table<ActivityBase> ActivityBases { get { return this.GetTable<ActivityBase>(); } } ... [Table(Name="dbo.Activities")] [InheritanceMapping(Code="1", Type=typeof(ActivityBase), IsDefault=true)] [InheritanceMapping(Code="2", Type=typeof(Project))] [InheritanceMapping(Code="3", Type=typeof(ProjectActivity))] [InheritanceMapping(Code="5", Type=typeof(Task))] [InheritanceMapping(Code="4", Type=typeof(Activity))] public abstract partial class ActivityBase : INotifyPropertyChanging, INotifyPropertyChanged { ... Is there a way to generate accessor methods for the subclasses as shown in the inheritance mapping above (Project, Task, etc...) without doing it manually? I added them manually but then a change in the designer overwrites any manual changes. Am i doing this wrong? should I not be making accessors for the sub classes? filtering from ActivityBase seems worse to me. Thanks for any help on this.

    Read the article

  • Write a compiler for a language that looks ahead and multiple files?

    - by acidzombie24
    In my language I can use a class variable in my method when the definition appears below the method. It can also call methods below my method and etc. There are no 'headers'. Take this C# example. class A { public void callMethods() { print(); B b; b.notYetSeen(); public void print() { Console.Write("v = {0}", v); } int v=9; } class B { public void notYetSeen() { Console.Write("notYetSeen()\n"); } } How should I compile that? what i was thinking is: pass1: convert everything to an AST pass2: go through all classes and build a list of define classes/variable/etc pass3: go through code and check if there's any errors such as undefined variable, wrong use etc and create my output But it seems like for this to work I have to do pass 1 and 2 for ALL files before doing pass3. Also it feels like a lot of work to do until I find a syntax error (other than the obvious that can be done at parse time such as forgetting to close a brace or writing 0xLETTERS instead of a hex value). My gut says there is some other way. Note: I am using bison/flex to generate my compiler.

    Read the article

  • A Turing Machine Question

    - by Hellnar
    Greetings, I have been struggling to find a question regarding this theoretical question, even tho it is not directly a programming question, I believe it is really related. Assume a type of Turing machine which cannot have more than 1000 squares. What would be the relationship between the set of such type of recognizable languages and set of normal recognizable languages.

    Read the article

  • Can someone describe the nested set model from a C#/LINQ perspective?

    - by Chad
    I know the nested set model doesn't pertain to the C# language or LINQ directly... it's what I'm using to develop my web app. For hierarchical data (categories with sub-categories in my case), I'm currently using something similar to the Adjacency List model. At the moment, I've only got 2 levels of categories, but I'd like to take it further and allow for n levels of categories using the nested set model. I'm not quite clear on how to use it in a C# context. Here's the article I'm reading on the nested set model. Though this article cleared up my confusion some, I still have a big ?? in my head: - Is inserting, updating or deleting categories tedious? It looks like the left and right numbers would require re-numbering... what would the LINQ queries look like for the following scenarios? Delete a child node (re-number all node's left/right values) Delete a parent node (what do you do with the orphans?) Move a child node to a different parent node (renumber again) If my understanding is correct, at all times the child node's left/right values will always be between the parent node's left/right values, am I correct? Seems easy enough, if only the categories were static... most likely I need to spend more time to get my head around the concept. Any help is greatly appreciated!

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >