|
How not to be productive little guideline
2025-01-29 computer english
|
|
Wireguard reconfiguring AllowedIPs can cause issues
2024-05-16 computer english When reconfiguring Wireguard AllowedIPs list it could happen that previous or parallel connections (race condition) send/receive packets to/from forbidden IPs. This is not a problem if this connections are eventually closed. However, worth noticing.
|
|
Tail recursion in loop while
2024-04-15 blog english Interesting optimization of recursion using tail function. Consider this: And then this version:
|
|
Cognitive Complexity (SonarQube)
2024-04-15 computer english blogging
|
|
WireGuard
2023-06-15 english This is the VPN solution used in the project I am working on, a simple and secure packet distribution and controlled by the IP addresses configured for each peer. There is a very nice example in "the home of WireGuard project".
|
Hacker Rank Array - Part 1
2023-04-28 computer english blogging The next step after "Hacker Rank Warm Up" are the array challenges. And so I did it. Now I am going to recap what I did and how I did. And what complexity the algorithms have. To solve the "array manipulation problem" ChatGPT helped me with the code. Now in the review I realized how segment trees work and how binary trees can be implemented using arrays.
|
|
Hacker Rank Warm Up
2023-04-16 blog english blogging Here I am doing interview exercise tests at Hacker Rank. I am trying to recap what I've been doing the last two months before going on. Let's see what I learned, starting with the Warm Up exercises. To solve the "counting valleys problem" keep a valley counter that only increments when the hiker is coming up to the sea level. Monitor the altitude and the new altitude and compare. If the altitude was negative (into a valley) and the new altitude is zero (sea level) then that's a new valley to count. This strategy avoid to count valleys inside valleys before the hiker gets up to sea level.
|
|
Real Programmers Don't Use Java
2014-02-20 english blogging When I was a newbie (and a wanna-be) I enjoyed reading "Real Programmers Don't Use Pascal", a satiric text that influenced and encouraged me into the path of "C/C++ enlightenment", most even than K&R's book. Since then I thought that being a "Real Programmer" was something close to everything one needs to know to get (hard) things done (quickly). Being a "Quiche Eater" was, in couterpart, comparable to nothing. Real Programmers solve real problems! Quiche Eaters are losers who study the academic concepts of computer science and never do a damn useful and/or working program (maybe you know some guy like this).
|
|
What I've been doing in the last 10 years
2009-08-17 english This week I dedicate myself to update my resumè and I have the brilliant idea of put into it my technical historical, what resuming is a list of things I did or was involved with during my brief ten years stay in the programming world.
|
|
Static Polymorphism
2009-07-10 blog english To explain the polymorphism nothing is better than see how stuff used to be. If you were a twenty old C programmer in the past and created the following functions: Immediately the compiler would blame you about the following errors:
|
Antidebugging during the process attach
2008-08-05 blog english The purpose of this protection is to detect if some debugger tries to attach into our running process. The attach to process operation is pretty common in all known debugger, as WinDbg and Visual Studio. Different from the DebugPort protection, this solution avoids the attach action from the debuggee program. In this case the protection can make choices about what to do on the event of attach (terminate the process, send an e-mail, etc).
|
Antidebugging using the DebugPort
2008-08-01 blog english When a debugger starts a process to be debugged or, the article case, connects to a already created process, the communication between these processes is made through an internal resource inside Windows called LPC (Local Procedure Call). The system creates a "magic" communication port for debugging and the debugging events pass throw it.
|
|
Antidebugging using exceptions (part two)
2008-07-30 blog english In the first article we saw how it's possible to spoof the debugger through exceptions and let the attacker lose some considerable time trying to unbind the program from the fake breakpoints. However, we saw also that this is a difficult solution to keep in the source code, besides its main weakness to be easily bypassed if discovered. Now it's time to put things easier to support and at the same time to guarantee tough times even if the attacker discover what is going on.
|
|
Antidebugging using exceptions (part one)
2008-07-28 blog english A debugger puts breakpoints to stop for a moment the debuggee execution. In order to do this it makes use of a well known instruction: int 3. This instruction throws an exception - the breakpoint exception - that is caught by the operating system and bypassed to the handling code for this exception. For debuggee processes this code is inside the debugger. For free processes this code normally doesn't exist and the application simply crashs.
|
How to run anything as a service
2008-05-27 blog english Update 2026-02-20: Many years ago I switched from this solution to "NSSM", which I highly recommend. It has been used in robust products and avoids having to maintain redundant code to support programs that weren't designed to be services, but need to run independently of the user's account.
|
|
Funky do-while
2008-02-13 blog english It's a known habit to use do-while constructions when there's a need to define a macro that has more than one command instead of using the { simple multicommand brackets }. What was never clear is why this is so.
|
|
Why is my DLL locked?
2007-09-24 blog english The Windows code responsible to call DllMain for each loaded and unloaded DLLs uses an exclusive access object, the so-called mutex, to synchronize its calls. The result is that inside a process just one DllMain can be called at a given moment. This object-mutex is called "loader lock" into the Microsoft documentation.
|
|
C and C++ Operators Precedence Table
2007-07-30 blog english "Wanderley, your explanation about why a program compiles in C++ and not in C seems to me logic and correct, but gave me some doubts, because I always learned that the C and C++ operator precedence are the same thing. I checked out the Appendix A in the "C ++ - How To Program" (sixth edition) and the book table is equal to the C operators precedence table and it is different from the C++ precedence table presented by you in the article. I went to the internet and found out in two websites the table and both are equal to the book table. From where did you get the presented C++ table?" "Márcio Andrey Oliveira".
|
|
What happens inside the sizeof operator
2007-07-16 blog english The question: how to get the size of a struct member without declaring it as a variable in memory? In pseudocode: In this first try (even being a nice one) we can clearly see by instinct that the construction is not supposed to work. The compiler error is not even clear. The member access operator (the point sign) needs to have as its left some variable or constant of the same type of the struct. Since the operand is the type itself, there is no deal.
|
|
Precedence difference
2007-07-10 blog english Once upon a time my old friend Kabloc wrote this little and "harmless" function in order to print the multiplication table: Despite the fact the result is a strong candidate to "The International Obfuscated C Code Contest" the Linux guys told him the code was not successful on GCC, and somewhere inside those four lines there was a non-standard piece of code.
|
|
Disassembling the array operator
2007-06-22 blog english Arrays are fascinating in C language because they are so simple and so powerful at the same time. When we start to really understand them and realize all its power we are very close to understand another awesome feature of the language: pointers.
|