w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Javascript ParseInt() not working in Firefox
The code as shown above is missing a single "}" at the end to correctly close off the function. Otherwise, it works in Firefox - displays the value in the . The subsequent document.getElementId() fails, but I assume you have DOM elements with id's c0, c1, etc.

Categories : Javascript

Integer.parseInt Error : java.lang.Integer.parseInt(Unknown Source)
I think this is your problem: while (bufferedReader.readLine() != null) { result += Integer.parseInt(bufferedReader.readLine()); } You're calling readLine() twice there. You should store the initial result in a variable, and the reuse that result in the parseInt() call.

Categories : Java

if/else not working as expected
You may use the ===-operator to check for the correct type, too. The == checks, if the two expressions evaluate to the same value. Interpreted as a bool your string evaluates to true. The first of your operands is a bool-value, so the second operand is interpreted as a bool, too. A non-empty and not zero string evaluates to boolean true. You can look up the operator-behaviour for string and bool comparisons here: http://www.php.net/manual/en/language.operators.comparison.php

Categories : PHP

.on() isn't working as expected
I just ran into this myself using jQuery and Bootstrap. I solved it by adding a handler for the 'shown' event that animated scrollTop immediately (with a duration of 0). Assuming you have a modal with id 'notice' with a body id of 'noticeBody': // reset notice scrolling $('#notice').on('shown', function(){ $('#noticeBody').animate({scrollTop:0}, 0); }); I believe the problem you're seeing is due to an issue moving the scrollbar while the div is hidden, but your mileage may vary (YMMV).

Categories : Javascript

PHP-FPM is not working as expected
Can you show your php info() May you load PHP.ini from /etc/php5/cgi/php.ini and from your php-fpm config, from pool.d/* or from /etc/php5/fpm/php.ini I say that for: !/bin/sh PHPRC=/etc/php5/cgi/ export PHPRC export PHP_FCGI_MAX_REQUESTS=5000 export PHP_FCGI_CHILDREN=8 exec /usr/lib/cgi-bin/php php5-fpm is usualy in /usr/sbin/php5-fpm But maybe I fail because my english is very bad :/

Categories : PHP

parseInt vs unary plus - when to use which
Please see this answer for a more complete set of cases Well, here are a few differences I know of: An empty string "" evaluates to a 0, while parseInt evaluates it to NaN. IMO, a blank string should be a NaN. +'' === 0; //true isNaN(parseInt('',10)); //true The unary + acts more like parseFloat since it also accepts decimals. parseInt on the other hand stops parsing when it sees a non-numerical character, like the period that is intended to be a decimal point .. +'2.3' === 2.3; //true parseInt('2.3',10) === 2; //true parseInt and parseFloat parses and builds the string left to right. If they see an invalid character, it returns what has been parsed (if any) as a number, and NaN if none was parsed as a number. The unary + on the other hand will retur

Categories : Javascript

parseInt returns NaN
a and b are calculated once at page load, when the form is still empty, obviously the result will be NaN. Put all the logic in the add function, so you retrieve the current state of the form.

Categories : Javascript

sessionStorage isn't working as expected
Keys and Values in a WebStorage object (sessionStorage) must be strings. If they are not strings they "should" be converted to strings in the browser's implementation when you assign to sessionStorage. If you evaluate against "true" or convert to boolean it will work fine. https://code.google.com/p/sessionstorage/ http://www.w3schools.com/html/html5_webstorage.asp

Categories : Javascript

Web service (.net ), not working as expected
I found what was wrong. I wrote: final String NAMESPACE = "http://www.tempuri.org/"; instead of final String NAMESPACE = "http://tempuri.org/"; It's working now.

Categories : Java

PHP Calculator not working as expected
You are using assignment instead of comparison Your code (wrong!): if ($oper = "multiply") Right code (what you really want to do): if ($oper == "multiply") The same for division.

Categories : PHP

Autocomplete is not working as expected
Make sure your document has this general format and order. The error is likely caused by the autocomplete plugin not being loaded. <html> <head>...</head> <body> <div> body stuff </div> <script src="..../jquery.js"></script> <script src="..../jqueryui.js"></script> <script> var myArray = ['foo', 'bar']; $('selector').autocomplete({source:myarray}); </script> </body> <html>

Categories : Jquery

RewriteRule not working as expected?
Not sure but try this. RewriteEngine On # Redirect everything to the Front Controller RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f # RewriteRule !^(css|images|files)/ index.php [NC,L] RewriteRule ^(.*)$ index.php/$1 [L]

Categories : Htaccess

PropertyGroupDescription not working as expected
Use CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(this.Contacts); PropertyGroupDescription groupDescription = new PropertyGroupDescription("LastName"); view.GroupDescriptions.Add(groupDescription); instead. You should use hardcoded property name in PropertyGroupDescription's constructor.

Categories : C#

stopImmediatePropagation not working as expected
Try this var i=0; $('#myLink').on('mousedown mouseup click', function(e) { e.preventDefault(); e.stopImmediatePropagation(); console.log(e.type); console.log(i); i++; }); prints in console "mousedown" 0 "mouseup" 1 "click" 2 and using var i=0; $('#myLink').on('mousedown mouseup click', function(e) { if(i>0) { return false; } e.preventDefault(); e.stopPropagation(); console.log(e.type); console.log(i); i++; }); Prints in console "mousedown" 0

Categories : Javascript

PHP bit/value conversions are not working as expected
Dump the contents of your 'bit' array. You're not getting the values you think you are. Put them in quotes and you'll get the expected results. Edit: do the same in your vals array. You're specifying decimal numbers. In other words, 0010 means ten, not two.

Categories : PHP

Asp.NET Updatepanel not working as expected
Your updatepanel is triggering a postback right after the UploadFile control is clicked so what happens is that the file chosen is postedback immediately with that very first request. By the time you submit the second request by clicking on the button, the UploadFile control is empty again. The UploadFile control (or any input:file element, for that matter) won't retain the selected value after a postback. What you see is by design. The easiest thing to do is avoid the initial postback and do the validation entirely on the client side. In other words, remove the triggers section from the updatepanel since you already discovered that this works. Obviously, you would still do the validation on the server side when the "upload files" button is clicked. There are other alternatives to this

Categories : C#

Box-shadow not working as expected
You have 2 problems The header_2 class in the header states white background, that makes the shadow hard to see. And your box2 class has a height too high, that also makes the shadow invisible. I changed it to 80 px. The result: [http://jsfiddle.net/vals/3NDMB/2/]

Categories : CSS

Function SUM not working as expected
The problem is that you have multiple rows for a given date in both tables. There are 3 dates for id 24 in the first table and 3 rows in the second table. The resulting join has 9 rows, one for every combination of the two. To fix this, do the aggregation before the join: SELECT dt.ticket_id, SUM(dt.precio), iva, total FROM devolucion d INNER JOIN (select dt_ticket_id, sum(dt.precio) as precio, sum(dt.iva) as iva, sum(total) as total from detalle_ticket dt group by dt_ticket_id ) dt ON d.detalle_ticket_ticket_id = dt.ticket_id WHERE DATE(d.fecha) = '2013-06-04' I also added aggregations for iva and total. They seemed to be missing.

Categories : Mysql

set_time_limit is not working as expected?
Which version you are using? I used the version PHP Version 5.4.7 and I got the result 4i=0 i=1 i=2 i=3 i=4 Fatal error: Maximum execution time of 4 seconds exceeded in ....... Also while setting the set_time_limit(), the duration of sleep() will be ignored in the execution time. The following illustrates: <?php set_time_limit(20); while ($i<=10) { echo "i=$i "; sleep(100); $i++; } ?> Output: i=0 i=1 i=2 i=3 i=4 i=5 i=6 i=7 i=8 i=9 i=10 Source From set_time_limit()

Categories : PHP

on('change') not working as expected
Issue is with the way attr is used. Simplify it using prop instead. $(function(){ $("#selectall").on('change',function () { $('.case').prop('checked', this.checked); }); }); Fiddle Update based on your question in comment Version 1.3.2 of jquery does not support on as well as prop. This is a very old version where attr itself probably handles specific attribute value (for element attribute) or boolean value (for element property) to add/remove attribute value (in case of attributes of this kind (checked, selected...)) or set or unset element property based on the type of value specified. Later version of jquery introduced prop for setting the element property and attr to set the element attribute. Probably this is the reason. Also note that on is not supported in 1.3

Categories : Javascript

Rewrite not working as expected
It seems that adding the following works: RewriteCond %{QUERY_STRING} !^s= But I worry that my lack of clear understanding of why might result in some problems. Here is my understanding: If the query string !(does not)^(start with)s= Am I missing anything? That does, at first glance, appear to solve my problem but perhaps it is incomplete or error prone?

Categories : Htaccess

isValidJSONObject not working as expected
isValidJSONObject tests if a JSON object (a NSDictionary or NSArray) can be successfully converted to JSON data. It is not for testing if an NSData object contains valid JSON data. To test for valid JSON data you just call [NSJSONSerialization JSONObjectWithData:data ...] and check if the return value is nil or not.

Categories : Objective C

Jquery not working as expected
Since you are using jquery 1.7 (wich was an important statement since it doesnt show the same error). It is impossible to append an array (in most recent version, you can). this line: $container.append(tweetPs); Is causing the error, try to loop through every element and append them individually : $.each($tweetPs, function(){ $container.append(this); })

Categories : Javascript

CSS first-child not working as expected
It seems to work on the fiddle, so you probably have a (hidden) text node somewhere there. Therefore I suggest using .tblRow div:first-of-type { ... }, if possible from browser support point-of-view.

Categories : CSS

Condition not working as expected
There are a few things to check out here. I'm assuming character names are unique. If so, I'm guessing you're expecting mysql_fetch_array() to return one result for mysql_query("SELECT `level` FROM `cq_user` WHERE `name` = '" . $char_name. "'") You have $row = mysql_fetch_array($result1), and as the function name implies, mysql_fetch_array() returns an array, so $row is an array of the column values requested. Each time it's called, it iterates further over the results. If you're just expecting one row to be returned, you can call it just once (no need for the while loop). Since you're just selecting one column (level), the level should be $row[0]. Also, the conditions in your if statement are mutually exclusive: if (mysql_num_rows($result) == 0 && $row <= 119) I'm guessi

Categories : PHP

php GET request is not working as expected
You are sending a a post request so you should use $_POST instead of $_GET $temp = $_POST["emailData"]; if($temp != ''){ echo "YEAAAAAAAAAAAA"; }

Categories : PHP

For loop not working as expected
Here is my shot: You have all the code after entities.add(player) indented INSIDE the loop. Remove the extra indentation to put it outside the loop. EDIT: In fact, I guess the entities.add(player) should be out of the loop, too.

Categories : Python

key pressed down not working as expected
If you don't want lines to be added to the TextBox then you should set its Multiline property to False. Generally, if you don't want the Enter key to be processed then you'll need to prevent the KeyPress event for it from firing. Which you do by setting the e.SuppressKeyPress property to true. Fix: else if (e.KeyCode == Keys.Return) { // Return if (!String.IsNullOrWhiteSpace(txtBox.Text)) myButton.PerformClick(); e.Handled = e.SuppressKeyPress = true; }

Categories : C#

String.Contains not working as expected
Try it like this: Dim tempCheck as string = "1st BARITONE" Dim GoodOne as Boolean = False Select Case True Case tempCheck.Contains("CORN") GoodOne = True Case tempCheck.Contains("HORN") GoodOne = True Case tempCheck.Contains("BAR") GoodOne = True Case tempCheck.Contains("TROM") GoodOne = True Case tempCheck.Contains("EUP") GoodOne = True Case Else GoodOne = False End Select SELECT CASE doesn't work on strings like this (you have to compare string to a string, in this case you compare to a boolean). It does work on Booleans compared to booleans

Categories : Vb.Net

Float not working as expected
You were missing overflow:hidden on your ul element. Check this working jsFiddle. overflow:hidden is recommended on the parent of floating elements. It forces the parent to wrap around all of them, thus preventing weird behaviour as you were experiencing..

Categories : HTML

Refactoring not working as expected
Since I got no responses, I made several different refactors and the following code works as expected. Protected Sub gvEBEvals_DataBound(sender As Object, e As EventArgs) Handles gvEBEvals.DataBound Dim usr As MembershipUser = Membership.GetUser(HttpContext.Current.User.Identity.Name) If Not usr Is Nothing Then For Each col As DataControlField In gvEBEvals.Columns If (Roles.IsUserInRole(usr.UserName, "administrator") Or Roles.IsUserInRole(usr.UserName, "developer")) Then If col.HeaderText.ToLower().Trim() = "revenue potential" Then Dim revColumn As Integer = gvEBEvals.Columns.IndexOf(col) FormatCurrencyColumn(sender, revColumn) End If End If If col.HeaderText.ToLo

Categories : Asp Net

VBA For Loop not working as expected
I am not sure how VBA handles collections but I'm guessing when you are moving items from the myFolder you are actually "hopping over" in the collection. Proper languages would not allow you to alter collection which is being processed by for each loop.

Categories : Vba

Xor not working with VisuabBasic as expected
The algorithm you are using for encryption/decryption is wrong because comes from a wrong assumption: the length of the encrypted and unencrypted strings have to be identical (what is rarely the case). The basic encrytion/decryption for what you aim is: For i As Integer = 0 To text.Length - 1 RichTextBox2.Text = Chr(Asc(text(i)) Xor key) & RichTextBox2.Text Next Where key is an integer. What you have done is changing the key part such that strings might be accounted for. The problem is that the way you have chosen to accomplish this aim does not deliver the same key for both situations (encryption/decryption): you are generating your key as a function of the given length being considered (encrypted string vs. decrypted string) and thus you assume that both lengths are identica

Categories : Vb.Net

rstrip() not working as expected
While reading each line using: for line in raw: line contains the newline at the end. You need to remove it. Try using: noisy = line.rstrip() + " " + addNoise

Categories : Python

XSD Schema not working as expected
The order of the elements is wrong. You've defined the order as line-text, box-text and relative-text and not as in your example line-text, relative-text, box-text So either change your template xml to: <?xml version='1.0'?> <template-content output-directory='D:\output'> <line-text name='a' /> <box-text name='c' x='1' y='2' width='2' height='2' /> <relative-text name='b' flow='above' amount='1'/> </template-content> Or use <xs:all /> instead of <xs:sequence /> in your schema <xs:all> <xs:element name="line-text" type="LineText" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="box-text" type="BoxText" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="relative-text" type="Relat

Categories : C#

Mailmessage.from not working as expected
This is because you need to add the B@gmail.com in to your A@gmail.com account as an alternative email address, otherwise gmail smtp server won't let you spoof the email address.

Categories : C#

URL rewrite not working as expected
Replace your code with this: Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory: Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / RewriteRule ^([a-zA-Z0-9_,-]+)/([0-9]+)$ listing.php?business=$2 [L,QSA] ## hide .php extension # To externally redirect /dir/foo.php to /dir/foo RewriteCond %{ENV:REDIRECT_STATUS} ^$ RewriteCond %{THE_REQUEST} ^[A-Z]{3,}s([^.]+).php[s?] [NC] RewriteRule ^ - [F] # To internally forward /dir/foo to /dir/foo.php RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{DOCUMENT_ROOT}/$1.php -f RewriteRule ^(.+?)/?$ /$1.php [L]

Categories : Htaccess

asp.net regularexpressionvalidator not working as expected
I would say the first problem is that the / need escaped: ^([a-zA-Z0-9]+)|((https?://)?([w-]+.)+[w-]+(/[-w ;,./?%&=]*)?)$ The next problem of interest is that the Regex you currently have doesn't really ever match the entire URL, it matches and groups portions. But maybe that's what you want. Here is a Rubular with the modified Regex and values you noted.

Categories : Asp Net

JProgressBar not working as expected
Your code is executed on the EDT so the GUI can't repaint itself until the task is finished. Read the Swing tutorial on How to Use Progress Bars for a working example that uses a SwingWorker. Also, read the tutorial on Concurrency for more information about the EDT.

Categories : Java

jQuery .off() not working as expected
You could use "one" instead of "on" if the event is only to be used once. $(this).one("click.add", addLetter); This will automatically unbind itself after firing the first time. Reference: http://api.jquery.com/one/ If randomizeTiles is called repeatedly you may be stacking bindings. If that is the case you may wish to change this to: $(this).off("click.add").one("click.add", addLetter);

Categories : Jquery



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