Posts by epx • 8,191 points
241 posts
-
1
votes2
answers2560
views -
1
votes1
answer1029
viewsA: How to Implement "zoom in" and "zoom out" for imageView on Android?
This custom class seems to do what you want: https://github.com/sephiroth74/ImageViewZoom Have some ideas on how to implement zero magnification, in this post:…
-
1
votes4
answers14202
viewsA: How are prime numbers important in cryptography?
Prime numbers have importance not only in cryptography but in numerous other computer science topics, because a prime number can form a "Galois field". For example, a field based on number 7 and…
cryptographyanswered epx 8,191 -
1
votes4
answers1072
viewsA: What is the practical use of bitwise operators in PHP?
PHP is a general purpose language, can be used for potentially anything. Situations arise where even a high-level language needs to interact with binary numbers and bitwise operations. For example:…
-
0
votes1
answer947
viewsA: Shared database
Using a database directly over the Internet is possible, but very risky in terms of security and reliability. I believe that traditional Mysql-like banks assume a stable connection between client…
-
16
votes2
answers40655
viewsA: Difference between datetime x timestamp?
I’ll try an alternative answer. DATE: contains only a calendar date, without any time zone consideration, etc. For example, date of birth, or the due date of an account, or a legal term, it is DATE.…
-
0
votes2
answers669
viewsA: How do I let a php application run on the client’s pc even if the server connection goes down?
What you want, it’s not easy to get. I understand the motivation (keep the application available when Internet or server fail) but the application architecture would have to be considerably more…
-
5
votes1
answer2478
viewsA: What is the difference between Primary key and index in mysql?
An index is simply a helper when searching (for example, a SELECT) on top of a column. For example, in a table with people names, adding an index to the NAME helps speed up searches by name, and…
-
3
votes2
answers71
viewsA: Socket- does not receive the message in full
You are calling input.read() only once. In this case it will not wait until it has enough bytes to fill the buffer; it will return as soon as it has something received, even if it is 1 byte. If it…
-
2
votes1
answer146
viewsA: Advanced android course
What you want is to make your own Android image, so your stop is the AOSP project https://source.android.com/ . But it’s no trivial thing. I’ve handled AOSP in the past, to change key components of…
-
2
votes3
answers539
viewsA: Byte separation
Want some advice? Use JSON. Keep creating binary protocols is asking yourself to bother. Tomorrow or the day after you have to interface with a counterpart that was not written in Java...
-
3
votes7
answers22208
viewsA: Is using MD5 the safest way to encrypt passwords in PHP?
MD5 is not a good option to encrypt passwords for several reasons. It is certainly better than nothing, but it is not a "serious" protection. Some reasons are MD5, others the type of algorithm it…
-
0
votes1
answer209
viewsA: Http server in c
The interpreter discovered a GET followed by a space and "eats" these 4 buffer characters, repositioning the pointer 4 characters ahead, to continue the parse with what follows.
-
7
votes3
answers21803
viewsA: What is CGI and what is its purpose?
CGI is a method for a web page to be dynamically generated by an executable, rather than a static file. Any text the executable sends to the "terminal" will appear on the page. In the early days of…
-
1
votes1
answer108
viewsA: Processing calculation of the procesator
If you take the manual of a processor, you find the number of clock cycles that any instruction takes to execute. You can find Intel processor manuals on…
architecture-computersanswered epx 8,191 -
5
votes1
answer480
views -
5
votes3
answers434
viewsA: What is the maximum value for javascript number?
Note the fact that there are two "maximum" numbers. One is the largest number of floating points, which the other answers pointed out correctly (Number.MAX_VALUE, 1.79E+308). The other is the…
javascriptanswered epx 8,191 -
1
votes1
answer191
viewsA: Data type via socket
Would it be TCP/IP socket? If so, you get a "torrent" of bytes. You have to have an application protocol, known on both sides, to know what is being received. There is no way you just send a data…
-
0
votes1
answer212
viewsA: Why the operating system uses SWAP when it still has RAM
Each operating system has its strategy to use swap. If you do have leftover memory, your system is probably writing parts of the memory into the swap even without needing to. If there is an urgent…
-
1
votes1
answer70
viewsA: Date storage of the system
Data is a complicated business. In my opinion you should store as a string and use the YYYYMMDD format, because then a string comparison serves to tell if one date is bigger than another. If the…
-
1
votes1
answer383
viewsA: Search of shops by zip code
What is the granularity of your shops? City? Neighborhood? Block? Since the zip code is a structured code, you can try searching successively for larger parts of the zip code. For example, if the…
-
2
votes2
answers143
viewsA: configure virtual host in apache2
Virtualhost is valid when you access with the specified name (in this case, site.org), because it exists to serve multiple sites using a single server. Access via IP will pick up the default site,…
-
1
votes8
answers309745
viewsA: Reduce image size and maintain CSS aspect ratio
I fought a lot with this problem. Generically the solution is to put the img inside a div, and limit only the width of the div containing the image. The image must have "width: 100%". Thus, the…
-
2
votes1
answer1901
viewsA: How to use realloc() dynamically in struct allocation?
The program is relocating but maintaining the same size: sizeof(struct TMedidorEletrico) * 1 realloc() does not "sum" the size that is passed as the second parameter. This will be the new total…
-
5
votes1
answer294
viewsA: C socket for Linux (how to pass a struct?)
You cannot pass a binary structure directly because the server machine can use a different processor from the client. Each processor organizes structures, and even numerical types, differently in…
-
1
votes1
answer1471
viewsA: Calling another class method in the same application
It would not simply add a button to the layout to assign the System? final Button button = (Button) findViewById(R.id.id_do_botao); button.setOnClickListener(new View.OnClickListener() { public void…
-
2
votes1
answer780
viewsA: Mysql complex banking type statement how to solve
I think the problem is that your sub-query also searches for vw_extract data without filtering by idemp, so the sub-query is adding up everyone’s values when determining the balance. Adding this…
-
0
votes2
answers384
viewsA: Error while removing Arraylist item
Is there more than one thread messing with the list at the same time? Try to surround every snippet of code that handles this list with Synchronized (obj) { ... } The whole body of the question…
-
1
votes1
answer58
views -
7
votes3
answers3377
viewsA: How does the MVC framework for Desktop applications work?
MVC is a pattern of object-oriented development. The application has at least one View class, which takes care exclusively of drawing and maintaining the screen. The Model class takes care of the…
-
1
votes1
answer67
viewsA: Is there any standard, convention or practice that rules the use of static file server domains?
For HTTP, it makes no difference. The problem is when it involves HTTPS, and the tendency is for Web to migrate to HTTPS, so it would be good to predict the layout of domains to make things easier.…
-
0
votes3
answers173
viewsA: Why is it not (easily) possible to hide private members?
C++ requires private members to be declared in the header because the C++ lets you allocate objects to the stack, then its size has to be known beforehand by all customers in the class. If the class…
-
16
votes2
answers22340
viewsA: What is assert in Python for?
The assert is an execution-time check of any condition. If the condition is not true, an Assertionerror exception happens and the program stops. This is not used for "expected" error conditions,…
-
3
votes2
answers427
viewsA: What is the sequence of executions for Asynctask?
If you schedule an Asynctask’s number, there is no enforcement order guarantee. To ensure this order you would have to schedule only the Asynctask you want to see executed first, and on…
-
1
votes2
answers119
viewsA: Questions about NDK
NDK allows portability in the opposite direction: compile a C code on Android. If you have a large body of C code, you will be able to make use of it on Android through NDK. Since the C language is…
-
1
votes1
answer104
views -
12
votes2
answers3574
viewsA: Why is set theory so important to computation?
Is that some of the mathematical truths that affect sets also affect computation. For example, one can prove that each computer program can be related to an integer number. Just imagine all the bits…
-
1
votes1
answer94
viewsA: Cast struct em struct
The short answer is that socket functions expect a sockaddr structure, but you are typically passing a sockaddr_in, sockaddr_un, or other structure. Socket methods work for numerous network…
-
1
votes1
answer176
viewsA: It is better to use common division or Shift and Soma operations on 8bit microcontrollers
I would have to know a) the exact model of the processor, as well as the version of the same, because different versions with the same set Instruction may have quite different performance in the…
-
1
votes2
answers1756
viewsA: Replication between Mysql and Sqlite (E vice versa)
Implementing this kind of thing is never simple. A first suggestion is to put a timestamp on each line, so that you have how to know the "version" of each line, there you have a basis to compare if…
-
5
votes1
answer77
viewsA: What are the real problems for those working with Assembly development?
The main problems are: 1) The work yields very little, because each Assembly instruction does very little. 2) Control structures are scarce, you basically have "Jump" and nothing else. 3) The…
-
4
votes3
answers272
viewsA: Problems with "strcpy" locking program
I think it would be ideal to do std[i].name = strdup(nome); Simply assigning you cannot, because "name" is not a simple value as an int, it is an address for a memory area, only that "char name[15]"…
-
0
votes2
answers411
viewsA: Extract emails from a Memo
The following routine would work in Python, you could try converting to use the Delphi class of regular expressions. Remembering that there is no regular expression that takes 100% of valid emails,…
-
1
votes2
answers1129
viewsA: How do I know if a socket client has disconnected?
The right time to consider the closed connection is when Inputstream returns nothing when read. While the connection is open, read() blocks until at least one byte can be returned, and readline()…
-
0
votes1
answer363
viewsA: How to Convert Binary Files to String Securely?
"puts" adds a CR/LF at the end of each line, as you were not specifying the binary size in the header the other side is accepting these two extra bytes as part of the content, which obviously…
-
12
votes3
answers681
viewsA: Learning in neural networks
You really should buy a book on the subject if you are really interested. But the basic concepts (and put basics on this) are as follows:: 1) A neuron has a certain number of inputs, and only one…
artificial-intelligenceanswered epx 8,191 -
3
votes3
answers16761
viewsA: Change the contents of the div without refreshing the page
Assuming your div id is "bla", something like <div id=bla> ... </div> the most crude way to change content dynamically is to do something like this in Javascript:…
-
1
votes1
answer210
viewsA: websockets and php
Websockets maintain a persistent connection between client and server. There is no limit written in stone, but the fact is that serving 10000 clients with Websockets will require much more of the…
-
3
votes1
answer5437
viewsA: Difference between Multi and Single Thread
It has more architectures besides single-thread (ST) and multi-thread (MT). Basically the TS can only handle one request at a time, so the processing of each one cannot be time consuming, nor can it…
-
0
votes1
answer122
viewsA: AWS S3 Disabling Sslv3 Support
This is only a problem if you have clients that access S3 and do not support TLS v1.0. Among old customers who fall in this group are Android 2 and Java 6. Try running the www.SSLabs.com testing…