Posts by epx • 8,191 points
241 posts
-
0
votes1
answer260
viewsA: Why does a Sort method not work properly on LINUX servers?
Are you running this code in the context of a web page? It may be that the page is not in UTF-8, so the strings may be received in ISO-8859-1 format, which even explains why the "Ê" was corrupted.…
-
0
votes3
answers1056
viewsA: Redirect "dominio.com.br" to "Subdominio.xyz.com.br"
You won’t be able to solve this with DNS. Even if you accept that the first name is changed to the second in the browser bar, it is not recommended to make a domain name CNAME. CNAME is for…
-
1
votes2
answers389
viewsA: Asynchronous server execution problem with Express, Mysql and Socket.IO
I think this mixture of invoking io.on("Connection", ...) within the app.all() handler is wrong. It is one thing for Express to serve the page; the other is Socket.IO to serve his requests. These…
-
8
votes1
answer248
viewsA: How to check if the message has been delivered, websocket php
The class has some predictions for failure: the wsSendClientMessage method of this class returns false if not all content could be sent, and the class keeps "dripping" clients periodically to detect…
-
0
votes1
answer49
viewsA: Php script in java ? runs in the background?
You can configure the PHP script to stop if the connection closes, by ignore_user_abort(). But the script also has to send data periodically (every few seconds) and call flush() because only sending…
-
2
votes1
answer521
viewsA: Show ads admob interstitial (full page) after game over
Have you tried following any particular tutorial? I followed this one https://developers.google.com/admob/android/interstitial?hl=en and had no problems. I will paste my code here because there are…
-
1
votes1
answer59
viewsA: App features strange scroll on iPhone 6
It takes a little more information to give a precise answer. "Older" apps, which use XIB, tend to work because XIB for iPhone 5 is automatically scaled on iPhones 6/6+, since the screen ratio (16:9)…
-
3
votes3
answers2478
viewsA: How do C graphic libraries work?
To put it in perspective: no language is inherently "graphic" or "text". At some point, there needs to be an initialization so that the program is not blind, deaf and dumb. Such preparation may be…
-
1
votes1
answer240
viewsA: Obfuscation of code in IOS project
I have researched it professionally. There are only paid tools for this function, among which Arxan is the best known manufacturer. And they are very expensive tools (price is 5 or 6 digits, in…
-
6
votes3
answers423
viewsA: How to choose a digital certificate? What to take into account?
Overall, the more expensive the certificate, the more "reliable" it is -- from the customer’s point of view. The key size also influences this reliability, but it is not the main factor. Any new…
-
0
votes2
answers180
viewsA: Application is closed after a while, even with service
Speaking very generically, any Android service can be stopped at any time, in particular if the phone has little memory. That’s how the platform works. An alternative to ensure that it comes back…
-
2
votes2
answers704
viewsA: Pointer operators passing by reference
Passing by reference (type&) is more "safe" than by pointer (type*) as it ensures that the object will never be null (*). On the other hand, if you want to have the parameter option to be null,…
-
1
votes3
answers749
viewsA: Node.js application always falls after an error
One possibility to capture exceptions on a global level is to use process.on('uncaughtException', function (err) { console.log(err); }) but it is considered a bad practice because your program may…
-
4
votes1
answer12681
viewsA: How to redirect subdomain to fixed IP on specific port
This you want to do, cannot be done with DNS only. DNS solves only addresses, not ports. To redirect HTTP to another port, you need an HTTP server. So we have two alternatives. If the subdomain…
-
3
votes1
answer161
viewsA: Should translation dictionaries use the original strings as keys?
If the language of those who are developing the program is English, or the developers involved know English well, it seems to me much more productive and clear to use the original message,…
-
4
votes1
answer8664
viewsA: Socket between 2 clients and 1 C server
You have basically three paths: 1) delegate the received connection socket to Accept() for a child process, using Fork(). An example you can base on is…
-
3
votes5
answers573
viewsA: Why are you wearing shorts?
The short type guarantees at the very least 16 bits -- is not a synonym for int16_t. I only see use for it when you need to interact with a value or structure that is also short, like some hardware…
-
8
votes7
answers13788
viewsA: How to represent money in Javascript?
It depends on the size and accuracy of the value you want to deal with: If it’s less than $200 million and cents accuracy, as is the case with many simple applications. use whole numbers,…
-
2
votes5
answers2024
viewsA: Replace If/Else with Case javascript
Personally I don’t really like switch/case. Ugly syntax and easy to make mistakes. One option to be considered is to use an array. Follows a pseudocode (untested): opcoes = {}; opcoes["1"] =…
-
5
votes3
answers5462
viewsA: What is the lifespan of an SD card with Raspbian (Raspberry Pi)?
In short: don’t bother with this. The 10,000 or 100,000 write operations count per 512-byte cell, but the SD card circuit itself switches the use of cells so that they all "spend" equally. In…
-
66
votes6
answers5796
viewsA: How is computer randomization generated?
Classical pseudo random number generators (PRNG) work as follows (LC algorithm): x1 = (a . x0 + b) mod n where x0 is the "seed", or previous random number, a and b are chosen constants, and n is the…
-
0
votes1
answer89
viewsA: Character problems coming in Ndefmessage NFC
statusByte seems to be being used before being assigned in Decoder. Since the declared variable starts with zero, the Decoder must be assuming UTF-16 in the first round. I don’t like this math…
-
0
votes5
answers453
viewsA: Is it legal to delete this in a member function?
It is valid, just as it is valid to call the destructor itself (obj->~Class()), but the programmer has a huge responsibility to know what he is doing, that this will not be used then etc. In your…
-
12
votes7
answers14277
viewsA: What can C++ do that C# can’t?
As a language, C# is not owed anything, nor in performance. The problem with C# is that it implies a framework that is controlled by Microsoft, although there is the free implementation, Miguel de…
-
14
votes6
answers90846
viewsA: Do I use PHP inside an HTML or an HTML inside a PHP?
An HTML file with extension . php will behave exactly like HTML. The PHP interpreter only enters the scene for whatever is between <? ... ?>. In this context the ideal is to use all . php.…
-
10
votes2
answers2178
viewsA: Concept of Man-in-the-Middle attack
Generally speaking, it is an attack where all communication between Alice and Bob is intercepted and eventually modified by a hostile agent, "Charlie". Alice and Bob think they’re talking to each…
-
2
votes3
answers5189
viewsA: How to convert a string to const char *?
If it’s GTK+ Gstring, use astringemquestao->str that points directly to the buffer containing the string. It is terminated null and can be used where a const char * is expected. Remember that:…
-
45
votes4
answers233186
viewsA: What is the difference between INNER JOIN and OUTER JOIN?
This page is something to be printed and pasted in the stall: http://www.codeproject.com/Articles/33052/Visual-Representation-of-SQL-Joins Basically, Customers INNER JOIN Orders returns only…
-
7
votes2
answers5931
viewsA: git merge or rebase
Depends in part on your taste. The "merge" brings together two separate development lines. It’s easier to do and any developer can at any time merge with the "official repository". But many project…
-
7
votes4
answers262
viewsA: How to implement journaling in Python?
I wrote an article that describes how to do this: http://epx.com.br/artigos/arqtrans.php and even a citizen made a Python implementation based on the article:…
-
7
votes1
answer375
viewsA: Blocks vs Functions in Objective-C
The block is an "anonymous function", which you assign to a variable and/or pass on as parameter. Since the function has no name, you can only use it if you have a direct reference. Example taken…
objective-canswered epx 8,191 -
8
votes8
answers59138
viewsA: How to raise a number to a power without using the Math. h library?
My attempt, based on @Guilherme Bernal. Certainly has problems with extreme values, accumulation of rounding errors etc. etc. but for "well behaved" values seemed to work well. #include…
-
-1
votes4
answers2553
viewsA: Database structure for multi-language system
Use a separate table, one row per pair (product ID, Language ID). makes it much easier to add one language to more in the future. I suggest a standard like Iso 639 to identify languages.
-
4
votes2
answers2189
viewsA: How to calculate the determinant of a javascript matrix?
Direct determinant calculation by cofactors is didactic but rather inefficient if you want to use large matrices seriously. A better option would be to calculate LU decomposition. Since the matrices…
-
5
votes3
answers568
viewsA: Is there an advantage to an explicit "self" instead of the implicit "this"?
In my opinion the greatest advantage of the explicit self is to enable "closures" without pranks and without special treatment. Face avoids that problem where every Javascript beginner falls:…
-
15
votes10
answers34548
viewsA: What is the difference between the == and === Javascript operators?
The problem with Javascript is that it has weak typing, meaning it makes implicit type conversions. A comparison '0' == 0results true because the operator converts string to number in an attempt to…
-
7
votes2
answers942
viewsA: Function returns pointer to trash, and free locks the terminal
The error seems to be here: int *pontmaior = &maior; You are returning a pointer to the "larger" stack variable, which no longer exists when used by the main(). You should return a simple…
-
2
votes3
answers85
viewsA: Allocator and placement new
In allocate(n), n is the number of elements, not the size in bytes. malloc() should be n * sizeof(T). deallocate() is already correct. Source:…
-
2
votes2
answers354
viewsA: What architecture and operating system properties allow a buffer overflow attack?
It’s kind of a broad question, but come on. The biggest risk is using a low-level programming language, type C, because in it you are forced to use pointers to manipulate strings and buffers. Sooner…
-
1
votes3
answers1357
viewsA: Retrieve date and local time of an arbitrary day in an arbitrary Timezone, considering daylight saving time
You would have to periodically download the historical timezone list at http://www.iana.org/time-zones, on your server, interpret this document to a more Javascript palatable format (JSON?) and load…
-
6
votes6
answers47964
viewsA: What is JSON? What is it for and how does it work?
JSON is a hierarchical data encoding method, such as XML, although simpler. JSON was born within the context of Javascript -- and being valid Javascript can be directly interpreted with Eval(),…