Search blog

Friday, December 29, 2017

You could try adding a line to /etc/rc.local that will set the desired brightness level. To edit the file, run

sudo -H gedit /etc/rc.local

and add the following

echo X > /sys/class/backlight/intel_backlight/brightness

so that the end result looks like this

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
echo X > /sys/class/backlight/intel_backlight/brightness
exit 0

Substitute X by the desired brightness level.

PS: Alternatively, there may be /sys/class/backlight/acpi_video0/brightness instead of the above. Brightness levels vary wildly, and may range from 0 to 10 or to 1000. To find the maximum value, try

Sunday, November 26, 2017

>> Inventory

It is global across all the websites and stores. Either the product is IN STOCK or Not! If you need different inventories, you will have to use third party modules.

>> Fundamental Concept

A single installation of Magento can have multiple stores that share the same Admin. Multiple stores can share the same domain, be set up as subdomains of the same domain, or have entirely different domains. Stores that have the same IP address and domain, use the same security certificate, and share a single checkout process. If you want each store to have a dedicated checkout process under its own domain, each store must have a distinct IP address with a separate security certificate. Here are some examples of how URLs can be configured for multiple stores:

yourdomain.com/store1 - Each store has a different path, but shares the same domain.

yourdomain.com/store

store1.yourdomain.com - Each store has a different subdomain of the primary domain.

store2.yourdomain.com

store1.com - Each store has a dedicated domain.

store2.com

The important thing to understand is that the stores uses the same Magento code, shares the same Admin, and catalog. They can, however, have different identities, product selections, and themes.

The multi-store feature is one of the most important and powerful feature of Magento. (Multi store is also known as multi site.) It allows growing businesses to manage multiple websites and stores through one Magento installation under a single admin panel.

The primary purpose behind the Magento Store layer is the ability to sell various different products, structured within different categories to the same user base with the same checkout parameters.

Because the Magento Store Layer requires that you create a new Magento Store View you will have all of the functionality of the aforementioned, plus some additional functionality.

Magento uses the terminology of GWS (Global, Website, Store) to explain the ability to create multiple websites and stores through one installation. There is one more part called Store View that is added to each Magento installation automatically.

The three components of GWS are explained below:

Global refers to the complete installation of Magento

Website is the domain you are utilizing. Each domain or website can have multiple stores, while you can also have multiple domains on a single installation

Stores are your actual product catalogue. Multiple stores can be created on a single domain or more than one domains

And while we are at it, I think it would be wise to explain the Store Views term too. Store Views can be defined as the multiple presentation of your front-end data. Most e-Commerce stores use this feature to have stores in multiple languages.

Click on image to enlarge

The only use of Magento Store View is for multi- language or different theme design. You will typically have one Store View per language.

>> Magento Multi Store

>>> Features that CANNOT be implemented in a multi-store:

Payment Method: You will not be able to have specific payment methods for each Store

Shipping Method: You will not be able to have separate shipping methods for each Store

Products:

You cannot change the tax structures within Stores

You cannot manage a separate inventory with Stores

Configuration Settings: You will not be able to manage ANY configuration settings between Stores

>>> Features that CAN be implemented in a multi-store:

Products: You will be able to manage a completely different catalog between Store

Categories: You will be able to manage a completely different category structure for each Store

Stores are ‘children’ of websites. They are your actual product catalog. Products and Categories are managed on the store level. A root category is configured for each store. They are your actual product catalog. Products and Categories are managed on the store level.

>> Multiple Magento Websites

The primary purpose behind the Magento Website layer is the ability to change every aspect of the customer experience, including the ability to manage a completely different set of customers for each Website.

In mutli-website — From one administration you can manage a few shops.

There’s essentially nothing that you cannot do with multiple Magento Websites. From the reporting and orders to the customer base and checkout configurations, you can manage everything with different parameters. Basically Multiple Magento Website is just like Multi-site in Drupal.

>> When to use Magento Multiple Website?

If you want to sell your products in several stores and have to change one of the following criteria in these shops, then you have to go for different websites:

different price

different tax classes

different (base) currencies

different payment options

different shipping options

>> If you just create store groups, your customers will be able to log in to all shops with the same credentials whether you like it or not.

>> If you create websites, it's up to you whether your customers can log in to all shops with the same credentials.

>> Conceptual Example

Imagine that you sell electronics, software and DVDs. For that you want to create 3 websites. You would like them on separate subdomains, so we have companyname.com/electornics, companyname.com/software and companyname.com/dvds.

In companyname.com/electornics store you would like to sell mobile devices and computers, thus you create 2 separate stores for them - Mobiles and Computers. Each of them has lots of categories and subcategories, so it makes sense to create separate category tree with own root category for each. From one website your clients can switch between the stores.

Additionally, Mobile phones you you need to be available in English and Spanish and Computers in English, Spanish and French. Thus, for ‘Mobiles’ you create 2 store views and for ‘Computers’ 3 Magento store views.

The following scheme illustrates the mentioned above:

Click on image to enlarge

WARNING!!!

When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third party services (e.g. PayPal etc.). – Setting s can be found at: Store >> Config >> General >> Web

Wednesday, November 15, 2017

In some cases, you might have two PHP configuration files: one for the PHP command line and for the web server. If so, make the change in both php.ini files.

1. To Edit web server's php.ini file

Open any text editor of you choice like Gedit and Copy/Paste the following PHP code and Save the file as 'info.php' inside the Document Root folder of your Web Server. Usually the path to your Document Root should be something like '/var/www/html/'. Make sure to save your file under the 'html' folder.

<?php
phpinfo();
?>

Now access this file from a browser using the following URL: http://localhost/info.php

You should be seeing a page open as shown in the image below. The path to your 'php.ini' file will be under Loaded Configuration File. In my case the path was as follows: Loaded Configuration File/etc/php/5.6/apache2/php.ini

Click on image to enlarge

2. To Edit CLI's 'php.ini' file

Open your Terminal (CTRL+ALT+T) and enter the following command:

php --ini

You should get output as shown in the image below. Here too you should be looking for the Loaded Configuration File path. In my case it was /etc/php/5.6/cli/php.ini.

Sunday, November 12, 2017

Type juggling and type casting can be used to change a value's type. While programming, it's important to know the type of the value and use type casting or juggling to convert it to compatible types.

Type Juggling:

When PHP converts a value from one type of value to another, it is called type juggling. PHP does not require (or support) explicit type definition in variable declaration; a variable's type is determined by the context in which the variable is used. That is to say, if a string value is assigned to variable $var, $var becomes a string. If an integer value is then assigned to $var, it becomes an integer.

Type Casting:

When you explicitly set a type to change the value into another type, it is called type casting. PHP is a loosely typed language and assigns types to variables depending what is assigned to it. Variables coming from get/post and cookies etc are generally cast as strings rather than other types and there are often other times when you need to specifically cast a type in PHP as e.g. an integer.

An example of this in action is as follows, where $foo starts off as a string value and is then cast into an integer:

Tuesday, October 10, 2017

Follow the instructions below, if you would like to allow access to your localhost website amongst your peers in the same Local Area Network:

1. First, you may create a Virtual Host for your local website. To learn how to create virtual host in your localhost, you can go through my following tutorials. If you make use of virtual host then you can use local domain name such as http://wordpress.local or http://drupal.local etc. If you do not make use of localhost then

Monday, October 9, 2017

While working on WD My Cloud and trying to set up its Cloud Service I had to configure Port Forwarding to enable its Cloud Access service. Unless Port Forwarding was configured, using it's Cloud Service didn't seem to be possible. And that's when I had to research on Port Forwarding. Without setting up Port Forwarding, the connection status displayed at WD's Admin Dashboard was as follows:
"Connected: Relay connection established"

Although, while at college I'd to study subjects such as Data Communication & Computer Networking, where topics such as Port Forwarding etc are covered; since my work doesn't involve Computer Networks I seem to have forgotten the concept.

Anyway here are some wonderful explanation I found related to Port Forwarding.

1. What is Port Forwarding?
Ans: In simple concept, Port is not a physical connection but its a logical connection that is used by programs and services to exchange information.

Monday, September 25, 2017

Using the code below you can disable access to your WordPress Dashboard/Backend for selected roles and users belonging to that particular role. For example, if you want to restrict dashboard access to your guest users and users belonging to 'Subscriber' role then you may add the following code in your theme's function.php file or best way is to use the Code Snippet plugin.
There are many added benefits, which you can read in the plugin's description page, when you use Code Snippet instead of directly inserting your code into your theme's function.php file.

Saturday, September 16, 2017

You can reset the AUTO_INCREMENT value in MySQL either by using a SQL command or by using phpMyAdmin.

NOTE: You cannot reset the counter to a value less than or equal to the value that is currently in use. For both InnoDB and MyISAM, if the value is less than or equal to the maximum value currently in the AUTO_INCREMENT column, the value is reset to the current maximum AUTO_INCREMENT column value plus one.

To reset the Primary Key Value to 1, you should either delete the table and create a new table or TRUNCATE the table and apply the command below. But DON'T do this, if you already have data in your table.

1. Using SQL Command:

ALTER TABLE table_name AUTO_INCREMENT =1;

where,
- table_name is the name of the table whose AUTO_INCREMENT value you want to reset.

2. Using phpMyAdmin Operation:
- First open the table whose AUTO_INCREMENT value you would like to reset.
- Once inside the table click on the Operation tabs as shown in the image below.

As you must have noticed in the comments, in the Github page of the above code; you may have to add the following line of code just before the foreach loop at line number 222; which is basically, you are initializing the value of $i to 1.

$i = 1; //

Copy the above code and add it to your 'bp-custom.php' file. If this file already exists in your site then it should be located at 'wp-contents/plugins/bp-custom.php'; else you have to create it and place it at the aforementioned location. You can read more about 'bp-custom.php' file here: http://bit.ly/2y3IQak. There you will be able to understand why it's best to add the above code in your 'bp-custom.php' file and not in your theme's 'function.php' file.

Now, open the following link to access the Country List. Suppose, your site name is www.example.com, then you will have to enter: http://www.example.com/wp-admin/users.php?page=bp-profile-setup. You should now be able to view a Country List field as shown in the image below:

NOTE:
- Once you are able to view the Country List in your Profile Fields page you may remove the above code from your 'bp-custom.php' file, else your 'bp_xprofile_fields' table, which is the table that stores the above country list might go on getting unnecessarily populated with the all the above 193 country names.
- Only edit your field after removing the above code from your bp-custom.php file for aforementioned reasons.
- If you would like to have the Delete option for this field in your Profile Fields Admin Page, then change line 14 as below:

'can_delete' => true,

- Likewise you can also alter the value of the 'name' and 'description' fields in the code itself.

Saturday, August 19, 2017

Use the code below to view the Name & Slug of all the User Roles of your Wordpress site. You may insert the code in the header.php or footer.php of your Theme file. After your are done using it, please do not forget to remove the code from your site.

You get this error because the exfat filesystem is not installed in Ubuntu by default. exFAT is a proprietary and patented by Microsoft.

Ubuntu 14.04 or higher

Since Ubuntu 13.10, this package is in the main repository. Just install exfat-fuse and exfat-utils:

sudo apt-get install exfat-fuse exfat-utils

Ubuntu 12.04

For ubuntu 13.04 and lower, you'll need a ppa to install the exfat support. Installation procedure:

sudo apt-get install exfat-fuse exfat-utils

If you see the error gpg: "tag:launchpad.net:2008:redacted" not a key ID: skipping during the apt-add-repository step, then you'll need to manually install the signing key and run the apt-get update and apt-get install steps after that:

Sunday, June 4, 2017

To update Magento 2.1.x to a newer version, say your current Magento installation is version 2.1.2 Community Edition, and you would like to update your Magento to the latest version 2.1.3 Community Edition, then use the following commands. Firstly open up your terminals and execute command as below:

Saturday, May 27, 2017

The 'Breaks existing package' error usually happens when you are trying to update VirtualBox from say version 5.0.x to 5.1.x. To resolve this issue you will first have to uninstall VirtualBox. Open your terminal and enter the commands below:

sudo apt-get purge virtualbox-*

Now install VirtualBox using the code below. But first find the version number of the latest VirtualBox package available by visiting the following page: https://www.virtualbox.org/wiki/Downloads. When I checked the latest VirtualBox version available was: VirtualBox 5.1.22.

sudo apt-get update
sudo apt-get install virtualbox-5.1.22

After upgrading VirtualBox you will also have to update your Extension Pack. You can download the Extension Pack from the aforementioned page.

Thursday, May 18, 2017

If your Magento site is malfunction because of enabling CSS & JavaScript merging and minification, then you can apply the solution explained in the following page: https://magento.stackexchange.com/questions/80765/how-do-i-disable-merged-css-and-js

Monday, May 15, 2017

Because of repeatedly getting the following error, W: Failed to fetch
http://archive.ubuntu.com/ubuntu/dists/trusty/Release Unable to find
expected entry 'universe/source/Sources' in Release file (Wrong
sources.list entry or malformed file); I was unable to update my source list and thus unable to install softwares from the terminal. Finally, today I managed to solved this issue and also was able to update my apt source list.

3. Click 'Select Best Server'. Ubuntu will take some time to select the best server for you. Accept it.

4. Now try running the software update again. It should work.

5. If it does not go through steps 1-4 again. This time Ubuntu will (hopefully) select a different server as the 'Best server'. Try software update again.THE KEY IS TO CHANGE THE DOWNLOAD SERVER FROM WHERE UBUNTU UPDATES ITSELF.

Thursday, May 11, 2017

The first thing you need to do when you are unable to access your Component Manager page in your Magento 2x installation is to press F12, Click on Console & view the error message displayed there. Please look at the image below:

Click on image to enlarge

The message displayed in red are the error messages(s). With this error message in hand you will begin to get some idea about the direction you need to take to troubleshoot.

Click on image to enlarge

In my case, I copied the link that was causing the Error & tried to view it in the browser. When I did that I got new error messages generated as below:

Sunday, April 23, 2017

This tutorial shows you how to connect to your Amazon EC2 Instance from your Ubunut's terminal/CLI by making use of SSH.

NOTE: if you have not installed a tool like OpenSSH in your Ubuntu system you may do so by checking out the following tutorial: http://linux-sys-adm.com/how-to-install-and-configure-ssh-on-ubuntu-server-14.04-lts-step-by-step/ or use a tool like PuTTY.

1. First down the EC2 Key Pair Private Key for your EC2 instance. To generate Key Pair, you may check the following tutorial: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html

2. Copy the Key pair (.pem) key to the location of your choice and make note of the location path. In my case, I created a folder called 'aws-keys' under my 'home' directory and placed the '.pem' file there.

3. Open your terminal & change the file/folder permission to 600 where you have stored your '.pem' key, else you will get an error as shown in the image below:

Click image to enlarge

NOTE: since you have changed 'file permission' to 600, you will have to use sudo.

$ sudo chmod -R 600 aws-keys

4. Now enter the following commands to connect to your AWS EC2 Instance:

1. When you unpack the downloaded archive, you will see that the contents have been decompressed into a sub-directory.

2. Now,change directory to the one starting with "LibreOffice_", followed by the version number and some platform information. Example:

$ cd LibreOffice_5.3.2.2_Linux_x86-64_deb

4. This directory contains a subdirectory called "DEBS". Change directory to the "DEBS" directory.

$ cd DEBS

5. Now open your terminal (CTRL+ALT+T) and enter as below.The following commands will install LibreOffice and the desktop integration packages (you may just copy and paste them into the terminal screen rather than trying to type them):

$ sudo dpkg -i *.deb

The installation process is now completed, and you should have icons for all the LibreOffice applications in your desktop's Applications/Office menu. You may also open your Unity Dash & start LibreOffice from there.

Sunday, March 26, 2017

If you are experiencing permission issues with your web directories and files, use the following commands to resolve it, This solution is very helpful if you are trying to run Wordpress/Other CMS in localhost environment:

Saturday, March 11, 2017

Use the following commands to compress your files using terminal. First, make sure you have Zip already installed in your system.

>> To install Zip: Open you terminal (CTRL+ALT+T) and enter the command below:

sudo apt-get install zip gzip tar

>> To Zip:

zip -r compressed_filename.zip foldername

where:

r: recursive

compressed_filename.zip: name of your .zip folder you want to create. Example: magento-file-sys.zip

folder_name: name of the folder that you want to compress

Seems to be much faster and consume almost 80%-90% less CPU processes than the one using GUI/Archive Manager.; but file size seems to be large by 10-20 MB than the one created using the menu option available in GUI/Archive Manager.

>> To Unzip:

unzip my_arch.zip

Zip stores relative path names by default. There are several parameter-options available for zip. For that read: the manual (man zip). For a starting this will do.

Most often you will see .tar.gz endings in linux-world. That's the product of two tools: TAR (the tape archiver) and GZIP (the GNU-Zip). Tar has got the call option to automatically gzip/gunzip files after "taring".

tar -cvzf may_arch.tar.gz my_folder

where:

-c means "create"

-v means "verbose" (sometimes bothersome and slowing down...)

-z means "use (GNU)zip"

-f XYZ declares the name of the output file. (You should chose a helping name like XYZ.tar.gz)

There may also be .tar.bz2 endings. This is the product of the -j parameter instead of the -z parameter: you will choose compression with BZIP2 (-> man bzip2).

Sunday, February 26, 2017

This tutorial explains the various steps to enable Multi-byte UTF-8 support in Drupal 7. It's a very simple and straightforward process and if implemented rightly, you can easily convert your 'character set' & collation to

According to this post in drupal.org, multi-byte UTF-8 support for MySQL and other database drivers, allows emojis, Asian symbols, mathematical symbols, etc with your Drupal 7 installation. The only caveat to this is that your Drupal installation must be at least Version 7.50 or higher.

Requirements:

Drupal: Version 7.50 or above

Initially when you check your Drupal Site Report at: admin/reports/status, you will see a message similar to the image below:

Click on image to enlarge

The steps below have been compiled from the following post at drupal.org: https://www.drupal.org/node/2754539

For MySQL

1. In order to be able to use this, the following requirements must be met:

In order to allow for large indexes, MySQL must be set up with the following my.cnf settings:

These settings are available as of MySQL 5.5.14, and are defaults in MySQL 5.7.7 and up.

After editing the my.cnf file (often located at /etc/mysql/my.cnf), don't forget to restart the mysql service (for example, with the command sudo service mysql restart) in order to load the new configuration.

2. The PHP MySQL driver must support the utf8mb4 charset (libmysqlclient 5.5.3 and up, as well as mysqlnd 5.0.9 and up).

3. The MySQL server must support the utf8mb4 charset (5.5.3 and up).

Run the command mysql --version to see your current MySQL version.

Steps to enable

For existing Drupal installations

First, back up your database and convert all existing tables to utf8mb4, such as by using the drush command provided by the utf8mb4_convert contrib project.

Set the "charset" and "collation" keys on the database connection array in settings.php to "utf8mb4" and "utf8mb4_general_ci" respectively:

For new Drupal installations

Prior to running the installer, edit settings.php and manually add in the full database settings array code, with 'charset' as 'utf8mb4', and 'collation' as 'utf8mb4_general_ci', and with the actual values for 'database', 'username', 'password', 'host', as shown below:

Then run the installer specifically by accessing install.php, as in http://example.com/install.php (not just http://example.com/)

Other database systems

PostgreSQL and SQLite support 4-byte UTF-8 out-of-the-box, so no special changes are needed for these.

MariaDB and other MySQL equivalents should likely work with similar instructions as above for MySQL.

Database drivers provided by contributed modules may or may not support this feature. The best place to look for answers is the issue queue of the contributed module which provides the database driver you are using.

Now when you look at your Drupal Site Report, you should be getting a warning message as the image below, which is related to Database 4 byte UTF-8 support:

Easier way using Drush:

Now to convert all your database tables to utf8mb4 characterset and utf8mb4_general_ci collation, you may make use of the following Drush command called UTF8MB4 Convert.Please find detailed instructions of this command here: https://www.drupal.org/project/utf8mb4_convert.

The conversion process in your terminal after executing the above commands should be as below:

Click image to enlarge

Final Message After Conversion:

Click image to enlarge

Finally when all your tables are converted, you can view each of their's Collation by using any database management tool such as phpMyAdmin.

Wednesday, February 22, 2017

Below is the technique which you can use to redirect a URL to another URL using htaccess in Magento or various other websites.

Redirect 302 /en/php/index.php http://www.example.com/newpage.html

Note: A 301 redirect means that the page has permanently moved to a new location. A 302 redirect means that the move is only temporary. Search engines need to figure out whether to keep the old page, or replace it with the one found at the new location. So, if your link has changed permanently then go for 301 redirect else go for a 302 redirect.

Friday, February 3, 2017

If you have deleted your sample products and would like to reset the product id to one (1) or any number of your choice, open up your phpMyAdmin or any MySQL client of your choice and enter the following command:

ALTER TABLE `catalog_product_entity` AUTO_INCREMENT =1

If you have used table prefix don't forget to append that as well before catalog_product_entity. Example: table-prefix_catalog_product_entity.

Monday, January 23, 2017

If you are experiencing a queer problem where by your products are automatically converting to virtual product instead of the default simple product then one of the reason might be —while creating the product, under the weight field you might be selecting the option - 'This item has no weight.' & when you do this Magento saves the products as virtual product. To save a product as simple product you must select the option as 'This item has weight.'

In case you have lots of product that are virtual and you would like to convert them to simple products, you can run this simple SQL query as below:

Saturday, January 7, 2017

Just like I had been all this while, you too must be confused between Marketplace or Multi Vendor/Multi Website solution, and unable to make your choice. In this post I will explain to you as to whether you should go for a Marketplace or Multi Store/Multi Website solution. There can be many reasons, but the ones below, were the ones that made me eventually go for a marketplace, in spite of successfully building a Multi Vendor Solution.

1. Marketplace: You should go for a marketplace solution if you are looking to provide the following features/services in your website:

Multi Vendor Solution

Ability for users to register as vendors and start selling their products on your website. All this can be done from your site's frontend which isn't the case with Multi Store/Website.

Amazon/Ebay kind of solution

Fig: Multi Website/Multi Store (click on image to enlarge)

2. Multi Store/Multi Website: You should go for a multi store/multi website solution in the following case:

Use a single Magento installation to create several stores & websites which eases website maintenance related tasks.

The following features are shared in a multi store setup:

Payment Gateway (shared)

Shipment (shared)

Category (optional)

Catalog is shared or not shared depending upon how you have set up your Category. If you have same category for all the stores then the products will be shared between all the stores. If you have separate categories for separate stores then the product can be restricted to each store.

Users are shared across all the store enabling single account log in across stores.

The following features are shared/not shared in a multi website setup, depending upon your configuration:

Payment Gateway (Can be unique for each website)

Shipping (Can be unique for each website)

User account (Can be restricted or shared across websites depending upon your configuration)

Email Subscription:

Support/Donate:

Drupal Association Member

eV@gabond - The Meaning

" I want to be an educated vagabond, not a vagabond out of weakness. I don't want to do anything in my life out of weakness - because I could not be anything else, that's why I am a Vagabond - that is not my way. First I want to prove to the world that I can be anything that I want to be, but still I choose to be a vagabond - out of strength. Then there is respectability even if you are a Vagabond, because respectability has nothing to do with your vocation, your profession; respectability has something to do with acting our of strength, clarity, intelligence. "