Mocking Entity Framework 6 ObjectResult with Moq

Question: How can I mock the Entity Framework 6 ObjectResult with Moq so that I can unit test my code that relies on an EF database connection?
Having read numerous questions and answers along these lines, and gleaned many nuggets from what I've read, I've implemented what I feel is a reasonably elegant solution and felt that I should share it, since the community here helped me get there. Thus, I'll proceed to answer this question, and potentially open myself up to some mockery (pun intended):
Answer: First of all, ObjectResult does not have a public parameterless constructor, thus it is necessary first to create a testable wrapper for ObjectResult. The answer by @forsvarir (https://stackoverflow.com/users/592182/forsvarir) in this post got me thinking correctly along these lines (EF6 - Cannot Mock Return Value for ObjectResult<T> for Unit Test):
using System.Data.Entity.Core.Objects;

namespace MyNamespace.Mocks
{
    public class TestableEfObjectResult<T> : ObjectResult<T> { }
}

Of course, the DbContext needs to be mocked. Your method then needs to be set up to return the appropriate mocked enumerator. For convenience, I created a method to help in the creation of the Mock EF Results to keep my test code from getting cluttered and redundant. This can live in some utilitarian class that you have for your tests, though I just included it as a private method here. The key thing here being that the mock object result needs to return an enumerator when GetEnumerator is called:
namespace MyNamespace.Mocks
{
    public class MockSomeDbEntities
    {
        public static Mock<SomeDbEntities> Default
        {
            get
            {
                var mockSomeDbEntities = new Mock<SomeDbEntities>();

                mockSomeDbEntities
                  .Setup(e => e.SomeMethod(It.IsAny<int>()))
                  .Returns(MockEfResult(Enumerators.SomeCollection).Object);

                return mockSomeDbEntities;
            }
        }

        private static Mock<TestableEfObjectResult<T>> MockEfResult<T>(Func<IEnumerator<T>> enumerator) where T : class
        {
            var mock = new Mock<TestableEfObjectResult<T>>();
            mock.Setup(m => m.GetEnumerator()).Returns(enumerator);
            return mock;
        }
    }
}

The Enumerators class that I created for handing back the enumerator whenever the function is called on the mock simply looks like this. In this example I have the fake enumerator creating 5 rows of data:
using System;
using System.Collections.Generic;

namespace MyNamespace.FakeData
{
    public static class Enumerators
    {
        public static IEnumerator<Some_Result> SomeCollection()
        {
            yield return FakeSomeResult.Create(1);
            yield return FakeSomeResult.Create(2);
            yield return FakeSomeResult.Create(3);
            yield return FakeSomeResult.Create(4);
            yield return FakeSomeResult.Create(5);
        }
    }
}

And, as you can see, this simply relies on a class that creates each fake row of data:
namespace MyNamespace.FakeData
{
    public static class FakeSomeResult
    {
        public static Some_Result Create(int id)
        {
            return new Some_Result
            {
                Id = id,
            };
        }
    }
}

Being able to mock at this level really enables my ability to do BDD and only mock or fake the peripheries, never mocking or faking my code, so I get complete(r) test coverage.
Hope this helps those who, like me, were looking for a nice clean way to mock Entity Framework 6.
Answer: I have run into this problem many times
My solution is to mock a ObjectResult's GetEnumeartor method. This can easily be done within a test method will very little overhead
for example
say we have a repo method that calls a DBContext method that returns a ObjectResult<string>. The repo method would get the resulting value string by enumearting the ObjectResult<string> with maybe objResult.FirstOrDefault(). As you know the LINQ method just calls into the ObjectResult's enumeartor. Therefore, mocking the GetEnumeartor() function of the ObjectResult will do the trick. Any enumeartion of teh result will return our mocked enumerator.
Example

Here is a simple a simple func that produces an IEnumerator<string> from a string. This can be inlined with an anonymous method but it makes it harder to read for illustration purposes here.
var f = new Func< string,IEnumerator< string> >( s => ( ( IEnumerable< string > )new []{ s } ).GetEnumerator( ) );

this func can be called by passing a string like this
var myObjResultReturnEnum = f( "some result" );

this may make it easier for us to get the IEnumerator<string> we expect the ObjectResult<string>'s GetEnumerator() method to return so any repo method that calls the ObjectResult will receive our string
// arrange
const string shouldBe = "Hello World!";
var objectResultMock = new Mock<ObjectResult<string>>();
objectResultMock.Setup( or => or.GetEnumerator() ).Returns(() => myObjResultReturnEnum );

No we have a mocked ObjectResult<string> that we can pass into a repo method inferring our method will eventually call into the enumerator in some way and will get our shouldBe value.
var contextMock = new Mock<SampleContext>( );
contextMock.Setup( c => c.MockCall( ) ).Returns( ( ) => objectResultMock.Object );

// act
var repo = new SampleRepository( contextMock.Object );
var result = repo.SampleSomeCall( );

// assert
Assert.IsNotNull(result);
Assert.AreEqual(shouldBe, result);

Comment: Nice. I'm gonna have to try that style.


What is the difference between "Elliptic Curve Function" and "Hash Functions" like SHA256?

Question: I am reading about bitcoin and I am a little confused about "elliptic curve function" and "SHA256".
Do they have the same properties? Can both be used to generate private and public key pairs?
Comment: SHA256 is a hash function - https://en.wikipedia.org/wiki/Hash_function & for ECC look here - https://en.wikipedia.org/wiki/Elliptic-curve_cryptography
Comment: Your edit is totally a new question, should be rollback. Changing the course of the question once answered is not an accepted behavior in [so]. What is the input of SHA-256? There is a [short input space problem](https://crypto.stackexchange.com/a/81652/18298) on the hash functions. Also, there is [no multiplication on ECC](https://crypto.stackexchange.com/q/88214/18298), only scalar multiplication.
Comment: Also, if I've understood correctly, you cannot map arbitrarily inputs to point on the curve. The ECC relies on the [discrete logarithm problem](https://crypto.stackexchange.com/q/76230/18298), so we first select a uniform random integer then map it to a point on the curve by the scalar multiplication.
Answer:
What is the difference between "Elliptic Curve Function" and "Hash Functions" like SHA256?

There is no real context given, however we can understand it as

SHA-256 function:
Yes it is a function, in a rather precise way: a cryptographic hash function (collision-resistant hash);
$$\operatorname{SHA256}:\{0,1\}^* \to \{0,1\}^{256}$$

One way: it should be practically impossible to invert the given hash digest ( or, Polynomially bounded adversaries cannot revert it).
Deterministic: the same input must provide the same output.
Random: we should not know the hash of input before hashing it. We can read this as hash functions are candidates for Random Oracles (RO) and SHA256 is not since it has a length extension attack, SHA3 and Blake2 are more close to RO.
has Pre-image resistance: close to one way; given a hash value $h$ it must be infeasible for polynomial-time adversaries to find input $m$ such that $\operatorname{SHA256}(m) = h$.
Second Pre-image resistance: given a message $m$ and it's hash value $h$, find another message $m'$ such that $\operatorname{SHA256}(m) = h = \operatorname{SHA256}(m')$.
and Collision resistance; find the distinct input messages $m_1 \neq m_2$ such that $\operatorname{SHA256}(m_1) = \operatorname{SHA256}(m_2)$.

Bitcoin uses double SHA256 (SHA256d) and SHA256d is secure against the length extension attacks.

Elliptic Curve function:
This is strange naming, is it the L-function of the Elliptic curves or what? Since the question is talking about Bitcoin, it should rather be the set of functions that Elliptic curves provide more than the below functions:

Addition as the group operation (addition, negation, inverse, commute, and association).

Scalar multiplication: given a base point $G$ and add it $t$ times:
$$[t]G : = \underbrace{G + G + \cdots + G}_{t-times}
$$

Public key generation: Select random $k$ and calculate $[k]G$.

ECDSA signature generation.

ECDSA signature validation.

Now the answers to your other question are clear.

Do they have the same properties?

No, they don't! Even one is a function the other is a set of functions.

Can both be used to generate private and public key pairs?

No.
However, one can use SHA256 to digest an entropy source to select the random $k$ for their private key and find their public key $K = [k]G$ by using the scalar multiplication of the Elliptic Curves.
And the Bitcoin Address is calculated as;
$$\text{Bitcoin Adress} = \operatorname{RIPEMD160(SHA256(}K))$$ as 20-byte adresses (RIPEMD).

Special note: Some blockchain books/websites use EC multiplication for EC scalar multiplication, like Antonolopus's book Mastering Bitcoin, page 68. This confuses many since they start to think that $P\cdot Q$ exists. No! EC forms additive Abelian groups, and with the scalar multiplication (the usual way to define for additive groups) they form a Z-Module, nothing more.
Comment: +1.  I would have said they're like comparing apples and orangutans, but you took the extra effort to describe the properties of apples and the properties of orangutans in a way that should help the OP research the topic, and potentially form a more exacting question in the future.  Great Stack Exchange form!
Comment: @CortAmmon the OP did not specify the source, however, I've seen that many sites and books cause confusion. See the newly added special note with an example.
Comment: We'll exclude hash-based signatures for now I guess. If you count those they you can also do message authentication, key derivation and random number generation "with a hash function".
Comment: @MaartenBodewes Sure they exist. I want to keep the answer in the context of bitcoin. And the hash functions are ubiquitous as we listed some [here](https://crypto.stackexchange.com/q/64588/18298). Do you know that used in bitcoin?
Comment: @MaartenBodewes blockchains now is a wide subject that I've might miss one that use...
Comment: @MaartenBodewes is there a specific reason to be removed from HNQ? Seen now while looking OP's edits.
Answer: Both are functions. it means they are relations between two sets (the input set and the output set) such that every elements $x$ of the input set is in relation with at most one element of the output set. This element is called the image of $x$.
But they do not have the same status in cryptography. Function in "elliptic curve function" is a way to describe an elliptic curve. If the function is $f$, the points of the curve are $(x, f(x))$.
SHA-256, is an algorithm (an algorithm is more precise than a function, because it indicates how compute the images) which is used to generate hashes.
To generate the private key, we pick uniformly at random an integer $n$ of $256$ bits.
To generate the public key we multiply a generator $G$ (given as a public parameter of the curve) by $n$ (by using the square-and-multiply procedure). It gives us a point of the curve $P$. Sometimes this $P$ is considered as a hash of the private key. But it is much more than a simple a hash, it's a public key. It verifies much more properties than usual hash functions such as SHA-256.
If you want more details, you can look :
https://en.wikipedia.org/wiki/Elliptic_curve_digital_signature_algorithm
Comment: If SHA256 is irreversible or preimage resistant. Why bitcoin just don't use the SHA256 to generate a public key out of a randomly generated private key instead of elliptic curve multiplication. I know the input of SHA256 can be anything and output can be 0 to 2^256. Can someone explain to me the elliptic curve multiplication or function whatever is it in the sense of input and output just like SHA256. Because I am not able to understand it from Wikipedia. I have tried it several times.
Comment: Preimage resistance is not enough. You need to sign, it's much more difficult to make, a simple hash function is not enough. Eliptic curve are not basic maths, you can try to read this: cryptobook.nakov.com/asymmetric-key-ciphers/


get the location of UTXO data

Question: I need to find the location of the code which deals with UTXO, and then implement FIFO on UTXO storage. I aint able to find the location of UTXO code and also where it is stored.
Comment: Deals with UTXOs in what way? In your wallet or for the node to verify transactions? What do you mean by "FIFO on UTXO storage"?
Comment: @AndrewChow
 A feature in the FLO core wallet called as coin control allows the users to select the UTXOs which should be used as inputs for the transactions. Currently by default, the coin control selects the UTXOs automatically from the wallet.But the required default behavior is that, the UTXOs should be selected based on the FIFO. So I am supposed to  find a way to extract the received date from the UTXOs data and pass them to the wallet.cpp accordingly so that the wallet selects the UTXOs based on FIFO instead of random selection.
Comment: By FIFO here I mean,  one that was received first in the wallet should be used first in the transaction.
Answer: What you want is the code for Florincoin's wallet's coin selection. This is found in the CreateTransaction function. Within CreateTransaction, the wallet also calls SelectCoins and that calls SelectCoinsMinConf. The coins are actually selected with SelectCoinsMinConf but SelectCoins and CreateTransaction are all involved with coin selection.
Also, because Florincoin's wallet is based on Bitcoin Core, it does not use FIFO for coin selection. Rather it uses Bitcoin Core's special algorithm for selecting coins which is difficult to understand (it tries to solve the knapsack problem by selecting exactly the amount you want to spend, but then it does some weird things to handle fees and change).
Comment: So what would be the first step in case I want to achieve the goal?
Comment: You modify `SelectCoinsMinConf` to do whatever coin selection algorithm that you want. You will probably have to change the data types to include the time because they are not necessarily there.
Comment: can you please tell me which function deals with the UTXO timings??If theres one  @AndrewChow
Comment: Time is mostly irrelevant for UTXOs. The objects for coin selection itself do not have time fields, so you will need to add one. CWalletTx has a time field and that is used to create the CInputCoins and COutputs used for coin selection.

get the location of UTXO data


Remove a single event from Calendar subscription

Question: I am subscribed to Apple's holiday calendar, which is very useful. However, some holidays are not of interest for me - is there a way to delete selected events manually while keeping the rest of the subscription?
Answer: It is actually possible to download the subscription and then delete some events:
In the calendar app, right-click on the holiday calendar subscription and then "copy URL to clipboard". Paste this into a web browser, download the .ics file, double-click and finally we are there: All holidays for the next 10 years are imported, and all of the unwanted events can be deleted manually.
Answer: No — subscribing to a calendar will add all the events to your calendar and it is not possible to hide any of them, just all of them by hiding the entire calendar.
Comment: I hoped that there was a way to download the entire list of the subscription and then delete some events out of it or something like that.
Comment: This is quite possibly the dumbest decision in the history of the universe; not deciding that this is a useful feature. I cry myself to sleep every night over this.
Answer: I basically made copies of the holidays I wanted to show and unsubscribed from the calendar. IE, I duplicated the holidays for this province only and unsubscribed from the Canadian holidays so I wouldn't get holidays from every other province cluttering up my calendar. You can specify how you want the holiday to repeat by selecting yearly, say for Christmas, or custom, such as the third Monday every May for Victoria Day, by editing the settings for each holiday. It took me less than 5 minutes to add the holidayss for my province and delete the Canada holidays subscription; less time than it took to type this reply


Returning to US with K1 after overstaying visa

Question: Can I return to US with a k1 fiance visa, after overstaying my J1 since 2015 until 2020, I left the country voluntarily but wish to come back. Is it better to try fiance visa or get married and then apply for immigration visa. Thanks
Comment: Did your J1 I-94 say "D/S" on it?
Comment: If you were admitted "D/S", when did USCIS determine that you were unlawfully present?
Comment: @CrissZerga: Did your I-94 have an admit-until date on it? Or did it say "D/S"? I am not asking about the program end date on your DS-2019, nor about when your grace period ended.
Comment: Last day to leave was October 2015
Comment: The admission stamp in my passport has a D/S written on it
Answer: Either fiance visa before marriage, or immigrant visa after marriage, should be okay. Fiance visas and immigrant visas should not be denied unless there is a ban or they are not convinced of the genuineness of your relationship. (An immigrant visa after marriage might be slightly more likely to succeed than fiance visa, since after the marriage there would be no question about whether you will get married at that point, and for an immigrant visa the petitioner would have to file a binding Affidavit of Support, confirming their commitment.) Based on what you have described, you should not have an unlawful presence ban. The following is a discussion of why you don't have the ban.
INA 212(a)(9)(B) provides for a 3-year ban if you accrue 180 days of unlawful presence and then leave the US, and a 10-year ban if you accrue 1 year of unlawful presence and then leave the US. You start accruing "unlawful presence" in one of 3 ways:

You stay past the date on your I-94, if your I-94 has a specific date;
You applied for some benefit to USCIS and were denied with a determination that you were out of status; or
A final order was made against you in removal proceedings in immigration court

For people who were admitted with "D/S" on their I-94 instead of a date, unlawful presence can only start accruing in the last two ways described above (i.e. applied for a benefit and were denied, or final order in immigration court). Given that you were admitted with "D/S" on your I-94, if you never applied for a benefit to USCIS, and were never given a notice to appear for removal proceedings, then you never started to accrue "unlawful presence", no matter how long you stayed past the end of your J-1 program. Therefore, you did not trigger an unlawful presence ban when you left the US.
The USCIS Policy Manual is still in the process of incorporating the USCIS Adjudicator's Field Manual, and the section on unlawful presence ban, USCIS Policy Manual, Volume 8, Part O, is not written yet and just has a big PDF dump of AFM chapter 40. AFM chapter 40.9.2(b)(1)(E)(ii), Nonimmigrants Admitted for Duration of Status (D/S) (on page 76 of the current PDF), says:

(ii) Nonimmigrants Admitted for Duration of Status (D/S). If USCIS
finds a nonimmigrant status violation while adjudicating a request for
an immigration benefit, unlawful presence will begin to accrue on the
day after the request is denied. If an immigration judge makes a
determination of nonimmigrant status violation in exclusion,
deportation, or removal proceedings, unlawful presence begins to
accrue the day after the immigration judge's order. It must be
emphasized that the accrual of unlawful presence neither begins on the
date that a status violation occurs, nor on the day on which removal
proceedings are initiated. See 8 CFR 239.3.

In the Foreign Affairs Manual, 9 FAM 302.11-3(B)(1)(b)(2) similarly says:

b. DHS has interpreted "period of stay authorized by the Secretary of
Homeland Security," as used in this context, to include:
(2)  For aliens inspected and admitted for "duration of status" (DOS),
any period of presence in the United States, unless DHS, an IJ, or the
BIA makes a formal finding of a status violation, in which case
unlawful presence will only being to accrue the day after the formal
finding is made;

9 FAM 302.11-3(B)(1)(d):

d. For persons who have been admitted for duration of status (DOS) (as
is usually the case with aliens in A, G, F, J, and I visa status),
unlawful presence will not accrue unless DHS, IJ, or the BIA finds a
status violation in the context of a request for an immigration
benefit or in the course of removal proceedings.  This finding of
status violation by the DHS, an IJ, or the BIA will cause a period of
"unlawful presence" to begin.  In DOS cases where DHS or an IJ or the
BIA makes a formal status violation finding, the alien begins accruing
unlawful presence on the day after the finding (i.e., the date the
finding was published /communicated).  For example, if an applicant
presents a letter from DHS dated December 1, 2008, that says the
applicant was out of status starting on May 28, 2001, the applicant
began to accrue unlawful presence as of December 2, 2008, not May 28,
2001.

It should also be noted that in 2018, USCIS put out a memo that supposedly made anyone admitted in F, J, or M status accrue unlawful presence whenever they are out of status after August 9, 2018 (regardless of whether their I-94 has a date or D/S). However, this has been blocked by a court injunction, as noted on the USCIS students and exchange visitors page. The litigation history is summarized on this page, but basically, a temporary restraining order was issued in January 2019, a preliminary injunction was issued in May 2019, and a permanent injunction was issued in February 2020. In July 2020, DHS voluntarily asked to withdraw its own appeal in the case, and the court granted this. So this issue is settled and the memo is dead.


Will setting up 2 steam accounts allow you to play the games you've bought between both accounts

Question: My dad and I have just bought a gaming pc to share between us and we don't want to share the same steam account, but we also don't want to have to buy a game on my dad's account and not have it work for my account. shouldn't it just save to the desktop so we can both play the game but just on different accounts? We want to do this because single player games won't allow us to start two independent games for myself and my dad on the same steam account.
Comment: No.
Answer: Normally, a Steam game will only work while Steam is logged into an account, and that account has a license for that game (from being gifted it, buying it or redeeming a CD-key). However, you can configure Steam Family Sharing to share games between a limited set of accounts on a limited set of PCs; however, if the person who shared his library with you is currently playing a Steam game, even a F2P one, you will not be able to play the games they have shared with you until they stop playing.
Comment: we share the same pc but we just want to share the games across both accounts. can i still do it this way
Comment: @JordanH yes, you can.
Answer: If you're using the same PC and won't be playing games simultaneously, you can use Steam Family Sharing. Both you and your dad can buy your own games on your own accounts, but you both set up each others' accounts with Family Sharing and then register your shared gaming PC. Both accounts will then have access to the same set of games without needing to change users.


A 90 degree turn with Wheel part number 56145

Question: I'm making a program for my ev3rstorm and I want it to have a 90-degree spin turn. I use the standard part ev3rstorm wheelbase or rather, treadbase. Using the move tank block (I use that block all the time) how long should I move back/forward at 75/-75 power?
Wheel picture:
Answer: Use your gyroscope sensor, set your program to have the Move Tank block turn very slowly in the "On" mode, and then use a Wait block checking the Gyro sensor until it sees an absolute change of 90 degrees. Then add a Move Tank "Off" block. That's the closest you will come to 90 degrees.


Riding motorcycle in Sydney

Question: I plan to move to Sydney and seek a job. Currently, I generally use motorcycle to go around city. I am thinking about buying a motorcycle as soon as I reach there. But I have no idea about the viewpoint of people and the convenience of using a motorcycle in Sydney. Is motor riding popular in there? What is the process to buy and use a motor in Australia?
Comment: Hi from Sydney. Friend has a bike, and a couple of colleagues ride theirs to work. They all have stories of near misses or small crashes, but they do like getting up into the Blue Mountains on the weekends...
Answer: General things
If you'll be coming in on a permanent visa, you have three months to convert your foreign license to an Australian license.  The good news is that this is a fairly straightforward process; you should be able to walk into the nearest DMV office and walk out an hour or so later with an Australian license.  And as long as you're over 25 years old you shouldn't have any trouble getting an open/unrestricted license.
The bad news is that if you've held your local motorcycle license for less than 3 years and are under 25 you'll get stuck with a 'Provisional' license instead of an unrestricted one.  If you end up with a provisional license there will be a number of restrictions both in terms of what kind of motorcycles you can ride (i.e. only ones that are "approved for novice riders") and how you can operate them (i.e. not exceeding 90km/h even if the posted limit is higher, etc.).  You'll also get hit with very strict rules with respect to demerit points, blood-alcohol limits, and so on.  In short, you really don't want a provisional license.
More details here:  http://www.rms.nsw.gov.au/roads/licence/moving-to-nsw.html
Is motor riding popular?
Can't say for sure.
However motorcycling has a bit of an image problem in Australia, unfortunately.  There's a near-constant stream of articles concerning "outlaw bikies" and the heroic efforts of law enforcement and politicians to bring them under control.  Some states have fairly draconian laws on the books that make it an offence to even be associated with any group that's deemed an "outlaw motorcycle club" by the political powers-that-be, even if no actual crimes have been committed by the accused.
That said, there are still plenty of motorcycle riders around.  And with the traffic situation in Sydney, a motorcycle is certainly a more sensible option than putting another car on the road.  A push-bike or using public transport would be even better.
What is the process to buy and use a motor in Australia?
Fairly comparable to the process in most other locales, probably.  First, see the bit about getting an Australian motorcycle license.
Once you've got that down, you can purchase your desired bike from either a dealer or a private seller.  If buying a used vehicle, it will/should already be registered, so you shouldn't need to worry about any extra costs until the existing rego expires, at which point you'll be on the hook for registration fees and also a CTP (Compulsory Third Party) insurance premium (covers you for liability should you kill/injure someone in a crash).  With new vehicles, you may need to pay this outright on top of the purchase price (and if you're buying from a dealer, they'll walk you through the process).
The simplest option is to look for dealer vehicles advertised with a "Drive-away" price.  That means that the listed price includes the cost of the vehicle, registration, CTP, and any other required fees/charges so that you can just pay your cash, fill out the paperwork, and ride home on your new motorcycle.
You may also want to look at augmenting the mandatory CTP insurance with a private comprehensive insurance policy (to cover things like damage to your vehicle regardless of who's at fault), but that's optional.
Comment: Also, there's three flavors of insurance: obligatory CTP (damage to other person), third party property damage (damage to other person's property) and comprehensive (damage to your & others' property).  It's generally a good idea to get at least the second in case you crash into a Ferrari some day...
Comment: Is it safe to park and leave a motorcycle in Sydney street or I should use additional security devices?
Comment: @PHPst - Don't really know.  My anecdotal experience is that Australia is generally a very safe place with low levels of crime.  However I live in regional QLD, not the middle of Sydney.  There's a [crime map here](http://crimetool.bocsar.nsw.gov.au/bocsar/) that indicates relatively high levels of theft and malicious property damage in/around Sydney.  So probably doesn't hurt to have some extra security (or at least an insurance policy that covers theft).
Comment: The "bikie" stigma applies if you dress in black leather with club patches and drive a Harley or equivalent.  Commuting in Sydney with a Vespa?  Not so much.
Answer: Motorcycles are used by many people in Australia (even many rich people like my boss love to have fast and expensive motorbikes).
You can buy a motorbike or car using a foreign license (as long as it is in English or you have its translation)

Riding motorcycle in Sydney


How did the Apollo Lunar Module ascent engine prevent gas bubbling through fuel?

Question: As I understand it, in order to keep the lunar module ascent engine simple, instead of fuel and oxidant pumps, tanks of helium at pressure were used.   This pressure was used to force the fuel and oxidant through the pipes to the engine, where they would meet and, being hypergolic, spontaneously ignite and produce thrust.   What I cannot understand is how the engineers ensured that only fuel reached the engine and not a mixture of the gas and the fuel; in other words, how did they prevent the helium bubbling through the fuel and a fuel/helium mixture or even just helium reaching the engine.  Having to work in space it could not rely on gravity to help.
Comment: @jakekimdsΨ Please do post that as a separate question instead. Feel free to link to this one if you feel that provides context.
Comment: One question. Does the helium burn although it is a noble gas.? I don't know much on space stuff so I'm not familiar with helium as a propellant.
Comment: @jakekimdsΨ Helium doesn't burn at all, so a helium bubble in the propellant flow would cause a drop-off in thrust, and potentially unwanted vibration, neither of which is desirable. Occasional small amounts of helium wouldn't be a big problem.
Comment: @jkd helium isn't the propellant, it's just used to push the actual propellant (hypergolic toxic nastiness) into the engine. There's a lot more hypergol than helium by weight.
Answer: The ascent engine was normally fired when the LM was sitting on the moon's surface, so the tankage was subjected to about 1/6 $g$, more than sufficient to separate the dense liquid fuel from the helium pressurant. Once the engine was ignited, its own thrust accelerating the spacecraft would maintain the ullage.
The same question could well be asked of the LM's descent engine and the main engine on the Apollo service module, however, which did both need to fire in free-fall. In those cases, the smaller RCS thrusters on the LM or CSM were fired first, to "settle" the tankage and separate the fuel from the helium. In the LM case, this "ullage burn" was about 7.5 seconds. The first couple of service module burns -- typically for mid-course correction while en route to the moon -- generally didn't need an ullage burn prior, as the tanks would be full of propellant with little or no volume of helium. SPS burns later in the mission did require ullage burns. The RCS thrusters produced about 100 lbs of thrust each, and four would be used for the ullage burn, yielding roughly 1/200 $g$ acceleration.
The same RCS ullage burn technique would also apply to a situation where the descent engine failed and the ascent engine needed to be used for abort from free-fall, or in flight testing of the ascent engine.
That, in turn, raises the question of how helium ingestion was avoided in the RCS thrusters, since they were also helium pressurized. In those cases, the helium was separated from the propellants by a teflon bladder, so the helium didn't mix with the propellants. This was more practical to do on the smaller scale of the RCS propellant tanks than it would have been for the larger engines.
All that said, it was possible for the LM descent engine to ingest helium trapped in the propellant feed lines. On the bright side, even if enough helium was ingested to briefly prevent combustion of propellant, the release of helium through the nozzle would provide a small amount of thrust, which would tend to provide settling force to the propellant tankage. Various helium-ingestion tests were conducted on the engine, detailed in Operating Characteristics of the Apollo LM Descent Engine with Helium Ingestion and Propellant Depletion in a Simulated Space Environment.
Comment: The ascent engine was not only fired on the lunar surface, during Apollo 5, 9, and 10 it was fired without a landing as it would have been in an emergency abort.   In at least Apollo 5 it was fired again after the burn where it jettisoned the descent stage, so that would not have been available for pre-burn acceleration, and the tanks would no longer have been full.
Comment: Ullage burns require tiny accelerations, 1/6 g is huge compared to most. Also see the Lovell quote at the bottom of https://en.wikipedia.org/w/index.php?title=Ullage_motor&oldid=695686707
Comment: Wasn't there a slight incident on Apollo 9 where a LM engine burn was somewhat rough, at least originally presumed to be due to helium ingestion?
Comment: Fair point, will incorporate.


Do Most short motifs and phrases end on the root

Question: This may be objective, but I'd like others input.
Do most short phrases and motifs especially in blues and rock, end on the root.
I think I've noticed that in most phrases, that the ending note is always the most important to the listener. and its usually the root (or third ) of the backing chord.
Yes, No ?
Answer: Musical phrases normally end on a chord tone of some kind. The root is probably the most common (especially in rock, blues, and folk music) because it is the most stable tone in the chord. The fifth of the chord is probably the second most common note, followed by the third.
Often, musical phrases come in pairs known as "antecedent" and "consequent." It is sort of analogous to a question and answer, where the antecedent ends on the dominant and the consequent ends on the tonic. The two phrases together are called a "period."
http://openmusictheory.com/period.html
Comment: I'd say the third is more common than the fifth, which has shades of the dominant, so wouldn't be so convincing ( concerning plagal and perfect cadences, which is well connected).
Comment: I'm being picky but 'root' and 'tonic' are not interchangeable. The *tonic* is the stable tone of the key. The root of any given chord isn't necessarily the tonic.
Comment: @MichaelCurtis Good point. I have changed the post to reflect your suggestion.
Comment: @Tim Unless you're talking about jazz, I'm not sure that you are correct. I specifically pointed out the concept of antecedent/consequent phrases because the antecedent phrase will often end on the fifth (like in the example I linked to).
Comment: @MichaelCurtis I agree that "tonic" and "root" are not interchangeable words, but I'm pretty sure I used the words properly here.
Comment: I think if you say 'the root is the most common... because it is the most stable tone in the *chord*' you will have your intended meaning.
Answer: I think this is a great question and I have spent a lot of time trying to get the sense of the ending or goal tone of phrases in blues and jazz.
I often have felt that avoiding the tonic is characteristic in the style. That ending on the tonic is either too obvious, too bland, or too strong an ending that breaks the momentum. In no way is this a definitive statement from me, but I do present two examples that I think may illustrate the point. I concede the point up front that these are the "heads" and not necessarily indicative of how the phrasing would work in improvizations.
Blue Monk emphasizing chord 3rds and 5ths

C Jam Blue entirely the dominant
Comment: The OP doesn't seem to be asking about jazz. I deliberately chose these two because they are so strongly blues oriented.


What is Wolverine the best at?

Question: One of the common lines associated with Wolverine is "He's the best he is at what he does."
Now I think the line sounds great and it truly gives you an image of Logan, but I've never quite understood if this is supposed to allude to something specific or if it's just a general "he'll get the job done phrase. So what exactly is it that Wolverine does?
Comment: The full quote is something like: **He's the best he is at what he does, and what he does isn't very nice.** Which is a not-so-subtle allusion to killing people.
Comment: "Being an asshole" fits quite nicely.
Comment: Geography bees.
Comment: Witty one-liners.  The second half alludes to the fact that they don't always make sense.
Comment: In any case, Deadpool's the best at whatever it is wolverine does.
Answer: Chris Claremont started it all in the original four-part Wolverine limited series from September to December of 1982 in which Wolverine's catchphrase, "I'm the best there is at what I do, but what I do best isn't very nice," was debuted.
This catchphrase, which has been repeated over and over again throughout the years, alludes to maiming, killing or otherwise hurting people.  As internal monologue this, now popular, phrase had to do with Wolvie's negative perception of his identity.  Something Claremont (and writers after him) have tried to get everyone's favorite hairy Canuck to overcome.

While Wolverine is no longer the mindless berserker he was when he was introduced into the pages of the X-Men he still uses the catchphrase. In fact in a recent article Paul Montgomery [Marvel.com] said that "Being the best he is at what he does has always required of Logan a dauntless abandon."

(source: comichron.com)
Comment: Great answer. I assumed it meant that he was the best at killing but he's hardly ever shown as killing anyone anymore.
Answer: From the animated series:

Laser beams, I smell 'em

Given the implausibility of the feat, I'd say that he is probably better than anybody else at smelling out god damned lasers!
Comment: Implausible? Lasers strong enough to cut flesh and bone, probably have high voltage drivers which have o3/ozone hazards (Just like laser printers do). He could just be efficiently smelling the very small ppm ozone creation. Ozone has a distinct smell.
Comment: I believe the correct phrase is "frikking laser beams."  (Especially when said laser beams are mounted on sharks.)

What is Wolverine the best at?


Naruto and Sasuke's arms

Question: After the Naruto-Sasuke showdown and they blew their arms up, why didn't Sasuke get his arm repaired like Naruto had? Well, even with the bandages and all. I don't really know what's within the bandages.
Answer: He basically said he needed time to atone for his sins and that is why he went off on his own.  It is almost like he is telling himself that he deserved that. Inside Naruto's bandages are cells from Hashirama that are meant to regenerate his arm.  I am assuming in the future when it is fully finished, the bandages will probably come off.  It is also possible Sasuke will take the same treatment some day.
Answer: Naruto kept on using the hashirama hand while sasuke decided to stick with one only. Probably a physical reminder of what happened in the past.
Answer: After there legendary fight, which ripped off their arms. Lady tsunade treated naruto by recreating his arms using hashimara cells.
When she tried to help sasuke he refused -

first, he can create susanoo so for fight or living, he doesn't need to treat his arm.
  He wants to have a reminder of what he has done and should not become something that can harm his friends or village.
Answer: Naruto wear bandges because his arm look like obitos arm. But there is a problem witch can he use hashiram's cells because it affected by nintails chakra. But he is  reincarnation of hashirama so I think it will be ok.

Naruto and Sasuke's arms


Contacting a Potential Supervisor about Funding (after agreeing on project)

Question: I am in the process of contacting a potential supervisor to pursue a PhD in his group. We have agreed on the project and that I am a good fit for the project. However, there remains the funding issue. The professor is only granted funding for a UK citizen (since it's a university in the UK) from the department. But since I am an overseas student (the fees are double that of UK/EU citizens) he has to make a case to convince the department to fund me. I emailed him once, a week after our agreement, asking about updates regarding this situation. I got an update but no definitive yes-no answer and I am still waiting for more information. He said he would contact me when he has more information. But it's been more than 10 days since our last contact and I haven't received anything. Should I email him again? If so, what should I mention in the email (without seeming too pushy)?
Answer: I wouldn't push unless I had another option to consider and might need to back out of acceptance for another position. Ten days isn't a lot of time to move a bureaucracy.
However, if you need to write to him on another legitimate matter you could add a note at the end whether anything has developed about funding. If your acceptance is contingent on funding he should know that.
Comment: Then, how long should I wait to contact him again? @Buffy
Comment: @Mkw, if you have decisions to make about the position, then contact him soon enough to enable those decisions. But if it is just your wish to know, I'd keep waiting. If you have doubts about whether it will happen, explore what other options you may have.


Which term correctly identifies those who enjoy programming/technology: "geek" or "nerd"?

Question: Which term correctly identifies those who enjoy and are involved with programming and technology, geek or nerd?
Comment: I don't think you can discuss this without also discussing the orginal meaning of the word "hacker". Today it is more used to describe a computer criminal, but from the beginning it had the meaning "those who enjoy and are involved with programming".
Answer: VonC's answer is more to the point, but I just can't resist the urge to post this Venn diagram:

Image credit.
Comment: Excellent diagram :) +1
Comment: Love this!!! :-)
Comment: VonC's answer *is* more to the point, but I appreciate this too. +1
Comment: What's the slang term for those that are not in the overlapping areas, i.e. only intelligent ("smart" I guess), only socially inept, or only obsessed?
Comment: @SteinG.Strindhaug I assume (respectively) *egghead*, *loser*, and *maniac*.
Answer: The most probable term would be "geek", as in "computer geek" (roughly "computer whiz").
(not the US geek from fifty years ago, as the lowest form of circus performer, who did horrible, demeaning things).
Even though a geek is not necessarily smart or into computers, but can be in general a "weird person", the only usage of geek I know in French culture is related to computer.
This thread mentions:

"Nerd" has several meanings/usages.

One is that of a studious intellectual, meant to be negative but carrying a whiff of envy.
The other is "awkward pain in the neck".

One (non-official) difference between nerd and geek (in the computer field) could also be in term of general activity:

"Nerd" = producer
"Geek" = consumer

Eg. a nerd creates video games, a geek plays the video games.
But those two terms  certainly cannot be limited to this simple interpretation.
That being said, I thought the remark from John Hodgman was quite accurate:

Comedian John Hodgman recently spoke at a Washington DC press dinner, following Barack Obama, touting Obama as the first Nerd President, since Obama had admitted to collecting comic books and being a fan of Star Trek. Obama's Nerd intellectualism was contrasted to the "Jock" mentality that had defined the Bush years.
  In the midst of this speech Hodgman suddenly referred to Obama as a geek, quickly adding this aside:
"And to those who say, 'Wait, there's a difference between nerds and geeks,' I answer, 'Shut up, nerd!'"

Nicely illustrated by phdcomics:
Comment: For me, a Geek is a producer, and a Nerd is more likely to over-analyse and point out problems in everything.
Comment: In Norwegian "nerd" is a loan word with two pronunciations: As English: /nørd/ (sometimes spelled "nørd" too) or read as a Norwegian word /nærd/. Some people use the two versions slightly differently one corresponding to English "geek" and the other to English "nerd", but no real consensus on which means which.
Answer: Obligatory xkcd reference:
Comment: Title text: "The definitions I grew up with were that a geek is someone unusually into something (so you could have computer geeks, baseball geeks, theater geeks, etc) and nerds are (often awkward) science, math, or computer geeks. But definitions vary."
Answer: Merriam-Webster defines them thusly:

Geek - an enthusiast or expert especially in a technological field or activity
Nerd - one slavishly devoted to intellectual or academic pursuit

I'd say they're virtually synonyms. I've certainly heard them used interchangeably.
Comment: @VonC - Not quite. The debate started on chat.stackoverflow, I believe. It was about which term more accurately defines "computer people".
Comment: I believe the all crux of the debate is about the social awkwardness: do you associate that trait to a geek? a nerd? both?
Answer: Geek or Nerd = People who are passionate about something and laughed at by people who are NOT willing to take the time or effort find something to be passionate about and in fact trying their best to poke fun at people who care about something :-)
Answer: My definition of a Geek is that its somebody that is very interested in something and knows a lot about that subject, but also knows a lot or just as much about many other subjects. ie computers AND maths AND physics AND chemistry AND politics.
A Nerd however goes VERY deep on one subject and has a cursory interest in other subjects.
What this means is that geeks do some really interesting things in some fields, and manage to cross fields really easily. But the focused advances in most fields come from the hardcore Nerds.
Thus a Nerd is a very hardcore focused Geek.
Answer: A theory of a hierarchy, based on level of social interaction capabilities, has been discussed over numerous, excellent bottles of beer.  "Geeks," "nerds," and "dorks" all have the same level of passion for their field of study.  As a result, it is impossible to distinguish among them based on their level of skill and degree of interest.  Instead, it was concluded, one night, that it was better to organize them by their social skills.  "Geeks" have a high level of social skills and are able to interact with people outside their area of expertise: they might be geeks in, say, Ruby on Rails programming, but they can chat up an art historian with alacrity.  Nerds, on the other hand, are less comfortable outside their circle of peers--a C# programming nerd can talk to an advertising sales rep, if he/she must, but only if there is a substantial amount of alcohol involved.  For those unfortunate people who are so absorbed in their subject matter as to consider social interaction with anyone beyond their ken...we tend to call them dorks.  It's an cruel classification, but it exists all the same.
A fourth class have been discussed, usually late into the drink, and it's the question of the "poser," or someone who thinks they are an expert in something and think they belong in the "geek" or "nerd" class.  Even "dorks" agree that the proper term for them is probably "dweeb."
Answer: Someone reasonably famous once said "Nerds are simply Geeks who earn lots of money" I think it was in the context of Bill Gates.


Improvement in messages between parties in different time zones

Question: I occasionally receive job offers via SO's Careers and each time such offer come I need to bend my brain a bit to ensure I got sender's time zone right. And this is quite important in business contacts. For now, when one receives a message, time stamp shown on the screen is using your (recipient's) time zone. This can easily cause some problems if you are unaware, wrongly assume different timezone, or simply won't pay much attention. Sample situation: let's imagine you just sent a message "Let's have a call tomorrow at 10:30" to your potential employee. You are residing in California (PDT) and your clock shows May 13th, 5pm. But the recipient is in Europe (and you cannot tell that if his profile does not specify this). His clock shows 2am of... May 14th. So the "tomorrow" can be easily interpreted by recipient as his tomorrow, which means "Sunday" while sender really meant his tomorrow, which unfortunately is "Saturday". I'd be then extremely useful if, in case both sender and recipient are in different time zones, time stamp in both time zones could be visible (adding day name would also be useful too).
Comment: Impress your future employer by either using UTC or going through the extra effort of quoting his local timezone name correctly.  The latter is always best.
Comment: I pretty much doubt you can impress anyone with your time zones skills but at the same time I am pretty much sure that the situation from my post (which is actually real one) can cause you problems. It's not that hard to took "tomorrow"  wrong at 2am, as is not that hard to add support for the requested feature to SO to simplify usage.
Answer: You can't solve all communication problems with technology.
Someone sending a message at 2 A.M. (or 02:00) saying "tomorrow" is being ambiguous. In my book, it is only "tomorrow" after I've slept in a bed (I may have missed some days in my life through that), and they might mean the same. They could also really mean "the day after today".
When making appointments, one should mention the date. When specifying a time in an context where different timezones (could) apply, one should mention the timezone they intend.
Comment: In ideal world, true. But things sometimes look different. The information that other side is in different timezone would be simply helpful addition.


my phone is stolen and sim cards removed. how to track it?

Question: my android phone got stolen a few hours ago. the thief has already removed both the internet sims.
as such, i had not installed AndroidLost or Mobile Tracker apps in the phone as it is a relatively new one.
i have tried to remotely install it, but it may take time .
please help out with the procedure and suggest methods to get it back.
Comment: Keep in mind that any solution mentioned here and in the linked question only works as long as the device has not been factory-reset (so your Google Account would be disconnected fro the device). After that, the device can only be identified via its IMEI (and a clever thief even could manipulate that).
Comment: or from the link that @Sid suggested, you can try the plan B from the play store and use that.
Comment: do you have the IMEI number of the phone? It maybe mentioned on the reciept of your purchase.If you got it you can give it to the police to track and they will be able to find it
Comment: thanks a lot people... gonna try all ways out of this. will update whether i get it back or not ..
Answer: There can be many other options instead of those apps.
Android Device Manager
http://www.android.com/devicemanager
This is the only thing to do, and check where the theif had been for a few last moments. But this isn't perfect.
Android IMEI
If you ever wondered what your phone's IMEI is, you would have checked it via *#06# too. If you have it, then go to the government officials who can handle it (I am sorry I cannot guide you to the perfect organisation for that, because I never tried using IMEI to track a phone) and they will help you either in protecting your data or will even get you to your mobile too.
Comment: Good points. Unfortunately the *Android Device Manager* is very far from being perfect. I've tried it with four devices, it worked with none of them (could not locate the device, could not ring it, nothing).
Comment: Yup you're right, my mother just took my phone I tried to track it and it gave me a location just 2 streets away while my mom was more than 400miles away :D But lets wait for it untill its out of beta thing :)
Comment: I doubt it will ever be. For my devices it couldn't find *any* location at all. And if you take a look at Google Cloud Backup, which was introduced somewhere with Android 2.x more than 2 years ago: it's still a "game of fortune" whether restore works at all or at least partially, even with 4.x devices. So no, I wouldn't trust it before having verified it works with the device I intend to use it on. But *if* that's verified, it's a good solution.
Comment: Whether restore would work? You can bet on it! :/ It doesn't work, and it won't work for 4.3 either! You can be sure for this. And yeah, Android Device manager just gets the last location which was sent to Google Maps and shows it. But their ringing thing is awesome :) It rings the phone just in few seconds! :) I love that..:)


How to use taxonomy vocabulary with terms and children using views module

Question: I have a problem with Views and Taxonomy and maybe can found the solution here. I have a vocabulary with 15 terms and each term have a few childs. I want to show that with a jump menu using views but the result is awful because I have a list with terms and childs but losing the hierarchical order. Please, check it here (http://cubarecipes.org/restaurants-guide), right column, Cuba Restaurants guide block.
Thanks in advance,
Alex
Answer: You are probably looking for the Simple Hierarchical Select module.
From the module's page:

Simple hierarchical select defines a new form widget for taxonomy
  fields to select a term by "browsing" through the vocabularies
  hierarchy. The widget is available in node forms and as Views exposed
  filter.
This module has been inspired by Hierarchical select but is much
  simpler (hence the name ;) ).
Unlike Hierarchical select this module provides a simple widget for
  taxonomy terms only. As an addition Simple hierachical select works
  as Views exposed filter.

The Hierarchical Select module is still in development for D7 and the Views integration has not been ported, so SHS is the best choice at the moment.
Answer: A simple solution is the Taxonomy Menu module, this will automatically turn Taxonomy terms into a menu with heirarchy, you can view the trial site for it here for Drupal 7.
Another useful thing that may help tidy up your menu is Taxonomy Menu Trails, which will allow you to hover and access nested terms.
Hope this helps!
Answer: You can follow the below step:

Add relationship 'Taxonomy term: Parent term' in your views.
Add 'Taxonomy term: Name' field in views and set 'Relationship' as parent which you have added in your views.
Click on "settings" of jump menu and it will open "settings" form in popup.
select parent field from the drop down "Grouping field Nr.1" in popup
window and save the form.

Kindly see that there would not be link to parent term in jump menu and you can find the duplicate parent term in views, which you need to filter.


Waswas Related question

Question: What is the best on getting rid of waswas and how to ingnore will by prayer be accepted? If I actually did pronounce it wrong but ignored it thinking it's waswas
Answer: Allah knows your intention, he knows best what is in your heart, as long as you hate those thoughts you are not sinful for this, so whenever these thoughts come to your mind immediately start thinking about something else, engage yourself in something like painting, reading, cooking, playing,  stitching, writing,  talking so that you can get rid of these thoughts, because in free time there are more chances of those thoughts to come to your mind. And about salah, you should study the meaning of surahs and duas that you recite in salah so that you can get rid of these thoughts in your salah, concentrate every word in your salah, so whenever these thoughts come to your mind in salah don't try to ignore them just try to focus on the meanings of surahs and duas in salah
Answer: Reading more Quran and doing more dhikr. Reciting adhkar and increasing your general knowledge of Islam. You could also seek help from scholars as they are very knowledgeable and could help you as well.

Waswas Related question


Why do I get an extra element at the end in JSON?

Question: I'm working on some website, and am using JSON. My problem is the JSON.parse method, I use it to send a simple array, and append to an array the values. And I always get an extra element at the end that us just commas. here is the simplified code:
responseText = '["dummy1", "dummy2", "dummy3", "dummy4"]';
var  clientList=[];
try {
    JSON.parse(responseText, function(key, val){clientList.push(val)});
} catch (e) {
    alert('no');
}

alert(clientList.length);

First in IE its not working at all (exception is thrown).
Second chrome the result is that clientList is an array of 5 strings, while the last one is ',,, '.
Why is that extra value there? Can I get rid of it (without just popping the array at the end)? And what is wrong with IE?
Comment: How is "exception is thrown" supposed to help us tell you what's wrong?
Answer: This will work:
responseText = '["dummy1", "dummy2", "dummy3", "dummy4"]';
var  clientList=[];
try {
    clientList = JSON.parse(responseText);
} catch (e) {
    alert('no');
}

IE doesn't have JSON as a default in the browser. You need a library like json2.
As for your question, that callback function is really in order to transform your object not build it. For example:
var transformed =
JSON.parse('{"p": 5}', function(k, v) { if (k === "") return v; return v * 2; });
// transformed is { p: 10 }

From parse
Answer: There are differences in using JSON under different browsers. One way is to do what IAbstractDownvoteFactory said. Another way is to use jQuery library and
clientList = $.parseJSON(responseText);

should do the job under any browser (although I did not test it under IE).


cross border copyright claim

Question: i live in EU. somebody from another EU country is writing me that they intend to take me to court for a very minor possible copyright infringement. my question is - if meanwhile i move to live in a completely different EU country, can he have success in court over there since the actual copyright infringement took place in a different country?
Comment: Related question: [Which jurisdiction applies to copyright violations on the internet?](https://law.stackexchange.com/questions/4017/which-jurisdiction-applies-to-copyright-violations-on-the-internet). Tl;dr: International borders make copyright lawsuits more complicated, but not impossible.
Answer: As user Philipp notes in a comment, international lawsuits can succeed.  This is surely even easier within the EU than it would be otherwise.  I do not precisely know how the proper venue would be chosen in the EU case you describe, but there is a Wikipedia article discussing the relevant regulation, the Brussels I Regulation:

The Brussels I Regulation contains a jurisdictional regime: the rules which courts of European Union Member States use to determine if they have jurisdiction in cases with links to more than one country in the European Union. The basic principle is that the court in the member state of the party that gets sued has jurisdiction, ...

There are, however, several exceptions to the basic principle.
Even if the action is pursued in the original country, any judgment arising from that action would be enforceable in the new country:

In 2012, the EU institutions adopted a recast Brussels I Regulation which replaced the 2001 regulation with effect from 10 January 2015.[18] The recast regulation...abolishes formalities for recognition of judgments and simplifies the procedure for a court chosen by the parties to commence proceedings (even if proceedings have started in another member state already).

Therefore, the general answer to the implied question, whether one can avoid legal action for copyright infringement by moving to a different country, is no.

cross border copyright claim


HMAC computation using AES key

Question: I want to compute an HMAC value of a data set using CKM_SHA256_HMAC mechanism with AES key. I have the error code CKR_KEY_TYPE_INCONSISTENT because it seems that I need to use a key of key_type GENERIC_SECRET instead.
Is it possible to use AES key_type with this mechanism? If yes, how can I do it? Can you provide an example?
Comment: AES-CMAC would be functionally equivalent to HMAC - except for the output size. That may be of little consolation if your protocol requires HMAC of course. Same problem with fgrieu's answer: if the protocol doesn't define a KDF and cannot be changed then inserting one is not an option.
Answer: I see no way. Typed keys are typed to prevent them from being used for another task than being the key to the designated algorithm.
What you maybe could do is use the key to derive another, and use it as an HMAC key. But I do not immediately see how we could avoid that the HMAC key could leak of the PKCS#11 device.
Note: this comment sketches an option. But I can't remember of a key derivation mechanism in a PKCS#11 device that allows to derive a key remaining internal but where the new key is for a completely unrelated algorithm (even as a proprietary extension). Also, if the intended algorithm is not fed to the derivation, that could be susceptible to attack by using the same key for a variety of algorithms. For example DES to get 56 bits out of the first 64, then two-keys 3DES for 112 out of 128, then AES-128 for 128 out of 128, and so on.
If compatibility with standard HMAC is not needed, then an option is to compute an AES-based MAC of the SHA-512 of the message, which is possible with the key in the PKCS#11 device, and can likely be much faster since the SHA-512 of the message can be computed externally.
Comment: There are generally AES key derivation mechanisms available, maybe those could be used (generally they are little more than AES / ECB or AES / CBC over input data, where the output is treated as a key if I remember correctly).

HMAC computation using AES key


SharePoint 2013 - Custom Timer Job prevent concurrent instances

Question: I have a timer job that runs every minute. The timer job needs to do some processing and it may take more than a minute. I don't want the job to get triggered if previous instance is still running. That is, though it is supposed to run every minute, it should not run the next minute if previous one is still running. I am using SPJobLockType.Job as I need only single instance in farm. Please let me know if SharePoint will provide the desired behavior or if anything else is required to achieve this.
Answer: Yep, you're all good! Timer jobs rock, it's a pity we have to move away from them in the 'new school' style of SharePoint development
Answer: To check that whether your timer job is running, you can use "WebApplication.RunningJobs". look at following example,
<code>private bool IsTimerJobRunning(string timerJobTitle, SPSite site)
{
return site.WebApplication.RunningJobs.Cast<Microsoft.SharePoint.Administration.SPRunningJob>().Any(job => job.JobDefinitionTitle.Equals(timerJobTitle));
}

if(IsTimerJobRunning("Your timer job name", spsiteObject))
{
// Timerjob is running
}
else
{
// timerjob is not running
}
</code>


Does paying bills or shopping with a credit card build credit better?

Question: Okay, so the only reason I got a credit card was to build credit; Right now I use my credit card 3 times per month to buy gas, then I pay it off as soon as the bill is due.  Would it make any difference if I setup an automatic bill payment FROM my credit card to... say... Verizon, and also setup an automatic bill payment from my bank TO my credit card every month. Would that make any difference in building my credit vs what I'm currently doing?
Comment: Related: http://money.stackexchange.com/a/31066/11865
Answer: Your credit card company makes money from 3 ways: Interest and penalties; annual Fees; and a percentage of each transaction.
The more money you move through their card, without being late with payments, will encourage them to give you a larger credit limit. Which will allow you to move more money through their card.
Yes, using too much of your credit limit will hurt your utilization number and lower your score; but unless you need a high credit score now proper and frequent use of the credit card will allow them to expand your credit limit. Which gives you more ability to use the card and keep your utilization number low.
It doesn't matter if the card is used to pay for gas, or to pay the electric bill. Anything that you would use a debit card for can be charged to the credit card. Many utilities can be paid using the card.
Two big cautions. You don't want to pay fees to get a higher credit score. So always pay it off each month so you don't have to pay interest. The second thing is don't charge anything that requires a fee to use the card. Some local governments charge a 2-3% fee to charge your property taxes, which will generally be greater than any cash back card will award you.
Getting a great score take time.
Answer:
Number of credit card accounts you have matter to an extent.
When you get a new card use the card and before bill is generate at least have around 1% usage on that card. You can have 0% usage on all other cards.
1% is 1% of your total credit available across all cards.
For example,
if you have two cards with $1000 credit limit each, you have a total credit line of $2000.
Say you are getting a new credit card with $2000 limit. Use the new card for the first month for as much as you want BUT BEFORE BILL IS GENERATED, pay off everything except say, $40 (1% of total credit line - $1000(1st card) +$1000(2nd card)+$2000(new card)). You can report $0 balance on the two existing cards. This is the best case scenario. Total utilization of 1%-9% is considered ok, but try to avoid reporting balance in all the cards all the time.
Carrying a balance just for the sole purpose of increasing credit score is not at all required.

Therefore, it doesn't matter at all how you use it, Percentage of utilization certainly matters. Another thing you might want to note is some banks/institutions like Discover, Amex report to the credit bureaus (CBs) passively - i.e., the statement balance only, while a few others like local credit unions allow CBs to pull information on any certain day of a month (your outstanding balance on that day is used by the credit bureau will be used against that card for a month).
Also note that maintaining the 1% is important. If you go below 1% (less than $40 in the example above, you might see a minor decrease in your score.)
Other than these, nothing else you do - mode of payment, how and where you use the card etc., do not matter most of the time as long as it is not cash withdrawal from credit card (Don't do it under ordinary circumstances).
Additional tips:
Maintain a good payment record and if you have steady income, apply for a some good branded card like Discover after 4-5 months. If you get a good limit, wait for 3-4 more months and apply for another good card like Amex.
Do not apply for two many cards in the process. Websites like MyFico.com Forums will tell you what types are cards you are mostly likely to get for your credit profile. Choose an entry level card after thorough research and apply for it.
Sign up for free monitoring for indicative scores like CreditKarma which do not provide actual score but some educational score which you can track overtime. If you mistakes your scores will go down. Don't worry these scores are transitory. As long as you make errors in utilization or things like that you can rectify it in the next cycle (most likely, next month).


How can one compute the CPI All items index from the component indexes?

Question: How can one compute the CPI All items index given the CPI energy index and the less energy index? I used the relative importance as component weighted value but it isn't true.
Comment: To clarify, do you mean the "CPI energy _only_ index" and the "CPI _all-but-energy_ index"?
Comment: Yes, I want to calculate the CPI all items index from these two indexes.
Comment: Was my answer of any help? If so, please consider accepting it. If not, let me know how to improve.
Answer: I'm afraid that with the information you state, this is impossible.
Say there are three items in the CPI: housing, food, and energy. Define the weight of each component in total CPI, weight which can vary over period, as $w_{h,t}$, $w_{f,t}$, and $w_{e,t}$ respectively. By definition, they add up to 1. Similarly, define the CPI series of each item as $P_{h,t}$, $P_{f,t}$, and $P_{e,t}$ respectively.
The CPI index for all but energy goods, $P_{hf,t}$ is given by:
$$ P_{hf,t} \equiv \frac{w_{h,t}}{w_{h,t}+w_{f,t}}P_{h,t} + \frac{w_{f,t}}{w_{h,t}+w_{f,t}}P_{f,t}$$
Although you know $P_{hf,t}$, you do not know any of the other 4 terms, for each period. As such, this is an undetermined system. In the case of a CPI with $N$ items, the system has $2(N-1)$ unknowns.
If weights are constant, you cannot get much further either. Say that you have $T$ number of periods. Then, you have a system of equations like
$$ A_{t} = bX_{t} + cY_{t} $$
where only $A_{t}$ is known. This is also undetermined. You can only write $X_{t}$ as a function of $Y_{t}$, $b$ and $c$. (and viceversa).
A second best approach?
You have one option though. You could compute the "vector distribution" of the all-CPI index. To see this, notice that the total price index, $P_{t}$ is
$$ P_{t} \equiv w_{h,t}P_{h,t} + w_{f,t}P_{f,t} + w_{e,t}P_{e,t} $$
This is equal to
$$ P_{t} = (w_{h,t}+w_{f,t})P_{hf,t} + w_{e,t}P_{e,t} $$
But weights add up to one. Therefore,
$$ P_{t} = (1-w_{e,t})P_{hf,t} + w_{e,t}P_{e,t} $$
Or better:
$$ P_{t} = P_{hf,t} + w_{e,t}(P_{e,t}-P_{hf,t}) $$
Now, since you know the CPI index for energy-only ($P_{e,t}$) and for all-but-energy ($P_{hf,t}$), you could compute $P_{t}$ for a given assumption on the energy weight on total CPI. You can, for instance, look into other similar countries and see how much this weight is. Or look for related information on this respect. This number cannot be wildly different across countries. So you can still get a rough idea of general CPI.


May one have a torah aliyah during the mourning period

Question: Is it okay to have a torah aliyah during the 11 month mourning period, or should one wait?
Comment: Do you mean the 12 month mourning period (11 month is only for kadish; mourning continues into 12th month for a parent)?
Comment: If you're asked up for an aliyah, you can let the gabbai know that you're in mourning.  They would know the shul's policies and if not, they will ask someone who does.
Answer: I think you will find that there are various customs. Some communities give last aliyah (acharon) to a mourner who then says half Kaddish.
Comment: My mother passed away 8 months ago. Is it best to wait until the mourning period is over before having an aliyah?
Comment: @SteveDorfman, my condolences. Note that this site makes no guarantee of validity, and does not offer professional (particularly rabbinic) advice. Treat information from this site like it came from a crowd of your friends. Also, since your question seems now to have been whether one should wait (or, to the contrary, may get an _aliya_ during the mourning period), and not whether one may wait (or, to the contrary, should get an _aliya_ during the mourning period), I'm editing the question to clarify that.
Answer: Rivivos Efraim 5:556 concludes that although there is no Chiyuv for an Avel during the 12 months to get an Aliya every Shabbos, it is a good idea if possible. Thus it seems clear that an Avel should get an Aliya if possible during the 12 months.


PHP: What are the advantages of FastCGI over mod_php?

Question: It was recently suggested to me that I use FastCGI with PHP. Now I went to the FastCGI page and read it but I don't really understand what the advantages are.
Answer: Using mod_php each Apache worker has the entire PHP interpreter loaded into it. Because Apache needs one worker process per incoming request, you can quickly end up with hundreds of Apache workers in use, each with their own PHP interpreter loaded, consuming huge amounts of memory.
(Note, this isn't exactly true, Apache's worker_mpm allows you to serve many requests with a single threaded Apache worker. However, even in 2009, this is not the recommended way to deploy PHP because of suspected threading issues with the PHP extensions.)
By using PHP in fast_cgi mode (using something like spawn-fcgi from the lighttpd package) has the following benefits

tune the number of PHP workers separately from the number of incoming connections
allow you to put you PHP workers on a different server, or scale across many servers without changing you web tier
gives you flexibility to choose a different web server, like nginx, or lighttpd
allow you to run your PHP application in a different security domain on your web server
Answer: FastCGI means that the php bits aren't running in the same process as the apache bits, unlike with mod_php.  This separation can have some definite advantages when it comes to restarting the server or dealing with runaway applications - in the mod_php case that means that it's the apache process that's "runaway", but under fastcgi it's just a process that apache is talking to, so the entire server doesn't have to be taken down.
Answer: Another advantage not yet mentioned is the fact that with mod_fcgid (which is a newer implementation for using FastCGI on Apache) and suexec you can realize setups where different vhosts use different Linux users for execution, which can be a real security benefit in a shared hosting szenario.
With mod_php, all vhosts share the same user, which is Apache's user. This can lead to security issues.
Comment: It depends on the MPM used in this particular Apache httpd setup. For example with MPM-itk (http://mpm-itk.sesse.net/) it is possible to use mod_php and have the scripts (or better: the httpd processes) being run in the context of another user.
Comment: With pho-mode you can use very moderate permissions such as 644.  Do I need to make most of my files executables with fast-cgi and forcedly use suexec?


How long max should I leave yeast slurry out of the fridge to warm up?

Question: I took my yeast slurry out of the fridge to warm it up to room temp before brewing.  I had some technical issues however so I'm brewing tomorrow instead. At that point the yeast will be out of the fridge ( at room temp - aprox 20C ) for about 24-28 hours. It's in a mason jar and the lid is slightly loosened. Will it be OK to use or should I dump it and use a different jar?
Answer: I don't recommend letting it warm up at all.  For on thing, it isn't necessary.  For another, if you let it warm up the yeast starts consuming its "built in" nutrients before it's in the beer.  I've pitched hundreds of batches with slurry straight out of the fridge and never had a problem.
Comment: Currently, the main argument for warming it up is to see how active the yeast is. If it isn't active then it doesn't matter about the fridge or much else. If the yeast is of known activity and concentration then it could certainly be pitched directly from the fridge.
Comment: cool - will try that next time - I always find it a bother to remember to take it out - do you know what the argument is for warming it up - is it to do with  avoiding shocking the yeast with a sudden rise when pitched into warmer wort?
Comment: that was the theory, long ago disproven.
Answer: The main thing to check for is actual yeast activity. The time it was left in or out of the fridge is a secondary issue. An active yeast culture with sufficient nutrients is actually quite stable. If re-supplied with nutrients it can be safely kept going (and be used for brewing) for years in "normal kitchen conditions"(ie not a fridge).
Yeast taken out of a fridge needs some time to return from being dormant (or being of very low metabolic activity) and 24 hours at "room temperature"(20C) should be enough. If the yeast culture is active and has nutrients/sugars then it will ferment. Fermentation can be judged by the amount of bubbling and foam on the surface of the yeast "solution". If the yeast is actively fermenting then it can be pitched into a brew. If the yeast is not active then wait until it is or make a new culture using new yeast - AND MAKE SURE THAT IS ACTIVE TOO.
If yeast (liquid or powder) is added to a weak sugar solution and kept at room temperature for a day it should start actively fermenting. A good active yeast will start fermenting withing minutes and bubbles and foam might be seen on the surface of the solution within 30 minutes. If a correctly made up yeast starter culture does not show signs of life within a day (and I would say within 4 hours) at 20C then IMHO it should be discarded with any yeast source it was made up from.
Answer: It should be fine to use.  I'd decant the spent liquid from the jar and add some fresh wort and let that sit until I had signs of yeast activity in the jar.  If the new wort has to sit in the fermentor until the yeast have awoken so be it.  If your sanitation is good that should be a problem for the wort to sit for several hours. I regularly pitch the next day some of my beers. Again your sanitation has to be spot on.
If the jar doesn't start, that's when I'd look at using a different jar.  But I'd try restarting that one too with some starter wort.


Where are all the Khajiits?

Question: I wanted a Khajiit steward for my house because that would be awesome but I realized that I have only seen one Khajiit camp in Skyrim. I was wondering if there are camps throughout Skyrim or if there are caravan routes that would help me find some?
Answer: Khajiit are used to more temperate climes by far; they don't like the cold, and their native province, Elsweyr, is far to the south of Skyrim.
The distance from home combined with an unideal climate (and Nord racism) means very few Khajiit are found this far north. As such, there are very few Khajiit in Skyrim; they have no settlements of their own, and the only reasonable concentration of Khajiit at all are in the wandering "gypsy" caravans.
The UESP counts only 25 Khajiit in all of Skyrim (Compare this to the 500 or so Nords!), and they are the only race without marriage candidates in the base game.
The aforementioned "Caravan" Khajiit have the following routes:
<code> - Ri'saad's Group travels between Whiterun and Markarth
 - Ahkari's Group travels between Riften and Dawnstar
 - Ma'dran's Group travels between Windhelm and Solitude
</code>
Each caravan will stay camped outside the appropriate city for 2 days before traveling along the road to the other.
Comment: Wow that helps out a lot. I don't think I've accepted a Khajiik related quest so it'll be nice to learn about they're history. Thanks for the help!
Answer: There are three Khajiit trader groups and they follow fixed routes.

Ri'saad's Group travels between Whiterun and Markarth
Ahkari's Group travels between Riften and Dawnstar
Ma'dran's Group travels between Windhelm and Solitude

These traders will often camp out at one of the cities on their route for a few days before moving on.
Answer: No one seems to have addressed his primary question which is:

I wanted a Khajiit stewart for my house because that would be awesome

Unfortunately, in the base game, none of the possible Stewards are Khajiit:
https://elderscrolls.fandom.com/wiki/Category:Skyrim:_Possible_Stewards
There is at least one mod which offers this as an option:
Dominions Hearthfire Stewards
Also, on the XBox One there is another one:
Beast Mode
Answer: You can get a Khajiit follower by returning the moon amulet to Kharjo, then taking him to your house and asking him to be your steward.
Comment: Unfortunately Kharjo is not a possible steward in the base game:  https://elderscrolls.fandom.com/wiki/Category:Skyrim:_Possible_Stewards
Comment: Followers are not always stewards. Serana can be a follower but not a steward.

Where are all the Khajiits?


Does iOS 4.2 improve performance on the iPhone 3G?

Question: I've "inherited" an iPhone 3G from a friend who upgraded to iPhone 4. He had complined about the slowness of iOS 4. Although I personally have no problems with it, I was wondering if iOS 4.2 offers any noticeable performance improvement. Does iOS 4.2 improve performance on the iPhone 3G?
Answer: From the iLounge article

Thus far iOS 4.2 appears to perform as
  well as iOS 4.1 did under similar
  conditions. Performance even on older
  devices such as the iPhone 3G is the
  same as iOS 4.1 and thus far we
  haven't observed any significant
  changes in battery life.
Answer: It actually seems faster than 4.1 to me on my 3G.
Answer: My iPhone 3G has become slower in some occasions with iOS 4.2 especially when pasting an address from Mail to Maps.
Answer: I have an iPhone 3G that I use for testing. 4.2.1 seems insanely slow on it, but maybe that's just because I've gotten so used to the speed of the 3GS and iPhone 4 over the past two years and forget what the "normal" speed of a 3G should feel like.
Comment: I told everyone that they have no room to complain when 4.0 came out. I used the 4.0 betas (part of the developer program) for nearly the first half of the year on my 3G. It was *miserable*. I really like 4.0, but I think that's because each beta was better than the last, so I got the opposite effect. Good -> Horrible -> Better.
Answer: IOS4.2.1 is better than 4.1 for sure!!! I did not use yet the 3gs nor the iphone4, and got through every iOS "upgrade" available starting 3.1.3 , 4.0 , 4.0.1, 4.1 and probably yhe last one for the 3G 4.2.1 ! almost as fast as the 3.1.3 ,and with all the advantages of the 4.x ( folders, ibooks, faster maps, faster jawa, geo-tagging new caracters for notes, easier copy paste ((i think...)), etc. deffinatley a good option to upgrade! you will not be sorry!!!
Comment: Spelling, grammar, less special characters, and maybe even a newline or two. Please? Also, what the heck is jawa?
Comment: @Jason: they're those little people in robes that sell droids on the black market.
Comment: Well I knew that, but in-context what is sind talking about?
Answer: My wife's 3GS which has 3.1.3 runs much faster than my 3GS with 4.3.5(BL1). However I cannot backup her unit in newly purchased MacBook Pro with Lion, but I can backup mine. I see it as Apple's way to force us to upgrade to their latest iOS even if that means to sacrifice performance. I don't like that at all, therefore I chose to backup 3.1.3 to a WinXP machine.


LinkedIn: best way to handle listing an internship with two time periods as one position

Question: I was an intern May - August 2015 and I starting interning at the same place again last week. Is it unprofessional/deceiving to list the timeframe on my LinkedIn as May 2015 - present, even though I did not work there during August - December 2015? Is it not a big deal, or should I mention this is the job description? If so, how can I integrate the dates explanation into my description?
Comment: Consider them as two seperate assignments
Comment: I'm continuing my work on the same project... In my mind, it is the same assignment.
Comment: What if you joined the same project after 5 years ?
Comment: Really wish likedin allowed for multiple date ranges
Answer: If you worked on the same project and LinkedIn doesn't give you the option of having multiple dates for the same position:

Use the title to make clear that you were an intern: Chicken Plucker Intern
List the full period, gap(s) included:  May, 2015 to Present
Use the position description to elaborate on the dates:  (Position held intermittently May to August, 2015 and January, 2016 to Present.)  Put this at the end of the description so the reader isn't thinking about the dates while reading about what you accomplished.  What you did is more important than when you did it.

I've had the exact same same situation twice in my career (one during breaks and summers and another across two summers).  Most people understand that internships are often interrupted by full-time study, especially when the dates fall within the time you were in college.
Answer: I am in the same stuck spot.  I did my own consulting for five months in 2013, got hired by a company (not the one I consulted with) and now back to my own consulting.  I do not want to keep making my LinkedIn look like I have "another job" every time I consult.  LinkedIn needs to figure this out ... Especially with college students that return to summer/holiday work.
Comment: Blrfl's answer has worked well for me. I would choose one central company and reference the other ones in the description.


Dapper and n-tier application (navigation properties)

Question: I'm struggling to get my head around how I should implement dapper in my application. I have a n-tier mvc application and have some experience with EF. Even that I think EF is good, I have not passed the learning curve to make it flow easy and not struggle with performance. In the new project we decided to give dapper a go, mostly to get control over the sql and hopefully get good performance.
Background
I created a layered aplication (core) with these layer
Web - mvc
Service - Business layer to handle the business logic
Data - datalayer to access the ms sql server
I went ahead and started implementing a UnitOfWork and generic Repositories in the datalayer.
A normal structure in the Database would be
Order
   ref to User
   ref to Address
   OrderLine
      ref to Product

And in many cases I want to retrieve multiple orders with all lines and products.
So what I did was to have navigation properties on the entity models as you would in EF and populate them with dapper using either multiquery or split the result into different entities and mapping them to the graph.
The problem
The problem I run into is when I do an insert. I have an sqlextension that maps the properties to table columns. But the navigation would also be mapped by default. I realize that I can decorate with attributes and read them on the mapping, but as I google I'm getting aware that maybe I should drop the UnitOfWork pattern and also repository, making the data-layer "super thin" and just expose the connection.
Then the service-layer would call the Dapper with correct sql, kind of what I would do today but with repositories.
I would also drop the navigation properties and fetch each entity on it's own, and combine them in the ViewModel.
My problem with this is if we take the order table above I would have to do something like this to get a full list (normally paged, also I removed the User/address)
var listModel = new OrderListViewModel();
var orders = orderService.GetAll();
foreach(var order in orders) {
   var orderModel = new OrderViewModel();   // also map fields

   var orderLines = orderService.GetOrderLinesForOrder(order.OrderId);
   foreach(var orderline in orderLines) {
      var orderLineModel = new OrderLineViewModel();   // also map fields
      var product = productService.GetProduct(orderline.ProductId);
      orderLineModel.Product = new ProductViewModel();   // also map fields
      orderModel.OrderLines(orderLineModel);
   }

   listModel.Orders.Add(orderModel);
}

This will generate ALOT of queries (almost like EF lazy loading). So I could do a mapping thing
var orders = orderService.GetAll();
var orderLines = orderService.GetOrderLinesForOrders(orders.Select(o => o.OrderId).ToArray() );   // get all orderlines for all orders
var products = productService.GetProductsForOrderLines(orderLines.Select(p => p.OrderLineId).ToArray() );  // get all products for all orderlines

foreach(var order in orders) {
   var orderModel = new OrderViewModel();   // also map fields

   var orderLines = orderLines.Where( o => o.OrderId == order.OrderId );
   foreach(var orderline in orderLines) {
      var orderLineModel = new OrderLineViewModel();   // also map fields
      var product = products.First(p => p.ProductId == orderline.ProductId);
      orderLineModel.Product = new ProductViewModel();   // also map fields
      orderModel.OrderLines(orderLineModel);
   }

   listModel.Orders.Add(orderModel);
}

This will generate alot less sql queries and is optimal in performance I think. I know there can be a problem with more than 2100 (?) parameters, but I think that will not be a problem in my case.
The problem is that many of out tables have different status, and many relations to other tables. I would have to do alot of these queries all the time.
When I first did repository and navigation I would do it like
repo.Get<Order, OrderLines, Product, Order>(sqlThatWouldJoinAllTables);
// split and map the structure into order Entity and just return that

That way I could just call orderService.GetAll() and retrieve a graph of order, orderlines and products.
I don't know which of the solutions is "best practice". I've tried to find a good open source project using layers and dapper to get some real world usage, but without success.
The approach of removing navigation properties also remove some of the purpose of the service layer, since i'm in kind of a way moving some of the business logic to the mvc controller.
I can't find a good practice how I would go forward, please advice.
Answer: If the RDBMS you're using supports JSON, I would suggest to wrap everything you need to insert into a JSON and send it to stored procedure with just one call. Same technique can be used to return a graph of related object with just one call. The Unit-Of-Work, a transaction really, will be taken care in the stored procedure itself, which is also the right place where to deal with transactions that operation on data IMHO.
This helps enormously to reduce round-trips at the expense of more CPU used on the database. This is usually not a problem unless you expect a really huge number (= more then several thousands of concurrent queries per second.
I have wrote extensively about this here:
https://medium.com/dapper-net/one-to-many-mapping-with-dapper-55ae6a65cfd4
and more specifically the "Complex Custom Handling" sample shows exactly what I mentioned.


How to sign in to XBox One console from Windows 10

Question: When I try to stream my XBox One it sometimes works (I guess because the Kinect automatically detects and logs me in) but sometimes it doesn't recognize me, and when I try to stream the XBox it says "To continue, sign in on your console using this account."  However, there are times when I cannot see the console any way except via streaming, and cannot log on directly via the console; I need to do it either over the app or via streaming.  How can I do this?
Answer: Do you have auto sign-in turned on?

From the Xbox One dashboard, go to the left to open the sidebar
Scroll down to "Settings"
Choose "All Settings"
Choose "Account"
Choose "Sign-in, Security, and Passkey"
Set "Instant Sign in" to use your XB1 profile

That said, I actually get this error a lot if I just woke the XB1 up with the Xbox App before trying to stream.  If I give it 15-20 seconds and retry the streaming, it usually works.
Comment: I would perhaps replace "DO you" with "make sure". The asked mentions signing in with Kinect, which is an alternative to auto sign in. Auto sign in would circumnavigate Kinect sign in from the start.
Comment: Seconding your bit about waiting.  Connect, wait half a minute, and then streaming generally works for me.


How to make Gramps show more than 5 generations in the pedigree view

Question: I just installed Gramps the other day and am rather new to it. When I go to Pedigree view, it only shows me five generations at a time. How do I change this (as in make it show more)? Or is it not possible?
Comment: That sixth generation will have 2^5 (32) entries, and the seventh would have 64. They would necessarily be quite small, possibly unusably so.
Comment: @Luke Thanks for a question that caused me to investigate a problem that I have been "coping with" for more than a year, because I assumed the setting could not be changed. It can. See below.
Comment: I am new to this program, and I can tell it still needs improvement. These are the issues I have found with version 3.3 in Linux: The principal problem is at the interface "Ancestry", which I prefer to use as builder of the tree, rather than using "people" or "Families" interfaces. I mannaged to create a Tree in "Ancestry), begining with the most recent person, then going backwards, adding the parents; and so on. This is the way of Gramps, because it seems to me that it is not possible to create a tree begining from the oldest ancestor towards the present, because there is no way to make under
Answer: With the proviso that I am still using Gramps 3.4.1 on Windows (because I use it as a Portable App) the change you want is quite straight forward.
In the Ancestry mode, select View then Configure View.

Then move the slider to the right as far as you can cope with the necessary scrolling that results.
Comment: works on gramps 3.3.1-1 on a mac as well. Good answer.
Answer: Although not exactly what you are looking for (@Fortiter just provided that in his answer), you can see many generations at once using reports. That can provide context for the fewer-generation view in pedigree. Just keep it open in another window while you are navigating around using pedigree.
Reports - Graphical Reports - Pedigree Chart:
The 'tree options' tab has a 'generations' field. I set mine to 10 and it worked fine. Note you can output either openDocument, svg, postscript, or pdf. You might have to play with sizes (fonts and paper) to get what you want. My first 10 generation pdf was 48 pages which does not meet your original request to see more generations at once. However you can make one big pdf (easier with svg if you have svg viewer) that can.
Another choice is Reports - Graphs - Hourglass Graph. It allows for both ancestors and descendants - since both are configurable, you can set descendants to zero and have just an ancestor chart. Graphs allow a graphviz output (in additions to jpeg,png,pdf,...) which is the underlying graphical engine (see graphviz.org). I like using that so I can tune the output the way I want. For example - prune off a branch you don't want to see is easier in the graphviz file than it is by changing my gedcom. Another example is to combine two graphs. I used this when making a tree of how I was descended from the founders of Scituate, MA. They aren't related and it was easier to combine 5 realtionship graphs than to prune most of my ancestors out of my ancestor graph. This is easier to do visually with graphviz than by changing the gedcom - especially when there are overlaps (eg 3rd cousins marry).
Comment: Thanks. I hadn't yet tried the reports, but they were quite useful. What I was referring to in the question was the "ancestry" tab. When I click it, it shows five generations of the graph. If I click the right arrow, it shows another generation on the right, but removes one on the left. I was wondering how to change that in the "ancestry" tab.
Comment: I didn't know how to do it myself and did it the way above but @Fortiter just provided something closer to what you want. Good question. I'm glad you asked since now I know how to do it also.
Answer: A lot of software will display only four or five generations in its pedigree view, and for good reason; there simply isn't much space to display more.
RootsMagic will display six generations, but don't get too excited about that; the boxes that display the sixth generation are rather small.
Gramps' "Configure View..." button brings up a dialog box that lets you increase the number of generation displayed to 9, but there is a trade-off; even on a large screen, a pedigree that large does not fit within the application window, so you have to scroll around.
To view more generations at once, create a chart.
Most charting software can handle up to 10 or 12 generations or so,
and the on-screen preview mode may allow for interactive exploration of your database.
Comment: "there isn't much space" is display dependent. With today's high density, high area displays you can fit more on the screen visibly - and slider bars then make the virtual screen even bigger and easier to navigate than via add/delete generations. So software in general should make this configurable. Fortunately (as @Fortiter's answer shows), gramps did make it configurable.
Comment: Whether a user scrolls around a large canvas or needs to step through multiple interlinked small ones (with redraws) is often a matter of personal preference. I can imagine use cases in which I will select one setup then the other. On the other hand, I always find using a picture in a second window as a form of index to my working file very annoying. But others will certainly differ. The only response which is always incorrect is unbending dogmatism. (Irony intended.)
Answer: Download and use the H-tree view addon for Gramps. Follow the instructions from this link 6389

H-tree pedigree displays 5 generations (31 people) by default, and select the configuration icon in Ancestry mode and move the slider for "Tree Size" to "6" so that it displays 6 generations (64 people) of ancestors on screen at the same time!