PHP MySQLi Error Handling 1062 duplicate key entry
How can I elegantly catch the column name(s) a 1062 error code (duplicate key entry) occurred on?When I do:$db = @new mysqli('localhost', 'root', '******', 'database');$pstmt = $db->prepare("INSERT...
View ArticleRS232 Serial Pin Read in C in Linux
Ist there any possibility to read values from the pins of the COM Port? Any solution in C under Linux is appreciated!
View ArticleAnswer by arminb for getting value from void function with printf
You are assigning return value of m() to k. Since m() has no return value undefined behaviour will be visible, so there will be "garbage" in k (in this case: 5).
View ArticleGraphViz Dot very long duration of generation
I have a tree structure I want to be generated by Dot. Each node has 4 edges to another 4 nodes. In sum there are about 1,000 nodes. If I try to generate it with Dot it takes a very long time (once I...
View ArticleWhy is GCC 11 compiler producing weird output when optimization is enabled?
Please take a look at this code:#include <stdio.h>#include <stdint.h>int main(){ uint8_t run = 1; /* Define variable of interest and set to random value */ uint32_t dwTime = 0xdeadc0de; /*...
View ArticleWrite HEX values to file in Windows batch
In Linux we can doecho -n -e '\x66\x6f\x6f'> test.txtto write HEX values to a file.How can this be done simply in Windows batch?
View ArticleHow to trigger pynput's GlobalHotkeys when all of the keys are released?
With pynput we can listen for global hotkeys like this:from pynput import keyboarddef on_activate_i(): print('<ctrl>+<alt>+i pressed')with...
View ArticleAnswer by arminb for Is checking the return value of printf important?
Not checking a return value is considered bad practice. BUT it is considered clean, if you explicitly state that you ignore the return value by adding (void) in front of the function call:(void)...
View ArticleAnswer by arminb for CCID protocol command types
The official CCID specification: LinkAlso helpful document (not public available): ISO 7816-3
View ArticleLooking for source code of __builtin_avr_delay_cycles called by _delay_ms in...
I was investigating the delay_ms function of avr-gcc. In delay.h I found its definition:void _delay_ms(double __ms){ double __tmp ;#if __HAS_DELAY_CYCLES && defined(__OPTIMIZE__) && \...
View ArticleCan we tell the browser to set a specific header field?
Can we tell the web browser to set a specific header? I want the web browser to fetch a token from an authentication site. The browser then should set the acquired token in its header...
View Articlebash: xargs passing variable
How can a global script variable be passed to the command of xargs? I tried it this way:TEST=hallo2echo "hallo" | xargs sh -c 'echo passed=$1 test=$TEST' shOutput:passed=hallo test=I know I could use...
View ArticleAnswer by arminb for Substitutes for OSR Driver Loader (windows kernel driver )
Peter_Viscarola's comment from OSR community:Right now, you can't. We're in the process of trying to determine what to do with these hideously old, legacy, utilities. We haven't touched them in years...
View ArticleAnswer by arminb for LoRa: application layer receiving fragmented packets for...
I am not familiar with the Ebyte ttl-1w-433 module but it uses the Semtech SX1276 chip. The SX1276 has a register RegPayloadLength (see SX1272 datasheet, page 114) which defines the payload length....
View ArticleHow to obtain SCARD_ATTR_DEVICE_UNIT correctly
I am developing a smartcard UMDF windows driver. I would like to achieve following behaviour:When listing all connected readers by using API call SCardListReaders I want to retrieve the correct...
View ArticleUsing Data Annotations for SQLite in Entity Framework Core
I am using the Entity Framework Core to interface my SQLite database. I want to set a minimum and maximum range for the field ExitSide in my model Station:using...
View ArticleAnswer by arminb for Single channel gateway only detect first message
This sounds like your transmitter sends the messages using frequency-hopping, while your receiver does not handle it correctly (or the other way around).Definition of frequency-hopping found in chapter...
View ArticleAnswer by arminb for What's mean 10B payload?
Semtech provides a calcualtor for its LoRa chip SX1272. When you fill in the parameters to the calculator from the example (LoRa for the Internet of Things):To give an example we assume SF12, BW125,...
View ArticleAnswer by arminb for Can't Download Full File in Python
First of all http://www.nmgncp.com/dark-wallpaper-1920x1080.html is an HTML document. Second when you try to download an image by direct URL (like:...
View ArticleAnswer by arminb for Add a hyperlink only to one column of a table
Add a counter to you inner loop:$counter = 0;foreach ( $value as $a ){ $url = get_template_directory_uri(); if ($counter == 1) { echo '<td><a href="'.$url.'/folder/' . $a . '">'....
View Article