Search Results

Search found 7182 results on 288 pages for 'factory pattern'.

Page 34/288 | < Previous Page | 30 31 32 33 34 35 36 37 38 39 40 41  | Next Page >

  • Python singleton pattern

    - by Javier Garcia
    Hi, someone can tell me why this is incorrect as a singleton pattern: class preSingleton(object): def __call__(self): return self singleton = preSingleton() a = singleton() b = singleton() print a==b a.var_in_a = 100 b.var_in_b = 'hello' print a.var_in_b print b.var_in_a Edit: The above code prints: True hello 100 thank you very much

    Read the article

  • Php preg_replace pattern help

    - by christian
    I have this text: Lorem ipsum dolor sit {something.something({print.print(param1,param2)},param2)}, consectetur adipiscing elit. Where i need a pattern that can replace everything but: something.something The text something.something can contain [a-zA-Z.] (I am using preg_replace) Here is a site where you can test the code: http://www.spaweditor.com/scripts/regex/index.php

    Read the article

  • Disposable Registry: good pattern?

    - by illdev
    Imagine a: public class Global : IDisposable { private static readonly List<IDisposable> Disposables = new List<IDisposable>(); public void ApplicationStart() { var heavyLifter = new HeavyLifter(); Disposables.Add(heavyLifter); } public void Dispose() { Disposables.ForEach(d => d.Dispose()); } } I am somewhat inexperienced with IDisposable. Is this a viable pattern?

    Read the article

  • Simple but good pattern for EJB

    - by Sara
    What would you suggest as a good and practical but simple pattern for a soloution with: HTML + JSP (as a view/presentation) SERVLETS (controller, request, session-handling) EJB (persistence, businesslogic) MySQL DB And is it necessary to use an own layer of DAO for persistence? I use JPA to persist objects to my DB. Should I withdraw business logic from my EJB? Sources online all tell me different things and confuses me...

    Read the article

  • Makefile generic pattern rule -- xyzzy-en_US.ext2 from xyzzy.ext0

    - by Janne Savukoski
    I can't figure out a way to define a generic pattern rule for the following kind of production with make: require xyzzy-en_US.ext2 from xyzzy.ext0 via xyzzy.ext1. This works: all: xyzzy-en_US.ext2 # to be compiled from xyzzy.ext0 %.ext1 : %.ext0 # produce xyzzy.ext1 %-en_US.ext2 : %.ext1 # produce xyzzy-en_US.ext2 But how to generalize the locale part of the second rule? Or do I need to generate rules for all different locales? Neither of these work: %-??_??.ext2 : %.ext1 # ... %.ext2 : $(@,%-??_??.ext2,%.ext1) # ...

    Read the article

  • Is there a pattern for this?

    - by Timmy
    i have something that requires a matrix of values, similar to pokemon: i have a class object for each of the types, is there a pattern or a good way to implement this, as a middle layer or in the classes?

    Read the article

  • Python pattern search in a string

    - by Hulk
    In python if a string contains the following, print valid_str The output of this is Record is positive in tone: It emphasizes "what a child can do and his or her achievements, as opposed to what he or she cannot do," explains the It is useful for progress and achievements during office conferences How to search for the pattern It is useful in the above string and if not found return something. Thanks..

    Read the article

  • Multilevel asynchronous method call pattern in c#

    - by michajas
    Hi, I have design problem regarding async calls to method. I'd like to know best/good pattern to call async method, which calls another async method, which calls another async method :) In other words, I have WCF service reference created with async methods and I want to call them from another async method which is called by other async method. All this for non blocking GUI. Thanks!

    Read the article

  • Getting pattern string from java SimpleDateFormat

    - by D Lawson
    I have a SimpleDateFormat object that I retrieve from some internationalization utilities. Parsing dates is all fine and good, but I would like to be able show a formatting hint to my users like "MM/dd/yyyy". Is there a way to get the formatting pattern from a SimpleDateFormat object?

    Read the article

  • How to implement MVP pattern for a tabcontrol?

    - by John_Sheares
    I have an application that has a tabcontrol with 5 tabpages of information that user interacts with. Also, there are contextual menus and toolbars for editing and formatting the information. Do I create a different view & presenter for each tab page or the tabcontrol iteself? How do I apply the pattern to the toolbars and menus that can interact with any of the tabs?

    Read the article

  • Name the pattern - Create, Set, Execute, Destroy?

    - by Seb Nilsson
    I somewhere heard that the .NET Framework was built around specific pattern, which they tried to uphold as much as possible. var rsa = new RSACryptoServiceProvider(); // Create rsa.ImportParameters(GetParameters()); // Set byte[] encrypted = rsa.Encrypt(data, true); // Execute // Destroyed by garbage-collector Are there any variants of this? What are the general pros and cons?

    Read the article

  • Decorator Design Pattern - Not Possible

    - by Lennie
    Hi, This is more a design question... You can't do a decorate design pattern if: 1) The object is marked "sealed" meaning you can't extend from it. 2) or you want to override a method but its not virtual. What can you do then? Taken that you can't change the class source code if you don't have the source code (like a 3rd party library).

    Read the article

  • pattern to transfer search model to dao

    - by zeroed
    We have a dao as a project (jar file). Clients use its interfaces and factories to operate with database. Using standard CRUD operations, dao allows you to search an entity by some search criteria. What is the best way to represent this criteria? Is transfer object appropriate pattern in this situation? How should client create SearchModel instance? Please, share. Regards.

    Read the article

  • Design pattern to separate messages from actual process.

    - by Manish Gupta
    I am having a C# application to sync data between PC and palm devices. There are codes written like below: showMessage("synchronizing Table1"); Sync(destTable1,sourceTable1); Sync(destTable2,sourceTable2); showMessage("synchronizing Table2"); // more code How do I separate the actual process of synchronizing from displaying message? Which design pattern to follow? Thanks in advance...

    Read the article

  • Javascript plugins design pattern like jQuery

    - by Marco Demaio
    Could someone write down a very simple basic example in javascript to conceptualize (and hopefully make me understand) how the jQuery plugin design pattern is done and how it works? I'm not interested in how creating plugin for jQuery (so no jQuery code here at all). I'm interested in a simple explanation (maybe with a bit of Javascript code) to explain how it is done the plugin concept. Plz do not reply me to go and read jQuery code, I tried, but I it's too complex, otherwise I would have not post a question here.

    Read the article

  • Pattern for creating a database schema using JDBC

    - by Space_C0wb0y
    I have a Java-application that loads data from a legacy file format into an SQLite-Database using JDBC. If the database file specified does not exist, it is supposed to create a new one. Currently the schema for the database is hardcoded in the application. I would much rather have it in a separate file as an SQL-Script, but apparently there is now easy way to execute an SQL-Script though JDBC. Is there any other way or a pattern to achieve something like this?

    Read the article

  • Problem creating a webpage in OOP pattern?

    - by Starx
    I want to develop a website in OOP pattern, but I am stuck in a point whether I need to inherit from multiple classes. For example I have a main class "index" this class has several methods which need to inherited from other classes and I have created seperate classes for it like class "banner", class "content", class "footer" Not only this but class "content" has several methods to be inherited from other classes like class "gallery", class "news", etc I found out that multiple inheritance is not allowed, and using interface I cannot write codes in its methods, so how can i achieve a solution for this problem.

    Read the article

  • example for Singleton pattern

    - by JavaUser
    Hi, Please give me a real time example for singleton pattern . Different threads accessing a shared file is singleton or not ? Since each thread access the same instance of the file not individual instances of their own .

    Read the article

< Previous Page | 30 31 32 33 34 35 36 37 38 39 40 41  | Next Page >