Fairly straightforward question:
I know that Codeigniter is a MVC framework - however what design pattern is Codeigniter using?
From first look it seems like Facade, but I could be wrong.
.NET's ProviderBase was established in the 2.0 release of the .NET Framework. Have there been any new features since then that supercede or improve on this pattern that should be used as an alternative?
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)
# ...
For a while I have been struggling to integrate scala with java methods that might return null. I came up with the following utility which helps a lot:
// produce an Option, nulls become None
object Maybe {
def apply[T](t:T) = if (t==null) None else Some(t)
}
Maybe(javaClass.getResultCouldBeNull()).map( result => doSomeWork(result) )
I have a few questions about this solution:
Is there a better or more standard pattern to use?
Am I duplicating something that already exists?
Does this functionality have hidden gotchas?
I have a class which has a list of child items. Is there a design pattern I can copy that I can apply to these classes so that I can access the parent instance from the child, and it enforces rules such as not being able to add the child to multiple parents, etc?
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
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
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...
If I have a HTTP based RESTful service and I want to POST a search resource and use the PRG pattern for returning the URL to the search-result resource, I have to persist the search-result resource on the server.
Is this a good idea?
If I do persist the search-result resource how long is it persisted for?
Can I control this by a HTTP header of some kind?
Cheers
AWC
I'd like to "grab" a few hundred urls from a few hundred html pages.
Pattern:
<h2><a href="http://www.the.url.might.be.long/urls.asp?urlid=1" target="_blank">The Website</a></h2>
In my bash script I have an external (received from user) string, which I should use in sed pattern.
REPLACE="<funny characters here>"
sed "s/KEYWORD/$REPLACE/g"
How can I escape the $REPLACE string so it would be safely accepted by sed as a literal replacement?
NOTE: The KEYWORD is a dumb substring with no matches etc. It is not supplied by user.
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?
I've found many useful Bash commands that can execute OS X behaviors from the command line such as:
screencapture -x -C $FILENAME
Is there such a command that can check if the screen saver is active?
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!
Recently lot of interviewers are asking
"What are the integration patterns are you familiar with?".
I know design patterns,what is integration pattern then?
How to create regex pattern which is concatenate with variable, something like this:
var test ="52";
var re = new RegExp("/\b"+test+"\b/");
alert('51,52,53'.match(re));
Thanks
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?
I have gone through tons of documents over the internet in enabling Active Directory Authentication for Plone 3 using LDAPMultiplugins, PlonePAS etc., but none of them are working for me.
Is there any one who has successfully done this? Even if this has accomplished on Windows, it is ok!
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..
Is there a way to get the form active control?
I was checking in the help for the "Support.GetActiveControl" method but it isn't supported :) for the Compact Framework.
I suppose that I can track the focus by adding a custom GotFocus event handler to all the form controls, but I'm looking for a more generic way that can be implemented for any form.
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?
have you re-factored from an Active Record to a Data Mapper pattern? what conditions prompted the switch? i'm primarily interested in web based applications, but would like to know the challenges that accompany such a move in any environment.
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?
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?