Posts by Guill • 1,283 points
40 posts
-
3
votes2
answers671
viewsA: Search javascript input value
/** * @param String input - O id do input com o valor a ser adicionado/removido. * @param String output - O id do input com a lista atual de valores. * * @return void * **/ function doIt(input,…
javascriptanswered Guill 1,283 -
0
votes1
answer66
viewsA: How to keep an image in a form?
As stated in the comments, for whatever reason the method SetSize deletes the current content of bitmap. Therefore, removing the call to this method causes the image to remain in the form. In case…
-
3
votes1
answer258
viewsQ: How to improve the performance of a key search?
In view of the fact that TDictionary exposes only ways to recover value through the key, I have the following algorithm to fetch a key from its value: var Table: TDictionary<Int64, Extended>;…
-
3
votes1
answer373
viewsQ: How to concatenate two lists efficiently?
Aiming at the union represented by the figure: In view of the structure below: TMyRecord = record Index: Int64; Kind: TMyEnum; Value: String; end Having two lists…
-
0
votes1
answer84
viewsA: How to discover all the objects in a Joystick?
Well, the error is happening because of the type of procedure used in IDirectInputDeviceW.EnumObjects. The method declared in the header is as follows: function EnumObjects(lpCallback:…
-
1
votes1
answer66
viewsQ: How to keep an image in a form?
Hello! To use in game production, I would like to understand how to keep an image in a form through Firemonkey. The code I have so far is as follows:: program TestCase; uses UITypes, Classes, Types,…
-
1
votes0
answers96
viewsQ: Can Firemonkey use my GPU and Direct2d?
I’m starting a game development for Windows 10 and would like to know if Firemonkey can use my GPU without any extra configuration. I’ve heard "rumors" that Firemonkey can actually automatically use…
-
1
votes1
answer84
viewsQ: How to discover all the objects in a Joystick?
I am compiling a project for Win32 using the Directx Directinput library to manage Joysticks. I tried to successfully identify if any Joystick is connected through the enumeration: uses Classes,…
-
1
votes3
answers129
viewsA: Performing dual function not named in the declaration act of the same
If you want to perform a function right at the page load, just remove the code from the function and let it loose in the script. How: var b = 'hello world!'; console.log('bar'); console.log('foo ' +…
javascriptanswered Guill 1,283 -
-1
votes3
answers3097
viewsA: How to generate random matrices without repeating numbers on the same line?
Just play that code on main: int[][]mega = new int[7][6]; Random gerador = new Random(); for(int x=0; x<7; x++) { for(int y=0; y<6; y++) { int n = gerador.nextInt(60) + 1; int z = 0; while(z…
-
3
votes1
answer363
viewsQ: How to Convert Binary Files to String Securely?
Operating System: Windows 10; Version of Ruby: 2.2.1; Server Application: Apache 2 (mod_cgi); I must create a script that reads a file, convert it to text and after a possible processing, send the…
-
3
votes5
answers2182
viewsA: How to select a full xml/html tag with Regular Expression even if there are identical tags internally?
As said by @ctgPi: HTML is not a regular language and therefore cannot be processed by a regular expression. Therefore it is necessary to write functions to perform HTML processing. Here a sample of…
-
1
votes5
answers2182
viewsA: How to select a full xml/html tag with Regular Expression even if there are identical tags internally?
Basically this Regex works for your problem. In some samples it should fail. But for your problem it serves. \<(minhaTag)(?:…
-
1
votes1
answer755
viewsA: Section overwrite my header
Once your <header> is the first element in the body of the page, are not required (acceptable) the following style lines: position: absolute; top: 0; left: 0; Remove these lines so that the…
-
1
votes2
answers468
viewsA: Regular expression problem in . htaccess
According to Regexr: ? Matches 0 or 1 of the preceding token, effectively making it optional. ? Corresponds to 0 or 1 occurrences of the previous element, making it optional. on the other hand: \?…
-
0
votes1
answer95
viewsQ: How to map all requests to a single file?
I need to map all requests that arrive to the server as follows: exemplo.com/joao => exemplo.com/index.pl?u=joao exemplo.com/joao/ => exemplo.com/index.pl?u=joao My file /var/www/.htaccess is…
-
1
votes2
answers1650
viewsA: Show hint when component receives focus
Work the following code at the event OnEnter of) TEdit(s) desired: Create the necessary variables: var Origin : TPoint; // Receberá a origem do Form na tela HintWindow : THintWindow; // Objeto Hint…
-
4
votes3
answers3031
viewsA: What better way to create an app that works offline and automatically encrypt data with a server?
The method I suggest is as follows. Assuming you can use a scripting language on your server, first load the Local Database data into the Delphi application (Android). To proceed, add the Indy HTTP…
-
1
votes1
answer75
viewsQ: How to send errors and exceptions to the main output?
I’m using Ruby 2.1 32 bits. Interpreting scripts as CGI by Apache 2. Through Local IP. I am in a process of migrating several script in PHP to Ruby. During the process of writing code, several times…
-
4
votes2
answers1970
viewsQ: What is the relativity of the rem unit?
I have the following style sheet: html{ font-size: 16px; margin: 40px; padding: 32px; } p{ font-size: 1.5rem; padding: 2rem; margin: 1.8rem; } I know that the source of my paragraphs will be 24…
-
2
votes3
answers3037
viewsA: Calculate loading time of a page
You can try a ping using your server, assuming it is available and you use jQuery: // Timer de Alta Resolução hDPing = window.performance.now(); // Timer de Alta Resolução para browser baseados em…
javascriptanswered Guill 1,283 -
3
votes4
answers3475
views -
4
votes4
answers3211
viewsA: How to do strstr() in jquery
Use indexOf javascript that returns the position of a string in another. If the return of indexOf for -1 means that the first string is not within the second. Example if("string que…
-
4
votes3
answers3037
viewsA: Calculate loading time of a page
Right after the tag <head> from your page, add the following script: <script> var time = new Date().getTime(); </script> Before closing </body> the next script:…
javascriptanswered Guill 1,283 -
3
votes2
answers2617
viewsA: How to list objects of a deteminated class?
Assuming a class and an example type: TMyClass = class private FIndex : Integer; public //Crio um novo tipo TMyClassArray que representa um array dessa nova classe. type TMyClassArray = array of…
-
2
votes1
answer884
viewsA: Identifying a String as Pascal variable name
Even though there is a gambiarra (which I highly doubt) that serializes local identifiers on String, the proposal below is simpler and (in my opinion) more elegant. interface uses Vcl.Dialogs,…
-
4
votes1
answer1368
viewsA: When to use vertical-align?
Use vertical-align to vertically center an element in its "parent". Unlike text-align this does not adjust the text horizontally, but vertically the whole content of the element. Can have the…
-
3
votes1
answer152
viewsQ: Does the base tag affect scripts and styles in an html document?
Having in http://exemplo.com/diretorio1/documento1.html the code: <!DOCTYPE html> <html> <head> <title>Uma página</title> <base href="http://exemplo.com/diretorio2/"…
-
2
votes1
answer129
viewsQ: How to use top in image style with relative width?
I have the following code: <!DOCTYPE html> <html> <head> <style> img {position: absolute; height: auto; } </style> </head> <body> <div style="width:…
-
5
votes1
answer2723
viewsQ: How to change the font color of a Jtextarea?
All over the internet I just found people wanting to know how to stylize part of the text and being "redirected" to JTextPane, then there are no answers to my question around. So there you go: I got…
-
3
votes1
answer61
viewsQ: Why isn’t the style being applied?
I have the following program: program Paker; {$APPTYPE GUI} uses Vcl.Forms, Classes, SysUtils, Vcl.StdCtrls; var FForm : TForm; FModeComb : TComboBox; FBtn : TButton; begin Application.Initialize;…
-
13
votes3
answers1792
viewsQ: How to create a solid mask from a semi-transparent Bitmap?
I want to create the image on the right from the one on the left. And I have the following structure: var Image, Mask : TBitmap; begin Mask := TBitmap.Create; Image := TBitmap.Create;…
-
1
votes2
answers1670
viewsA: How to load semi-transparent PNG through a memory stream?
I realized that it is very "gambiarroso" what I am doing. The best practice would be to use only TPNGImage, in this way: public FPNG : TPNGImage; ... var Stream : TMemoryStream; begin Stream :=…
-
2
votes2
answers1670
viewsQ: How to load semi-transparent PNG through a memory stream?
I have the following structure: public FBMP : TBitmap; ... var PNG : TPNGImage; Stream : TMemoryStream; begin Stream := TMemoryStream.Create; Stream.LoadFromFile('foo.png'); PNG := TPNGImage.Create;…
-
4
votes2
answers17667
viewsQ: How to send string variables as parameter to call Ajax?
The following Ajax call would send PHP the parameters corresponding to the form that called the function: var foo = "bar"; var bar = "foo"; function register(){ $.ajax({ method: "post", url:…
-
7
votes1
answer25983
viewsQ: How to run PHP file from Javascript function?
I have the following structure for registering a new Mysql database account (Register.php): <?php $con = mysqli_connect("meu_host","meu_user","minha_senha","banco"); mysqli_query($con,"INSERT…
-
0
votes2
answers998
viewsA: Method does not work when called
I have no experience with C#, but from what I understand the following should work: Supposing they are in namespaces separately, add the namespace of Form1 no using form2: using Form1; If you happen…
-
0
votes1
answer246
viewsQ: How to use Bass_fx.dll attributes?
Next. I was using bass.dll without any problem. But when I try to use the attributes of bass_fx.dll, the bass does not recognize. I performed the installation of the two dlls as follows. 1- I copied…
-
5
votes1
answer469
viewsQ: Am I loading this Song correctly with Bass.dll?
Based on documentation from Bass, i am trying to upload a common ogg file, with the following code: var FFile : string; Music: HSAMPLE; ch: HCHANNEL; OpenDialog1 : TOpenDialog; begin…
-
4
votes1
answer2247
viewsQ: How to stop a Thread for a certain time without using a Timer?
Explanation: Next, I have a TThread running parallel to Main Thread. And I have a routine to give fade image. Well, the important thing is that I realize this fade in a given time in milliseconds,…