Firefox Add-On of the ... month? Issue #1: HttpRequester

Let me quickly introduce an interesting add-on for Firefox to you. It's called HttpRequester and it's very very useful add-on for basically any developer.

What it does, it enables you to quickly send an HTTP request using the method which is not easily done through the browser (PUT/POST/DELETE).

You can also use a "browser view" instead of plain-text view.

Read More

Return HTTP status code 404 and error content in ASP.NET MVC

Google and all other search engines say "don't do soft 404". The proper way to return a 404 is with a 404 status code and some content that indicates that the requested page is not available. But the key thing is to return Real 404 HTTP status code and avoid any solution that replaces 404 with 301. This is completely wrong and has a potential to do damage to your site.

How to do this? Well, as always in IT there are different ways. Here's how I usually do it.

Add this to web.config:

<system.webServer>
    <httpErrors errorMode="Custom" existingResponse="Replace">
      <remove statusCode="404" />
      <error statusCode="404" responseMode="ExecuteURL" path="/Error/NotFound" />
    </httpErrors>
  </system.webServer>

Create a new Error controller with a NotFound Action:

Read More

Direct social sharing URLs

There are cases when you don't want to add some plugin to your blog or to the website you're building simply to have social sharing links on your site.

You might also want to be in full control of your design.

In cases like these it's hand to have a set of commonly used social links.

So, here hey are.

Facebook

https://www.facebook.com/sharer/sharer.php?u={siteUrl}

Twitter

https://twitter.com/intent/tweet?url={siteUrl}&via=DomagojSalopek&text={socialTitle}

Documentation

Google Plus

https://plus.google.com/share?url={siteUrl}

Documentation

Linked In

https://www.linkedin.com/cws/share?url=@fullUrl

Pinterest

https://pinterest.com/pin/create/bookmarklet/?media={socialImage}&url={siteUrl}&is_video=false&description={socialTitle}
Read More

Getting started with Virtualization - Create a Ubuntu Virtual Machine

This will be brief but (excuse me for saying so myself) a cool little blog post about getting started with virtualization. We'll get into an example right away and some minutes from now you'll be testing your website in real IE6 on a virtual machine. Don't care about IE6? Fine, later in the article we'll quickly create our own little machine where you can install any software you might find useful.

We'll install Ubuntu. Why? Because it's free and cool.

Read More
SEO

SEO for Developers

Hey, you! Thanks for visiting. I don't know if you found this website via a search engine or by social media link or whatever, but thank you for stopping by. As a matter of fact, this will be the topic of our little post: how to improve your SEO, from the technical side of things.

This will be the post about what you as developers can do about SEO. We'll stay on the technical side of the equation, and leave the "snake oil salesmanship" to so-called "SEO experts, gurus and rockstars". Therefore we'll only mention the things that are proven to be SEO-friendly, and much more important than that, we'll see how you can implement those things using some popular Web Development technologies.

Read More

Create a simple PHP MVC Framework

In this blog post we'll create a simple PHP MVC Framework from scratch. This simple framework can be used as a tool for learning the basic plot behing MVC or you can modify it and make it grow into something bigger and much more useful.

MVC?

MVC stands for "Model View Controller". MVC is a concept that enables us to separate our business logic from the presentation. One of the biggest advantages is the code reusability. There are other benefits, such as: We can let the designers edit the Views, without worrying that they will screw up database access logic.

Please note that this blog post is from 2012 and take it "as is". I'm unable to answer any questions anymore regarding the implementation. Thank you for understanding.

Read More
Server Room

Setup your own small dedicated server

In this blog post we'll do something different. We'll use an old computer to setup a dedicated web server using Ubuntu Server edition, Apache and MySQL server.

What you'll need

  • A blank CD
  • An old computer with CD drive
  • Some free time (3 hours approximately)
Read More

Introduction to URL Rewriting using IIS URL Rewrite Module and Regular Expressions

In this blog post we'll talk about URL Rewriting and how it can be done using Microsoft's IIS. Why IIS? Because there are not that many tutorials that cover that stuff. Also, some very experienced PHP developers don't know how to rewrite URLs if their page is hosted on IIS.

URL Rewriting?

URL Rewriting basically means: altering the URL's apperance without affecting behaviour of your site. But why would someone alter the apperance of an URL?

Well, there are couple of great reasons. First, of course is Search Engine Optimization (SEO). For example, compare the following URL:

http://localhost.com/blog.php?id=1

With this one:

http://localhost.com/CSS-shorthand-properties/1

What are the advantages of URL number two? It's friendlier to both users and search engines. Users can immediately tell what the blog post is about and it also helps your site to get better search engine rankings.

Read More

Create a simple Responsive Design for a blog site using CSS media queries

Responsive Web Design is basically a design done with CSS3 Media Queries that changes according to the environment a visitor uses. In other words, the design "responds" to changes.

It may sound science-fictiony, but that's what happens. And it's not complicated like it sounds. It's actually easy to create a basic Responsive design. All you need to do is play a little with CSS3 Media Queries and setting different widths for container elements.

Read More

Display locations from a database on a map using Google Maps JavaScript API and PHP

In this relatively short blog post we'll use PHP/MySQL and Google Maps Javascript API to display locations from a MySQL database on a map.

We'll make a simple "City guide to Zagreb", meaning we'll select interesting locations from the database, display them on a map, show some info about them and show directions from user's current position to a location of his/her choice.

What you'll need

  • PHP/MySQL Development Environment
  • Some understanding of JavaScript
  • Some free time

As you can see it's really easy to get started. So, let's do it!

Read More