using

How can I login into my asp.net website using gmail account?

荒凉一梦 提交于 2020-01-06 04:33:09
问题 I have an asp.net website with login form and I want every visitors can able to login into my website using their gmail account.... Is there any one who can assist me on this or send some examples for the same? Thanks Hitesh 回答1: You are looking for OpenID. See http://www.fryan0911.com/2010/09/use-google-openid-authentication-in.html. 回答2: Gmail uses a technology called 'open ID'. I suggest you use a service like Janrain and they will take care of the open ID implementation for you. 来源: https

Is “Using{}” good practice to dispose object even if there is no variable referring to it

馋奶兔 提交于 2020-01-04 14:38:09
问题 In my company, I am seeing code like this using (LoggerFactory.GetTracer(_log.ModuleName + "._GetAccessTokenFromWns")) {...} When I looked up, I learned it disposes the objects referred by variables declared inside "Using" parenthesis. Does it also help for code like above, where there is no variable referring to the object returned by the factory? Thanks, 回答1: After I see your question I write a simple code like this: using (new FileStream("sample.txt",FileMode.CreateNew)) { } And then I

C++: Correct syntax for friending a template type member of template parameter?

被刻印的时光 ゝ 提交于 2020-01-03 08:27:10
问题 I have a class that takes a template type parameter (tTRAIT). I want to friend a template type member alias of tTRAIT, but I can't figure out the syntax. (Is this even possible?). template <bool bBOOL> struct SFoo {}; struct STrait { template <bool bBOOL> using TFoo = SFoo<bBOOL>; }; template <typename tTRAIT> struct SBar { template <bool bBOOL> friend typename tTRAIT::template TFoo<bBOOL>; }; SBar<STrait> bar; Clang's error (on the friend line) is: error: friend type templates must use an

How to use Moq to return a List of data or values?

荒凉一梦 提交于 2020-01-02 02:59:07
问题 Can anyone tell me how to return List of data using mock object using Moq framework and assigning the so returned list of data to another List<> variable.?? 回答1: public class SomeClass { public virtual List<int> GimmeSomeData() { throw new NotImplementedException(); } } [TestClass] public class TestSomeClass { [TestMethod] public void HowToMockAList() { var mock = new Mock<SomeClass>(); mock.Setup(m => m.GimmeSomeData()).Returns(() => new List<int> {1, 2, 3}); var resultList = mock.Object

Python equivalent to C#'s using statement [duplicate]

北慕城南 提交于 2020-01-01 10:03:24
问题 This question already has answers here : Closed 9 years ago . Possible Duplicate: What is the equivalent of the C# “using” block in IronPython? I'm writing some IronPython using some disposable .NET objects, and wondering whether there is a nice "pythonic" way of doing this. Currently I have a bunch of finally statements (and I suppose there should be checks for None in each of them too - or will the variable not even exist if the constructor fails?) def Save(self): filename = "record.txt"

using std::<type> v.s. using std namespace [duplicate]

前提是你 提交于 2020-01-01 06:55:25
问题 This question already has answers here : Why is “using namespace std;” considered bad practice? (36 answers) Closed 4 years ago . Two ways to use the using declaration are using std::string; using std::vector; or using namespace std; which way is better? =========Satisfactory Answer Below============= In short, using declarations within functions are harmless provided locally scoped care is given whereas global using declarations are dangerous as they could cause namespaces to intersect,

Detecting a Dispose() from an exception inside using block

我只是一个虾纸丫 提交于 2019-12-31 09:21:08
问题 I have the following code in my application: using (var database = new Database()) { var poll = // Some database query code. foreach (Question question in poll.Questions) { foreach (Answer answer in question.Answers) { database.Remove(answer); } // This is a sample line that simulate an error. throw new Exception("deu pau"); database.Remove(question); } database.Remove(poll); } This code triggers the Database class Dispose() method as usual, and this method automatically commits the

C# using statement catch error

天大地大妈咪最大 提交于 2019-12-31 08:13:08
问题 I am just looking at the using statement, I have always known what it does but until now not tried using it, I have come up with the below code: using (SqlCommand cmd = new SqlCommand(reportDataSource, new SqlConnection(Settings.Default.qlsdat_extensionsConnectionString))) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@Year", SqlDbType.Char, 4).Value = year; cmd.Parameters.Add("@startDate", SqlDbType.DateTime).Value = start; cmd.Parameters.Add("@endDate", SqlDbType

C# using statement catch error

不羁的心 提交于 2019-12-31 08:12:08
问题 I am just looking at the using statement, I have always known what it does but until now not tried using it, I have come up with the below code: using (SqlCommand cmd = new SqlCommand(reportDataSource, new SqlConnection(Settings.Default.qlsdat_extensionsConnectionString))) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@Year", SqlDbType.Char, 4).Value = year; cmd.Parameters.Add("@startDate", SqlDbType.DateTime).Value = start; cmd.Parameters.Add("@endDate", SqlDbType

video generation using ffmpeg

梦想与她 提交于 2019-12-30 07:44:07
问题 I am trying to generate video from set of image using ffmpeg library. Using following code, I am able to generate the video on simulator but when I run it on device, it produces strange green effect in video. I followed Encoding images to video with ffmpeg url. Can anybody help me out or if can provide code snippet, will be really appreciated. //here is the code.. (void)createVideoFromImages { NSString *fileName2 = [Utilities documentsPath:[NSString stringWithFormat:@"test.mov"]]; NSLog(@