Search Results

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

Page 18/95 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • Create My own language with "Functional Programming Language"

    - by esehara
    I prefer Haskell. I already know How to create my own language with Procedural Language (for example: C, Java, Python, etc). But, I know How to create my own language with Functional Language (for example Haskell, Clojure and Scala). I've already read: Internet Resources Write Yourself a Scheme in 48 Hours Real World Haskell - Chapter 16.Using Persec Writing A Lisp Interpreter In Haskell Parsec, a fast combinator parser Implementing functional languages: a tutorial Books Introduction Functional Programming Using Haskell 2nd Edition -- Haskell StackOverflow (but with procedural language) Learning to write a compiler create my own programming language Source Libraries and tools/HJS -- Haskell Are there any other good sources? I wants to get more links,or sources.

    Read the article

  • How to force grails GORM to respect DB scheme ?

    - by fabien-barbier
    I have two domains : class CodeSet { String id String owner String comments String geneRLF String systemAPF static hasMany = [cartridges:Cartridge] static constraints = { id(unique:true,blank:false) } static mapping = { table 'code_set' version false columns { id column:'code_set_id', generator: 'assigned' owner column:'owner' comments column:'comments' geneRLF column:'gene_rlf' systemAPF column:'system_apf' } } and : class Cartridge { String id String code_set_id Date runDate static belongsTo = CodeSet static constraints = { id(unique:true,blank:false) } static mapping = { table 'cartridge' version false columns { id column:'cartridge_id', generator: 'assigned' code_set_id column:'code_set_id' runDate column:'run_date' } } Actually, with those models, I get tables : - code_set, - cartridge, - and table : code_set_cartridge (two fields : code_set_cartridges_id, cartridge_id) I would like to not have code_set_cartridge table, but keep relationship : code_set -- 1:n -- cartridge In other words, how can I keep association between code_set and cartridge without intermediate table ? (using code_set_id as primary key in code_set and code_set_id as foreign key in cartridge). Mapping with GORM can be done without intermediate table?

    Read the article

  • SQL: How do I INSERT primary key values from two tables INTO a master table.

    - by Stefan
    Hello, I would appreciate some help with an SQL statement I really can't get my head around. What I want to do is fairly simple, I need to take the values from two different tables and copy them into an master table when a new row is inserted into one of the two tables. The problem is perhaps best explained like this: I have three tables, productcategories, regioncategories and mastertable. --------------------------- TABLE: PRODUCTCATEGORIES --------------------------- COLUMNS: CODE | DESCRIPTION --------------------------- VALUES: BOOKS | Books --------------------------- --------------------------- TABLE: REGIONCATEGORIES --------------------------- COLUMNS: CODE | DESCRIPTION --------------------------- VALUES: EU | European Union --------------------------- --------------------------- TABLE: MASTERTABLE --------------------------- COLUMNS: REGION | PRODUCT --------------------------- VALUES: EU | BOOKS --------------------------- I want the values to be inserted like this when a new row is created in either productcategories or regioncategories. New row is created. --------------------------- TABLE: PRODUCTCATEGORIES --------------------------- COLUMNS: CODE | DESCRIPTION --------------------------- VALUES: BOOKS | Books --------------------------- VALUES: DVD | DVDs --------------------------- And a SQL statement copies the new values into the mastertable. --------------------------- TABLE: MASTERTABLE --------------------------- COLUMNS: REGION | PRODUCT --------------------------- VALUES: EU | BOOKS --------------------------- VALUES: EU | DVD --------------------------- The same goes if a row is created in the regioncategories. New row. --------------------------- TABLE: REGIONCATEGORIES --------------------------- COLUMNS: CODE | DESCRIPTION --------------------------- VALUES: EU | European Union --------------------------- VALUES: US | United States --------------------------- Copied to the mastertable. --------------------------- TABLE: MASTERTABLE --------------------------- COLUMNS: REGION | PRODUCT --------------------------- VALUES: EU | BOOKS --------------------------- VALUES: EU | DVD --------------------------- VALUES: US | BOOKS --------------------------- VALUES: US | DVD --------------------------- I hope it makes sense. Thanks, Stefan

    Read the article

  • The Immerman-Szelepcsenyi Theorem

    - by Daniel Lorch
    In the Immerman-Szelepcsenyi Theorem, two algorithms are specified that use non-determinisim. There is a rather lengthy algorithm using "inductive counting", which determines the number of reachable configurations for a given non-deterministic turing machine. The algorithm looks like this: Let m_{i+1}=0 For all configurations C Let b=0, r=0 For all configurations D Guess a path from I to D in at most i steps If found Let r=r+1 If D=C or D goes to C in 1 step Let b=1 If r<m_i halt and reject Let m_{i+1}=m_{i+1}+b I is the starting configuration. m_i is the number of configurations reachable from the starting configuration in i steps. This algorithm only calculates the "next step", i.e. m_i+1 from m_i. This seems pretty reasonable, but since we have nondeterminisim, why don't we just write: Let m_i = 0 For all configurations C Guess a path from I to C in at most i steps If found m_i = m_i + 1 What is wrong with this algorithm? I am using nondeterminism to guess a path from I to C, and I verify reachability I am iterating through the list of ALL configurations, so I am sure to not miss any configuration I respect space bounds I can generate a certificate (the list of reachable configs) I believe I have a misunderstanding of the "power" of non-determinisim, but I can't figure out where to look next. I am stuck on this for quite a while and I would really appreciate any help.

    Read the article

  • A two way minimum spanning tree of a directed graph

    - by mvid
    Given a directed graph with weighted edges, what algorithm can be used to give a sub-graph that has minimum weight, but allows movement from any vertex to any other vertex in the graph (under the assumption that paths between any two vertices always exist). Does such an algorithm exist?

    Read the article

  • Parent Child Relationships with Fluent NHibernate?

    - by ElHaix
    I would like to create a cascading tree/list of N number of children for a given parent, where a child can also become a parent. Given the following data structure: CountryType=1; ColorType=3; StateType=5 6,7,8 = {Can, US, Mex} 10, 11, 12 = {Red, White, Blue} 20,21,22= {California, Florida, Alberta} TreeID ListTypeID ParentTreeID ListItemID 1 1 Null 6 (Canada is a Country) 2 1 Null 7 (US is a Country) 3 1 Null 8 (Mexico is a Country) 4 3 3 10 (Mexico has Red) 5 3 3 11 (Mexico has White) 6 5 1 22 (Alberta is in Canada) 7 5 7 20 (California is in US) 8 5 7 21 (Florida is in US) 9 3 6 10 (Alberta is Red) 10 3 6 12 (Alberta is Blue) 11 3 2 10 (US is Red) 12 3 2 11 (Us is Blue) How would this be represented in Fluent NHibernate classes? Some direction would be appreciated. Thanks.

    Read the article

  • A table that has relation to itself issue

    - by Mostafa
    Hi , I've defined table with this schema : CREATE TABLE [dbo].[Codings]( [Id] [int] IDENTITY(1,1) NOT NULL, [ParentId] [int] NULL, [CodeId] [int] NOT NULL, [Title] [nvarchar](50) COLLATE Arabic_CI_AI NOT NULL, CONSTRAINT [PK_Codings] PRIMARY KEY CLUSTERED ( [Id] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] And fill it up with data like this : Id ParentId CodeId Title ----------- ----------- ----------- ---------- 1 NULL 0 Gender 2 1 1 Male 3 1 2 Female 4 NULL 0 Educational Level 5 4 1 BS 6 4 2 MS 7 4 3 PHD Now , I'm looking for a solution , in order , When i delete a record that is parent ( like Id= 1 or 4 ), It delete all child automatically ( all records that their ParentId is 1 or 4 ) . I supposed i can do it via relation between Id and Parent Id ( and set cascade for delete rule ) , But when i do that in MMS , the Delete Rule or Update Rule in Properties is disabled . My question is , What can i do to accomplish this ? Thank you

    Read the article

  • What ORMs work well with Scala?

    - by Clinton R. Nixon
    I'm about to write a Scala command-line application that relies on a MySQL database. I've been looking around for ORMs, and am having trouble finding one that will work well. The Lift ORM looks nice, but I'm not sure it can be decoupled from the entire Lift web framework. ActiveObjects also looks OK, but the author says that it may not work well with Scala. I'm not coming to Scala from Java, so I don't know all the options. Has anyone used an ORM with Scala, and if so, what did you use and how well did it work?

    Read the article

  • Could a truly random number be generated using pings to psuedo-randomly selected IP addresses?

    - by _ande_turner_
    The question posed came about during a 2nd Year Comp Science lecture while discussing the impossibility of generating numbers in a deterministic computational device. This was the only suggestion which didn't depend on non-commodity-class hardware. Subsequently nobody would put their reputation on the line to argue definitively for or against it. Anyone care to make a stand for or against. If so, how about a mention as to a possible implementation?

    Read the article

  • What is the "owning side" in an ORM mapping?

    - by Yousui
    Hi guys, I'm new to JPA. Now I have a question that what exactly is the owning side mean? I only have a rough idea of it. Can someone give me an explanation with some mapping examples(one to many, one to one, many to one) please? Great thanks. ps, the following text is excerpt from the decription of @OneToOne in java EE 6 documentation. You can see the concept owning side in it. Defines a single-valued association to another entity that has one-to-one multiplicity. It is not normally necessary to specify the associated target entity explicitly since it can usually be inferred from the type of the object being referenced. If the relationship is bidirectional, the non-owning side must use the mappedBy element of the OneToOne annotation to specify the relationship field or property of the owning side.

    Read the article

  • how to use random bits to simulate a fair 26-sided die?

    - by Michael Levin
    How do I use a random number generator that gives bits (0 or 1) to simulate a fair 26-sided die? I want to use a bitstream to pick letters of the English alphabet such that the odds of any one letter coming up is the same as the odds of any other letter (I know real words aren't like that and have specific frequency distributions for each letter but it doesn't matter here). What's the best way to use binary 0/1 decisions to pick letters fairly from the set A-Z? I can think of a few ways to map bits onto letters but it's not obvious to me that they won't be biased. Is there a known good way?

    Read the article

  • Database Modelling - Conceptually different entities but with near identical fields

    - by Andrew Shepherd
    Suppose you have two sets of conceptual entities: MarketPriceDataSet which has multiple ForwardPriceEntries PoolPriceForecastDataSet which has multiple PoolPriceForecastEntry Both different child objects have near identical fields: ForwardPriceEntry has MarketPriceDataSetId (foreign key to parent table) StartDate EndDate SimulationItemId ForwardPrice PoolPriceForecastEntry has PoolPriceForecastDataSetId (foreign key to parent table) StartDate EndDate SimulationItemId ForecastPoolPrice If I modelled them as separate tables, the only difference would be the foreign key, and the name of the price field. There has been a debate as to whether the two near identical tables should be merged into one. Options I've thought of to model this is: Just keep them as two independent, separate tables Have both sets in the one table with an additional "type" field, and a parent_id equalling a foreign key to either parent table. This would sacrifice referential integrity checks. Have both sets in the one table with an additional "type" field, and create a complicated sequence of joining tables to maintain referential integrity. What do you think I should do, and why?

    Read the article

  • What can map database tables like LINQ to SQL did?

    - by trnTash
    A good thing in LINQ to SQL was a fast and reliable way to map database tables and convert them into classes accessible from c# project. However it is no longer recommended to create projects using LINQ to SQL. What is its substitute? What kind of tool should I use in VS 2010 today if I want to have the same functionality as I had with LINQ to SQL?

    Read the article

  • Indentation control while developing a small python like language

    - by sap
    Hello, I'm 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 indentation, not only that but i want to implement index breaking like for instance if you type "break 2" inside a while loop that's 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 'hello world'!! #will never reach this. "!!" outputs with a newline end 'hello world again'!! #also will never reach this. again "!!" used for cout end #after break 2 it would jump right here but since I don't 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 every time 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 indentation got reduced, should i read \b (backspace) chars from lex and then reduce the tabIndex variable (when the user doesn't 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 appreciated. 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

  • Can Goldberg algorithm in ocamlgraph be used to find Minimum Cost Flow graph?

    - by Tautrimas
    I'm looking for an implementation to the Minimum Cost Flow graph problem in OCaml. OCaml library ocamlgraph has Goldberg algorithm implementation. The paper called Efficient implementation of the Goldberg-Tarjan minimum-cost flow algorithm is noting that Goldberg-Tarjan algorithm can find minimum cost graph. Question is, does ocamlgraph algorithm also find the minimum cost? Library documentation only states, that it's suitable at least for the maximum flow problem. If not, does anybody have a good link to a nice any minimum cost optimization algorithm code? I will manually translate it into OCaml then. Forgive me, if I missed it on Wikipedia: there are too many algos on flow networks for the first day!

    Read the article

  • How do I create a good evaluation function for a new board game?

    - by A. Rex
    I write programs to play board game variants sometimes. The basic strategy is standard alpha-beta pruning or similar searches, sometimes augmented by the usual approaches to endgames or openings. I've mostly played around with chess variants, so when it comes time to pick my evaluation function, I use a basic chess evaluation function. However, now I am writing a program to play a completely new board game. How do I choose a good or even decent evaluation function? The main challenges are that the same pieces are always on the board, so a usual material function won't change based on position, and the game has been played less than a thousand times or so, so humans don't necessarily play it enough well yet to give insight. (PS. I considered a MoGo approach, but random games aren't likely to terminate.) Any ideas? Game details: The game is played on a 10-by-10 board with a fixed six pieces per side. The pieces have certain movement rules, and interact in certain ways, but no piece is ever captured. The goal of the game is to have enough of your pieces in certain special squares on the board. The goal of the computer program is to provide a player which is competitive with or better than current human players.

    Read the article

  • Languages and VMs: Features that are hard to optimize and why

    - by mrjoltcola
    I'm doing a survey of features in preparation for a research project. Name a mainstream language or language feature that is hard to optimize, and why the feature is or isn't worth the price paid, or instead, just debunk my theories below with anecdotal evidence. Before anyone flags this as subjective, I am asking for specific examples of languages or features, and ideas for optimization of these features, or important features that I haven't considered. Also, any references to implementations that prove my theories right or wrong. Top on my list of hard to optimize features and my theories (some of my theories are untested and are based on thought experiments): 1) Runtime method overloading (aka multi-method dispatch or signature based dispatch). Is it hard to optimize when combined with features that allow runtime recompilation or method addition. Or is it just hard, anyway? Call site caching is a common optimization for many runtime systems, but multi-methods add additional complexity as well as making it less practical to inline methods. 2) Type morphing / variants (aka value based typing as opposed to variable based) Traditional optimizations simply cannot be applied when you don't know if the type of someting can change in a basic block. Combined with multi-methods, inlining must be done carefully if at all, and probably only for a given threshold of size of the callee. ie. it is easy to consider inlining simple property fetches (getters / setters) but inlining complex methods may result in code bloat. The other issue is I cannot just assign a variant to a register and JIT it to the native instructions because I have to carry around the type info, or every variable needs 2 registers instead of 1. On IA-32 this is inconvenient, even if improved with x64's extra registers. This is probably my favorite feature of dynamic languages, as it simplifies so many things from the programmer's perspective. 3) First class continuations - There are multiple ways to implement them, and I have done so in both of the most common approaches, one being stack copying and the other as implementing the runtime to use continuation passing style, cactus stacks, copy-on-write stack frames, and garbage collection. First class continuations have resource management issues, ie. we must save everything, in case the continuation is resumed, and I'm not aware if any languages support leaving a continuation with "intent" (ie. "I am not coming back here, so you may discard this copy of the world"). Having programmed in the threading model and the contination model, I know both can accomplish the same thing, but continuations' elegance imposes considerable complexity on the runtime and also may affect cache efficienty (locality of stack changes more with use of continuations and co-routines). The other issue is they just don't map to hardware. Optimizing continuations is optimizing for the less-common case, and as we know, the common case should be fast, and the less-common cases should be correct. 4) Pointer arithmetic and ability to mask pointers (storing in integers, etc.) Had to throw this in, but I could actually live without this quite easily. My feelings are that many of the high-level features, particularly in dynamic languages just don't map to hardware. Microprocessor implementations have billions of dollars of research behind the optimizations on the chip, yet the choice of language feature(s) may marginalize many of these features (features like caching, aliasing top of stack to register, instruction parallelism, return address buffers, loop buffers and branch prediction). Macro-applications of micro-features don't necessarily pan out like some developers like to think, and implementing many languages in a VM ends up mapping native ops into function calls (ie. the more dynamic a language is the more we must lookup/cache at runtime, nothing can be assumed, so our instruction mix is made up of a higher percentage of non-local branching than traditional, statically compiled code) and the only thing we can really JIT well is expression evaluation of non-dynamic types and operations on constant or immediate types. It is my gut feeling that bytecode virtual machines and JIT cores are perhaps not always justified for certain languages because of this. I welcome your answers.

    Read the article

  • Alternative or succesor to GDBM

    - by Anon Guy
    We a have a GDBM key-value database as the backend to a load-balanced web-facing application that is in implemented in C++. The data served by the application has grown very large, so our admins have moved the GDBM files from "local" storage (on the webservers, or very close by) to a large, shared, remote, NFS-mounted filesystem. This has affected performance. Our performance tests (in a test environment) show page load times jumping from hundreds of milliseconds (for local disk) to several seconds (over NFS, local network), and sometimes getting as high as 30 seconds. I believe a large part of the problem is that the application makes lots of random reads from the GDBM files, and that these are slow over NFS, and this will be even worse in production (where the front-end and back-end have even more network hardware between them) and as our database gets even bigger. While this is not a critical application, I would like to improve performance, and have some resources available, including the application developer time and Unix admins. My main constraint is time only have the resources for a few weeks. As I see it, my options are: Improve NFS performance by tuning parameters. My instinct is we wont get much out of this, but I have been wrong before, and I don't really know very much about NFS tuning. Move to a different key-value database, such as memcachedb or Tokyo Cabinet. Replace NFS with some other protocol (iSCSI has been mentioned, but i am not familiar with it). How should I approach this problem?

    Read the article

  • Subgraph isomorphism on disconnected graphs with connection rules

    - by Mac
    Hello I was wondering if anyone knows about a solution to the following problem: Given a graph g as query and a set of graphs B with connection rules R. The connection rules describe how two graphs out of B can be linked together. Linking points are marked vertexes. Find all combination of graphs in B that contain g as a subgraph. Regards Mac

    Read the article

  • How do I left join tables in unidirectional many-to-one in Hibernate?

    - by jbarz
    I'm piggy-backing off of http://stackoverflow.com/questions/2368195/how-to-join-tables-in-unidirectional-many-to-one-condition. If you have two classes: class A { @Id public Long id; } class B { @Id public Long id; @ManyToOne @JoinColumn(name = "parent_id", referencedColumnName = "id") public A parent; } B - A is a many to one relationship. I understand that I could add a Collection of Bs to A however I do not want that association. So my actual question is, Is there an HQL or Criteria way of creating the SQL query: select * from A left join B on (b.parent_id = a.id) This will retrieve all A records with a Cartesian product of each B record that references A and will include A records that have no B referencing them. If you use: from A a, B b where b.a = a then it is an inner join and you do not receive the A records that do not have a B referencing them. I have not found a good way of doing this without two queries so anything less than that would be great. Thanks.

    Read the article

  • Why is it bad to use boolean flags in databases? And what should be used instead?

    - by David Chanin
    I've been reading through some of guides on database optimization and best practices and a lot of them suggest not using boolean flags at all in the DB schema (ex http://forge.mysql.com/wiki/Top10SQLPerformanceTips). However, they never provide any reason as to why this is bad. Is it a peformance issue? is it hard to index or query properly? Furthermore, if boolean flags are bad, what should you use to store boolean values in a database? Is it better to store boolean flags as an integer and use a bitmask? This seems like it would be less readable.

    Read the article

  • Joining Tables Based on Foreign Keys

    - by maestrojed
    I have a table that has a lot of fields that are foreign keys referencing a related table. I am writing a script in PHP that will do the db queries. When I query this table for its data I need to know the values associated with these keys not the key. How do most people go about this? A 101 way to do this would be to query this table for its data including the foreign keys and then query the related tables to get each key's value. This could be a lot of queries (~10). Question 1: I think I could write 1 query with a bunch of joins. Would that be better? This approach also requires the querying script to know which table fields are foreign keys. Since I have many tables like this but all with different fields, this means writing nice generic functions is hard. MySQL InnoDB tables allow for foreign constraints. I know the database has these set up correctly. Question 2: What about the idea of querying the table and identifying what the constraints are and then matching them up using whatever process I decide on from Question 1. I like this idea but never see it being used in code. Makes me think its not a good idea for some reason. I would use something like SHOW CREATE TABLE tbl_name; to find what constraints/relationships exist for that table. Thank you for any suggestions or advice.

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >