Posts by Victor Martins • 798 points
22 posts
-
6
votes2
answers2209
viewsA: What is typing style?
The typing style is nothing more than the classification of the system of types of some language, it can be the union of more than one of the categories: Strong typing Almost a synonym for safe…
-
1
votes1
answer446
viewsA: Select a row where a column has an element of a CSV
You can use the function FIND_IN_SET() to find the substring in the set, for example: SELECT * FROM tabela WHERE FIND_IN_SET('3', numeros); Will return all that contain element 3: | id | numeros |…
-
1
votes2
answers626
viewsA: Separate file lines into tokens - Python
To separate a string using spaces as delimiters, you use the method .split(): >>> "18-10-2015 00092 65534".split() >>> ["18-10-2015", "00092", "65534"]…
pythonanswered Victor Martins 798 -
8
votes6
answers4038
viewsA: What is lexical analysis?
An interpreter/compiler does not understand "thick text" directly, he needs the data well organized and defined. For example, let’s assume that our interpreter needs to interpret this simple sum: 42…
-
1
votes2
answers515
viewsA: How to create a recursive algorithm to find the depth of a list
Recursion with theoretical explanation is even more difficult to understand, so let’s see in practice: count = 0 def flat(l): global count count += 1 depths = [] print "- entrando em for, flat n:",…
-
2
votes1
answer725
viewsA: Is using %(limit)[ n] in scanf safe to capture strings?
The ideal would be to use the function fgets: fgets(buffer, buffer_size, stdin); But you may not limit yourself to it, as you can see below: Max string length using scanf -> ANSI C How to use…
-
6
votes1
answer504
viewsQ: Can the type of an operating system be microkernel + monolithic?
Based on what is said to be a monolithic system procedures and link in a large binary, where procedures can call others procedures. The microkernel aims to minimize the "service" made directly from…
operating-systemasked Victor Martins 798 -
2
votes3
answers553
viewsA: In Python, what are the consequences of using is instead of '=='
A code is worth a thousand words. class Pessoa(object): def __init__(self, nome, idade): self.nome = nome self.idade = idade joao = Pessoa("João Bom de Python", 16) # 0x1 alex = Pessoa("Alex Java",…
-
4
votes1
answer234
viewsA: How to use a Lua variable in C++?
You can use the method lua_gettable. You need to add the index to the stack via lua_pushinteger. The key is superimposed with the element. You can also try: lua_getglobal(L, "MATRIZ")…
-
4
votes2
answers330
viewsQ: How is the find function implemented?
Unlike match() looking for an occurrence of a language y in the beginning of the string, the find() makes a quest for y inside that string. I could use the algorithm of Knuth-Morris-Pratt to search…
-
2
votes2
answers125
viewsA: How to loop with regex in javascript?
I’m not a Javascript guru, so any mistake is just to say. function times(str, n){ var step = str; for (var y = 1; y < n; y++){ str = str.concat(step); } return str; } test = "a b d" test =…
-
4
votes1
answer503
viewsQ: What simulate, NFA or DFA?
Well, we know that theoretically and practically, every NFA can be converted to a DFA that accepts the same language. My question is this:: Which one should I actually simulate? NFA or DFA? I don’t…
automataasked Victor Martins 798 -
5
votes2
answers1470
viewsQ: What is the real meaning of using ε-transitions in NFA?
Well, I still don’t understand the logic of using ε-transitions in NFA, what is the real meaning? Jump from state without making a reading? For example, given the regex: a* NFA: DFA:…
automataasked Victor Martins 798 -
2
votes2
answers651
viewsA: Use or not use table
Why run away from the Tables? They are there to be used (just don’t use them to position layout, please). Anyway, of course there is. Consider the following HTML: <form action="">…
-
-1
votes3
answers1195
viewsA: Call php code on button
Well, without too much ado: <?php if (!empty($_GET['act'])) { echo "Olá, Stack Overflow!"; //Seu código vai aqui, enfim... } else { ?> (.. html ..) <form action="index.php" method="get">…
-
1
votes3
answers243
viewsQ: Regex for hexadecimal colors
I have a small doubt: I have a regex that captures in 3 groups (2 values per group) of certain color, but this when I have 6 values(excluding the #), I would like to know how to implement to catch 1…
-
6
votes2
answers1842
viewsA: What is the Unicode (BOM) signature?
You can fix this issue as demonstrated below: http://www.melhorweb.com.br/artigo/5-Problemas-de-espacamento-e-acentuacao-no-Dreamweaver.htm…
-
3
votes2
answers677
viewsA: What is the difference between typeof(T) vs. Object.Gettype()
You can only use typeof() when you know what type at compile time, and you are trying to get the corresponding object type. (Although the type could be a generic type parameter, for example,…
-
0
votes3
answers529
viewsA: 403 Forbidden when saving data from a form
I’m not a php enthusiast, but I’m pretty sure when PHP reads it it turns into a string: "<span style="display: none"> </span>" That’s why the style should have its values in…
-
2
votes3
answers232
viewsA: Change CRT file to byte
Untested code With my search I obtained the following: public static byte[] convertFileToByteArray(File f) { byte[] byteArray = null; try { InputStream inputStream = new FileInputStream(f);…
-
2
votes1
answer7006
viewsA: How to capture the membership list of a private or secret Facebook group using the GRAPH API?
According to my research I got the following answer: You can access user and friend permissions. There is a specific user_groups permission. Generally the authentication mode as Facebook works is…
-
5
votes3
answers33382
viewsA: What are the HTTP request methods, and what is the difference between them?
Basically, if that’s what I understood, there are 8 types of methods of which: GET, POST, DELETE, PUT, CONNECT, HEAD, TRACE, OPTIONS. GET: Method that requests some resource or object from the…