Azure Storage Filter Last Modified Date

This blog article shows you how to filter the files from Azure Storage by Last Modified date. The snippet of the PowerShell as follows.

Connect-AzAccount -Tenant TenantId -Subscription SubscriptionId

$resourceGroupName =” resourceGroupName “

$storageAccName =” storageAccName “

$directoryPath =”document”

$container = “container”

$ctx=(Get-AzStorageAccount -ResourceGroupName $resourceGroupName -Name $storageAccName).Context

Get-AzStorageBlob -Container “document” -Context $ctx | Where-Object {$_.LastModified -gt “2024-03-15”}

Certainly! Let’s break down the PowerShell script step by step:

1. Connect-AzAccount -Tenant TenantId -Subscription SubscriptionId:

    • This command connects to your Azure account using the specified tenant ID and subscription ID.
    • It authenticates you to perform operations against your Azure resources.

2. Variable Assignments:

    • $resourceGroupName: This variable holds the name of the Azure resource group where your storage account resides.
    • $storageAccName: This variable stores the name of your Azure storage account.
    • $directoryPath: Specifies the directory path within the storage account container.
    • $container: The name of the storage container you want to work with.

3. $ctx=(Get-AzStorageAccount -ResourceGroupName $resourceGroupName -Name $storageAccName).Context:

    • This line retrieves the storage account context (connection information) for the specified resource group and storage account.
    • The context is necessary for subsequent operations on the storage account.

4. Get-AzStorageBlob -Container "document" -Context $ctx | Where-Object {$_.LastModified -gt "2024-03-15"}:

    • This command retrieves a list of blobs (files) from the specified container named “document” within the storage account.
    • The -Context $ctx parameter ensures that the command uses the previously obtained storage account context.
    • The Where-Object filter is applied to select only blobs where the LastModified timestamp is greater than March 15, 2024.

In summary, this script connects to your Azure account, retrieves the storage account context, and then lists the blobs in the “document” container that were modified after March 15, 2024. If any blobs meet the criteria, they will be displayed in the output12

Also: Start and Stop Azure App Service using PowerShell

powershell1

You can see the return result sample as above.

Source code download: https://github.com/chanmmn/powershell/tree/main/2024/AzureStorageFilterDate?WT.mc_id=DP-MVP-36769

Reference: https://stackoverflow.com/questions/66763313/powershell-azure-storage-accounts-get-last-authentication-time-date/?WT.mc_id=DP-MVP-36769

Posted in Uncategorized | Leave a comment

Responsible AI guidelines for decision makers

Discover resources and strategies to help you prioritise responsible AI as you build and modernise your intelligent apps. In this eBook, Responsible AI Guidelines for Decision Makers: Best Practices for Intelligent Apps, learn more about Microsoft’s approach to responsible AI and explore ways to apply best practices at your organisation so that you can confidently take full advantage of the efficiency, personalisation and insight that AI solutions offer.

Learn how to:

  • Adopt responsible AI best practices that allow you to build and modernise intelligent apps while still protecting your innovations from societal, environmental and reputational impacts.
  • Overcome common AI adoption barriers including complexity , fear of the unknown and security concerns.
  • Protect your data solutions, apps and AI systems using cloud-native tools and services with built-in security and compliance features.

Responsible AI  guidelines for  decision makers

This blog is originated form here (https://chanmingman.wordpress.com).
The content is extracted from a Microsoft email.
(Read it now, I am not sure how long Microsoft will leave the link alive).

Read: https://bit.ly/3JIg6dK

Posted in .Net, Cloud, Community, Computers and Internet, CTO, Data Platform, programming | Leave a comment

VBA Loop to Office.js Loop

This blog article shows you how to do the VBA Loop in Office JS. This article expects you to have basic VBA knowledge. I have a VBA to loop through the column A as follows:

Sub LoopA()

Range(“A1”).Select

While (ActiveCell.Value <> “”)

      Debug.Print ActiveCell.Value

      ActiveCell.Offset(1, 0).Select

Wend

End Sub

To convert to Office JS. Firstly, you need to have Office 365. Open Excel and go to Automate. Click on New Script

vba1

Paste the script into the script pane and click on Run.

function main(workbook: ExcelScript.Workbook) {

  const sheet = workbook.getActiveWorksheet();

  let range = sheet.getRange(“A1”);

  while (range.getValue() !== “”) {

    console.log(range.getValue());

    range = range.getOffsetRange(1, 0);

  }

}

Also: SQL Server generate SELECT script using Excel VBA

vba2

A few things to note:

  • · We use getValue() instead of ActiveCell.Value.
  • · Instead of Debug.Print, we use console.log.
  • · The getOffsetRange method replaces ActiveCell.Offset.

I believe till now there is no Breakpoint feature for Office JS.

Reference: https://learn.microsoft.com/en-us/office/dev/scripts/overview/exce?WT.mc_id=DP-MVP-36769

Posted in .Net, Cloud, Community, Computers and Internet, Data Platform, Microsoft Office, Office 365, programming | Tagged | Leave a comment

How to raise the bar on customer relationships using AI

Organisations can usher in a new era of customer relationship excellence and business innovation by taking advantage of AI in CRM platforms. Read the eBook to learn how to:

  • Deepen customer engagement. Deliver personalised experiences at scale, fostering deeper customer relationships and loyalty through targeted, meaningful interactions.
  • Increase operational efficiency. Streamline CRM operations to increase efficiency, reduce repetitive tasks and accelerate customer issue resolution.
  • Support data-driven decision-making. Make more informed, data-driven decisions to optimise campaigns, allocate resources more efficiently and increase sales engagement.

How to raise the bar on customer relationships using AI.

This blog is originated form here (https://chanmingman.wordpress.com).
The content is extracted from a Microsoft email.
(Read it now, I am not sure how long Microsoft will leave the link alive).

Read: https://bit.ly/44gJcKI

Posted in .Net, Cloud, Community, Computers and Internet, CTO, Data Platform | Tagged | Leave a comment

Extract Date Number from Date

This blog article shows you a code sample on how to extract the date number from the date data type. I was testing this using GitHub Copilot. As you can see from the following screenshot. I prompt the Copilot to “Write a function to extract 2 digits for day, 2 digits for month and 2 digits for year form a date”.

image

In came out quite a decent generated code but … no function.

Also: Generate Code using GitHub Copilot, Gemini, ChatGPT, and Bing Chat

image

I have wrapped it with a function like the following.

public static void ExtractDate()
{
            DateTime date = DateTime.Now;


           // Extracting 2 digits for day, month, and year
            string day = date.ToString(“dd”);
            string month = date.ToString(“MM”);
            string year = date.ToString(“yy”);


           // Printing the extracted values
            Console.WriteLine($”Day: {day}”);
            Console.WriteLine($”Month: {month}”);
            Console.WriteLine($”Year: {year}”);
    }

Source code download: https://github.com/chanmmn/general/tree/master/2024/GetDate2Digit/?WT.mc_id=DP-MVP-36769

Reference: https://code.visualstudio.com/docs/copilot/overview/?WT.mc_id=DP-MVP-36769

https://learn.microsoft.com/en-us/dotnet/csharp/tour-of-csharp/tutorials/?WT.mc_id=DP-MVP-36769

Posted in .Net, Cloud, Community, Computers and Internet, programming | Tagged | Leave a comment

Find Primary Key and Foreign Key Dependencies of Database Table in MS SQL

This blog article shows you how to find dependencies of Database Table in MS SQL. If you get the SQL statement correct, then it is quite straightforward. The SQL statement below will give you the dependencies.

Also: How to Create Microsoft SQL Server Stored Procedure

Source code download: https://github.com/chanmmn/database/tree/main/2024/script/FindPKFKTableDependenciesMSSQL/?WT.mc_id=DP-MVP-36769

Reference: https://stackoverflow.com/questions/925738/how-to-find-foreign-key-dependencies-in-sql-server?WT.mc_id=DP-MVP-36769

https://www.mssqltips.com/sqlservertip/2999/different-ways-to-find-sql-server-object-dependencies/?WT.mc_id=DP-MVP-36769

Posted in .Net, Cloud, Community, Computers and Internet, Data Platform, programming | Tagged , , , , | Leave a comment

Assembly Language with Visual Studio Code

This blog article shows you how to run Assembly Language using Visual Studio Code. This article expects you to have already used Visual Studio Code somewhere. Open Visual Studio Code, click on the Extension. Install MASM/TASM.

Click on Explorer. Add a new file with the extension asm, for example I used test.asm.

Type the following code.

.model small

.stack

.data

    msg db “Hello World!”, 13, 10, “$”

.code
start:
mov ax, @data
mov ds, ax                 ; set DS to point to data segment
mov dx, offset msg        ; point to the string
mov ah, 09h                 ; function to print the string
int 21h                     ; execute the function

mov ax, 4C00h             ; function to terminate the program
int 21h                     ; execute
end start

Right click on the code page and select Run ASM code.

The result is on the following screen.

Source code download: https://github.com/chanmmn/general/tree/master/2024/asm/?WT.mc_id=DP-MVP-36769

Reference: https://github.com/fredimachado/Assembly/blob/master/tasm/01/hello.asm

https://youtu.be/pBh29mURXLk/?WT.mc_id=DP-MVP-36769

Posted in .Net, Cloud, Community, Computers and Internet, programming | Tagged | Leave a comment

CTO April 2024 articles and resources

 

These are the good reads found in this month.

Low-code and no-code development gets a makeover as priorities shift to AI

It’s probably too soon for inexperienced developers to work directly with generative AI. But once AI is embedded into low-code platforms, the technology could serve as a valuable assistant…

https://www.zdnet.com/article/low-code-and-no-code-development-gets-a-makeover-as-priorities-shift-to-ai/

Turn Generative AI from an Existential Threat into a Competitive Advantage

1. Adopt publicly available tools.

2. Customize the tools.

3. Create automatic and continuous data feedback loops…

https://hbr.org/2024/01/turn-generative-ai-from-an-existential-threat-into-a-competitive-advantage

Strategy & Artificial Intelligence

AI & the Progress of Knowledge

Why is the Future Unevenly Distributed?

What Then Does LLM/AI Do?…

https://rogermartin.medium.com/strategy-artificial-intelligence-6f719015b8fc

3 areas where gen AI improves productivity — until its limits are exceeded

Gen AI and customer service

Gen AI and software development

Gen AI and knowledge work…

https://www.cio.com/article/1312721/3-areas-where-gen-ai-improves-productivity-until-its-limits-are-exceeded.html

Why public cloud providers are cutting egress fees

The writing on the wall

Following the leader

Don’t cry for the cloud providers…

https://www.infoworld.com/article/3714291/why-public-cloud-providers-are-cutting-egress-fees.html

Resource:

Accelerate innovation, achieve agility and build on a comprehensive platform

https://chanmingman.wordpress.com/2023/02/15/accelerate-innovation-achieve-agility-and-build-on-a-comprehensive-platform/?WT.mc_id=DP-MVP-36769

Posted in .Net, Cloud, Community, Computers and Internet, CTO, Data Platform | Tagged | Leave a comment

Find Dependencies of Database Table in MySql

This blog article shows you how to find dependencies of Database Table in Mysql. If you get the SQL statement correct, then it is quite straightforward. The SQL statement below will give you the dependencies.

select distinct ref.referenced_table_name
Source_Table,
tab.constraint_name, tab.constraint_type, tab.table_name Target_Table

from information_schema.table_constraints tab,    information_schema.referential_constraints ref

where tab.constraint_name = ref.constraint_name ORDER BY Source_Table;

Also: MySQL Query Profiler

Source code download: https://github.com/chanmmn/mysql/tree/main/script/FindTableDependent/?WT.mc_id=DP-MVP-36769

Reference: https://dba.stackexchange.com/questions/5441/how-to-find-dependencies-on-a-table-in-mysql-5-0#:~:text=Just%20inspect%20table_name%20and%20referenced_table_name%20columns.&text=You%20can%20use%20this%20for,to%20find%20your%20specific%20key.&text=You%20can%20use%20Toad%20for%20MySQL%2C%20which%20is%20free./?WT.mc_id=DP-MVP-36769

Posted in .Net, Cloud, Community, Computers and Internet, Data Platform | Tagged | Leave a comment

Using SWITCH to Replace CHOOSE in Power Query Excel

This blog article shows you how to use SWITCH in Power Query Excel. In Excel, you have Choose function.

An example is like the following.

= Choose (Weekday(A2), “Sunday,”, “Monday,” “Tuesday,” “Wednesday,” “Thursday,” “Friday,” “Saturday”).

Unfortunately, there is no Choose in Power Query.

What you need to do is to use SWITCH like the one below.

=SWITCH(WEEKDAY(DailyVolumes[Weekday]),1,“Saturday”,2,“Sunday,”,3, “Monday”,4,“Tuesday”,5,“Wednesday”,6,“Thursday”,7,“Friday”)

Reference: https://www.indeed.com/career-advice/career-development/how-to-get-day-of-week-from-date-in-excel#:~:text=Click%20on%20the%20blank%20cell,key%20to%20get%20your%20result./?WT.mc_id=DP-MVP-36769

https://exceljet.net/functions/switch-function

Posted in .Net, Cloud, Community, Computers and Internet, Data Platform, Microsoft Office, Office 365 | Tagged | Leave a comment