How does Angular JS relate to Google Closure?

The only Google project I’m aware of that uses AngularJS is the DoubleClick team. (presentation) Essentially, they still use Google Closure Library for everything but the UI building. Also note that they use Google Closure Compiler, but that’s almost a given, “nobody” uses only the Library without the Compiler. Google Closure Library comes with a … Read more

Which CSS selectors or rules can significantly affect front-end layout / rendering performance in the real world?

The first thing that comes to mind here is: how clever is the rendering engine you’re using? That, generic as it sounds, matters a lot when questioning the efficiency of CSS rendering/selection. For instance, suppose the first rule in your CSS file is: .class1 { /*make elements with “class1” look fancy*/ } So when a … Read more

ASP.NET MVC 3 client-side validation with parameters

You could use the ValidationParameters property to add custom parameters to the rule: public IEnumerable<ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context) { var rule = new ModelClientValidationRule { ErrorMessage = this.ErrorMessage, ValidationType = “futuredate”, }; rule.ValidationParameters.Add(“param1”, “value1”); rule.ValidationParameters.Add(“param2”, “value2”); yield return rule; } which could be used in the adapter: jQuery.validator.unobtrusive.adapters.add( ‘futuredate’, [ ‘param1’, ‘param2’ ], function … Read more

Pagination: Server Side or Client Side?

The right answer depends on your priorities and the size of the data set to be paginated. Server side pagination is best for: Large data set Faster initial page load Accessibility for those not running javascript Client side pagination is best for: Small data set Faster subsequent page loads So if you’re paginating for primarily … Read more

Disable client-side validation in MVC 3 “cancel” submit button

What is this mystical force that causes the answer to reveal itself as soon as you post a question somewhere? It looks like in MVC 3 you disable client-side validation on a button by adding the class “cancel” to it. So in my example: <input type=”submit” name=”backButton” value=”← Back” title=”Go back to step 1.” class=”cancel” … Read more

Is it possible to check dimensions of image before uploading?

You could check them before submitting form: window.URL = window.URL || window.webkitURL; $(“form”).submit( function( e ) { var form = this; e.preventDefault(); //Stop the submit for now //Replace with your selector to find the file input in your form var fileInput = $(this).find(“input[type=file]”)[0], file = fileInput.files && fileInput.files[0]; if( file ) { var img = … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)