Monday, October 18, 2021

Cache in C++

Cache in C++

  1. Memory cache for collections of objects
  2. A generic template class to implement a memory cache for collections of objects..

  3. Memory allocations caching
  4. How to optimize heap usage.

  5. Sophisticated memory allocation
  6. How to manage heap in an extremely effective way.

    In this article, I would like to discuss how the performance of a program can be improved dramatically by a bit sophisticated memory allocation management.

  7. C/C++ macros programming
  8. Sophisticated use of macros, never write things twice!.

  9. Superior container classes: Smaller, faster, flexible, convenient
  10. Alternative container classes implementation, a different approach..

  11. A Guard class for any object/resource type
  12. An elegant way to wrap all types that need a cleanup, to minimize the chances of memory/resource leaks..

  13. This is a paragraph.

  14. This is a paragraph.

  15. This is a paragraph.

  16. This is a paragraph.

  17. This is a paragraph.

  18. This is a paragraph.

  19. This is a paragraph.

  20. This is a paragraph.

  21. This is a paragraph.

  22. This is a paragraph.

  23. This is a paragraph.

  24. This is a paragraph.

SQL server 2019 developer edition issue

Question: I installed MS SQL server developer 2019 edition last year. but now I find it occupied almost 300G on my C drive. the total size of my C drive is 500G, so I have to uninstall this SQL server 2019 instance to get enough space to install new Windows patches.

C:\Program Files\Microsoft SQL Server\MSSQL15.NANSHAN\MSSQL\Log\Polybase\dump folder is big size of 300G.

One Answer: As Jacquers said, it's probably your database files. Specifically, if you have the "recovery model" set to "full", and you're not taking regular backups of the transaction logs, they will just keep growing.

You can check the log_reuse_wait_desc column in the sys.databases management view to check for other reasons why the transaction logs might not be shrinking.

run this query:
SELECT name, recovery_model_desc, log_reuse_wait_desc FROM sys.databases ORDER BY name;

MY FIX:
  1. Repair current instance to see if there is any issue: it finds my SQL server instance ID is missing. after repair, the instance ID is corrected.
  2. rename the instance ID to the one without special characters such as XXXXX0000000;
  3. install new feature: PolyBase.
  4. verify PolyBase feature from SQL server Management Studio.
  5. remove all files under this folder: C:\Program Files\Microsoft SQL Server\MSSQL15.NANSHAN\MSSQL\Log\Polybase\dump
  1. Fix PolyBase in SQL Server 2019 Developers Edition
  2. At MS Ignite in Orlando November 4 - 8, 2019, Microsoft announced the general availability of SQL Server 2019. At the same time, the SQL Server 2019 Developers Edition appeared as an MSDN download, and of course, I downloaded it and installed it on my dev box.

    After the installation, I noticed that PolyBase did not start up correctly, and I saw dump files all over the place. After some investigation, I figured out what the issue was, and this blog post describes the fix.

  3. Why is my SQL Log File Huge?
  4. HUGE Log files and how to troubleshoot: The single most common question I have encountered in 18+ years of working with SQL Server:

    Why is the .LDF file filling up my 500GB drive? I only have 100MB of data!!?!?!? Why am I getting error 9002?

    For new or non-DBAs, this is a very frustrating situation without a logical reason (or so it seems). It is also very common for it be be accompanied by applications that won’t work, alerts firing for drive space issues, etc.

  5. The SQL server Log folder is expanding because of the SQL Dump files (what to do with it ?)
  6. The "Log" folder SIZE in the SQL server root directory (X:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Log) becomes too big , ~80 GB.

    When I checked it, I see that there are a lot of SQLDumpxxxx.mdmp /SQLDumpxxxx.txt files in that folder.

    1. what to do with them ?
    2. can I delete them and if it is good thing to do ?
  7. sqldumper error leads to C drive getting full
  8. I've installed Microsoft SQL Server 2019 following this guide. At 10:30 it was advised to change the User database directory, the User log directory and the backup directory from default to directories on drive D.

    Now I got dump files being generated at C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\Log\Polybase\dump.

  9. This is a paragraph.

  10. This is a paragraph.

  11. This is a paragraph.

  12. This is a paragraph.

  13. This is a paragraph.

  14. This is a paragraph.

  15. This is a paragraph.

  16. This is a paragraph.

  17. This is a paragraph.

  18. This is a paragraph.

  19. This is a paragraph.

  20. This is a paragraph.

  21. This is a paragraph.

  22. This is a paragraph.

Saturday, October 16, 2021

static variable in file scope

keyword 1:c static variable in file scope

keyword 2:c access static variable from another file

    My Previous Research

  1. static keyword in C++
  2. My previous research on this static keyword.

  3. What a C static variable in file scope means?
  4. I have three files to demonstrate the use of static variable in file scope. Variable is declared as extern in file2.h, initialized in file2.c. I am declaring another variable with same name in main.c as static to test for static global scope. But I get the error message "main.c|6|error: static declaration of 'var1' follows non-static declaration.

    Could someone explain me the usage of static for file scope?

    If I do not include file2.h in main.c, I do not get any problem. But what if I need to use some functions of other files in main.c but still want to keep the variable scope to this file only?.

  5. Access a global static variable from another file in C
  6. This is a paragraph.

    Can we access static variable from another file?

  7. Chapter 3. Variable declaration
  8. 3.1.2. Static variables Any variable declaration may have the prefix “static”. Static variables in C have the following two properties:

    1. They cannot be accessed from any other file. Thus, prefixes “extern” and “static” cannot be used in the same declaration.
    2. They maintain their value throughout the execution of the program independently of the scope in which they are defined.

    As a consequence of these two properties, the following two cases are derived:

    1. If a static variable is defined outside of the functions it will be accessible only by the code that follows in the file it is declared.
    2. If the static variable is declared in a function, it will only be accessible from the function, and it will keep its value between function executions.

      This behavior is counter intuitive because this variables are declared with the rest of variables in a function, but while the latter acquire new values with each execution, the static variables preserve these values between executions..

    Can we change a global static variable from another file?

  9. Access a global static variable from another file in C
  10. In C language, I want to access a global static variable outside the scope of the file. Let me know the best possible way to do it. One of the methods is to assign an extern global variable the value of static variable,.

    Why can't we access a global static variable from one file to another file?

  11. Access of static variable from one file to another file
  12. I recently came across the question like how to access a variable which declared static in file1.c to another file2.c?

    Is it possible to access static variable?

    My understanding about static keyword in C is,

    static is "internal linkage", so they are accessible only from one compilation unit - the one where they were defined. Objects declared with internal linkage are private to single module..

    How can we use static variable across multiple files?

  13. How to use a static C variable across multiple files?
  14. I have two C files 1.c and 2.c.

    What is correct syntax to access static member of a class?

  15. Global variables, static, extern, const
  16. This is a paragraph.

  17. Static Variables in C
  18. Static variables have a property of preserving their value even after they are out of their scope! Hence, static variables preserve their previous value in their previous scope and are not initialized again in the new scope. Syntax: .

  19. Internal static variable vs. External static variable with Examples in C
  20. The static variable may be internal or external depending on the place of declaration. Static variables are stored in initialised data segments.

    Internal Static Variables: Internal Static variables are defined as those having static variables which are declared inside a function and extends up to the end of the particular function..

    External Static Variables: External Static variables are those which are declared outside a function and set globally for the entire file/program.

    Basics

  21. Internal Linkage and External Linkage in C
  22. good post in depth.

  23. Internal static variable vs. External static variable with Examples in C
  24. The static variable may be internal or external depending on the place of declaration. Static variables are stored in initialised data segments.

    Internal Static Variables: Internal Static variables are defined as those having static variables which are declared inside a function and extends up to the end of the particular function..

  25. Internal static variable vs. External static variable with Examples in C
  26. The static variable may be internal or external depending on the place of declaration. Static variables are stored in initialised data segments.

    Internal Static Variables: Internal Static variables are defined as those having static variables which are declared inside a function and extends up to the end of the particular function..

  27. file scope of static variable
  28. Scope rules of the "persistent" variables in C
  29. This is a paragraph.

  30. Static Variables in C and C++ – File Level
  31. When is a global not a global? When it’s a static variable. This post, and the next three, will talk about static variables. Let’s start with static variables declared in a file.

  32. global variables
  33. The extern Keyword

  34. This is a paragraph.

  35. This is a paragraph.

  36. This is a paragraph.

  37. This is a paragraph.

FAR type in old C/C++ language

FAR type in old C/C++ language

  1. What are near, far and huge pointers?
  2. These are some old concepts used in 16 bit intel architectures in the days of MS DOS, not much useful anymore. Near pointer is used to store 16 bit addresses means within current segment on a 16 bit machine. The limitation is that we can only access 64kb of data at a time..

    A far pointer is typically 32 bit that can access memory outside current segment. To use this, compiler allocates a segment register to store segment address, then another register to store offset within current segment.

    Like far pointer, huge pointer is also typically 32 bit and can access outside segment. In case of far pointers, a segment is fixed. In far pointer, the segment part cannot be modified, but in Huge it can be

  3. What is the difference between far pointers and near pointers?
  4. Can anybody tell me the difference between far pointers and near pointers in C?.

  5. far pointer declaration in Visual Studio
  6. I have a far pointer declaration in this way:

    char far *p;

    But visual studio 2008 give me

    error C2146: missing ';' before identifier 'p'

    Any help is appreciated.

  7. far pointer declaration in Visual Studio
  8. I have a far pointer declaration in this way:

    char far *p;

    But visual studio 2008 give me

    error C2146: missing ';' before identifier 'p'

    Any help is appreciated.

    The answer to your question is also in the blog that you linked to, but it's mentined in a kind of round about way:

    If you open up the Property Manager view to see the property sheets associated with your project, you’ll see that one of the property sheets is named Microsoft.Cpp.Win32.User. This property sheet is actually stored in LocalAppData, just as VCComponents.dat file was, in the directory %LocalAppData%MicrosoftVisualStudio10.0. Using the property editor on the property sheet (just right-click on this property sheet node and select Properties…), you can see that you are able to make edits directly to this file. Since all projects, by default, import this property sheet, you are effectively editing the VC++ directories in the same way you were able to do before.

    The key is that you get to the VC++ Directories property through the "Property Manager" windows (open it via the View/"Property Manager" menu selection). The VC++ Directories setting is in the "Microsoft.Cpp.Win32.user" property sheet - that edits the global setting, so you should only have to do it once.

    There seem to be quite a few people who dislike this change; I think that's because it's less discoverable and obvious than how the setting was managed before. The trade-off is that it's more flexible and integrates into the MSBuild architecture better, and once you do know about it it's just as easy to change as before (it's just harder to find, particularly if you're used to the old place).

Friday, October 15, 2021

high speed charting research

High-speed Charting Control: configuration and fix.

  1. High-speed Charting Control
  2. A flexible charting control to display 2D data.

  3. This is a paragraph.

  4. This is a paragraph.

  5. This is a paragraph.

  6. This is a paragraph.

  7. This is a paragraph.

  8. This is a paragraph.

  9. This is a paragraph.

  10. This is a paragraph.

  11. This is a paragraph.

  12. This is a paragraph.

  13. This is a paragraph.

  14. This is a paragraph.

  15. This is a paragraph.

  16. This is a paragraph.

  17. This is a paragraph.

  18. This is a paragraph.

  19. This is a paragraph.

scrollbar custom library

scrollbar custom library

  1. Custom Scrollbar Library version 1.1
  2. How to use the Cool Scrollbar Library Cool Scrollbars is a library I have written to customize the standard scrollbars of a window. That library only supports standard window-scrollbars. Separate scrollbar controls are NOT supported..

  3. This is a paragraph.

  4. This is a paragraph.

  5. This is a paragraph.

  6. This is a paragraph.

  7. This is a paragraph.

  8. This is a paragraph.

  9. This is a paragraph.

  10. This is a paragraph.

  11. This is a paragraph.

  12. This is a paragraph.

  13. This is a paragraph.

  14. This is a paragraph.

  15. This is a paragraph.

  16. This is a paragraph.

  17. This is a paragraph.

  18. This is a paragraph.

  19. This is a paragraph.

windows version

  1. DtWinVer v1.34 - OS Detection Utility
  2. A comprehensive OS detection utility..

  3. Windows Version Numbers
  4. Values returned by GetVersionEx for Windows operating systems.

  5. This is a paragraph.

  6. This is a paragraph.

  7. This is a paragraph.

  8. This is a paragraph.

  9. This is a paragraph.

  10. This is a paragraph.

  11. This is a paragraph.

  12. This is a paragraph.

  13. This is a paragraph.

  14. This is a paragraph.

  15. This is a paragraph.

  16. This is a paragraph.

  17. This is a paragraph.

  18. This is a paragraph.

  19. This is a paragraph.

  20. This is a paragraph.