project-structure

AngularJS service in separate file

淺唱寂寞╮ 提交于 2019-12-03 09:50:16
问题 My app.js contains var app = angular.module('myApp', []). config(['$routeProvider', function ($routeProvider, $http) { ... }]); Service looks like app.service('MyService', function () { addNums = function (text) { return text + "123"; } }); And in contoller I have function adminCtrl ($scope, MyService) { $scope.txt = MyService.addNums("abc"); }; They are all in separate files. The problem is that I'm getting an error Unknown provider: MyServiceProvider <- MyService Looks like I'm doing

Web project's folders/directories structure - Best practices

前提是你 提交于 2019-12-03 07:22:42
问题 I’m working on different web projects and I was wondering if there is any rule of thumb regarding the project/ folders structure? Many of my apps are build in the structure where each file type has it’s own directory. For example: └─┬root | ├─┬node_modules | └ // node_modules (npm libraries) | └─┬www | ├─┬Libs // Js libraries | | | ├─┬Angular | | └ … (.js files) | | | └─┬Bootstrap | └ … (.js files) | ├─┬JavaScript // my Js files | | | ├─┬Services | | └ … // my services (.js files) | | | ├─

Structuring python projects without path hacks

半腔热情 提交于 2019-12-03 06:19:02
问题 I have a shared python library that I use in multiple projects, so the structure looks like this: Project1 main.py <--- (One of the projects that uses the library) ... sharedlib __init__.py ps_lib.py another.py Now in each project's main.py I use the following hack to make it work: import os import sys sys.path.insert(0, os.path.abspath('..')) import sharedlib.ps_lib ... Is there a way to do it without using this hack? Or is there a better way to organize the projects structure? 回答1: I think

Clean solution (project) structure with EF, Repositories, Entities

我只是一个虾纸丫 提交于 2019-12-03 05:18:02
问题 I like to keep the structure of the project as clean as possible. Sample: --BlogApp.sln --BlogApp.Data BlogModel.edmx (the EF mappings) Post.cs (I end up having partial classes in here with attributes) --BlogApp.Domain --Entities Post.cs (I would like to have my POCOs here with all its additional logic) --Repositories PostsRepository.cs --BlogApp.Ui (standard MVC structure) I end up with mess when using EF as my ORM. Could anybody suggest some "clean" way to structure the project? Or maybe

What Project Layer Should Screen DTO's Live In?

依然范特西╮ 提交于 2019-12-03 05:16:06
问题 I have a project where we use screen DTO's to encapsulate the data between the Service Layer and the Presentation Layer . In our case, the presentation layer is ASP.Net. The only classes that know about the DTO's are the service layer classes and the Pages/Controls that call these services and display the DTO's. The DTO's are almost always Page/Control specific so I feel they belong in the Presentation Layer, but that would mean the Service Layer would have to reference the Presentation Layer

How do you organize 100+ projects in Eclipse?

纵饮孤独 提交于 2019-12-03 04:35:46
When you have 5+ languages and 100+ projects, IMO the default of using one workspace is not acceptable because the one workspace becomes horribly disorganized. Having one huge unorganized workspace lowers your productivity. The question: What are the more advanced ways of using Eclipse when you have 5+ languages and 100+ projects? I would really appreciate advice that elaborates a little bit more than just giving one sentence like "use multiple workspaces" or "use working sets". "Must have" requirements: The project navigator only shows related projects (like only projects from abc language or

What is a very *simple* way to structure a python project?

一世执手 提交于 2019-12-03 04:18:24
So I have this python thing that needs to process a file. First it was: my_project/ ├── script.py And I would simply run it with python script.py file.csv . Then it grew and became: my_project/ ├── script.py ├── util/ │ └── string_util.py ├── services/ │ └── my_service.py (There is an empty __init__.py in every directory) But now my_service.py would like to use string_util.py and it's so damn not straightforward how to do this nicely. I would like to do from ..util import string_util in my_service.py (which is imported into script.py with from services import my_service ), but that does not

How do you manage your Delphi Projects with third-party components in Version Control?

我只是一个虾纸丫 提交于 2019-12-03 01:59:57
问题 Installing third-party components always take a long time specially if you have large ones, but also it take more time if you setup the environment in more than one computer. And I'm thinking to add them to the Version Control (Subversion), so it will be always easy to checkout the project with all it's required components. So how you manage that, and what's the best practice to manage them inside the VCS? Also consider some of these third-parties come without source but as Delphi libraries.

Web project's folders/directories structure - Best practices

这一生的挚爱 提交于 2019-12-02 20:56:30
I’m working on different web projects and I was wondering if there is any rule of thumb regarding the project/ folders structure? Many of my apps are build in the structure where each file type has it’s own directory. For example: └─┬root | ├─┬node_modules | └ // node_modules (npm libraries) | └─┬www | ├─┬Libs // Js libraries | | | ├─┬Angular | | └ … (.js files) | | | └─┬Bootstrap | └ … (.js files) | ├─┬JavaScript // my Js files | | | ├─┬Services | | └ … // my services (.js files) | | | ├─┬Controllers | | └ … // my controllers (.js files) | | | ├─┬Directives | | └ … // my directives (.js files

Clean solution (project) structure with EF, Repositories, Entities

拈花ヽ惹草 提交于 2019-12-02 19:39:23
I like to keep the structure of the project as clean as possible. Sample: --BlogApp.sln --BlogApp.Data BlogModel.edmx (the EF mappings) Post.cs (I end up having partial classes in here with attributes) --BlogApp.Domain --Entities Post.cs (I would like to have my POCOs here with all its additional logic) --Repositories PostsRepository.cs --BlogApp.Ui (standard MVC structure) I end up with mess when using EF as my ORM. Could anybody suggest some "clean" way to structure the project? Or maybe you could suggest some standard project structure that is most commonly used. My preferred structure is: