Tuesday 15 March 2022

BhaiLang tutorial

BhaiLang tutorial

Example:

hi bhai

    bol bhai "Hello World - This is my first bhailang example";

bye bhai




You can check here

Bhailang will start with "hi bhai" & end with "bye bhai" same as other programming language synatax.

bol bhai - Keyword use to print content

bhai ye hai - This will be use for declare variable

agar bhai - This will be use for IF statement

warna bhai - This is for Else statement

jab tak bhai - This will be use for Loop statement

bas kar bhai;  - This is Break statement

BhaiLang programming language

What is BhaiLang 

Bhailang is dynamically typed toy programming language, based on an inside joke, written in Typescript.

BhaiLang is a toy programming language.

Bhailang is Created by Aniket Singh and Rishabh Tripathi.

It is for fun :) 😊

It will clear programming concept with example.

It's a great time to learn & start coding.

BhaiLang programming language


Installation

npm i -g bhailang


Sample example for bhailang.

1. Create new file

hi bhai

  bol bhai "Hello World - This is my first bhailang example.";

bye bhai

2. Save with bhailangExample.bhai

3. Run: bhailang test.bhai

4. Output: "Hello World - This is my first bhailang example.


Official website:

https://bhailang.js.org/


This is official repository for bhai-lang.

https://github.com/DulLabs/bhai-lang


NPM

www.npmjs.com/package/bhailang


BhaiLang Tutorial

You can check here for BhaiLang Tutorial


MIT LICENSE

https://github.com/DulLabs/bhai-lang/blob/develop/LICENSE


Open issue

https://github.com/DulLabs/bhai-lang/issues

Friday 31 December 2021

SEO tips for 2022


Today I am sharing best seo tips for 2022. These are the very short and effective tips which will works for you.

So let's read the below seo tips for 2022 which definaltly work for new website.

  • 1. Nice Domain name
  • 2. Purpose and design
  • 3.keyword research
  • 4. Set the keywords in Title and content
  • 5. Use pure HTML with no broken any tags
  • 6. Use H1 to H6 tag in your content
  • 7. Unique title and content for each page
  • 8. Internal link and external link
  • 9. update fresh content frequently
  • 10. About and Contact us page
  • These are the simply seo tips you should follow and it will increase organic traffic as well as product selling.

Tuesday 28 December 2021

Difference between string and stringbuilder in c#

 

The main Difference between string and stringbuilder in c# is below

Sr No. Sting StringBuilder
1. String is immutable. StringBuilder is mutable in C#.
2. We can't modify it after it is created. It creates a new object of string type in memory if we perform any operation in that String variable This means that if an operation is performed on the string, it will not create a new instance every time. With that, it will not create new space in memory, unlike Strings.
3. It is slow because all time create new instance It is fast because of same instance using when any operation is performed
4. The namespace used System The namespace used System.Text

Friday 15 May 2020

How to add new elements to DOM in jQuery

Answer: User the jQuery append() function

You can add element to dom using append function. sometimes we need to create dynamic html to dom at that time you can use append function.

$("#dvData").append("How to add new elements to DOM in jQuery");  


promise is undefined ie11

Answer: Use the npm es6-promise-promise to solve promise is undefined ie11

You need to install npm once imstalled then use this code to to solve promise function error

var ES6Promise = require("es6-promise");
ES6Promise.polyfill();
var axios = require("axios");

Other solution

You can resolve this error to adding 1 js in head tag. Use this script https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js

Search keywords for promise is undefined ie11

  • es6-promise-promise
  • ie11 promise polyfill
  • promise polyfill for ie

Monday 30 December 2019

How to replace all occurrences of a string in JavaScript

How to replace all occurrences of a string in JavaScript

Use the JavaScript replace() method

You can use the JavaScript replace() method in combination with the regular expression to find and replace all occurrences of a word or substring inside any string.

Let's check out an example to understand how this method basically works:

<script>
    var myStr = 'freedom is not worth having if it does not include the freedom to make mistakes.';
    var newStr = myStr.replace(/freedom/g, "liberty");
   
    // Printing the modified string
    document.write(newStr);
</script>

<script>
/* Define function for escaping user input to be treated as
   a literal string within a regular expression */
function escapeRegExp(string){
    return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}

/* Define functin to find and replace specified term with replacement string */
function replaceAll(str, term, replacement) {
  return str.replace(new RegExp(escapeRegExp(term), 'g'), replacement);
}

/* Testing our replaceAll() function  */
var myStr = 'if the facts do not fit the theory, change the facts.';
var newStr = replaceAll(myStr, 'facts', 'statistics')

// Printing the modified string
document.write(newStr);
</script>

How to refresh a page with jQuery

How to refresh a page with jQuery

Use the JavaScript location.reload() Method

You can simply use the JavaScript location.reload() method to refresh or reloads the page. This method optionally accepts a Boolean parameter true or false.

If the parameter true is specified, it causes the page to always be reloaded from the server. But, if it is false (which is default) or not specified, the browser may reload the page from its cache.

Let's check out an example to understand how this method basically works:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Reload the Page Using jQuery</title>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script>
    $(document).ready(function(){
        $("button").click(function(){
            location.reload(true);
        });
    });
</script>
</head>
<body>
    <button type="button">Reload page</button> 
</body>
</html>

How to Remove a Property from a JavaScript Object

How to Remove a Property from a JavaScript Object

Use the delete Operator

You can use the delete operator to completely remove the properties from the JavaScript object. Deleting is the only way to actually remove a property from an object.

Setting the property to undefined or null only changes the value of the property. It does not remove property from the object. Let's take a look at the following example:

<script>
    var person = {
        name: "Harry",
        age: 16,
        gender: "Male"
    };
   
    // Deleting a property completely
    delete person.age;
    alert(person.age); // Outputs: undefined
    console.log(person); // Prints: {name: "Harry", gender: "Male"}
   
    // Setting the property value to undefined
    person.gender = undefined;
    alert(person.gender); // Outputs: undefined
    console.log(person); // Prints: {name: "Harry", gender: undefined}
</script>

How to Parse JSON in JavaScript

How to Parse JSON in JavaScript

Use the JSON.parse() Method

You can simply use the JSON.parse() method to parse a JSON string in JavaScript.

The following example will show you how to convert a JSON string into a JS object and access individual values with pure JavaScript. It works in all major browsers

<script>
// Store JSON data in a JS variable
var json = '{"name": "Harry", "age": 18, "country": "United Kingdom"}';

// Converting JSON encoded string to JS object
var obj = JSON.parse(json);

// Accessing individual value from JS object
alert(obj.name); // Outputs: Harry
alert(obj.age); // Outputs: 18
alert(obj.country); // Outputs: United Kingdom
</script>


Asp.net tutorials