Author: drweb

Making the Most of Your Docker Hardened Images Enterprise Trial – Part 2 In Part 1 of this series, we migrated a Node.js service to Docker Hardened Images (DHI) and measured impressive results. But how do you verify these claims independently? This post walks through the verification process: signature validation, provenance analysis, compliance evidence examination, and SBOM analysis.

Read More

from datetime import datetime # Get current date and time now = datetime.now() print(now) # 2026-01-25 14:30:45.123456 # Create a specific datetime object specific_date = datetime(2026, 1, 25, 14, 30, 45) print(specific_date) # 2026-01-25 14:30:45 Python’s datetime module handles date and time operations through five core classes. The datetime.datetime class represents a specific point in time with year, month, day, hour, minute, second, and microsecond precision. The date class stores calendar dates without time information. The time class holds time values independent of dates. The timedelta class measures durations between two points in time. The tzinfo class provides timezone information…

Read More

import pandas as pd df = pd.DataFrame({ ‘product’: [‘Laptop’, ‘Mouse’, ‘Laptop’, ‘Keyboard’, ‘Mouse’], ‘region’: [‘North’, ‘North’, ‘South’, ‘North’, ‘South’], ‘sales’: [1200, 150, 1400, 220, 180], ‘units’: [3, 15, 4, 8, 12] }) grouped = df.groupby(‘region’)[‘sales’].sum() print(grouped) # Output: # region # North 1570 # South 1580 # Name: sales, dtype: int64 The pandas groupby method implements the split-apply-combine pattern, a fundamental data analysis technique that divides your dataset into groups, applies functions to each group independently, and merges the results into a unified output. This approach mirrors SQL’s GROUP BY functionality but extends beyond simple aggregation to support complex transformations,…

Read More

import numpy as np # Create 5 evenly spaced values between 0 and 10 result = np.linspace(0, 10, 5) print(result) # Output: [ 0. 2.5 5. 7.5 10. ] The np.linspace function generates evenly spaced numbers across a defined interval. You specify where to start, where to stop, and how many values you want. NumPy calculates the spacing automatically. Basic syntax for np.linspace The function accepts several parameters that control array generation: numpy.linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None, axis=0) The start parameter defines your first value. The stop parameter sets your last value (or the boundary if endpoint is False).…

Read More

# Syntax result = condition1 and condition2 # Example age = 25 has_license = True can_drive = age >= 18 and has_license print(can_drive) # Output: True The AND operator in Python evaluates multiple conditions and returns True only when all conditions evaluate to True. This logical operator forms the backbone of conditional logic across Python programs, from simple validation checks to complex decision trees. How the AND operator works in Python The AND operator checks each condition from left to right. Python stops evaluating immediately when it encounters the first False condition, a behavior known as short-circuit evaluation. This makes…

Read More

# Syntax map(function, iterable1, iterable2, …) # Example: Square each number in a list numbers = [1, 2, 3, 4, 5] squared = map(lambda x: x**2, numbers) print(list(squared)) # [1, 4, 9, 16, 25] The python map function applies a transformation to every element in an iterable without writing explicit loops. You pass a function and one or more iterables, and map returns an iterator containing transformed values. Understanding how python map processes data The map() method takes two required arguments. The first argument accepts any callable function, including built-in functions, lambda expressions, or custom functions. The second argument accepts…

Read More