Saturday, December 3, 2022

number to word in Microsoft Word using formula

 

Press Ctrl + F9 to write mathematical equations and you get { }.

write the formula as: { =123456\*cardtext } and press Alt + F9

Output:

one hundred twenty-three thousand four hundred fifty-six

Use of Equations in Microsoft word.

Many of us don't know that we can do calculations and put equations in Microsoft Word. Below is the way you can put equations in any version of Microsoft Word.



Note:   If an "error" message comes, right-click it and select the toggle field code and make the correction.

Tuesday, November 22, 2022

Javascript Tips and Best Practices

1. Check property exists in an object

The in operator returns the boolean value true/false.
The in operator returns true if a property exists in the object or its prototype chain.

2. String to a number using the plus (+) operator

The unary plus operator (+) is the fastest and preferred way of converting something into a number.

3. Mask numbers using slice and padStart

The slice() method returns selected elements in an array, as a new array. Negative numbers select from the end of the array.
The padStart() method pads the current string with another string until the resulting string reaches the given length. The padding is applied from the start of the current string.

4. Swap two variables

Use destructuring assignment approach because it is short and expressive. Swapping is performed in just one line statement. It works with any data type like numbers, strings, booleans, or objects.

5. Check every element of the array using Array.every

The Array every() method checks whether all the array elements pass the test implemented by the provided function.
It returns true if the function returns true for all elements.
It returns false if the function returns false for one element. When every() finds a false result, it will stop the loop and continue no more which improves the performance. The every() method does not change the original array.

6. Use of nullish coalescing operator with numbers

I have use lot of time || operator for the logical disjunction, but it ends when value is 0 in the variable. So found better way to handle this.

A Nullish value is a value that is either null or undefined.
The Nullish Coalescing Operator (??) is a logical operator that accepts two values and returns the second value if the first one is null or undefined and otherwise returns the first value.

7. Filter Array with only values

Many times we have an issue with array to have empty values and need to handle we write extra code. To avoid it just you have to use filter().

Pass the Boolean to Array.filter as the first argument.

Friday, October 14, 2022

HTML Tags, which does not require CSS or JS


(1) The <details> tag is used to create an interactive widget that the user can open and close. By default, the widget is closed. When open, it expands and displays the content within. The <summary> tag is used in conjunction with <details> to specify the details of a visible heading. 

 Here is an example:-

Output

Loram Ipsumis simply dummied

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.








(2) Tag <picture>
The <picture> tag gives you flexibility in specifying image resources. This tag is used in responsive designs. As it allows you to use multiple images of different sizes to nicely fill the browser viewport, so you don’t need to use one image that is scaled up or down based on the viewport width.
The <picture> element contains two tags: one or more <source> tags and one <img> tag.

Here is an example

Output:

Resize the browser window to load different images.

Flowers







(3) Tag <template>
The <template> tag is a container to hold some HTML content hidden from the user. This hidden content can be displayed by Javascript.

Here is an example


The template Element

Click the button below to display the hidden content from the template element.

Monday, October 10, 2022

Resets CSS for all browser default values

 

The CSS code snippet below resets all browser default values and makes your CSS codes work in the same way in all browsers and neutralizes browser incompatibility.

Monday, September 19, 2022

Input type = number, remove the arrow at the end

Input type = number, remove the arrow at the end

Example:

Without class

With class

Online status when working from home !! with Python Script

Run this program and your cursor will move regularly enough to keep your online status when working from home!



//install PIP, you need to type into the terminal

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py

pip --version

// Is used to control the mouse and keyboard.

pip install pyautogui


//Code to move mouse every 2 second of sleep.. moveRel(x,y) -- move by pixel

import pyautogui;

import time;


while True:

    pyautogui.moveRel(0, 10)

    time.sleep(2)