• Artificial Intelligence, Machine Learning, Python, Web Scraping: Feedbacks/Queries - e-contact

Programming for the World Wide Web

Table of Contents

Web Technology -|- PHP |-| Javascript [+] To-Do Application |*| MySQL |-| Mathematical Equations in HTML |=| PowerBI and Pivot Tables |+| Cursor AI {+} Video editing and streaming using OBS Studio [=] PHP vs. JavaScript [/] Web Scraping in Python |:| Job Description Templates |:| Flowchart to create User Interfaces for multiple Standalone Apps |:| Work-flow for International Travels |:| Checklist to Develop a Simple Web App |:| Software Architect |:| DevOps Engineer |:| Example User Stories for a Web App Development Projects

Write Mathematical Equations in HTML Pages

MathJax is JavaScript display engine for mathematics that works in all browsers. MathML is an XML-based language for describing mathematical notation. AsciiMath is an easy-to-write markup language for mathematics. LaTeX and TeX are another notation system for mathematical equations in HTML pages. Some example scripts for MathML is given below. xmlns="http://www.w3.org/1998/Math/MathML" needs to be added to <math> tag.
  • <mfrac><mn>1</mn>mn>2</mn></mfrac> = 12
  • <math><msqrt><mo>(</mo><mfrac><mn>A</mn><mn>B</mn></mfrac><mo>)</mo></msqrt></math> = (AB)
Σn=1+ 1n2 : The html code for above expression is
 <mrow>
  <munderover>
   <mo>&Sigma;</mo><mrow><mi>n</mi><mo>=</mo><mn>1</mn></mrow><mrow><mo>+</mo><mn>&infin;</mn>
  </mrow></munderover>
  <mfrac><mn>1</mn><msup><mi>n</mi><mn>2</mn></msup></mfrac>
 </mrow>

f(x) dx : The HTML code is
  <mrow>
    <munderover><mi>&int;</mi><mn>-&pi;</mn><mn>+&pi;</mn></munderover>
    <mrow>
      <mi>f</mi><mo>(</mo><mi>x</mi><mo>)</mo> <mi>d</mi><mi>x</mi>
    </mrow>
  </mrow>

Web Technology

Web Technology, Full Stack Developer

Front-EndBack-endFull Stack
Topic dealing with user interface, what the end user see and interact with Deals with methods required to create, maintain and provide data needed for Front End Deals with both Front End and the Back End technologies
Mainly programmed in HTML, CSS, JavaScript, PHPDeals with databases and server-side scripting: PHP, ASPX, SQL, JSON, Angular, ReactJS In addition to Front End and Back-end, the developers have to deal with servers (ports, networks, web-hosting), data security and database management. MongoDB, NodeJS, PHP, Python
Node.js is a free, open-source, cross-platform asynchronous event-driven JavaScript runtime environment that lets developers create servers, web apps, command line tools and scripts. It is not a programming language or a framework. Node.js uses an event-driven architecture that can handle multiple tasks simultaneously without waiting for one to finish before starting the next. In other words, Node.js as an event-driven architecture handles multiple tasks (like reading files or network requests) at the same time without waiting for one to finish before starting the next. This makes it very efficient for data-intensive tasks.

While JavaScript was originally designed to run only in browsers (the 'client-side'), Node.js allows it to run on servers, making it possible to build full-stack applications using a single programming language. It is built on V8 JavaScript engine of Google Chrome, which compiles code directly into fast machine code.

REST stands for REpresentational State Transfer. It is a type of API (Application Programming Interface) that allows communication between different systems over the internet by sending requests and receiving responses typically in JSON format, between the client and server.

Django is a Full-stack web development framework that facilitates the creation and maintenance of high-quality dynamic pages and makes it easier to automate repeated operations. Middleware in the back-end is a software layer—often called "glue code" — that sits between the front-end (user interface) and back-end logic (database/server). Key examples include authentication, logging, data validation, and caching.

Containerization is a form of operating system virtualization where an application and all its necessary files (libraries, configuration files, and dependencies) are bundled together into a single, isolated, and executable unit called a container. Docker is a popular open-source platform used to create, deploy, and manage these containerized applications. Thus, Docker acts as an operating system for containers.


Some roles in Software Development:

Back-End Developers create server-side logic, database management, and API integration, ensuring security and functionality using languages like PHP, Python, Java, or Node.js. Web Designers focus on the visual aspects, layout, and usability of the website, often handling graphic design and UI/UX elements.

Software architects are senior developers or programmers with degree in either of "computer science or information systems or software engineering" who formulate the high-level structure of a software, manages technical teams, and enforces coding standards for software development projects. Key responsibilities include selecting "technology stacks, appropriate frameworks, tools, and databases" to meet technical needs. Guide developers, conduct code and architecture reviews in order to ensure the final product meets established standards. Remain engaged in every step of the software development life cycle (SDLC) and performs regular code inspections to ensure the product meets quality standards within planned cost and schedule.

Similar roles include Solution architects, Enterprise architects, Data architects and Cloud architects. Front-End Developers create the user-facing, interactive, and visual elements of websites and applications using HTML, CSS, and JavaScript. They collaborate with designers and back-end engineers to ensure responsive, accessible, and high-performance interfaces utilizing modern frameworks like Bootstrap, React, Angular, or Vue. Write clean, maintainable, and well-documented code, integrate APIs and maintain web standards. Require to have basic graphic design skills such as Photoshop, Figma, or Sketch.

Job titles are based on overall relevant experience as well as size of the company: Junior Developer is designation for entry-level (0 ~ 3 years experience), Mid-Level Developer is used for practitioner level developers (2 ~ 5 years), Senior Developer (5 ~ 10 years) designation is given to those with high-level of expertise, mentoring, and architectural decisions - multitasking programmers who master many programming and scripting languages and familiar with Content Management Systems (CMS). Lead Developer / Architect (> 10 years) are responsible for the entire team or technical direction - convert the customer’s requirements into technical requirements.

AspectSoftware ArchitectFull-Stack DeveloperDevOps Engineer
Primary FocusSystem design and technical strategyBuilding application features end-to-endInfrastructure, automation, deployment, reliability
Main GoalCreate scalable, maintainable architectureDeliver functional software productsEnsure smooth CI/CD and operational stability
ScopeEnterprise/system-wideApplication/module-levelInfrastructure and deployment ecosystem
Works Closely WithBusiness leaders, engineering teams, product managersUI/UX, backend teams, QADevelopers, QA, cloud/platform teams
Key DeliverablesArchitecture diagrams, tech standards, solution designFrontend + backend codePipelines, cloud infrastructure, monitoring

Interview questions

  • When would you choose a monolithic architecture over micro-services, and vice versa?
  • How do you decide database for a system say between SQL, NoSQL, MongoDB?
  • How involved should a Software Architect be in code generation, debugging and change management?
  • How would you architect a system for wind farm analytics that ingests real-time turbine data and provides predictive insights?
  • How do you design systems to handle large-scale data processing?
  • What trade-offs are required to design a system optimized for average load and that of peak load?
  • How do you handle authentication and authorization in a web app?
  • Tell me about a bug you faced recently and how you resolved it.
  • What inputs are required to design the dashboard and layout of a scalable and cross-browser compliant website?
  • How do you decide which method to chose: functional programming or object-oriented?
  • Explain us the methodology of front-end, back-end, database, and deployment through a real project you were part of?
  • How would you scale a system from just few users to 10,000 users?
  • What are common security risks in web applications and how do you prevent them?
  • How do you ensure long-term code quality in a fast-moving team due to both the rotations in different projects and attrition?
  • What coding standards (guidelines) did you follow in past projects?
  • How would you design a Continuous Integration / Continuous Delivery (Deployment) or CI/CD pipeline for a full-stack app?
  • Which AI/ML based tools and platforms have you used for code generation and debugging?
Integrated development environments (IDE), such as GitHub or AWS CodeCommit, help developers create, maintain and track software packages. The most common open source CI/CD tool is Jenkins. DevSecOps practices include shift-left and shift-right testing. Shift-left testing involves integrating security testing and other critical development practices earlier in the software development lifecycle (SDLC). Shift-right security testing involves testing later in development, usually in production environments.

Few questions related to Full-stack developers.

  • What is the difference between GET and POST requests?
  • What are the advantages of using a framework like React, Angular, or Vue instead of using vanilla JavaScript?
  • What are the differences between client-side and server-side programming?
  • What is event bubbling and capturing in JavaScript?
Cross-browser compatibility: this is not a matter of testing task - it is a development discipline. Use web standard and not the browser specific features. Use feature detection and not browser detection. If workarounds are avoidable, isolate the browser specific fixes and comment clearly why the fix exists.

Flowchart-Full-Stack


Software Architect

Some of the questions to evaluate Software Architects on judgment, trade-offs, leadership, and real-world decision-making are listed below. The questions are intended to probe how they think under ambiguity and influence systems and people.

Monolithic architecture is a single, unified unit, making it ideal for small, simple applications with fast initial development. Microservices consist of small, independent services, offering high scalability, agility, and flexibility for complex, large-scale applications.

  • How do you approach designing of a system from vague or high-level programming?
  • How do you prevent over-engineering in architecture?
  • How do you design cloud-native systems?
  • How do you document and communicate architectural decisions?
  • How do you ensure architectural consistency across teams and projects?
  • How do you validate that an architecture actually works in production?
  • How do you evaluate build vs buy?
  • What are common vulnerabilities you encounter very often?
  • How do you ensure engineering teams follow architectural guidelines?
  • How do you communicate trade-offs to non-technical stakeholders?
Roles / Task performed by a Software Architect ↴

Flowchart-Sw-Architect

Sample Architecture Diagram for Deployment of a Web App on AWS ↴

Arch-Diagram-AWS


DevOps Engineer

Dev refers to the software development side: Writing code (features, bug fixes), Designing applications and APIs, Running unit tests, Building new releases. Ops refers to the IT operations and infrastructure side: Deploying applications to servers/cloud, Managing infrastructure (servers, containers, networks), Monitoring system health and uptime, Handling incidents and outages. DevOps is about bridging the gap between Dev and Ops so both work as one team instead of silos. Dev ≡ designing and building the car. Ops ≡ driving, maintaining, and fixing issues on the road.
  • What checks do you enforce before production deploys?
  • How do you design systems to be fault-tolerant?
  • How do you secure a CI/CD pipeline?
  • How do you manage multi-cluster deployments?
  • How do you enforce standards without slowing teams down?

DevOps-Flowchart


Testing Strategy

Testing Pyramid: Unit Tests (Catch logic bugs early) > Integration Tests (Ensure components work together) > End-to-End (E2E) Tests (Validate business-critical logics or flows). Regression tests (Prevent old bugs). Cross-Browser and Device Testing: BrowserStack, LambdaTest. Performance Testing (Ensure scalability under load): JMeter, Lighthouse. Responsibilities of Software Test Engineers:

Functional Testing

Understand business and technical requirements. Create test scenarios, test cases, and test data. Execute manual and automated test cases. Validate application functionality against requirements

Bug / Defect Management

Identify, log, track, and retest software defects. Work with development teams to resolve issues. Perform root cause analysis for recurring defects

Automation Testing

Develop and maintain automation scripts. Execute regression and smoke test suites. Improve test coverage using automation tools

Test Planning and Documentation

Prepare test plans and testing strategies. Document test results and quality metrics. Maintain QA documentation and reports.

Agile Development Hierarchy

It is typically structured as Initiatives > Epics > User Stories > Tasks. Functional Team Structure: Product Owner (Defines the product vision, manages the backlog, and prioritizes work) > Scrum Master (Facilitates processes, removes impediments, and ensures Agile practices are followed) > Development Team (Cross-functional members namely designers, engineers, testers who build the product).

Product Manager: decides what product to build and why (strategy). Product Owner: ensures it gets built correctly (execution). Analogy: Product Manager ≡ Architect (designs the building), Product Owner ≡ Site Manager (ensures it is built correctly).
Job Description Templates

Refer to this page for information to be put in a job description. The behavioural aspects of a candidate can be assessed though these questions. Use this page to create Job Description and save in CSV format. An spreadsheet template with appropriate drop-downs to create a summary of JD for hiring new members can be downloaded from here. It contains defined names for drop-downs in a separate sheet which can be updated / edited as per one's needs.

Click the tabs below to get sample job descriptions.

×
Job TitleSoftware ArchitectJob TypeFull-time
Cost CenterCC01Section NameSH01
Job CodeCC01_SH01_SAJob TypeFull-time
Work LocationPatnaNumber of Openings2
Minimum Experience (years)5.0Maximum Experience (years)8.0
Education QualificationB. Tech.Engineering DisciplineComputer Science
Description of roleMake high-level design choices, set technical standards, present technical concepts, and define the overall structure of software systems. Act as a bridge between business requirements and technical solutions by deciding on tools, platforms, and architecture to ensure expected performance
ResponsibilitiesCreate the outline for software defining components, interfaces, and their interactions. Selecting tech stacks, define coding standards, and address non-functional requirements like security and performance. Mentor developers and conduct code reviews to ensure the architectural decisions are implemented. Identify potential technical issues early and plan mitigations.
Technical Skills Required with % weight(a) Experience in React front end programming - 25%, (b) Knowledge of concurrent execution, distributed computing and parallel processing - 25%, (c) Cloud-Native Architecture - 25% and (d) Security best practices - 25%
Domain Skills Required with % weight(i) Software development lifecycle (SDLC) - 25%, (ii) Knowledge of UI/UX principles - 25%, (iii) Expertise in system design and cloud platforms with strong coding and problem-solving skills - 50%
Keywords and Tool NamesSoftware Architecture, Python, React.js, Node.js, Automation Scripting, REST API, CI/CD - Jenkins, Flask, SQL, AWS hosting, Kubernetes/Docker, JIRA, SCRUM
×
Job TitleFull Stack DeveloperJob TypeFull-time
Cost CenterCC01Section NameSH02
Job CodeCC01_SH02_FSJob TypeFull-time
Work LocationPatnaNumber of Openings3
Minimum Experience (years)6.0Maximum Experience (years)9.0
Education QualificationB. Tech.Engineering DisciplineComputer Science
Description of roleSoftware engineer proficient in both front-end (client-side) and back-end (server-side) development, managing the entire application lifecycle from user interface design to database management, APIs, and server configuration
ResponsibilitiesCreate user-friendly and responsive interfaces using HTML, CSS, and JavaScript frameworks. Write server-side logic, maintain application performance, and build robust APIs using languages like Node.js. Database Management: Designing, developing, and managing databases (SQL or NoSQL) to store and retrieve data efficiently. API Integration: Develop and integrate third-party services and APIs to enhance functionality. Collaborate with product managers, business analysts, and other stakeholders to gather requirements and translate them into technical specifications. erform unit testing, debugging, and troubleshooting to identify and resolve software defects and performance bottlenecks.
Technical Skills Required with % weight(a) Understanding of front-end frameworks, with a primary emphasis on React.js and knowledge of other libraries or frameworks such as Bootstrap, jQuery - 40%, (b) Familiarity with back-end frameworks and libraries, notably Node.js - 40%, (c) Experience deploying and managing applications using AWS Lambda and related server-less tools - 20%
Domain Skills Required with % weight(i) Software development lifecycle (SDLC) - 25%, (ii) Knowledge of UI/UX principles - 25%, (iii) Expertise in system design and cloud platforms with strong coding and problem-solving skills - 50%
Keywords and Tool NamesJavaScript (React.js, Node.js), Python, Java, PHP, HTML/CSS, MySQL, MongoDB, PostgreSQL, JIRA, SCRUM
×
Job TitleDevOps EngineerJob TypeFull-time
Cost CenterCC02Section NameSH03
Job CodeCC02_SH03_DOJob TypeFull-time
Work LocationNoidaNumber of Openings1
Minimum Experience (years)5.0Maximum Experience (years)8.0
Education QualificationB. Tech.Engineering DisciplineComputer Science
Description of roleDevOps Engineer acts as a bridge between software development and IT operations to automate, streamline, and optimize software delivery.
ResponsibilitiesCreate the outline for software defining components, interfaces, and their interactions. Selecting tech stacks, define coding standards, and address non-functional requirements like security and performance. Mentor developers and conduct code reviews to ensure the architectural decisions are implemented. Identify potential technical issues early and plan mitigations.
Technical Skills Required with % weight(a) Experience with cloud platforms (AWS) - 25%, (b) CI/CD tools (Jenkins, GitHub Actions) - 25%, (c) Containerization (Docker, Kubernetes) - 25% and (d) Security best practices - 25%
Domain Skills Required with % weight(i) Software development lifecycle (SDLC) - 25%, (ii) Understanding of basic networking concepts - 25%, (iii) Familiarity with monitoring and logging tools - 25%, (iv) Web and Internet Technologies - 10%, (v) Experience with installing, configuring, and maintaining local services (daemons) - 15%
Keywords and Tool NamesPython, Automation Scripting, CI/CD - Jenkins, Flask, SQL, AWS hosting, Kubernetes/Docker, Linux/Bash, PowerShell, JIRA, SCRUM
×
Job TitleData ScientistJob TypeFull-time
Cost CenterCC03Section NameSH05
Job CodeCC03_SH05_DSJob TypeFull-time
Work LocationGurgaonNumber of Openings2
Minimum Experience (years)5.0Maximum Experience (years)8.0
Education QualificationM. Sc.Engineering DisciplineApplied Maths
Description of roleAnalyse complex, structured, and unstructured data to extract actionable insights, building predictive models and machine learning algorithms to solve business problems.
ResponsibilitiesCollecting, cleaning, and preprocessing large datasets to ensure data quality, uniformity, and reliability. Translating data insights into actionable strategies for stakeholders. Utilizing programming languages (Python, R, SQL) and data frameworks (Hadoop, Spark) to analyse, visualize, and report data.
Technical Skills Required with % weight(a) Experience in R/Python programming - 25%, (b) Data science - 25%, (c) Data mining - 25% and (d) Machine Learning - 25%
Domain Skills Required with % weight(i) Machine learning frameworks - 50%, (ii) Data mining, predictive modeling, and algorithm development - 25%, (iii) Hands on experience in data visualization tools such as Power BI - 25%
Keywords and Tool NamesPowerBI, Python, Scikit-Learn, Numpy/Pandas, SQL, AWS hosting, JIRA, SCRUM

Data Engineering is the discipline of designing, building, and maintaining systems that collect, process, and move data. Users are called Data Engineers. Data Warehousing is about storing structured data in a way that enables fast querying, reporting, and analytics. Users are called (Data) Analysts and BI (Business Intelligence) teams.


WAMP stands for Windows, Apache, MySQL, and anyone of PHP, Perl, or Python. LAMP is equivalent set for Linux. WAMP server is a local web server for running the scripting language (PHP, Perl) and this is open source. XAMPP stands for Cross-Platform (X), Apache (A), Maria DB (M), PHP (P), and Perl (P). It is developed by Apache Friends. It includes Apache and MySQL, FileZilla, Mercury, Tomcat, and Maria DB.

  • Put files into the destination folder. Default folder is c:/xampp/htdocs, /var/www/html in Linux.
  • Type address "http://localhost" in web browser: Opens XAMPP dashboard
  • localhost/folderName/index.php: opens personalized page on localhost
  • Excertps from Apache2 Ubuntu Default Page: "By default, Ubuntu does not allow access through the web browser to any file apart of those located in /var/www, public_html directories (when enabled) and /usr/share (for web applications). If your site is using a web document root located elsewhere (such as in /srv) you may need to whitelist your document root directory in /etc/apache2/apache2.conf."

Javascript is loosely typed. A variable can contain all data types and a variable can change its data type. Strings created with single or double quotes work the same. Use quotes inside a string, as long as they don't match the quotes surrounding the string. Hoisting is JavaScript's default behavior of moving declarations to the top. In JavaScript, a variable can be declared after it has been used. JavaScript modules allows to break up code into separate file which makes it easier to maintain a code-base. Like Python, with the 'import' statement. 'modules' are imported from external files with the 'import' statement.

document.addEventListener("click", func_name);
function func_name() {
  document.getElementById("demo") .innerHTML = "Demo";
}
document. addEventListener("click", function(){
  document.getElementById("demo") .innerHTML = "Demo";
}

Select a column from a table on the webpage: No direct method exist though some add-on to web-browsers do exist. Select that table and paste in a text file or a spreadsheet. Use Python with CSV or Pandas modules. Paste the data in MS-Word which allows selecting particular column with mouse drag. For creating a table where columns can be selected, create a nested table. Outer table with only one 'tr' and 'td' tags. Each column as inner 'table' with single 'td' and desired number of 'tr' tags.

The Window object is the top level object in the JavaScript hierarchy and represents a browser window. It is created automatically with every instance of a 'body' or 'frameset' tag.

DOM ObjectEvent Handlers Available
Checkbox, Radio / Reset / Submit buttononClick
Button elementonClick, onMouseOver
Hypertext link, Clickable ImageMaponClick, onMouseOver, onMouseOut
DocumentonLoad, onUnload, onError
FormonSubmit, onReset
FramesetsonBlur, onFocus
Selection listonBlur, onFocus, onChange
ImageonLoad, onError, onAbort
Text and TextArea elementonBlur, onChange, onFocus, onSelect
WindowonLoad, onUnload, onBlur, onFocus

JavaScript Objects

PropertyDescription
closedReturns whether or not a window has been closed
defaultStatusSets or returns the default text in the statusbar of the window
documentReturns the entire HTML document
historya JavaScript object, not an HTML DOM object, part of the Window object and is accessed through the window.history property
lengthSets or returns the number of frames in the window
locationSee Location object
nameSets or returns the name of the window
openerReturns a reference to the window that created the window
outerHeightSets or returns the outer height of a window
outerWidthSets or returns the outer width of a window
pageXOffsetSets or returns the X position of the current page in relation to upper left corner of a window's display area
pageYOffsetSets or returns the Y position of the current page in relation to upper left corner of a window's display area
parentReturns the parent window
personalb Sets whether or not the browser's personal bar (or directories bar) should be visible
scrollbarsSets whether or not the scrollbars should be visible
selfReturns a reference to the current window
statusSets the text in the status bar of a window
statusbarSets whether or not the browser's status bar should be visible
toolbarSets whether or not the browser's tool bar is visible or not
topReturns the topmost ancestor window

JSON: Javascript Object Notation

A JSON array is equivalent to list in Python and a JSON object is similar to dictionary in Python. Python has standard JSON module where it is parsed using json.loads() method resulting in Python dictionary. A Python dictionary object can be converted into a JSON string using the json.dump() method.

PHP is white space insensitive, case-sensitive, statements are terminated by semicolons, variables start with $, constants created by define() function e.g. define("pi", 3.1416), {...} create blocks - a sequence of multiple statements (concatenation of statements). Unlike with variables, constant does not need to start with a $. Logical operators uses both ('and' &&), ('or' '||'). Loop uses parentheses for logical argument: if () ... elseif () ... else ... Single-line comments: # or //. */ .... /* is used for multiline comments. PHP Magic constants: __LINE__, __FILE__, __FUNCTION__, __CLASS__, __METHOD__, $_POST (is a PHP super global variable which is used to collect form data after submitting an HTML form with method = "post").

The double arrow operator '=>' is used as an access mechanism for arrays. => is used in associative array key/value pairs for assignment that is => is used to assign values to the keys of an array. PHP is a server side language: nothing inside the "<?php ... ?>;" blocks will ever be visible in the browser. User names and passwords are required to connect to various databases. They are secure so long they remain inside PHP tags. include_once( "../../sub-folder-x/connect_mysqli.php"); can be used to avoid keeping connect_mysqli.php file into sub-folders along with index.php file.

PHP-enabled web pages are treated just like regular HTML pages and they can be created / edited the same way as normally done for regular HTML pages. Codes can jump in and out of PHP mode even in the middle of a PHP block while the logical flow of the script remains intact. This is similar to how image and equations can be put inline with text in a MS-Word file or how PERL scripts are used in CCL (CFX Command Language). PHP code can be embedded in the middle of an HTML opening tag. Instead of using PHP echo statement, one can jump out of PHP mode and just sent straight HTML. The PHP parser doesn't care that it is in the middle of an opening tag, and doesn't require that it (HTML tag) be closed. It also allows the cases where the closing ?> tag is at the end of the HTML opening tag, just before > of HTML tag.

<?php if ($expression == true): ?>
  Show if the expression is true.
<?php else: ?>
  Otherwise show this.
<?php endif; ?>
Similarly, following code shall print "Hello, there!" 4 times.
<?php for ($i = 0; $i < 5; ++$i): ?>
  Hello, there!
<?php endfor; ?>
Tag "<?=" is shorthand for "<? php echo". The super global variable $_SERVER["PHP_SELF"] returns the filename of the currently executing script. The htmlspecialchars() function converts special characters like < and > to '&lt;' and '&gt;' which prevents Cross-Site Scripting attacks. Use stripslashes() and preg_match('/^[a-zA-Z0-9]+$/', $username) functions for additional sanitization of user inputs. Regular expression '/^[a-zA-Z0-9_.]+$/' can be used to allow underscore and dot. $_SERVER["PHP_SELF"] exploits can be avoided by using the htmlspecialchars() function. if ($_SERVER["REQUEST_METHOD"] == "POST") { .. } checks the method used to submit a form. Prepared Statements and Bound Parameters are useful against SQL injections.

Error Reporting and Debugging: Quite often while running a PHP script, one gets a blank screen, no error message but just the empty screen. The reason might be syntax error, failed function call, or something else. One need to turn on the error display options. Use "sudo find /etc -name php.ini -type f" to find the location of php.ini file (something like /etc/php/7.4/apache2/php.ini) and set "display_errors = On" in the file. The location (path) of php.ini file can also be looked into the output generated through phpinfo(); function. php.ini: update line "mysqli.default_user =" to mysqli.default_user = "root". Some programs may access fields such as $username = ini_get("mysql.default_user"); $passwd = ini_get("mysql.default_password");

Depending on which files user developer has access to, it may be needed to configure display_errors in .htaccess or PHP.ini file. Many hosting providers do not allow modification to PHP.ini file. In production version of codes, error messages must not be shown to the end users, yet information must be recorded for tracing purposes. The common way to record error messages in production environment is to store it in log files.

When working with PHP and AJAX calls, errors is difficult to track as they do not get displayed in the browser rather they are returned to the AJAX request.

The @ symbol, when placed before an expression, acts as an error control operator. When used with 'include' or 'require' statements, it suppresses error messages that would get generated if the included file cannot be found or if there is an issue during its inclusion.

"Notice: Undefined index" occurs when attempting to access an array key that does not exist within the array. This is a common warning, not a fatal error, but it indicates a potential issue in the code where an expected array key is missing. Use error_reporting(E_ALL & ~E_NOTICE); to suppress the warning (notice) messages.

debug_backtrace() generates a PHP backtrace, Returns an array of associative arrays. When an error occurs, debug_backtrace() can identify the exact function or method call that triggered it. debug_print_backtrace() prints a PHP backtrace. It prints the function calls, included/required files and eval()ed stuff. No value is returned.

User Defined Functions in PHP:

A function is defined using the function keyword, a name, a list of parameters (which might be empty) separated by commas (,) enclosed in parentheses, followed by the body of the function enclosed in curly braces. Functions need not be defined before they are referenced, except when a function is conditionally defined. By default, function arguments are passed by value (so that if the value of the argument within the function is changed, it does not get changed outside of the function).
<?php
  $x = 5.0;
  echo nl2br("$x \n");           // Output: 5
  function sqr($x) {
    $x = $x * $x;
    return $x;
  }
  
  echo nl2br("$x \n");          //  Output: 5
  echo nl2br(sqr($x) \n");      //  Output: 25
?>
To have an argument to a function passed by reference, prepend an ampersand (&) to the parameter name in the function definition.

JavaScript

  • Global Functions: eval(), isNaN(), parseInt(), parseFloat()
  • String Methods: length, toUpperCase(), toLowerCase(), substring(), indexOf(), replace()
  • Array Methods: length, push(), pop(), shift(), unshift(), splice(), slice(), forEach(), map(), filter(), reduce()
  • Number Methods: toFixed(), toPrecision()
  • Date and Time: Date() object and its methods
  • Math Object: Math.abs(), Math.round(), Math.random(), Math.floor(), Math.ceil()
  • Asynchronous Operations: setTimeout(), setInterval()

PHP vs. JavaScript

FeaturePHPJavaScript
String Manipulationstrlen(), str_replace(), explode(), implode()length, replace(), split(), join()
Array Handlingarray_push(), array_pop(), array_keys(), array_values()push(), pop(), keys(), values()
Type Conversion(int), (float), (string), intval(), floatval()parseInt(), parseFloat(), String(), Number()
Input/Outputecho, print(), file_get_contents(), file_put_contents()console.log(), alert(), fetch() (for network I/O)
Date & Timedate(), strtotime(), time()Date object methods: getFullYear(), getMonth(), getTime()
CategoryPHPJavaScriptExample Code Snippet
Outputecho, printconsole.log()PHP: echo "Hello"; JS: console.log("Hello");
String Lengthstrlen().length propertyPHP: strlen("Hello") JS: "Hello".length
Substringsubstr()substring() / slice()PHP: substr("Hello", 1, 3) JS: "Hello".slice(1, 4)
String Replacestr_replace()replace()PHP: str_replace("a", "b", "cat") JS: "cat".replace("a", "b")
Find in Stringstrpos()indexOf()PHP: strpos("Hello", "e") JS: "Hello".indexOf("e")
Array Lengthcount().length propertyPHP: count([1, 2, 3]) JS: [1, 2, 3].length
Array Mergearray_merge()concat()PHP: array_merge([1], [2]) JS: [1].concat([2])
Check if in Arrayin_array()includes()PHP: in_array(2, [1, 2, 3]) JS: [1, 2, 3].includes(2)
Loop - For Eachforeach loopforEach() methodPHP: foreach($arr as $val){} JS: [1,2,3].forEach(v => {})
JSON Encodejson_encode()JSON.stringify()PHP: json_encode(["a" => 1]) JS: JSON.stringify({a: 1})
JSON Decodejson_decode()JSON.parse()PHP: json_decode('{"a":1}') JS: JSON.parse('{"a":1}')
Date/Time Nowdate("Y-m-d H:i:s")new Date()PHP: date("Y-m-d H:i:s") JS: new Date().toISOString()
Math Roundround()Math.round()PHP: round(2.5) JS: Math.round(2.5)
Random Numberrand(min, max)Math.random() + scalingPHP: rand(1, 10) JS: Math.floor(Math.random()*10+1)
Type Checkis_array(), is_string(), etc.typeof, Array.isArray()PHP: is_array($x) JS: Array.isArray(x)
File Readfile_get_contents()fetch() / FileReader API (async)PHP: file_get_contents("file.txt") JS: fetch('file.txt')
Variable Dumpvar_dump(), print_r()console.log()PHP: var_dump($x) JS: console.log(x)
Set TimeoutNot built-in; use sleep()setTimeout()PHP: sleep(2) JS: setTimeout(() => {}, 2000)
Define Constantdefine()const keywordPHP: define("PI", 3.14) JS: const PI = 3.14
Function Declarefunction myFunc() {}function myFunc() {} or arrow functionPHP: function greet() {} JS: const greet = () => {}

Both MySQLi (the "i" stands for improved) and PDO (PHP Data objects) have their advantages: PDO will work on many (almost all) different database systems, whereas MySQLi will only work with MySQL databases. So, switching project to use another database is easier with PDO. One only have to change the connection string and a few queries. With MySQLi, the entire code will need to be rewritten - queries included. Both are object-oriented, but MySQLi also offers a procedural API. PDO has an exception class to handle any problems that may occur in database queries.

MySQLi Object-Oriented:               |  MySQLi Procedural
-------------------------------------------------------------------------------
<?php
$srv = "localhost";                   |  <- same
$usr = "username";                    |  <- same
$pwd = "password";                    |  <- same
// Create connection
$con = new mysqli($srv, $usr, $pwd);  |  $con=mysqli_connect($srv, $usr, $pwd);
// Check connection
if ($con->connect_error) {            |  if (!$con) {
  die("Fail: ".$con->connect_error);  |   die("Fail: ".mysqli_connect_error());
}                                     |  }
$con->close();                        |  mysqli_close($con);
?>
Strings (text can contain HTML markup) are surrounded by (single or double) quotes, but with double quotes variables can be inserted to the string directly and using single quotes variables have to be inserted using the '.' dot operator. For example:
$str1 = "AI ML";
$str2 = "cfdyna.com"; 
echo '<p>Sample codes in ' . $str1 . 'at' . $str2.'<p>';
or
echo "<p>Sample codes in $str1 at $str2.<p>";
Variables can be defined in a file say named as 'common_vars.ph'. Then, this file can be included in any other file and variables defined can be used in the calling file within <?php ... > tags. For example, creation of a form can be parametrized as <input type="text" name="<?php echo $tag_username;?>" value="<?php echo $value_username;?>">

strval(string): Get the string value of a variable - this is useful function to convert arguments of a function into string before adding the information into database. Thus, $sql = "SELECT * FROM tasks WHERE username = '".$username."'"; can be simplified to combination of following two statements: $username = strval($username); and $sql = "SELECT * FROM tasks WHERE username = '$username'";

Handling Passwords: password_verify — Verifies that a password matches a hash e.g. $does_pw_match = password_verify( $user_pass, $stored_pass ); $stored_pass = password_hash( $user_pass, PASSWORD_DEFAULT ); where password_hash( ) creates a new password hash using a strong one-way hashing algorithm PASSWORD_DEFAULT.


MySQL: COMMENTS are from a '-- ' to the end of the line. The double dash-comment style requires at least white space or control character (space, tab, newline...) after the second dash. From a '#' to the end of the line, C-style comment /* ... */ can span multiple lines. You use this comment style to document a block of SQL code. MySQL does not support nested comments. Log-in to MySQL: mysql -u root -p and then enter the password, type 'quit' on mysql prompt to close the session.

  • Convention: any entry containing an underscore is user input
  • String and date values in MySQL used with either single or double quotes, but single quotes are more standard. INT signifies that the column holds integers (numeric values with no fractional part). UNSIGNED disallows negative values. NOT NULL requires that the column value must be filled in. This prevents members from being created without an ID number. AUTO_INCREMENT is a special attribute in MySQL. It indicates that the column holds sequence numbers. The PRIMARY KEY clause indicates that the the column is indexed to allow fast lookups. It also sets up the constraint that each value in that column must be unique. An ENUM (enumeration) column which means it can take only one of the values listed in the column specification. Storage engine clause, if present, names the storage engine that MySQL should use for creating the table.
  • MySQL expects dates to be written in 'CCYY-MM-DD' format
  • Check mysql version: SHOW VARIABLES LIKE "%version%";
  • Get installation directory: which mysql on Linux prompt. To clear screen: system clear; \! is used to execute system shell commands and hence \!clear; works too. \! pwd; can be used to get working directory.
  • Create a database named db_name: create database if not exists db_name;
  • Check what the default database is: select database(); To add a database to current project: use db_name; The keyword 'none' shall appear in the command prompt (MariaDB [(none)]>) if no database is selected.
  • Create database named db_name with commands input from SourceFile.sql: mysql db_name < SourceFile.sql
  • Login and activate database named 'db_name': mysql -h host_name -p -u user_name db_name
  • List all the database names being managed by MySQL server to which the current user is logged in: show databases;
  • Get list of users: SELECT user FROM mysql.users;
  • Create a new user: CREATE USER user_name IDENTIFIED BY PASSWORD user_passwd; Note that the user_name should be enclosed in quotes. User name should be specified at user_name@host_name such as 'abc'@'localhost'.
  • Show privileges granted to a user: SHOW GRANTS FOR 'user_name'@'host_name';
  • flush privileges; Required to inform MySQL to reload the privilege after the change is made.
  • Add specified privileges to a user: grant select, insert, update, delete on *.* to ‘user_name’@’host_name’;
  • Add a user name on a host: INSERT INTO table_name (Host, User, Password) values('host_name', 'user_name', PASSWORD('user_passwd’));
  • Change password for a user: SET PASSWORD FOR 'user_name'@'localhost' = PASSWORD('new_password'); FLUSH PRIVILEGES; For newer versions: ALTER USER 'user_name' IDENTIFIED BY 'new_password';
  • Remove a user: drop user 'user_name'; Note that the user name must be in single quotes. delete from user where user='user_name’ and host='host_name';
  • Create table named tab_name with column headers identified by column_designation: CREATE TABLE tab_name (column_designation);
  • List all tables in currently active database: SHOW tables;
  • Display information only for columns that match a given pattern %name where ‘%’ is a wildcard character: show columns from tab_name like ‘%name’;
  • Show whole content of a table: SELECT * FROM tab_name;
  • Add records into a table, for all the columns: INSERT INTO tab_name VALUES (value1, value2 ...);
  • Start the auto_increment other than 1, 37001 in this example: ALTER TABLE tab_name auto_increment = 37001;
  • load data infile 'c:\MySQL\tab_input.csv' replace into table tab_name fields terminated by ',' lines terminated by '\n' field_names;
  • Check structure of a table: DESCRIBE tab_name; or SHOW COLUMNS FROM tab_name; or show fields from tab_name
  • Insert several rows into a table with a single INSERT statement by specifying multiple value lists: INSERT INTO tab_name VALUES (...), (...); Parentheses enclose the set of column values for each row. INSERT INTO tab_name (col_name1, col_name2, ...) VALUES (value1, value2, ...);
  • Execute text file containing SQL queries: source queries_list.sql;
  • Load data from a CSV file into a table: load data infile input_data.csv replace into table tab_name fields terminated by ',' lines terminated by '\n' Field_1, Field_2, Field_3 ignore 1 lines; Note that in the example, only 3 fields are being updated. Ignore option is used to ignore few lines such as header of the input file.
  • load data local infile 'input_data.txt' into table tab_name; It assumes that input_data.txt is located in the current directory on the client host. By default, the LOAD DATA statement assumes that column values are separated by tabs and that lines end with newlines. It also assumes that the values are present in the order that columns are stored in the table.
  • Change attributes of field 'id' in a table: ALTER TABLE tab_name CHANGE `id` `id` SMALLINT( 5 ) UNSIGNED NOT NULL AUTO_INCREMENT;
  • Update a new record into the table emp_info: UPDATE INTO emp_info (first_name, last_name) value(‘ABC’, ‘LMN’);
  • Update additional records to the entry updated in previous step: update emp_info set PAN = ‘ABCAB3461N’ where last_name=’LMN’ and first_name=’ABC’;
  • Add column after (to the right of) an existing column: ALTER TABLE tab_name ADD COLUMN col_name VARCHAR(32) AFTER existing_column;
  • Change a column name: alter table tab_name change old_col_name new_col_name varchar (32);
  • Make a unique column to avoid duplicity: alter table tab_name add unique col_name;
  • Delete unique column from table: alter table tab_name drop index col_name;
  • Wipe out data completely from a table: delete from tab_name;
  • Rename a table: rename old_tab_name to new_tab_name;
  • Delete a table completely: drop table tab_name;
  • delete from tab_name where "Query String"; Deletes specific records matching query string. For example, delete from tab_emp_info where first_name=’ABC’ and last_name = ‘LMN’;
  • Delete a database: drop db_name;

Option-1: read files which contains SQL queries

Import SQL Queries

Option-2: Copy-paste SQL queries

Copy Paste SQL Queries


Commons Errors:

Failed to connect to MySQL: Access denied for user 'root'@'localhost' (using password: YES), Failed to connect to MySQL: Unknown database 'web_admin_db'

Catching error in SQL Queries:

$sql_cmd = "INSERT INTO tbl_members(`username`, `email`, `password`) VALUES(?,?,?)";
$stmt = $conn -> prepare($sql_cmd);
if ($stmt === False) {
  die('Error preparing SQL statement: ' . $conn->connect_error);
}

Steps to create a responsive page with LAMP: assuming LAMP is successfully configured. Default path for local server in Ubuntu: /var/www/htm. The URL to phpMyAdmin on local machine is "localhost/phpmyadmin". Check if /etc/phpmyadmin file is available. "sudo service apache2 restart" will result in error if server not installed. Use sudo apt-get install phpmyadmin to install from command line.

Installing phpMyAdmin may give error message "Connect failed: Access denied for user 'root'@'localhost' (using password: NO)" and shall ask to chose one of the 4 options. Chose 'ignore' to continue installation (use 'tab' key to select <ok>). Now loading "localhost/phpmyadmin" shall result in page looking like this:

phpmyadmin login

Optionally, GRANT ALL PRIVILEGES ON data_base.* TO 'buddhu'@'localhost'; to use this account for testing PHP codes. Use "CREATE USER 'buddhu'@'localhost' IDENTIFIED BY 'passwd'; (specify appropriate password as 'passwd') to create a new user named 'buddhu'.

Likely errors: mysqli_real_connect(): (HY000/1045): Access denied for user 'phpmyadmin'@'localhost' (using password: YES). Solution: get password from /etc/phpmyadmin/config-db.php >> run SQL Query: CREATE USER 'phpmyadmin'@'localhost' IDENTIFIED BY 'passwd'; >> Run another query: "flush privileges;" to apply the changes. Another error: 'The phpMyAdmin configuration storage is not completely configured, some extended features have been deactivated. Find out why. Or alternately go to 'Operations' tab of any database to set it up there." Get file "resources/sql/create_tables.sql" from github repository of phpmyadmin and run the SQL query from this file. Alternatively, under phpMyAdmin dashboard: go to "User Accounts", select 'phpmyadmin' under "User name" and then "Edit privileges".

phpMyAdmin privileges

Files to configure MySQL

  1. /etc/mysql/mariadb.cnf: to set global defaults
  2. /etc/mysql/conf.d/*.cnf: to set global options
  3. /etc/mysql/mariadb.conf.d/*.cnf: to set MariaDB-only options
  4. ~/.my.cnf: to set user-specific options.

Now actual database and PHP stuff:

Step-1:

Define the folder structure named as jas (JavaScript), css, dab (database), adm (administrative stuff), img (images only), vid (videos only), ico (icons only), doc (PDF, DOC and other files), sql, api, lib, tpa (third party)... and create a Readme.txt file to describe what these folders contain and/or are expected to contain. Following is an example for user registration:

web folder structure

Step-2:

Log-in to mysql terminal and create database(s) and table(s) using command and method described above. A database db_user_reg was created from command prompt. A text file contain SQL commands can be used to create table(s). Alternatively, phpMyAdmin dashboard can also be used to create and view the table.

User Table

Ensure that password field is long enough to store hashed version of the passwords (no error shall get reported and the user details shall not get added otherwise). It is safer to use field width 255 for password column.

Step-3:

Create login and user registration form using standard HTML and CSS features. A good starting point is "github.com/keerti1924/PHP-MYSQL-User-Login-System" which seems to work without any modifications. A modified version can be downloaded from here. Minor updates such as trimming user inputs, ensuring alpha-numeric user names and e-mail addresses, password length between 8 to 16 characters with at least 1 special character, prepare() and bind_param() used for database updates. A simple forgot password page has been added. There is no check if user has entered a real e-mail address or not, click on 'eye' icon shows password only for one input field.

Login page

User registration

Step-4:

Create the landing page after successful login or new user registration.

Security issues: 'Form' resubmission using refresh (F5) or "Go back one page" logs-in user and/or repeats last operation such as adding same information into the database again.

page refresh

Caching directives: PHP scripts often generate dynamic content that must not be cached by the client browser or any proxy caches between the server and the client browser. Many proxies and clients can be forced to disable caching with following code. This will sort of disable back button.
<?php
  header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
  header("Expires: Sat, 01 Jan 2020 05:00:00 GMT");   // Date in the past
?>

Some guidelines: create separate SQL command files for create and alter operations. Do not put JavaScript code inside the body - store these scripts in separate files. Follow a convention for naming: tab_ or tbl_ and db_ for table names and database names, for example db_user_reg. Add version and last update at the beginning of each file.

To-Do Application: Another example is taken from github.com/dhiraj-01/Todo-PHP to create a "ToDo List". Some modifications have been done to disable caching and prevent form resubmission on page refresh. This is a very simple set of codes for learning and demonstration. The updated version can be downloaded from here.

The folder structure of modified version is as shown below.

toDo PHP MySQL

This simple module has three main pages: signup.php, login.php and todo.php. The plain HTML file default.html is to add contents at the top of each page.
signup.php
|
*-- includes default.html and lib/database.php
*-- checks if user is logged-in and sets location to todo.php
*-- prints (echo) error message above the form section
*-- generates sign-up form and calls lib/adduser.php after Submit
|   |
|   *--- calls createCAPTCH() function to generate CAPTCHA
|   |
|   *--- adduser.php
|        |
|        *-- includes database.php (collection of all functions)
|        *-- collects inputs: username, password, secret key and CAPTCHA
|        *-- call createUser() function
|            |
|            *-- validates username, password and secret key
|                |
|                * alpha-numeric usernames
|                * password with special character, length between 6 to 10
|                * secret key: up to 6 numeric characters
|            *--- if criteria met, adds user
|            *--- if not, directs to signup.php which prints error message
login.php
|
*-- form submission directs to lib/valid_inputs.php
*-- function haveValidInputs() defined in database.php is used to check inputs
*-- checks if specified user name exist
`-- checks specified password with stored password using password_verify()
|
todo.php
|
*-- called after successful login
|   |
|   *-- option to change password with secret key used during sign-up
|   *-- generates single line form to get to-do text
|   *-- retrieves existing to-do string using getTodoItems() function
|   *-- adds new to-do string using addTodoItem() function
|
`*--lib/forgot_password.php
    |
    *-- form submission directs to lib/resetPassword.php
    `*- resetPassword() function from database.php is used to update password
        |
        *-- checks for valid username, secret key and new password
        *-- re-directs to signup.php is invalid inputs are provided.
Further improvement can be to add counter for 3 wrong attempts to log-in, send OTP to specified e-mail to reset password or secret pin, retain valid inputs when page is refreshed for invalid inputs, better background... As one can deduct, the code structure gets complicated even with simplest possible web page having server-side scripts.

Refer the example of Responsive Blog here from 'code-projects.org' which contains 140 different .php files (folder tree contains 41 directories, 266 files). A complete description of code structure with the inter-dependence of files and folders cannot be covered in few pages of a note book. The readme.txt file in this zip folder explains basic steps to make the repository working. The attached ZIP file is working on Ubuntu LTS 20.04, PHP version 7.4, Apache/2.4.41 (Ubuntu), phpMyAdmin 4.9.5deb2 and server version 10.3.39-MariaDB. Readme.txt file has been updated based on experience gained to make the code working.


Server Administration, Data Security and Hacking: Social Media Hunting, Data Theft, Tracking Personal Information

There are 52 characters (including lower and upper cases), 10 digits and 32 special characters on computer keyboard. If one does not allow to have password starting with special character and minimum size of password is set to be 8 characters, just for passwords having 8 characters, 62 x 947 = 4020 trillion combinations are possible. Note that passwords can be any size higher than 8 characters but usually it would limited to 12 ~ 16 characters as users need to remember them.

Most Basic Web Security Tips: [1] Prevent access of folder through browser such as https://www.abc.com/pqr/ - Use .htaccess file, [2] whois: This prints personal details of the website owner if privacy protection is not enabled or purchased from domain name provider, [3] wget or libwww: this Linux command can download entire content of a website: Change HTTP User Agent - RewriteCond %{HTTP_USER_AGENT} wget.* [NC], [4] Prevent access to crawlers: use Robot.txt file, [5] Prevent an htaccess file from being viewed: add following line:

<Files .htaccess>
  order allow,deny
  deny from all
</Files>

Browser Automation and Server Side Scripting:

Selenium, Pupeteer, Playwright, Headless browsers. Server side scripting: jQuery (JavaScript Framework), PHP, Ruby, Django (server side framework, free, open source and written in Python), Node.js (free, open source tool to run JavaScript outside the web browser), AngularJS (to extend HTML with new attributes). MongoDB is a document database which stores data in a type of JSON format called BSON.

jQuery

'$' is alias for 'jQuery' and '$()' is shorthand for "$(document).ready()". Code included inside $(window).load(function() { ... }) will run once the entire page (images and iframes), not when just the DOM is ready.

PowerBI and Pivot Tables

Excerpt from Microsoft website about PowerBI: Find insights in your data and share rich analytics reports. Explore your reports to find and generate the quick insights you need for better business decisions. Collaborate on reports with colleagues, then easily share reports and insights in workspaces, on the web, in apps, via Microsoft Teams.

How to Create a Pivot Table

Pivot Table


Cursor AI

Tag line on official website: "The AI Code Editor". More from website: "Cursor lets you write code using instructions. Update entire classes or functions with a simple prompt. Cursor's agent mode completes tasks end to end. It does this quickly, while keeping programmers in the loop. We support all frontier coding models, including Claude Sonnet 4, OpenAI o3-pro, OpenAI GPT-4.1, Gemini 2.5 Pro, Claude Opus 4, and more."

Thus, Cursor AI is a code editor that uses artificial intelligence models to help code writers with coding tasks such as code generation, smart rewrites, codebase queries and end-to-end task completion.


OBS Logo

OBS Studio FAQ

OBS stands for Open Broadcaster Software - an open source software to record screen and stream live on platforms like YouTube. In this section some of the tips and tricks are summarized which has been observed and received from other videos and demos. MB stands for Mouse Button. Unlike other programs, OBS does not have option to Save File... Instead is uses Profile for the same purpose. Excerpts from user guide: "A Profile saves most a solid chunk of OBS Studio settings, primarily related to outputs. Using Profiles lets you to switch between different saved settings quickly depending on the stream or recording a user is working on. Scene Collections save all Scenes and Sources that have been added to it. Similar to Profiles for output settings, you can store multiple different collections of saved Scenes and Sources. Then, you can swap between different collections for different situations. Scene Collections do not store output settings."

Studio Mode: It helps to queue-up the scenes (by creating new scenes or selecting from existing ones) and preview while streaming or recoding.

OBS-Studio Main Window

  • Alt + Left MB: crop any source object such as image, web camera...
  • Video overlap: add any scene to main scene - for example to overlay video scene (Video Capture Device with mask added to it)
  • Like any other program, white portion of an image acts as transparent section of the mask.
  • You can add only one mask on an image or video [Right click on Scene -> Filter -> -> + -> Image Mask/Blend]

You can add image mask to your webcam using ‘Image Mask/Blend’ option as per steps mentioned here: streamshark.io/obs-guide/image-mask. The white or coloured part of the image is made transparent while applying a mask and the black pixels are made invisible. Note that the mask can be applied on the source and not one the scene. If you apply mask on a source (say web cam), any relative transform between the web cam and mask cannot be applied.

Concepts of Scene and Layers in OBS: Top layer is the visible layer.

OBS Studio Mode Off

Various Types of Sources in OBS

OBS-Studio Source Window

Text Source in OBS

OBS Text Source 1

Text Source in OBS: Colour Gradient

OBS Text Source 2

Scrolling Text in OBS

OBS Text Scroll

Sometimes, the recording may automatically start without you intending to do so. This is very likely due to Hotkey associated with "Start Recording" pressed during some other tasks. Following settings might rectify this issue:

Disable hotkey when OBS window not in focus

One of the drawbacks of this setting is that you cannot start OBS while it is minimized. This is specially needed when you want to capture screen (activities on the Desktop). One option is to turn on "Never disable hotkeys" before starting a screen capture, set appropriate hotkeys (keyboard shortcuts preferably with ALT key combination at ALT key is rarely used in normal keybord input of texts) for start and stop recordings. Once desired screen capture is complete, turn on "Disable hotkeys when main window is not in focus". Note that scenes and sources automatically gets added to hot-key menu. One can use combination of ^+Shift+keys on the first, second and third rows such as z, x, c or a, s, d or q, w, e for various short cuts.

During screen capturing, one may face screens which captures itself (mirror effect) as shown in following image. If available, move the OBS Studio window to a second monitor. This will prevent it from being captured in the recording. In newer versions of OBS Studio, there is option under Settings > General > check box "Hide OBS windows from screen capture".

Screen Capture source in OBS Sutdio

Excerpts from OBS website: "High performance real time video/audio capturing and mixing. Create scenes made up of multiple sources including window captures, images, text, browser windows, webcams, capture cards and more. Studio Mode lets you preview your scenes and sources before pushing them live. Adjust your scenes and sources or create new ones and ensure they're perfect before your viewers ever see them. Set hotkeys for nearly every sort of action, such as switching between scenes, starting/stopping streams or recordings, muting audio sources, push to talk, and more. Choose from a number of different and customizable transitions for when you switch between your scenes or add your own stinger video files."


Step-by-Step method to create a circular crop of webcam for OBS Studio. One may need to use "ffmpeg -i Image-Mask-2.png -vf colorkey=white:0.01:0.0 Image-Transparent.png" or other application to create image with white pixels as transparent. In MS-PowerPoint, one can select the shape and directly save as image where the corners of the square around the circle shall be filled with transparent pixels. ImageMagick can also be used to convert white pixels to transparent.

i / ii
Input Image 1 for "Image Mask/Blend" filter
Image-Mask-1
ii / ii
Input Image 2 with transparent white pixels - to create blue circular boarder
Image-Mask-1
1 / 8
Step-1: Rename Scene, add web cam as source
Rename Scene-1
2 / 8
Step-2: Add filter to the Scene using Circular Image Mask-1
Add Filter to Scene
3 / 8
Step-2: Add filter to the Scene using Circular Image Mask-1
Add Circular Filter
4 / 8
Step-3: Adjust web cam size to fit the mask
Adjust web cam size
5 / 8
Step-4: Add new Scene
Add Circular Webcam
6 / 8
Step-5: Add filter to new scene using Circular Mask-2
Filter Using Circular Mask
7 / 8
Step-5: Add filter to new scene using Circular Mask-2
Filter Using Circular Mask 2
8 / 8
Step-6: Create a third scene and add previous scene as source
Add scene into scene

Web Scraping in Python
The term web scraping refers to collecting information from web sites. However, the same concept can be used to check the consistency and correctness of tags and links in folder structure of a website before uploading the content on host server. If a website fetches data using Javascript (called Dynamic pages such as nseindia.com), requests and urllib libraries cannot be used. These tools work only for static pages (where the contents are directly stored in HTML page being accessed).
import re
def split_string_at_numbers(input_string):
  # Check for +/- sign, digits, decimal point
  pattern = r'(-?\d+\.?\d*|\d*\.?\d+)'
  
  # Split the string by the number pattern, keeping delimiters
  sub_str  = re.split(pattern, input_string)
  sub_str_txt = []
  sub_str_num = []
  for str_txt in sub_str :
    if str_txt: 
      try:
        num = float(str_txt)
        if num == int(num):
          sub_str_num.append(int(num))
        else:
          sub_str_num.append(num)
      except ValueError:  # If conversion fails, it implies a string
        sub_str_txt.append(str_txt)
  
  for item_txt, item_value in zip(sub_str_txt, sub_str_num):
    #print(f"{item_txt} | {item_value}")
    print('{} | {}'.format(item_txt, item_value))
    
  return sub_str_txt, sub_str_num

This Python code is a simple and scalable example to check the image tags in all the HTML files stored in a folder and print summary of image tags such as relative path of image file, its file size, missing images...This code can be further improvised to include HREF tags, missing ALT tag for images, add styles to the images, remove styles of the images such as width and height... to name a few.

Python code lined here is a simple and scalable example to check the <a> tags and HREF values in all the HTML files stored in a folder and print summary of hyperlinks such as relative path of the file referred by HREF, missing files in the links... This code does not check the hyperlinks referred by HREF starting with http or https. This script can be further improvised to check for missing attribute values such as _blank.


Flowchart to create User Interfaces for multiple Standalone Apps and Deploy on Cloud Platforms like AWS

START
  ↓
Requirement Analysis: Define scope and expected key features
  ↓
Analyze Engineering Tools: inputs, run-time, outputs
  ↓
Define UI Requirements
  ├─ User roles
  ├─ Input/Output formats
  ├─ Tool execution triggers
  ↓
Choose UI Framework
  ├─ Web (React / Angular / Vue)
  └─ Desktop (Electron / PyQt)
  ↓
Design UI/UX
  ├─ Wireframes
  ├─ Navigation flow
  └─ Tool integration layout
  ↓
Develop Frontend UI
  ├─ Forms for input
  ├─ Dashboard for tools
  └─ Visualization components
  ↓
Create Back-end Layer (Optional but Recommended)
  ├─ API Gateway
  ├─ Microservices (Node.js / Python)
  └─ Tool Execution Handlers
  ↓
Integrate Standalone Tools
  ├─ CLI execution wrappers
  ├─ Containerization (Docker)
  └─ Input/Output handling
  ↓
Testing Phase
  ├─ Unit Testing
  ├─ Integration Testing
  └─ UI Testing
  ↓
Containerize Application
  ├─ UI (Frontend container)
  ├─ Back-end services
  └─ Engineering tools
  ↓
Push to Container Registry
  └─ AWS ECR
  ↓
AWS Deployment Decision
  ├─ Simple Hosting → AWS EC2
  ├─ Scalable Apps → AWS ECS / EKS
  └─ Serverless → AWS Lambda + API Gateway
  ↓
Deploy Infrastructure
  ├─ Configure VPC
  ├─ Setup Load Balancer
  ├─ Configure Auto Scaling
  ↓
Deploy Application
  ├─ Frontend → S3 + CloudFront
  ├─ Back-end → ECS / EC2 / Lambda
  └─ Tools → Containers / EC2 instances
  ↓
Setup Storage
  ├─ S3 (files/results)
  ├─ RDS / DynamoDB (metadata)
  ↓
Monitoring and Logging
  ├─ CloudWatch
  ├─ X-Ray (optional)
  ↓
Security Setup
  ├─ IAM Roles
  ├─ HTTPS (ACM)
  ├─ Authentication (Cognito)
  ↓
CI/CD Pipeline
  ├─ CodeCommit / GitHub
  ├─ CodeBuild
  └─ CodePipeline
  ↓
END (Live System)

Checklist to Develop a Simple Web App

Activity / Step / StageValueRASIC
Product Definition and Planning
Define problem statementProduct OwnerS/w ArchitectS/w ArchitectFull-stackDevOps
Identify target usersProduct OwnerS/w ArchitectS/w ArchitectFull-stackDevOps
Define core featuresProduct OwnerS/w ArchitectS/w ArchitectFull-stackDevOps
Write functional requirementsProduct OwnerS/w ArchitectS/w ArchitectFull-stackDevOps
Define success metrics (KPIs)Product OwnerS/w ArchitectS/w ArchitectFull-stackDevOps
Technical Planning
Choose architectureMonolithS/w ArchitectProduct OwnerFull-stackProduct OwnerFull-stack
Select frontend frameworkReactS/w ArchitectProduct OwnerFull-stackProduct OwnerFull-stack
Select back-end techNode.jsS/w ArchitectProduct OwnerFull-stackProduct OwnerFull-stack
Choose databaseMongoDBS/w ArchitectProduct OwnerFull-stackProduct OwnerFull-stack
Define API designRESTS/w ArchitectProduct OwnerFull-stackProduct OwnerFull-stack
Create authentication and authorization schemeAWS AmplifyS/w ArchitectProduct OwnerFull-stackProduct OwnerFull-stack
Define third-party integrationsS/w ArchitectProduct OwnerFull-stackProduct OwnerFull-stack
Create high-level system design diagramAWS AmplifyS/w ArchitectProduct OwnerFull-stackProduct OwnerFull-stack
UX/UI Design
Create wireframes (low fidelity)S/w Architect
Design UI mock-ups (high fidelity)S/w Architect
Define design system (colours, typography, components)S/w Architect
Plan responsive designDesktops onlyS/w Architect
Validate UX with stakeholdersS/w Architect
Project Setup
Initialize repositoryGitDevOps
Set up project structureDevOps
Configure package managersnpmDevOps
Set up linting and formatting toolsESLintDevOps
Configure environment variablesDevOps
Set up CI/CD pipelineGitHubDevOps
Frontend Development
Set up routing/navigationFull-stack
Build reusable componentsFull-stack
Implement UI screens, ensure responsivenessFull-stack
Integrate APIsFull-stack
Manage stateReduxFull-stack
Handle forms and validationFull-stack
Add loading/error statesFull-stack
Back-end Development
Set up server frameworkNode.jsFull-stack
Define database schemaFull-stack
Implement APIs/endpointsFull-stack
Add authenticationJWTFull-stack
Implement business logicFull-stack
Add input validation and error handlingFull-stack
Integrate external servicesFull-stack
Write unit testsFull-stack
Database and Data Management
Design schema/modelsFull-stack
Set up migrationsFull-stack
Seed initial dataFull-stack
Optimize queries and indexingFull-stack
Security
Implement HTTPSTSL 1.3Full-stackDevOps
Protect against XSS, CSRF, SQL injectionFull-stackDevOps
Secure authentication and sessionsFull-stackDevOps
Validate and sanitize inputsFull-stackDevOps
Manage secrets securelyFull-stackDevOps
Set up rate limitingFull-stackDevOps
Testing
Unit testsJestFull-stackDevOpsS/w Architect
Integration testsJestFull-stackDevOpsS/w Architect
End-to-end testsFull-stackDevOpsS/w Architect
Manual QA testingFull-stackS/w Architect
Cross-browser testingFull-stackS/w Architect
Performance testingLighthouseFull-stackS/w Architect
Deployment Stage
Choose hostingAWSFull-stack
Set up production environmentFull-stack
Configure CI/CD pipelinesCodeBuild Full-stack
Set up domain and DNSFull-stack
Configure SSL certificatesFull-stack
Set up monitoring and loggingFull-stack
Performance Optimization
Optimize frontend assetsLazy loadingS/w Architect
Implement caching Not requiredS/w Architect
Optimize database queriesS/w Architect
Use compressiongzipS/w Architect
Analyze performance S/w Architect
Launch Readiness
Final QA passS/w Architect
Fix critical bugsS/w Architect
Prepare rollback planS/w Architect
Create user documentation/help pagesS/w Architect
Post-Launch
Monitor errors and logsS/w ArchitectFull-stackDevOpsProduct Owner
Track user behaviour and metricsS/w ArchitectFull-stackDevOpsProduct Owner
Gather user feedbackS/w ArchitectFull-stackDevOpsProduct Owner
Plan feature iterationsS/w ArchitectFull-stackDevOpsProduct Owner
Regular security updatesS/w ArchitectFull-stackDevOpsProduct Owner
Scale infrastructure as neededS/w ArchitectFull-stackDevOpsProduct Owner

Example User Stories for a Web App Development Projects

  | Stakeholder Role  | Stakeholder Name | Responsibility       | 
  | ----------------- | ---------------- | -------------------- |
  | Sponsor           | A                | Budget Approval      |
  | Project Manager   | B                | Define Requirements  |
  | Product Owner     | C                | Implement Features   |
  | Development Team  | D                | Develop Applications |
  | QA Team           | E                | Quality Assurance    |
  | End Users         | F, G, H          | Provide Feedbacks    |
  1. Epic: UI/UX Requirements
    • Modern and responsive page for laptops and desktops (not for mobile screens)
    • Company logo and colours
    • Simple menu structure
    • Conditional drop-downs
    • Navigation: Sidebars, top menus, and search boxes
    • Data Visualization: Lists, grids, expansion tables, and charts
    • Cross-browser compatibility
  2. Epic: User Authentication
    • User Registration: New users can create accounts
    • User Log-in: Users should log in using email/password
    • User authorization by admin
  3. Epic: Task Management
    • Create tasks
    • Edit and update tasks not locked
    • Delete tasks not submitted for review
    • Display task list - dashboard
  4. Epic: Collaboration
    • Submit for review
    • Close tasks
    • Add comments
Web app interface diagrams—including wireframes, mock-ups, and user flows—map out the layout and navigation of digital products. Example of web interface diagram after successful log-in:

Web-Interface-Diagram


Template to create work-flow for International Travels

This is a simple template which can be improvised to create an efficient workflow for international travels.
Contact us
Disclaimers and Policies

The content on CFDyna.com is being constantly refined and improvised with on-the-job experience, testing, and training. Examples might be simplified to improve insight into the physics and basic understanding. Linked pages, articles, references, and examples are constantly reviewed to reduce errors, but we cannot warrant full correctness of all content.