Search Results

Search found 1103 results on 45 pages for 'eager evaluation'.

Page 10/45 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Anonymous iterator blocks in Clojure?

    - by Checkers
    I am using clojure.contrib.sql to fetch some records from an SQLite database. (defn read-all-foo [] (with-connection *db* (with-query-results res ["select * from foo"] (into [] res)))) Now, I don't really want to realize the whole sequence before returning from the function (i.e. I want to keep it lazy), but if I return res directly or wrap it some kind of lazy wrapper (for example I want to make a certain map transformation on result sequence), SQL-related bindings will be reset and connection will be closed after I return, so realizing the sequence will throw an exception. How can I enclose the whole function in a closure and return a kind of anonymous iterator block (like yield in C# or Python)? Or is there another way to return a lazy sequence from this function?

    Read the article

  • Alter a function as a parameter before evaluating it in R?

    - by Shane
    Is there any way, given a function passed as a parameter, to alter its input parameter string before evaluating it? Here's pseudo-code for what I'm hoping to achieve: test.func <- function(a, b) { # here I want to alter the b expression before evaluating it: b(..., val1=a) } Given the function call passed to b, I want to add in a as another parameter without needing to always specify ... in the b call. So the output from this test.func call should be: test.func(a="a", b=paste(1, 2)) "1" "2" "a" Edit: Another way I could see doing something like this would be if I could assign the additional parameter within the scope of the parent function (again, as pseudo-code); in this case a would be within the scope of t1 and hence t2, but not globally assigned: t2 <- function(...) { paste(a=a, ...) } t1 <- function(a, b) { local( { a <<- a; b } ) } t1(a="a", b=t2(1, 2)) This is somewhat akin to currying in that I'm nesting the parameter within the function itself. Edit 2: Just to add one more comment to this: I realize that one related approach could be to use "prototype-based programming" such that things would be inherited (which could be achieved with the proto package). But I was hoping for a easier way to simply alter the input parameters before evaluating in R.

    Read the article

  • make a lazy var in scala

    - by ayvango
    Scala does not permit to create laze vars, only lazy vals. It make sense. But I've bumped on use case, where I'd like to have similar capability. I need a lazy variable holder. It may be assigned a value that should be calculated by time-consuming algorithm. But it may be later reassigned to another value and I'd like not to call first value calculation at all. Example assuming there is some magic var definition lazy var value : Int = _ val calc1 : () => Int = ... // some calculation val calc2 : () => Int = ... // other calculation value = calc1 value = calc2 val result : Int = value + 1 This piece of code should only call calc2(), not calc1 I have an idea how I can write this container with implicit conversions and and special container class. I'm curios if is there any embedded scala feature that doesn't require me write unnecessary code

    Read the article

  • Evaluating IIS7 with Virtual PC?

    - by Neil
    Hi, I wanna do some local developer tests of IIS 7 but I don't have Windows Vista, 7 or 2008 server - I currently run XP SP3. I have Virtual PC installed so I can use Microsoft's IE compatibility images - are there any time-limited images that I can use with Virtual PC so I can check out IIS 7? The IIS 7 "Try it" link points to this page. But the VHS is for Windows Server platforms only I think and I don't want an ISO? Any advice?

    Read the article

  • How can I evaluate variable to another variable before assigning?

    - by HH
    #!/usr/bin/python # # Description: trying to evaluate array -value to variable before assignment # but it overwrites the variable # # How can I evaluate before assigning on the line 16? #Initialization, dummy code? x=0 y=0 variables = [x, y] data = ['2,3,4', '5,5,6'] # variables[0] should be evaluted to `x` here, i.e. x = data[0], how? variables[0] = data[0] if ( variables[0] != x ): print("It does not work, why?"); else: print("It works!");

    Read the article

  • Haskell, list of natural number

    - by Hellnar
    Hello, I am an absolute newbie in Haskell yet trying to understand how it works. I want to write my own lazy list of integers such as [1,2,3,4,5...]. For list of ones I have written ones = 1 : ones and when tried, works fine: *Main> take 10 ones [1,1,1,1,1,1,1,1,1,1] How can I do the same for increasing integers ? I have tried this but it indeed fails: int = 1 : head[ int + 1] And after that how can I make a method that multiplies two streams? such as: mulstream s1 s2 = head[s1] * head[s2] : mulstream [tail s1] [tail s2]

    Read the article

  • Any way to define getters for lazy variables in Javascript arrays?

    - by LLer
    I'm trying to add elements to an array that are lazy-evaluated. This means that the value for them will not be calculated or known until they are accessed. This is like a previous question I asked but for objects. What I ended up doing for objects was Object.prototype.lazy = function(var_name, value_function) { this.__defineGetter__(var_name, function() { var saved_value = value_function(); this.__defineGetter__(var_name, function() { return saved_value; }); return saved_value; }); } lazy('exampleField', function() { // the code that returns the value I want }); But I haven't figured out a way to do it for real Arrays. Arrays don't have setters like that. You could push a function to an array, but you'd have to call it as a function for it to return the object you really want. What I'm doing right now is I created an object that I treat as an array. Object.prototype.lazy_push = function(value_function) { if(!this.length) this.length = 0; this.lazy(this.length++, value_function); } So what I want to know is, is there a way to do this while still doing it on an array and not a fake array?

    Read the article

  • Haskell: foldl' accumulator parameter

    - by Clinton
    I've been asking a few questions about strictness, but I think I've missed the mark before. Hopefully this is more precise. Lets say we have: n = 1000000 f z = foldl' (\(x1, x2) y -> (x1 + y, y - x2)) z [1..n] Without changing f, what should I set z = ... So that f z does not overflow the stack? (i.e. runs in constant space regardless of the size of n) Its okay if the answer requires GHC extensions. My first thought is to define: g (a1, a2) = (!a1, !a2) and then z = g (0, 0) But I don't think g is valid Haskell.

    Read the article

  • is it ethical to attend interview for the purpose of self evaluation?

    - by user49767
    I wonder, if it is ethical to attend interview for the purpose of self evaluation? Sometime I suspect that I am below average to my experience (but certainly not worst).And I keep reading books, do code almost everyday. But in order to understand What it takes to be a good developer and find better job when need arises, Can you guys suggest to attend interview for just self evaluation. is it ethical? Kindly share your thoughts.

    Read the article

  • Difference between $ and # in ADF/JSF/JSP

    - by pavan.pvj
    Found this one interesting. So, picked it from one of the books and posting here.JSP 2.1 and JSF 1.2 - both of them use a unified Expression language. One major and the most obvious difference is between $ and #. JSP 2.1 uses $ and JSF 1.2 uses # in an EL. $ - immediate evaluation# - deferred evaluation$ - $ syntax executes expressions eagerly/immediately, which means that the result is returned immediately when the page renders.# - # syntax defers the expression evaluation to a point defined by the implementing technology. In general, JSF uses deferred EL evaluation because of its multiple lifecycle phases in which events are handled. To ensure the model is prepared before the values are accessed by EL, it must defer EL evaluation until the appropriate point in the life cycle.Note: This is picked up from Oracle Fusion Developer Guide (ISBN: 9780071622547). There is also a very good article here:http://java.sun.com/products/jsp/reference/techart/unifiedEL.html

    Read the article

  • MS ACCESS: How can i count distinct value using access query?

    - by Sadat
    here is the current complex query given below. SELECT DISTINCT Evaluation.ETCode, Training.TTitle, Training.Tcomponent, Training.TImpliment_Partner, Training.TVenue, Training.TStartDate, Training.TEndDate, Evaluation.EDate, Answer.QCode, Answer.Answer, Count(Answer.Answer) AS [Count], Questions.SL, Questions.Question FROM ((Evaluation INNER JOIN Training ON Evaluation.ETCode=Training.TCode) INNER JOIN Answer ON Evaluation.ECode=Answer.ECode) INNER JOIN Questions ON Answer.QCode=Questions.QCode GROUP BY Evaluation.ETCode, Answer.QCode, Training.TTitle, Training.Tcomponent, Training.TImpliment_Partner, Training.Tvenue, Answer.Answer, Questions.Question, Training.TStartDate, Training.TEndDate, Evaluation.EDate, Questions.SL ORDER BY Answer.QCode, Answer.Answer; There is an another column Training.TCode. I need to count distinct Training.TCode, can anybody help me? If you need more information please let me know

    Read the article

  • SQL SERVER – Retrieve SQL Server Installation Date Time

    - by pinaldave
    I have been asked this question number of times and my answer always have been – search online and you will find the answer. Every single time when someone has followed my answer – they have found accurate answer in first few clicks. However increasingly this question getting very popular so I have decided to answer this question here. I usually prefer to create my own T-SQL script but in today’s case, I have taken the script from web. I have seen this script at so many places I do not know who is original creator so not sure who should get credit for the same. Question: How to retrieve SQL Server Installation date? Answer: Run following query and it will give you date of SQL Server Installation. SELECT create_date FROM sys.server_principals WHERE sid = 0x010100000000000512000000 Question: I have installed SQL Server Evaluation version how do I know what is the expiry date for it? Answer: SQL Server evaluation period is for 180 days. The expiration date is always 180 days from the initial installation. Following query will give an expiration date of evaluation version. -- Evaluation Version Expire Date SELECT create_date AS InstallationDate, DATEADD(DD, 180, create_date) AS 'Expiry Date' FROM sys.server_principals WHERE sid = 0x010100000000000512000000 GO I believe there is a way to do the same using registry but I have not explored it personally. Now as I said earlier there are many different blog posts on this subject. Let me list a few which I really enjoyed to read personally as they shared few more insights over this subject. Retrieving SQL Server 2012 Evaluation Period Expiry Date How to find the Installation Date for an Evaluation Edition of SQL Server Reference: Pinal Dave (http://blog.sqlauthority.com) Filed under: PostADay, SQL, SQL Authority, SQL DateTime, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology

    Read the article

  • Google devient une entreprise plus chère que Microsoft, changement d'époque ou sous-évaluation du premier éditeur mondial ?

    Google devient une entreprise plus chère que Microsoft Changement d'époque ou signe que les marchés sous-évaluent le premier éditeur mondial ? Le fait est simple. Google a aujourd'hui une capitalisation boursière supérieure à celle de Microsoft. Son interprétation, elle, est beaucoup plus complexe. Certains y verront un changement de paradigme (vers le 100% Web, l'abonnement, le contenu et le mobile). D'autres, le signe que les marchés sous-estiment l'assise de Microsoft dont le portefeuille produits et les clients sont beaucoup plus diversifiés. Le Wall Street Journal pour sa part remarque que l'action de Google était au plus bas depuis 4 ans au début de l'été. Les analyst...

    Read the article

  • Understanding Eager Loading & How to use it? (specific issue)

    - by Elliot
    I have the following relation in my rails app: genre - has many - authors authors - belong to genre and has many books books - belongs to authors and belongs to users (users can add books to the db) in my controller I have: @books=current_user.books(:include => [:author => :genre], :order => 'books.created_at DESC')--- -- In my controller I used to have: @authors = Author.All @genres = Genre.All etc. -- In my view I have @genres.each do |genre| @authors.each do |author| if author.genre_id == genre.id stuff end end end Now that I'm using eager loading, I can't imagine this is the best way to do this (nor does it work as I don't have the @ variables) - I was wondering if anyone could shed some light on how to approach this?

    Read the article

  • Why call-by-value evaluation strategy is not Turing complete?

    - by Roman
    I'm reading an article about different evaluation strategies (I linked article in wiki, but I'm reading another one not in English). And it says that unlike to call-by-name and call-by-need strategies, call-by-value strategy is not Turing complete. Can anybody explain, please, why is it so? If it's possible, add an example pls.

    Read the article

  • I keep on getting "save operation failure" after any change on my XCode Data Model

    - by Philip Schoch
    I started using Core Data for iPhone development. I started out by creating a very simple entity (called Evaluation) with just one string property (called evaluationTopic). I had following code for inserting a fresh string: - (void)insertNewObject { // Create a new instance of the entity managed by the fetched results controller. NSManagedObjectContext *context = [fetchedResultsController managedObjectContext]; NSEntityDescription *entity = [[fetchedResultsController fetchRequest] entity]; NSManagedObject *newManagedObject = [NSEntityDescription insertNewObjectForEntityForName:[entity name] inManagedObjectContext:context]; // If appropriate, configure the new managed object. [newManagedObject setValue:@"My Repeating String" forKey:@"evaluationTopic"]; // Save the context. NSError *error; if (![context save:&error]) { // Handle the error... } [self.tableView reloadData]; } This worked perfectly fine and by pushing the +button a new "My Repeating String" would be added to the table view and be in persistent store. I then pressed "Design - Add Model Version" in XCode. I added three entities to the existing entity and also added new properties to the existing "Evaluation" entity. Then, I created new files off the entities by pressing "File - New File - Managed Object Classes" and created a new .h and .m file for my four entities, including the "Evaluation" entity with Evaluation.h and Evaluation.m. Now I changed the model version by setting "Design - Data Model - Set Current Version". After having done all this, I changed my insertMethod: - (void)insertNewObject { // Create a new instance of the entity managed by the fetched results controller. NSManagedObjectContext *context = [fetchedResultsController managedObjectContext]; NSEntityDescription *entity = [[fetchedResultsController fetchRequest] entity]; Evaluation *evaluation = (Evaluation *) [NSEntityDescription insertNewObjectForEntityForName:[entity name] inManagedObjectContext:context]; // If appropriate, configure the new managed object. [evaluation setValue:@"My even new string" forKey:@"evaluationSpeechTopic"]; // Save the context. NSError *error; if (![context save:&error]) { // Handle the error... } [self.tableView reloadData]; } This does not work though! Every time I want to add a row the simulator crashes and I get the following: "NSInternalInconsistencyException', reason: 'This NSPersistentStoreCoordinator has no persistent stores. It cannot perform a save operation.'" I had this error before I knew about creating new version after changing anything on the datamodel, but why is this still coming up? Do I need to do any mapping (even though I just added entities and properties that did not exist before?). In the Apple Dev tutorial it sounds very easy but I have been struggling with this for long time, never worked after changing model version.

    Read the article

  • Spooling in SQL execution plans

    - by Rob Farley
    Sewing has never been my thing. I barely even know the terminology, and when discussing this with American friends, I even found out that half the words that Americans use are different to the words that English and Australian people use. That said – let’s talk about spools! In particular, the Spool operators that you find in some SQL execution plans. This post is for T-SQL Tuesday, hosted this month by me! I’ve chosen to write about spools because they seem to get a bad rap (even in my song I used the line “There’s spooling from a CTE, they’ve got recursion needlessly”). I figured it was worth covering some of what spools are about, and hopefully explain why they are remarkably necessary, and generally very useful. If you have a look at the Books Online page about Plan Operators, at http://msdn.microsoft.com/en-us/library/ms191158.aspx, and do a search for the word ‘spool’, you’ll notice it says there are 46 matches. 46! Yeah, that’s what I thought too... Spooling is mentioned in several operators: Eager Spool, Lazy Spool, Index Spool (sometimes called a Nonclustered Index Spool), Row Count Spool, Spool, Table Spool, and Window Spool (oh, and Cache, which is a special kind of spool for a single row, but as it isn’t used in SQL 2012, I won’t describe it any further here). Spool, Table Spool, Index Spool, Window Spool and Row Count Spool are all physical operators, whereas Eager Spool and Lazy Spool are logical operators, describing the way that the other spools work. For example, you might see a Table Spool which is either Eager or Lazy. A Window Spool can actually act as both, as I’ll mention in a moment. In sewing, cotton is put onto a spool to make it more useful. You might buy it in bulk on a cone, but if you’re going to be using a sewing machine, then you quite probably want to have it on a spool or bobbin, which allows it to be used in a more effective way. This is the picture that I want you to think about in relation to your data. I’m sure you use spools every time you use your sewing machine. I know I do. I can’t think of a time when I’ve got out my sewing machine to do some sewing and haven’t used a spool. However, I often run SQL queries that don’t use spools. You see, the data that is consumed by my query is typically in a useful state without a spool. It’s like I can just sew with my cotton despite it not being on a spool! Many of my favourite features in T-SQL do like to use spools though. This looks like a very similar query to before, but includes an OVER clause to return a column telling me the number of rows in my data set. I’ll describe what’s going on in a few paragraphs’ time. So what does a Spool operator actually do? The spool operator consumes a set of data, and stores it in a temporary structure, in the tempdb database. This structure is typically either a Table (ie, a heap), or an Index (ie, a b-tree). If no data is actually needed from it, then it could also be a Row Count spool, which only stores the number of rows that the spool operator consumes. A Window Spool is another option if the data being consumed is tightly linked to windows of data, such as when the ROWS/RANGE clause of the OVER clause is being used. You could maybe think about the type of spool being like whether the cotton is going onto a small bobbin to fit in the base of the sewing machine, or whether it’s a larger spool for the top. A Table or Index Spool is either Eager or Lazy in nature. Eager and Lazy are Logical operators, which talk more about the behaviour, rather than the physical operation. If I’m sewing, I can either be all enthusiastic and get all my cotton onto the spool before I start, or I can do it as I need it. “Lazy” might not the be the best word to describe a person – in the SQL world it describes the idea of either fetching all the rows to build up the whole spool when the operator is called (Eager), or populating the spool only as it’s needed (Lazy). Window Spools are both physical and logical. They’re eager on a per-window basis, but lazy between windows. And when is it needed? The way I see it, spools are needed for two reasons. 1 – When data is going to be needed AGAIN. 2 – When data needs to be kept away from the original source. If you’re someone that writes long stored procedures, you are probably quite aware of the second scenario. I see plenty of stored procedures being written this way – where the query writer populates a temporary table, so that they can make updates to it without risking the original table. SQL does this too. Imagine I’m updating my contact list, and some of my changes move data to later in the book. If I’m not careful, I might update the same row a second time (or even enter an infinite loop, updating it over and over). A spool can make sure that I don’t, by using a copy of the data. This problem is known as the Halloween Effect (not because it’s spooky, but because it was discovered in late October one year). As I’m sure you can imagine, the kind of spool you’d need to protect against the Halloween Effect would be eager, because if you’re only handling one row at a time, then you’re not providing the protection... An eager spool will block the flow of data, waiting until it has fetched all the data before serving it up to the operator that called it. In the query below I’m forcing the Query Optimizer to use an index which would be upset if the Name column values got changed, and we see that before any data is fetched, a spool is created to load the data into. This doesn’t stop the index being maintained, but it does mean that the index is protected from the changes that are being done. There are plenty of times, though, when you need data repeatedly. Consider the query I put above. A simple join, but then counting the number of rows that came through. The way that this has executed (be it ideal or not), is to ask that a Table Spool be populated. That’s the Table Spool operator on the top row. That spool can produce the same set of rows repeatedly. This is the behaviour that we see in the bottom half of the plan. In the bottom half of the plan, we see that the a join is being done between the rows that are being sourced from the spool – one being aggregated and one not – producing the columns that we need for the query. Table v Index When considering whether to use a Table Spool or an Index Spool, the question that the Query Optimizer needs to answer is whether there is sufficient benefit to storing the data in a b-tree. The idea of having data in indexes is great, but of course there is a cost to maintaining them. Here we’re creating a temporary structure for data, and there is a cost associated with populating each row into its correct position according to a b-tree, as opposed to simply adding it to the end of the list of rows in a heap. Using a b-tree could even result in page-splits as the b-tree is populated, so there had better be a reason to use that kind of structure. That all depends on how the data is going to be used in other parts of the plan. If you’ve ever thought that you could use a temporary index for a particular query, well this is it – and the Query Optimizer can do that if it thinks it’s worthwhile. It’s worth noting that just because a Spool is populated using an Index Spool, it can still be fetched using a Table Spool. The details about whether or not a Spool used as a source shows as a Table Spool or an Index Spool is more about whether a Seek predicate is used, rather than on the underlying structure. Recursive CTE I’ve already shown you an example of spooling when the OVER clause is used. You might see them being used whenever you have data that is needed multiple times, and CTEs are quite common here. With the definition of a set of data described in a CTE, if the query writer is leveraging this by referring to the CTE multiple times, and there’s no simplification to be leveraged, a spool could theoretically be used to avoid reapplying the CTE’s logic. Annoyingly, this doesn’t happen. Consider this query, which really looks like it’s using the same data twice. I’m creating a set of data (which is completely deterministic, by the way), and then joining it back to itself. There seems to be no reason why it shouldn’t use a spool for the set described by the CTE, but it doesn’t. On the other hand, if we don’t pull as many columns back, we might see a very different plan. You see, CTEs, like all sub-queries, are simplified out to figure out the best way of executing the whole query. My example is somewhat contrived, and although there are plenty of cases when it’s nice to give the Query Optimizer hints about how to execute queries, it usually doesn’t do a bad job, even without spooling (and you can always use a temporary table). When recursion is used, though, spooling should be expected. Consider what we’re asking for in a recursive CTE. We’re telling the system to construct a set of data using an initial query, and then use set as a source for another query, piping this back into the same set and back around. It’s very much a spool. The analogy of cotton is long gone here, as the idea of having a continual loop of cotton feeding onto a spool and off again doesn’t quite fit, but that’s what we have here. Data is being fed onto the spool, and getting pulled out a second time when the spool is used as a source. (This query is running on AdventureWorks, which has a ManagerID column in HumanResources.Employee, not AdventureWorks2012) The Index Spool operator is sucking rows into it – lazily. It has to be lazy, because at the start, there’s only one row to be had. However, as rows get populated onto the spool, the Table Spool operator on the right can return rows when asked, ending up with more rows (potentially) getting back onto the spool, ready for the next round. (The Assert operator is merely checking to see if we’ve reached the MAXRECURSION point – it vanishes if you use OPTION (MAXRECURSION 0), which you can try yourself if you like). Spools are useful. Don’t lose sight of that. Every time you use temporary tables or table variables in a stored procedure, you’re essentially doing the same – don’t get upset at the Query Optimizer for doing so, even if you think the spool looks like an expensive part of the query. I hope you’re enjoying this T-SQL Tuesday. Why not head over to my post that is hosting it this month to read about some other plan operators? At some point I’ll write a summary post – once I have you should find a comment below pointing at it. @rob_farley

    Read the article

  • How can I eager-load a child collection mapped to a non-primary key in NHibernate 2.1.2?

    - by David Rubin
    Hi, I have two objects with a many-to-many relationship between them, as follows: public class LeftHandSide { public LeftHandSide() { Name = String.Empty; Rights = new HashSet<RightHandSide>(); } public int Id { get; set; } public string Name { get; set; } public ICollection<RightHandSide> Rights { get; set; } } public class RightHandSide { public RightHandSide() { OtherProp = String.Empty; Lefts = new HashSet<LeftHandSide>(); } public int Id { get; set; } public string OtherProp { get; set; } public ICollection<LeftHandSide> Lefts { get; set; } } and I'm using a legacy database, so my mappings look like: Notice that LeftHandSide and RightHandSide are associated by a different column than RightHandSide's primary key. <class name="LeftHandSide" table="[dbo].[lefts]" lazy="false"> <id name="Id" column="ID" unsaved-value="0"> <generator class="identity" /> </id> <property name="Name" not-null="true" /> <set name="Rights" table="[dbo].[lefts2rights]"> <key column="leftId" /> <!-- THIS IS THE IMPORTANT BIT: I MUST USE PROPERTY-REF --> <many-to-many class="RightHandSide" column="rightProp" property-ref="OtherProp" /> </set> </class> <class name="RightHandSide" table="[dbo].[rights]" lazy="false"> <id name="Id" column="id" unsaved-value="0"> <generator class="identity" /> </id> <property name="OtherProp" column="otherProp" /> <set name="Lefts" table="[dbo].[lefts2rights]"> <!-- THIS IS THE IMPORTANT BIT: I MUST USE PROPERTY-REF --> <key column="rightProp" property-ref="OtherProp" /> <many-to-many class="LeftHandSide" column="leftId" /> </set> </class> The problem comes when I go to do a query: LeftHandSide lhs = _session.CreateCriteria<LeftHandSide>() .Add(Expression.IdEq(13)) .UniqueResult<LeftHandSide>(); works just fine. But LeftHandSide lhs = _session.CreateCriteria<LeftHandSide>() .Add(Expression.IdEq(13)) .SetFetchMode("Rights", FetchMode.Join) .UniqueResult<LeftHandSide>(); throws an exception (see below). Interestingly, RightHandSide rhs = _session.CreateCriteria<RightHandSide>() .Add(Expression.IdEq(127)) .SetFetchMode("Lefts", FetchMode.Join) .UniqueResult<RightHandSide>(); seems to be perfectly fine as well. NHibernate.Exceptions.GenericADOException Message: Error performing LoadByUniqueKey[SQL: SQL not available] Source: NHibernate StackTrace: c:\opt\nhibernate\2.1.2\source\src\NHibernate\Type\EntityType.cs(563,0): at NHibernate.Type.EntityType.LoadByUniqueKey(String entityName, String uniqueKeyPropertyName, Object key, ISessionImplementor session) c:\opt\nhibernate\2.1.2\source\src\NHibernate\Type\EntityType.cs(428,0): at NHibernate.Type.EntityType.ResolveIdentifier(Object value, ISessionImplementor session, Object owner) c:\opt\nhibernate\2.1.2\source\src\NHibernate\Type\EntityType.cs(300,0): at NHibernate.Type.EntityType.NullSafeGet(IDataReader rs, String[] names, ISessionImplementor session, Object owner) c:\opt\nhibernate\2.1.2\source\src\NHibernate\Persister\Collection\AbstractCollectionPersister.cs(695,0): at NHibernate.Persister.Collection.AbstractCollectionPersister.ReadElement(IDataReader rs, Object owner, String[] aliases, ISessionImplementor session) c:\opt\nhibernate\2.1.2\source\src\NHibernate\Collection\Generic\PersistentGenericSet.cs(54,0): at NHibernate.Collection.Generic.PersistentGenericSet`1.ReadFrom(IDataReader rs, ICollectionPersister role, ICollectionAliases descriptor, Object owner) c:\opt\nhibernate\2.1.2\source\src\NHibernate\Loader\Loader.cs(706,0): at NHibernate.Loader.Loader.ReadCollectionElement(Object optionalOwner, Object optionalKey, ICollectionPersister persister, ICollectionAliases descriptor, IDataReader rs, ISessionImplementor session) c:\opt\nhibernate\2.1.2\source\src\NHibernate\Loader\Loader.cs(385,0): at NHibernate.Loader.Loader.ReadCollectionElements(Object[] row, IDataReader resultSet, ISessionImplementor session) c:\opt\nhibernate\2.1.2\source\src\NHibernate\Loader\Loader.cs(326,0): at NHibernate.Loader.Loader.GetRowFromResultSet(IDataReader resultSet, ISessionImplementor session, QueryParameters queryParameters, LockMode[] lockModeArray, EntityKey optionalObjectKey, IList hydratedObjects, EntityKey[] keys, Boolean returnProxies) c:\opt\nhibernate\2.1.2\source\src\NHibernate\Loader\Loader.cs(453,0): at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) c:\opt\nhibernate\2.1.2\source\src\NHibernate\Loader\Loader.cs(236,0): at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) c:\opt\nhibernate\2.1.2\source\src\NHibernate\Loader\Loader.cs(1649,0): at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) c:\opt\nhibernate\2.1.2\source\src\NHibernate\Loader\Loader.cs(1568,0): at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters) c:\opt\nhibernate\2.1.2\source\src\NHibernate\Loader\Loader.cs(1562,0): at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet`1 querySpaces, IType[] resultTypes) c:\opt\nhibernate\2.1.2\source\src\NHibernate\Loader\Criteria\CriteriaLoader.cs(73,0): at NHibernate.Loader.Criteria.CriteriaLoader.List(ISessionImplementor session) c:\opt\nhibernate\2.1.2\source\src\NHibernate\Impl\SessionImpl.cs(1936,0): at NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results) c:\opt\nhibernate\2.1.2\source\src\NHibernate\Impl\CriteriaImpl.cs(246,0): at NHibernate.Impl.CriteriaImpl.List(IList results) c:\opt\nhibernate\2.1.2\source\src\NHibernate\Impl\CriteriaImpl.cs(237,0): at NHibernate.Impl.CriteriaImpl.List() c:\opt\nhibernate\2.1.2\source\src\NHibernate\Impl\CriteriaImpl.cs(398,0): at NHibernate.Impl.CriteriaImpl.UniqueResult() c:\opt\nhibernate\2.1.2\source\src\NHibernate\Impl\CriteriaImpl.cs(263,0): at NHibernate.Impl.CriteriaImpl.UniqueResult[T]() D:\proj\CMS3\branches\nh_auth\DomainModel2Tests\Authorization\TempTests.cs(46,0): at CMS.DomainModel.Authorization.TempTests.Test1() Inner Exception System.Collections.Generic.KeyNotFoundException Message: The given key was not present in the dictionary. Source: mscorlib StackTrace: at System.ThrowHelper.ThrowKeyNotFoundException() at System.Collections.Generic.Dictionary`2.get_Item(TKey key) c:\opt\nhibernate\2.1.2\source\src\NHibernate\Persister\Entity\AbstractEntityPersister.cs(2047,0): at NHibernate.Persister.Entity.AbstractEntityPersister.GetAppropriateUniqueKeyLoader(String propertyName, IDictionary`2 enabledFilters) c:\opt\nhibernate\2.1.2\source\src\NHibernate\Persister\Entity\AbstractEntityPersister.cs(2037,0): at NHibernate.Persister.Entity.AbstractEntityPersister.LoadByUniqueKey(String propertyName, Object uniqueKey, ISessionImplementor session) c:\opt\nhibernate\2.1.2\source\src\NHibernate\Type\EntityType.cs(552,0): at NHibernate.Type.EntityType.LoadByUniqueKey(String entityName, String uniqueKeyPropertyName, Object key, ISessionImplementor session) I'm using NHibernate 2.1.2 and I've been debugging into the NHibernate source, but I'm coming up empty. Any suggestions? Thanks so much!

    Read the article

  • Error while running RSpec test cases.

    - by alokswain
    Following is the error i receive while running test cases written using rpsec. The strange thing is the test were running fine until early yesterday. Can someone guide me towards a solution. I am new to RSpec and and using Rspec and rspec-rails as plugins in my app. and i have no clue to what went wrong. F:/Spritle/programs/ruby 1.86/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_suppor t/dependencies.rb:105:in `const_missing': uninitialized constant Test::Unit::TestResult::TestResultFailureSupport (NameError) from F:/Spritle/programs/ruby 1.86/lib/ruby/gems/1.8/gems/test-unit-2.0.1/lib/test/unit/testresult.rb:28 from F:/Spritle/programs/ruby 1.86/lib/ruby/site_ruby/1.8/rubygems/custom_require. rb:31:in `gem_original_require' from F:/Spritle/programs/ruby 1.86/lib/ruby/site_ruby/1.8/rubygems/custom_require. rb:31:in `require' from F:/Spritle/programs/ruby 1.86/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/ active_support/dependencies.rb:158:in `require' from F:/Spritle/projects/Evaluation/vendor/plugins/rspec/lib/spec/interop/test.rb: 34 from F:/Spritle/programs/ruby 1.86/lib/ruby/site_ruby/1.8/rubygems/custom_require. rb:31:in `gem_original_require' from F:/Spritle/programs/ruby 1.86/lib/ruby/site_ruby/1.8/rubygems/custom_require. rb:31:in `require' from F:/Spritle/programs/ruby 1.86/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/ active_support/dependencies.rb:158:in `require' ... 15 levels... from F:/Spritle/projects/Evaluation/vendor/plugins/rspec/lib/spec/runner/example_g roup_runner.rb:14:in `load_files' from F:/Spritle/projects/Evaluation/vendor/plugins/rspec/lib/spec/runner/options.r b:133:in `run_examples' from F:/Spritle/projects/Evaluation/vendor/plugins/rspec/lib/spec/runner/command_l ine.rb:9:in `run' from F:/Spritle/projects/Evaluation/vendor/plugins/rspec/bin/spec:5 rake aborted! Command "F:/Spritle/programs/ruby 1.86/bin/ruby.exe" -I"lib" "F:/Spritle/projects/Evaluation/vendor/plugins/rspec/bin/spec" "spec/controllers/articles_controller_spec.rb" --option s "F:/Spritle/projects/Evaluation/spec/spec.opts" failed

    Read the article

  • Function parameters evaluation order: is undefined behaviour if we pass reference?

    - by bolov
    This is undefined behaviour: void feedMeValue(int x, int a) { cout << x << " " << a << endl; } int main() { int a = 2; int &ra = a; feedMeValue(ra = 3, a); return 0; } because depending on what parameter gets evaluated first we could call (3, 2) or (3, 3). However this: void feedMeReference(int x, int const &ref) { cout << x << " " << ref << endl; } int main() { int a = 2; int &ra = a; feedMeReference(ra = 3, a); return 0; } will always output 3 3 since the second parameter is a reference and all parameters have been evaluated before the function call, so even if the second parameter is evaluated before of after ra = 3, the function received a reference to a wich will have a value of 2 or 3 at the time of the evaluation, but will always have the value 3 at the time of the function call. Is the second example UB? It is important to know because the compiler is free to do anything if he detects undefined behaviour, even if I know it would always yield the same results. *Note: I think that feedMeReference(a = 3, a) is the exact same situation as feedMeReference(ra = 3, a). However it seems not everybody agrees, in the addition to having 2 completely different answers.

    Read the article

  • Mocking a namespace in a partial class.

    - by Nix
    I am messing around with Entity Framework 3.5 SP1 and I am trying to find a cleaner way to do the below. Basically I have an EF model and I am adding some Eager Loaded entities and i want to put them in the partial class context Eager namespace. Currently I am using composition but I feel like there is an easier way to do what I want. namespace Entities{ public partial class TestObjectContext { EagerExtensions Eager { get;set;} public TestObjectContext(){ Eager = new EagerExtensions (this); } } public partial class EagerExtensions { TestObjectContext context; public EagerExtensions(TestObjectContext _context){ context = _context; } public IQueryable<TestEntity> TestEntity { get { return context.TestEntity .Include("TestEntityType") .Include("Test.Attached.AttachedType") .AsQueryable(); } } } } public class Tester{ public void ShowHowIWantIt(){ TestObjectContext context= new TestObjectContext(); var query = from a in context.Eager.TestEntity select a; } }

    Read the article

  • How do I install the evaluation version of Windows Server 2012R2 VHD within a Windows Server 2008R2 Hyper-V system?

    - by Paul Hale
    I have a windows server 2008R2 running hyper-v. I have downloaded the Windows Server 2012RC DC Version from here... http://technet.microsoft.com/en-us/evalcenter/dn205286.aspx I am "forced" to install a download app that copy's a .vhd file to my chosen directory. The instructions on this page... http://technet.microsoft.com/library/dn303418.aspx say... To install the VHD Download the VHD file. Start Hyper-V Manager. On the Action menu, select Import Virtual Machine. Navigate to the directory that the virtual machine file was extracted to and select the directory (not the directory where the VHD file is located). Select the Copy the virtual machine option. Confirm that the import was successful by checking Hyper-V Manager. Configure the network adapter for the resulting virtual machine: right-click the virtual machine and select Settings. In the left pane, click Network Adapter. In the menu that appears, select one of the network adapters of the virtualization server, and then click OK. Start the virtual machine. Where it says "Navigate to the directory that the virtual machine file was extracted to and select the directory (not the directory where the VHD file is located). Select the Copy the virtual machine option." Well nothing has been extracted as far as I can tell? and if it has, I have no idea where or what im looking for? I tried creating a new VM and using the downloaded .vhd file but I got an error saying that the .vhd file is an incompatible format. Can anybody help me out please? Thanks, Paul

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >