Web Log

Server-side, client-side, code snippets, scripts, automation, best practices, proven approaches, tips & tricks...

Getting cropped image the smart way

The way to get cropped image URL with option to load original image too
0
I noticed that some of the content managers keep complaining about the quality and size of cropped images. If you lower down quality, file is smaller but in some cases it gets blurry with quirks which comes from compression applied to a file. Let's face it, image cropper is not Photoshop with all options for image optimization ... read more

Fastest way to return JSON result from a controller

Resturn JSON in MVC controller action
0
Recently I had to develop a form on a page which loads secondary dropdown list items based on selection in a primary dropdown list. Because secondary list items are basically children elements of the one selected in primary I just had to run through all children and just return text-value pair object to JavaScript to populate secondary dropdown list. ... read more

Faking browser client in HttpWebRequest

Introduce your request to server as a browser request
0
Using HttpWebRequest to fetch some data in your code from web is the easiest way to do it. However some web locations have restrictions to all only requests which come from browsers. Performing a normal HttpWebRequest will return 403 status code (HTTP 403 - Wikipedia) which means forbidden access ... read more

Restrict Access to an MVC Action or Controller based on IP address

IP Address Filtering in MVC Controller
0
When you are developing a back-end web application, you might want to restrict access only to people who are working in the company which is maintaining the content or any other operations in the back-end and allowing public access only for the public, usually read-only content. This means you still have to leave some parts of your application public and for some you need to restrict access for the people outside of a network (certain IP range). ... read more

Best practice tips for large scale Umbraco websites

Experience based tips for building large and complex websites in Umbraco
0
Umbraco is a great CMS, it simple, easily extendible and most important it is free. However, it is not build for large scale websites, since presentation and back-end are on the same machine and all published content is stored in AppData/umbraco.config file. This is good because it can be easily cached and database read is reduced ... read more

Automatic property population when node created

Pre-populate properties right after node is created
0
For pretty much every website I built in Umbraco, there is some sort of title property for page document type. Either it is a title for navigation in breadcrumbs or menu or main h1 page title. Usually some of these properties need to be mandatory and in most cases they are the same as the name of the node in content, but still, you have to keep ability to override the value with these properties. ... read more

Testing mobile website client side functionality on desktop

Development and testing of mobile websites on desktop
0
Recently I have posted an article about new HTML5 features for mobile devices where some of the new JavaScript APIs are described. If you decide to apply any of these new cool features on your mobile website you would first want to test them before you publish them on the real website. You can always expose the website to you mobile device and navigate, but it really takes additional time and after 10th time you would really get annoyed by doing this. ... read more

Use GitHub for hosting JS and CSS files

How to use your CSS and JS files direcly from GitHub
0
Recently I've started JQuery plugin project on GitHub and decided to provide examples via JSFiddler. I could easily take latest files and host it on the same host as this blog but that would make a headache for me as I would have to update files on my host as soon as I update file in GitHub. So I googled a little bit and found a solution ... read more

JavaScript

read more

Umbraco CMS

read more

.NET

read more

SQL/T-SQL

read more