Posts by stderr • 30,356 points
651 posts
-
1
votes3
answers7968
viewsA: Delete a line in Datagrid
It is necessary to define the property AllowUserToAddRows of DataGridView for false. And to avoid an exception OutOfRangeException, check before if the line index is valid. var indice = e.RowIndex;…
-
3
votes1
answer590
viewsA: Reconnect Websocket after connection loss
When the connection is lost the event onclose is triggered, to make the reconnection you must work on that event. One mode you can use to connect again is through the function setTimeout, she will…
-
0
votes1
answer1714
viewsA: Write to file, replace words/numbers
You have a problem when you use the i.replace(...) this doesn’t really remove line breaks because strings in Python are immutable, what you want to do is: i = i.replace("\n", "") Since you did not…
-
2
votes1
answer1313
viewsA: Uncaught Invalidstateerror: Failed to execute 'send' on 'Websocket'
According to the returned message, you are trying to execute the method send before even if the connection has been established. According to the page of W3.org about WebSockets: The send(data)…
-
9
votes2
answers125
viewsA: Use of ';' before starting a function
The semicolon is used to make sure that the previous instruction has been completed. For example: (function() { })() // <--- Não tem ponto e vírgula // Adicionado ponto e vírgula para evitar um…
-
3
votes5
answers2736
viewsA: Test whether all characters of the first string also appear in the second
Updating Follow another alternative way without use the function strchr: int testarString(char *fonte, char encontrar[]){ int i, ret = 0, tamanho = strlen(encontrar); while (*fonte){ for (i = 0; i…
-
0
votes1
answer177
viewsA: Windows libxml error
According to the Dev-C++ FAQ, the directory of include can be located in: C: Dev-C++ include\ In the Code::Blocks the directory (in a normal installation) is usually: C: Program Files Codeblocks…
-
1
votes2
answers116
viewsA: Format columns - select specific information
You can extract this information in several ways, for example with cut, the awk, and also with the glorious Perl. Follow an example using awk: $ awk 'match($0, /SIFT=tolerated\([0-9.]+\)/) { print…
-
1
votes2
answers211
viewsA: Directory index Forbidden
Directory index Forbidden by Options Directive. This error indicates that there is no standard file (index.php, index.html..) in the directory, this means that it will show the directory’s content…
-
0
votes2
answers460
viewsA: Str: preg_replace(): No ending delimiter '-' found
You forgot again to put the delimiters on preg_replace. function simplifica($txt){ $txt = strtolower($txt); $txt = str_replace(array('á','à','â','ã','å','ä','ª','Á','À','Â','Ã','Ä'), 'a', $txt);…
-
4
votes5
answers4008
viewsA: Regex take from one point to the other within a text
Has the method Regex.Split that can be used for this. using System.Text.RegularExpressions; .... public static void Main() { string texto = @"From: .... blabla bla Message: blablabalab //linha em…
-
5
votes1
answer2029
viewsA: How to validate Dbgrid fields before saving?
Do this at the event TDataSet.BeforePost not a bad idea, but how do you want to validate the fields in particular, the event DB.TField.OnValidate can serve better for this case. To use this event…
-
1
votes1
answer1781
viewsA: How to place next and previous buttons on a slider?
There is a demo provided by jQueryDemo site: Basic jQuery Image Slider about that. I adapted your code to the example (after running, click on Janela Toda for better viewing): (function($) { var…
-
7
votes6
answers8412
viewsA: Function that enumerates letters of the alphabet
Another alternative that can be used is: function enumerarLetras(texto){ texto = texto.toLowerCase(); var numeros = []; texto.split('').map(function(letra){ numeros.push((letra.charCodeAt(0) - 97) +…
-
4
votes3
answers2955
viewsA: Function that returns function in Javascript
The function hello function returna hi with the parameters 3,3 however the function hi returns to * b, soon 3 * 3 = 9 right? No. What is passed to the function hi is 3 and 3 + 1. When requesting the…
-
1
votes1
answer1388
viewsA: imagejpeg is not saving image
The function imagecreatefromjpeg and derivatives return the image identifier resource if successful, the Resource id #4 indicates that you are manipulating a resource. Image is not being saved…
-
3
votes1
answer871
viewsA: Problem with fopen
PHP Notice: Undefined variable: string in .. The first error is generated because the variable was not declared string, you are trying to concatenate a value to a non-existent variable. PHP Warning:…
-
1
votes1
answer781
viewsA: How to allow the insertion of information in the database using Dblookupcombobox?
If your idea is to get the user to edit the selected content on DBLookupComboBox, this may not be possible as the purpose of this control is to list the data of a table as specified in the property…
-
2
votes3
answers683
viewsA: list index out of range when trying to resolve the issue of google Developer day 2010
Like mentioned by Victor, the problem happens when you use the del to remove the item from the list. This happens in the last two loops for of the code: for ca in range(len(validos)) ... del…
-
1
votes2
answers4494
viewsA: Scroll through a list of characters
There are several ways to do this, the idea is usually to go through the string and each n characters get block with method String.Substring() passing as parameter the initial position and the size…
-
1
votes1
answer794
viewsA: Error while uploading image to Codeigniter
This happens because the maximum allowed value for the file size in the key max_size of array $config is smaller than the image size: $config['max_size'] = '1000'; You must define this property with…
-
3
votes2
answers544
viewsA: Grab custom tags with Html Agility Pack
Solution found by the author: The problem was using the initials of tag capital letters. Instead of Tag-Teste, utilise tag-teste. The Html Agility Pack deals with the HTML insensitively ¹ in…
-
3
votes1
answer36
viewsA: Get SVG object id
One way to do this is to use getElementsByTagName and traverse the elements in a for. var shapes = document.getElementsByTagName('rect'); for (var i = 0; i < shapes.length; i++) {…
javascriptanswered stderr 30,356 -
2
votes3
answers1994
viewsA: How to count characters from a Java reference?
Another alternative that can be used is the class StringTokenizer package java.util. public static void main (String[] args) throws java.lang.Exception{ StringTokenizer st = new…
-
6
votes1
answer2783
viewsA: How to pass a number in scientific notation in Java?
Maybe the function BigDecimal#toPlainString() may serve that purpose. toPlainString: Returns the representation of string of this Bigdecimal without an exponent field. For values with a positive…
-
2
votes2
answers140
viewsA: Change color of various Panel’s dynamically
One way to do this is to walk the controls of the form and check if it is a Panel, if it is, you perform the action. For Each pnl As Control In Me.Controls If TypeOf (pnl) Is Panel Then…
-
5
votes2
answers3701
viewsA: Get directory from server
This information may be obtained through array $_SERVER passing as argument DOCUMENT_ROOT. DOCUMENT_ROOT: The root directory under which the current script runs, as defined in the server…
-
1
votes3
answers2212
views -
1
votes2
answers89
viewsA: How to erase a word at once?
The method can be used String#replace() to eliminate her. But if you do: texto = txtTexto.getText().toString(); texto.replace("seno", ""); The above code will not work as expected, it will not…
-
1
votes1
answer3262
viewsA: apache server does not execute. php files
These files probably don’t have the necessary permissions. In the terminal type: sudo chmod -R 755 ~/var/www/ This will allow you to read and run the files from the folder /var/www/.…
-
5
votes2
answers19743
viewsA: Warning: mysqli_fetch_assoc() expects Parameter 1 to be mysqli_result, Boolean Given in
This error is launched because the query was not executed correctly, before entering the While(..) {...}, check the returned result: if($sql === FALSE) { // Consulta falhou, parar aqui…
-
3
votes3
answers527
viewsA: Protect secret configuration file
One of the ways you can use to block access to this file would be through a rule via file .htaccess, specifying the file in the directive <Files>: <Files "config.php"> Order Allow,Deny…
-
0
votes2
answers798
viewsA: Convert a text link to a href link
For this just add the hyphenate and the underscore on the catch list. (?<![\>https?:\/\/|href=\"'])(?<http>(https?:[\/][\/]|www\.)([a-z]|[A-Z]|[0-9]|[\/.&?=\-_ ]|[~])*) ^^ Your code…
-
3
votes2
answers699
viewsA: How to send a SOAP in C?
You can use the API WWSAPI, as mentioned in Toby Mosque’s answer, to do this you must basically create a proxy service through function WsCreateServiceProxy and once created, use the function…
-
5
votes2
answers676
viewsA: Catch last delimiter with explode
You can use the function pathinfo with the option PATHINFO_EXTENSION to obtain exclusively that information. $string = "adsfasdfasd.234.asdfa.3rfr.jpg"; echo pathinfo($string, PATHINFO_EXTENSION);…
-
4
votes2
answers2530
views -
3
votes1
answer237
viewsA: Recursive function for integer number input
I believe only one should be missing return when caught the exception. return return_int() Thus remaining the code: def return_int(): try: x = int(raw_input("Number of names to insert?\n")) return x…
-
1
votes1
answer1124
viewsA: Image Check (Captcha) does not work
Errors in executing your code are not shown because the library uses error control operator, the sign @ in front of the expression, this causes any error message of the expression to be ignored.…
-
3
votes1
answer326
viewsA: Python - Test read permissions
You can use the function access(path, mode) module os. Take an example: if os.access("foo.txt", os.R_OK): with open("foo.txt") as fp: # Fazer algo aqui The first parameter of the function is the…
-
2
votes3
answers436
viewsA: Why is array_shift considered a slow function?
The performance of this function is slow at certain times due to reindexation that is done to reorder the items of array, has to be taking into account that its complexity is O(n). Assuming we have…
-
1
votes1
answer251
viewsA: Image upload error: Undefined index
You should check whether $_FILES['imagem'] exists with the function isset. if (isset($_FILES['imagem'])){ $name = $_FILES['imagem']['name']; $tmp_name = $_FILES['imagem']['tmp_name']; $location =…
-
14
votes1
answer398
viewsA: What does '2>' and '&>' mean in Bash?
which rbenv &> /dev/null || return $(node -v 2> /dev/null) The which get the path of rbenv and redirects the stdout and stderr for /dev/null with &>, or || returns the execution of…
-
2
votes3
answers2967
viewsA: How to remove the last character from the last value of an array
You can use the function implode: $items = []; foreach ($_POST['termos'] as $item) { if(isset($item)){ array_push($items, $item); } } $string = implode('+', $items); echo $string; //…
-
1
votes1
answer67
viewsA: How to call another WP app
According to this response from the OS, in WP7 there is no effective way to do this, however in WP8 it is possible and you can use the protocol handlers by means of the method launchUriAsync. For…
windows-phoneanswered stderr 30,356 -
6
votes1
answer3635
views -
1
votes1
answer325
viewsA: php script without permission in root document
You may need to change the access permissions. Open a terminal and navigate to where the file is, and type: sudo chmod 777 log.txt This will allow you full access on that file. For more information…
-
5
votes1
answer64
viewsA: Remove P with Jquery
Use the method .unwrap(). $('p > *').unwrap(); DEMO…
-
1
votes2
answers330
viewsA: Capture and decrease values of multiple Ivs and inputs
Warning: DOMDocument::loadHTML() [domdocument.loadhtml]: ID isOffered already defined in Entity This warning message is issued when the HTML to be parsed contains two or more equal identifiers, in…
-
9
votes4
answers361
viewsA: Decrease span field value with preg_replace
As already mentioned in response from Tivie, regular expressions are not recommended to analyze a structure like the HTML, besides she’s not a regular language, do not use regex when there are…
-
2
votes1
answer233
viewsA: How to take the distance from the scroll bar to the top of the page in Internet Explorer?
According to this response from the OS you can do it like this: var top = (document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop;…