software-design

What PHP application design/design patterns do you use?

和自甴很熟 提交于 2019-12-03 00:02:37
问题 Please share your favorite application design / design patterns for use in PHP with me. Some things I'd like to know: How your folders are designed How you use object oritentation in your PHP applications Do you have a standard way of dealing with CRUD, pagination, or any other common tasks? How do you avoid using repetitive code? What's your approach to libraries/sharing common code, etc? What are ways in which you can make your code more elegant? You don't have to answer all of these,

Find Number of CPUs and Cores per CPU using Command Prompt

余生颓废 提交于 2019-12-02 18:50:56
I am trying to retrieve the Number of CPUs and Cores per CPU using Command Prompt. I have executed the following command: wmic cpu get NumberOfCores, NumberOfLogicalProcessors/Format:List I get this error: wmic' is not recognized as an internal or external command, operable program or batch file I am executing this on a Windows Server 2008 R2 machine. I believe the 'wmic' command is compatible on this windows. The directory I am running the command promt from is 'C:\Windows> Any advice please? Based upon your comments - your path statement has been changed/is incorrect or the path variable is

What are the DAO, DTO and Service layers in Spring Framework?

给你一囗甜甜゛ 提交于 2019-12-02 14:08:20
I am writing RESTful services using spring and hibernate. I read many resource in internet, but they did not clarify my doubts. Please explain me in details what are DAO , DTO and Service layers in spring framework? And why usage of these layers is required in spring to develop RESTfull API services. First off, these concepts are Platform Agnostic and are not exclusive to Spring Framework or any other framework, for that matter. Data Transfer Object DTO is an object that carries data between processes. When you're working with a remote interface, each call it is expensive. As a result you need

What PHP application design/design patterns do you use?

纵饮孤独 提交于 2019-12-02 13:49:48
Please share your favorite application design / design patterns for use in PHP with me. Some things I'd like to know: How your folders are designed How you use object oritentation in your PHP applications Do you have a standard way of dealing with CRUD, pagination, or any other common tasks? How do you avoid using repetitive code? What's your approach to libraries/sharing common code, etc? What are ways in which you can make your code more elegant? You don't have to answer all of these, answering any or a few of these will be helpful. The reason I'm asking this,is because I'm very tired of

Can a use-case include and precondition the same other use-case?

断了今生、忘了曾经 提交于 2019-12-02 07:20:18
Let's take the example of logging in and add item as two use case of an items management system. the requirements of the client are : (he needs/wants to : ) Gain legitimate access to the resources of the system; Add Item (create one). we also know that no unauthenticated user should use the system ! My questions are : 1) Is " Gain Access " a use case ? A precondition to other use-cases ? Or Both ? (knowing that by naming the use-case " Gain Access " and not "Logging in" I wanted to highlight the need rather than the solution to that need. 2) if " Gain Access " is a use-case, does the " Add

In MVC pattern, can the Model interact / modify the View?

江枫思渺然 提交于 2019-12-02 01:10:50
The MVC pattern component interactions are described this way on Wikipedia: The model is responsible for managing the data of the application. It receives user input from the controller. The view means presentation of the model in a particular format. The controller responds to the user input and performs interactions on the data model objects. The controller receives the input, optionally validates it and then passes the input to the model. I understand that the View should not be able to interact with the Model. But in most of the diagrams I find on the net, MVC is represented like this: We

How to get feedback on design [closed]

ぃ、小莉子 提交于 2019-12-01 11:26:41
As we know design is most important part of Software Development, I want to practice it. But problem is, I cannot get feedback on my design, is there any website where we can submit design (like UML diagrams) and community will review it. Thanks in advance. Joris Van Regemortel Use the Code Review section on stackexchange. 来源: https://stackoverflow.com/questions/17396594/how-to-get-feedback-on-design

Extract and Clean HTML Fragment using HTML Parser (org.htmlparser)

狂风中的少年 提交于 2019-12-01 05:18:02
I'm looking for an efficient approach to extracting a fragment of HTML from a web page and performing some specific operations on that HTML fragment. The operations required are: Remove all tags that have a class of "hidden" Remove all script tags Remove all style tags Remove all event attributes (on*="*") Remove all style attributes I've been using HTML Parser (org.htmlparser) for this task and have been able to meet all of the requirements, however, I don't feel that I have an elegant solution. Currently, I am parsing the web page with a CssSelectorNodeFilter (to get the fragment) and then

Extract and Clean HTML Fragment using HTML Parser (org.htmlparser)

拜拜、爱过 提交于 2019-12-01 02:46:56
问题 I'm looking for an efficient approach to extracting a fragment of HTML from a web page and performing some specific operations on that HTML fragment. The operations required are: Remove all tags that have a class of "hidden" Remove all script tags Remove all style tags Remove all event attributes (on*="*") Remove all style attributes I've been using HTML Parser (org.htmlparser) for this task and have been able to meet all of the requirements, however, I don't feel that I have an elegant

Twitter-like app using MongoDB

爱⌒轻易说出口 提交于 2019-11-29 20:31:18
I'm making an app that uses the classic "follow" mechanism (the one used by Twitter and a lot of other apps around the web). I'm using MongoDB. My system has a difference, though: an user can follow groups of users. That means that if you follow a group, you'll automatically follow all the users who are members of that group. Of course users can belong to more than one group. This is what I came up with: when user A follows user B , id of user B gets added to an embedded array (called following ) in user A's document for unfollowing, I remove the id of the followed user from the following