[ This is a content summary only. Visit our website http://ift.tt/1b4YgHQ for full links, other content, and more! ]
by Irfan Ahmad via Digital Information World
"Mr Branding" is a blog based on RSS for everything related to website branding and website design, it collects its posts from many sites in order to facilitate the updating to the latest technology.
To suggest any source, please contact me: Taha.baba@consultant.com
Table of Contents How to select POJOs with a CriteriaQuery Problem Solution Source Code Learn More Summary Comments The Criteria API provides a type-safe way to define queries programmatically. Similar to JPQL, you can use it to select a set of entity attributes and map each result set record to a POJO. The Criteria API […]
Continue reading %How to Select POJOs with a CriteriaQuery%
This article is part of a series created in partnership with SiteGround. Thank you for supporting the partners who make SitePoint possible.
As of March 2017, images make up over 65% of web content.
This is not surprising: images add beauty, communicate messages, tell stories and create connections with your website visitors.
The flip side is that, if not used correctly, images are often the main cause of a slow website and poor user experience.
Using images correctly on the web mainly involves two things:
In this article, I discuss the first point. In particular, I introduce the image formats that work best on the web and what kind of images they are most suitable for.
But before I go any further, let's briefly clarify some terminology.
Raster or bitmap images are made of a two-dimensional grid of pixels. Each pixel stores color and transparency values.
Raster images don't scale very well: if you enlarge a raster image, it will lose sharpness and quality. Popular raster image types for the web are JPEG or JPG, GIF and PNG formats.
Here are two raster images (JPG) of an apple. The first one is the image at its natural size. The second one shows a detail of an enlarged version of the same image
[caption id="attachment_151788" align="alignleft" width="300"] Detail of raster image enlarged well over its natural size.[/caption]
Notice the degradation of the enlarged version of the image with respect to the original copy.
By contrast, vector images are made of lines, shapes, and path points. Information for vectors are not stored in pixels. Rather, they are stored in mathematical drawing instructions, which are completely pixel-independent. Alex Walker puts it very well as he refers to SVG, the most popular vector format for the web, as follows:
SVG isn’t an image format — it’s more of an image recipe.
One implication of being resolution-independent is that you can scale vector images to your heart's content: they will always look crisp and awesome, perfect for retina screens.
[caption id="attachment_151796" align="alignleft" width="300"] Detail of enlarged SVG graphic.[/caption]
Both images above are views of the same vector graphic, but in the second one, the vector is rendered at more than double the size with respect to the first. Yet, there is no loss of quality.
Continue reading %What Is the Right Image Format for Your Website?%
Table of Contents JavaScript Operators Assignment Operators Arithmetic Operators Addition Subtraction Multiplication Division Modulus Increment Decrement Comparison Operators Equal Strict Equal Not Equal Strict Not Equal Less Than Less Than or Equal To Greater Than Greater Than or Equal To Logical Operators And Or Not Operator Precedence Conditional Statements If / Else If Else Else […]
Continue reading %Back to Basics: JavaScript Operators, Conditionals & Functions%
This article is part of a series created in partnership with SiteGround. Thank you for supporting the partners who make SitePoint possible.
Version control is an integral part of the web development workflow, and it is no less necessary with WordPress sites. However, getting a WordPress site set up with version control, or more specifically, with Git, can be challenging in several ways. Knowing what to commit to your Git repositories and what to ignore can be challenging. Syncing database changes can be similarly so. And WordPress, with its ease of updates and additions straight to live sites, makes it incredibly easy to update the live site directly, disrupting the version control process.
Below are a few options for using Git with WordPress, some information about VersionPress, the well known Git plugin, as well as a brief mention of hosting-based Git implementations.
Using Git with WordPress can be a challenge. Here are a few tips that can get you going the right direction (note that these tips are assuming you already have a basic familiarity with Git):
Regarding your database connection, you should do one of two things: Either use the same exact database name and credentials in development, staging, and production environments, so that there is no difference in your wp-config.php database connection info, or else .gitignore your wp-config.php entirely so that it doesn’t get overwritten with the info from your local development environment.
Speaking of things to ignore, you should also probably .gitignore your uploads directory. It’s unnecessary to be syncing uploads, and uploads are the one thing that may be added to the production file system only, so no need to cause unnecessary sync problems!
Disabling certain abilities within WordPress can be useful as well.
define( 'AUTOMATIC_UPDATER_DISABLED', true ); to wp-config.php. This will stop the automatic updates from occurring altogether on the productions site.define( 'DISALLOW_FILE_EDIT', true ); to prevent it from being used to modify theme code and other files on the production site.wp-config.php suggestions unnecessary) on production with define( 'DISALLOW_FILE_MODS', true );. This ensures that all updates are first done in a development or staging environment, and then pushed manually to the live site.Backups created manually or by plugins should be stored somewhere outside of the Git repository (preferably to an offsite or cloud backup).
VersionPress is an alternative to traditional Git repository usage with WordPress websites. Installing VersionPress is as easy as any other plugin! As part of the installation process, VersionPress will check the prerequisites that it requires on the host system, and warn you or stop the installation if they are not present.
Continue reading %WordPress Version Control with Git%
The static site generator Jekyll is known in web design circles for being light-weight and "hacky". But that is only part of the truth. Jekyll is surprisingly powerful in terms of what you can do with it, and how user-friendly you can make it to non-technical users and clients.
In this quick tip, I will show how you can build HTML widgets that your clients or team members can easily customize and include anywhere in a Jekyll project—no Ruby plugins needed, just Liquid, the open source template language created by Shopify, and good old HTML.
There are several ways of setting variables for customization. In this article, I'll introduce two of them: the inline and Front matter methods.
Setting variables inline is the best option if there's a good chance the widget will be included more than once, say, in a blog post. In this example I'll use a PayPal button.
First, create a new file called paypal-widget.html in your _includes folder. Then, fill it with this code:
[code language="html"]
<form action="http://ift.tt/rDmnwQ" method="post" target="_top">
<input name="cmd" type="hidden" value="_s-xclick">
<input name="hosted_button_id" type="hidden" value="VALUE">
<button class="buy-button" name="submit">Buy Now</button>
<img src="http://ift.tt/rpOo6s" alt="" width="1" height="1" border="0" style="display: none !important;">
</form>
[/code]
The above example will generate a simple "Buy Now" button, allowing people to pay via PayPal. There's just one problem: the code is static and can't be customized.
The widget has two elements you will want to keep dynamic: the value of the hosted_button_id and the button label. Achieving this with inline variables is quickly done:
[code language="html"]
<form action="http://ift.tt/rDmnwQ" method="post" target="_top">
<input name="cmd" type="hidden" value="_s-xclick">
<input name="hosted_button_id" type="hidden" value="">
<button class="buy-button" name="submit"></button>
<img src="http://ift.tt/rpOo6s" alt="" width="1" height="1" border="0" style="display: none !important;">
</form>
[/code]
The variables you added are include.id and include.button. When you are ready to include the HTML widget inside, say, a Markdown post, you can simply do this:
[code language="html"]
Liquid error: This liquid context does not allow includes.
[/code]
This will create a button labeled "Buy Now | $30". You can include the same file several times in the same page, each with different include.id and include.button values, as they are set individually inline.
Continue reading %Quick Tip: How to Build Customizable HTML Widgets in Jekyll%
Laravel Socialite is a package developed to abstract away any social authentication complexities and boilerplate code into a fluent and expressive interface.
Socialite only supports Google, Facebook, Twitter, LinkedIn, Github, and Bitbucket as OAuth providers. They won't be adding any others to the list, however, there's a community-driven collection called Socialite Providers, which contains plenty of unofficial providers for Socialite. More on this in the next section.
I'll assume you already have a fresh Laravel application instance up and running on your machine, so you can see the code in action along the way. If you need a good development environment, you're free to use Homestead Improved.
Before getting into OAuth authentication, let's set up Laravel's standard form based authentication. To do this, we run the make:auth artisan command, which installs all the necessary views as well as the required authentication endpoints.
php artisan make:auth
Note We also need to run
php artisan migrateto make sure theuserstable is created.
Now, if we head over to /login, we should see a nice Bootstrap-styled login page that works.
To get started with Socialite, we install it with Composer:
composer require laravel/socialite
Once installed, Socialite's service provider and facade should be registered in config/app.php - just like with any other Laravel package.
config/app.php
<?php
// ...
'providers' => [
// ...
/*
* Package Service Providers...
*/
Laravel\Socialite\SocialiteServiceProvider::class,
],
// ...
And here's the facade alias:
<?php
// ...
'aliases' => [
// ...
'Socialite' => Laravel\Socialite\Facades\Socialite::class,
],
// ...
Socialite is registered as a lazy-loaded singleton service inside the service container.
To use any provider, we need to register an OAuth application on that provider platform. In return, we'll be given a pair of client ID and client secret keys as our credentials for interacting with the provider's API.
We need to add the credentials in config/services.php for each provider:
// ...
'facebook' => [
'client_id' => env('FB_CLIENT_ID'),
'client_secret' => env('FB_CLIENT_SECRET'),
'redirect' => env('FB_URL'),
],
'twitter' => [
'client_id' => env('TWITTER_CLIENT_ID'),
'client_secret' => env('TWITTER_CLIENT_SECRET'),
'redirect' => env('TWITTER_URL'),
],
'github' => [
'client_id' => env('GITHUB_CLIENT_ID'),
'client_secret' => env('GITHUB_CLIENT_SECRET'),
'redirect' => env('GITHUB_URL'),
],
// ...
The actual key values are put into the .env file in the project's root directory.
Since the users table structure hasn't been designed to integrate social authentications, we first need to do a few tweaks there.
Continue reading %Easily Add Social Logins to Your App with Socialite%