Skip to main content
7 votes
Accepted

WebForms, JQuery and the DRY principle

A colleague I'm working with insists this is WET code and a violation of the DRY principle since each page has to load JQuery individually. No. The jQuery library code is cached by the browser. If ...
Robert Harvey's user avatar
7 votes
Accepted

How to process large image with a minimum time lag

I cannot and will not recommend any libs or frameworks for this, but if you are willing to implement a system by yourself, here is a simple outline of what might work: send the image to the server ...
Doc Brown's user avatar
  • 209k
7 votes

Should I stop using jQuery and create custom abstractions?

Custom abstractions should feel custom. That is, they should take advantage of knowing your particular needs. Without that you’re simply replacing a well known library with an obscure one that has ...
candied_orange's user avatar
6 votes
Accepted

I keep bouncing from "god function" to "tiny SRP functions" how do I break this cycle?

What you need is a new abstraction. Simply pulling out common bits of functionality ends up creating a mess. You need to find a brand new way of looking at your problem that enables you to extract ...
Winston Ewert's user avatar
5 votes
Accepted

Why JS MVC frameworks prefer data binding to UI element reference?

The purpose of data binding is to decouple the view from the model. Neither the model nor the view should know about each other. Data binding is the glue that connects the model to the view and ...
Robert Harvey's user avatar
4 votes
Accepted

How does jQuery work?

A high-level dissection of the code posted: <script type="text/javascript"> Html-element to embed a script in it $("#circle") $ is the jQuery alias for getting the jQuery object which wraps ...
cwap's user avatar
  • 347
4 votes

Hosting a static website containing JavaScript/jQuery

There is a difference between hosting static .js files that are served to clients, and running a JS program on the server to generates dynamic files in response to requests. The services you are ...
Caleth's user avatar
  • 11.4k
4 votes

How to impersonate user in web app?

Update to your update. So I am looking at building something into my web page that allows the business user to pick an end user from a list of names, then pass that login name along to the web ...
Flater's user avatar
  • 52.5k
3 votes

Are there standards for handling card swipers in applications?

Not really, no. At least, not outside of the fact that there are three tracks to read from, and each has a maximum number of bytes they can hold. While there are standards that are followed, it's ...
Cypher's user avatar
  • 124
3 votes
Accepted

Using CSS classes to express state

Using classes to track state is pretty common, for example - in AngularJS: https://docs.angularjs.org/api/ng/directive/form#css-classes but - remember that css-classes are easily manipulated in the ...
electblake's user avatar
2 votes

Stopping client-side Javascript from turning into a monolith

The modern JS approach is to: Maintain lots of separate *.js source files, much the same as we do in OO languages Use a JavaScript build pipeline like gulp or grunt to concatenate and minify the *.js ...
jamesfmackenzie's user avatar
2 votes

Effective way of using jQuery

Typically this is the spot where I would tend to bring in a JavaScript templating library to complement jQuery. Knockout JS was always one of my favorites because it brought data binding with it, but ...
Michael's user avatar
  • 6,467
2 votes
Accepted

Is RSS generation from MySQL server an ideal method for Facebook-like user feed in a website?

RSS is a specification format for feeds. As you said, it's just a specification of an XML document. Since RSS is a specified format, there are many tools that can digest RSS feeds. It only makes sense ...
Samuel's user avatar
  • 9,197
2 votes

Javascript inline event handling versus external jQuery event handlers

The benefit of the 1st approach is, as you read your HTML file you also know what happens when the div is clicked (i.e. gotoFamilyPage) without having to dig through your javascript source files, ...
Sarsaparilla's user avatar
2 votes

How to process large image with a minimum time lag

If it were me, I would probably implement it locally on the users machine using a GPU-based toolkit like WebGL. This allows you to do the processing very quickly and in parallel. This solves several ...
user1118321's user avatar
  • 4,991
2 votes

How to declare the need of polyfills publishing jquery plugin (and specially for webpack users)?

First, document the browsers you support. Below that include a section in your documentation about how to support older browsers. Here you can list the features for which pollyfills are required. ...
Greg Burghardt's user avatar
2 votes

Should one-line functions be avoided in jQuery/JavaScript?

In my experience, creating the function hurts readability and provides no benefit. This is only because the function is extremely short, and because it doesn't provide abstraction. If the function ...
Quitting Due To Antisemitism's user avatar
2 votes
Accepted

Should one-line functions be avoided in jQuery/JavaScript?

I see your coworker's point. You went from repeating a relatively short jQuery expression to repeating an only-slightly-shorter function call. I think this is in the size range where creating a ...
Karl Bielefeldt's user avatar
2 votes

Implementing heartbeat in terms of best practice

Client heartbeat is bad practice. There's no scenario explanation in your question, but you have to consider: what happens when the heartbeat misses? What's the server supposed to do? Basically, in ...
palin dromo's user avatar
1 vote

Support i18n in existing application?

I almost hate to suggest this given my dislike of regexes, but would a regex search for quoted strings work: /\v"([^"]|\n)*" I found this one here - Regex to search double quoted strings on multiple ...
ChrisF's user avatar
  • 39k
1 vote

How to process large image with a minimum time lag

Very similar to Doc Brown's answer: let the user choose the file using dropzonejs or something similar. Do not upload the file to the server yet; create a HTML canvas that holds a smaller version of ...
turdus-merula's user avatar
1 vote

ModelState Validation vs JQuery vs Remote

Technically it is possible to do validation almost anywhere. It is the purpose of the validation that determines where you should place it, and if you want a robust, user friendly site/app, then you ...
Nathanael 's user avatar
1 vote

ModelState Validation vs JQuery vs Remote

Validation can be done in many different ways. Each way has its own drawbacks and benefits. Frontend validation is very quick. It provides the best user experience, since you can provide immediate ...
Flater's user avatar
  • 52.5k
1 vote

I keep bouncing from "god function" to "tiny SRP functions" how do I break this cycle?

In what ways will the code vary in the future? Which code will be easiest to add to? If you are going to have lots of per-item exceptions, then you don't want a full function for each case (...
Andrew's user avatar
  • 721
1 vote

Visitor pattern. Operating on the nodes of a tree

For completeness, I thought I would post what I actually came up with: //Traverses the SVG tree and invokes userFnc when ever it encounters //a Basic Shape node function shapesTraverser( ...
AdamW's user avatar
  • 69
1 vote

sending ajax request with setinterval . is it good?

I would recommend moving to websockets when possible, but until then, here are a few things to consider. Make sure you are collecting statistics on numbers of requests, and response times. While not ...
backpackcoder's user avatar
1 vote
Accepted

How to integrate Jquery validation into ASP .Net web form

The reason all server controls are placed inside tag is to allow the WebForms engine to recognize them, load their values & save their values from/to the ViewState. Almost all infrastructure of ...
theK's user avatar
  • 36
1 vote

Stopping client-side Javascript from turning into a monolith

In order to avoid one monolith file containing all the code of your application, you may use two techniques: Frameworks. There are a bunch of JavaScript frameworks which will let you declare ...
Arseni Mourzenko's user avatar
1 vote

Collecting user input to use as query with API

I realized you may be in this category. Make sure you read the Open letter to students with homework problems before making further posts. I tried to follow the rules in there for answering this, ...
Adam Wells's user avatar
1 vote
Accepted

Is it a good practice to use jQuery object to load scripts onto page?

Use a formal convention such as require.js. For example, to load jquery-ui: requirejs.config({ baseUrl: 'js/lib', paths: { // the left side is the module ID, // the right side ...

Only top scored, non community-wiki answers of a minimum length are eligible