Search Results

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

Page 24/263 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • Java - Is this a bad design pattern?

    - by Walter White
    Hi all, In our application, I have seen code written like this: User.java (User entity) public class User { protected String firstName; protected String lastName; ... getters/setters (regular POJO) } UserSearchCommand { protected List<User> users; protected int currentPage; protected int sortColumnIndex; protected SortOder sortOrder; // the current user we're editing, if at all protected User user; public String getFirstName() {return(user.getFirstName());} public String getLastName() {return(user.getLastName());} } Now, from my experience, this pattern or anti-pattern looks bad to me. For one, we're mixing several concerns together. While they're all user-related, it deviates from typical POJO design. If we're going to go this route, then shouldn't we do this instead? UserSearchCommand { protected List<User> users; protected int currentPage; protected int sortColumnIndex; protected SortOder sortOrder; // the current user we're editing, if at all protected User user; public User getUser() {return(user);} } Simply return the user object, and then we can call whatever methods on it as we wish? Since this is quite different from typical bean development, JSR 303, bean validation doesn't work for this model and we have to write validators for every bean. Does anyone else see anything wrong with this design pattern or am I just being picky as a developer? Walter

    Read the article

  • pattern for the following condition in java

    - by zahir hussain
    hi i want to know how to write pattern.. for example : the word is "AboutGoogle AdWords Drive traffic and customers to your site. Pay through Cheque, Net Banking or Credit Card. Google Toolbar Add a search box to your browser. Google SMS To find out local information simply SMS to 54664. Gmail Free email with 7.2GB storage and less spam. Try Gmail today. Our ProductsHelp Help with Google Search, Services and ProductsGoogle Web Search Features Translation, I'm Feeling Lucky, CachedGoogle Services & Tools Toolbar, Google Web APIs, ButtonsGoogle Labs Ideas, Demos, ExperimentsFor Site OwnersAdvertising AdWords, AdSenseBusiness Solutions Google Search Appliance, Google Mini, WebSearchWebmaster Central One-stop shop for comprehensive info about how Google crawls and indexes websitesSubmit your content to Google Add your site, Google SitemapsOur CompanyPress Center News, Images, ZeitgeistJobs at Google Openings, Perks, CultureCorporate Info Company overview, Philosophy, Diversity, AddressesInvestor Relations Financial info, Corporate governanceMore GoogleContact Us FAQs, Feedback, NewsletterGoogle Logos Official Logos, Holiday Logos, Fan LogosGoogle Blog Insights to Google products and cultureGoogle Store Pens, Shirts, Lava lamps©2010 Google - Privacy Policy - Terms of Service" I have to search some word... for example "google insights" so how to write the code in java... i just write small code... check my code and answer my question... that code only use for find the search word, where is that. but i need to display some words front of search word and display some words rear of search workd... similar to google search... my code is Pattern p = Pattern.compile("(?i)(.*?)"+search+""); Matcher m = p.matcher(full); String title=""; while (m.find() == true) { title=m.group(1); System.out.println(title); } the full is orignal content, search s search word... thanks and advance

    Read the article

  • Multiple leaf methods problem in composite pattern

    - by Ondrej Slinták
    At work, we are developing an PHP application that would be later re-programmed into Java. With some basic knowledge of Java, we are trying to design everything to be easily re-written, without any headaches. Interesting problem came out when we tried to implement composite pattern with huge number of methods in leafs. What are we trying to achieve (not using interfaces, it's just an example): class Composite { ... } class LeafOne { public function Foo( ); public function Moo( ); } class LeafTwo { public function Bar( ); public function Baz( ); } $c = new Composite( Array( new LeafOne( ), new LeafTwo( ) ) ); // will call method Foo in all classes in composite that contain this method $c->Foo( ); It seems like pretty much classic Composite pattern, but problem is that we will have quite many leaf classes and each of them might have ~5 methods (of which few might be different than others). One of our solutions, which seems to be the best one so far and might actually work, is using __call magic method to call methods in leafs. Unfortunately, we don't know if there is an equivalent of it in Java. So the actual question is: Is there a better solution for this, using code that would be eventually easily re-coded into Java? Or do you recommend any other solution? Perhaps there's some different, better pattern I could use here. In case there's something unclear, just ask and I'll edit this post.

    Read the article

  • PHP preg_match: a pattern which satisfies all MySQL field names (including 'table.field' formations)

    - by gsquare567
    i need a pattern which satisfies mysql field names, but also with the option of having a table name before it examples: mytable.myfield myfield my4732894__7289FiEld here's what i tried: $pattern = "/^[a-zA-Z0-9_]*?[\.[a-zA-Z0-9_]]?$/"; this worked for what i needed before, which was just the field name: $pattern = "/^[a-zA-Z0-9_]*$/"; any ideas why my addition isnt working? maybe i'm making up regex, so i'll explain what i added... the first '?' is to say that it isn't greedy, ie. it will stop if the next part, namely "[.[a-zA-Z0-9_]]?" is satisfied. now, that second part is just the same as the first except it is optional (hence the '?' at the end) and it starts with a period (hence the '[.' and ']' wrapping my old clause. and obviously, the "^" and "$" rep the beginning and end of the string so... any ideas? (also, i'm a tad confused as to why i need to put in those "/"s in the begining/end anyways, so if you could tell me why it's required, that'd be awesome) thanks a lot! (and thanks for reading this all if you actually did... it's quite a ramble)

    Read the article

  • rsync --remove-source-files but only those that match a pattern

    - by Daniel
    Is this possible with rsync? Transfer everything from src:path/to/dir to dest:/path/to/other/dir and delete some of the source files in src:path/to/dir that match a pattern (or size limit) but keep all other files. I couldn't find a way to limit --remove-source-files with a regexp or size limit. Update1 (clarification): I'd like all files in src:path/to/dir to be copied to dest:/path/to/other/dir. Once this is done, I'd like to have some files (those that match a regexp or size limit) in src:path/to/dir deleted but don't want to have anything deleted in dest:/path/to/other/dir. Update2 (more clarification): Unfortunately, I can't simply rsync everything and then manually delete the files matching my regexp from src:. The files to be deleted are continuously created. So let's say there are N files of the type I'd like to delete after the transfer in src: when rsync starts. By the time rsync finishes there will be N+M such files there. If I now delete them manually, I'll lose the M files that were created while rsync was running. Hence I'd like to have a solution that guarantees that the only files deleted from src: are those known to be successfully copied over to dest:. I could fetch a file list from dest: after the rsync is complete, and compare that list of files with what I have in src:, and then do the removal manually. But I was wondering if rsync can do this by itself.

    Read the article

  • Sed: Deleting all content matching a pattern

    - by Svish
    I have some plist files on mac os x that I would like to shrink. They have a lot of <dict> with <key> and values. One of these keys is a thumbnail which has a <data> value with base64 encoded binary (I think). I would like to remove this key and value. I was thinking this could maybe be done by sed, but I don't really know how to use it and it seems like sed only works on a line-by-line basis? Either way I was hoping someone could help me out. In the file I would like to delete everything that matches the following pattern or something close to that: <key>Thumbnail<\/key>[^<]*<\/data> In the file it looks like this: // Other keys and values <key>Thumbnail</key> <data> TU0AKgAAOEi25Pqx3/ip2fak0vOdzPCVxu2RweuPv+mLu+mIt+aGtuaEtOSB ... dCBBcHBsZSBDb21wdXRlciwgSW5jLiwgMjAwNQAAAAA= </data> // Other keys and values Anyone know how I could do this? Also, if there are any better tools that I can use in the terminal to do this, I would like to know about that as well :)

    Read the article

  • rsync --remove-source-files but only those that match a pattern

    - by user28146
    Is this possible with rsync? Transfer everything from src:path/to/dir to dest:/path/to/other/dir and delete some of the source files in src:path/to/dir that match a pattern (or size limit) but keep all other files. I couldn't find a way to limit --remove-source-files with a regexp or size limit. Update1 (clarification): I'd like all files in src:path/to/dir to be copied to dest:/path/to/other/dir. Once this is done, I'd like to have some files (those that match a regexp or size limit) in src:path/to/dir deleted but don't want to have anything deleted in dest:/path/to/other/dir. Update2 (more clarification): Unfortunately, I can't simply rsync everything and then manually delete the files matching my regexp from src:. The files to be deleted are continuously created. So let's say there are N files of the type I'd like to delete after the transfer in src: when rsync starts. By the time rsync finishes there will be N+M such files there. If I now delete them manually, I'll lose the M files that were created while rsync was running. Hence I'd like to have a solution that guarantees that the only files deleted from src: are those known to be successfully copied over to dest:. I could fetch a file list from dest: after the rsync is complete, and compare that list of files with what I have in src:, and then do the removal manually. But I was wondering if rsync can do this by itself.

    Read the article

  • If you had two projects with the same specification and only one was developed using TDD how could you tell?

    - by Andrew
    I was asked this question in an interview and it has been bugging me ever since. You have two projects, both with the same specification but only one of these projects was developed using Test Driven Development. You are given the source for both but with the tests removed from the TDD project. How can you tell which was developed using TDD? All I was able to muster up was something about the classes being more 'broken up' in to smaller chunks and having more visible APIs, not my proudest moment. I would be very interested to hear a good answer to this question.

    Read the article

  • Should one use the legal "shall" in requirements documents and specification documents? [migrated]

    - by Billy ONeal
    At least in the US, "will" has replaced "shall" in most every context, with the notable exception of the "legal shall". Shall is used instead of will in legal documents to indicate a sense of obligation or requirement; e.g. "the defendant shall vacate the premises by October 16". In software, requirements documents and specification documents serve close to the same purpose as the aforementioned legal documents; does this mean shall should be used in a similar fashion as a result?

    Read the article

  • Le W3C valide une spécification sur la confidentialité des internautes proposée par Microsoft, la normalisation du standard commence

    Le W3C valide une nouvelle spécification proposée par Microsoft Pour lutter contre le traçage des internautes Un nouveau standard Web, fondé sur la fonctionnalité « Tracking protection » d'Internet Explorer 9 pour aider les utilisateurs à mieux contrôler le traçage de leur activité en ligne, avait été proposée par Microsoft au W3C. Elle vient d'être validée. Dans un billet, Microsoft affirme que l'organisme de normalisation responsable de la définition des standards du Web a récemment porté son attention sur la protection de la vie privée en ligne et a trouvé sa proposition « opportune et en phase avec ses propres objectifs et priorités ». Pour Dean Hachamovitch, vic...

    Read the article

  • WebGL 1.0, spécification finalisée pour la bibliothèques d'accélération 3D libre soutenue par Chrome, Firefox, Opera et Safari

    La spécification de WebGL 1.0 est finalisée Pour la bibliothèques d'accélération 3D libre soutenue par Chrome, Firefox, Opera et Safari Ces dernier temps, vous avez entendu parler de la mise en place de WebGL dans les nouvelles versions des différents navigateurs web. Comme vous devez déjà le savoir, Firefox 4, Google Chrome 9 (rendez-vous à l'adresse "about:flags" pour activer WebGL supportent la nouvelle technologie (également soutenue par Apple pour Safari et par Opera). Khronos, un consortium de constructeurs de cartes graphiques (NVidia, AMD, Imagination Technologies, ...) et de différents grand acteurs dans le monde de la 3D (Activision, Epic Games, ...) annonce dur...

    Read the article

  • « Responsive Images » : afficher des tailles d'images qui varient avec les écrans, le W3C publie un nouveau projet de spécification HTML

    HTML : afficher des tailles d'images différentes en fonction des écrans Le W3C publie un projet de spécification pour des « Responsive Images » L'heure est au « Responsive » pour le développement de sites Web. Après le Responsive Design ? qui fait varier le nombre de colonnes et modifie les contenus à afficher en fonction de la taille de la fenêtre ? voici le HTML Responsive Images Extension. Ce projet du W3C vise à normaliser la manière d'afficher des tailles d'images différentes en fonction de la taille de la fenêtre de navigation et de la résolution de l'écran. Concrètement, f...

    Read the article

  • PHP regex to search across multiple lines

    - by Gaz
    I'm using preg_* in PHP to search for the pattern <!-- %{data=THIS GETS MATCHED}% --> and pull out the matched text. The pattern for this is: preg_match('#<!-- %{' . $knownString . '\s*=\s*(.*?)}% -->#', ...) What I would like it to do is search across multiple lines for the string. For example: <!-- %{data= THIS GETS MATCHED AND RETURNED }% --> How can I edit my current pattern to have this search ability?

    Read the article

  • Using Nearest Neighbour Algorithm for image pattern recognition

    - by user293895
    So I want to be able to recognise patterns in images (such as a number 4), I have been reading about different algorithms and I would really like to use the Nearest Neighbour algorithm, it looks simple and I do understand it based on this tutorial: http://people.revoledu.com/kardi/tutorial/KNN/KNN_Numerical-example.html Problem is, although I understand how to use it to fill in missing data sets, I don't understand how I could use it as a pattern recognition tool to aim in Image Shape Recognition. Could someone please shed some light as to how this algorithm could work for pattern recognition? I have seen tutorials using OpenCV, however I don't really want to use this library as I have the ability to do the pre-processing myself, and it seems silly that I would implement this library just for what should be a simple nearest neighbour algorithm.

    Read the article

  • JavaScript/Dojo Module Pattern - how to debug?

    - by djna
    I'm working with Dojo and using the "Module Pattern" as described in Mastering Dojo. So far as I can see this pattern is a general, and widely used, JavaScript pattern. My question is: How do we debug our modules? So far I've not been able to persuade Firebug to show me the source of my module. Firebug seems to show only the dojo eval statement used to execute the factory method. Hence I'm not able to step through my module source. I've tried putting "debugger" statements in my module code, and Firebug seems to halt correctly, but does not show the source. Contrived example code below. This is just an example of sufficient complexity to make the need for debugging plausible, it's not intended to be useful code. The page <!-- Experiments with Debugging --> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>console me</title> <style type="text/css"> @import "../dojoroot/dojo/resources/dojo.css"; @import "../dojoroot/dijit/themes/tundra/tundra.css"; @import "edf.css"; </style> <script type="text/javascript" src="../dojoroot/dojo/dojo.js"> </script> <script type="text/javascript" > dojo.registerModulePath("mytest", "../../mytest"); dojo.require("mytest.example"); dojo.addOnLoad(function(){ mytest.example.greet(); }); </script> </head> <body class="tundra"> <div id="bulletin"> <p>Just Testing</p> </div> </body> </html> <!-- END: snip1 --> The java script I'd like to debug dojo.provide("mytest.example"); dojo.require("dijit.layout.ContentPane"); /** * define module */ (function(){ //define the main program functions... var example= mytest.example; example.greet= function(args) { var bulletin = dojo.byId("bulletin"); console.log("bulletin:" + bulletin); if ( bulletin) { var content = new dijit.layout.ContentPane({ id: "dummy", region: "center" }); content.setContent('Greetings!'); dojo._destroyElement(bulletin); dojo.place(content.domNode, dojo.body(), "first"); console.log("greeting done"); } else { console.error("no bulletin board"); } } })();

    Read the article

  • C# threading pattern that will let me flush

    - by Jeff Alexander
    I have a class that implements the Begin/End Invocation pattern where I initially used ThreadPool.QueueUserWorkItem() to do thread my work. I now have the side effect where someone using my class is calling the Begin (with callback) a ton of times to do a lot of processing so ThreadPool.QueueUserWorkItem is creating a ton of threads to do the processing. That in itself isn't bad but there are instances where they want to abandon the processing and start a new process but they are forced to wait for their first request to finish. Since ThreadPool.QueueUseWorkItem() doesn't allow me to cancel the threads I am trying to come up with a better way to queue up the work and maybe use an explicit FlushQueue() method in my class to allow the caller to abandon work in my queue. Anyone have any suggestion on a threading pattern that fits my needs?

    Read the article

  • Is Microformat's date-value-pattern fully accessible?

    - by Stephen
    Has there been an announcement (outside microformats.org) that the value-class-pattern is fully accessible? e.g. given <abbr class="value" title="2008-06-24">this Tuesday</abbr>, will a screen reader say "24 June 2008" or will it say "2008 dash 6 dash 24"? History Microformats came along, and were great, except that dates etc were stored in abbr tags: <abbr class="dtstart" title="20070312T1700-06"> March 12, 2007 at 5 PM, Central Standard Time </abbr>` This lead to screen readers doing ridiculous things as noted in hAccessibility. Now that microformats.org have released the value-class-pattern it's a lot better. But I'm left unable to find a declaration from WaSP (or another accessibility source not directly tied to microformats) that declaratively states that they are now accessible to screen readers etc.

    Read the article

  • Winforms Which Design Pattern / Agile Methodology to choose

    - by ZedBee
    I have developed desktop (winforms) applications without following any proper design pattern or agile methodologies. Now I have been given the task to re-write an existing ERP application in C# (Winforms). I have been reading about Domain Driven Design, scrum, extreme programming, layered architecture etc. Its quite confusing and really hard (because of time limitations) to go and try each and every method and then deciding which way to go. Its very hard for me to understand the bigger picture and see which pattern and agile methodology to follow. To be more specific about what I want to know is that: Is it possible to follow Domain Driven Design and still be agile. Should I choose Extreme programming or scrum in this specific scenario Where does MVP and MVVM fits, which one would be a better option for me

    Read the article

  • Singleton pattern and broken double checked locking in real world java application

    - by saugata
    I was reading the article Double-checked locking and the Singleton pattern, on how double checked locking is broken, and some related questions here on stackoverflow. I have used this pattern/idiom several times without any issues. Since I have been using Java 5, my first thought was that this has been rectified in Java 5 memory model. However the article says This article refers to the Java Memory Model before it was revised for Java 5.0; statements about memory ordering may no longer be correct. However, the double-checked locking idiom is still broken under the new memory model. I'm wondering if anyone has actually run into this problem in any application and under what conditions.

    Read the article

  • Java Inter Application Form Communication Observer Pattern

    - by ikurtz
    Observer pattern? Where do i get examples of this in Java (i know google but was hoping for some personal insight also.) On to a proper explanation of my issue: i have 3 forms/windows. "board" is the main form that loads as the application. "chat" is where the text chat takes place. "network" is where network connection is established. i have the game (connect4) working locally and i would like to implement a networked version of it also. my idea is maybe it is related to Observer pattern to have a thread (or something) monitoring network state during runtime and update the chat and board forms of the current network status as well as delivering received data from the network. are my ideas valid? or how should i go about establishing network and network status updates throughout the application? thank you for your input.

    Read the article

  • EF and design pattern

    - by kathy
    Hello, I’m working on a high volume transactional enterprise application(asp.net, windows app, oracle app as client) which has been designed using n-tire application and SOA architecture .The application was developed in the .NET platform utilizing C#,VB.NET, Framework 3.5 (I’m planning to upgrade to the , Framework 4.0), EF( EF in the data layer level) and WCF(WCF services in the service layer level) Since this is the first project using EF, and having read about using EF in n-tier and SOA applications, and the features available in the EF Feature, I have the following points: Which design pattern should I use in EF( Simple Entities, Change Set, Self-Tracking Entities and DTOs) in the data layer level In addition Which design pattern should I use in the other tier and layer to get the best practices of EF Thanks

    Read the article

  • Idiom vs. pattern

    - by Roger Pate
    In the context of programming, how do idioms differ from patterns? I use the terms interchangeably and normally follow the most popular way I've heard something called, or the way it was called most recently in the current conversation, e.g. "the copy-swap idiom" and "singleton pattern". The best difference I can come up with is code which is meant to be copied almost literally is more often called pattern while code meant to be taken less literally is more often called idiom, but such isn't even always true. This doesn't seem to be more than a stylistic or buzzword difference. Does that match your perception of how the terms are used? Is there a semantic difference?

    Read the article

  • split a string based on pattern in java - capital letters and numbers

    - by rookie
    Hi all I have the following string "3/4Ton". I want to split it as -- word[1] = 3/4 and word[2] = Ton. Right now my piece of code looks like this:- Pattern p = Pattern.compile("[A-Z]{1}[a-z]+"); Matcher m = p.matcher(line); while(m.find()){ System.out.println("The word --> "+m.group()); } It carries out the needed task of splitting the string based on capital letters like:- String = MachineryInput word[1] = Machinery , word[2] = Input The only problem is it does not preserve, numbers or abbreviations or sequences of capital letters which are not meant to be separate words. Could some one help me out with my regular expression coding problem. Thanks in advance...

    Read the article

  • Database Replication OOD Pattern

    - by MrOnigiri
    Greetings fellow overflowers, After reading on MSDN about correct strategies on how to perform database replication, and understanding their suggestion on Master-Subordinate Incremental Replication. It left me wondering, what OOD design pattern should I use on this... The main elements of this strategy are the Acquirer, the Manipulator and the Writer. The first fetches data from the database and passes on to the second which might perform simple transformations to the data, before handling it to the final element, the writer, that writes the desired data on the destination Database. I thought about using the Chain of Responsibility pattern, but the Acquirer, Manipulator and Writer don't share a common role among theme, so It makes no sense. Should these elements be written as separate classes, or methods inside my service? Of course I'll be creating a DB Helper class as well, but that doesn't constitutes a problem. Wondering what your opinions on this are! Thanks for your replies

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >