Posts by Gabriel Sales • 1,257 points
84 posts
-
1
votes2
answers148
viewsQ: String "letter" position
How can I get the position of a letter in a string. EX: a = "x x x" I’d like to take the position of each x. I tried using the string.find, but he just took the one from the first one.…
luaasked Gabriel Sales 1,257 -
9
votes3
answers1558
viewsQ: Last folder of a directory
How do I get the last folder from a directory. Ex: C:\Program Files\Skype The last folder would be Skype.
-
0
votes4
answers3097
viewsA: Path is file or directory (folder)
With @Raul’s tip, I did this function: function isFolder(dir:string):boolean; var fof : boolean; begin if FileExists(dir) then fof := false else fof := true; Result := fof; end; If it returns true,…
delphianswered Gabriel Sales 1,257 -
4
votes4
answers3097
viewsQ: Path is file or directory (folder)
How do I check if a path points to a file or folder? I have no idea how to do it. A folder or directory path would be: C:\Program Files\Embarcadero\RAD Studio\10.0\bin A file: C:\Program…
delphiasked Gabriel Sales 1,257 -
0
votes2
answers2180
viewsA: Delete item from Dynamic Array
I ended up not using array, but Tstringlist. http://www.activedelphi.com.br/forum/viewtopic.php?t=65822&sid=9d65d7309f79a1e91775e3525ea87322…
delphianswered Gabriel Sales 1,257 -
6
votes1
answer114
viewsQ: Accented letters returning invalid character
Well, I realized that in Lua, you can’t use accented letters. print("á") Returns an invalid character. Is there any way to avoid this?
luaasked Gabriel Sales 1,257 -
2
votes2
answers2180
viewsQ: Delete item from Dynamic Array
Well, I’m trying to use this Procedure to delete array items: Before I declared in Type: TStringArray = array of string; In public: filestoadd : TStringArray; And no create: for x:=0 to 5 do begin…
delphiasked Gabriel Sales 1,257 -
3
votes1
answer372
viewsQ: Idhttp grab file size downloaded
Well, I would like to know how to find the file size that is being downloaded with the Idhttp component.
-
0
votes1
answer269
viewsQ: Coloring text within "tag"
Well, I have a Rich Edit and I’m using it as a changelog, and I’d like every text with you in -><-to be of a specific color. For example, in: ->10/10/2014<- 10/10/2014 would be of a…
-
1
votes2
answers60
viewsA: Illegal Loop + Expression in Valuator
The mistake was in: downloadedf[high(downloadedf)+1] I was already increasing the length before and tried to insert a value into a non-existent field. I just took the +1.…
-
0
votes2
answers60
viewsQ: Illegal Loop + Expression in Valuator
I am downloading several files (one after the other) by one loop, but as soon as the first one goes down, it gives crash. Follows the loop: for x := StrToInt(version)+1 to StrToInt(version2) do…
-
5
votes1
answer121
viewsQ: D7zip file list
I’m using the D7zip(https://code.google.com/p/d7zip/source/) to extract files, and would like to receive the entire list of files from the archive archive. In the documentation, I found this: with…
-
6
votes2
answers12692
viewsQ: Find out if item is in array
How do I check if an item is in a array? Ex: var Tabela : Array of String; begin Tabela[0] := 'Valor'; Tabela[1] := 'Value'; if Tabela[0] = 'Valor' then // do wathever; That would be the normal way,…
-
4
votes2
answers873
viewsA: Run executable independent program
I managed to do, I found a way on this link: http://www.delphibr.com.br/artigos/atualizador.htm More clearly, in this part: program Atualizador; {$APPTYPE CONSOLE} uses SysUtils, Windows; var min:…
-
3
votes2
answers873
viewsQ: Run executable independent program
I am making a Updater, but at certain times, I need to update the executable, which is not possible since it is in use. You would have a way to swap the executables and run the program afterwards.…
-
1
votes2
answers1529
viewsQ: Break a For Loop
How do I break a loop? EX: for x:=1 to 10 do if x = 5 then "break" end When it reached 5, the loop would be broken, no longer continue. Of course it would be another condition. I wonder if there’s a…
delphi-7asked Gabriel Sales 1,257 -
2
votes1
answer44
viewsQ: To continue if true
Well, I’m trying to run several downloads, one after the other, and I’d like you to start the next one after the other. The codes are these: if StrToInt(version) < StrToInt(version2) then begin…
-
2
votes1
answer1222
viewsQ: Run commands when opening program
Well, I am trying to execute several commands when opening the program, but this prevents the same to be shown at the desired time, since it executes all to then show. I am trying to execute such…
-
3
votes1
answer210
viewsQ: Error in created function
Well, I did a job, but it’s not working. The purpose of this function is to download a file and when finished, return true. This is the function: function TForm1.BaixarArquivo(Sender: TObject;…
-
4
votes1
answer179
viewsQ: Read Ini from a website
I want to read the ini file of a site, but I’m not getting. I tried so: inicheck := 'http://pokestage.ddns.net/patch/CHECK.INI'; conf2 := TIniFile.Create(IdHTTP3.Get(inicheck)); version2 :=…
delphiasked Gabriel Sales 1,257 -
3
votes1
answer80
viewsQ: Temporary file with Indy
Well, I’m trying to download a text file and get a Richedit to take the content from that file. But I don’t really know how to do it. I tried so: news :=…
delphi-7asked Gabriel Sales 1,257 -
0
votes0
answers179
viewsQ: Binary for text
I’m trying to read a binary value from a table, but I can’t get what I want. On the moon, is there any way to convert binary content to text? mysql database. I’m trying the following command:…
luaasked Gabriel Sales 1,257 -
6
votes1
answer206
viewsQ: Sort table by contained value
I want to sort such a table by a value contained in it. Ex: tabela = { {pessoa="Joao", idade=20}, {pessoa="Pedro", idade=22}, {pessoa="Lucas", idade=19}, {pessoa="Derp", idade=25} } I want to sort…
-
3
votes1
answer196
viewsQ: How do you get time for a millisecond?
I would like to take the time (HH:MM:SS) per millisecond. Ex: 86400000 Would be: 24:00:00 since it is the equivalent of a day.
-
3
votes1
answer82
viewsQ: String (g)Match
Well, I’m looking to turn a string into a table. I tried so: toset = "nb = 10, gb = 20, sb = 0, sfb = 0, ub = 0;" toget = "nb = (.-), gb = (.-), sb = (.-), sfb = (.-), ub = (.-);" t =…
-
4
votes1
answer946
viewsQ: Array size
How do I get the size of an array with this structure: A = { ["b"] = {c=1, d=2}, ["e"] = {f=1, g=2}, } I want to take the size of A, in this case, 2.
-
0
votes1
answer116
viewsQ: Session_destroy() returns error
I am making a page, and in parts, PHP use, but in one part gives an error in the log out. Follow the error: Warning: session_destroy(): Trying to Destroy uninitialized Session on line 22. Follows…
phpasked Gabriel Sales 1,257 -
2
votes1
answer71
viewsQ: Select in encrypted value
Well, I created a table and entered a value into a field using SHA1(Encrypt), and I don’t know how to select the value by this encrypted field. TABLE: CREATE DATABASE IF NOT EXISTS `quest`; USE…
mysqlasked Gabriel Sales 1,257 -
7
votes3
answers392
viewsQ: String contains a certain word
I’d like to check if a string contains a certain word. String = "oi\ntchau\nhi\nbye" To string is divided by \n (jumps line), I would like to check between each line, if it contains the whole word,…
-
3
votes1
answer107
viewsQ: Print does not return table values
pokecatches = { ["Bulbasaur"] = {chance = 150, corpse = 5969}, ["Ivysaur"] = {chance = 275, corpse = 5982}, ["Venusaur"] = {chance = 400, corpse = 5962}, } print(table.maxn(pokecatches)) corpses =…
-
5
votes1
answer498
viewsQ: Check values in txt
Well, I want to save a value in a txt file, checking if there is already some value with 2 similar things. Ex: local file = io.open("arquivo.txt", "a+") local oi = {dia=os.date(),…
luaasked Gabriel Sales 1,257 -
3
votes1
answer128
viewsQ: Take array name within array
Well, what I want is the following: take the name of an array within another array, just the name. EX: local a = { ["oi"] = {sim=1, nao=2}, ["tchau"] = {sim=2, nao=1} } local falas = {}…
-
4
votes1
answer165
viewsQ: Save table value
I would like to save the value assigned to a table in real time, I will explain. I have 2 files: Main moon. dofile("tester.lua") io.write("blabla") table.insert(oi, io.read()) print(oi[1]) io.read()…
-
3
votes1
answer155
viewsQ: Check if a value corresponds to a value in an array
How to check if a given value corresponds to another present in an array? Ex: array1 ={nome = "Fulano", idade = 15} print(array1[idade].nome)