Posts by stderr • 30,356 points
651 posts
-
6
votes6
answers8712
viewsA: How and when to use Finally after a Try?
The code inside a block finally will run regardless whether or not there is an exception. This is useful when it comes to certain functions in which you need to do closing connections, disconnect or…
-
6
votes2
answers110
viewsA: String assembler (or How to improve the performance of massive replacements)
I’ve been researching the subject and found this project StringBuilder. Which seems to be optimized for what you want. Normally a code snippet similar to this would be used: var myString = ""; for…
javascriptanswered stderr 30,356 -
2
votes2
answers2098
viewsA: Handle windows events using Python
Because it is a script that will run in Windows, the function can be used Shell_NotifyIcon to show the popup. Example: from win32api import * from win32gui import * import win32con import sys, os…
-
1
votes1
answer228
viewsA: How to avoid page being displayed in another tab
I think you might be doing it this way: window.open("/gerenciarpdv","_self") Or location.href = "/gerenciarpdv" Jsfiddle I’m not familiar with jQuery, so I believe there can be more appropriate…
-
7
votes2
answers600
viewsA: How to read a file with an email list?
You can use the function file() to read the e-mails and put them in a array. $texto = file('emails.txt'); Now just use the explode() to capture the emails and separate them by the comma. $emails =…
-
1
votes1
answer234
viewsA: Regular expression for picking up HTTP input and header
I didn’t quite understand what the question is asking but, here’s a try. Try using the following expression: /csrftoken=([\w]+)\;/ Demo The second expression: /value=\"([\w]+)\"/ Demo…
-
4
votes2
answers1007
viewsA: Windows Ping should return only response values
Do the following: @echo off for /f "tokens=* delims= " %%i in ('ping -n 1 bing.com^|find "ms"') do set "tempo=%%i" echo.%tempo% PAUSE The result must be similar there is this: Now to capture only…
-
3
votes3
answers954
viewsA: How to list variables defined within a Javascript scope?
Yes and nay. Not in almost all situations. Yes, but only to a limited extent if you want to check the overall range. See the following example: var a = 1, b = 2, c = 3; for ( var i in window ) {…
-
4
votes2
answers259
viewsA: Regular expression error in PHP
Use regular expression this way: /:[^\/\\\\]*/ References: Escape backslash [ ] in PHP regex? Escape Sequences…
-
2
votes3
answers543
viewsA: Make a rest screen with Jquery
You can make one like this: var s_saver; $('body').mousemove(function() { clearTimeout(s_saver); s_saver = setTimeout(function(){ $('#screensaver').fadeIn(900); }, 4000);…
-
3
votes1
answer1198
viewsA: Pascal Car Rental System
Basically saying you should create a registry vector that will contain the following data: car model, make, daily value, situation (Available or Rented), current customer and daily amount. Consider…
-
2
votes2
answers2318
views -
3
votes4
answers11584
viewsA: How to put a Python module in a different folder than my script?
In Python 2.x, you can use the module Imp: This module provides an interface to the mechanisms used to implement the import statement. Use the functions find_module and load_module. find_module:…
-
5
votes1
answer750
viewsA: How to create a Splash Screen on Windows Phone
See this article How to create an opening screen for Windows Phone(Msdn - English). Free Translation: If you are using a single image, you should add an image file that is 768×1280 nominee…
-
2
votes2
answers1293
viewsA: Hide Subitems from a Listview?
Unfortunately there is no way to do this, at least not natively. The idea I had to work around this was to save the data in a list of strings(StringList) in a global variable. Updating Do the…
-
10
votes2
answers1100
viewsA: What is the difference between Meter and Progress in HTML5?
According to this answer in the Soen there is not much difference between using one or the other. Basically the tag <progress> is used to display the progress of a specific task(eg: inform the…
-
3
votes2
answers1898
viewsA: What is the difference between Tsqldataset, Tsqlquery, Tsqltable and Tsqlsimpledataset components?
The COMIC(Borland Database Engine) was used in earlier versions of Delphi. Although not obsolete(yet?!), it is advisable to migrate to the dbExpress or Firedac. The dbExpress was introduced from the…
-
6
votes2
answers6538
viewsA: Meaning of ?: ?= ?! ? <= ? <! in a regex
Lookahead is a way to find strings that have a certain ending or not. It is used (?⁼..) for the positive, that is to say, that they end with; and (?!..) to the negative, that is, that does not end…
-
2
votes1
answer752
viewsA: Associate a file with an application made on Lazarus on Linux
I believe you can use the xdg-utils to do this in a Linux environment. First, you will need to register the icon for the type MIME through the command: xdg-icon-resource install --context mimetypes…
-
6
votes3
answers7833
viewsA: Count elements in a Java Arraylist
You can use the attribute length, and you can access it to know the size of the array. public void contarMusica(Musica m){ int contador = 0; for (int i = 0; i < m.length; i ++) if (m[i] != null)…
-
5
votes2
answers827
viewsA: Types of payment prohibited on IOS
According to the section 11.2 of App Store Review Guidelines for iOS(Login required - you can also read here) any application that does not use the In-App will be rejected. Applications using a…
-
1
votes1
answer1913
viewsA: Counting Items from a Listview
You can count the items of a Listview through the use of Listview.Items.count(as already mentioned in comment from Motta). ShowMessage('Quantidade de Itens ' + IntToStr(ListView1.Items.Count));…
-
2
votes2
answers1098
viewsA: Unable to load dbxmss.dll in Delphi XE4
By default this Dll(Dbxmss Driver) is by default in the directory Bin(C:\Program...\Embarcadero\RAD Studio\<Versão>\bin) delphi. In case you don’t have the file(which would be unlikely) you…
-
6
votes2
answers7696
viewsA: Get the current date and time by internet in desktop application
Delphi In Delphi if you have installed the components of Indy(in recent versions of Delphi the Indy comes already embedded), you can get the time by using the component IdSntp. Example: { Na seção…
-
3
votes4
answers3355
views -
13
votes1
answer1319
viewsA: How to install a Windows Service without Setup?
You can use the class ManagedInstallerClass (responsible for dealing with the functionality of Installutil), more specifically, the method InstallHelper: static void Main(string[] args) { if…
-
3
votes1
answer2003
viewsA: How can I check if there is a file in an URL with Idhttp?
This can be done through an HTTP request using the method HEAD to request information from a particular resource, without it being returned. According to the Wikipedia: Variation of GET where the…
-
1
votes2
answers495
viewsA: Serversocket IP lock?
I believe this is possible. To block an address list (be in a Memo or in a StringList) you can use a function like this: { Verifica se uma lista contem determinada string(IP bloqueado) } function…
-
5
votes3
answers1771
viewsA: Print html code
To do this you need to escape some special characters**, for example: " para " ' para ' & para & < para < > para > To facilitate you can use the…
-
3
votes2
answers1731
viewsA: How to handle dependencies (DLL’s) in Delphi/Lazarus?
How do I find out which DLL’s I should distribute together with my app so it works on any machine? I know the Installshield - it does business in an automated way, but I would like to know if there…
-
0
votes3
answers240
viewsA: How to display "from" inside the Datetimepicker
Use the barra invertida \\. To prevent a character from being interpreted as a specifier format, you can precede it with a backslash \\, which is the escape character. The escape character means…
-
3
votes1
answer1423
viewsA: How to place dots or location markers on the map
According to the documentação in the Markers section. The builder google.maps.Marker takes a single literal from the object Marker options that specifies the initial properties of the marker. The…
javascriptanswered stderr 30,356 -
15
votes3
answers10198
viewsA: What are lexical scope and dynamic scope and what are their main differences?
From the text of Wikipedia(Lexical Scope vs. Dynamic Scope): What is? In Computer Science scope is a bounding context to which values and expressions are associated. Programming languages have…
answered stderr 30,356 -
1
votes3
answers3236
viewsA: Mouse Click without Moving Screen Cursor
At the event OnClick of Button1 put the following code: SendMessage(Button2.Handle, WM_LBUTTONDOWN, MK_LBUTTON, 0); SendMessage(Button2.Handle, WM_LBUTTONUP, MK_LBUTTON, 0); This will make clicking…
-
1
votes3
answers4604
viewsA: Count characters without empty spaces
To do this you can use the function std::erase. #include <iostream> #include <algorithm> using namespace std; int main() { string str = "Stack Overflow em Portugues";…
-
4
votes2
answers211
viewsA: Displays hexadecimal value in cmd.exe
The correct is to use the %c to display the character, %s is used to display a string of strings. unsigned char eh = 0x82; printf("%c", eh);…
-
1
votes2
answers1670
viewsA: How to load semi-transparent PNG through a memory stream?
Well, I believe that manipulating property TransparencyMode of a component TPNGImage should be useful to you. Uses pngimage; // ... var PNG : TPNGImage; // ... begin // ... PNG := TPNGImage.Create;…
-
5
votes4
answers1842
views -
9
votes5
answers7529
viewsA: How to search recursively using grep
Use the parameter -r of grep. grep -r "foo" . Where the . indicates the current directory to start the search. If you prefer to search for a word in files with a specific extension, you can do: grep…
-
9
votes5
answers20688
viewsA: How to verify similarity between strings?
There is an article(How to Strike a Match) created by Simon White related to what you want, he wrote an article about an algorithm that compares adjacent pairs of characters that should be useful to…
-
7
votes2
answers7627
viewsA: What is the C/C++ volatile modifier for?
A variable or declared object volatile prevents the compiler from performing code optimization involving volatile objects, thus ensuring that each volatile variable assignment reads the…
-
1
votes2
answers134
viewsA: How to use Logicexception from PHP?
The exception LogicException is released when the code shows some logic error. Exception representing error in program logic. This type of exception must lead directly to a correction in your code.…
-
4
votes3
answers5076
viewsA: How to pick up the arrow keys in C/C++?
One way to do this in Windows is to use Hooks, which is a technique used to intercept, monitor and modify the behavior of system calls, functions, messages and events. You can detect the directional…
-
3
votes2
answers260
viewsA: Threads with size set via code
Unfortunately the class TThread does not allow setting the stack size of the thread. The only way to achieve this would be to use the function BeginThread, but as you said is not feasible in your…
-
1
votes3
answers457
viewsA: Lock the window zoom
You can use the method setFixedSize to do this. Example: setFixedSize(this->geometry().width(),this->geometry().height());…
-
2
votes3
answers232
viewsA: Change CRT file to byte
Well, you can use the library Apache Commons to achieve this. Attention to the functions IOUtils.toByteArray(InputStream input) and FileUtils.readFileToByteArray(File file). If you do not choose to…
-
8
votes3
answers2325
viewsA: How does the rotation of Bits in C work?
This text from Wikipedia(Circular Shift - Circular Change, in free translation) explains how this is done. A circular change is the operation of rearranging the inputs into a tuple, or moving from…
-
3
votes3
answers180
viewsA: It is a standard for email providers' SMTP addresses to be in the default: smtp.provedor.com?
I believe it is not a standard, just a conventional practice. In RFC974 does not impose such restriction as long as the address. :)…
-
0
votes3
answers869
viewsA: Time measurement in Windows
The text(Optimizing software in C++ - recommend read) shows how we can achieve this. Translated: Time measures may require very high resolution if the time intervals are short. In Windows, you can…
-
4
votes2
answers4768
viewsA: How to get MD5 from a file in Delphi?
In the older versions of Delphi(as a 7), the component Indy is not built in by default. If you want to do this without using components, you can use esse código redistributed by software developers…