Search blog

Tuesday, November 22, 2016

Setup Custom TinyWebDB (App Inventor) in Ubuntu or Linux




1. For this tutorial, you will use two commands from the Google App Engine SDK:
1.1. dev_appserver.py, to run the development web server locally
1.2. appcfg.py, for uploading your app to App Engine -- e.g:  In your terminal run the following command: ~/path-to-your-google-cloud-sdk/platform/google_appengine/appcfg.py update ~/customtinywebdb/appinventordb

2. Custom TinyWebDB Tutorial in App Inventor Website: http://bit.ly/2gCYjKw

3. Download Custom TinyWebDb: http://bit.ly/2fiHT3R

4. Installing Google Cloud SDK for App Engine using Python 2.7 in Ubuntu 14.04: http://bit.ly/2gbpWZE

Monday, November 21, 2016

Installing Google Cloud SDK for App Engine using Python 2.7 in Ubuntu 14.04

This tutorial shows you the various steps to successfully install the Google Cloud SDK for App Engine using Python 2.7 in Ubuntu 14.04.

1. First make sure whether you have Python 2.7 installed or not. Open your terminals and enter the following command:

 $ python -V  

You should similar output as this: Python 2.7.6.

2. Download the SDK for App Engine from here: http://bit.ly/2fe0azC. Make sure you select the Python version.

3. Once your file downloads, extract it in any folder of your choice. In our example we will extract it inside the Home directory. Your SDK path in side the home folder should be like:

 ~/google-cloud-sdk/bin  

Note: In Ubuntu ~ represent the Home directory.

4. Remain in your home folder (do not change directory to your SDK folder) and execute the following commands in your terminal.

 ./google-cloud-sdk/install.sh  

You should be getting the following result as shown in the image below:

Click image to enlarge

5. You will be asked the following questions which you may respond as below:


5.1 To help improve the quality of this product, we collect anonymized usage data  and anonymized stacktraces when crashes are encountered.. You may choose to opt out of this collection now (by choosing 'N' at the below prompt), or at any  time in the future by running the following command:

gcloud config set disable_usage_reporting true

Do you want to help improve the Google Cloud SDK (Y/n)?  N

5.2. Modify profile to update your $PATH and enable shell command
completion? (Y/n)
?  Y

5.3. Enter a path to an rc file to update, or leave blank to use
[/home/evagabond/.bashrc]
: just leave blank and hit enter


Iniitialize SDK


Use the gcloud init command to perform several common SDK setup tasks. These include authorizing the SDK tools to access Google Cloud Platform using your user account credentials and setting up the default SDK configuration.

Once you run the initi command, your default browser will open up and you will be asked to sign into your google account. This will be the account connected to your App Engine and various Google Cloud related services. 

6.1. Open up another terminal and run the following command:

 gcloud init  

6.2 Accept the option to log in using your Google user account:

 To continue, you must log in. Would you like to log in (Y/n)? Y  

For further instructions on initialization you may go through the following Google Documentaiton: http://bit.ly/2gsZdrY

Installing App Engine:

 Once you have successfully performed the installations explained above, you can now install the App Engine by running the following command in your terminal (also refer image below). Make sure you are outside your SDK folder else the command wont execute.

 gcloud components install app-engine-go  



To run App Engin: 

 dev_appserver.py app.yaml  

Helpful Resources by Google:

Sunday, November 13, 2016

Change 'Default Welcome Message' in Magento 2.1.x & Cleaning Cache



This tutorial shows the steps to change the 'Default Welcome Message' as of Magento 2.1.x and also shows how to clear the Magento cache.


Thursday, November 10, 2016

Magento 2 CLI/Terminal Commands

Commands for Magento 2x

If you are a Terminal/CLI ninja and have been seeking for nifty CLI commands, head forward!

Note: You may/may not have to enter 'sudo', depending on your folder permission settings. In my case I had to so I have added 'sudo' before each of my command.

>> To view Magento Help Commands:
php bin/magento

>> To view Magento Version: php bin/magento --version

>> To REINDEX CACHE: php bin/magento indexer:reindex

>> To Clean Cache:
php bin/magento cache:clean

- Cache Options: config , layout , block_html , collections , reflection , db_ddl , eav , customer_notification , full_page , config_integration , config_integration_api , translate , config_webservice

- Cache Options Usage:
  • php bin/magento cache:clean
  • php bin/magento cache:flush
  • php bin/magento cache:enable
  • php bin/magento cache:disable
  • php bin/magento cache:status
>> Maintenance Mode:
  • Sets maintenance mode exempt IPs: php bin/magento maintenance:allow-ips your_ip_address1 ip_address2
  • Disable Allowed IPs: php bin/magento maintenance:enable --ip=none
  • Disables maintenance mode: php bin/magento maintenance:disable 
  • Enable maintenance mode: php bin/magento maintenance:enable 
  • Displays maintenance mode status: php bin/magento maintenance:status
For more on Maintenance Mode, you may check Magento Guide at: http://devdocs.magento.com/guides/v2.0/install-gde/install/cli/install-cli-subcommands-maint.html

    >> Info:
    • Displays the Magento Admin URI: php bin/magento info:adminuri 
    • Displays the list of available currencies: php bin/magento info:currency:list 
    • Displays the list of available language locales: php bin/magento info:language:list 
    • Displays the list of available timezones: php bin/magento info:timezone:list

    >> Admin Solutions: 

      >> Module:

       NOTE: If you are disabling a module, first & foremost, check whether the particular module has any circular dependency.
       php bin/magento info:dependencies:show-modules-circular  
      
       The command above will generate one CSV file, please analyze this and make a decision. The file will be located in your DOCUMENT_ROOT folder bearing the filename 'modules-circular-dependencies.csv'.

      Also, while disabling an extension using the command below, it will throw an exception, if it has a circular dependency. - Source: https://magento.stackexchange.com/a/238338/58152
      • Disables specified modules: php bin/magento module:disable module_name --clear-static-content
      • Enables specified modules: php bin/magento module:enable module_name --clear-static-content
      • Displays status of modules: php bin/magento module:status 
      • Uninstalls modules installed by composer: sudo php bin/magento module:uninstall

      >> Setup:
      • Run CRON for Setup Application: php bin/magento setup:cron:run
      • Installs and upgrades data in the DB: php bin/magento setup:db-data:upgrade
      • Installs and upgrades the DB schema: php bin/magento setup:db-schema:upgrade
      • Checks if DB schema or data requires upgrade: php bin/magento setup:db:status
      • Generates DI configuration and all missing classes that can be auto-generated: php bin/magento setup:di:compile
      • Installs the Magento application: php bin/magento setup:install
      • Rolls back Magento Application codebase, media and database: php bin/magento setup:rollback
      • Deploys static view files: php bin/magento  setup:static-content:deploy
      • Installs the store configuration: php bin/magento setup:store-config:set
      • Uninstalls the Magento application: php bin/magento setup:uninstall
      • Upgrades the Magento application, DB data, and schema: php bin/magento setup:upgrade

      >> Backup:
      • Takes BACKUP of Magento Application code base, media and database: php bin/magento setup:backup
      •  View various backup options available: php bin/magento| grep backup
      •   View various backup options in detail: php bin/magento setup:backup --help
      Example to backup both code & data:
       php bin/magento setup:backup --code --db  
      
        Enable/Disable Backup from CLI:
        • Enable: php bin/magento config:set system/backup/functionality_enabled 1
        • Disable:  php bin/magento config:set system/backup/functionality_enabled 0

        >> Theme:
        Uninstall Theme: php bin/magento theme:uninstall theme_name

        Probably the above method is only applicable to themes that have been installed using composer. For other themes that haven't been installed using composer, please refer to the methods below:
        An important point I noticed from Reference 2 was this SQL query:

        There is a table in database named as theme.You can use the below code to delete your theme:

         USE dbname;  
         DELETE FROM theme where theme_id=5;  
        

        >> Deploy Static Content for Selected Theme:

        NOTE: Executing just the 4th command from the list below, will automatically run all the commands from 1 to 3.
        1. php bin/magento setup:static-content:deploy --theme Magento/backend en_US
        2. php bin/magento setup:static-content:deploy --theme frontend/Smartwave/porto en_US
        3. php bin/magento setup:static-content:deploy --theme Smartwave/porto_child en_US
        4. php bin/magento setup:static-content:deploy --theme Smartwave/porto_child

        >> Sample Data:
        • Deploy sample data modules: php bin/magento sampledata:deploy
        • Remove all sample data packages from composer.json: php bin/magento sampledata:remove
        • Reset all sample data modules for re-installation: php bin/magento sampledata:reset

        >> Magento Mode:
        • Display current mode: php bin/magento deploy:mode:show
        • Change mode: magento deploy:mode:set {mode} [-s|--skip-compilation]
          where
          {mode}
          is required; it can be either developer or production
          --skip-compilation is an optional parameter you can use to skip code compilation when you change to production mode.
          Example: php bin/magento deploy:mode:set production -s or php bin/magento deploy:mode:set developer
        • Change to production mode: magento deploy:mode:set production
        • Change to developer mode: If you’re changing from production mode to developer mode, delete the contents of the var/generation and var/di directories. Run the following command in your Magento Root Directory:

           rm -rf var/di/* var/generation/* var/cache/* var/page_cache/* var/view_preprocessed/* var/composer_home/cache/*
          
           php bin/magento deploy:mode:set developer 
            or
           php bin/magento module:enable [--force] Magento_Developer  
          


        >> Cron Job Hang/Stuck/Stopped
        If your cron job has got stuck or what is also known as hanged, you can run the commands below to resolve the issue. Sometimes, you might have to re-run all the 3 commands, in case the issue doesn't resolve in the 1st attempt:
        • php bin/magento setup:cron:run
        • php bin/magento cron:run
        • php update/cron.php

        Saturday, November 5, 2016

        [SOLVED] - Problem after Updating NVIDIA Drivers in Dell 5558 Laptop using Ubuntu 14.04

        Today I was recommended to update my NVIDIA drivers to its latest version nvidia-graphics-drivers-367 package. Once I updated and rebooted my Dell 5558 laptop, using Ubuntu 14.04 I experienced a blank login screen. After some Google searching I found out that probably the Unity Service had failed to load because of driver incompatibility issue.

        So the solution I figured out was to switch to terminal from the blank login screen; where I was unable to see nothing. Press CTRL+ALT+F2 to switch to Terminal. Then log into your account and hit the following command to remove the NVIDIA drivers completely from your system:

         sudo apt-get remove --purge nvidia-*  
        

        You should be getting a message as displayed in the image below:


        Confirm by pressing 'y or Y' to delete.

        Once deleted restart your computer and install the compatible driver version.

        In my case I had TimeShift installed which is a software that allows feature just like Windows Restore through which I restored my computer to the state just before it was updated.

        Top 5 Posts (Weekly)