Search Results

Search found 6569 results on 263 pages for 'specification pattern'.

Page 94/263 | < Previous Page | 90 91 92 93 94 95 96 97 98 99 100 101  | Next Page >

  • Design of Business Layer

    - by Adil Mughal
    Hi, We are currently revamping our architecture and design of application. We have just completed design of Data Access Layer which is generic in the sense that it works using XML and reflection to persist data. Any ways now we are in the phase of designing business layer. We have read some books related to Enterprise Architecture and Design so we have found that there are few patterns that can be applied on business layer. Table Pattern and Domain Model are example of such patterns. Also we have found Domain Driven Design as well. Earlier we decided to build Entities against table objects. But we found that there is difference in Entities and Value Objects when it comes to DDD. For those of you who have gone through such design. Please guide me related to pattern, practice and sample. Thank you in advance! Also please feel free to discuss if you didn't get any point of mine.

    Read the article

  • NSPredicate error/behaving differently on 10.5 vs 10.6

    - by Tristan
    I am using a NSPredicate to determine if an entered email address is valid. On 10.6 it works perfectly as expected. I recently decided to get my app going on 10.5 and this is the only thing that doesn't work. The error i get is as follows: "Can't do regex matching, reason: Can't open pattern U_MALFORMED_SET (string [email protected], pattern ([\w-+]+(?:\.[\w-+]+)*@(?:[\w-]+\.)+[a-zA-Z]{2,7}), case 0, canon 0)" The code im using is as follows: NSString *regex = @"([\\w-+]+(?:\\.[\\w-+]+)*@(?:[\\w-]+\\.)+[a-zA-Z]{2,7})"; NSPredicate *regextest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex]; if ([regextest evaluateWithObject:[userEmail objectValue]] == YES) Does anyone know why this isn't working on 10.5? And how I might get it working or be able to do this test in a way compatible for both 10.5 and 10.6?

    Read the article

  • [C#, Regex] EOL Special Char not matching

    - by Aurélien Ribon
    Hello, I am trying to find every "a - b, c, d" pattern in an input string. The pattern I am using is the following : "^[ \t]*(\\w+)[ \t]*->[ \t]*(\\w+)(,[ \t]*\\w+)*$" The input is : a -> b b -> c c -> d The function is : private void ParseAndBuildGraph(String input) { MatchCollection mc = Regex.Matches(input, "^[ \t]*(\\w+)[ \t]*->[ \t]*(\\w+)(,[ \t]*\\w+)*$", RegexOptions.Multiline); foreach (Match m in mc) { Debug.WriteLine(m.Value); } } The output is : c -> d Actually, there is a problem with the line ending "$" special char. If I insert a "\r" before "$", it works, but I thought "$" would match any line termination (with the Multiline option), especially a \r\n in a Windows environment. Is it not the case ?

    Read the article

  • initial caps in actionScript using Regex

    - by Deyon
    I'm trying to do initial caps in actionScript with no loops but now i'm stuck. I wanted to select the first letter or every word then apply uppercase on that letter. Well I got the selection part right, but at a dead end right now, any ideas? I was trying to do this with out loops and cutting up strings. //replaces with x cant figure out how to replace with the found result as uppercase public function initialcaps():void { var pattern:RegExp=/\b[a-z]/g; var myString:String="yes that is my dog dancing on the stage"; var nuString:String=myString.replace(pattern,"x"); trace(nuString); }

    Read the article

  • Regular Expression Help in .NET

    - by Matt H.
    I have a simple pattern I am trying to match, any characters captured between parenthesis at the end of an HTML paragraph. I am running into trouble any time there is additional parentheticals in that paragraph: i.e. If the input string is "..... (321)</p" i want to get the value (321) However, if the paragraph has this text: "... (123) (321)</p" my regex is returning "(123) (321)" (everything between the opening "(" and closing ")" I am using the regex pattern "\s(.+)</p" How can I grab the correct value (using VB.NET) This is what I'm doing so far: Dim reg As New Regex("\s\(.+\)</P>", RegexOptions.IgnoreCase) Dim matchC As MatchCollection = reg.Matches(su.Question) If matchC.Count > 0 Then Dim lastMatch As Match = matchC(matchC.Count - 1) Dim DesiredValue As String = lastMatch.Value End If

    Read the article

  • Adding Listeners at runtime? - Java MVC

    - by Halo
    My model in my MVC pattern, generates components at runtime and gives them to the View to be displayed on the screen through update() method (you know, model is the observable and the view is the observer). But I also need to add listeners to these components, and the controller has the listener methods (because they say the MVC pattern is like this) and it's not involved in this update process. So I can't add the listeners at runtime, but only in the controller's constructor at startup. I've got an idea, that is making the controller the observer and then giving the data to the view, as well as adding the listeners. Do you think this would be OK?

    Read the article

  • Regex for extracting second level domain from FQDN?

    - by Bob
    I can't figure this out. I need to extract the second level domain from a FQDN. For example, all of these need to return "example.com": example.com foo.example.com bar.foo.example.com example.com:8080 foo.example.com:8080 bar.foo.example.com:8080 Here's what I have so far: Dim host = Request.Headers("Host") Dim pattern As String = "(?<hostname>(\w+)).(?<domainname>(\w+.\w+))" Dim theMatch = Regex.Match(host, pattern) ViewData("Message") = "Domain is: " + theMatch.Groups("domainname").ToString It fails for example.com:8080 and bar.foo.example.com:8080. Any ideas?

    Read the article

  • Regex - replace only last part of an expression

    I'm attempting to find the best methodology for finding a specific pattern and then replace the ending portion of the pattern. Here is a quick example (in C#): //Find any year value starting with a bracket or underscore string patternToFind = "[[_]2007"; Regex yearFind = new Regex(patternToFind); //I want to change any of these values to x2008 where x is the bracket or underscore originally in the text. I was trying to use Regex.Replace(), but cannot figure out if it can be applied. If all else fails, I can find Matches using the MatchCollection and then switch out the 2007 value with 2008; however, I'm hoping for something more elegant MatchCollections matches = yearFind.Matches(" 2007 [2007 _2007"); foreach (Match match in matches){ //use match to find and replace value }

    Read the article

  • StackOverflowError occured as using java.util.regex.Matcher

    - by Captain Kidd
    Hi guys I try to catch text by Regular Expression. I list codes as follows. Pattern p=Pattern.compile("<@a>(?:.|\\s)+?</@a>"); Matcher m = p.matcher(fileContents.toString()); while(m.find()) { //Error will be thrown at this point System.out.println(m.group()); } If the length of text I want to catch is too long, system will throw me a StackOverflowError. Otherwise, the codes work well. Please help me how to solve this problem.

    Read the article

  • .Net Regular expression - how to do an exact match exclusion on a full string?

    - by Nathan Ridley
    I need a .Net regular expression that matches anything OTHER than the exact full string match specified. So basically: ^Index$ ... is the only exclusion I care about. Strings can start with, finish with or contain "Index", but not match exactly. My brain doesn't seem to be working today and I'm failing to work this one out. EDIT The answer MUST be via the pattern itself, as I am passing an argument to a third party library and do not have control over the process other than via the Regex pattern.

    Read the article

  • str_replace match only first instance

    - by kylex
    A followup question to http://stackoverflow.com/questions/3063704/ Given the following POST data: 2010-June-3 <remove>2010-June-3</remove> 2010-June-15 2010-June-16 2010-June-17 2010-June-3 2010-June-1 I'm wanting to remove ONLY the first instance of 2010-June-3, but the following code removes all the data. $i = 1; $pattern = "/<remove>(.*?)<\/remove>/"; preg_match_all($pattern, $_POST['exclude'], $matches, PREG_SET_ORDER); if (!empty($matches)) { foreach ($matches as $match) { // replace first instance of excluded data $_POST['exclude'] = str_replace($match[1], "", $_POST['exclude'], $i); } } echo "<br /><br />".$_POST['exclude']; This echos: <remove></remove> 2010-June-15 2010-June-16 2010-June-17 2010-June-1 It should echo: <remove>2010-June-3</remove> 2010-June-15 2010-June-16 2010-June-17 2010-June-3 2010-June-1

    Read the article

  • Find ASCII "arrows" in text

    - by ulver
    I'm trying to find all the occurrences of "Arrows" in text, so in "<----=====><==->>" the arrows are: "<----", "=====>", "<==", "->", ">" This works: String[] patterns = {"<=*", "<-*", "=*>", "-*>"}; for (String p : patterns) { Matcher A = Pattern.compile(p).matcher(s); while (A.find()) { System.out.println(A.group()); } } but this doesn't: String p = "<=*|<-*|=*>|-*>"; Matcher A = Pattern.compile(p).matcher(s); while (A.find()) { System.out.println(A.group()); } No idea why. It often reports "<" instead of "<====" or similar. What is wrong?

    Read the article

  • Windows Phone 7, MVVM, Silverlight and navigation best practice / patterns and strategies

    - by Matt F
    Whilst building a Windows Phone 7 app. using the MVVM pattern we've struggled to get to grips with a pattern or technique to centralise navigation logic that will fit with MVVM. To give an example, everytime the app. calls our web service we check that the logon token we've assigned the app. earlier hasn't expired. We always return some status to the phone from the web service and one of those might be Enum.AuthenticationExpired. If we receive that I'd imagine we'd alert the user and navigate back to the login screen. (this is one of many examples of status we might receive) Now, wanting to keep things DRY, that sort of logic feels like it should be in one place. Therein lies my question. How should I go about modelling navigation that relies on (essentially) switch or if statements to tell us where to navigate to next without repeating that in every view. Are there recognised patterns or techniques that someone could recommend? Thanks

    Read the article

  • WCF client proxy initialization

    - by 123Developer
    I am consuming a WCF service and created its proxy using the VS 2008 service reference. I am looking for the best pattern to call WCF service method Should I create the client proxy instance every time I call the service method and close the client as soon as I am done with that? When I profiled my client application, I could see that it is taking lot of time to get the Channel while initializing the proxy client Should I use a Singleton pattern for the client proxy so that I can use the only once instance and get rid of the re-initializing overhead? Is there any hidden problem with this approach? I am using .Net framework 3.5 SP1, basicHttp binding with little customization.

    Read the article

  • Routing and URI parsing in Codeigniter

    - by bobo
    I have a route defined in CI, $route['user/activate-account/:any'] = "user/activate_account"; People access the route in this url pattern, http://mydomain.com/user/activate-account/user_id/12345/token/abcdefghijk Inside the activate_account function, I tried to use the following codes to retrieve the required data, $user_id=$this->input->get('user_id'); $token=$this->input->get('token'); But they return FALSE, does this mean that for this kind of url pattern, I am supposed to use the functions provided by the URI class (http://codeigniter.com/user_guide/libraries/uri.html) to retrieve the variables?

    Read the article

  • Static Access To Multiple Instance Variable

    - by Qua
    I have a singleton instance that is referenced throughout the project which works like a charm. It saves me the trouble from having to pass around an instance of the object to every little class in the project. However, now I need to manage multiple instances of the previous setup, which means that the singleton pattern breaks since each instance would need it's own singleton instance. What options are there to still maintain static access to the singleton? To be more specific, we have our game engine and several components and plugins reference the engine through a static property. Now our server needs to host multiple game instances each having their own engine, which means that on the server side the singleton pattern breaks. I'm trying to avoid all the classes having the engine in the constructor.

    Read the article

  • plist vs static array

    - by morticae
    Generally, I use static arrays and dictionaries for containing lookup tables in my classes. However, with the number of classes creeping quickly into the hundreds, I'm hesitant to continue using this pattern. Even if these static collections are initialized lazily, I've essentially got a bounded memory leak going on as someone uses my app. Most of these are arrays of strings so I can convert strings into NSInteger constants that can be used with switch statements, etc. I could just recreate the array/dictionary on every call, but many of these functions are used heavily and/or in tight loops. So I'm trying to come up with a pattern that is both performant and not persistent. If I store the information in a plist, does the iphoneOS do anything intelligent about caching those when loaded? Do you have another method that might be related?

    Read the article

  • spring 3 mvc requestmapping dynamic param problem

    - by Faisal khan
    I have the following code which works fine with http://localhost:8080/HelloWorldSpring3/forms/helloworld but i want to have url have some thing like this http://localhost:8080/HelloWorldSpring3/forms/helloworld/locname_here/locid_here I found that adding this @RequestMapping("/helloworld/**") will work but when i try to access http://localhost:8080/HelloWorldSpring3/forms/helloworld/locname_here/locid_here it is not found. Web.xml entry as follows <servlet-mapping> <servlet-name>dispatcher</servlet-name> <url-pattern>/forms/*</url-pattern> </servlet-mapping> Mapping bean entry @RequestMapping("/helloworld/**") public ModelAndView helloWord(){ String message = "Hello World, Spring 3.0!"; return new ModelAndView("helloworld", "message",message); }

    Read the article

  • handle when callback to a dealloced delegate?

    - by athanhcong
    Hi all, I implemented the delegate-callback pattern between two classes without retaining the delegate. But in some cases, the delegate is dealloced. (My case is that I have a ViewController is the delegate object, and when the user press back button to pop that ViewController out of the NavigationController stack) Then the callback method get BAD_EXE: if (self.delegate != nil && [self.delegate respondsToSelector:selector]) { [self.delegate performSelector:selector withObject:self withObject:returnObject]; } I know the delegate-callback pattern is implemented in a lot of application. What is your solution for this?

    Read the article

  • How to combine designable components with dependency injection

    - by Wim Coenen
    When creating a designable .NET component, you are required to provide a default constructor. From the IComponent documentation: To be a component, a class must implement the IComponent interface and provide a basic constructor that requires no parameters or a single parameter of type IContainer. This makes it impossible to do dependency injection via constructor arguments. (Extra constructors could be provided, but the designer would ignore them.) Some alternatives we're considering: Service Locator Don't use dependency injection, instead use the service locator pattern to acquire dependencies. This seems to be what IComponent.Site.GetService is for. I guess we could create a reusable ISite implementation (ConfigurableServiceLocator?) which can be configured with the necessary dependencies. But how does this work in a designer context? Dependency Injection via properties Inject dependencies via properties. Provide default instances if they are necessary to show the component in a designer. Document which properties need to be injected. Inject dependencies with an Initialize method This is much like injection via properties but it keeps the list of dependencies that need to be injected in one place. This way the list of required dependencies is documented implicitly, and the compiler will assists you with errors when the list changes. Any idea what the best practice is here? How do you do it? edit: I have removed "(e.g. a WinForms UserControl)" since I intended the question to be about components in general. Components are all about inversion of control (see section 8.3.1 of the UMLv2 specification) so I don't think that "you shouldn't inject any services" is a good answer. edit 2: It took some playing with WPF and the MVVM pattern to finally "get" Mark's answer. I see now that visual controls are indeed a special case. As for using non-visual components on designer surfaces, I think the .NET component model is fundamentally incompatible with dependency injection. It appears to be designed around the service locator pattern instead. Maybe this will start to change with the infrastructure that was added in .NET 4.0 in the System.ComponentModel.Composition namespace.

    Read the article

  • javascript string exec strange behavior

    - by Michael
    have funciton in my object which is called regularly. parse : function(html) { var regexp = /...some pattern.../ var match = regexp.exec(html); while (match != null) { ... match = regexp.exec(html); } ... var r = /...pattern.../g; var m = r.exec(html); } with unchanged html the m returns null each other call. let's say parse(html);// ok parse(html);// m is null!!! parse(html);// ok parse(html);// m is null!!! // ...and so on... is there any index or somrthing that has to be reset on html ... I'm really confused. Why match always returns proper result?

    Read the article

  • Sharing beans from contextListener -- dispatcher servlet

    - by Ernest
    Hello! ok, i have another question now. I have a bunch of beans loaded succesfully in applicationContext.xml, which loads from web.xml: contextConfigLocation applicationContext.xml org.springframework.web.context.ContextLoaderListener Here are is the bean defined in applicationContext.xml that i want to share: it loads other beans (DAOs) which are initialized with hibernet. I need to acces catalogFacadeTarget from the dispatcherServlet, declared in web.xml: dispatcher org.springframework.web.servlet.DispatcherServlet 1 <servlet-mapping> <servlet-name>dispatcher</servlet-name> <url-pattern>*.htm</url-pattern> </servlet-mapping> and configured dispatcher-servlet.xml like this: welcome There! in the property called catalogFacadeImpl. If you need the entire applicationCOntext.xml, web.xml, and dispatcher-servlet.xml please let me know. From what i read, i should be able to share beans if i declared them in the contextConfigLocation configuration file. Thank you very much in advance.

    Read the article

  • Unit Testing functions within repository interfaces - ASP.net MVC3 & Moq

    - by RawryLions
    I'm getting into writing unit testing and have implemented a nice repository pattern/moq to allow me to test my functions without using "real" data. So far so good.. However.. In my repository interface for "Posts" IPostRepository I have a function: Post getPostByID(int id); I want to be able to test this from my Test class but cannot work out how. So far I am using this pattern for my tests: [SetUp] public void Setup() { mock = new Mock<IPostRepository>(); } [Test] public void someTest() { populate(10); //This populates the mock with 10 fake entries //do test here } In my function "someTest" I want to be able to call/test the function GetPostById. I can find the function with mock.object.getpostbyid but the "object" is null. Any help would be appreciated :) iPostRepository: public interface IPostRepository { IQueryable<Post> Posts {get;} void SavePost(Post post); Post getPostByID(int id); }

    Read the article

  • Sorting based on existing elements in xslt

    - by Teelo
    Hi , I want to sort in xslt based on existing set of pattern . Let me explain with the code: <Types> <Type> <Names> <Name>Ryan</Name> </Names> <Address>2344</Address> </Type> <Type> <Names> </Name>Timber</Name> </Names> <Address>1234</Address> </Type> <Type> <Names> </Name>Bryan</Name> </Names> <Address>34</Address> </Type> </Types> Right now I m just calling it and getting it like (all hyperlinks) Ryan Timber Bryan Now I don't want sorting on name but I have existing pattern how I want it to get displayed.Like Timber Bryan Ryan (Also I don't want to lose the url attached to my names earlier while doing this) I was thinking of putting earlier value in some array and sort based on the other array where I will store my existing pattern. But I am not sure how to achieve that.. My xslt looks like this now(there can be duplicate names also) <xsl:for-each select="/Types/Type/Names/Name/text()[generate-id()=generate-id(key('Name',.)[1])]"> <xsl:call-template name="typename"> </xsl:call-template> </xsl:for-each> <xsl:template name="typename"> <li> <a href="somelogicforurl"> <xsl:value-of select="."/> </a> </li> </xsl:template> I am using xsl 1.0

    Read the article

  • PHP regex help -- reverse search?

    - by Ian Silber
    So, I have a regex that searches for HTML tags and modifies them slightly. It's working great, but I need to do something special with the last closing HTML tag I find. Not sure of the best way to do this. I'm thinking some sort of reverse reg ex, but haven't found a way to do that. Here's my code so far: $html = "<div id="test"><p style="hello_world">This is a test.</p></div>"; $pattern = array('/<([A-Z][A-Z0-9]*)(\b[^>]*)>/i'); $replace = array('<tag>'); $html = preg_replace($pattern,$replace,$html); // Outputs: <tag><tag>This is a test</p></div> I'd like to replace the last occurance of "" with something special, say for example, "". Any ideas?

    Read the article

< Previous Page | 90 91 92 93 94 95 96 97 98 99 100 101  | Next Page >