Friday, September 2, 2022

bitfield

bitfield

    Microsoft Site

  1. C Bit Fields
  2. In addition to declarators for members of a structure or union, a structure declarator can also be a specified number of bits, called a "bit field." Its length is set off from the declarator for the field name by a colon. A bit field is interpreted as an integral type.

  3. Bit-field
  4. Declares a class data member with explicit size, in bits. Adjacent bit-field members may (or may not) be packed to share and straddle the individual bytes.

    Example

  5. C - Bit Fields
  6. Suppose your C program contains a number of TRUE/FALSE variables grouped in a structure called status, as follows −

  7. Bit Fields in C
  8. In C, we can specify size (in bits) of structure and union members. The idea is to use memory efficiently when we know that the value of a field or group of fields will never exceed a limit or is within a small range.

  9. What direction does the compiler define bitfields? Is it LSB to MSB or the reverse.
  10. What direction does the compiler define bitfields? Is it LSB to MSB or the reverse.

  11. Bit field
  12. A bit field is a data structure that consists of one or more adjacent bits which have been allocated for specific purposes, so that any single bit or group of bits within the structure can be set or inspected.[1][2] A bit field is most commonly used to represent integral types of known, fixed bit-width, such as single-bit Booleans.

  13. Storage and Alignment of Structures
  14. Structure members are stored sequentially in the order in which they are declared: the first member has the lowest memory address and the last member the highest.

  15. How Endianness Effects Bitfield Packing
  16. Hints for porting drivers. Big endian machines pack bitfields from most significant byte to least. Little endian machines pack bitfields from least significant byte to most.

  17. 6.4. Bitfields
  18. While we're on the subject of structures, we might as well look at bitfields. They can only be declared inside a structure or a union, and allow you to specify some very small objects of a given number of bits in length. Their usefulness is limited and they aren't seen in many programs, but we'll deal with them anyway. This example should help to make things clear:

  19. Don'ts for bit-fields
  20. Don'ts for bit-fields

  21. Bitfield storage in memory
  22. Bit field are structures in c that hold bit fields. A typical definition is:

  23. Can I safely assume that Windows installations will always be little-endian?
  24. I'm writing a userspace filesystem driver on Windows and endianness conversions are something I've been dealing with, as this particular filesystem always stores values in little-endian format and the driver is expected to convert them (if necessary) for the CPU it's running on. However, I find myself wondering if I even need to worry about endianness conversions, since as far as I can tell, desktop Windows only supports little-endian architectures (IA32, x86-84, etc.), and therefore, the on-disk little-endian values are perfectly fine sans conversion. Is this observation accurate, and if so, is it generally acceptable to make the assumption that Windows will always be running on little-endian hardware? Additionally, is it even possible (in 2011) to run Windows on a big-endian emulator or something, such that one could even test for endianness issues?

  25. Endianness
  26. "Big-endian" and "Little-endian" redirect here. For the conflicting ideologies in Gulliver’s Travels, see Lilliput and Blefuscu § History and politics.

Wednesday, August 31, 2022

C# struct layout and operator overloading

C# struct layout

  1. Struct layout in C# - .NET Concept of the Week - Episode 13
  2. In this episode I talk about struct layout in C#. You will learn how C# structs are represented in memory and you will also learn how you can influence this with the StructLayoutAttribute.

  3. C# Struct: Everything You Need to Know in Lesson 12
  4. This lesson will teach you about C# struct. Our objectives are as follows: Understand the Purpose of structs. Implement a struct. Use a struct.

    Operator Overloading

  5. Does the order of operands matter for an overloaded == operator in C#
  6. I am using a 3rd party tool (Unity3d), where one of the fundamental base classes overloads the == operator (UnityEngine.Object). The overloaded operator's signature is: public static bool operator == (UnityEngine.Object x, UnityEngine.Object y)

  7. Operator overloading (C# reference)
  8. A user-defined type can overload a predefined C# operator. That is, a type can provide the custom implementation of an operation in case one or both of the operands are of that type. The Overloadable operators section shows which C# operators can be overloaded

  9. About Operator Overloading
  10. The principal arithmetic and comparison operators can be adapted for use by your own classes and structs. This is known as operator overloading. This article is a thorough discussion of the syntax as well as which operators can be overloaded and those that can't.

  11. C# explicit and implicit Keywords
  12. Use the explicit and implicit keywords to implement conversions with operators.

  13. Implicit And Explicit Conversions In C#
  14. In my last article about type casting, I explained narrow and widening conversions along with as and is operators. In this article, we shall take casting to a whole new level. At the end, you will learn how readability of code can be improved with implicit and explicit operators.

    With the help of implicit operator, readability of code is improved and now class Money is responsible for all the conversion needed.

    So as to summarize, the implicit keyword should be used to enable implicit conversions between a user-defined type and another type, if the conversion is guaranteed not to cause a loss of data.

  15. Working With Data Types
  16. First thing a programmer looks for is what kind of data types a programming languages has and how to use them. In this part, I will cover C# data types and how to use them in a program.

  17. Static implicit operator
  18. What does static implicit operator mean?

  19. Why must C# operator overloads be static?
  20. Why does C# require operator overloads to be static methods rather than member functions (like C++)? (Perhaps more specifically: what was the design motivation for this decision?)

  21. Writing Implicit and Explicit C# Conversion Operators
  22. Implicit conversion operators are those that don’t require an explicit cast.
    Explicit conversion operators are those that do require an explicit cast.

Monday, August 29, 2022

type converter

need to play around with them...

  1. Dynamic Type Description Framework for PropertyGrid
  2. A framework that allows you to customize your class for PropertyGrid at design-time and/or run-time. Using this framework your can control what properties PropertyGrid shows, how the properties are shown, and when it shows them.

  3. Universal Type Converter
  4. This article is about the different possibilities of type conversion provided by the .NET Framework. At the end, it offers a ready to use solution: the UniversalTypeConverter which converts nearly every type to another type.

  5. Bit Flags Type Converter
  6. An implementation of TypeConverter which allows you to edit bit flag enumerations in the PropertyGrid.

  7. A Vector Type for C#
  8. A guide through a Vector type in C# using Cartesian and Euclidian Geometry

  9. Generics Converter for Basic Types
  10. A generics method to convert an object to a basic type.

  11. .NET Type Conversion Utility
  12. Convert what System.Convert can't.

  13. Transformations Type Converter Library
  14. The transformations library is intended to cover type conversion, enumeration conversion and some additional helper methods.

  15. A Beginner's Tutorial - Type Casting and Type Conversion in C#
  16. This small article discusses about type casting in C#.

Thursday, August 18, 2022

IEnumerable example

IEnumerable

c# ienumerable to array

  1. C# – Best way to convert IList or IEnumerable to Array
  2. However, I want it to return an array of the Entity that I'm selecting, what would be the best way of accomplishing that? I can either enumerate through it and build the array, or use CopyTo() a defined array.

  3. C# IEnumerable vs List and Array
  4. When you should use one over the other and what I learned trying to work this out…

  5. C# IEnumerable Examples: LINQ, Lists and Arrays
  6. IEnumerable. A List, array, and query can be looped over. This makes sense. All these constructs implement methods from IEnumerable.

  7. C# / .NET - convert IEnumerable to array
  8. In this article, we would like to show you how to convert IEnumerable to array in C#.

  9. Best way to convert IList or IEnumerable to Array
  10. I have a HQL query that can generate either an IList of results, or an IEnumerable of results. However, I want it to return an array of the Entity that I'm selecting, what would be the best way of accomplishing that? I can either enumerate through it and build the array, or use CopyTo() a defined array.

Saturday, August 13, 2022

TreeView

TreeView

  1. C# Tutorial 72: How to use TreeView (Add ,Removes Clear , Delete Checked Items from a TreeView)
  2. C# Tutorial 72: How to use TreeView (Add ,Removes Clear , Delete Checked Items from a TreeView)

  3. TreeView (tvw)
  4. TreeView (tvw) - Allows you to display a hierarchy of nodes with parents and child.

  5. C# – Saving content of a treeview to a file and load it later
  6. In my C# WinForms program I have a treeview that only contains parent nodes (so, no childs) it is like a listbox but I needed it because of haveing differet properties of nodes like Name, Tag and Text.

    No I want to be able to save the content of this treeview into a file (Basically a text file which I call it *.MVIA). The question is what is the best way to save all three properties of nodes in a file so it can loaded again later properly?

  7. Loading and Saving a TreeView control to an XML file using XmlTextWriter and XmlTextReader / Controls / C#
  8. The purpose of this article is to demonstrate the saving and loading of System.Windows.Forms.TreeView control from an XML file. XmlTextReader and XmlTextWriter of System.Xml namespace are used for reading and generating XML files respectively. It also demonstrates a simple XML file viewer using a TreeView control.

  9. How to edit treeview xml file and save in Winforms?
  10. My Code wroks. I choose a file and it is shown to Application. How to edit a node by double-clicking it and save it by pressing Crtl+S? Thank you for your help!

  11. Saving content of a treeview to a file and load it later
  12. In my C# WinForms program I have a treeview that only contains parent nodes (so, no childs) it is like a listbox but I needed it because of haveing differet properties of nodes like Name, Tag and Text.

  13. C# — Load a TreeView from JSON, Save a TreeView to JSON
  14. Here are a few snippets of code I needed for internal tools…

  15. BinaryFormatter Class
  16. Serializes and deserializes an object, or an entire graph of connected objects, in binary format.

Friday, August 12, 2022

ChartArea class

ChartArea class

  1. How do I create a canvas in c#?
  2. I am self-taught and am trying to move away from text-based programs and into actual games and apps, but I cannot figure out/understand Microsoft's documentation to create a canvas. When I run this code all I get is the terminal. This is my code currently, copied straight from Microsoft:

  3. A quick look at the ControlPaint class in C#
  4. This class has some methods to draw standard GUI elements

  5. code tutorials
  6. good to watch

  7. Canvas implementation for C#
  8. Design and implementation of canvas in C#

  9. DotNetMatrix: Simple Matrix Library for .NET
  10. A set of C# classes providing basic matrix operations

  11. Sandcastle Conceptual Help: Quick Start
  12. Learn how to write user manuals with the Sandcastle Help Compiler.

  13. A Structured 2D Graphics Framework
  14. Welcome to Piccolo2D! A revolutionary way to create robust, full-featured graphical applications in Java and C#, with striking visual effects such as zooming, animation and multiple representations.

  15. Papers We have Written
  16. Here you'll find an archive of all the papers we have published that are related to Piccolo, it's predecessor toolkits, or zoomable user interfaces in general.

  17. 2D Graphics Primer
  18. This section contains an overview of various 2D graphics concepts related to Piccolo. This is a huge topic which cannot be covered in depth here. But the basics are presented below. In many cases these lower level details are handled for you by Piccolo. But, understanding them will help you to use the framework more efficiently, especially when extending functionality and creating your own types.

  19. API Documentation
  20. Here you'll find detailed documentation of the Piccolo.Java and Piccolo.NET toolkits. Currently there is no API documentation for PocketPiccolo.NET. But, the Piccolo.NET API can be used, since PocketPiccolo.NET is essentially a subset of Piccolo.NET. We will eventually update the Piccolo.NET API docs to say which methods are supported in PocketPiccolo.NET.

  21. Getting Started
  22. Here you will find both basic and advanced tutorials to help you get started using Piccolo. All tutorials provide examples in both Java and C#. This section assumes you have read Piccolo Patterns and have a basic understanding of the concepts presented there.

select point in series

c# chart select point

  1. C# Chart, Windows Forms (Series and Points)
  2. Use the Chart control from Windows Forms to display data in a graphical way. Chart. The Chart control visualizes your data. It displays data in your Windows Forms program as a bar graph or chart. With Chart you can quickly display your data in a colorful graphic controlled by C# code.

  3. Selection of Points or Series in MS Chart
  4. I am look at the System.Windows.Forms.DataVisualization.Charting.Chart class, and I cannot figure out how to enable the selection of points or series (like in Excel charts). Is the functionality there, or do I have to implement it myself?

  5. Chart.HitTest Method
  6. Determines the chart element, if any, that is located at a point defined by the given X and Y coordinates.

  7. Extract nearest X,Y data from line series during mouseover event
  8. I'm doing an evaluation of this product. I'm using VS2015, C#, winforms. I'd like to know how to extract X,Y data from a line series chart at the nearest data point to where I mouse over the plotted line in the chart.

  9. GDI+ Line/Curve Drawing and Hit Test
  10. Demo application for developing a drawing application using GDI+. Featuring line/curve draw, hit test, and implementation of CObject/CObArray classes.

  11. Hit Testing Lines and Curves
  12. Useful graphics applications, such as CAD or drawing programs, permit the user to select and manipulate graphics objects. This article describes three methods for detecting if the user has selected a line or a curve.

  13. hit test project
  14. need to download it soon..

  15. Rectangle.Contains Method
  16. Determines if the specified point is contained within the rectangular region defined by this Rectangle.