w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Regex replace content within parenthesis ignoring nested parenthesis
You could try this instead: set_([^(]*)((.*)) This captures the property name after set_ in group $1 and anything between the ( and ) of the method call into group `$2, so you can use a replacement string like this: $1 = $2 Regex 101 Demo Your expression is invalid and won't compile because you have unbalanced parentheses and un-recongnized tokens.

Categories : Asp Net

Jquery toLowerCase doesn't work
You need to set the value back on the element: var $input = $('input[name=email_address]'); var lowerCaseValue = $input.val().toLowerCase(); $input.val(lowerCaseValue);

Categories : Javascript

How to make .val().toLowerCase() work properly?
your id selectors are missing the prefix # in the ` if condition if ($("#email_confirm").val().toLowerCase() != $("#email").val().toLowerCase()) also the emailregex is missing Demo: Fiddle

Categories : Jquery

buffer.js:246 "Object 1 has no method 'toLowerCase'
Without seeing the part of your code that defines encoding I can't tell you precisely what is wrong, but encoding is clearly not a string. .toLowerCase() is a method of the String object.

Categories : Javascript

Restrict action of toLowerCase to part of a string?
I think this is probably what you are looking for: Change case using Javascript regex Detect on the first curly brace instead of a hyphen.

Categories : Javascript

Cannot call method 'toLowerCase' of undefined (Bootstrap Typeahead)
Try something like this: $.ajax({ type: "POST", url: "system/json.php", success: function(cevap){ var jsonString = '['+cevap+']'; var jsonObj = $.parseJSON(jsonString); var sourceArr = []; for (var i = 0; i < jsonObj.length; i++) { sourceArr.push(jsonObj[i].label); } typeahead = $('.my-auto-complete').data('typeahead'); typeahead.source = sourceArr; } }); $(".my-auto-complete").typeahead();

Categories : Javascript

"Cannot call method 'toLowerCase' of undefined" when using grid.setFilter(...)
Try converting the String into a JSON Object and passing that. If you are using jQuery then use parseJSON. var objQueryString = $.parseJSON(queryString); grid.setFilter(objQueryString , 'logicany');

Categories : Javascript

Uncaught TypeError: Cannot call method 'toLowerCase' of undefined
It looks like your fadeOut is being called on the .error siblings of $(field), not on $(field) itself. Is this what you are attempting to do? (ie: Remove $(field))? field.siblings('.error').fadeOut(200, function() { field.remove(); });

Categories : Jquery

Uncaught TypeError: Cannot call method 'toLowerCase' of undefined (Youtube API)
I hit a very similar error. My problem appeared to be that I was passing in a JQuery element rather than a raw element, and it didn't have a tagName. Your question gave me the clue I needed so thanks very much! Perhaps you could try getting the element yourself rather than passing in an id, and making sure you get an object that has a tagName member.

Categories : Javascript

Chrome throwing Uncaught TypeError: Cannot call method 'toLowerCase' of undefined when using e.keyCode
Aah.. found the issue, since I both had blur and keypress, I made a function for them so my code didn't get repetitive, when I made the function, I forgot to parse the $(this) to the function, so it had no idea what I meant by $(this). Code is now as follows: function bindHandlers() { $('div.city').click(function() { $(this).replaceWith('<input type="text" class="city input" value="'+$(this).text()+'" />'); bindHandlers(); }); $('.city.input').blur(function() { changeCity(this); }); $('.city.input').keypress(function(e) { if(e.keyCode == 13) changeCity(this); }); } function changeCity(el) { window.city = $(el).val(); $(el).replaceWith('<div class="city">'+window.city+'</div>'); clearTimeout(weatherTimeout); loadW

Categories : Javascript

Is ob_start useless when there is no output?
I believe it would allow you to suppress all output, for example, from error messages, and dump them into an error file. This is especially useful if you are going to be sending headers in your response at some point, and don't want error output to message with it. For example: <?php ob_start(); //Do something that would generate a warning or notice. //Output some headers header("Content-type: application/json"); //This would fail if output had already been sent to the browser. $contents = ob_get_contents(); //write contents to an error file or something.

Categories : PHP

magento url rewrite useless?
Point one and two seem to have been addressed see the notes for EE 1.13.0.2 (released today, CE 1.7 coming soon): http://www.magentocommerce.com/knowledge-base/entry/ee113-later-release-notes#prod-url-unique But, it's worth addressing some of your points. Why do/did URL rewrites work this way? Because that's the way they worked - it's just how they were created/evolved, including the racing rewrite bug you noticed when two products have the same url_key. Based on a lot of benchmarking and experience, I can state that the core_url_rewrite table is not "the main cause of poor performance in Magento". The reindex process can suck though, no doubt. The URL rewrite table is necessary for custom rewrites in general. Suggesting that manipulation of server config files (e.g. Apache .htaccess) t

Categories : Magento

Microsoft JScript runtime error: Unable to get value of the property 'toLowerCase': object is null or undefined
Change your condition to if (IsReviewable && IsReviewable.toLowerCase() == "true" && currentLocale()=="en-us" ) This will make sure the value is not falsy and only then apply the toLowerCase method

Categories : Jquery

Tiny_mce.js "Uncaught TypeError: Cannot call method 'toLowerCase' of undefined" for forecolor, backcolor buttons
Not sure about the current environment you're having the bug. However, my issue was with a tinyMCE plugin, using the same API. I experienced the same uncaught exception. I found the issue was that the parent createSplitButton() call lacked an onClick property. When tinyMCE tries to handle a click on the parent button, it fails with this error. My solution was to use jQuery (already loaded on page) to find the mceLast element, and trigger a click on it, which "shortcuts" the button that's supposed to open. I wanted to make sure this error wasn't causing a major UX faux-pas: having the tinyMCE plugin button not do anything (& throw an error)! control = e.createSplitButton( "plugin_button", { title: "My Plugin", image: 'image.png',

Categories : Javascript

Why increasing number of threads is useless?
There are many different issues that can constrain the maximum speed of some application on a given system. For example, it can be limited by memory bandwidth, by Amdahl's Law effects (time needed for non-parallel code, including synchronized blocks), I/O bandwidth, and cache space. If you want further improvement you need to do some measurements and profiling to find where the time is going, and then work on that.

Categories : Java

SQL: Only Rounded numbers shown, everything else: Useless
Try to convert both values before dividing select convert(float,2)/convert(float,7) as Value or one of them select convert(float,2)/7 as Value select 2/convert(float,7) as Value

Categories : SQL

Is std::lock() ill-defined, unimplementable, or useless?
I think you are misunderstanding the scope of the deadlock avoidance. That's understandable since the text seems to mention lock in two different contexts, the "multi-lock" std::lock and the individual locks carried out by that "multi-lock" (however the lockables implement it). The text for std::lock states: All arguments are locked via a sequence of calls to lock(), try_lock(),or unlock() on each argument. The sequence of calls shall not result in deadlock If you call std::lock passing ten different lockables, the standard guarantees no deadlock for that call. It's not guaranteed that deadlock is avoided if you lock the lockables outside the control of std::lock. That means thread 1 locking A then B can deadlock against thread 2 locking B then A. That was the case in your original t

Categories : C++

Do traits make abstract classes useless?
Generally traits are used for abstract functionality that might be needed by many classes that are not part of the same class hierarchy. You could use a trait to keep this functionality in a single location and apply it across a number of classes. This doesn't remove the usefulness of abstract classes, but it does potentially remove the need for static utility classes one might typically put these type of functions in.

Categories : PHP

Why does Perl complain "Useless use of a constant in void context", but only sometimes?
Documented in perldoc perldiag complete with rationale: This warning will not be issued for numerical constants equal to 0 or 1 since they are often used in statements like 1 while sub_with_side_effects(); As for undef, it's a function that has uses even in void context. e.g. undef($x) does something similar to —but different than— $x = undef();. (You normally want the latter.) A warning could be issued for uses of undef without args in void context, but it would require specialized code, and it's simply not needed.

Categories : Perl

HTML5 and Canvas scrolling: trick interesting or useless?
fastest scrolling is to scoll using css. So you draw all background once, not only visible part, but all, and hide that is not visible, and use css to scoll it (margin, or position). No redraw, only css changes. This work really fastest. But if all map is really huge, other custom ways can be better.

Categories : HTML

How to stop Socket to send a lot of useless data when closed?
I think you should use a delimiter character, to tell the Server your Client it's about to die. Add that character of code in onPause method of your Android Activity/Fragment. Then in your Server, just get the String or byte and compare it against your Delimiter String/Character and stop the Server listening for the Connection.

Categories : Android

Is it useless to declare a local variable as rvalue-reference, e.g. T&& r = move(v)?
No, AnyTypeMovable&& r = move(v); here is not useful at all. Consider the following code: #include <iostream> #include <vector> class MyMovableType { int i; public: MyMovableType(int val): i(val){} MyMovableType(MyMovableType&& r) { this->i = r.i; r.i = -1; } MyMovableType(const MyMovableType& r){ this->i = r.i; } int getVal(){ return i; } }; int main() { std::vector<MyMovableType> vec; MyMovableType a(10); MyMovableType&& aa = std::move(a); vec.push_back(aa); std::cout << a.getVal() << std::endl; return 0; } As aa is an l-value (as noted by R. Martinho Fernandes, and also by Xeo - a named rvalue-reference is an lvalue), this wil

Categories : C++

MvcHtmlString and HtmlString seem pretty useless wrappers around a simple string?
Their main purpose is to implement the IHtmlString marker interface which was introduced in ASP.NET 4.0. This is part of the Auto-Encoding feature of ASP.NET 4.0+. Before ASP.NET 4.0 we had only this syntax available: <%= … %> And this was simply injecting the string into the generated HTML. In 4.0 following syntax has been added: <%: … %> Which is a syntax we all should be using now. The difference with old syntax is that the string will be HTML encoded by the framework. But there are some cases when we don't want to encode the string as it is already a properly encoded HTML (for example it is an output from HtmlHelper). In such cases we should return a class which implements IHtmlString. The new syntax will be happy to accept this instead of string and will not tr

Categories : C#

Got Warning : this linearlayout layout or its framelayout parent is possibly useless
I am not sure what exactly you are trying to accomplish, but you can get rid of the warning by moving FrameLayout content to a separate file and add it back to your TabHost by using <include> tag. A possible version could look something like this: <?xml version="1.0" encoding="utf-8"?> <TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/tabHost" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content"

Categories : Android

Why would introducing useless MOV instructions speed up a tight loop in x86_64 assembly?
You may want to read http://research.google.com/pubs/pub37077.html TL;DR: randomly inserting nop instructions in programs can easily increase performance by 5% or more, and no, compilers cannot easily exploit this. It's usually a combination of branch predictor and cache behaviour, but it can just as well be e.g. a reservation station stall (even in case there are no dependency chains that are broken or obvious resource over-subscriptions whatsoever).

Categories : Performance

Eclipse generating useless 'public abstract' modifier in interface method signatures
Thanks Alexey. It sounds like an Eclipse bug, but it has a workaround. The bug has been reported since 2004-08-09 and its status is always 'ASSIGNED' :( – Solution is here

Categories : Java

Finding middle element of linked list with 1 pass, is this a creative "useless answer"?
If we modify the code to be: while(current.next() != null){ current = current.next(); middle = middle.next(); if(current.next() != null){ current = current.next(); } } Now there are fewer assignments since length does not have to be incremented and I do believe this will give an identical result. At the end of the day both solutions are O(N) so it is a micro-optimization.

Categories : Java

Using parenthesis for "for"
That must be why the bible saith: Avoid the temptation to write things like this: for (file <- filesHere if file.getName.endsWith(".scala")) { yield file // Syntax error! } chapter and verse, just before this anchor. Hoping this helps: an expr after the for means foreach; a yield expr after the for means map. There are certainly answers to that effect on SO.

Categories : Scala

C++ Why does "istringstream" use parenthesis after the name?
The parentheses enclose an argument to the istringstream constructor. istringstream converter(stringVariable); // ^^ variable being passed as argument to the // istringstream constructor This initialization syntax applies to all types with constructors which have parameters. This one of the standard C++ object initialization syntaxes, although beware: under certain circumstances, similar constructs can be parsed as function declarations, in what is known as the most vexing parse. So this istringstream mystream(); would be parsed as a function, eventhough std::istringstream has a constructor that accepts no parameters.

Categories : C++

VB Parenthesis on conditions?
It is down to your own preference. Personally I would not use them in a single expression like this: If foo = bar Then But I would use them in something like this (for clarity/readability) Dim boolValue = (foo = bar) and this (to ensure that booleans are evaluated in the order I intended): If (foo = bar) Or (foo2 = bar2) Then

Categories : Vb.Net

When to use parenthesis in knockoutJS?
Your problem is that you don't have an unwrap call for your valueAccessor in the custom binding. It should look like this init: function (element, valueAccessor) { // Start visible/invisible according to initial value var shouldDisplay = ko.unwrap(valueAccessor()); $(element).toggle(shouldDisplay); }, This will work in Knockout2.3 If you have an older version its ko.utils.unwrapObservable instead. Here is a fiddle demonstrating it without the parens. BTW, in the future, when you have the code like this to demonstrate the issue, it helps to put together a fiddle of your own so people can look at the problem quickly.

Categories : Javascript

SQL issue with parenthesis
Probably you need to GROUP BY pri, sbst, st SELECT * from example WHERE pri IN ( SELECT pri FROM ( SELECT pri, sbst, st, count(*) AS cnt FROM example WHERE sbst = 'oi' GROUP BY pri, sbst, st ) tmp WHERE cnt = 1 AND st = 'ko' ) AND sbst = 'cp';

Categories : SQL

What does single parenthesis do here?
You must surround your variable into double quotes, else it will be expanded into command line arguments that will be passed to echo. If you surround it into double quotes variable will be passed as single argument and echo will display it correctly. echo "$file"

Categories : Bash

Omitting parenthesis
You can always exchange methods argument parentheses for curly braces in Scala. For example def test(i: Int) {} test { 3 } The base for this is the definition of argument expressions, covered by section §6.6 of the Scala Language Specification (SLS): ArgumentExprs ::= ‘(’ [Exprs] ‘)’ | ‘(’ [Exprs ‘,’] PostfixExpr ‘:’ ‘_’ ‘*’ ’)’ | [nl] BlockExpr The curly braces are covered by the last case (block expression), which essentially is ‘{’ Block ‘}’ (cf. beginning of chapter 6 SLS). This doesn't go for conditional expressions, if, (§6.16 SLS) and while loop expressions (§6.17 SLS), but it works for for comprehensions (§6.19 SLS), somewhat of an inconsistency. A pattern matching statement or pattern matching a

Categories : Scala

What does a comma in a parenthesis mean in Assembly
The complete AT&T base/index register syntax is: offset(base, index, multiplier) Your offset field is 0, so you just have the (base, index, multiplier) part. In your case, you're comparing the contents of the eax register to the 32-bit value located at esi + (ebx * 4).

Categories : Assembly

TI-Basic Parenthesis Syntax
This is pretty common for complex variable trickery without if statements and such. This is pretty much saying if Z=0, subtract 1 from Z. If Z isn't 0, Z=0 becomes 0, and Z-1(0 (order of operations is multiply first) is just Z-0, which will leave the variable unchanged. In normal code it would be like: If not(Z Z-1->Z Just another thing to point out, If not(Z[newline] and (Z=0 have the same amount of tokens, which means you should do (not(Z instead to save space. Never in ti basic should you really have a =0 because that is 2 tokens for something not( can do in one.

Categories : Misc

Missing right parenthesis subquery
Just remove semicolon and last comma. Try to run below code. select t.id from (select v.id, max(c.image_type_id), max(vp.x), max(vp.y), max(vp.z) FROM v, vp, c WHERE v.id = vp.id AND v.id = c.id group by v.id) t

Categories : SQL

Regex for parenthesis (JavaScript)
How about you parse it yourself using a loop without the help of regex? Here is one simple way: You would have to have a variable, say "level", which keeps track of how many open parentheses you have come across so far (initialize it with a 0). You would also need a string buffer to contain each of your matches ( e.g. (2+2) or (2+3 * (2+3)) ) . Finally, you would need somewhere you can dump the contents of your buffer into whenever you finish reading a match. As you read the string character by character, you would increment level by 1 when you come across "(", and decrement by 1 when you come across ")". You would then put the character into the buffer. When you come across ")" AND the level happens to hit 0, that is when you know you have a match. This is when you would dump the cont

Categories : Regex

regex match within parenthesis
If you print m, you'll see gregexpr(..., perl = TRUE) gives you the positions and lengths of matches for a) your full pattern including the leading and closing quotes and b) the captured (.*). Unfortunately for you, when m is used by regmatches, it use the positions and lengths of the former. There are two solutions I can think of. Pass your final output through sub: line <- 'VARIABLES = "First [T]" "Second [L]" "Third [1/T]"' m <- gregexpr('"(.*?)"', line, perl = TRUE) z <- regmatches(line, m)[[1]] sub('"(.*?)"', "\1", z) Or use substring using the positions and lengths of the captured expressions: start.pos <- attr(m[[1]], "capture.start") end.pos <- start.pos + attr(m[[1]], "capture.length") - 1L substring(line, start.pos, end.pos) To further your understandi

Categories : Regex

Unbalanced parenthesis or bracket
You are running an old Matlab version (older than R2009b). The use of ~ as unassigned to argument is relatively new feature to Matlab. Use instead: [r, ignore] = size( alternative ); See How to elegantly ignore some return values of a MATLAB function? on other methods to accomplish what you are trying. PS, Specifically for size you can specify the dimension you are interested in as an input argument: r = size( alternative, 1 ); % get only the number of rows

Categories : Matlab



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