How to store data in the flash memory of a Arduino Uno (ATmega328p)

From the ATmega328P datasheet, “Boot Loader Support” section, “Application and Boot Loader Flash Sections” subsection, “Application Section” subsubsection: … the SPM instruction is disabled when executed from the Application section. Therefore there is no way to write to flash from the running program. Use an external memory device if you need to store more data … Read more

How do I check if a Key is pressed on C++

As mentioned by others there’s no cross platform way to do this, but on Windows you can do it like this: The Code below checks if the key ‘A’ is down. In case of shift or similar you will need to pass one of these: https://msdn.microsoft.com/de-de/library/windows/desktop/dd375731(v=vs.85).aspx The low-order bit indicates if key is toggled. Oh and … Read more

How to print a int64_t type in C

For int64_t type: for uint64_t type: you can also use PRIx64 to print in hexadecimal. cppreference.com has a full listing of available macros for all types including intptr_t (PRIxPTR). There are separate macros for scanf, like SCNd64. A typical definition of PRIu16 would be “hu”, so implicit string-constant concatenation happens at compile time. For your code to be fully portable, you must use PRId32 and so on for … Read more

Android Debugging Failing With “Couldn’t connect to logcat, GetProcessId returned: 0” FFImageLoading.Platform.dll.so Not Found

This is a known issue with Oreo and Xamarin Android on Visual Studio for Windows. It works on Visual Studio for Mac apparently. It will be fixed in an upcoming release. In the mean time there is a work around down near the bottom of the bug link above (comment 20).

Running time of algorithm A is at least O(n²) – Why is it meaningless?

T(n): running time of Algo A. We just care about the upper bound and lower bound of T(n) The statement: T(n) >= O(n^2) Upper bound: Because T(n) >= O(n^2), then there’s no information about upper bound of T(n) Lower bound: Assume f(n) = O(n^2), then the statement: T(n) >= f(n), but f(n) could be anything that is “smaller” than n^2 , Ex: constant, n,…, So there’s no conclusion … Read more

Ext.getCmp(id) or Ext.ComponentQuery.query(attribute)

The best is to avoid using any of this two directly. Ext.getCmp is especially considered bad “code smell”. You should strive to organize your code in such a way that you don’t need them. Component queries are elegant, but you should use them either from a parent container (thus reducing the research tree and allowing you to leverage relative itemId), … Read more

What is socket, core, threads, CPU?

A socket is the physical socket where the physical CPU capsules are placed. A normal PC only have one socket. Cores are the number of CPU-cores per CPU capsule. A modern standard CPU for a standard PC usually have two or four cores. And some CPUs can run more than one parallel thread per CPU-core. … Read more