Servage Magazine

Information about YOUR hosting company – where we give you a clear picture of what we think and do!

Archive for June, 2015

Real-time updates from your site with Pusher

Sunday, June 28th, 2015 by Servage
pusherProviding information in real time to users is significant or even crucial to many site operators. The use cases for real time information are many, like instant notifications, chat messages, game updates, or other similar time sensitive pieces of information to be made available for the user. The traditional way It is relatively easy to query a server for updates by using AJAX requests. You basically tell the client to make a specific request for new data at a given interval. So for example every 5 seconds you request an update from the server "Are there any notifications?". As soon as one is returned, the client will render it in the browser, and ...

Recycle your design elements across the website

Tuesday, June 23rd, 2015 by Servage
code-recyclingProviding a standardized design is a fundamental part of providing a continuously great visual experience. It means that you build your web application using the same visual elements, and reuse the same code, which makes your system appear generally structured and consistent. One good help is to compartmentalize your code snippets for various elements and simply include them again and again wherever the element is needed. Clever systems allow such elements to be customized via settings passed to the element for specific use. This still allows you to use the same elements, just with differentiating settings. Sample website without elements Consider the sample website below, which has a welcome message displayed in the ...

Understand service containers in Laravel

Friday, June 19th, 2015 by Servage
service-containerThe service container concept in Laravel is one of the most misunderstood parts of the framework. It is rather complex and abstract but for the enlightened it provides great extensibility to your code and a useful way of managing class dependencies. Furthermore the service container facilitates insulation between different classes, which can be advantageous for creating more stable code. Dependency injection The class dependencies are managed via class injection, which basically means you can tell a method which class you expect, where after it will create an instance of it, if none is passed. Technically speaking this is done by type-hinting the expected class name. The code below shows an example class which loads a ...

Use popovers for information on demand

Monday, June 15th, 2015 by Servage
popoverPopovers are a neat visual element for web apps, which enables you to highlight certain functionality or provide on-screen instructions like tutorials. There are a wide range of usefull popover applications which may enhance your site. Consider the following variations: Help / Question icon located next to form fields or buttons. On click or hover, the icon triggers a popover which explains the purpose of the field or button in more detail. Upon detecting an invalid field after a form submission , a popover is used to explain the validation error for the specific field. On pageload a popover is used to highlight a specific feature by opening autotmatically, thus directing the user's attention ...

Collect data from other websites

Tuesday, June 9th, 2015 by Servage
data-scrapingSometimes web developers need to fetch data from other sources for their own databases or websites. This process may be for simple tasks like including some external content on your own page, or be more complex by feeding data to own algorithms that perform complex calculations. In more practical examples the simple scenario is collecting content from other pages, where the more complex one is systematically crawling the web for relevant information.  News aggregators for example continuously collect and display content from other pages in their own feeds. The intention is not to steal external content, but to facilitate their overview of current news, and linking users back to the original ...

Understand service providers in Laravel

Thursday, June 4th, 2015 by Servage
service-providersThe so called service providers are the heartbeat of your Laravel application. They are the central element of the initialization process where all the relevant and required code is loaded by PHP. This includes all the essentials from the framework itself, but also any own and custom code you need to load. Bootstrap service providers During the initializing process the code bootstraps itself. That means it gets ready to go by registering service container bignings, event listeners, middleware, configuration and routes. Service providers are therefore a central place to setup your application. In the config/app.php you will find an array of providers listing all the service provider classes that are loaded during bootstrapping. ...