28, Jan 2023
Javascript error : ” ‘Sys’ is undefined “

The “‘Sys’ is undefined” error in JavaScript typically occurs when the script is trying to access an object or variable named “Sys” that has not been defined or is not in the current scope. This error usually indicates that there is a problem with the code or with the way the script is being loaded.

Here are some common causes of this error:

  • The script that is trying to access ‘Sys’ is loaded before the script that defines it.
  • The script that defines ‘Sys’ is not loaded at all.
  • The script that defines ‘Sys’ is loaded but it has some errors that prevent it from working correctly.
  • There is a typo in the name of the object or variable.

To fix this error, you will need to check the following:

  • Make sure that the script that defines ‘Sys’ is loaded before the script that is trying to access it.
  • Make sure that the script that defines ‘Sys’ is not loaded multiple times.
  • Check the script that defines ‘Sys’ for any errors, like syntax errors or missing dependencies.
  • Check the spelling of the object or variable in the code.

It’s also helpful to check the browser’s developer tools to see if there are any console errors related to ‘Sys’ and the script that defines it.

You can also check the network tab and check if the script file is being loaded properly or if there is any 404 error.

It could also be that Sys is part of a framework or a library, in that case, you should check if it’s properly installed and loaded.

28, Jan 2023
JavaScript error : ‘document.advanced_search.keywords’, null or not the object

The “‘document.advanced_search.keywords’, null or not an object” error in JavaScript typically occurs when the script is trying to access a property or method of an object that is null or not an object. This error usually indicates that there is a problem with the code or with the way the object is being initialized.

Here are some common causes of this error:

  • The object “advanced_search” is not defined or is not in the current scope.
  • The object “advanced_search” is defined but it’s null or not an object.
  • The object “advanced_search” is defined but the property “keywords” is not.
  • There is a typo in the name of the object or property.

To fix this error, you will need to check the following:

  • Make sure that the object “advanced_search” is defined and it’s not null.
  • Make sure that the property “keywords” is defined on the object “advanced_search”
  • Check the spelling of the object or property name in the code.

It’s also helpful to check the browser’s developer tools to see if there are any console errors related to “advanced_search” and the property “keywords” and the script that defines it.

It’s also good to use try-catch block to handle any exception and get the error message with more details, which will help you to debug the issue.

Another way to check if the object is defined or not, is by using the typeof operator:

if(typeof advanced_search === 'undefined') {
  console.log("advanced_search is not defined");
}

You can also use the “hasOwnProperty” method to check if the object has a specific property:

if(!advanced_search.hasOwnProperty("keywords")) {
  console.log("keywords property is not defined on the advanced_search object")
}
28, Jan 2023
Why Usercontrol show javascript error

A UserControl in ASP.NET is a reusable control that can be added to an ASP.NET page, similar to a custom web component. If a UserControl is causing a JavaScript error, it could be due to a number of reasons. Some common causes include:

  • JavaScript code in the UserControl is not properly formatted or contains errors.
  • JavaScript code in the UserControl is trying to access elements or variables that are not present or are not defined correctly.
  • JavaScript code in the UserControl is trying to access elements or variables that are not properly loaded or initialized.
  • JavaScript code in the UserControl is conflicting with JavaScript code in the main page or in other UserControls.
  • JavaScript code in the UserControl is using an outdated or incompatible version of a library.

To fix this error, you will need to check the following:

  • Check the JavaScript code in the UserControl for any syntax errors or logical mistakes.
  • Check if the elements or variables that the JavaScript code is trying to access are properly defined and initialized.
  • Check if the JavaScript code is conflicting with any code in the main page or other UserControls.
  • Check if the JavaScript code is using an outdated or incompatible version of a library.
  • Check if the UserControl’s JavaScript files are being loaded properly.

It’s also helpful to check the browser’s developer tools to see if there are any console errors related to the UserControl or the JavaScript code, as that could help you to debug the problem.

It’s also good to use try-catch block to handle any exception and get the error message with more details, which will help you to debug the issue.

26, Jan 2023
Guid.NewGuid.toString Javascript error
Guid.NewGuid.toString Javascript error

The error message “Guid.NewGuid.toString is not a function” is indicating that the JavaScript code is trying to call the toString() method on the Guid.NewGuid object, but Guid.NewGuid is not an object that has a toString() method.

In JavaScript, the Guid object is not a built-in object, it is either a custom object or a part of a library that is being used in the code. .NewGuid is a static method that generates a new globally unique identifier (GUID) and it should be called as a function like Guid.NewGuid() and the returned value is a guid object that doesn’t have a toString() method.

You can resolve this issue by making sure that the Guid object is correctly imported or defined, and calling the Guid.NewGuid() method to get a new guid, then call the toString() method on that returned value.

For example, if the code is :

let newGUID = Guid.NewGuid.toString();

change it to

let newGUID = Guid.NewGuid().toString();

Also, make sure that you have the correct library/library version that has the Guid object defined in it.

26, Jan 2023
What does the exclamation mark do before the function?
What does the exclamation mark do before the function?
What does the exclamation mark do before the function?

In JavaScript, the exclamation mark (!) before a function is often used to indicate that the function will return a Boolean value (i.e. true or false). The exclamation mark is a logical operator that negates the Boolean value of an expression.

For example, if a function is called isValid(), it might return a Boolean value indicating whether a certain condition is true or false. By adding an exclamation mark before the function, the returned value will be negated, meaning if the function returns true, it will be converted to false and vice versa.

function isValid(){
  // some logic
  return true;
}
console.log(!isValid()); // will output false

Another common use of the exclamation mark before a function is to check if a variable is undefined or null.

let x;
console.log(!x); // will output true

It can also be used as a shorthand for type coercion of a variable to boolean, if the variable is truthy it will return false, otherwise, it will return true.

let x = 0;
console.log(!x); // will output true

It’s important to note that the use of exclamation mark before a function can vary depending on the context and the specific implementation. So, it’s always a good practice to check the documentation or the surrounding code to understand the intended behavior of the function.

26, Jan 2023
JavaScript:How do I print a message to the error console?
JavaScript: How do I print a message to the error console?
JavaScript: How do I print a message to the error console?

In JavaScript, you can use the console.error() method to print a message to the error console. This method takes one or more arguments, and it prints them to the console as an error message.

Here’s an example of how to use the console.error() method:

console.error("This is an error message");

You can also use console.log() method to print a message to the console, which is not considered as an error.

console.log("This is a log message");

You can also include the variable value with the message you want to print.

var name = "John";
console.error("Name is "+name);

You can also use template literals to print the message along with the variable values

var name = "John";
console.error(`Name is ${name}`);

It’s important to note that the console.error() method and console.log() method only work when the developer console is open in the browser. So, you should use them for debugging purposes only.

26, Jan 2023
“Submit is not a function” error in JavaScript
"Submit is not a function" error in JavaScript

“Submit is not a function” error in JavaScript typically occurs when you are trying to call the submit() method on an object that is not a form element. The submit() method is a built-in method of the HTML <form> element, and it can be used to submit the form’s data to the server.

The error can occur if you have referenced the wrong element in your code, for example, if you have referenced a div element instead of a form element. It can also occur if you are trying to call the submit() method on a JavaScript object that does not have this method.

To fix this error, you need to ensure that you are calling the submit() method on the correct element. Here’s an example of how to correctly submit a form:

<form id="myForm">
  <!-- form inputs -->
</form>

<script>
  var form = document.getElementById('myForm');
  form.submit();
</script>

You can also use Jquery

$("#formId").submit();

If you are trying to submit the form using JavaScript, you may also check if the form element has a submit method or not, and then call it if possible.

if (typeof form.submit == "function") {
  form.submit();
}

In case you are trying to submit the form without refresh the page, you can use the ajax method to submit the form.

$("#formId").on('submit',function(e){
    e.preventDefault();
    $.ajax({
        type: "POST",
        url: "submit.php",
        data: $("#formId").serialize(),
        success: function(response)
        {
          // Do something after submit
        }
    });
});

It’s important to investigate the context of the error message and the specific line number and file that it’s being thrown from, it will help you to find the exact cause of the problem and how to fix it.

26, Jan 2023
What’s a good way to extend Error in JavaScript?
What's a good way to extend Error in JavaScript?

A good way to extend the Error class in JavaScript is to use the class keyword to create a new class that inherits from the Error class. This can be done using the extends keyword, like this:

class MyError extends Error {
  constructor(message) {
    super(message);
    this.name = 'MyError';
  }
}

In this example, MyError is a new class that inherits from the built-in Error class. The constructor function takes a message parameter, which is passed to the parent class’s constructor function using the super keyword. Additionally, the name property is set to ‘MyError’ which can be useful for identifying the error.

You can also set additional properties and methods in your custom error class as required.

Here’s an example of how you can use your custom error class

try {
  throw new MyError('Something went wrong');
} catch (err) {
  if (err instanceof MyError) {
    console.log(err.name); // MyError
    console.log(err.message); // Something went wrong
  }
}

It’s also a good practice to include a stack trace for debugging purpose by using the Error.captureStackTrace method.

class MyError extends Error {
  constructor(message) {
    super(message);
    this.name = 'MyError';
    Error.captureStackTrace(this, MyError);
  }
}

Note that, in older version of javascript, Error.captureStackTrace is only supported in V8. So, you might not be able to use it in other javascript engines.

26, Jan 2023
What is Graphic Design ?

Graphic design is the process of creating visual content that effectively communicates information to a specific audience. It involves the use of typography, imagery, color, and layout to create designs that are both aesthetically pleasing and functional.

Graphic designers use a variety of tools and techniques to create their designs, including:

  • Software: Popular graphic design software includes Adobe Illustrator, Photoshop, and InDesign. These programs are used to create vector graphics, edit photographs, and layout designs for print and digital media.
  • Sketching and drawing: Some designers prefer to begin their design process with traditional sketching and drawing techniques before moving to digital tools.
  • Color theory: Graphic designers use color theory to create effective color schemes in their designs. This includes understanding how different colors interact with each other and how they can be used to evoke certain emotions or convey a specific message.
  • Typography: The use of different typefaces and font styles is an important aspect of graphic design. Graphic designers must be able to choose appropriate typefaces and manipulate them to create a specific look or feel.

Graphic design is used in a wide range of applications, including:

  • Print design: This includes creating designs for brochures, posters, books, magazines, and other printed materials.
  • Web design: This includes creating designs for websites, mobile apps, and other digital platforms.
  • Advertising: Graphic designers create designs for billboards, posters, and other forms of advertising.
  • Product packaging: Graphic designers create designs for product packaging, including labels and boxes.
  • Motion graphics: This includes creating designs for video, animation, and other moving images.

A good graphic designer is able to balance the elements of design, typography, color, imagery, and layout to create visually pleasing, effective and compelling designs that convey the message and achieve the desired goal.

Software use in graphic design ?

Software plays a critical role in graphic design, allowing designers to create, edit, and manipulate digital images and typography to create visually appealing and communicative designs. There are several types of software used in graphic design, including:

  1. Vector Graphics Software: Vector graphics software allows designers to create graphics using mathematical equations, which makes them infinitely scalable without losing quality. Adobe Illustrator, CorelDRAW, and Inkscape are popular vector graphics software used by graphic designers.
  2. Image Editing Software: Image editing software is used to manipulate digital images and photographs, including resizing, cropping, adjusting color and contrast, and applying filters and effects. Adobe Photoshop, GIMP, and Affinity Photo are popular image editing software used in graphic design.
  3. Page Layout Software: Page layout software is used to create layouts for printed materials such as magazines, brochures, and books. Adobe InDesign, QuarkXPress, and Scribus are popular page layout software used by graphic designers.
  4. Typography Software: Typography software is used to create and manipulate typefaces, allowing designers to adjust font size, line spacing, and other typographic elements. Adobe Typekit, FontLab, and FontForge are popular typography software used in graphic design.
  5. 3D Design Software:3D design software is used to create three-dimensional models and animations. Autodesk Maya, Blender, and Cinema 4D are popular 3D design software used by graphic designers.

Using a combination of these software tools, graphic designers can create a wide range of visual designs, including logos, branding, illustrations, packaging, web design, and more.

Important skill in graphic design ?

Sketching and drawing are important skills for graphic designers, as they are often used in the initial stages of the design process to develop and refine ideas before moving on to digital tools. Sketching and drawing allow designers to quickly explore different design concepts, experiment with layout and composition, and work out details before committing to a final design.

Sketching and drawing can be done using traditional tools such as pencils, pens, and markers, or digital tools such as tablets and styluses. Some graphic designers prefer to start with traditional tools, as they allow for more freedom and experimentation, while others prefer to work digitally for the convenience and flexibility that digital tools offer.

When sketching and drawing, it is important for graphic designers to consider the principles of design, such as balance, contrast, rhythm, and proportion, to ensure that their designs are visually appealing and effective. They should also consider the intended audience and message of the design, as well as any specific requirements or constraints of the project.

After sketching and drawing, graphic designers can use digital tools such as Adobe Photoshop, Illustrator, or Procreate to refine and finalize their designs. They can scan or photograph their sketches and import them into digital software, where they can be further developed and refined using digital tools and techniques. Ultimately, the goal of sketching and drawing in graphic design is to create a strong and effective design that effectively communicates the desired message to the intended audience.

24, Jan 2023
What is social media marketing ?

Social media marketing is the process of using social media platforms to promote a product or service, increase brand awareness, and engage with customers. Social media platforms such as Facebook, Twitter, Instagram, LinkedIn, and Pinterest have millions of active users and provide businesses with a cost-effective way to reach a large and targeted audience.

Some of the key elements of social media marketing include:

  • Content creation: Social media marketing often involves creating and sharing high-quality, relevant, and engaging content that is designed to appeal to a specific target audience. This can include text, images, videos, infographics, and live streaming.
  • Paid advertising: Many social media platforms offer advertising options that allow businesses to target specific demographics and interests, such as age, location, and interests. These options can be used to promote products or services, increase brand awareness, and drive website traffic.
  • Influencer marketing: Influencer marketing is a form of social media marketing that involves working with individuals who have a large following on social media platforms to promote a product or service. These influencers can be industry experts, celebrities, or everyday users who have built a large following.
  • Engagement: Social media marketing also involves engaging with customers, responding to comments and messages, and building relationships with followers.
  • Analytics and measurement: The success of social media marketing campaigns can be measured using various analytics tools that track metrics such as website traffic, engagement, and conversions.

Social media marketing can be highly effective for businesses of all sizes, and it can be used to achieve a wide range of goals, such as increasing sales, building brand awareness, and improving customer loyalty. It’s important to have a strategy in place, to know the target audience, and the platforms they use, and to consistently create and share high-quality content that aligns with the business objectives.