Posts by stderr • 30,356 points
651 posts
-
1
votes1
answer78
viewsA: Open forms change size when closing another
This must have been caused by some change in the properties of the form FrmFornecedor because I could not reproduce this problem, check the property AutoSize is marked as False. At the event…
-
2
votes2
answers571
viewsA: Batch to choose drive letter
Use the command SET to define a variable and with EXIST you check if a file or folder exists. SET "LETRA=" :: Declara a variável que vai receber a letra do drive if exist C:\ ( :: Se existir SET…
-
1
votes3
answers322
viewsA: Put in array strings according to a regular expression
Another expression that can be used is /\[(?:.*?)\]/ that will match anything between [ and ]. var texto = "Eu quero comprar [qtdOvós] e [qtdFrutâs] somando o total de [total Comprãs]"; var array =…
-
10
votes4
answers92747
viewsA: Convert String to whole in Java
Beyond the function Integer.ParseInt, quoted by Mutley, you can also use Integer.ValueOf: public static int strToInt(String valor, int padrao) { try { return Integer.valueOf(valor); // Para retornar…
-
7
votes2
answers233
viewsA: Is there any way to handle all Exceptions of the software?
You can add a Event Handler for event AppDomain.UnhandledException, this event will be triggered when an exception is not detected/handled. It allows the application to record information about the…
-
1
votes1
answer1693
viewsA: Grab database ID when selecting option in spinner?
You can use the method getSelectedItem to get the value of a selected item. Create the following class Spinnerobject: public class SpinnerObject { private int databaseId; private String…
-
3
votes1
answer1921
viewsA: How to Convert RTF to HTML
Ever tried to use that Parser? Include the archive rtf.php somewhere in your project. Then do the following: $reader = new RtfReader(); $rtf = file_get_contents("test.rtf"); // Ou uma string…
-
2
votes1
answer141
viewsA: Postgresql 9.3 Centos Structure
According to the documentation, /var/lib/pgsql/data is the grouping data directory where the data required for a grouping of databases is stored, usually referred to as PGDATA, due to the name of…
-
1
votes1
answer58
viewsA: How to make wsmaximized not hide top menu?
This is not the default form behavior, you must have changed the value of some property for this to occur. Check if the property Align of form is with the value AlClient defined if you are changing…
-
2
votes3
answers2210
viewsA: Remove First Word from String
To remove a word from a sentence, one can do: public static void replaceAll(StringBuffer builder, String from, String to) { int index = builder.indexOf(from); while (index != -1) {…
-
1
votes1
answer1955
viewsA: cont.if it doesn’t work in Excel
The mistake #NAME indicates that Excel failed to identify a certain part of the formula. Instead of CONT.SE use COUNTIF if you are using the English version. =COUNTIF(A1:A38;"Branca")…
-
3
votes1
answer174
viewsA: Scraping with python
You can use the expression #8220;(\w.+)” which will correspond to numbers and letters (minuscules and uppercase) and . who are among #8220; and ”. #!/usr/bin/env python # -*-…
-
1
votes4
answers347
viewsA: Is there any way to detect if there are any asynchronous calls being run?
If you are using jQuery, you can get the number of active Ajax requests through the function $.active, this is a function that jQuery uses internally but not mentioned in the official documentation.…
-
4
votes3
answers6396
viewsA: How to display an image on the screen
If you want to open the image in the default image viewer, you can do: public void openInGallery(String imageId) { Uri uri =…
-
2
votes1
answer204
viewsA: Is it possible to work with spatial object attribute tables in Delphi and dbExpress?
Updating: The solution found to circumvent this problem, according to the author was to make a SELECT in all fields except the field of type Geometry, and change the update mode of upWhereAll for…
-
1
votes2
answers660
viewsA: Print associative array element inside string without concatenation
According to the documentation that nay it is possible. To specify a single literal quote, escape it with a slash reversed (). To specify a backslash, twice ( ). All other instances of backslash…
-
0
votes3
answers141
viewsA: Photo on the web with Windows 8.1 tablet
You can use the API MediaCapture to capture an image, video and audio. Here have an example of use made available by Microsoft for C++, C#, VB. NET and Javascript. This example shows how to capture…
-
5
votes2
answers323
viewsA: How to get server CPU load
You can use the library Phpsysinfo that is open source and does not use exec(), some of the information that can be obtained are: Uptime, RAM usage statistics, temperature, number of processes,…
-
2
votes3
answers14619
viewsA: java.lang.Noclassdeffounderror: Caused by: java.lang.Classnotfoundexception: When run . jar
The exception NoClassDefFoundError is launched when the JVM is not able to find a particular runtime class that was available at compile time, for example, if a method or any static member of a…
-
2
votes2
answers581
viewsA: Use Cookie or Localstorage?
I must really worry about still developing for the Internet Explorer 7 or earlier versions? This will depend on whether you intend to support older browsers, particularly I believe that it is not…
-
2
votes3
answers16370
views -
8
votes3
answers13619
viewsA: How to split a string into an array in Javascript?
You can use the method split as already mentioned, along with the expression \s+, which will correspond to one or more spaces. var str = "FAT* FAT32*"; var match = str.split(/\s+/); alert(match[0]);…
-
22
votes4
answers37758
viewsA: What is the difference between "&&" and "||" and "and" and "or" in PHP? What to use?
This image illustrates the difference between the two logical operators. Both operators result in a boolean value, i.e., true(true) or false(false). And: $a and $b: Returns true if both past values…
-
2
votes1
answer183
viewsA: Match fractional number javascript
You just need to add one . and , in the expression leaving so /[0-9,\.]+(?=\%)/. The modifier i is not necessary in that situation. Fiddle…
-
2
votes2
answers4158
viewsA: How to get the host name in Urls?
You can get this value by manipulating HTML, see: $contextOptions = array( "ssl"=>array( "verify_peer" => false, "verify_peer_name" => false, ), ); $url =…
-
2
votes1
answer1222
viewsA: Calling another terminal with python
You can use the functions provided by the module subprocess to execute commands in the terminal. import subprocess cmd = ['gnome-terminal'] # Se estiver usando o GNOME cmd.extend(['-x', 'bash',…
-
5
votes2
answers509
viewsA: How to read the width and height of a physical image file?
You can get this information using the class Image, through the properties Height and Width. var img = System.Drawing.Image.FromFile(@"c:\Path\1.jpg"); MessageBox.Show("Width: " + img.Width + ",…
-
6
votes2
answers7907
viewsA: Convert XML to PHP array
To convert correctly an XML for Array without the need to use JSON, the method below can be used for this. function xmlToArray($xml, $options = array()) { $defaults = array( 'namespaceSeparator'…
-
1
votes1
answer647
viewsA: Error sending e-mail by Indy 10
According to this article from Microsoft, follow the steps below to resolve this impasse. Open the Control Panel → Programs → Programas Padrão. Click on Set access to programs and computer patterns.…
-
2
votes1
answer59
viewsA: How to check on the console for open websockets connections?
If you’re using Google Chrome you can do: Open the Developer Tools window, shortcut: CTRL + Shift + I. Click on the tab Network. Click on the tab WebSockets. Click the button Filter. In the Firebug…
-
2
votes1
answer720
viewsA: Identify elements with xPath
To catch the value it is necessary to put @value at the end of query, being like this: $node = $xpath->query("//input[@id='ctl00_ContentPlaceHolder1_txtData']/@value"); Like the xpath does not…
-
3
votes2
answers1048
viewsA: Warning: preg_match(): No ending delimiter ' '
It is necessary to place delimiters in the regular expression, thus: if(preg_match("/^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}$/", $email, $check)) A delimiter can be any…
-
1
votes1
answer147
viewsA: Eclipse does not show java attribute hint
Try the following. Go on Window → Preferences → Java → Publisher → Content Assist → Advanced and make sure the option Java Proposals is checked, valid for Eclipse Kepler and Luna.…
-
1
votes1
answer98
viewsA: Is it possible to encode line by line in Base64?
It is possible yes, the code below was taken from a commenting about the function base64_encode. $fh = fopen('Input-File', 'rb'); //$fh2 = fopen('Output-File', 'wb'); $cache = ''; $eof = false;…
-
1
votes2
answers264
views -
1
votes1
answer188
viewsA: How to send a Bufferedimage by POST method?
The method below does what you ask, code extracted from this reply soen. public static void upload(BufferedImage image) { String IMGUR_POST_URI = "https://api.imgur.com/3/upload"; String…
-
1
votes1
answer1459
viewsA: Get name of worksheets containing in an excel file with c#
In that article has an example that demonstrates this using the OLEDB. The function returns a array containing the sheet names in the parameter excelFile you will point to the Excel file. // Utilize…
-
1
votes1
answer290
viewsA: Error running project: Cannot set up guest memory 'android_arm': Invalid argument
Reduce emulator RAM size. In the Eclipse go on: Window -> Android Virtual Device Manager, select your device and click the button Edit on the right side of the window, then on Memory Options look…
-
2
votes3
answers226
viewsA: How to use Getsetting/Savesetting in Windows Services
You’re giving in to reading permission as the function requires? If you prefer another way to obtain and change this data, you can use the class methods RegistryKey for that reason. To recover a…
-
3
votes4
answers9489
viewsA: How to call a new terminal from a shell script?
If you are using the GNOME as an interface, you can call a new terminal by calling the gnome-terminal, see an example: #!/bin/bash readonly OUTRO_SCRIPT="hello1.sh"; # O script a ser executado chmod…
-
2
votes2
answers975
viewsA: How to get the directory the program is running?
For Windows system you can use the function GetModuleFileName() passing the parameter hModule a null value. Something like this(not tested): #include <iostream> #include <Windows.h>…
-
2
votes1
answer1442
viewsA: Report display error (Fastreport) in Multi-language software
Apparently there seems to be no solution to this error that is generated by the class EResNotFound, this exception is cast when a specific decline, such as a form that cannot be found, a form…
-
1
votes1
answer454
viewsA: How to simulate a time trial with Tkinter?
The example below makes a countdown of 60 seconds at the end of that time is displayed a message. To make it work the method is used after() available on Tkinter, this method records a function…
-
4
votes3
answers229
viewsA: Foreach returning unconverted array
The function preg_match_all returns a array multidimensional, the amount of subarrays is proportional to the number of groups in regular expression, such as mentioned by bfavaretto in comment. To…
-
2
votes3
answers366
viewsA: How to Record Data in Windows Registry?
In addition to the solutions already presented, it is possible to use some Winapis that provide you with access to the Registry and handling it. RegOpenKeyEx: Opens specified key for read or write.…
-
4
votes1
answer717
viewsA: Avoid endless loop of errors
As quoted by @Caffe in comment, the correct thing would be for you to capture the exceptions launched and treat them. The error of Access Violation is something critical, assuming that gender…
-
9
votes4
answers4731
viewsA: How to check if the first four characters of a string match 'www.'?
Another alternative is the method RegExp.test var endereco = "www.google.com"; if (/^www\./.test(endereco)) console.log("Começa com www."); else console.log("Não começa com www."); The expression…
-
7
votes1
answer14394
viewsA: Decrypt db.crypt files
According to this article the files with the extension .db.crypt use a 192 key bits AES, whose value is 346a23652a46392b4d73257c67317e352e3372482177652c. To decrypt you can use Openssl which is…
-
12
votes2
answers1533
viewsA: Material for the study of functional languages: scala, Haskell and Erlang
Scala A tutorial by Scala - for Java programmers Introduction to the Scala language Mailing list in Portuguese Programming in Scala, First Edition - by Martin Odersky, Lex Spoon, and Bill Venners -…
-
9
votes2
answers420
viewsA: How to remove a variable from memory?
Suppose you assigned memory dynamically using malloc() you release it using free(). If memory has been statically allocated, you can’t release it. Follows the code Assembly of a piece of code…