Saturday, November 25, 2017

"Dead Code" can rot a code base over time.


"Dead Code" can rot a code base over time.
 





Monday, November 20, 2017

IceSleeve.com Hot and Cold Wraps,

IceSleeve Hot and Cold Wraps, launched successfully, where you can find the Heat therapy, Cold therapy, ergonomic and mobility, you can get details at https://icesleeve.com/Benefits. They provide following category products:
  1. Shoulder Ice wrap
  2. Shin and Calf Ice wrap
  3. Knee ice wrap
  4. Hamstring Wrap
  5. Lower back wrap
  6. Ankle ice wrap
  7. Elbow wrap
  8. Cold packs
  9. Ice bags
Special features to buy products from them can be:
  1. Customer satisfaction guaranteed https://icesleeve.com/Warranty
  2. Ship products within 24h from California warehouse https://icesleeve.com/delivery
  3. Eco-friendly, field usable, ease of use, adjustable, compression, mobility, multi-use https://icesleeve.com/about_us
  4. You can get more details of terms and conditions at https://icesleeve.com/terms
You can contact them at
https://icesleeve.com/contact
IceSleeve4720 Calle Carga
Camarillo, CA 93012
Telephone
818-814-6025
EMAILsales@icesleeve.com
Enjoy your visit at icesleeve.com and please provide feedback so that we can keep on improving it.
Thanks

Thursday, November 2, 2017

Interesting Switch case Optimization

Details at:

https://derickrethans.nl/php7.2-switch.html

<?php
$cc = "no";
$_table = [ "de" => 1, "en" => 2, "nl" => 3, "no" => 4 ];
if (gettype($cc) == 'string') {
        if (array_key_exists($cc, $_table)) {
                goto "jmp_{$_table[$cc]}";
        } else {
                goto jmp_default;
        }
} else {
        /* do original if/else if/else sequence */
}
jmp_1: echo "DEUTSCH"; goto end;
jmp_2: echo "English"; goto end;
jmp_3: echo "Nederlands"; goto end;
jmp_4: echo "Norsk"; goto end;
jmp_default: echo "unknown";
end:
?>





Friday, October 27, 2017

How to Fix the Error Setup Wizard ended prematurely


Sometime easy fix also take lots of time when you did not know what is happening, here is the easy fix for the error which keep on showing setup wizard ended prematurely. 


Thursday, October 26, 2017

JavaScript Data structures videos training



https://www.youtube.com/watch?v=Gj5qBheGOEo&list=PLWKjhJtqVAbkso-IbgiiP48n-O-JQA9PJ
  • Stacks
  • Sets
  • Queues
    • Priority Queues
  • Hash tables
  • Linked List
  • Map
  • Binary Search Tree
    • Tree Traversal and Height 
  • Trie
  • Heap
  • Graph
    • Adjacency list and Adjacency Matrix
    • Breadth first search

Friday, July 29, 2016

Bad NaCl helper startup ack ERROR:nacl_fork_delegate_linux.cc

Got following error after installation of google chrome and solved by running solution command: ERROR:nacl_fork_delegate_linux.cc(315)] Bad NaCl helper startup ack (0 bytes)

[4895:4895:0729/220859:ERROR:browser_main_loop.cc(231)] Running without the SUID sandbox! See https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md for more information on developing with the sandbox on.
[4895:4895:0729/220859:ERROR:gconf_listener.cc(117)] Error with gconf key '/apps/metacity/general': Client failed to connect to the D-BUS daemon:
Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
Gkr-Message: couldn't connect to dbus session bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

SOLUTION:
google-chrome --no-sandbox --user-data-dir

intl ICU version installed on your system (56.1) should match the ICU data bundled with Symfony (55.1

intl ICU version installed on your system (56.1) should match the ICU data bundled with Symfony (55.1)
In most cases you should be fine, but please verify there is no inconsistencies between data provided by Symfony and the intl extension. See https://github.com/symfony/symfony/issues/15007 for an example of inconsistencies you might run into.

Configuration Checker

This script analyzes your system to check whether is ready to run Symfony applications.

RECOMMENDATIONS

To enhance your Symfony experience, it’s recommended that you fix the following:

  1. intl ICU version installed on your system (56.1) should match the ICU data bundled with Symfony (55.1)
    In most cases you should be fine, but please verify there is no inconsistencies between data provided by Symfony and the intl extension. See https://github.com/symfony/symfony/issues/15007 for an example of inconsistencies you might run into.
  2. a PHP accelerator should be installed
    Install and/or enable a PHP accelerator (highly recommended).

OCMOD Modification System opencart 2.3 example for Show all products module ecommerce

Things to take care while making OCMOD file:
  1. File extension must be either .ocmod.zip or .ocmod.xml.
  2. Upload from admin section, Admin>>Extensions >> Extension Installer, Upload the .xomod.zip or .ocmod.xml file from here.
Now go to following link and download "Display all Products" module

You will find following ocmod example which shows how to show "All Products" links at the top menu bar.



For example:

<modification>
<version>OpenCart Version 2.2</version>
<vqmver>2.0.0</vqmver>
<author>Rupak Nepali</author>
   <code>List_all_Products</code>
<file name="catalog/view/theme/*/template/common/header.tpl" error="skip">
<operation>
<search position="after"><![CDATA[
<ul class="nav navbar-nav">
]]></search>
<add><![CDATA[
<li><a href="index.php?route=product/allproduct">All Products</a></li>
]]></add>
</operation>
</file>
</modification>


OCMOD is a system that allows store owners to be able to modify their store by uploading a compressed file that contains XML, SQL and PHP files.
If a OCMOD is developed correctly it can modify how a users OpenCart store works without changing any of the core files. This means that if a modification is removed none of the original OpenCart files need to be restored or fixed.

OCMOD Files

OCMOD files can be upload via the opencart admin under:
Extensions / Extension Installer
For a OCMOD file to be uploaded the file extension must be either .ocmod.zip or .ocmod.xml. This is to avoid none OCMOD files from being uploaded to a store users admin.

File Structure

Example file structure for OCMOD compressed files.
  • upload
  • install.sql
  • install.php
  • install.xml

upload

All files under this directory will be uploaded to the to directory of your OpenCart installation.

install.sql

Add any create, drop, insert and update SQL quires here. Make sure each query ends with ;

install.php

If the modification requires any custom PHP code.

install.xml

The XML modification file.
You can view the documentation for this system below.

XML

This is the file that creates a virtual copy of any files that require changes. Use this system instead of overwriting any default installation files. Multiple modifications can be applied to the same file.
Example OCMOD file:
<?xml version="1.0" encoding="utf-8"?>
<modification>
    <name>Modification Default</name>
    <version>1.0</version>
    <author>OpenCart Ltd</author>
    <link>http://www.opencart.com</link>
    <file path="catalog/controller/common/home.php">
        <operation>
            <search><![CDATA[
            $data['column_left'] = $this->load->controller('common/column_left');
            ]]></search>
            <add position="replace"><![CDATA[
            test123
            ]]></add>
        </operation>
    </file>  
</modification>

Tags

File

You can set multiple file locations by spiting up the file locations using commas. The modification system uses PHP function glob.
Example:
Direct file path.
<file path="catalog/controller/common/home.php">
Using braces allows for selecting multiple files and not having to repeat the code operation multiple times.
<file path="system/engine/action.php|system/engine/loader.php|system/library/config.php|system/library/language.php">
also allows braces
<file path="system/{engine,library}/{action,loader,config,language}*.php">
please note that all file paths must start with either admin, catalog or system. you can also use wildcard *

Search

Search code
Allowed Attributes
  • trim="(true|false)"
  • regex="(true|false)"
  • index="(number)"
Example:
<?xml version="1.0" encoding="utf-8"?>
<modification>
    <name>Modification Default</name>
    <version>1.0</version>
    <author>OpenCart Ltd</author>
    <link>http://www.opencart.com</link>
    <file path="catalog/controller/common/home.php">
        <operation>
            <search trim="true|false" index="1"><![CDATA[
            $data['column_left'] = $this->load->controller('common/column_left');
            ]]></search>
            <add position="replace" offset="1"><![CDATA[
            test123
            ]]></add>
        </operation>
    </file>  
</modification>

Add

The code to replace the search with.
Allowed Attributes
  • trim="(true|false)"
  • position="(Replace|Before|After)"
  • offset="(number)"
(note position can not be used if regex is set to true in the search attribute).
Example
<?xml version="1.0" encoding="utf-8"?>
<modification>
    <name>Modification Default</name>
    <version>1.0</version>
    <author>OpenCart Ltd</author>
    <link>http://www.opencart.com</link>
    <file path="catalog/controller/common/home.php">
        <operation>
            <search trim="true|false"><![CDATA[
            $data['column_left'] = $this->load->controller('common/column_left');
            ]]></search>
            <add position="Replace|Before|After" trim="true|false" offset="2"><![CDATA[
            test123
            ]]></add>
        </operation>
    </file>  
</modification>
Regex
Allowed Attributes
  • limit="(number)"
Example:
<?xml version="1.0" encoding="utf-8"?>
<modification>
    <name>Regex Example</name>
    <version>1.0</version>
    <author>OpenCart Ltd</author>
    <link>http://www.opencart.com</link>
    <file path="system/{engine,library}/{action,loader,config,language}*.php">
        <operation>
            <search regex="true" limit="1"><![CDATA[
            ~(require|include)(_once)?\(([^)]+)~
            ]]></search>
            <add><![CDATA[
            $1$2(modification($3)
            ]]></add>
        </operation>
    </file>
</modification>
If you use regex you can not use attributes position, trim or offset as these are handled by the regular expression code you write. The limit attribute is still available.
If, for example, you want to change the 3rd 'foo' to 'bar' on the following line:
lorem ifoopsum foo lor foor ipsum foo dolor foo
^1      ^2      ^3         ^4        ^5
Run:
s/\(.\{-}\zsfoo\)\{3}/bar/
Result:
lorem ifoopsum foo lor barr ipsum foo dolor foo
^1      ^2      ^3=bar     ^4        ^5
You can find more information about the regular expression PHP function OCMOD uses can be found here:
More information about regular expression can be found here: