w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to handle business logic errors and application exceptions from business logic layer in MVC ASP.NET
I think it is a good idea to look at this sample. When ever an error occurs in Business logic layer you can return false or say -1 for a method of Business class, then show proper error message to user, and in catch part of the business method you can use one of popular error logging libs like Log4NET or elmah. Edited: To redirect user when error occurs you can specify the error controller in custom error section of web config

Categories : Asp Net Mvc

how to bind menuitem to another project in same solution
Use This : string Path = Request.Url.GetLeftPart(UriPartial.Authority) + VirtualPathUtility.ToAbsolute("~/"); Path will contain your current localhost/CurrentOpenedProject, replace it by Project required by using : Path = Path.Replace("CurrentOpenedProject", "RequiredProject"); You can add this to menuItem like this: for(int i = 0; i < Menu1.Items.Count;i++){ Menu1.Items[i].NavigateUrl = Path; }

Categories : C#

MVC: Where to put business logic?
I like to keep my models clean I.e. Just with properties and no business logic. I always think its good to inject dependencies into the controller and these dependencies contain the logic I perform on my models. I like to adhere to the single responsibility principle where possible and I find that models with tons of methods get bloated very quickly. There's pros and cons for both, injecting a lot of dependencies has an overhead yet allows to test in isolation and keeps classes simple and you'll end up having leaner controllers. Despite my logic not actually existing on my model as members of the class, its still business logic. I tend to not have business logic defined in the controller as mocking things like the Httpcontext are a bit of a nightmare and unnecessary.

Categories : C#

How did my Xcode project get changed from iOS project to an OSX project?
By your comment you should not have an issue navigating this. Go to your Project (in upper left) -> Project (project name in submenu) -> Build Settings -> under Architectures menu select Base SDK and choose iOS 6.1. This should switch your project back. Now under Info you should see your Deployment Target options have switched from saying OS X Development Target to iOS Development Target As for why it originally changed, I have no idea. But hopefully this will fix your issue.

Categories : Xcode

JSP display first then do business logic
JSP is serverside language, the whole page is rendered, then send back to browser/client. So with JSP you cannot do this. You can include javascript in your jsp page, which talks to a webservice that does the logic you want it to do. The webservice can also return data that you can use to update your page... I suggest you lookup AJAx on the web, a good place to start is: http://www.w3schools.com/ajax/

Categories : Java

Project has no project.properties file! Edit the project properties to set one error
Why don't you do this Right click on Project Root folder > properties > Java BuildPath > Library Tab Check whether any of library is missing (showing error with red cross) if yes then add this library to your project don't forget to CHECK it on Order and Export Do one more thing Right click on Project Root folder > properties > Android > set your Project Build Target check any one target Check your Android-sdk path from Window > Preference > Android

Categories : Android

C# Entity Framework and Business Logic
As far as I understand your question, you want to control the graph of entities which are related to a project object. You can leave the repository layer intact and put another layer (business layer) on top of it to enforce the rules.

Categories : C#

Node.js and Complex Business Logic
Managing complex business logic with node is possible. I can give you some tips : Code organization point of view Think async Easy to say, but when I began node, comming from C programming, it wasn't easy at all. If you have something like : read(function(){ //some stuff write(function(){ //some other stuff [etc...] } } Your code should probably be : var onRead = function(){ //some stuff write(onWrite); } var onWrite = function(){ //some other stuff } read(onRead); or even better : Make a onRead module ? wich lead me to second advice : Make modules A lot of them. And load them on start. A 50 line module can't really be that complicated to read, can it? It takes some time to get accustomed with this, but you'll feel at home really quickl

Categories : Node Js

Should all business logic be in domain models or?
It is recommended that you have a thin code on controllers , it's better you handle business logic in another layers like serviceLayer that i have used it before which the returns you a view model of what you have wanted to return to your view/controller. Even define your ajax methods inside a service layer class.Which decrease code complexity and maintainability problems.Even it is more readable .. In you Controller you can use DI to inject the serviceLayer class or instansiate it as ServiceLayer test = new ServiceLayer() ; then in you controller test.registerCustomer(model); // or test.registerCutomer(CustomerViewModel);

Categories : C#

ASP.Net MVP - One Business Logic class per Presenter?
Model-View-Presenter is a user interface design pattern engineered to facilitate automated unit testing and improve the separation of concerns in presentation logic, so there is no problem that you have multiple business logic classes. If you want to separate your business logic to take benefit of separation of concern you should use modularity design pattern.

Categories : Asp Net

Where should I place business logic when using RavenDB
There's two main parts to consider here. Firstly, as you have already noted, if you go by the word of the more fanatical RavenDB fans it is some mythical beast which is exempt from the otherwise commonly accepted laws of good application design and should be allowed to permeate throughout your application at will. It depends on the situation of course but to put it simply, if you would structure your application a certain way with something like SQL Server, do the same with RavenDB. If you would have a DAL layer, ORM, repository pattern or whatever with a SQL Server back-end, do the same with RavenDB. If you don't mind leaky abstractions, or the project is small enough to not warrant abstracting your data access at all, code accordingly. The main difference with RavenDB is that you're g

Categories : C#

How to integrate a C# server with C++ business logic
Another option is to expose your C++ library as COM+. This way your C# web-service can easily use the C++ library. For .NET - COM+ interoperability see: MSDN

Categories : C#

Zend Framewok 2, Doctrine 2 and where do Business logic fit in
You have the right idea. To de-couple Doctrine 2 more you can create another layer that follows one of the interfaces in ZendDb, but uses Doctrine to accomplish the database interaction. Also, for verification you can create custom input filters for the form that check against the database using Doctrine. The idea is that whatever is behind the service can be replaced by changing the service as long as the method names remain the same. This way you could later replace Doctrine with Propel, for example, and you wouldn't have to refactor your controllers & views, just the service class.

Categories : PHP

WCF data service - where would I write business logic
We were looking at OData for the same reasons and while there appears to be some hooks in place for doing custom processing, we too were left with the same "where does the logic go?" question. In my opinion, whatever value we would have gotten from the OData format and the WCF Data Services framework would eroded fairly quickly over time because the framework seem to demand we expose our raw data source (in our case SQL Server via NHibernate) and provides no way to do anything real-world logic-wise. This not only made it hard to see how we could move our existing RPC style SOAP services on traditional WCF to this platform, but it wasn't clear how you would use this to do anything, but vanilla CRUD. I like to say... the only real world app that's truly "just a CRUD app" is an app where S

Categories : Wcf

Expressions - how to reuse business logic? How to combine them?
I can fix your expression generator, and I can compose your GetDisplayNameExpression (so 1 and 3) public class Member { public string ScreenName { get; set; } public string Name { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public static Expression<Func<Member, string>> GetRealNameExpression() { return m => (m.Name + " " + m.LastName).TrimEnd(); } public static Expression<Func<Member, string>> GetDisplayNameExpression() { var isNullOrEmpty = typeof(string).GetMethod("IsNullOrEmpty", BindingFlags.Static | BindingFlags.Public, null, new[] { typeof(string) }, null); var e0 = GetRealNameExpression(); var par1 = e0.Parameters[0]; // Done in this

Categories : C#

How do I use a Java project that requires a 1.7 compliance level on an Android project build path?
Try to clean your project, and fix android properties. Link here and here

Categories : Android

Failed to import Gradle project error creating new project with Android Studio
I had same issue with the latest Android Studio () today, and I finally found that configuring a https proxy for Gradle can solve the issue. I only set a http proxy at the beginning. Gradle needs to sync some files via HTTPS. Use IP address instead if hostname of proxy can't work.

Categories : Android

How to make Visual Studio Setup Project to require but not include a given project output?
In VS 2010 in the solution navigator there is a small icon called "Launch Conditions editor". There you can search on the target machine for resources and create "Launch conditions" which binds your wanted message texts ("The file xx was not found...") against the property chosen for the resources.

Categories : Visual Studio 2010

How to configure the Project ( depends on maven/web.xml/servlet APi) AJAX call not to include the Project name in it?
What worked for me is in the Pom.xml i added this <finalName>Jira-Synchronization</finalName> under the <build> tag and that was able to output the WAR with the desired name as i like

Categories : Java

Maven error: Failed to execute goal on project : Could not resolve dependencies for project
The first thing is you are having the wrong credentials for the repository ...(http://www.jets3t.org/maven2): Access denied to: http://www.jets3t.org/maven2/org/... Apart from that the repository does not look like Maven repository. And also the http://ericbottard.github.com/cloudfoundry-tomcat-7 gives a page not found which gives me the impression this is not a valid repository. Furthermore i would suggest first to use Maven Central only which means no repository entries in your pom.xml files which is the wrong way at all. Just check if it works without the repository definition. If you really need to define other repository better use a repository manager (Artifactory, Nexus, Archiva). One other thing is that i see in your pom the version which is a released versions already in c

Categories : Maven

Duplicate Storyboard files appeared in Xcode project Directory. Barely able to run project
For each storyboard file name (or really any resource in Xcode) you should only have one source document with that file name. Resources with the same name are all mapping to the same output file, and you're seeing results of this undefined behavior resolve in various ways. So if you have this: ProjectRoot/Base.lproj/MyStoryboard.storybaord ProjectRoot/Folder/Folder/Base.lproj/MyStoryboard.storybaord Then both of those documents map to the same output file. You need to either delete the one at ProjectRoot/Base.lproj or the one at ProjectRoot/Folder/Folder/Base.lproj, but do not keep both documents.

Categories : Iphone

Target "qnx" does not exist in the project "Build and deploy a Cordova BB Webworks project"
I think that as of Cordova 2.8 this may have changed. We're in the process of doing some new documentation updates for BlackBerry 10 right now. If you head on over to the Cordova 'Getting Started Guide' I think it'll get you moving in the right direction again. http://cordova.apache.org/docs/en/2.8.0/guide_getting-started_blackberry10_index.md.html#Getting%20Started%20with%20BlackBerry%2010

Categories : Cordova

Why do I keep getting 'Assembly must be specified for XAML files that are not part of a project' errors in a local project?
Is the project ON a network drive? XAML has issues with projects stored on a network drive. In corporate environments your Documents are often remapped to a network path, causing this problem for the default project folder. Try like c:projectsyourprojecthere instead? WPF Project on a network share with clr-namespace

Categories : Wpf

VC++ Winforms auto generated project won't debug VS2010: "This Project is out of Date"
The default VS settings are not entirely compatible with your desired one-click-does-all usage. C++ programmers normally favor building the program explicitly. Use Build + Build or press the shortcut keys for that command. You can change that. Use Tools + Options, Projects and Solutions, Build and Run. Note the "On Run, when projects are out of date" setting. Change it to "Always build". The one below that is best changed to "Do not launch".

Categories : C++

Getting error while running AppFuse project: "Failed to execute goal on project"
As you said you are using modular appfuse application. In appfuse modular application two module exists: core and web. Web module depends to core module. So you should first install the core module. Try this code in your core module directory: mvn install

Categories : Java

Test Project in Visual Studio 2010 for a Windows Service Project
Do you want to debug the service or code that service runs? In the past I would create one project for a service, one project for a library that contains the logic, and one project for a console app that would be used to test and debug the logic locally. That setup covered most of the debugging needs. Hope this helps!

Categories : Visual Studio 2010

SBT: How to make one task depend on another in multi-project builds, and not run in the root project?
I may be wrong, but you are defining the verify task dependency only for the current project. Maybe you can try: Seq( verifyTask in Global := {}, verifyTask <<= (verifyTask in Global).dependsOn(scctTestTask, scalastyleTask) ) Or you can add the verifyTask settings to all your modules.

Categories : Scala

Choosing the right project type and Windows Azure Services for SignalR ASP.NET project
Take a look at SignalR Scaleout - most likely, you want to develop your web application and deploy the web application to an Azure Cloud Service. The Cloud Service runs any number of instances behind a load balancer without any configuration on your part other than pointing your CNAME record to the Cloud Service. For the SignalR part, to make it scalable, you will want to use the Azure Service Bus Relay as a backplane for your SignalR implementation (again, load balanced without you having to woory lots about configuring/maintaining). The referenced example is a good start.

Categories : Azure

java servlet project and android library project in eclipse - NoClassDefFoundError
First of all - I believe Java Web Project will not work with any of Android specific classes due to many reasons. If your MonitoringModel contains some Java code that you want to share between Android and Web application you can extract it to separate Java project and use a Link Source option in Properties->Build Path to link it to both projects.

Categories : Android

why won't this richfaces demo project work in myeclipse web project with maven support
That's a dependency conflict for some google's library, probably guava or google collection. To fix it, you need to have a look into your dependency tree. As you're using myeclipse, open your pom.xml file and in the tabs below select the dependency hierarchy view. Then search for the dependencies I told you. There can be different problems: You're excluding a dependency for an artifact which needs it. Maven is resolving a conflict with new Google's dependency, but this method is in the old one and a third-party library you are using makes use of it. In this case you should try to update your third party library or downgrade the version of the one you're using by your own. For some artifact, you included a version of the API dependency and other version of the implementation. In this case

Categories : Java

Double facebook sdk import, in my android library project and in target project
I faced the same problem, this is what i did. Hope it helps you too. Remove all the libraries in your project.(Properties->javaBuildPath->library(tab)->select dependancy folder->remove) Now go to libs and remove the library.(your project will show some errors, never mind) Finally import the library that contains the sub library.

Categories : Android

How do you include files from a scala project in eclipse in a java project in netbeans
If you are developing a library in your Scala application, i would suggest to use sbt and package the library as a jar and import that jar to your java project. You will have to define a build file in sbt. I am not sure whether you already defined it and use the sbt package command. sbt package Try using sbt

Categories : Java

Disable project migration dialogue when opening a SharePoint 2010 project
I've found how to manage this. Update your .csproj file for SP 2010 project. Set <TargetOfficeVersion>15.0</TargetOfficeVersion> So now it will not ask you for migration anymore when opening in SP 2013 machine. But you will not be able to build the project on 2010 machine. So you can put following code to the .csproj.user file: <PropertyGroup> ... <TargetOfficeVersion>14.0</TargetOfficeVersion> </PropertyGroup> The revision control system(like SVN or Git) is usualy configured to ignore .csproj.user files. So if this file is not ignored by revision control system - add it to ignore list. That's it. Everyone who opens a project on a SP 2013 machine will not see a migration dialog. Everyone who needs to work on SP 2010 - just update the

Categories : Visual Studio 2012

NoSuchMethodError occuring in normal java project and not in J2EE project ( Eclipse)
NoSuchMethodError happens when you write code for one version of a class and then run it with another that does not have a the method that you use. From the documentation: Thrown if an application tries to call a specified method of a class (either static or instance), and that class no longer has a definition of that method. Normally, this error is caught by the compiler; this error can only occur at run time if the definition of a class has incompatibly changed. Make sure that you have the same versions of the library that is giving the error in both environments. If the error is thrown for a method that you wrote yourself you have a mixture of classes from different builds. Try deleting all class files and doing a clean build.

Categories : Java

Eclipse: How to import git project as library for Android Project which has to be pushed to Bitbucket
If the library is a .jar file, you can simply paste it into the libs folder of your app. Android should automatically add it to the build path. As far as pushing/pulling from BitBucket goes, as long as you add the .jar file in git the library will be committed like any other file.

Categories : Android

Trying to create a project in a sub folder gives " overlaps the location of another project" error
1-Take for workspace "MyBook" 2-In eclipse, create a "Java project" ch-01. 3-right click on ch-01 , new, project "MyExampleApple" for each folder like ch-01 do number 2 and 3. :) This will create a subFolder in your Workspace and a project inside this subFolder. workspace subfolder project MyBook Ch-01 MyExampleApple :D

Categories : Java

git pull/merge between base application project and specific client project
One approach is to have a "common" branch, that is ideally a product in its own right but can be just a base for different customizations. From that you branch off "client1", and make the changes. Same for other clients. Just the custom things. Do most work on the common, and keep merging it to all customized branches. If you can keep the custom stuff in a single commit (or just a few), you can instead keep rebasing those on top of common, that way is easier to look through. Which is better depends on the actual workflow and nature/amount of differences.

Categories : GIT

Visual Studio: Programmatically Create Project Items in project directory
That's roughly how I add my cpp file, should be no different in your case. The code will add the file under "SourceFilesSomeFolder" in the project and also in the "Source Files" folder in the project view tree (it should be already there). Project project = null; // you should get the project from the solution or as active project or somehow else string fileName = "myFileName.cpp"; string fileRelativePath = "SourceFiles\SomeFolder\" + fileName; // First see if the file is already there and delete it (to create an empty one) string fileFullPath = Path.GetDirectoryName(project.FileName) + "\" + fileRelativePath; if (File.Exists(fileFullPath)) File.Delete(fileFullPath); // m_applicationObject here is DTE2 or DTE2 string templatePath = (m_applicationObject.Solution as Solution2).Projec

Categories : C#

Java reflection: How can I load a class from another project without adding that project or JAR to my classpath?
You need to implement a custom classloader, something like this Class<?> cls = new ClassLoader() { public java.lang.Class<?> loadClass(String name) throws ClassNotFoundException { byte[] a = read class bytes from known location return defineClass(name, b, 0, a.length); }; }.loadClass("test.MyClass");

Categories : Java

Intellij Idea's Project view doesn't show all project files
Most likely the project was imported into IDEA, but it's not a pure Java project. Note that non-Java projects cannot be imported from the existing sources using the Import option. You should create a new project, select the appropriate module type and then point to the existing directory with the code when creating the module. Other options are to import from Maven/Eclipse/Gradle. There is a known issue logged. If it's not the case, please share a sample project (zipped) that will reproduce the problem.

Categories : Intellij Idea

© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.