Search Results

Search found 191 results on 8 pages for 'tomaš kafka'.

Page 5/8 | < Previous Page | 1 2 3 4 5 6 7 8  | Next Page >

  • How do I test ActionFilterAttributes that work with ModelState?

    - by Tomas Lycken
    As suggested by (among others) Kazi Manzur Rashid in this blog post, I am using ActionFilterAttributes to transfer model state from one request to another when redirecting. However, I find myself unable to write a unit test that test the behavior of these attributes. As an example, this what I want the test for the ImportModelStateAttribute to do: Setup the filterContext so that TempData[myKey] contains some fake "exported" ModelState (that is, a ModelStateDictionary I create myself, and add one error to) Make ModelState contain one model error. Call OnActionExecuting. Verify the two dictionaries are merged, and ModelState now contains both errors. I'm at a loss already on the second step.

    Read the article

  • Cross Domain Post - Losing POST Data

    - by Tomas Beblar
    I have 2 servers, both running R2 / IIS7 / ASP Classic sites (can't get around any of that) Server A is making the follow calls: Dim objXMLHTTP, xml Set xml = Server.CreateObject("Msxml2.ServerXmlHTTP.6.0") xml.Open "POST", templateName, false xml.setRequestHeader "Content-Type", "application/xml" xml.Send variables Where the templateName is the URL of Server B (It's an email template) ... and variables are a name value pair string like a query string password=myPassword&customerEmail=Dear+Bob,.... Server B receives the POST but all the POST data (password=myPassword&customerEmail=Dear+Bob,....) is missing from the POST password = Request.Form("templatePassword") customerEmail = Request.Form("RackAttackCustomerEmail") The above values are all empty. Here's the kicker. This all worked on our old servers (Windows Server 2003, IIS 6) But when we migrated over, this stopped working correctly. My question is: What would cause the POST data to be dropped in IIS 7 when it all worked in IIS 6? I've done about 3 days of research into this trying many different things and nothing has worked. The POST data is just gone.

    Read the article

  • Software to find dependencys in a database that not have them as restrictions

    - by Tomas Friden
    I have a database in SQL server 2005 that originaly comes fom an old mainframe. All relations was set in the surrounding software and there are non i the database. I need to find the relations, not by field name but by actual contence in the registers. (as suggestions, I realize I'l have to check them up) It would be nice with some extras, like finding motherless posts etc. but not a primary demand. There are some 200 registers with max 2 000 000 posts in any register. Does any one know of a software that can help me with this? The software I can find presuposes that relations are set in the database :(

    Read the article

  • Is there Java counterpart for Aspnet 4's <%: %> XSS prevention?

    - by Tomas Tintera
    I'm developer moving from C# to Java. Heard about new ASP net feature. <%: %. It renders object with html encoding. Only these impolementing IHtmlString interface are not encoded (to prevent double encoding). See more in http://weblogs.asp.net/scottgu/archive/2010/04/06/new-lt-gt-syntax-for-html-encoding-output-in-asp-net-4-and-asp-net-mvc-2.aspx Is such cute tool in Java side? I mean a way to output a string to webpage and (not)encode it based on it's type.

    Read the article

  • How to update multiple rows with one single query

    - by xRobot
    I use Postgresql + PHP. Say I have this table: Books ( id, title, year ) and this array of titles in PHP: $titles = array ("bible","kafka","Book of Eli"); now I want update all rows where the title is in the $titles array above. So I need a query like this: UPDATE books SET year = '2001-11-11' WHERE title is in $titles; Is is possible with one single query ? Or do I need to use FOR loop ?

    Read the article

  • Access to module denied from within GAE dev server

    - by Tomas Kohl
    I am developing an app for GAE. Having installed the "feedparser" module with setuptools, I tried importing it (with "import feedparser") statement. However, the module does not load and when I look at the dev_appserver.py debug log on screen, I see the following: Access to module file denied: /usr/local/lib/python2.6/dist-packages/feedparser-4.1-py2.6.egg/feedparser.py So GAE dev server cannot access the module but I can't figure out why. The path is correct and the file is accessible. I am fairly new to Python/Django/GAE - what am I missing?

    Read the article

  • Is it really wrong to version documents using CouchDB's default behaviour?

    - by Tomas Sedovic
    This is one of those "I know I shouldn't do this but it's oh so convenient." questions. Sorry about that. I plan to use CouchDB for storing a bunch of documents and keeping their entire revision history. CouchDB does the versioning automatically, but it is strongly discouraged for programmer's use: "You cannot rely on document revisions for any other purpose than concurrency control." From what I've found on the CouchDB wiki, the versions can get deleted either during compaction or during replication. As far as I can tell, Compaction must always be triggered manually and Replication occurs only when there's more than one database server. The question is: if I won't run compaction and will use only single database instance for my documents, can I just use CouchDB's document versioning and expect it to work? What other problems I might run into? E.g. does not running compaction hurt the performance or consume significantly more disk space (than if I did handle the versioning manually)?

    Read the article

  • Can I use CodeRush Xpress in Visual Studio 2010?

    - by Tomas Lycken
    I've installed the Beta 1 of Visual Studio 2010, and started working a little. Even though I haven't been using CodeRush Xpress for long in Visual Studio 2008, I immediately started missing some of the neat functionality. Is there any way to install CodeRush Xpress on Visual Studio 2010, even though it's only the Beta yet?

    Read the article

  • How to get Class type

    - by Tomáš
    Hi gurus How to determine Class type of Object in collection? class Human{...} class Man extends Human{...} class Women extends Human{...} def humans = Human.findAll() humans.each(){ human -> // ??? , it is not work if ( human instanceof Man ) { println "Man" } if ( human instanceof Woman ) { println "Woman" } } Thanks a lot, Tom

    Read the article

  • How do I assert that two arbitrary type objects are equivalent, without requiring them to be equal?

    - by Tomas Lycken
    To accomplish this (but failing to do so) I'm reflecting over properties of an expected and actual object and making sure their values are equal. This works as expected as long as their properties are single objects, i.e. not lists, arrays, IEnumerable... If the property is a list of some sort, the test fails (on the Assert.AreEqual(...) inside the for loop). public void WithCorrectModel<TModelType>(TModelType expected, string error = "") where TModelType : class { var actual = _result.ViewData.Model as TModelType; Assert.IsNotNull(actual, error); Assert.IsInstanceOfType(actual, typeof(TModelType), error); foreach (var prop in typeof(TModelType).GetProperties()) { Assert.AreEqual(prop.GetValue(expected, null), prop.GetValue(actual, null), error); } } If dealing with a list property, I would get the expected results if I instead used CollectionAssert.AreEquivalent(...) but that requires me to cast to ICollection, which in turn requries me to know the type listed, which I don't (want to). It also requires me to know which properties are list types, which I don't know how to. So, how should I assert that two objects of an arbitrary type are equivalent? Note: I specifically don't want to require them to be equal, since one comes from my tested object and one is built in my test class to have something to compare with.

    Read the article

  • ASP.NET MVC does not add ModelError when invoking from unit test

    - by Tomas Lycken
    I have a model item public class EntryInputModel { ... [Required(ErrorMessage = "Description is required.", AllowEmptyStrings = false)] public virtual string Description { get; set; } } and a controller action public ActionResult Add([Bind(Exclude = "Id")] EntryInputModel newEntry) { if (ModelState.IsValid) { var entry = Mapper.Map<EntryInputModel, Entry>(newEntry); repository.Add(entry); unitOfWork.SaveChanges(); return RedirectToAction("Details", new { id = entry.Id }); } return RedirectToAction("Create"); } When I create an EntryInputModel in a unit test, set the Description property to null and pass it to the action method, I still get ModelState.IsValid == true, even though I have debugged and verified that newEntry.Description == null. Why doesn't this work?

    Read the article

  • What should I name my files with generic class definitions?

    - by Tomas Lycken
    I'm writing a couple of classes that all have generic type arguments, but I need to overload the classes because I need a different number of arguments in different scenarios. Basically, I have public class MyGenericClass<T> { ... } public class MyGenericClass<T, K> { ... } public class MyGenericClass<T, K, L> { ... } // it could go on forever, but it won't... I want them all in the same namespace, but in one source file per class. What should I name the files? Is there a best practice?

    Read the article

  • Testing ActionFilterAttributes with MSpec

    - by Tomas Lycken
    I'm currently trying to grasp MSpec, mainly to learn new ways of (T/B)DD to be able to make an educated decision on which technology to use. Previously, I've mostly (read: only) used the built-in MSTest framework with Moq, so BDD is quite new for me. I'm writing an ASP.NET MVC app, and I want to implement PRG. Last time I did this, I used action filters to export and import ModelState via TempData, so that I could return a RedirectResult and the validation errors would still be there when the user got the view. I tested that scenario by verifying two things: a) That the ExportModelStateAttribute I had written was applied (among tests for my controller) b) That the attribute worked (among tests for action filter attributes) However, in BDD I've understood I should be even more concerned with behavior, and even less with implementation. This means I should probably just verify that the model state is in tempdata when the action has finished executing - not necessarily that it's done via an attribute. To further complicate things, attributes are not run when calling the action directly in the test, so I can't just call the action and see if the job's been done. How should I spec/test this in MSpec?

    Read the article

  • Why does this test fail?

    - by Tomas Lycken
    I'm trying to test/spec the following action method public virtual ActionResult ChangePassword(ChangePasswordModel model) { if (ModelState.IsValid) { if (MembershipService.ChangePassword(User.Identity.Name, model.OldPassword, model.NewPassword)) { return RedirectToAction(MVC.Account.Actions.ChangePasswordSuccess); } else { ModelState.AddModelError("", "The current password is incorrect or the new password is invalid."); } } // If we got this far, something failed, redisplay form return RedirectToAction(MVC.Account.Actions.ChangePassword); } with the following MSpec specification: public class When_a_change_password_request_is_successful : with_a_change_password_input_model { Establish context = () => { membershipService.Setup(s => s.ChangePassword(Param.IsAny<string>(), Param.IsAny<string>(), Param.IsAny<string>())).Returns(true); controller.SetFakeControllerContext("POST"); }; Because of = () => controller.ChangePassword(inputModel); ThenIt should_be_a_redirect_result = () => result.ShouldBeARedirectToRoute(); ThenIt should_redirect_to_success_page = () => result.ShouldBeARedirectToRoute().And().ShouldRedirectToAction<AccountController>(c => c.ChangePasswordSuccess()); } where with_a_change_password_input_model is a base class that instantiates the input model, sets up a mock for the IMembershipService etc. The test fails on the first ThenIt (which is just an alias I'm using to avoid conflict with Moq...) with the following error description: Machine.Specifications.SpecificationException: Should be of type System.RuntimeType but is [null] But I am returning something - in fact, a RedirectToRouteResult - in each way the method can terminate! Why does MSpec believe the result to be null?

    Read the article

  • Inheritance domain classes in Grails

    - by Tomáš
    Hi gurus how can I get Collection of specific Class? I use inheriance: On Planet live Human. Humans are dividing to Men and Women. class Planet{ String name static hasMany = [ humans : Human ] } class Human{ String name static belongsTo = [Planet] } class Man extends Human{ int countOfCar } class Woman extends Human{ int coutOfChildren } now a neet to get only Collection of Man or Collection of Woman: get all humans on planet is simple all = Planet.get(1).humans but what can I get only woman or men? womenLivedOnMars = Planet.get(1).getOnlyWoman menLivedOnJupiter = Planet.get(2).getOnlyMan Thanks for your help Tom

    Read the article

  • How to find out whether SqlCe query Has rows?

    - by Tomas
    Hi, In my simple db I use SqlCe and I cannot figure out how to correctly find out whether the query has rows or not. HasRows does not work. So far I have this: _DbCommand.CommandText="SELECT * FROM X" SqlCeDataReader reader=_DbCommand.ExecuteQuery(); if (reader.FieldCount!=0) //I thought it could work (O rows - 0 fields?), but its true even with 0 rows { while (reader.Read()) { // } } Thanks

    Read the article

  • XSL transformation and special XML entities escaping

    - by Tomas R
    I have an XML file which is transformed with XSL. Some elements have to be changed, some have to be left as is - specifically, text with entities &quot;, &amp;, &apos;, &lt;, &gt; should be left as is, and in my case &quot; and &apos; are changed to " and ' accordingly. Test XML: <?xml version="1.0" encoding="UTF-8" ?> <root> <element> &quot; &amp; &apos; &lt; &gt; </element> </root> transformation file: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="no" indent="no" /> <xsl:template match="element"> <xsl:copy> <xsl:value-of disable-output-escaping="no" select="." /> </xsl:copy> </xsl:template> </xsl:stylesheet> result: <?xml version="1.0" encoding="UTF-8"?> <element> " &amp; ' &lt; &gt; </element> desired result: <?xml version="1.0" encoding="UTF-8"?> <element> &quot; &amp; &apos; &lt; &gt; </element> I have 2 questions: why does some of those entities are transformed and other not? how can I get a desired result?

    Read the article

  • Can I "inherit" a delegate? Looking for ways to combine Moq and MSpec without conflicts around It...

    - by Tomas Lycken
    I have started to use MSpec for BDD, and since long ago I use Moq as my mocking framework. However, they both define It, which means I can't have using Moq and using Machine.Specifications in the same code file without having to specify the namespace explicitly each time I use It. Anyone who's used MSpec knows this isn't really an option. I googled for solutions to this problem, and this blogger mentions having forked MSpec for himself, and implemented paralell support for Given, When, Then. I'd like to do this, but I can't figure out how to declare for example Given without having to go through the entire framework looking for references to Establish, and changing code there to match that I want either to be OK. For reference, the Establish, Because and It are declared in the following way: public delegate void Establish(); public delegate void Because(); public delegate void It(); What I need is to somehow declare Given, so that everywhere the code looks for an Establish, Given is also OK.

    Read the article

  • Domain without hosting - possible to redirect with DNS?

    - by Tomas
    Hi, I have a domain (A) without webhosting and I have different domain with hosting (B). I have no experience with that but I guess it should be possible to redirect DNS with A directly to B. In domain administration there is a possibility to change AAAA DNS or ctname and some other settings. Thank you for your help

    Read the article

  • Fade animation UITableViewCell

    - by Tomas
    Hi everyone, I have a UITableViewController that populates a UITableView with some data that I pull off the net. The data for each cell consists also of an image used as background, which I'm downloading in a separated NSOperation added to a NSOperationQueue with a MaxConcurrentOperationCount set to 4. As long as the image is not downloaded I'm showing a generic placeholder which I would like to replace (fading out/fading in) with the downloaded image once it's being successfully downloaded. I'm using the following code placed inside the cellForRowAtIndexPath of the UITableViewController. [UIView beginAnimations:@"fade" context:nil]; [UIView setAnimationBeginsFromCurrentState:YES]; [UIView setAnimationDuration:3.0]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; cell.placeholderUIImage.alpha = 0.0; cell.backgroundUIImage.alpha = 1.0; [UIView commitAnimations]; This is unfortunately just working randomly for a couple of rows, since for the most the background image is set instantly, as if the animation started on one cell would have been "overwritten" by the next call of beginAnimations.

    Read the article

  • Color scaling function

    - by Tomas Pajonk
    I am trying to visualize some values on a form. They range from 0 to 200 and I would like the ones around 0 be green and turn bright red as they go to 200. Basically the function should return color based on the value inputted. Any ideas ?

    Read the article

  • How to "check for overwide node(s)." in graphviz dot file

    - by Tomas Forsman
    I'm trying to generate a large graph using graphviz. I have a generated text file with nodes defined in the dot format. When I try to generate a PNG file from the file using dot -Tpng:cairo graph.txt graph.png I get the error message: Error: Edge length 136228 larger than maximum 65535 allowed. Check for overwide node(s). How do I actually "check for overwide node(s)" ?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8  | Next Page >