Search This Blog

Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts

Saturday, August 2, 2025

Demystifying the Finite Element Method: A Very Simple Truss Stiffness Matrix in Python



I dont recall how long ago i worked on FEM methods but found this basic program of stiffness matrix calculation in one of my older hard drive. So why go it to waste here is a brief blog on how FEM, a numerical technique can be approached. This technique breaks down a complex structure into smaller, simpler pieces called "finite elements." By analyzing these small elements and then reassembling them, we can understand the behavior of the entire structure.

One of the most fundamental concepts in FEM is the stiffness matrix. This matrix represents the relationship between the forces applied to a structure's nodes and the resulting displacement of those nodes. In a simple truss, which is a structure made of straight members connected at joints (like a bicycle frame), we can build a stiffness matrix to understand its behavior.

Let's take a look at a Python script that calculates the global stiffness matrix for a simple plane truss with three members.

Monday, July 7, 2025

Python Interview Prep - Part 1

The post holds my old notes and questions that have been asked during the era of python2.7. This is my interview prep guide.

Table of Contents

  1. What is python?

  2. What is the purpose of PYTHONSTARTUP environment variable?

  3. Is python a case sensitive language?

  4. What are 5 standard data types in python?

  5. What is PEP8?

  6. What is pickling and unpickling?

  7. How memory is managed in Python?

  8. What are the tools that help to find bugs or perform static analysis?

  9. How will you convert a string to an int in python?

  10. How will you convert a string to a float in python?

  11. How will you convert a object to a regular string representation in python?

  12. How will you convert a String to an object in python?

  13. How will you convert a string to a tuple in python?

  14. How will you convert a string to a list in python?

  15. How will you convert a string to a set in python?

  16. How will you create a dictionary using tuples in python?

  17. How will you convert a string to a frozen set in python?

  18. How will you convert an integer to a character in python?

  19. How will you convert an integer to an unicode character in python?

  20. How to convert ASCII to int and back?

  21. How will you convert an integer to hexadecimal string in python?

  22. How will you convert an integer to octal string in python?

  23. What is the purpose of ** operator?

  24. What is the purpose of // operator?

  25. Difference between is and == in python?

  26. Python Format Specifiers(python 2):

  27. Pick a random item from a list or tuple?

  28. Pick a random item from a range?

  29. How can you get a random number in python?

  30. How will you set the starting value in generating random numbers?

  31. How will you capitalizes first letter of string?

  32. How will you check in a string that all characters are alphanumeric?

  33. How will you check in a string that all characters are digits?

  34. How will you check in a string that all characters are in lowercase?

  35. How will you check in a string that all characters are in uppercase?

  36. How will you check in a string that all characters are numerics?

  37. How will you check in a string that all characters are whitespaces?

  38. How will you check in a string that it is properly titlecased?

  39. How will you replaces all occurrences of old substring in string with new string?

  40. How will you change case for all letters in string?

  41. How will you check in a string that all characters are decimal?

  42. What is the output of ['Hi!'] * 4?

  43. How will you get the max valued item of a list?

  44. How will you get the min valued item of a list?

  45. How will you get the index of an object in a list?

  46. How will you insert an object at given index in a list?

  47. How will you remove last object from a list?

  48. How your python code gets executed?

  49. Is .pyc created every time code is run?

  50. Different python complied extensions

Friday, April 25, 2025

How to Build a Biometric Authentication System in Python Using the Windows Biometric Framework


Biometric authentication is no longer limited to high-security labs or science fiction movies. With the rise of facial recognition and fingerprint scanning, developers now have the tools to implement biometric login systems in their own applications. In this tutorial, we’ll show you how to build a Python-based biometric authentication system using the Windows Biometric Framework (WBF).

Whether you’re building a secure desktop app, experimenting with IoT access control, or just curious about how biometric login works, this post walks you through every step—from loading the biometric API to identifying users by fingerprint or facial data.

Tuesday, May 3, 2022

Write a python program to search for a file in a provided directory

 So i had to for some reason develop a small utility to search a directory or drive for a particular filename. Decided to do the same in python to try and explore the os.walk() in python.

Here is how i did the same.