Why is t.b evaluated on every call? And is there any way how to make it evaluate only once?
type test =
{ a: float }
member x.b =
printfn "oh no"
x.a * 2.
let t = { a = 1. }
t.b
t.b
In EF eager loading related entities is easy.
But I'm having difficulties including inherited entities when loading data using table-per-type model.
This is my model:
Entities:
ArticleBase (base article entity)
ArticleSpecial (inherited from ArticleBase)
UserBase (base user entity)
UserSpecial (inherited from UserBase)
Image
Relations…
Whilst answering “Dealing with awful estimates” posted by Ash I shared a few tips that I learned and personally use to spot weak estimates. But I am certain there must be many more!
What heuristics to use in the scenario when one needs to make a quick evaluation of software project estimate that has been compiled by a third-party (a colleague,…
We are a medium-large non-profit company, with around 1000 staff and volunteers, and have been using MS Exchange (currently 2003) for our mail system for years.
I recently attended a Google conference where they were positing that "Cloud computing is the way of the future", and encouraging us to switch from doing our own email with Exchange,…
I am looking for a file management web service that lets me integrate the directory-view into a commercial website.
Another requirement: User can register themselves, but need to be approved, before being able to download files.
So something like box.net, but with more than just a a flash-widget. I would prefer some javascript, that can be…
Consider the following Perl code.
#!/usr/bin/perl
use strict;
use warnings;
$b="1";
my $a="${b}";
$b="2";
print $a;
The script obviously outputs 1. I would like it to be whatever the current value of $b is.
What would be the smartest way in Perl to achieve lazy evaluation like this? I would like the ${b} to remain "unreplaced"…
Skydrive : Microsoft fait une évaluation de son service de stockage Cloud
et souhaite renforcer celui-ci
SkyDrive, la solution de stockage des données en mode Cloud de Microsoft, bien qu'ayant subir plusieurs mises à jour et adopter le HTML5 pour son interface utilisateur, afin d'améliorer l'expérience d'accès et de partage des…
I'm trying to solve Project Euler Problem 14 in a lazy way. Unfortunately, I may be trying to do the impossible: create a lazy sequence that is both lazy, yet also somehow 'looks ahead' for values it hasn't computed yet.
The non-lazy version I wrote to test correctness was:
(defn chain-length [num]
(loop [len 1
n …
I have just completed an evaluation of Java, Groovy and Scala.
The factors I considered were: readability, precision
The factors I would like to know: performance, ease of integration
I needed a BigDecimal level of precision.
Here are my results:
Java
void someOp()
{
BigDecimal del_theta_1 = toDec(6);
BigDecimal…
Hey guys, simple question...
Working with XLISP to write a program, but I've seemed to run into a simple fundamental problem that I can't seem to work around: perhaps someone has a quick fix.
I'm trying to write an if statement who's then-clause evaluates multiple forms and returns the value of the last.
In example:
(setq…
Hi,
I have a string that holds user input. This string can contain various types of data, like:
a six digit id
a zipcode that contains out of 4 digits and two alphanumeric characters
a name (characters only)
As I am using this string to search through a database, the query type is determined on the type of search, which…
In my app, when a User makes a Comment in a Post, Notifications are generated that marks that comment as unread.
class Notification < ActiveRecord::Base
belongs_to :user
belongs_to :post
belongs_to :comment
class User < ActiveRecord::Base
has_many :notifications
class Post < ActiveRecord::Base
has_many…
I have a UnitOfWork/Service pattern where I populate my model using NHibernate before sending it to the view. For some reason I still get the YSOD, and I don't understand why the object collection is not already populated.
My controller method looks like this:
public ActionResult PendingRegistrations()
{
var model =…
We are using NHibernate but sometimes manually load proxies using the NHibernateUtil.Initialize call. We also employ soft delete and have a "where" condition on all our mapping to tables. SQL generated by NHibernate successfully adds the where condition (i.e. DELETED IS NULL) however we notice that…
I have a need to load an entire LINQ-to-SQL object graph from a certain point downwards, loading all child collections and the objects within them etc. This is going to be used to dump out the object structure and data to XML.
Is there a way to do this without generating a large hard coded set of…
Hi to everyone,
I'm studying about programming language's theory and I can't figure out a solid reason to why lazy languages doesn't have mutation?
Does anyone know the reason?
Is there any way to disable the use of the "dynamic" keyword in .net 4?
I thought the Code Analysis feature of VS2010 might have a rule to fail the build if the dynamic keyword is used but I couldn't fine one.
What is the difference between these two functions? I see that lazy is intended to be lazy, but I don't understand how that is accomplished.
-- | Identity function.
id :: a -> a
id x = x
-- | The call '(lazy e)' means the same as 'e', but 'lazy' has a …
I've got a Moose class with a lazy_build attribute. The value of that attribute is a function of another (non-lazy) attribute.
Suppose somebody instantiates the class with a value of 42 for the required attribute. Then they request the lazy attribute, which is calculated as a function of 42. Then,…
I have a class with static method which has a local static variable. I want that variable to be computed/evaluated once (the 1st time I call the function) and for any subsequent invocation, it is not evaluated anymore. How to do that? Here's my class:
template<
typename T1 = int, unsigned…
I ran into an interesting error with the following LiNQ query using LiNQPad and when using Subsonic 3.0.x w/ActiveRecord within my project and wanted to share the error and resolution for anyone else who runs into it.
The linq statement below is meant to group entries in the tblSystemsValues…
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…
In Scala, does calling isEmtpy method on an instance of Stream class cause the stream to be evaluated completely? My code is like this:
import Stream.cons
private val odds: Stream[Int] = cons(3, odds.map(_ + 2))
private val primes: Stream[Int] = cons(2, odds filter isPrime)
private def…