w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Shared classes for Android and Spring MVC projects
Including the android project in a Spring MVC project doesnt make sense You should build a standalone standard java project (that compiles and is built to a JAR file) that contains all the code that is shared between the android and springmvc project. This common JAR file should then be included in both the android project and Spring MVC project. Pretty simple really :) If you are using Maven you can include it as a dependency (Which will be the cleanest approach) if not then just manually include the JAR in each of the projects.

Categories : Android

Duplicate classes R & BuildConfig after "Reimport All Maven Projects"
From your description above I guess that your project structure differs from the maven default. See Introduction to the POM. But I think the android android:generate-sources is more interesting if you have changed the assets directory etc. Example: <sourceDirectory>${basedir}/src</sourceDirectory> <outputDirectory>${basedir}/target/classes</outputDirectory>

Categories : Android

How to add templates to java classes for existing projects in eclipse
I think you can use this Copyright Wizard plugin. Search in the eclipse market place. There is a guide which will help you on this.

Categories : Java

asp.net application with multiple projects cannot load type of page code
It sounds like you may have just broken a reference in the main project. Whenever you remove a project that is referenced by project, it automatically removes it as a dependency wherever it's used.

Categories : C#

Gitlab's API (GET /projects/:id/repository/tree) throws 404 page not found
The Gitlab API page ""Status Code" section mentions: 404 Not Found A resource could not be accessed, e.g. an ID for a resource could not be found So either the id is incorrect (which it shouldn't be if other API calls succeeds). Or 'tree' isn't enough, but a path should be provided (unless the project tree is empty). Or there is some kind of permission issue which would prevent, on the server, the API to access the content of that repo. But if the issue persists for any path, then it is worth to add that case to the list of GitLab issues. As the OP mentions, that is also an indication that the API isn't available in the code.

Categories : GIT

Is it possible to share library projects between projects when using Android Studio and gradle?
Couldn't you use git with submodules? e.g. In your .gitmodules file, you may add this: [submodule "volley"] path = volley url = https://path/to/volley/repository You can set the url to Volley's official repository, or to your own in-house version of volley. Other projects can be setup the same way and point to the same volley repository. I think this way, other users can call git clone and all the dependent projects will be downloaded within the main project folder and they don't have to worry about downloading the library projects separately. For Volley though, I would just compile it into a JAR file and stick it into the /libs folder of the main project. That is, if you don't need to modify its source. [Update] For library projects that you don't need to modify its source, you ca

Categories : Android

ASP Page directive inherits structure
This is a uniform syntax known as "assembly qualified naming" in .NET and you can read about it here: AssemblyQualifiedName

Categories : C#

Using page directive instead of master in umbraco
I'm not sure why you're trying to create a child template as a page and not a master and expect it be visible in Umbraco. This isn't how Umbraco works. Whilst in webforms mode, Umbraco only uses masterpages to generate pages. You can create child masterpages and this is a common practice. However 'pages' are created dynamically by Umbraco so you don't have to. If this is confusing you then I'm afraid you're best option is to read the documentation at our.umbraco.org and start with the basics. If you are trying to achieve something specific, then you need to provide more information in your question.

Categories : C#

Should every "component" on a page be a directive in angularJS
Directives allow you to reuse code. I would certainly put everything that is reused into a directive. To avoid repeating yourself, you should use directives. I would even go as far as to say that even if you're not repeating yourself, i.e. the code is only in one place, you should also make it into a directive. Directives that are used only in one place does not reduce code, but it does separate concerns. I see directives as analogous to classes. Instead of a huge block of code, class scoping enforces that classes be standalone blocks. Likewise, creating directives with their own scope makes them standalone blocks that interact with their surroundings in a limited way. ngInclude is a little different. I would see it as the equivalent of eval, or C's #include. You do get a little separat

Categories : Javascript

Error parsing attribute on @page directive
That's not the way the Page directive works. You're asking it to understand your derived class even before the page is parsed. You should put this in the Page_Init() event of Manager_Info_services.

Categories : Asp Net

How to have an angularJS directive on a page called via ajax?
rGil fixed the jsFiddle. It was missing a ng-app="pddc" declaration on an element so Angular did not know where to begin its magic. I'd like to mention another way to render to the data in question. I suggest using an ng-repeat within an ng-repeat. See my forked & updated fiddle here. You can actually refer to the parent theme within the ng-repeat of the subtheme, so you don't have to copy values from the parent theme into each subtheme (which effectively eliminates the need for the directive in this example). Another reason to use a nested ng-repeat is because of async issues that could come up when pulling data from a web service asynchronously. What could happen is when the directive executes, it may not have any data to loop through and populate because the data hasn't arrived ye

Categories : Javascript

Firefox adds 5mm additional margin to @page directive
Try this: @page { /* for for all browsers except Firefox */ size: A4 portrait; margin: 30mm; padding: 0; } @-moz-document url-prefix() { /* only for Firefox, page margin - 5mm */ @page {margin:25mm;} }

Categories : HTML

Dynamic Compilation in Memory for Java for classes and classes that have dependencies on those classes
I believe your problem is in the JavaSourceFromString class, which needs to encode a URI for the class name: @Test public void test(){ Map<String, String> code = new HashMap<String, String>(); code.put("example.A", "package example; " + "public class A { " + " public A() { " + " doSomething(); " + " } " + "}"); code.put("example.B", "package example; " + "public class B { " + " private A holderForA; " + " public B() { " + " this.holderForA = new A(); " + " } " + "}"); JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); Diag

Categories : Java

How to make list of all classes in the page using jQuery?
jQuery has an attribute selector - choose only elements which have class atribute :) Then split class attribute string (for cases like class="one two") and add them to array (dont forget to check if class is not empty or isnt already in the array. Use this.valueOf() for checking and saving the string :) var classes = []; $('[class]').each(function(){ $($(this).attr('class').split(' ')).each(function() { if (this.length>0 && $.inArray(this.valueOf(), classes) === -1) { classes.push(this.valueOf()); } }); }); console.log("LIST START "+classes.join(' ')+" LIST END"); JSFiddle link : http://jsfiddle.net/MWJKL/

Categories : Jquery

Is there any way to import classes to the jsp page (jsp+eclipse+java)
Ctrl+shift+o does not work in eclipse for jsp file although you can just try writing <%@page import="com and then crtl+space it should provide you all the classes and package available. One more thing... Try this: Type YourClassName anywhere on your JSP which you want to import and just hit crtl+space it will automatically add following line <%@page import="package.YourClassName"%>

Categories : Eclipse

How to load classes based on pretty URLs in MVC-like page?
I think you are over thinking this one.... So the controller/resource is a blog....the method that all of them should run from is "read" (using crud...I usually call it data but basically its your select). Now just have your method accept a category value that automatically gets mapped based on the url.... here is a sample...completely untested but just to show you the idea (using pdo) public function data($id = 0, $category = 0){ if (isset($id) AND $id != 0){ $bind = array(":id", $id); $results = $db->query("SELECT * FROM blog WHERE blog_id = :id", $bind); return $results[0]; } else if (isset($category) AND $id != 0){ $approved_categories = array("cosplay","game","movie","series"); if (in_array($category, $approved_categories)){

Categories : PHP

What to do about those page specific little classes that don't seem to fit as Models or Libraries in CodeIgniter?
I would use a helper. When a helper is loaded, that function will be available in the global scope so you can call it anywhere. They're great for small, stand-alone functions that do only one thing that is not necessarily related to code in a model or library Helpers especially excel for me when converting things between one format or another (slugify, convert_timezone, change_query_string) or doing little tasks that you don't want to think about (force_ssl, is_image, uri_string) funkify() seems like an appropriate helper function that may prevent a lot of repeated code. Here's the codeigniter documentation page on them: http://ellislab.com/codeigniter/user-guide/general/helpers.html If you're in a situation where the helper function is so specific it will be only used in one place,

Categories : PHP

Does having a lot of unused classes/rules have any performance impact on a web page?
Well, since the browser has to download and parse the entire file, it'll have an impact. How big of an impact it is depends on how big the file is, how fast is the computer said browser is running on, and how fast is the user's internet connection. I've just tried a .css file of 10 000 rows full of redundant information, spreading the relevant styles all over it. None of my browsers actually seemed to give a damn, and I didn't notice any visible slowdown (bear in mind the file's on localhost). It still doesn't make it a particulary good idea tho.

Categories : HTML

Is it possible to call functions from parent directive controller, when subsidiary directive has isolated scope
directives can share controllers via the require property, that you correctly specified. this is what Angular's docs on directives say about accessing the directive's controller (emphasis added): "require - Require another directive and inject its controller as the fourth argument to the linking function. The require takes a string name (or array of strings) of the directive(s) to pass in. If an array is used, the injected argument will be an array in corresponding order. If no such directive can be found, or if the directive does not have a controller, then an error is raised" IMHO, when applied to your case, this means that the link function where the controller is injected is the one in your child directive, not in the parent

Categories : Javascript

Rendering AngularJS directives from array of directive names in a parent directive or controller
So the second attempt would have worked had I used $compile on the prepended directives like so: .directive('parentDirective', function($compile) .... element.prepend($compile('<div ' + scope.directives[i] + '"></div>')(scope));

Categories : Javascript

Directive model binding doesn't work under angular ui bootstap tabs directive
The AngularUI boostrap directive creates a child scope, so a quick fix is to use the following inside your "Second" tab: <my-directive ng-model="$parent.ranges"></my-directive>

Categories : Angularjs

How to prevent transcluding directive to create new child scope for the form directive?
An interesting question, but a problem that's easily avoided by using <form name="appForm" ng-submit="submit(appForm.$valid)"> and checking the parameter in the submit function. http://jsfiddle.net/udMJ7/ Another (perhaps better) option is to use this which is set to the scope of the last controller (in this case the form controller, which we want) $scope.submit = function(){ if(this.appForm.$valid){ //post the form!! } }; http://jsfiddle.net/udMJ7/1/

Categories : Angularjs

bind event in a directive doesn't work if the directive is in a ng-repeat loop
you need app.directive('mySelect', function() { return { restrict : 'E', template : '<select><option>1</option><option>2</option></select>', link : function(scope, element, attributes, ngModelCtrl) { element.bind('change', function() { console.log("change !"); }); } } }); Demo: Fiddle

Categories : Angularjs

AngularJS: How to make parent directive using transclusion be compiled before the child directive?
did you try to transclude in the mother element ? in fooDir Directive: transclude: true replace: true template: "<div ng-transclude></div>" and after in the child barDir Directive require: '^fooDir'

Categories : Javascript

Trouble $watching model being passed to parent directive through directive attribute
When using an isolate scope, only those properties referenced in scope: { ... } are available to the view and the directive. Use mod everywhere and it will work: <form child-watch mod="inputModel" name="form"> <input type="text" name="one" ng-model="mod.one"> <input type="text" name="two" ng-model="mod.two"><br/> <p>Model in attribute: {{attribute}}</p> <p>Original model: {{mod}}</p> </form> Plunker

Categories : Angularjs

Angular js passing a variable from a parent directive to a child directive
First, the correct syntax to "require" the parent controller is: require:"^supNavDirective" Second, you must add returnNavTree method to the controller instance itself (instead of $scope) to access it from the child directive, like this: ... controller: function ($scope, $element) { this.returnNavTree = function(){ return $scope.navtree } }, ...

Categories : Javascript

Debugging AngularJS Databinding Inline Directive vs Directive in ngTemplate
There are multiple problems in your code 1) You have defined ng-controller Multiple times.Please be informed that everytime you define a ng-controller a new scope is created 2) your model test is a primitive which will cause problem during prototypical inheritance instead watch on object not primitive type directly https://github.com/angular/angular.js/wiki/Understanding-Scopes I have modified your fiddle which is working now :http://jsfiddle.net/ADukg/3037/ $scope.newtest={value:true}

Categories : Angularjs

Angularjs Button loading state directive with ng-disabled directive
You can listen to the ng-disabled property in the parent's scope, and if it is disabled then just simply does nothing. The trick is to watch on ngdisabled property like this scope.$watch(attrs.ngDisabled, function (newVal) {... I want to shed some light on since I can't test your code without other pieces, you probably can do something like this: .directive("btnLoading", function () { return function (scope, element, attrs) { //maybe you need just scope.$watch instead of scope.$parent.$watch. Depends on your impl. scope.$parent.$watch(attrs.ngDisabled, function (newVal) { //you can make the following line more robust if (newVal === 'disabled' || newVal === 'true') return; function () { return scope.$eval(attrs.

Categories : Twitter

In Angularjs can a controller nested inside a directive set the ng-model of the directive?
http://jsfiddle.net/jSEba/ This is one way to satisfy your need by using event emission. i.e. letting directive to $broadcast event into its child scope, so that transcluded child scope can catch via $on to react to the button click. angular.module('myApp', []) .directive('fooDirective', function(){ var template = '<div><div ng-transclude></div> <button ng-click="someFunc()">I want to update ng-model in the directive, which in turn will update myController $scope.viewModel.foo</button></div>'; return { transclude: true, template: template, link: function(scope, elem, attrs) { scope.someFunc = function() { scope.$broadcast('buttonclick', { valname: attrs.fooDirective }); };

Categories : Javascript

Angularjs control flow from directive to controller back to directive
In my solution I'm allowing a service to have access to the markers that are on the map and another service which communicates to the backend for content. The service that accesses the marker allows me to add a directive for the popup and bind it to a marker. The popup directive could have additional information that is filled out by the retrieved data. The content getting service works by using a promise, which is resolved with the data when the backend returns. I just used a $timeout, but you will be using $http. me.GetData = function() { var def = $q.defer(); $timeout(function() { def.resolve('<span> wooo! </span>'); }, 2000); return def.promise; }; The popup service binds to the marker (with some default elements if needed) and waits for the con

Categories : Angularjs

Angularjs: set parent directive scope value with child directive
First, watch this video. It explains it all. Basically, you need to require: '^parentDir' and then it will get passed into your link function: link: function (scope, element, attrs, ParentCtrl) { ParentCtrl.$scope.something = ''; }

Categories : Angularjs

Is it possible to access instances of a directive from inside the directive definition?
I would combine the directive with a drawer service. Use the drawer service to expose things that are needed to coordinate across various models, views, etc. For example, you can have each drawer directive register itself to the service (for example, send in a callback for notification). Then you can have a method on the service that when invoked will send a message to all registered drawers to close. This also makes it cleaner to implement because if anything else has to interact with drawers, they can interact with the service instead of the directive and remain decoupled from the UI implementation.

Categories : Javascript

Using ng-switch in angularjs directive and using that directive in ng-grid cellTemplate
In your cellTemplate change myData to my-data. When using angular directives camel case is converted to dash case automatically by the angular library. For example if you have a directive element defined as "mySuperAwesomeDirective". It would be declared in html using the following. <my-super-awesome-directive></my-super-awesome-directive> Here is a working version of your plunker example. http://plnkr.co/edit/ENj00Re3bfaVGPlomhFG?p=preview

Categories : Angularjs

Passing parameter to ng-click directive, within custom directive
Figured this out. Hope it helps anyone else stuck on it. Firstly this ng-click="togglePhoto({{$index}})" Should be ng-click="togglePhoto($index)" Braces not needed! Secondly I found that you can pass the event object into the click function eg ng-click="togglePhoto($event)" Then catch that event and find out what element trigged it in your click function $scope.togglePhoto = function(e) { console.log(e.currentTarget) }

Categories : Angularjs

angular ng-animate directive with ng-show directive
You need to be running AngularJS version 1.1.4 or newer, with 1.1.5 being the latest right now. You also need to use a different set of CSS rules — they've changed since the first release. Updated jsbin Modify your HTML to point to 1.1.5: <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js"></script> And change your CSS rules to use .show-animation for setup and .show-animation.show-animation.active for the active animation: .show-animation { background-color:red; -webkit-transition:all linear 0.5s; -moz-transition:all linear 0.5s; -ms-transition:all linear 0.5s; -o-transition:all linear 0.5s; transition:all linear 0.5s; opacity: 0; } .show-animation.show-animation-active { background: blue; opacity: 1; } Also please n

Categories : Angularjs

how to make a directive modify the content of another directive?
I had the same question before and have Fiddle example, for calling Directive from directive. Maybe it will help you. HTML <div ng-controller="MyCtrl"> <div directive-foo></div> </div> JS var app = angular.module('myApp',[]); app.directive('directiveFoo', function() { return { template: '<div directive-bar="123">bar</div>', replace: true, controller: function() { console.log('in foo ctrl'); this.isFooAlive = function() { return 'Foo is alive and well'; } } } }); app.directive('directiveBar', function() { return { controller: function() { console.log('in bar ctrl'); }, require: 'directiveFoo', link: function(scope, element, attrs, fooCtrl) { console.log(foo

Categories : Javascript

Passing method through a directive to a parent directive
resolve: "&" is a mapping. So here: myApp.directive('grandParent', function() { return { scope:{ resolve: "&" }, link: function($scope, $element) { $scope.resolve = function(selected){ $scope.text = selected } } }; }); you are trying to map "resolve" to ... nothing, because "grandParent" doesn't have any attr named "resolve". If you want to share some staff betweens directives you should do something like that: view <div data-grand-parent resolve="resolved()"> <div data-parent ></div> </div> Directives var app = angular.module('test'); app.directive('grandParent', function() { return { scope : { resolve : "&" // in view we defined resolve attr

Categories : Javascript

Inner-directive communication on all repeated instances of a directive
Given what you're trying to achieve, I would do this. Basically use scope notification to communicate among the elements. directive('highlightable', function() { return { link: function(scope, element, attrs) { var color = '#DEE4FC'; scope.$on("reset", function() { element[0].style.backgroundColor = 'transparent'; }); element.bind('click', function(e) { scope.$parent.$broadcast("reset"); element[0].style.backgroundColor = color; }); } }; }); Demo: link Updated sze correctly points out that my solution is only suitable if you need exactly one list (which appears to be the case from your question). However, it's very easy to accommodate multiple lists while

Categories : Angularjs

how to pass directive attribute to directive template?
Personally, I like creating child scope for element directives: http://plnkr.co/edit/Dz7fcZaT4KdRDa869rwm?p=preview app.directive('rating', function() { return { restrict: 'E', scope: { paramItem: '@' }, link: function(scope, element, attr){ console.log(scope.paramItem); } } }); There are a couple other ways too, depending on how you expect your directive to work.

Categories : Angularjs

angular.js: using a directive to insert another directive as an attribute
After the compilation, AngularJS only calls $compile for all of the child elements. The element itself is not automatically recompiled, so adding a directive at this stage will not have effect. In your case, I think you can change it from a compile function to a link function (so you get a scope argument), and call $compile(element)(scope) yourself. See this Fiddle where I have a directive that adds style="color: red", and another directive that "dynamically" adds that directive. It doesn't work, unless I call $compile afterwards. HTH!

Categories : Javascript



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