Knowledge.ToString()

Month: April 2023

  • Parse Number List and Number Ranges in C#

    Have you ever had a need to parse list of numbers and number ranges? Wanted to convert it into strongly typed data? For example, string “2-5, 7, 9-15” should be converted into strongly typed objects for easier handling. Input is a string which consists of comma separate numbers or number ranges. Number ranges are indicated…

    |

  • C/C++ Dll: Two Ways to Get a List of Exported Symbols on Windows

    If you are developing a C/C++ dll, you want to make sure that you are exporting the symbols. Exporting symbols will help you use your dll using PInvoke by exposing only needed interface while hiding the implementation within C/C++ code. You will get plenty of online resources when you are using Linux for your development.…

    |

  • ReactJS : Generic OnChange Event Handler for TextBox in Typescript

    If you have a ReactJS component with multiple textboxes, you don’t want to create multiple event handlers for updating state. Here is a way to use a generic OnChange event handler for all textboxes.

    |

  • ReactJS/Typescript Error Solved: Cannot Find Name

    When we use ReactJS functional component with props, it throws following error: Here is a code sample that generates the error. This in fact is not a ReactJS error. It is a Typescript error. By mistake I defined data type “string” for variable “heading” two times and hence it was causing an issue. Here is…

    |

  • How to Create ReactJS TypeScript Component with State without Props

    When we use ReactJS, the first argument for component requires props. but if we don’t have props and only state, here is a way to define component. Technically we are creating props object but it does not have any property.

    |

  • ReactJS Error Solved: Type Children is Not Assignable to Type IntrinsicAttributes

    When you are trying to create a React Component with strongly typed props you may get this error. This means that you are trying to use component with children and you did not provide any child element. In above code, it is expecting children because you are not using self closing tag. If you are…

    |

  • CMake – How to Generate Visual Studio Project

    You are a developer familiar with Visual Studio on Windows. If you have downloaded C/C++ code from Github, you will find it intimidating to build your code with unknown tools. Your primary goal is to quickly compile the code on a click of a button and not worry about compilation details behind the scene. C/C++…

    |