Search Results

Search found 17 results on 1 pages for 'matthewmartin'.

Page 1/1 | 1 

  • How to force logout of all users on VSS?

    - by MatthewMartin
    VSS is resuming it's sabotage of my repository again. The repair command won't let me repair, the lock VSS doesn't seem to affect currently logged in users-- and it isn't a user, its claiming the only person logged in is admin (via the VSS admin tool!) and I have already closed all instances of the VSS admin tool and client.

    Read the article

  • Is System.AddIn mostly about making it easier to use Remoting or does it make it harder to do so?

    - by MatthewMartin
    It takes at least 7 assemblies and restricting my AddIn's data model to data types that remoting can deal with before the appdomain isolation features begin to work. It is so complex! The System.AddIn teams blog implies to me they were trying to re-create a mental model of COM, a model I never understood very well in the first place and am not sold on the benefits. (If COM is so good why's it dead?-rhetorical question.) If I don't need to mirror or interop with legacy COM (like VSTO does using System.AddIn), is it possible to just create some classes that load load in a new AppDomain? I can write the discovery code my self, I've done it before and a naive implementation is pretty fast because I'm not like iterating over the assemblies in the GAC! So my specific question is, can I get the AppDomain isolation that AddIns provide with a few code Remoting snippets, and what would those be?

    Read the article

  • Replay attacks for HTTPS requests

    - by MatthewMartin
    Let's say a security tester uses a proxy, say Fiddler, and records an HTTPS request using the administrator's credentials-- on replay of the entire request (including session and auth cookies) the security tester is able to succesfully (re)record transactions. The claim is that this is a sign of a CSRF vulnerability. What would a malicious user have to do to intercept the HTTPS request and replay it? It this a task for script kiddies, well funded military hacking teams or time-traveling-alien technology? Is it really so easy to record the SSL sessions of users and replay them before the tickets expire? No code in the application currently does anything interesting on HTTP GET, so AFAIK, tricking the admin into clicking a link or loading a image with a malicious URL isn't an issue.

    Read the article

  • How to safely use VSS when using a working directory on a thumb drive?

    - by MatthewMartin
    I know putting code into VSS in general is as safe as putting money into a mutual fund run by Bernard Madoff, but I don't have the luxury of ditching it for subversion. That said, I need to be able to write code on two machines, I'm considering checking out code to a flash thumb drive. Anyone know in advance what I should/shouldn't do to avoid loss of work? Do I need to ensure the drive letter stays the same?

    Read the article

  • What is wrong with Stubs for unit testing?

    - by MatthewMartin
    I just watched this funny YouTube Video about unit testing (it's Hitler with fake subtitles chewing out his team for not doing good unit tests--skip it if you're humor impaired) where stubs get roundly criticized. But I don't understand what wrong with stubs. I haven't started using a mocking framework and I haven't started feeling the pain from not using one. Am I in for a world a hurt sometime down the line, having chosen handwritten stubs and fakes instead of mocks (like Rhinomock etc)? (using Fowler's taxonomy) What are the considerations for picking between a mock and handwritten stub?

    Read the article

  • How do I change the base class at runtime in C#?

    - by MatthewMartin
    I may be working on mission impossible here, but I seem to be getting close. I want to extend a ASP.NET control, and I want my code to be unit testable. Also, I'd like to be able to fake behaviors of a real Label (namely things like ID generation, etc), which a real Label can't do in an nUnit host. Here a working example that makes assertions on something that depends on a real base class and something that doesn't-- in a more realistic unit test, the test would depend on both --i.e. an ID existing and some custom behavior. Anyhow the code says it better than I can: public class LabelWrapper : Label //Runtime //public class LabelWrapper : FakeLabel //Unit Test time { private readonly LabelLogic logic= new LabelLogic(); public override string Text { get { return logic.ProcessGetText(base.Text); } set { base.Text=logic.ProcessSetText(value); } } } //Ugh, now I have to test FakeLabelWrapper public class FakeLabelWrapper : FakeLabel //Unit Test time { private readonly LabelLogic logic= new LabelLogic(); public override string Text { get { return logic.ProcessGetText(base.Text); } set { base.Text=logic.ProcessSetText(value); } } } [TestFixture] public class UnitTest { [Test] public void Test() { //Wish this was LabelWrapper label = new LabelWrapper(new FakeBase()) LabelWrapper label = new LabelWrapper(); //FakeLabelWrapper label = new FakeLabelWrapper(); label.Text = "ToUpper"; Assert.AreEqual("TOUPPER",label.Text); StringWriter stringWriter = new StringWriter(); HtmlTextWriter writer = new HtmlTextWriter(stringWriter); label.RenderControl(writer); Assert.AreEqual(1,label.ID); Assert.AreEqual("<span>TOUPPER</span>", stringWriter.ToString()); } } public class FakeLabel { virtual public string Text { get; set; } public void RenderControl(TextWriter writer) { writer.Write("<span>" + Text + "</span>"); } } //System Under Test internal class LabelLogic { internal string ProcessGetText(string value) { return value.ToUpper(); } internal string ProcessSetText(string value) { return value.ToUpper(); } }

    Read the article

  • How do I use Eval() to reference values in a SortedDictionary in an asp Repeater?

    - by MatthewMartin
    I thought I was clever to switch from the memory intensive DataView to SortedDictionary as a memory efficient sortable data structure. Now I have no idea how get the key and value out of the datasource in the <%# or Eval() expressions. SortedDictionary<int, string> data = RetrieveNames(); rCurrentTeam.DataSource = data; rCurrentTeam.DataBind(); <asp:Repeater ID="rNames" runat="server"> <ItemTemplate> <asp:Label ID="lblName" runat="server" Text='<%# Eval("what?") %>' /> </ItemTemplate> </asp:Repeater> Any suggestions?

    Read the article

  • How do I safely Debug.Assert in ASP.NET?

    - by MatthewMartin
    Asserts can't be caught. This is good because some errors I don't want to be wrapped in try/catch, at least not on the development server. But Asserts seem awefully dangerous. If they get onto production, it can hang the ASP.NET server with a msgbox. //Don't want this on prod even if debug=true is in the web.config #if DEBUG //A future client programmer can wrap this in a try{}catch{} if (!EverythingIsOkay) throw new InvalidOperationException("Dagnabbit, programming error"); //This stops the but has less information that an // Exception and hangs the server if this accidentally // runs on production System.Diagnostics.Debug.Assert(!EverythingIsOkay); #endif Is there better way to communicate an violation of a inviolable condition to a developer without risking hanging IIS? UPDATE: After reading the first replies, I guess the answer hinges on a foolproof way to detect when code is running in a development environment and when it is on a production server, or figuring out how to throw an exception that can't be caught and ignored.

    Read the article

  • Using switch and enumerations as substitute for named methods

    - by MatthewMartin
    This pattern pops up a lot. It looks like a very verbose way to move what would otherwise be separate named methods into a single method and then distinguished by a parameter. Is there any good reason to have this pattern over just having two methods Method1() and Method2() ? The real kicker is that this pattern tends to be invoked only with constants at runtime-- i.e. the arguments are all known before compiling is done. public enum Commands { Method1, Method2 } public void ClientCode() { //Always invoked with constants! Never user input. RunCommands(Commands.Method1); RunCommands(Commands.Method2); } public void RunCommands(Commands currentCommand) { switch (currentCommand) { case Commands.Method1: // Stuff happens break; case Commands.Method2: // Other stuff happens break; default: throw new ArgumentOutOfRangeException("currentCommand"); } }

    Read the article

  • What is the difference between deploying to com+/MTS using regsvr32?

    - by MatthewMartin
    We have a legacy VB6 component that was com+/MTS and is used by asp classic. Staff is having trouble with deployment. Would there be any harm in just using regsvr32 to register the DLL, which will be used by IIS? Alternatively---I won't touch COM+ with a 10 foot pole--so is there a suitable one line command to register a VB6 component with COM+/MTS using a 11 foot pole? My google fu is failing me.

    Read the article

  • What data structure would be the least painful DataTable replacement?

    - by MatthewMartin
    I'm storing a lot of sorted ~10 row 2 column/key value pairs in ASP.NET cache-- they're the data for dropdownlists. Right now they are all DataTables, which isn't very space efficient (the rule of thumb is 10x increase in size when data is strored in a dataset). Old Code DataTable table = dataAccess.GetDataTable(); dropDownList.DataSource = table; Hoped for new Code Unknown data = dataAccess.GetSomethingMoreSpaceEfficient(); dropDownList.DataSource = data; What pre-existing datastructures are similar enough to DataTable that would minimize code breakage and reduce the serialized size when stored in ASP.NET cache?

    Read the article

  • How to switch from VARCHAR to TEXT in SQL 2000?

    - by MatthewMartin
    What do I need to consider before I switch a bunch of fields from VARCHAR(bignumber) to TEXT? Aside from performance, and sometime in the far future TEXT will be deprecated, and aside from the fact that it looks like I need to drop and recreate the table to alter the column's data type? This is for SQL 2000-- I can't do VARCHAR(max) and VARCHAR(8000) isn't large enough.

    Read the article

  • What is the benefit to wrapping every sql/stored proc invocation in a transaction?

    - by MatthewMartin
    The following code executes one stored procedure. The stored procedure has only one command in it. Is there any benefit to wrapping everything in a transaction, even it only has one SQL statement in it (or one stored proc that has only one sql statement)? In the sample code below, if the delete fails, it fails. There is nothing else to be rolled back (it seems). So why is everything wrapped in a transaction anyhow? using (ITransactionManager transMan = repository.TransactionManager()) using (IController controller = repository.Controller()) { transMan.BeginTransaction(); try { //DELETE FROM myTable where Id=@id controller.Delete(id); transMan.CommitTransaction(); } catch { transMan.RollbackTransaction(); throw; } }

    Read the article

  • What does "Contract can't be in try block" mean?

    - by MatthewMartin
    I'm using the 3.5 library for microsoft code contracts public object RetrieveById(int Id) { Contract.Ensures(newObject != null, "object must not be null"); return newProject; //No error message if I move the Contract.Ensures to here //But it isn't asserting/throwing a contract exception here either } I get the compiler message: "Error 18 Contract section within try block in method 'Controller.RetrieveById(System.Int32)'

    Read the article

  • Is there anything wrong with a class with all static methods?

    - by MatthewMartin
    I'm doing code review and came across a class that uses all static methods. The entrance method takes several arguments and then starts calling the other static methods passing along all or some of the arguments the entrance method received. It isn't like a Math class with largely unrelated utility functions. In my own normal programming, I rarely write methods where Resharper pops and says "this could be a static method", when I do, they tend to be mindless utility methods. Is there anything wrong with this pattern? Is this just a matter of personal choice if the state of a class is held in fields and properties or passed around amongst static methods using arguments?

    Read the article

  • How to create a non-persistent (in memory) http cookie in C#?

    - by MatthewMartin
    I want my cookie to disappear when the user closes their brower-- I've already set some promising looking properties, but my cookies pop back to live even after closing the entire browser. HttpCookie cookie = new HttpCookie("mycookie", "abc"); cookie.HttpOnly = true; //Seems to only affect script access cookie.Secure = true; //Seems to affect only https transport What property or method call am I missing to achieve an in memory cookie?

    Read the article

  • How do I mock/fake/replace/stub a base class at unit-test time in C#?

    - by MatthewMartin
    UPDATE: I've changed the wording of the question. Previously it was a yes/no question about if a base class could be changed at runtime. I may be working on mission impossible here, but I seem to be getting close. I want to extend a ASP.NET control, and I want my code to be unit testable. Also, I'd like to be able to fake behaviors of a real Label (namely things like ID generation, etc), which a real Label can't do in an nUnit host. Here a working example that makes assertions on something that depends on a real base class and something that doesn't-- in a more realistic unit test, the test would depend on both --i.e. an ID existing and some custom behavior. Anyhow the code says it better than I can: public class LabelWrapper : Label //Runtime //public class LabelWrapper : FakeLabel //Unit Test time { private readonly LabelLogic logic= new LabelLogic(); public override string Text { get { return logic.ProcessGetText(base.Text); } set { base.Text=logic.ProcessSetText(value); } } } //Ugh, now I have to test FakeLabelWrapper public class FakeLabelWrapper : FakeLabel //Unit Test time { private readonly LabelLogic logic= new LabelLogic(); public override string Text { get { return logic.ProcessGetText(base.Text); } set { base.Text=logic.ProcessSetText(value); } } } [TestFixture] public class UnitTest { [Test] public void Test() { //Wish this was LabelWrapper label = new LabelWrapper(new FakeBase()) LabelWrapper label = new LabelWrapper(); //FakeLabelWrapper label = new FakeLabelWrapper(); label.Text = "ToUpper"; Assert.AreEqual("TOUPPER",label.Text); StringWriter stringWriter = new StringWriter(); HtmlTextWriter writer = new HtmlTextWriter(stringWriter); label.RenderControl(writer); Assert.AreEqual(1,label.ID); Assert.AreEqual("<span>TOUPPER</span>", stringWriter.ToString()); } } public class FakeLabel { virtual public string Text { get; set; } public void RenderControl(TextWriter writer) { writer.Write("<span>" + Text + "</span>"); } } //System Under Test internal class LabelLogic { internal string ProcessGetText(string value) { return value.ToUpper(); } internal string ProcessSetText(string value) { return value.ToUpper(); } }

    Read the article

1