How to Make a Website Pixel Perfect

How to Make a Website Pixel Perfect

Check out some tricks for designing testing by using various way with Responsive and Resizing.

  • Fields used in any pages like textbox, radio buttons, drop-down etc. lists should be aligned properly either by Left or Right.
  • Values used As Numeric should be right justified unless specified.
  • Spaces between Each Error or validation messages, Columns, Rows should be consistent for all pages
  • Check for Scrollbar which should be enabled only when necessary…
  • Font Family, size, style and colour for the headline, description text, labels, Input data should be as per the standard requirement. For Testing – Use ColorZilla, WhatFont Add-ons.
  • Text box for Description should be multi-line for the end user.
  • When the fields are disabled it should be greyed & non – clickable.
  • On click on an input text field, mouse arrow should be a cursor.
  • Input values filled by users should be highlighted when there is an error or validation message on page submission. After correcting the errors user should be able to submit the form.
  • Dropdown list options or values are readable and should not be truncated due to field size limit.
  • Page Content should be left justified.
  • The user can select only one radio option and any combination of check boxes.
  • Check design should be compatible in different browsers with different OS.
  • Alignment from top to bottom(Header to footer) and left to right should be proper.
  • Buttons or Links to different pages should be easily visible and consistent on all web pages
  • Hover and select effect on fields, links, button etc. should be consistent and highlight properly.
  • Check Images for the different section should be displayed properly and should resize as per required size for a section.Check by uploading different size of image, Also by Portrait & Landscape images
  • Check editor works as expected with front CSS.
  • Check sections size or Image size using scaling and measurement tools. For Testing – Use PageRuler, Measureit  Add-ons.
  • Check responsive design and make sure website works on multiple devices. Text, images, blocks etc. should not display out of the screen. For Testing: Use Resize Window, Emulator, Device Mode
  • Menus should design properly for responsive or devices and should be consistent on all pages. Also, check Menu in responsive view, it should display with Hamburger icon.
  • Check content should not be overlapped by section or block and should not go outside across the block on devices.
  • Also, We can follow the design testing as per W3C standard format using this, it shows all the errors & warning related to web design service standard.

Add-ons for testing design for different purposes:

  • Responsive Testing – Resize Window, Simulator, Emulator, Device Mode
  • Text, Images, Frames – ColorZilla, WhatFont, Perfect Pixel
  • Section, Image Size – Page Ruler, MeasurIt
  • W3C HTML Checker
  • Javascript errors notifiers

Hope this blog helped you in making your website work flawlessly and you can also refer our website testing blog. Feel free to provide your vital feedbacks, suggestions are welcomed!

Original Post: AddWeb Solution

Advertisements

How to Increase WordPress Site Performance

How to Increase WordPress Site Performance
Nowadays everyone wants the site they are accessing should be faster. No one wants to wait till the site gets loaded. Because of this, it has become a necessity to improve our site performance as much as possible.
To increase WordPress site performance we need to take care of following things from professional WordPress developers:
1) Host
When you selecting any host for your site, you need to keep following things in your mind:
  • Your hosting should be capable to respond quickly. Response time will be vary based on server i.e. server response time of Apache is differ
  • Your hosting should be able to handle multiple requests at a time. It should be slow down while there is heavy traffic.
2) WordPress Theme
  • A theme which you select for your WordPress site is also responsible for the performance of your site.
  • Your theme should be lightweight and quite speedy.
  • The theme should not unnecessary images in theme, all image should be optimized.
  • A number of files should be less to display the page on your site. For that, we need to combine multiple CSS into a single file. The file should be optimized.
  • You should minify your CSS and javascript.
3) Use Effective Caching
  • Caching is the process of storing data in cache memory.
  • Cache is a temporary storage area. Whenever you request for a page first time, it will save it in the cache memory and then second time onwards server will serve this page from a cache memory. By this way, it will save your execution time and network burden of additional traffic.
There are many plugins available for WordPress like W3 Total CacheWp Super Cache, etc.
 
4) Optimize Images
  • Your site should have a way to optimize an image. If user uploads image with heavy file size, then it will affect your page load time. So as a solution, you should have installed a plugin which will optimize an image to reduce file size not reducing quality.
  • There are many plugins available for this like Wp-SmushItOptimus, etc.
5) Add an Expires Header to Static Resources
  • An Expires header is a way to specify a time far enough in the future so that the clients (browsers) don’t have to re-fetch any static content such as CSS file, javascript, images etc. This will help you to reduce load time for the regular user of your site.
  • You just need to add following code in your root .htaccess file:
ExpiresActive On
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
6) Add LazyLoad to your Image
  • LazyLoad is the process of having only the images visible in the visitor’s browser window, then, when reader scrolls down, the other images begin to load, just before they come into view.
  • As a result, it will increase your page load time as well as it will save your bandwidth because you are loading less data for users who don’t scroll all the way down on your page.
  • There are many plugins available to implement this functionality, like jQuery Image LazyLoadLazy Load, etc
7) Disable Hotlinking and Leaching of Your Content
  • Hotlinking means, you are loading content from another site like google fonts, some images etc.
  • This will increase your bandwidth and page speed.
  • To overcome this situation, load content as much from your site only. Download external content in your site and load it from there.
8) Remove Unnecessary Plugins
Remove all inactive plugins from your site. You should also remove duplicate plugins(more than one plugin for the same purpose).
By doing this it will not load assets( like CSS, js, etc) of that plugins in your page or it will not perform and process which plugins does before page load.
9) Enable Gzip Compression
Enabling gzip compression on your site will dramatically reduce the amount of data sent from your server to the visitor’s browsers, thus increasing the page-load speed.
Hope this blog helps you out. Hire WordPress Developer to improve your WordPress website’s performance.

Building Custom Solr Query

Building Custom Solr Query

Solr search has great performance, is suitable even for use on large commercial websites and supports facets and multi-index searches. What if we want to build your own query or get all indexed nodes programmatically?

Yes, building the custom query for Solr content will solve the problem.

Benefits of custom Solr Query

  1. Reduces load time.
  2. Custom filters.

1. Initialize solr api query using your index name

// To get index field value
$public_index = “Name of your Index”
$index = search_api_index_load($public_index);
$query = new SearchApiQuery($index);

2. Building filter, you can add multiple filters in your query

// Build a filter.
$node_filter = $query->createFilter('AND');
$node_filter->condition('type', 'content_type', '=');
$node_filter->condition('status', NODE_PUBLISHED, '=');

3. Adding filters to query

// Added filter in query.
$filter->filter($node_filter);
$query->filter($filter);

4. Fetch results of custom query

// Fetch results.
$results = $query->execute()['results'];
$arr_nodes = array_keys(return $arr_node$results);
Hope this helped you to get most out of the system, feel free to share your reviews and Pick the best answer for your requirements.

Original Post: Building Custom Solr Query

Introduction To Bootstrap Paragraph Drupal 8

Bootstrap Paragraph Drupal 8

Paragraphs

Paragraphs are one of the modules that make site builder and end users more powerful. Paragraph module does this by replacing one big WYSIWYG with predefined paragraph types. Paragraph module utilizes entity reference field to reference paragraph types. Paragraphs are basically entities so users get control over fields and theming of the paragraph.

Bootstrap 

Bootstrap is sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development. Bootstrap has become one of the most popular front-end frameworks and open source projects in the world.

A combination of these two is “Bootstrap Paragraph” module.

“The Bootstrap Paragraphs module provides a suite of content and layout Paragraph bundles made with the Bootstrap front-end framework.”

Using bootstrap paragraph module, it is very easy to create features like an accordion, modals, tabs, multi-column layouts, and many more things.

The module has multiple dependencies including paragraphs, Entity reference revisionscontact formatter to name a few. The module also needs Bootstrap framework’s js and CSS added in site theme. Installing this module via composer could be beneficial.

Module installation follows a standard process. The module comes with predefined paragraph bundles which can be accessed from /admin/structure/paragraphs_type. These paragraph bundles are divided into 2 main categories:

Content bundles

  • Simple HTML
  • Image
  • Blank
  • Contact Form
  • Drupal Block
  • View

Layout bundles

  • Accordion
  • Carousel
  • Columns (Even, up to 6)
  • Columns (3 Uneven)
  • Columns (2 Uneven)
  • Modal
  • Tabs

Each paragraph type comes with 2 options:

Width and background color

Bootstrap Paragraph Drupal 8

Over 50 background colors are already defined. Empty background classes are also available to customize based on your theme. These classes are :

  • .paragraph–color–primary
  • .paragraph–color–secondary
  • .paragraph–color–success
  • .paragraph–color–info
  • .paragraph–color–warning
  • .paragraph–color–danger

Predefined width options include following:

  • Tiny – col-4, offset-4
  • Narrow – col-6, offset-3
  • Medium – col-8, offset-2
  • Wide – col-10, offset-1
  • Full – col-12

To use these paragraph bundles, an entity reference field referencing to paragraph needs to be added to a content type. This field can have unlimited value to allow site builders to add as many paragraphs as they want. Once set you can start creating content. With this module, you can place a piece of content in your own structured page.

Additional Features

  • Paragraphs and fields are saved in the database. This means that whatever changes are made in them are also in the database.
  • Theme CSS gets precedence over module CSS. You can copy template files in theme from a module and overwrite CSS as you desire.
  • The module can be uninstalled without losing paragraphs and CSS. You need to move all templates and CSS to your theme. Remove “attach_library” calls from template files and call CSS from theme’s library.
  • You can use this module to create reusable paragraph bundles via a module.

To summarize, Bootstrap paragraph module is a suite of Paragraph bundles made with the Bootstrap framework. With this module, you can easily position chunks of content (Paragraph bundles) within a structured layout of your own design.

Hope this blog helped you and explore more about Paragraphs also need assistance for Drupal 8 Services then get in touch with us Feel free to share feedback.

Original Post: Introduction to Bootstrap Paragraph Drupal 8

Understand Laravel Eloquent Relationships

ND- May

Laravel relationship tables are often connected to one another in the database.
Laravel support different types of relationships and it’s easily working and managing data.
Hire Laravel Developer because Laravel provides powerful query builder for the defined relationship for Database tables and relationship Eloquent model provides capabilities for querying and powerful chaining method.

Defining Relationships:-

  • One to One
  • One to Many
  • Many to Many
  • Has Many Through
  • Polymorphic Relations
  • Many To Many Polymorphic Relations

One to One:-

One to One is a basic relation in the relationship of database tables. In this relationship hasOne() method call and return result value :

Understand Laravel Eloquent Relationships
  • In hasOne method first argument passed is the name of the related model. Once a relationship is defined, we use Eloquent dynamic properties for retrieve related records.
  • Relationship model automatically assumes foreign key to id. if we wish to override or pass the third argument to specify your custom key.

    return $this->hasOne(‘App\Demo, ‘foreign_key’, ‘local_key’);

  • Now, we can access Demo model to our Test model. We can define belongsTo() method in Test model for access relationship Demo model.
Understand Laravel Eloquent Relationships

One to Many:-

One to Many relationships is defined in a single model to use relationships other models data.

Understand Laravel Eloquent Relationships
  • This relationship defined to hasMany() method.
  • In this relationship, we can create a relationship in a single model same as One to One inverse model. After defining relationship we can retrieve demo model for the exam.

Many to Many:-

  • Many to Many relations are a little complex to hasOne and hasMany relationships.
  • This relationship is defined by ‘belongsToMany’ method.
Understand Laravel Eloquent Relationships
  • After defining relationship you can access student’s exams using dynamic property exam.
  • You can use chaining query constraints on this relationship.
  • You can simply call belongsToMany() on your related model when inverse of Many to Many relationships.
Understand Laravel Eloquent Relationships
  • In this relationship you can see both models counterpart are same because we are reusing the belongsToMany() on this models

Has Many Through:

  • Many convenient shortcuts are used to access distance relations in this relationship and all convenient shortcuts are provided by Has Many Through relationship.
  • Now, we can define Has Many Through relationship in Demo model.
Understand Laravel Eloquent Relationships
  • In above example first argument and second argument pass in hasManyThrough() method is the name of the final method and intermediate model name.

Polymorphic Relations:

  • Single associated model is allowed to belong more than one another model in Polymorphic relationship.
  • This relation provides a custom Polymorphic relation
Understand Laravel Eloquent Relationships
  • You can register morphMap() in boot function in AppServiceProvider or Create a separate service.
  • The model structure is Build a relationship in Polymorphic relationship.
Understand Laravel Eloquent Relationships
  • The polymorphic relation is a great deal to save time and share particular features.

Many To Many Polymorphic Relations:

  • Many To Many Polymorphic Relation Is defined in traditional polymorphic relations. For example, teacher and exam model is shared a polymorphic relation with a demo model.
  • It can allow you to unique tags in a single list and that shared in teacher and exam models.
  • Model structure of this relationship is based on Eloquent class.
Understand Laravel Eloquent Relationships
  • After that inverse of the relationship of exams model. So you can define its related models and define teacher and test method in below example :
Understand Laravel Eloquent Relationships

OctoberCMS – How Component Works?

OctoberCMS - How Component works?
What is Component?
A component is a part or identifiable of larger program or construction of web application. A component is a nontrivial, nearly independent, and replaceable part of a system that fulfills a clear function in the context of a well-defined architecture.
Usually, a component provides a particular function or group of related functions. Components are configurable building elements that can be attached to any page, partial or layout. Components are key features of October. Each component implements some functionality that extends your website.
 
Why Use?
Components can output HTML markup on a page, but it is not necessary – other important features of components are handling AJAX requests, handling form postbacks and handling the page execution cycle, that allows to inject variables into pages or implement the website security in OctoberCMS Builder.
How to Defines and Use?
If you use the back-end user interface you can add components to your pages, partials, and layouts by clicking the component in the Components panel. If you use a text editor you can attach a component to a page or layout by adding its name to the Configuration section of the template file. The next example demonstrates how to add a demo To-do component to a page:
    title = "Components demonstration"
    url = "/components"

    [demoTodo]
    maxItems = 20
    ==
    ...
Here, the [demoTodo] defines the component alias with demoTodo name defines when registering the components into registerComponents() method of plugins.php file.
Also, we can initialize component with properties that’s defines a component as per we have gives maxItems property. Many components have properties, but it is not a requirement. Some properties are required, and some properties have default values.
Components that provide HTML markup can be rendered on a page with the {% component %} tag, like this:
    {% component 'demoTodo' %}

If you define two components with the same name are assigned to page and layout together, the page components override any properties of the layout components.
Components Alias:
If there are two plugins that register components with the same name, you can attach a component by using its fully qualified class name and assigning it an alias:
[October\Demo\Components\Todo demoTodoAlias]
maxItems = 20
The first parameter in the section is the class name, the second is the component alias name that will be used when attached to the page.
If you specified a component alias you should use it everywhere in the page code when you refer to the component. Like this:
    {% component 'demoTodoAlias' %}
The aliases also allow you to define multiple components of the same class on the same page by using the short name first and an alias second.
    [demoTodo todoA]
    maxItems = 10
    [demoTodo todoB]
    maxItems = 20
Passing variable to Component:
Components can be designed to use variables at the time they are rendered, similar to Partial variables, they can be specified after the component name in the {% component %} tag.
Like this : {% component 'demoTodoAlias' maxItems='7' %}
Hope this helped you to know how components work in OctoberCMS. Here’s an informative blog regarding OctoberCMS Plugin Development.

Know How To Use SQLite In Ionic 2

Know How To Use SQLite In Ionic 2

Ionic 2

Ionic 2 is the upgraded version of ionic 1 and it has a lot of differences in it than the earlier one. Typescripts are introduced in this as well. Some new components are also included in ionic 2.

Let’s talk about the backend database with ionic 2. Nowadays requirements for offline application is becoming more popular. People want to have a quick and very much accurate application with or without internet connectivity. SQLite is a phenomenon, which can be useful in providing such feature.

SQLite

SQLite is a software library that implements SQL operations using SQL database engine. SQLite is the widely deployed SQL database engine in the world.

SQLite is a local storage for the applications, SQLite is used for storing data similarly we store data in server-side websites using MySQL. SQLite provides the similar functions and queries as we have in MySQL

SQLite provides faster access to the data in an application. One can fetch the data from the server and can save in SQLite database so that later on we can use it from SQLite only because of which application’s performance will good rather than normal application.

Note: SQLite stores its database on the local device so that you can’t find your data in another device also due to this the size of an application is also got increased.

Why we use SQLite 

  • In case you’re unfamiliar with local storage, it is key-value storage within your application.
  • This makes it difficult to query for data when you have a lot of it.
  • Not only is their query difficulties, but there are limitations. And local storage has a limitation of 10MB of data.

These reasons are what makes SQLite a better choice if we compare it against local storage.

Connection with SQLite 

For using SQLite in our application we need to add the SQLite plugin given by Cordova in our ionic v2 application. It can be added via the following:

$ ionic plugin add cordova-sqlite-storage
$ npm install –save @ionic-native/sqlite

pages/home/home.ts

import {Component} from '@angular/core';
import {NavController, Platform} from 'ionic-angular';
import {SQLite} from "ionic-native";
import { AddNote } from '../addnote/addnote';
@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {
  public database: SQLite;
  public people: Array<Object>;
  addnote = AddNote;
  public username:any;
  public password:any;
  constructor(private navController: NavController, private platform: Platform) {
      this.platform.ready().then(() => {
          this.database = new SQLite();
          this.database.openDatabase({
            name: "data.db",
             location: "default"
           }).then((data) => {
              this.database.executeSql("CREATE TABLE IF NOT EXISTS people (id INTEGER PRIMARY KEY AUTOINCREMENT, firstname TEXT, lastname TEXT)", {})
                .then((data) => {
                    console.log("TABLE CREATED: ", data);
                   alert('db and table created ');
                }, (error) => {
                    console.error("Unable to execute sql", error);
                })
            }, (error) => {
                console.error("Unable to open database", error);
            });
      });
  }
  public add() {
    this.database.executeSql("INSERT INTO userdata (firstname, lastname) VALUES ('"+this.firstname+"', '"+this.lastname+"')", []).then((data) => {
            console.log("INSERTED: " + JSON.stringify(data));
            alert(JSON.stringify(data));

        }, (error) => {
            console.log("ERROR: " + JSON.stringify(error.err));
        });
  }
  Public select() {
       this.database.executeSql("SELECT * FROM userdata", []).then((data) => {
           this.people = [];
           if(data.rows.length > 0) {
               for(var i = 0; i < data.rows.length; i++) {
                   this.people.push({firstname: data.rows.item(i).firstname, lastname: data.rows.item(i).lastname});
                 }
           }
       }, (error) => {
           console.log("ERROR: " + JSON.stringify(error));
       });
   }

Here, in the platform.ready() function, we will create a new database and it will store in device, openDatabase() is a function for opening database, it has two cases if the Database does not exist then, it will create the DB and open it and if it already exists then, it will open that one. deleteDatabase() delete the database.  add() function will add the firstname and lastname in userdata table. executeSql() Execute SQL on the opened database.

Note, you must open/create DB first, and ensure it resolved and successfully opened.

pages/home/home.html

<ion-content padding>
  <ion-item>
      <ion-input type="text" name="title"  placeholder="Firstname" [(ngModel)]="firstname"  required></ion-input>
  </ion-item>
  <ion-item>
     <ion-input type="text" placeholder="Lastname" [(ngModel)]="lastname" required></ion-input>
   </ion-item>
<button ion-button (click)="add()">Add</button>  <button ion-button (click)="select()">Select</button>

  <ion-card *ngFor="let peopl of people ">
      
{{peopl.firstname}}
     
{{peopl.lastname}}
  </ion-card> </ion-content>

Note: Access SQLite databases on the device.

Feel free to review this document for more details. Leave your vital feedback and we are readily available for any query resolving. Hope you had a quick solution for your purpose, feel free to Hire our Hybrid App Development service, provider.