Search Results

Search found 12924 results on 517 pages for 'module pattern'.

Page 7/517 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Django error - no module named

    - by Shreyas
    Here is my relevant directory structure (Windows 7, Python 2.7, virtualenv) -userProf - - manage.py - -UserProfile - sampleapp_db - urls.py - views.py - wsgi.py - __init__.py - -libs - - __init__.py - -allauth - - app_settings.py - - models.py - - tests.py - - urls.py - - utils.py - - - -account - - - admin.py - - - context_processors.py - - - models.py - - - urls.py - - - __init__.py - -socialaccount - - - admin.py - - - context_processors.py - - - models.py - - - urls.py - - - views.py - - - __init__.py - - - - -templates - -account - - - base.html - - - email.html -settings - base_settings.py - dev.py - __init__.py - -static -css I get the following error when I try to run this dango app Error: No module named account I have read other posts on SO that refer to the syspath being the issue or that the appname matches the project name Django Shell No module named settings ...as a result of this, I added the following statements in the base_settings.py file import sys base = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) base_parent = os.path.dirname(base) sys.path.append(base) sys.path.append(base_parent) sys.path.append(os.path.join(base,'libs')) sys.path.append(os.path.join(base,'libs','allauth','account')) I verified that the sys.path is correct by putting a break in PyCharm and evaluating sys.path Should I be putting this in manage.py? Some other SO postings referred to not being able to import the module but I can launch the python console and import UserProfile.libs.allauth.account without any exceptions being thrown! My base_setings.py has the following relevant section INSTALLED_APPS = ( 'UserProfile.libs.allauth.account', )

    Read the article

  • Perl Module from relative path not working in IIS6

    - by Laramie
    Disclaimer: I am not a PERL developer and am learning by the seat of my pants. I am using a Perl module called from a CGI scipt in IIS 6 that is bombing. The identical folder structure on an XP machine (IIS 5.1) works fantastic. If I remove the module loading command at line 9, it will print "about to load" and "ok", but When I try to run use Language::Guess; I receive The specified CGI application misbehaved by not returning a complete set of HTTP headers. in the browser. The folder structure is /cgi-bin/test.pl /PerlModules/Language/Guess.pm I have tried adjusting the file/folder permissions and have reviewed my IIS configuration time and again. It runs fine from the command line on the IIS machine or if I copy the module into \Perl\site\lib, but I don't have permission to load modules on the shared server this script is destined for. Am I missing something simple? Here is test.pl use strict; use CGI ':standard'; print header("text/html"); use lib "..\\PerlModules\\"; print "about to load<br/>"; #bombs here use Language::Guess; print "ok"

    Read the article

  • Repository Pattern with Entity Framework 3.5 and MVVM

    - by Ravi
    I am developing a Database File System. I am using - .Net framework 3.5 Entity Framework 3.5 WPF with MVVM pattern The project spans across multiple assemblies each using same model. One assembly,let's call it a "server", only adds data to the database using EF i.e. same model.Other assemblies (including the UI) both reads and writes the data.The changes made by server should immediately reflect in other assemblies. The database contains self referencing tables where each entity can have single OR no parent and (may be) some children. I want to use repository pattern which can also provide some mechanism to handle this hierarchical nature. I have already done reading on this on Code Project. It shares the same context(entities) everywhere. My question is - Should I share the same context everywhere? What are the advantages and disadvantages of doing that?

    Read the article

  • Repository Pattern and Entity Framework.

    - by vitorcast
    Hi people, I want to make an implementation with repository pattern with ASP.NET MVC 2 and Entity Framework but I have had some issues in the process. First of all, I have 2 entities that has a relationship between them, like Order and Product. When I generate my dbml file it gaves me a class Order with a property that map a "ProductSet" and one class Product with a property that map wich Order that Product relates itself. So I create my Repository pattern like IReporitory with the basic CRUD operations and inside my controllers I implement the ProductRepository or OrderRepository. The problem occurs when I try to create Product and have to assign my Order on it, like ProductOne.Order = _orderRepository.Find(orderId); That operation gave me some strange behavior and I can't find out what is wrong with it. Thanks for the help.

    Read the article

  • Repository Pattern with Entity Framework 3.5

    - by Ravi
    I am developing a Database File System. I am using - .Net framework 3.5 Entity Framework 3.5 WPF with MVVM pattern The project spans across multiple assemblies each using same model. One assembly,let's call it a "server", only adds data to the database using EF i.e. same model.Other assemblies (including the UI) both reads and writes the data.The changes made by server should immediately reflect in other assemblies. The database contains self referencing tables where each entity can have single OR no parent and (may be) some children. I want to use repository pattern which can also provide some mechanism to handle this hierarchical nature. I have already done reading on this on Code Project. It shares the same context(entities) everywhere. My question is - Should I share the same context everywhere? What are the advantages and disadvantages of doing that?

    Read the article

  • Repository Pattern with Entity Framework 3.5

    - by Ravi
    I am developing a Database File System. I am using - .Net framework 3.5 Entity Framework 3.5 WPF with MVVM pattern The project spans across multiple assemblies each using same model. One assembly,let's call it a "server", only adds data to the database using EF i.e. same model.Other assemblies (including the UI) both reads and writes the data.The changes made by server should immediately reflect in other assemblies. The database contains self referencing tables where each entity can have single OR no parent and (may be) some children. I want to use repository pattern which can also provide some mechanism to handle this hierarchical nature. I have already done reading on this on Code Project. It shares the same context(entities) everywhere. My question is - Should I share the same context everywhere? What are the advantages and disadvantages of doing that?

    Read the article

  • when to use the abstract factory pattern?

    - by hguser
    Hi: I want to know when we need to use the abstract factory pattern. Here is an example,I want to know if it is necessary. The UML THe above is the abstract factory pattern, it is recommended by my classmate. THe following is myown implemention. I do not think it is necessary to use the pattern. And the following is some core codes: package net; import java.io.IOException; import java.util.HashMap; import java.util.Map; import java.util.Properties; public class Test { public static void main(String[] args) throws IOException, InstantiationException, IllegalAccessException, ClassNotFoundException { DaoRepository dr=new DaoRepository(); AbstractDao dao=dr.findDao("sql"); dao.insert(); } } class DaoRepository { Map<String, AbstractDao> daoMap=new HashMap<String, AbstractDao>(); public DaoRepository () throws IOException, InstantiationException, IllegalAccessException, ClassNotFoundException { Properties p=new Properties(); p.load(DaoRepository.class.getResourceAsStream("Test.properties")); initDaos(p); } public void initDaos(Properties p) throws InstantiationException, IllegalAccessException, ClassNotFoundException { String[] daoarray=p.getProperty("dao").split(","); for(String dao:daoarray) { AbstractDao ad=(AbstractDao)Class.forName(dao).newInstance(); daoMap.put(ad.getID(),ad); } } public AbstractDao findDao(String id) {return daoMap.get(id);} } abstract class AbstractDao { public abstract String getID(); public abstract void insert(); public abstract void update(); } class SqlDao extends AbstractDao { public SqlDao() {} public String getID() {return "sql";} public void insert() {System.out.println("sql insert");} public void update() {System.out.println("sql update");} } class AccessDao extends AbstractDao { public AccessDao() {} public String getID() {return "access";} public void insert() {System.out.println("access insert");} public void update() {System.out.println("access update");} } And the content of the Test.properties is just one line: dao=net.SqlDao,net.SqlDao So any ont can tell me if this suitation is necessary?

    Read the article

  • Variable 'app' in url-pattern for servlet mapping

    - by Brian
    I'm learning Spring MVC (and servlets in general) and following springsource's mvc-ajax example, which uses annotated controller methods. It appears that there is only one url-pattern (in web.xml) mapped to a servlet in that example: /app/* I've deployed the app as a WAR file, and the actual, ugly URL I'm requesting is http://127.0.0.1:8080/org.springframework.samples.mvc.ajax-1.0.0-20100407.233245-1/account. So, it appears that 'app' in '/app/*' is a variable corresponding to 'org.springframework.samples.mvc.ajax-1.0.0-20100407.233245-1', however, it isn't universal because it isn't usable in my own app, and it contradicts my understanding that url-pattern contains the portion of the URL after the app name. So, what is 'app'? Where is it configured?

    Read the article

  • Understanding pattern matching with cons operator

    - by Mathias
    In "Programming F#" I came across a pattern-matching like this one (I simplified a bit): let rec len list = match list with | [] -> 0 | [_] -> 1 | head :: tail -> 1 + len tail;; Practically, I understand that the last match recognizes the head and tail of the list. Conceptually, I don't get why it works. As far as I understand, :: is the cons operator, which appends a value in head position of a list, but it doesn't look to me like it is being used as an operator here. Should I understand this as a "special syntax" for lists, where :: is interpreted as an operator or a "match pattern" depending on context? Or can the same idea be extended for types other than lists, with other operators?

    Read the article

  • When to use the Flyweight Pattern

    - by elmt
    So I've just gotten on the boost train and was checking out the flyweight pattern and was interested in implementing it in my project. Obviously, it doesn't make sense to use it on any class that has only has one instance of it. However, say I have 5 instances of an class. Should I be using the flyweight pattern or should it be only used for a class that has at least N instances. I realize that many factors will influence this answer (how many fields there are, the size of the fields, etc.).

    Read the article

  • Better to use constructor or method factory pattern?

    - by devoured elysium
    I have a wrapper class for the Bitmap .NET class called BitmapZone. Assuming we have a WIDTH x HEIGHT bitmap picture, this wrapper class should serve the purpose of allowing me to send to other methods/classes itself instead of the original bitmap. I can then better control what the user is or not allowed to do with the picture (and I don't have to copy the bitmap lots of times to send for each method/class). My question is: knowing that all BitmapZone's are created from a Bitmap, what do you find preferrable? Constructor syntax: something like BitmapZone bitmapZone = new BitmapZone(originalBitmap, x, y, width, height); Factory Method Pattern: BitmapZone bitmapZone = BitmapZone.From(originalBitmap, x , y, width, height); Factory Method Pattern: BitmapZone bitmapZone = BitmapZone.FromBitmap(originalBitmap, x, y, width, height); Other? Why? Thanks

    Read the article

  • Problem with literal arguments in the PATTERN string for a python 2to3 fixer

    - by Zxaos
    Hi folks. I'm writing a fixer for the 2to3 tool in python. In my pattern string, I have a section where I'd like to match an empty string as an argument, or an empty unicode string. The relevant chunk of my pattern looks like: (args='""' | args='u""') My issue is the second option never matches. Even if it's alone, it won't match. However, if I simply say args=any and then output args, I can catch cases where args is exactly equal to the second option. Is there some weird unicode handling thing going on? Why won't the second literal option ever match?

    Read the article

  • Instantiate a javascript module only one time.

    - by Cedric Dugas
    Hey guys, I follow a module pattern where I instantiate components, however, a lot of time a component will only be instantiate one time (example: a comment system for an article). For now I instantiate in the same JS file. but I was wondering if it is the wrong approach? It kind of make no sense to instantiate in the same file and always only once. But at the same time, if this file is in the page I want to have access to my module without instantiate from elsewhere, and IF I need another instance, I just create another from elsewhere... Here is the pattern I follow: ApplicationNamespace.Classname = function() { // constructor function privateFunctionInit() { // private } this.privilegedFunction = function() { // privileged privateFunction(); }; privateFunctionInit() }; ApplicationNamespace.Classname.prototype = { Method: function(){} } var class = new ApplicationNamespace.Classname(); What do you think, wrong approach, or is this good?

    Read the article

  • Matching Line Boundaries in a Regular Expression (Pattern.MULTILINE/(?m)) is broken in Java?

    - by Mister M. Bean
    The example on http://www.exampledepot.com/egs/java.util.regex/Line.html gives false for me twice but should'nt! Why? CharSequence inputStr = "abc\ndef"; String patternStr = "abc$"; // Compile with multiline enabled Pattern pattern = Pattern.compile(patternStr, Pattern.MULTILINE); Matcher matcher = pattern.matcher(inputStr); boolean matchFound = matcher.find(); // true // Use an inline modifier to enable multiline mode matchFound = pattern.matches(".*abc$.*", "abc\r\ndef"); // false System.out.println(matchFound); // false matchFound = pattern.matches("(?m).*abc$.*", "abc\r\ndef"); // true System.out.println(matchFound);// false !!!!!

    Read the article

  • sed find pattern on line with another pattern

    - by user2962390
    I am trying to extract text from a file between a '<' and a '', but only on a line starting with another specific pattern. So in a file that looks like: XXX Something here XXX Something more here XXX <\Lines like this are a problem ZZZ something <\This is the text I need XXX Don't need any of this I would like to print only the "<\This is the text I need". If I do sed -n '/^ZZZ/p' FILENAME it pulls the correct lines I need to look at, but obviously prints the whole line. sed -n '/</,//p' FILENAME prints way too much. I have looked into grouping and tried sed -n '/^ZZZ/{/</,//} FILENAME but this doesn't seem to work at all. Any suggestions? They will be much appreciated. (Apologies for formatting, never posted on here before)

    Read the article

  • Better Understand the 'Strategy' Design Pattern

    - by Imran Omar Bukhsh
    Greetings Hope you all are doing great. I have been interested in design patterns for a while and started reading 'Head First Design Patterns'. I started with the first pattern called the 'Strategy' pattern. I went through the problem outlined in the images below and first tried to propose a solution myself so I could really grasp the importance of the pattern. So my question is that why is my solution ( below ) to the problem outlined in the images below not good enough. What are the good / bad points of my solution vs the pattern? What makes the pattern clearly the only viable solution ? Thanks for you input, hope it will help me better understand the pattern. MY SOLUTION Parent Class: DUCK <?php class Duck { public $swimmable; public $quackable; public $flyable; function display() { echo "A Duck Looks Like This<BR/>"; } function quack() { if($this->quackable==1) { echo("Quack<BR/>"); } } function swim() { if($this->swimmable==1) { echo("Swim<BR/>"); } } function fly() { if($this->flyable==1) { echo("Fly<BR/>"); } } } ?> INHERITING CLASS: MallardDuck <?php class MallardDuck extends Duck { function MallardDuck() { $this->quackable = 1; $this->swimmable = 1; } function display() { echo "A Mallard Duck Looks Like This<BR/>"; } } ?> INHERITING CLASS: WoddenDecoyDuck <?php class WoddenDecoyDuck extends Duck { function woddendecoyduck() { $this->quackable = 0; $this->swimmable = 0; } function display() { echo "A Wooden Decoy Duck Looks Like This<BR/>"; } } Thanking you for your input. Imran

    Read the article

  • Data structure for pattern matching.

    - by alvonellos
    Let's say you have an input file with many entries like these: date, ticker, open, high, low, close, <and some other values> And you want to execute a pattern matching routine on the entries(rows) in that file, using a candlestick pattern, for example. (See, Doji) And that pattern can appear on any uniform time interval (let t = 1s, 5s, 10s, 1d, 7d, 2w, 2y, and so on...). Say a pattern matching routine can take an arbitrary number of rows to perform an analysis and contain an arbitrary number of subpatterns. In other words, some patterns may require 4 entries to operate on. Say also that the routine (may) later have to find and classify extrema (local and global maxima and minima as well as inflection points) for the ticker over a closed interval, for example, you could say that a cubic function (x^3) has the extrema on the interval [-1, 1]. (See link) What would be the most natural choice in terms of a data structure? What about an interface that conforms a Ticker object containing one row of data to a collection of Ticker so that an arbitrary pattern can be applied to the data. What's the first thing that comes to mind? I chose a doubly-linked circular linked list that has the following methods: push_front() push_back() pop_front() pop_back() [] //overloaded, can be used with negative parameters But that data structure seems very clumsy, since so much pushing and popping is going on, I have to make a deep copy of the data structure before running an analysis on it. So, I don't know if I made my question very clear -- but the main points are: What kind of data structures should be considered when analyzing sequential data points to conform to a pattern that does NOT require random access? What kind of data structures should be considered when classifying extrema of a set of data points?

    Read the article

  • Name for Osherove's modified singleton pattern?

    - by Kazark
    I'm pretty well sold on the "singletons are evil" line of thought. Nevertheless, there are limited occurrences when you want to limit the creation of an object. Roy Osherove advises, If you're planning to use a singleton in your design, separate the logic of the singleton class and the logic that makes it a singleton (the part that initializes a static variables, for example) into two separate classes. That way, you can keep the single responsibility principle (SRP) and also have a way to override singleton logic. (The Art of Unit Testing 261-262) This pattern still perpetuates the global state. However, it does result in a testable design, so it seems to me to be a good pattern for mitigating the damage of a singleton. However, Osherove does not give a name to this pattern; but naming a pattern, according to the Gang of Four, is important: Naming a pattern immediately increases our design vocabulary. It lets us design at a higher level of abstraction. (3) Is there a standard name for this pattern? It seems different enough from a standard singleton to deserve a separate name. Decoupled Singleton, perhaps?

    Read the article

  • Python - problem in importing new module - libgmail

    - by Microkernel
    Hi all, I downloaded Python module libgmail from sourceforge and extracted all the files in the archive. The archive had setup.py, so I went to that directory in command prompt and did setup.py install I am getting the following error message I:\libgmail-0.1.11>setup.py install Traceback (most recent call last): File "I:\libgmail-0.1.11\setup.py", line 7, in ? import libgmail File "I:\libgmail-0.1.11\libgmail.py", line 36, in ? import mechanize as ClientCookie ImportError: No module named mechanize This may be trivial, but I am new to python. So plz guide what to do. please note, I am using python 2.4 and using Windows-XP. Thank you MicroKernel

    Read the article

  • Error after installing Classified Ad Module on Drupal 7

    - by Ams
    Hello, i just installed Classified Ad but after the installation i get this error: Notice: Undefined index: type in ed_classified_form_alter() (line 218 of /home3/amineamm/public_html/chrini/sites/all/modules/ed_classified/ed_classified.module). When i look up at the php code i can't figure out how to correct it. Here is my code: function ed_classified_form_alter(&$form, $form_state, $form_id) { module_load_include('inc', 'ed_classified', 'ed_classified_utils'); if ($form['type']['#value'] == EDI_CLASSIFIED_MODULE_NAME) { if ($form_id == 'ed_classified_node_form' && $form['attachments'] && _ed_classified_variable_get('alter_attachment_text', EDI_CLASSIFIED_VAR_DEF_ALTER_ATTACHMENT_TEXT) ) { // Don't allow the attachments block to be collapsed. $form['attachments']['#collapsed']=FALSE; $form['attachments']['#collapsible']=FALSE; // Enhance the help for classified ads. // NOTE: this is appropriate for the upload_image module enhancements only! $form['attachments']['#title']=t('Photo Attachments'); $form['attachments']['#description']= _ed_classified_variable_get('alter_attachment_text_description', t(EDI_CLASSIFIED_VAR_DEF_ALTER_ATTACHMENT_TEXT_DESCRIPTION)); } } } Any suggestion ?

    Read the article

  • Automatically enabling an output filter in Apache module

    - by Chris
    I am developing a module for Apache which contains an output filter that I would like to always be invoked so that it can determine whether to process the request data or just pass the data along. Since I would like the module to be compatible with Apache 2.0 as well as 2.2, I do not want to use mod_filter. Ideally I would like to do this without having to explicitly enable the filter through the httpd.conf file, but I have so far not been able to find any example of this. Is this at all possible? Can someone please point me to a suitable example?

    Read the article

  • A metaphor for Drupal module's inner workings

    - by PHP thinker
    What is the best application workflow metaphor for Drupal module? In PHP frameworks we think MVC-style. How do we think inside Drupal? Asumming I am writing some user-oriented module like Shop, Catalog or Forum. As far as I understand there are no or few MVC based modules. Should I generally treat Drupal modules (as sub-application) as a number of screens connected via forms and hyperlinks or there is a better way. My question may be a little bit speculative, but I hope someone will share my intent to think models, not just "scripts".

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >