vba – How to manage concurrency while writing – DBMS on files

I’m trying to create a small DBMS with text files, but I’ve no experience with this stuff.

The code below is part of the Writer class of the Table class. Its concern is to gain access to the table and make the requested changes.

The hardest part is to gain unique access to the file that contains the table.

To achieve the goal, I create a busy temp file that is meant to be a signal for other processes to wait and retry because another process is already changing the table.

At that point, the code check for the updated version of the table and, if found, recalculate the name of the file-table (this is because the file name contains the ID of the transaction).

I would like to know how stupid is what I’m doing and if there is a way to say to the OS “hey! please lock that folder”.
The complete code is quite long and is not included, the revision that I’m asking for is on this part. Do you see any weak points in the flow of actions?

This DBMS is meant to run on business networks.

    t_Failed = 0
    t_Success = 1
End Enum

    os_TiredOfTrying = 0
    os_AlreadyBusy = 1
    os_KindaSmooth = 2
End Enum

Public Function WriteRecords(args As Variant) As TRANSACTION_RESULT
    Dim result              As TRANSACTION_RESULT
    Select Case OpenAndLockOld
        Case os_KindaSmooth
            PretendToBeBusy         ' create an empty "busy" file to signal that there is another transaction going on
            OpenTransaction         ' get a transaction ID
            ReadContent             ' read old table
            ManipulateContent       ' create a new array of bytes in accord to args
            OpenAndLockNew          ' create the updated file
            RenameOld               ' move the old file for transaction reversal
            CreateTransaction       ' write on the registry of the transactions
            ChangeAttitude          ' delete the busy file
            result = t_Success
        Case os_AlreadyBusy
            CheckForStuckedBusy     ' check for the time of creation of the busy file and if it's too old, assume that is stuck and proceed to delete it
            result = t_Failed
        Case os_TiredOfTrying
            result = t_Failed
    End Select
    WriteRecords = result
End Function

Private Function OpenAndLockOld() As OPENING_STATE
    Dim result              As OPENING_STATE
    Dim countOfBusy         As Long
    Dim countOfDenied       As Long
    Dim countOfUnkownError  As Long
    ff = FreeFile
    If Dir$(BUSY_PATH) = vbNullString Then      ' check if another process has already gained access
        On Error Resume Next
        Open tablePath For Binary Access Read Write Lock Read Write As #ff
        Select Case Err.Number
            Case 0
                result = os_KindaSmooth
            Case 55, 70
                countOfDenied = countOfDenied + 1
                If countOfDenied < 11 Then
                    FindUpdates                 ' findUpdates look for changes at the table by other processes
                    GoTo Start
                    result = os_TiredOfTrying
                End If
            Case Else
                ' no idea of what is going on here
        End Select
        countOfBusy = countOfBusy + 1
        If countOfBusy < 11 Then
            GoTo Start
            result = os_AlreadyBusy
        End If
    End If
    OpenAndLockOld = result
End Function

8 – How to select the user desired crop in the “Manage Display” section of a paragraph type for an image field?

I’m currently using ImageWidget crop to give some aspect ratios for users to pick when editing content (1:1, 1:2, 2:1, 2:3, 16:9), that is properly set up in the “Manage Form Display” section of the paragraph type I’m using:

screenshot of the "Manage form display" configuration

That is working properly and showing up as expected in the content editor, however, the crop isn’t respected on the front-end because I currently have, in the “Manage Display” section of the paragraph type, “Original Image” selected as a way to present the image.

"Manage Display" section with the image type "Original image" selected

If I select one of the previously mentioned crops, that is respected in the front-end (i.e.: if I select 16:9, and crop the image to 16:9, that shows up fine).

"Manage Display" section when selecting other image styles

What should I do to be able to select multiple aspect ratios for the image in the “Manage Display” section so whatever aspect ratio was selected by the user when editing content is used? I’m working on Drupal 8 (mentioning this because some have advised to switch modules, but I’m unable to do so because of both the version and my employer who has been using this for a while now)

I will do manage your pinterest profile and growth for $5

I will do manage your pinterest profile and growth

About my service:

At its social media coronary heart, Pinterest is marketing.

Creating forums, finding human beings to comply with, and pinning things associated with your enterprise, and then also pinning your very own merchandise, offerings or blog articles that can be related on your internet site is all it takes! Of route – there’s a time dedication many busy human beings cannot spare.

We actually have the skill to create an expert Pinterest presence for you. Your up-to-date account will showcase your product, carrier, or posts to millions of users trying to find experts, forums & pins on your niche.

During the time period, we will do the following:

  • New account setup
  • Update Profile
  • Analysis and revision of present account
  • Pin
  • Repin
  • Follow People & Boards for your area of interest
  • Create new forums that in shape in your niche
  • Organize contemporary forums

Keep you up to date in the course of the procedure with a constant communiqueExtra Services:

  • Set Up Rich Pins
  • Apply for Group Boards
  • Claim Website
  • Create & Design Mix & Unique Pins

If you need this service, please feel free to knock me.Thank you.


How we need to manage the App Secret expiry without having any downtime

I have have been working with remote event receivers for long time but i have never thought that they actually get expired, so based on this link @ https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/replace-an-expiring-client-secret-in-a-sharepoint-add-in?redirectedfrom=MSDN we can renew the app secret after been expired.. but my question is that the steps inside the link assume that the App secret is already expired and we can renew the App secret and then update the web.config with the new App Secret.. but my question is how we can prevent the App from been expired? and renew it before expiry .. as seems we can not use the new App Secret unless the old one already expired.. any advice on this please?

taxonomy terms – How do I manage breadcrumbs when the node uses multiple vocabularies?

I have a blog in Drupal 8 and it uses the Categories vocabulary to display breadcrumbs as Home > Blog > (Category) > Post title.

I added taxonomies from the Tags vocabulary, which means every post can have one category, and multiple tags. Since I added the Tags vocabulary, it has taken over the breadcrumbs on individual blog posts, which are now Home > Blog > (Tag) > Post title.

Is it possible to control which vocabulary should have priority when it comes to displaying breadcrumbs?
Is it possible to control which vocabulary is displayed on blog posts based on where the user came from? For example, if the user is on the individual Tag page (Home > Blog > (Tag)) and clicks on a blog post belonging to that tag, the blog post should display the breadcrumbs using the Tags vocabulary (Home > Blog > (Tag) > Post title). However, if the user is on the individual Category page (Home > Blog > (Category)) and clicks on a blog post belonging to that category, the blog post should display the breadcrumbs using the Category vocabulary (Home > Blog > (Category) > Post title).

authentication – How to manage API keys

I’m trying to consume a payment processor API (not developed by my), but (being honest) I don’t know anything about security, I don’t understand API keys and authentication, I have multiple questions about API’s that I couldn’t resolve no matter how much research I did, the questions are:

  1. What could happen if someone steal the payment processor API keys? I mean, I know for example that if someone steals your Google API keys he can use Google API charging it to my credit card (there are multiple cases all around the world), but in this case the API keys are used to process the payment, I don’t understand what they can do with my API keys

  2. Where should I store my keys, I’m using React.js CRA as Front-end and PHP as backend, I was making some research and this is what I found:https://medium.com/better-programming/how-to-hide-your-api-keys-c2b952bc07e6

    the post says: “if you wish to totally mask your key, you should make a backend that proxies your requests, and store the API key there”, so at this point my question is should I send the request to my backend then my backend sends a request to payment processor API?.

  3. When developing my own API should I use authentication no matter what I am going to do?, I mean, I know that authentication is for user login functionalities, but, should I use Auth to bring products from a database?

  4. When generating API keys is it safe to store them in a database?

Please try to be gentle I don’t understand security, I’m trying to do my best

How to manage DbContexts in Ef Core?

I want to add Ef Core to my project and thought about DbContexts. Most of the information can be found here


So let’s assume you have a users model and a tasks model representing the database tables. I’m not sure if I should

Create 1 DbContext called DatabaseContext and register both models as DbSet<T>s


Create multiple DbContexts, as many as I want. Maybe one per model or combine some sets like a bounded context as you would have it in Domain-Driven-Design

For now I think I should only create multiple DbContexts when having multiple connection strings, so the users come from database A and the tasks come from database B.

My application uses 1 database and no external sources so I think the first approach should be taken. Is that correct? How do you handle your contexts?