w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How does the expression in ng-repeat work?
You are injecting your service dashboardContent directly into your directive. It's not necessary. Insted you could inject it into your controller, access single array elements with ng-repeat and pass those to your directive. mainApp.controller('ContentCtrl', function($scope, dashboardContent) { $scope.contentData = dashboardContent.contentBoxes; }); In your directive code replace scope: {} with scope: { contentData: '='} and remove line scope.contentData=... This way you'll have a directive with isolate scope and you can pass a value to this scope in your html like this: <div ng-controller="ContentCtrl" ng-repeat="content in contentBoxes"> <content-box contentData="content"></content-box> </div>

Categories : Angularjs

How to set repeat regular expression?
The expression you appear to need is: ^d{5}(|-d{4})(,d{5}(|-d{4}))*$ The one you were attempting to write was: ^(d{5}|d{5}-d{4},)*$ but that would require every ZIP to have a trailing comma, which the very last one would not have had. Breaking down the answer given, d{5}(|-d{4}) is a variant of your original, but simply making the -1234 optional. (,d{5}(|-d{4}))* is the first regular expression preceded by a comma, and allowed zero or more times.

Categories : C#

how to make an regular expression in javascript to repeat
/^(([0-9a-zA-Z!?])+:([0-9a-zA-Z!?])+,?)+$/ should do it. You had ^ inside the first group, forcing it to match a newline. I'm not too familiar with javascript regular expressions, so I'm not sure what the i at the end was doing. You can run quick tests on http://rubular.com

Categories : Javascript

CSS multiple backgrounds - one to repeat
Fixed with: html { height : 100%; background : url('images/grassBackground.jpg') top center repeat-y; background-size : 100%; } body { font-family : "Helvetica Neue", "HelveticaNeue", Helvetica, Arial; font-size : 11px; color : #000; text-align : center; margin : 0; background : url('images/background.jpg') top center no-repeat; background-size : 100%; height : 100%; }

Categories : HTML

Angular.js ng-repeat across multiple elements
There are two options: First option is to create directive that will render several tags and replace source tag (jsfiddle) <div multi ></div> angular.module('components').directive('multi', function ($compile) { return { restrict: 'A', scope : { first : '=', last : '=', }, terminal:true, link: function (scope, element, attrs) { var tmpl = '', arr = [0,1,2,3] // this is instead of your repeater for (var i in arr) { tmpl +='<div>another div</div>' } var newElement = angular.element(tmpl); $compile(newElement)(scope); element.replaceWith(newElement); } }) Second option is to use updated source code of angular that enables comment style ngRepeat directive (p

Categories : Javascript

multiple Domains without repeat config
in the same server section and using server_name directive to support multiple domains. And seems you already give the answer above.

Categories : Nginx

angular ng-repeat with multiple filter options
Try writing a custom filter, and using some kind of combination like this. <select ng-options="foo.blah for foo in foos" ng-model="selection"></select> <li ng-repeat="obj in objects|filter:selection|filterFunction">{{obj}}</li> .filter('filterFunction', function() { return function (objects) { var filter_objects = []; for (var i = 0; i < objects.length; i++) { for (var j = 0; j < objects[i].weights.length; j++) { if (objects[i].weights[j].name === "Raised Panel") { filter_objects.push(objects[i]); } } } return filter_objects; } });

Categories : Javascript

Repeat same JS function multiple times on same page
Your window.onload function is an anonymous function which calls loadCapsChecker(); window.onload = function() { .... loadCapsChecker(); ... //rest of your code ... However loadCapsChecker(); was not defined as a global variable (Yes in JS variables can be functions ). Hence your window.onload function has no idea what loadCapsChecker(); refers to. Try to declare the function loadCapsChecker(); with a global scope. It should work fine. declare it before usage like this var loadCapsChecker = function (){ // Your function code same as above for loadCapschecker in your code }; window.onload = function() { .... loadCapsChecker(); // Now this will because it can see the var "loadCapsChecker" ... //rest of your code ... Hope that helps :)

Categories : Javascript

Angular JS - Complex Multiple OrderBy on ng-repeat
Yes, you can introduce $scope.decoratedName = function(title, seriesnumber) { return title + '-' + seriesnumber; } and then use ng-repeat ... orderBy:decoratedName(title, seriesnumber).

Categories : Angularjs

Repeat values to multiple plots when faceting
You will have to do the data duplication due to ggplot's philosophy: Each item in the plot represents exactly one data point. So if you want to have the NA data in two facets, you need to create two data points for each original data item. If you want to avoid explicitly creating temporary data just for plotting, you can create a function that will do the data duplication for you. Something along the following lines: distribute.na.type <- function(dat) { rbind( transform(subset(dat, type %in% c(1, NA)), type=1), transform(subset(dat, type %in% c(2, NA)), type=2) ) } The above example is untested and not very generic, but with a little bit of luck it'll just work. Use it like this: distribute.na.type(melt(...)).

Categories : R

How do I not repeat myself when I want to put a word limit cap on multiple textareas?
Here's a possible solution. The limit is only written once. HTML : <textarea name="what" id="five" rows="1" data-limit=5></textarea> <div class="word_count"> Word count: <span>0</span> </div> <textarea name="what" id="six" rows="1" data-limit=6></textarea> <div class="word_count"> Word count: <span>0</span> </div> JavaScript : $('textarea[data-limit]').each(function() { var $this=$(this), limit = $this.data('limit'); $this.attr('placeholder', 'limit '+limit+' words'); $this.keypress(function(){ var wordcount = $this.val().split(/[s,.-:;]*/).length; $this.next('.word_count').text(Math.min(wordcount, limit)); return wordcount<=limit; }); }); Demonstration

Categories : Javascript

Is it possible to expand elements from multiple arrays using ng-repeat?
Use $scope.$parent instead of $attrs since you should access the model from scope rather than attr. And since ng-repeat creates new scope, you need $parent to access the model defined in the repeater. controller: ['$scope', '$element', '$attrs', function ($scope, $element, $attrs) { $scope.a = $scope.$parent.a; //change to $scope.$parent $scope.b = $scope.$parent.b; //change to $scope.$parent }]

Categories : Angularjs

angularjs: ng-repeat-start and ng-repeat-end with inner ng-repeat
You should be able to use index-based iterations to bypass that: <tr ng-repeat-start="obj in rows" > <td ng-repeat="e in obj.row">{{obj.row[$index]}}</td> </tr> <tr ng-repeat-end> <!-- ... -->

Categories : Angularjs

how to repeat same Javascript code over multiple html elements
Why not $('.spanlink').hide(); $('.column1of4').hover( function() { // in $(this).children('.spanlink').show(); }, function() { // out $(this).children('.spanlink').hide(); } ); It doesn't even need the ids.

Categories : Javascript

multiple arraylist repeat subjectname display in sequence
Your problem is in using a dictionary. dictionaries aren't ordered so there's no guarantee of the order whenever you iterate through it. However a List(Of KeyValuePair(Of String,Integer)) will do the job you want. Additionally you can do it using the same list(Of String). I don't use arraylist's much, never found a need that a list can't do, but I imagine the syntax should be pretty much the same. Something like this should work Dim arraysub As List(Of String) = New List(Of String)({ "maths", "english", "maths", "hindi", "english", "science", "Economics", "science" }) For i = 0 To arraysub.Count - 1 If Not Char.IsDigit(arraysub(i).Last) Then Dim temp As String = arraysub(i) For j = 0 To arraysub.FindAll(Function(s) s = arraysub(i)).Count - 1 arraysub(a

Categories : C#

How to ng-repeat into html table with multiple levels of json?
Sounds like you'll need a specific directive that wires up children to be recursive, take a look at this example: Recursion in Angular directives What you'd check on is if what you need to repeat is an object and not a value, then add the new element compile it, and start the process over again.

Categories : Json

Isolating scope for multiple d3 components in AngularJS directives within ng-repeat
I fixed this. I think the main issue was add a D3 select() on the transition line so D3 knows which dial it is transitioning. I also pulled the append SVG out of the directive and just have one SVG in the document now. The directive is appending groups under the SVG tag. Looks awesome! HTML: <div ng-controller="DashboardCtrl" ng-init="init();"> <svg id="d3Parent" width="1000" height="1000" fill="#2E7AF9"> </svg> <div ng-repeat="item in metrics"> <div ng-switch on="item.type"> <div ng-switch-when="dial"> <gh-dial val="item.data" data-format="item.data-format" metric-title="item.title" gh-target="item.target"></gh-dial> </div> <div ng-switch-when="meter"> <gh-meter val="item.data" data-format="item

Categories : Angularjs

Codeigniter sessions queries with multiple users and repeat logins
Codeigniter actually uses cookies for their sessions and you set the expiry time in the config.php file. I am not really sure how long it stores the actual database info (It isn't that long) and it will rewrite a new entry for a user when they log back in. So it's not really recommended to store critical data in the session table itself that isn't stored elsewhere. As long as their cookie persists the information could be restored but if they delete the cookie then you'll lose that data. If you need to store something permanently on a user don't use the session table. I have no idea why you'd want to change the data types of the already present schema and honestly that would very likely screw up the system being able to store that data anyway without extending the session library. This s

Categories : PHP

What is best way to get angularjs ng-repeat variable to a directive called withn the repeat
What you are trying to do should work just fine. Here is an example... http://jsfiddle.net/HB7LU/4269/ <div ng-repeat="val in values"> <my-directive val="{{val}}">{{val}}</my-directive> You can see that the value from the repeater is easily binded into the child directive. Since you didn't provide any code, its hard to see where you are going wrong, but it might have something to do with the fact that you are using a table in your html. There was a bug in Angular, which was fixed in 1.2.13, related to repeating over table elements, since browsers actually manipulate the DOM inside of tables on their own sometimes. Please see this bug report regarding that issue. I would update to the latest version of Angular and try again. If you still can't get it working, try t

Categories : Angularjs

AngularJS Outer ng-repeat not to register watches on inner ng-repeat
You could write a directive that takes both users and items as bindings attributes (especially because it seems like your inner loop is independant from the outer one), then manually nest two loops that would add content to the DOM, plus adding a scroll listener to each element. It's more hard-way coding but a lot less watchers.

Categories : Javascript

Python Regular Expressions: How to repeat a repeat of a pattern?
The simplest pattern that comes to mind is: 'AAA(w{3})*CCC' ^^^ stop code ^ zero or more of… ^ ^ a group of… ^^^^^ three characters ^^^ start code If you have additional requirements on the number of three-character groups, like “at least two such groups”, you can now easily replace the star character in the regular expression with what you need. As for the longest match and different frames, I'm not sure. Technically the star character already is greedy, that is will match the longest string possible, so that should fulfill your requirements. But I fear this feature and the requirement to not to share substrings while in a single frame will interact badly. I think the clearest way would be to ask the regex engine to provide you with all ma

Categories : Python

Python combination of 2 lists (1 repeat, 1 non-repeat)
I think I've come up with a solution, but please correct me if this wrong. I would also love to see if there are any more elegant solutions. First, I came up with the total number of combinations. All combinations without replacement are equal to n!/r!(n-r)! and with replacement are equal to (m+s-1)!/s!(m-1)! where m and n are number of items to choose from and r and s are the number of items you actually choose. Because I know the total items I want in each combination (lets call it cap), I find the number of combinations for 0 of the no replacement type (n=0) and for "cap" of the replacement type (m=3) and multiply those numbers together. Then, add to that the number of combinations for 1 of the no replacement type (n=1) multiplied by combinations "cap-1" of the replacement type (m=

Categories : Python

How can you add multiple conditions to a path expression?
In the same way, like /bookstore/book[@price>20][1][@title!=''] You can also use and and or operator like /bookstore/book[@price>20 and position() = 1 and @title!='']

Categories : Xslt

Multiple statements in angular expression
There are a couple of issues here that are interacting. First, your statements are ordered backwards: you're setting k=j before setting j, which leads to its being undefined. Second, and more importantly, interpolated expressions (the ones in "{{}}") should not be used change the state of the scope. There's a good reason for this: Interpolation and Watches The way interpolation works is that when it compiles your html, angular registers a scope.$watch on each interpolated expression. But these watched expressions can get executed multiple times during a digest: whenever a listener modifies the scope, it causes angular to run through the watches on that scope again. For this reason, watched expressions really ought to be "idempotent": i.e., they should have no side effects / caus

Categories : Angularjs

Regular expression for multiple email addresses
try this function validateEmail(field) { var regex=/[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}/i; return (regex.test(field)) ? true : false; } function validateMultipleEmailsCommaSeparated(value) { var result = value.split(" "); for(var i = 0;i < result.length;i++) if(!validateEmail(result[i])) return false; return true; }

Categories : Javascript

Animating multiple objects in Expression blend
Have you looked at creating a custom user control? It would contain the image, and the storyboard. It would also be a good place for hit test logic. Then you create 50 instances of the user control. To get them to appear in staggered stream, either use a timer to instantiate each control or create a dependency property on the user control for the start time of the animation.

Categories : C#

multiple parameter pack expansion in one expression
Yes your code is perfectly valid. A pack expansion consists of a pattern and an ellipsis and can appear in a pattern of another pack expansion. In paragraph §14.5.3/5 of the standard you will find: [...] An appearance of the name of a parameter pack is only expanded by the innermost enclosing pack expansion. The pattern of a pack expansion shall name one or more parameter packs that are not expanded by a nested pack expansion; [...] A pack expansion can be used in any context mentioned in §14.5.3/4. Given your example: DebugPrinter< T1, T2, T1...>... Both pack expansions are valid. The context of the first one is a template-argument-list while the second appears in a base-specifier-list. The example provided by the standard text: template<class ... Args> void g(Arg

Categories : C++

Multiple Delimiter Date Regular Expression
Just make it optional: (0?[1-9]|1[012])[- /.]?(0?[1-9]|[12][0-9]|3[01])[- /.]?(19|20)?[0-9]{2} ^ ^

Categories : Regex

java regular expression for multiple spaces
strTestIn = strTestIn.replaceAll("^\s+", ""); removes whitespace at the start of the string. strTestIn = strTestIn.replaceAll("\s+$", ""); removes whitespace at the end of the string. strTestIn = strTestIn.replaceAll("[ ]+", " "); condenses multiple spaces into a single space. strTestIn =strTestIn.replaceAll("(\r\n)+", " "); removes empty lines by replacing adjacent newlines with a single newline. strTestIn = strTestIn.replaceAll("(\t)+", " "); condenses tabs into a single space. So they all do different things. A combination is possible for those that have the same replacement string: strTestIn = strTestIn.replaceAll("^\s+|\s+$", ""); strTestIn = strTestIn.replaceAll(" {2,}| +", " "); strTestIn = strTestIn.replaceAll("( )+", " "); You can also clean up and improve the

Categories : Java

javascript regular expression with multiple parentheses
1) The (?:) is not being returned. What you are seeing is that the .match() method will always return an array: The first element is the whole match, and the following elements (if any) are the back-references. In this case, you have one back-reference, so the array contains two items. 2) Because of the first half of your regex: (?:[^&]|&.+;)* This is not a good idea! This will match just about anything, even including new lines! In fact, the only thing it won't match is a "&" that is not followed by a ";" on the same line. Thus, it is matching everything up to the last ";" in each of your lines. 3) I'm not at all familiar with MASM-style comments in HTML, so I'd need to see a more extensive list of what you want matched/not matched in order to confidently give a good answ

Categories : Javascript

Regular expression - filename with multiple periods
Describe it! For: P23.24.23.4.w07 use: w+(?:.w+)+ note that for your java version you can use possessive quantifiers and atomic groups: \w++(?>\.\w++)+

Categories : Java

Printing a regular expression over multiple lines
Flip-flop in perl: perl -ne ' if ( $range = ( m/Astart:/ .. m/Aend:/ ) ) { $s .= $_; if ( $range =~ /E0/ ) { if ( $s =~ m/(?m)^s*1234s*$/ ) { print $s; } undef $s; } } ' infile It yields: start: blah..blah 1234 blah blah.. end:

Categories : Regex

What is the Regular expression for multiple word combinations
I think this will do it. ^(((ab|xy|ij|pqr)(,(ab|xy|ij|pqr))*)|all)$ Screenshot

Categories : Regex

iif in query expression to return multiple parts
One way is to embed the WHERE within the iif: iif(Forms!ReportCreator.Location.Value>0," WHERE SampleLocation = " _ & Forms!ReportCreator.Location.Value,"") although it depends how you are constructing your statement.

Categories : SQL

Using Regular expression to match Multiple choice?
"1. Any Text _ Goes here, And end with ? Or ." can translate to this in regex: d+.[^?.]*[?.] Does that work for you? This assumes you never have any question marks or periods within the question until the end... but that's sort of what you implied as well. Edit: Since you want the answers and not just the question itself and you are looking to distinguish between other types of questions, try this: ([ ]*d+.[^ ]+ (?:[ ]*[a-zA-Z])[^ ]+ )+[s]*Ans:[^ ]*) Edit live on Debuggex

Categories : Regex

Setting up a git and multiple environments for expression engine
Now I have managed to do a remote push back to the dev.mydomain without errors, but when I check the files, I find these haven't been updated to include my adds/commits. Pushing to an upstream remote repo means: pushing to a bare repo (meaning there is no files to see! There is no working tree in a remote repo) or pushing to a non-bare repo, but in that case you can only do so without error if you are pushing a branch which is not checked out in that remote repo. Which means none of the currently visible files on that upstream repo are modified. That is the all point of allowing that push: you are sure there is no discrepancies between that checked out branch HEAD and the HEAD you are pushing. The problem is detailed in "git push error: refusing to update checked out branch". So I wou

Categories : GIT

How to set multiple values in a list using lambda expression?
Well personally I wouldn't write the code that way anyway - but you can just use a statement lambda: A statement lambda resembles an expression lambda except that the statement(s) is enclosed in braces The body of a statement lambda can consist of any number of statements; however, in practice there are typically no more than two or three. So the ForEach call would look like this: .ForEach(x => { x.BtnColor = Color.Red.ToString(); x.OtherColor = Color.Blue.ToString(); }); I would write a foreach loop instead though: var itemsToChange = objFreecusatomization.AllCustomizationButtonList .Where(p => p.CategoryID == btnObj.CategoryID && p.IsSelected && p.ID == btnObj.ID); foreach (var item in itemsToChange) {

Categories : C#

Unexpected result with in_array() and multiple conditions in if expression
I believe you want to use XOR if(!in_array($user->id, array($lsp->created_by_id, $lsp->approving_committee_pri_id, $lsp->approving_committee_sec_id)) XOR $user->level != 5) Meaning one or the other, but not both

Categories : PHP

How to validate multiple phone number using regular expression
Choose appropriate and suitable regular expression e.g. from here Iterate through your number collection and validate them one by one like: Regex rgx = new Regex(yourPattern, RegexOptions.IgnoreCase); foreach(string num in numbers) { if(rgx.Matches(num )) //do something you need } You also can add RegularExpressionValidator to your phone number column cells in grid and pass it your pattern. Then button click or any event that causes validation will do it for you.

Categories : C#

Perl regular expression {} quantifier multiple matches
Quntifiers just allow you to specify how many times you want to match something in a regex. For example /(ba){3}/ would match ba in a string exactly 3 times : bababanfnfd = bababa but not baba = no match. You can also use (taken from: http://perldoc.perl.org/perlrequick.html): a? = match 'a' 1 or 0 times a* = match 'a' 0 or more times, i.e., any number of times a+ = match 'a' 1 or more times, i.e., at least once a{n,m} = match at least n times, but not more than m times. a{n,} = match at least n or more times a{n} = match exactly n times

Categories : Regex



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