Posts by Gabriel Sales • 1,257 points
84 posts
-
4
votes3
answers283
viewsQ: How to delete duplicates between multiple tables
I have three tables with structure similar to this: CREATE TABLE itens_chao ( id int PRIMARY KEY AUTO_INCREMENT, pos_x int, pos_y int, nome varchar(255), quantidade int, numero_serie int(11) );…
-
3
votes1
answer180
viewsQ: How to get a string from an hbitmap
I have a function that captures the monitor image and creates a bitmap file with the result, but I would like you to return a string with the content that the file would have, instead of writing it…
-
4
votes5
answers3789
viewsQ: NPM does not continue package installation
I’m trying to install a simple package with NPM, but the installation doesn’t start, always stops at the same place. C:\Users\Gabriel>npm install -g luaparse --verbose npm info it worked if it…
-
1
votes1
answer163
viewsQ: Keep connection active after a POST request
I am trying to create a script to activate the QOS bandwidth control service of my router, but I am doing something wrong because I can’t keep the connection after making a POST request. local host…
-
2
votes1
answer95
viewsQ: Cryptography does not read spaces
Well, I’m trying to encrypt a text file with the following "program": #include <iostream> #include <fstream> using namespace std; void writeFile(char* filename, string str){ ofstream…
c++asked Gabriel Sales 1,257 -
4
votes1
answer314
viewsQ: Reading entire file
I am trying to read a simple file, which contains only two lines, but the program shows only one. The program: #include <iostream> #include <fstream> using namespace std; int main() {…
c++asked Gabriel Sales 1,257 -
1
votes1
answer90
viewsA: Get table inside table Lua through C++
The mistake is in this: if(lua_tostring(L, -2) == "on"){ The right thing is: if((std::string)lua_tostring(L, -2) == "on"){
-
1
votes1
answer90
viewsQ: Get table inside table Lua through C++
I have a moon file with the following contents: Pokes_Icons = { ["Bulbasaur"] = { on = 12906, off = 12908, used = 12907, } } I am trying to get the value of "on" in C++, I tried as follows: enum…
-
2
votes1
answer190
viewsQ: Read table in Lua through C++
I have a table in Lua this way: myTable={ one = {a=1, b=2, c=3}, two = {a=4, b=2, c=1} } The file has already been uploaded, as I do to read the table data through C++?…
-
1
votes1
answer41
viewsA: Luasql(Sqlite3) accepting only a "value"
There were two mistakes. The first: con:execute([[ INSERT INTO users VALUES('Alguem'); INSERT INTO users VALUES('Outro'); INSERT INTO users VALUES('Mais Outro'); ]]) Thus, it runs only 1 line, the…
-
1
votes1
answer41
viewsQ: Luasql(Sqlite3) accepting only a "value"
I’m trying to create a simple table, just with names, but when I enter a value, I can’t enter any more. Like I’m doing: require 'luasql.sqlite3' local env = luasql.sqlite3() local con =…
-
4
votes2
answers775
viewsQ: How to Vector/Array integers indexed by strings?
How do I vector/array integer numbers with strings as index? Something that in Lua would be: vetor = { ["eu"] = 10, ["voce"] = 11, } ps: It will be dynamic, so it will not have a fixed size. ps²:…
c++asked Gabriel Sales 1,257 -
2
votes2
answers1207
viewsQ: Replace values inside string
How do I replace values within a string? To string will be something like: gabriel = 1.73,derp = 1.80, Take into account that this structure is: nome = altura, nome = altura,. In case, I want to…
-
2
votes1
answer463
viewsQ: Run Lua code block inside C++
How do I run a Lua code block inside a C function++? The idea would be something like: int main() { tipodavariavel script; script << "print('Ola mundo')"; executar(script); return 0; }…
-
2
votes1
answer121
viewsQ: Replace text within tag
Am I trying to replace inside a tag? EX: mystr = '<html><head></head><body><p>Aqui meu texto</p></body></html>' mystr = mystr:gsub('<.+>', '')…
luaasked Gabriel Sales 1,257 -
1
votes1
answer262
viewsQ: Access Violation when creating Thread
I’m getting the bug: Acess Violation at address 00420214. Write of address 0000000E. When creating a Thread. The error line is exactly the creation line (marked with '>'). In uses I added the…
-
1
votes1
answer87
viewsA: Iuplua - Background dialog
That’s how it worked: require "iuplua" require "iupluaim" back = iup.LoadImage("back.png") dlg = iup.dialog{title="test", size="QUARTERxQUARTER", background=back} dlg:show() iup.MainLoop()…
-
1
votes1
answer87
viewsQ: Iuplua - Background dialog
How do I define an image as the background of a Dialog? In the documentation it says: BACKGROUND (non inheritable): Dialog background color or image. Can be a non inheritable Alternative to BGCOLOR…
-
2
votes2
answers162
viewsA: Iuplua - Positioning component
I got. To be able to position, I had to put the button inside a box (I used hbox), and set the button’s FLOATING attribute to "yes". Just follow the code: require "iuplua" button =…
-
2
votes2
answers162
viewsQ: Iuplua - Positioning component
In Iuplua, how do I position a component indicating the X(horizontal position) and Y(vertical position)? I read in the documentation: It will be changed During the layout computation, except when…
-
1
votes0
answers62
viewsQ: How to set a background image in a Wxframe?
With the library wxLua, how do I use an image as a background WxFrame? Using the wxBitmap, the components on the image are not shown correctly.…
-
5
votes2
answers887
viewsQ: Check if variable has been set
How do I check if a variable has been set? The #ifndef can be used for this? Plainer: #include <iostream> int getNumber() { if (check) { check = false; return 10; } else { bool check = true;…
-
3
votes1
answer154
viewsA: Download with Sockets
I was not getting it because I was opening a binary file in text mode. When I changed "w"(write) to "Wb" (write Binary), I did it. It was like this: local file = io.open("1.7z", "wb")…
-
4
votes1
answer229
viewsQ: Srlua - Problem after compiling
I’m trying to compile a simple script that contains: require 'classlib' human = class() function human:__init(name) self.name = name end gabriel = human("Gabriel") print(gabriel.name) With srlua,…
luaasked Gabriel Sales 1,257 -
2
votes1
answer39
viewsQ: Get position of wxTextCtrl
How do I get the position (x and y) of a WxTextCtrl? I didn’t find anything in the documentation.
-
3
votes1
answer170
viewsQ: How to change the background image of a Wxdialog?
How do I use an image like background of a wxDialog? Using the WxStaticBitmap, components do not appear right. I am using version 2.8.12 of Wxwidgets. Example of expected result:…
-
3
votes2
answers1327
viewsQ: Qmake - Independent executable
How do I compile a Qt Creator program(.pro) with "static link"? I compiled by QT Creator, but I need to copy about 6 dlls to the executable folder, some of them are more than 100mb. I read in the…
-
4
votes3
answers880
viewsQ: Integer for String
In QT Creator 5, how do I convert Integer to string? In Visual Studio 2012 there was the command: std::to_string(10); But it doesn’t work on QT. I tried to: #include <QCoreApplication>…
-
15
votes4
answers6237
viewsQ: How does the "#include" directive work?
C++ "include" does what exactly? I know it "matters" a header/library. But if I have a Header. h com: #include <string> using namespace std; string a() { return "PTSO"; } and on Main.cpp:…
-
1
votes1
answer627
viewsQ: Best IDE Designer GUI
I am currently using Visual Studio 2012, and to create window applications, I need to use C++/CLI, but I saw that it is outdated (wikipedia). What would be another alternative? Wxwidgets is…
c++asked Gabriel Sales 1,257 -
0
votes0
answers74
viewsQ: System::String for basic_string
I was looking for how to convert System::String to "normal" string, and found a command: #include <iostream> #include <string> #include <msclr\marshal_cppstd.h> System::String^…
c++-cliasked Gabriel Sales 1,257 -
6
votes1
answer915
viewsQ: Assign an expression to a variable
In c++ is it possible to execute expressions within a variable? Ex(in Lua): n = math.random(9, 10) a = n .. (#tostring(n) > 9 and "-" or "--") print(a) If n were equal to 9 it would return: 9--…
c++asked Gabriel Sales 1,257 -
2
votes1
answer303
viewsQ: Application icon in Visual Studio 2012 Express
How do I set the app icon in Visual Studio 2012 Express? ps: Da executável. ps²: Aplicação C++
-
3
votes2
answers120
viewsQ: Reset variable
Is there any way to reset the variable without assigning all values again? ex: int number = 5 + rand() % 5 + 1; cout << number << endl; cout << number << endl; If the…
-
6
votes1
answer272
viewsQ: Initialization of data of a class
Is there a class initialization function for C++? In Lua, using the library classlib there is the function __init, and in Python as well. EX: require "classlib" Human = class(); function…
-
6
votes1
answer1411
viewsQ: How to place variables within vectors?
How do I create variables within a vector? Something like: int arr[] = {int x=1, int y = 2};
-
3
votes1
answer1796
viewsQ: Change the value of a vector in a function
How do I do? I’m trying to: #include <stdio.h> #include <stdlib.h> int changeMap(char mp[], int x, int y){ mp[x-1][y-1] = 'X'; return 0; } int main(){ char map[][1] = "gabriel";…
casked Gabriel Sales 1,257 -
7
votes3
answers1181
viewsQ: Passing vector to functions
How do I pass a vector to a function? Something that, on the Moon, would be like this: vector = {"V", "e", "t", "o", "r"} function getVector(vector, pos) return vector[pos] end…
-
0
votes1
answer35
viewsQ: Extract everything using Libarchive
How do I extract all content from a compressed file to the current directory? P.S.: The file has folders and files. import libarchive def unpack(file): #?
pythonasked Gabriel Sales 1,257 -
4
votes1
answer58
viewsQ: Two simultaneous routines
How do I run two routines simultaneously in the same program? I’m trying to download a file, and print a value while downloading. Exactly that: http = require "socket.http" function…
luaasked Gabriel Sales 1,257 -
1
votes1
answer133
viewsQ: Pick Table in string form
I’m trying to get a string table. EX: tabela = {1, b=2, {c=3}} print(getTableString(tabela)) If this function existed, and functioned, it would return: -> tabela = {1, b=2, {c=3}} Is there any…
-
2
votes1
answer882
viewsQ: Loadstring, how to use?
I’m using the loadstring function, but I don’t know if this is the right way: a= "st = {b=1, c=2}" st = {} b = loadstring(a) b() print(st.b) Is there any simpler way?…
luaasked Gabriel Sales 1,257 -
1
votes1
answer94
viewsQ: Get "output" from Lua command
I want to take Output from a moon command and store it in a string. EX: print(1) output->1 getOutput("print(1)") I would like to store the returned value in a string, in this case, 1. Something…
luaasked Gabriel Sales 1,257 -
3
votes1
answer125
viewsQ: "require" in higher directories
I have a program in Lua. This is the file structure: |Programa |-Main.lua |-config.lua |--------functions |-functions.lua Through the functions.lua, I want to give a require in the config.lua. Is…
-
3
votes1
answer1560
viewsQ: In Pairs or Ipairs
Is there any difference between in ipairs and in pairs? Which? a = {1, "b", 3, "d"} for i, v in pairs(a) do print(i, v) end print("Ipairs") for i, v in ipairs(a) do print(i, v) end Returns: 1 1 2 b…
luaasked Gabriel Sales 1,257 -
7
votes1
answer125
viewsQ: Loop with array + string
I’m trying to do something like: a = {move1="oi", move2="oi2"} for x=1, #a do print(a.move..x) end I can’t explain it very well, but what I’m trying to do is this: print(a.move..x) getting…
-
1
votes2
answers109
viewsQ: Do not execute command line
Well, I’m doing a show with Vclua and I realized that after compiling, even with the graphical interface, it runs the command line mode, how do I avoid that? Running only the program. I compiled it…
luaasked Gabriel Sales 1,257 -
0
votes0
answers97
viewsQ: Create DLL from files
I have some files .lua with functions and would like to create a DLL with all the files, it is possible?
-
1
votes1
answer154
viewsQ: Download with Sockets
I’m using the Luasocket and wanted to download files with it, but I don’t know how, I managed to download text file like this: local file = io.open("Blabla.txt", "w")…
-
3
votes2
answers190
viewsQ: Delete repeated values
How could I delete repeated values in a table? Ex: a = {1,2,3,4,3,2,1} How would you delete 3, 2 and 1, keeping only one of each? My table is one inside another: a = { {a=1, b=2}, {a=2, b=3}, {a=1,…