We help IT Professionals succeed at work.






JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and  in almost every mainstream web browser.

I'm on my first Angular 8 project, upgrading a side project I have.

I installed nmp and Angular 8.

Following a tutorial on learning Angular 8 (https://www.c-sharpcorner.com/article/learn-angular-8-step-by-step-in-10-days-day-1/)
 it mentions installing Typescript.

1. I checked package.json and I see this. Does this mean Typescript has been installed?

2. I checked this folder and I see this:

3. I did tsc -v, but get a message 'tsc' is not recognized as an internal or external command,
operable program or batch file.

4. I opened the project's file in notepad and I see this <TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>

Do I have Typescript installed?
Good day Experts,

Need help with turn server and web rpc.. we are getting "ICE failed, add a TURN server and see about:webrtc for more details" and we trying to get our video chat application to work properly.  At moment it only works if i am on the same ISP with a user..if users are on different isps..the voice and video does not work.  We are running tests using this kink https://www.teledoctor.co.zm/livesmart/client.html

When it works we are on same service provider, but voice video stops on different..we are not experts on this and need help to get work across service providers for our application.  Is there a site where one can test a TURN/STUN server setup?

Kind regards
I'm coding my JavaScript phone games in Brackets. It claims Google Chrome browser must be used for test/preview.
But if I refresh in Safari, it seems to be fine.

I'm using a local XAMPP server for my project web-file-space.
Is there a good/convenient way to publish the files to a real web_space? How do I connect the (lightning) preview button in Brackets IDE properly?

It insists Google Chrome must be installed as a browser. Does this in any way complicate my install of Safari?

Here's the ticket I'm working on:

When the Prospects service queries for contacts, if values are undefined, the defaults are hardcoded and caught later on.

I.e in the backend:
phone number -> 000-000-0000
name -> . //Not kidding, it's literally a period
email -> noemail@email.com

Then in the front end, it checks for each of these hardcoded values before converting them to booleans. This seems very loose and confusing.

Basically, what's happening is if a user adds a contact to the database and they enter very little info (no email, no name or no phone number), the database will interpret those NULL values, in whatever combination they may be, and replace those NULLs with either a period, or what you see above.

The team member who's identified this anomaly is an exceptional programmer and I'm not cynical at all. My question: What would be the better approach?

I've got three fields available to me. The only required field is the, "name" - although I'm thinking that could also be left blank in light of there being the "period" accommodation mentioned above.

I've asked about making all three fields required and that was nixed.

So, what then, is the better approach to handling NULL values in this scenario?

Right now, rather than inserting a NULL value, things like "noemail@email.com" are being inserted instead. And then the system looks for "noemail@email.com" to determine whether or not there's a legitimate email address in the database.

It's a …
How do I add a "sign-up" form for my website? I would want a form for the user to fill-in, then the information goes to a database, I suppose. THEN a Thank You notice. I believe this has to be done in javascript.

How can I alert the user if they enter From date greater than To date?

var StartCreateDate = $('#FromCreatedDate').val();
var EndCreateDate = $('#ToCreatedDate').val();

  if ((StartCreateDate != null && EndCreateDate != null) && (StartCreateDate > EndCreateDate)) {
            alert("From create date must be greater than to create date")
            return false;

Open in new window

I've been working w javascript Phaser for games, and one example isn't coming through. It is the 'colorzap' example.

It ads a state object to a window that only works on a device and not a browser. What should I change in main.js, or the first state .js. ?

The colorzap Github is here

Here's a screenshot of the page I'm working on:

screenshot of app
The field in the red box is what's got me baffled.

My task is to change the formatting of the "02/26/2020 - 03/26/2020" that's in there right now to "Last 30 Days."

The app is using "DateRangePicker..."

Here's the relevant portion of the twig file:

<div class="row">
    <div class="col">
        <div class="card">
            <div class="card-header">
                <form class="filter-form form-inline view-report inline-filters" action="/reporting" method="post">
                    <div class="form-group">
                        <input type="text" name="date-range" id="date-range" placeholder="Date Range" class="form-control"/>
                    <div class="form-group">
                        <select name="user" placeholder="Seller" class="form-control user-select "></select>
                    <div class="form-group">
                        <button type="submit" class="btn btn-md btn-success"><i class="fa fa-check fa-lg"></i> View Report</button>
                    <div class="form-group">
                        <button type="button" class="btn btn-md btn-primary btn-print"><i class="fa fa-print fa-lg"></i> Print</button>
                        <button type="button" class="btn btn-md btn-primary btn-pdf"><i class="fa fa-file-pdf fa-lg"></i> PDF</button>

Open in new window

I'm working on an app that's using DateRangePicker...

There's been more than one third party contractor involved and I say that because of the way the formatting changes from page to page. My task is to institute some uniformity and I'm stuck.

Here's the dilemma:

The Dashboard:DateRangePicker

screenshot of dashboard
The twig file that goes along the Dashboard looks like this (this is just the relevant part):

 <div class="row filter-widget">
                <div class="col"><h4>Most Active</h4></div>
                <div class="col right-padding">
                    <form class="form-inline float-right" action="/dashboard/activitychart" data-chart-target="activityChart">                       
                        <div style="cursor: pointer;" class="form-control text-muted date-range" data-saved="{{dashboard_settings.most_active.range}}" onclick="dateRangeSelect('index3')">
                            <div style="margin-top: 3px;">
                                <i class="fa fa-calendar"></i>&nbsp;
                                <span style="padding-right: 30px;"></span> <i class="fa fa-caret-down"></i>
                        <input type="text" style="display:none;"  placeholder="Date Range" name="date" required />

Open in new window

There's a JS file that goes along with this page. I have it here in its entirety ,but I'm looking at line #34.

Open in new window

For my javascript mobile game, I'll need to have hundreds of various pro-looking icons for in-game-choice buttons on my Phaser pages.

iconfinder.com has exactly the sort of pics I need. -- Polished.

Are there any subtleties to this choice? Will I regret it, legally, to be specific?
If I buy one of their membership packages, is it that simple? Credit them on the site?

Look around!
This page has an example of elephant icons. Ignore the childish ones! I'll prefer black and white.  here

I have the following function called from a selection in a grid:

I'd like to convert this to jquery. Is there a process or do people just know how this is done.

            function OnRowSelection() {
                var MasterTable = $find("<%=Grid.ClientID%>").get_masterTableView();
                var selectedItemsCount = MasterTable.get_selectedItems().length;
                    if (selectedItemsCount > 0) {
                        document.getElementById('btn1').disabled = false;
                        document.getElementById('btn2').disabled = false;
                        return false;
                        document.getElementById('btn1').disabled = true;
						document.getElementById('btn2').disabled = true;
						return false;

Open in new window

Also more generally the button doesnt look disabled, although the on click event doent fire in its disabled state. How would I achieve the diabaled style when disabled?
Hi Experts,

How can I resize an image dynamically based on their original width or height, without distorting them?

Let me elaborate...

The images are logos that are uploaded by users, so their dimensions are unknown. Some squares, some vertical rectangles, others horizontal. In other words there are 3 possible shapes.

I'm only in the planning phase for this, but i'll have a container (div) for these images, with a fixed size, let's say 190 x 60px.

So based on the 3 shapes and on the known 190 x 60 container, I'd want to end up with the following if the shape is

  • Square
  • , then the display size would be
  • 60 x 60

  • Horizontal
  • , then the display size would be
  • 190 x calc

  • Vertical
  • , then the display size would be
  • calc x 60

In each scenario, the img would remain its original size if it is less than 190x60 I think

Now, I know calc would be proportional. For example, for vertical, calc (or width) would be 60/[orig_height]x[orig_width]

So, my first question is how to obtain the original dimensions of a given image file?

Secondly, what is the easiest way to do this, considering that I'm using PHP/jQuery/SCSS? I'm leaning towards doing it all on the  PHP side.

Thank you.
JQuery pop up window with Radio buttons

I have the following Jquery code for the pop up window

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" type="text/javascript"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/jquery-ui.min.js" type="text/javascript"></script>

Open in new window

<script type="text/javascript">
           autoOpen: false,
           height: 250,
           width: 250,
           modal: true,
         buttons: {
        "Ok": function() {
          $( this ).dialog( "close" );
          window.location.href = $("#YourDialog input:radio:checked").val();
           //Additional Code Here
       //Displays the dialog modal when the "YourButton" element is clicked

Open in new window

<div id="YourDialog" style="display: none;">
				Please choose an option : <br />
				<input name='choice' type='radio' value='MQG' checked >MQG<br/>
				<input name='choice' type='radio' value='DQG'>DQG

Open in new window

and then Im trying to call it from the following function and trying to replace windows.confirm box with above pop-up windows

if(fileExtension.toUpperCase()==="csv".toUpperCase() )
		    var isMQG = window.confirm("If this a MQG then" +
		    		"\n Please select OK for a MQG" +
		    		"\n or Cancel for a DQG");
			if (isMQG)
				document.form1.action = "getFile.jsp?grpType=M";
				document.form1.action = "getFile.jsp?grpType=D";

Open in new window

Im not sure how can i Call my pop-up code in above code so that when radio button MQG is selected on OK ,  this
document.form1.action = "getFile.jsp?grpType=M";

Open in new window

action gets called and when DQG radio button is selected on OK , this
document.form1.action = "getFile.jsp?grpType=D";

Open in new window

action is called

Thank you
I've been asked to edit an existing app by eliminating the "pagination" feature of a third party vendor called "Datatables."

Here's what the page looks like currently:

Sweet little package, but the "features" that I have identified with an arrow within the big, black box - those are the guys that I'm needing to eliminate, but only in the event that the number of total rows is 10 or less.

My question is, "How?"

I've read through some documentation, but I'm at a point where I would welcome anyone who's been down this road before to give me some insight.

What do you think?

i have following code , in the construtor below, i call a function , which makes an api call , i verified I am able to get the json data. but when, i click view button, i get an error and tracing through the error, this.itemlist is undefined .

i have verified uisng console log that , in the success and then function, there is json data being returned and assigned to this.itemlist property  from the api call.

Question : as this.itemlist is populated and should be available in the same instance of the class , why it is undefined when it gets to the displayresults method below?

(function() {
  class page {
      constructor() {
          this.showdata = false; 
          this.viewdata = document.querySelector("#view");
          this.itemlist = []; 

          //populate data 

           //add event handler 

       addeventhandlers () {
          this.viewdata.addEventListener("click", this.displayresults);

      getdata() {
                 url: "www.api.com/api "
                contentType: "application/json",
                dataType: 'json',
                success: (result) =>  {  
                            this.itemlist = result; 
                }).then (function () { 
                        if (this.itemlist.length > 0) {
                                 this.showdata = true;

Open in new window

Here's a screenshot of my page:

Here's what you're looking at:

This particular company doesn't have any address information .Within the code, there's a piece that's looking for some relevant data based on the postal code. If that info doesn't exist, the page will just sit there until it finally times out leaving the user confused and bewildered.

To solve that dilemma, once I found the relevant syntax, I just qualified things by engaging that query only if there were some postal codes to query.

So, now for the first time in days, I'm actually able to look at some data on the page that, beforehand was simply timing out with no real explanation, at least as far as the user was concerned.


As you can tell by the screenshot, while the page is firing, beneath the hood there's an error message that references "leaflet.js."

Upon closer inspection, "heatmap.js" is involved as well.

So, here's my dilemma...

Although there's only one row in my database at this point, there will most certainly be multiple rows, most of which will represent a complete array of information. In other words, they will have some postal codes.

But in those instances where you've got a renegade row with no postal codes, I want to prevent "heatmap" from firing.

Here's the twig file:

<table id="main-dt" class="table custom make-datatable table-bordered table-striped dataTable no-footer" data-route="/companies/datatable" 

Open in new window

I am attempting to include  [  ]  $  ?  \  in the below snippet. I tried to escape them to no avail. What is the proper syntax for this string?

function validate_desc(val){
        if ( val.match("^[a-zA-Z0-9,-. \\\\/(/)#/_/'\":]+\$") ) {
            return true;
        } else {
            return false;

Open in new window

I saw these 2 libraries online:


SheetJS js-xlsx

Just wondering which one is better in aspects such as stability, sustainability and resource consuming?

I've been doing work in Javascript this week, and I don't want to end up using inferior packages.

I'm using CSS and HTML to put up a chess board now. Are the javascript primitives for drawing not quite as solid as Phaser?
I've also been watching the Udemy javascript lectures. I'd like to use its apparent effectiveness (made by gamers for gamers?)

I like the preload, create, update .. interface for the various components of the project.
It does sound, in addition.

Any insights or experience concerning this assessment? Do all devices support Phaser?

EE Ninjas!

We are poised on the threshold of great things, I just know it!

I'm working on a ticket that involves some pagination, but I have yet to be able to retrieve the list of "companies" that will utilize the pagination...

So, I've got to fix / understand a problem before I can fix the problem.

The good news is that I've been able to decipher where the error is coming from but I'm not sure what it means or how to fix it.

Given the fact that I'm still a pig on roller skates when it comes to NodeJs, I'm certain there's someone out there who can look at the error and know exactly what to do.

First of all, here's the code. This is "companies.js" and it's coming from the "services" directory.

datatable(input, baseFilters = {}) {
        return new Promise((resolve, reject) => {
            let config = this._getDataTablesFilters(input);
            let pipeline = [];
            let countPipeline = []; // the filters used for counts

            // add in the base filters
            config.filters = Util.merge(baseFilters, config.filters);

            // set the base pipeline where/match clause
            pipeline.push({ $match: this._enforceScope() });

            // add sorting
            if (Object.keys(config.sort).length > 0) {
                if (typeof config.sort[0] == 'undefined') {
                    pipeline.push({ $sort: config.sort });

            // Owner

Open in new window

Hi Experts,

I am using the following input mask that I have found a long time ago
//Source: http://digitalbush.com/projects/masked-input-plugin/#demo 

!function(factory) {
    "function" == typeof define && define.amd ? define([ "jquery" ], factory) : factory("object" == typeof exports ? require("jquery") : jQuery);
}(function($) {
    var caretTimeoutId, ua = navigator.userAgent, iPhone = /iphone/i.test(ua), chrome = /chrome/i.test(ua), android = /android/i.test(ua);
    $.mask = {
        definitions: {
            "9": "[0-9]",
            a: "[A-Za-z]",
            "*": "[A-Za-z0-9]"
        autoclear: !0,
        dataName: "rawMaskFn",
        placeholder: "_"
    }, $.fn.extend({
        caret: function(begin, end) {
            var range;
            if (0 !== this.length && !this.is(":hidden")) return "number" == typeof begin ? (end = "number" == typeof end ? end : begin, 
            this.each(function() {
                this.setSelectionRange ? this.setSelectionRange(begin, end) : this.createTextRange && (range = this.createTextRange(), 
                range.collapse(!0), range.moveEnd("character", end), range.moveStart("character", begin), 
            })) : (this[0].setSelectionRange ? (begin = this[0].selectionStart, end = this[0].selectionEnd) : document.selection && document.selection.createRange && (range = document.selection.createRange(), 
            begin = 0 - 

Open in new window

I am trying out ES6 syntax and writing a javascript class, that can read URL and parameter values  . doing some research  , I have the following and want to understand how to do this in javascript.

class  urlLogging{
  constructor() {
        this.currentUrl = window.location.search

  getUrlParameters() {
       //parse the currentURL

Questions : do I need to pass window object to this class and how do I do that?
                    how can I make a class , Immediately invoked function ?
in the chessboard Javascript available at https://chessboardjs.com

They use a 'FEN' string to keep track of the board state / piece locations, which looks like this: lower case is black, integers are blank square counts, upper case is white.


For my game, I need to store additional data about each piece in its lifespan.
The String board state would not hold extra info for each piece effectively.

Each piece needs at least a color, type character and an x and y location, and maybe a moveCount, history ..

something like:

struct piece {
 char pieceType;
char color;
int x;
int y;
int moveCount;
Move[] moves;
piece[] capturedPieces;

How should I approach this in Javascript for an entire board state? append 32 pieces to a {} structure?
What should this board / piece constructing best look like?

Hi Experts,

I have a primary domain with WordPress, that is mainly content. Now I am building a custom PHP application in a subdomain, and I need to show a form from the subdomain in the primary one, with all includes, etc.

Is it possible to have a iFrame in WP (or anywhere for that matter), so it does not have scroll bars, but actually have a natural flow, sort of  overflow visible?

Any help will be appreciated.
Hi there,  I am getting a Uncaught TypeError: Cannot read property 'open' of undefined error, on Line 14. This is a function, that will open a popup on page load.  Not sure hoe to rectify it?

jQuery(document).ready(function($) {
	// Parse the URL
	function getParameterByName(name) {
	    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
	    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
	        results = regex.exec(location.search);
	    return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
	// Give the URL parameters variable names
	var access = getParameterByName('access');
	// if access does not = yes then display the popup
	if (access != 'yes') {
		  items: {
		    src: 'https://go.buildertrend.com/l/464372/2020-03-20/7sshdx'
		  type: 'iframe', modal: true

Open in new window







JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and  in almost every mainstream web browser.