Wednesday, January 22, 2025

jquery debugging

 

// This function will wrap all methods on an object
// with detailed logging information.
function wrapper (toWrap, identifier, collapse) {
// Determine how we're grouping
var grouping = collapse ? 'groupCollapsed' : 'group';
// Get all keys of our method and iterate over them
var methods = Object.keys(toWrap);
methods.forEach(function (method) {
// Get the original method
var oldMethod = toWrap[method];
// If it's not a function, we're done, skip it
if (typeof oldMethod !== 'function') { return; }
// Create our wrapped version!
toWrap[method] = function wrapped () {
var groupName = identifier + ': ' + method;
console[grouping](groupName);
console.log('%s args: %o', method, arguments);
try {
var value = oldMethod.apply(this, arguments);
console.log('%s return value: %o', method, value);
return value;
} catch (e) {
console.error('%s error: %o', method, e);
} finally {
console.log('%s: Exiting', method);
console.groupEnd(groupName);
}
};
});
};

GIT useful

Common Git Commands:-


//screw all the local commits and set to the origin branch

How do I reset my local branch to be just like the branch on the remote repository?

git fetch origin
git reset --hard origin/master

https://stackoverflow.com/questions/1628088/reset-local-repository-branch-to-be-just-like-remote-repository-head

 

git branch -vv | sls "\[.*: gone\]" | % { git branch -D ($_.Line.Trim() -split '\s+')[0] } 

Friday, January 10, 2025

food

 

1. Legumes (e.g., Lentils, Chickpeas, Black Beans)

  • Why Cheap: Available in bulk, both dried and canned, with a long shelf life.
  • Cost: Dried lentils and beans are some of the most cost-effective protein and fiber sources.
  • Usage: Make soups, curries, or add to salads.

2. Whole Grains (e.g., Oats, Brown Rice)

  • Why Cheap: Bulk oats and rice are inexpensive and versatile.
  • Cost: Per serving, they’re among the most affordable staples.
  • Usage: Breakfast porridge, side dishes, or in grain bowls.

3. Nuts and Seeds (e.g., Sunflower Seeds, Peanuts)

  • Why Cheap: Sunflower seeds and peanuts are budget-friendly compared to almonds or walnuts.
  • Cost: Choose unsalted, raw options in bulk.
  • Usage: Snacks, spreads, or toppings for dishes.

4. Leafy Greens (e.g., Spinach, Kale)

  • Why Cheap: Spinach is widely available and affordable, especially frozen.
  • Cost: Frozen spinach costs less and lasts longer.
  • Usage: Add to soups, stir-fries, or smoothies.

5. Berries (Frozen)

  • Why Cheap: Frozen berries are cheaper than fresh ones and retain their nutrients.
  • Cost: Affordable when bought in bulk.
  • Usage: Smoothies, oatmeal toppings, or snacks.

Daily Recommendation:

For a daily budget, focus on lentils/beans, oats, and frozen spinach, as they are the most affordable while providing excellent nutrition. You can occasionally add seeds or frozen berries for variety. 😊

Wednesday, January 8, 2025

Monday, January 6, 2025

ADO.NET

 https://learn.microsoft.com/en-us/dotnet/framework/data/adonet/local-transactions

Thursday, January 2, 2025

Azure Integration for On-Premises Deployments

 Date: January 2, 2025


Topic: Azure Integration for On-Premises Deployments

Key Learnings
:

1. Azure Arc with Managed Identity:

Simplifies secure integration of on-premises resources with Azure.

Removes the need for manual credential management.

2. Client ID + Secret Approach:

Requires periodic renewal, adding operational overhead.

Less efficient and secure compared to modern solutions like managed identities.

3. Deploying Azure Services On-Premises:

Using Windows Servers for Azure services is inefficient unless required by regulations.

Azure Arc offers better manageability and reduced complexity for hybrid environments.

4. Current Setup:

IIS-hosted web app uses Client ID + Secret to authenticate with Azure AD and call Microsoft Graph API.

5. Challenges with Client Secrets:

Periodic renewal increases management effort.

Secure storage is critical but challenging.

6. Managed Identity Exploration:

Automatically manages identities for Azure-hosted resources.

Not usable for IIS-hosted apps as it is designed for Azure-native environments.


Reflections:

Modern solutions like managed identities and Azure Arc simplify security management.

Certificate-based authentication may improve security and efficiency for the current IIS setup.

Regulatory constraints play a critical role in designing effective deployment strategies.

Wednesday, January 1, 2025

string c++

 1. find:

This function is used to locate the first occurrence of a substring (in this case, "WUB") within a string.

It helps you determine where to extract parts of the string.

size_t found = remix.find(separator);


2. substr:

Once you’ve found a substring (like "WUB"), substr is used to extract the part of the string between two "WUB" occurrences.

It takes two arguments: the starting position and the length of the substring.


std::string word = remix.substr(start, found - start);