node.xx already installed, it’s just not linked. Brew error

I’ve been trying to install node using brew on Mac and encountered an error.


brew install node
==> Downloading https://homebrew.bintray.com/bottles/node-6.8.1.el_capitan.bottle.tar.gz
Already downloaded: /Users/kalmario/Library/Caches/Homebrew/node-6.8.1.el_capitan.bottle.tar.gz
==> Pouring node-6.8.1.el_capitan.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/doc/node/gdbinit
Target /usr/local/share/doc/node/gdbinit
already exists. You may want to remove it:
  rm '/usr/local/share/doc/node/gdbinit'

To force the link and overwrite all conflicting files:
  brew link --overwrite node

To list all files that would be deleted:
  brew link --overwrite --dry-run node

Fixing the link issue

First is to change the /usr/local permission to your user

 sudo chown -R `kalmario` /usr/local/

Force the link between node and /usr/local

brew link --overwrite node

Execute the post install

brew postinstall node

And you are done!

SQL Backup of magento catalog Category, product, prices, description

I need to replicate my production data to a development server (without the images) and this command will have the tables listed.

You can also use the import/export tool within the admin panel of magento but i hate those tools because it takes too long to import back. The import/export took time to finish because it will properly set all your Foreign Keys and ensure that indexes are correct.

Be sure to re-index your data once you imported it back to you dev server

mysqldump -u user -p DB_NAME 
catalog_category_anc_categs_index_idx 
catalog_category_anc_categs_index_tmp 
catalog_category_anc_products_index_idx 
catalog_category_anc_products_index_tmp 
catalog_category_entity 
catalog_category_entity_datetime 
catalog_category_entity_decimal 
catalog_category_entity_int 
catalog_category_entity_text 
catalog_category_entity_varchar 
catalog_category_flat_store_1 
catalog_category_product 
catalog_category_product_index 
catalog_category_product_index_enbl_idx 
catalog_category_product_index_enbl_tmp 
catalog_category_product_index_idx 
catalog_category_product_index_tmp 
catalog_compare_item 
catalog_eav_attribute 
catalog_product_bundle_option 
catalog_product_bundle_option_value 
catalog_product_bundle_price_index 
catalog_product_bundle_selection 
catalog_product_bundle_selection_price 
catalog_product_bundle_stock_index 
catalog_product_enabled_index 
catalog_product_entity 
catalog_product_entity_datetime 
catalog_product_entity_decimal 
catalog_product_entity_gallery 
catalog_product_entity_group_price 
catalog_product_entity_int 
catalog_product_entity_media_gallery 
catalog_product_entity_media_gallery_value 
catalog_product_entity_text 
catalog_product_entity_tier_price 
catalog_product_entity_varchar 
catalog_product_flat_1 
catalog_product_index_eav 
catalog_product_index_eav_decimal 
catalog_product_index_eav_decimal_idx 
catalog_product_index_eav_decimal_tmp 
catalog_product_index_eav_idx 
catalog_product_index_eav_tmp 
catalog_product_index_group_price 
catalog_product_index_price 
catalog_product_index_price_bundle_idx 
catalog_product_index_price_bundle_opt_idx 
catalog_product_index_price_bundle_opt_tmp 
catalog_product_index_price_bundle_sel_idx 
catalog_product_index_price_bundle_sel_tmp 
catalog_product_index_price_bundle_tmp 
catalog_product_index_price_cfg_opt_agr_idx 
catalog_product_index_price_cfg_opt_agr_tmp 
catalog_product_index_price_cfg_opt_idx 
catalog_product_index_price_cfg_opt_tmp 
catalog_product_index_price_downlod_idx 
catalog_product_index_price_downlod_tmp 
catalog_product_index_price_final_idx 
catalog_product_index_price_final_tmp 
catalog_product_index_price_idx 
catalog_product_index_price_opt_agr_idx 
catalog_product_index_price_opt_agr_tmp 
catalog_product_index_price_opt_idx 
catalog_product_index_price_opt_tmp 
catalog_product_index_price_tmp 
catalog_product_index_tier_price 
catalog_product_index_website 
catalog_product_link 
catalog_product_link_attribute 
catalog_product_link_attribute_decimal 
catalog_product_link_attribute_int 
catalog_product_link_attribute_varchar 
catalog_product_link_type 
catalog_product_option 
catalog_product_option_price 
catalog_product_option_title 
catalog_product_option_type_price 
catalog_product_option_type_title 
catalog_product_option_type_value 
catalog_product_relation 
catalog_product_super_attribute 
catalog_product_super_attribute_label 
catalog_product_super_attribute_pricing 
catalog_product_super_link 
catalog_product_website 
cataloginventory_stock 
cataloginventory_stock_item 
cataloginventory_stock_status 
cataloginventory_stock_status_idx 
cataloginventory_stock_status_tmp 
catalogrule 
catalogrule_affected_product 
catalogrule_customer_group 
catalogrule_group_website 
catalogrule_product 
catalogrule_product_price 
catalogrule_website 
catalogsearch_fulltext 
catalogsearch_query 
catalogsearch_result 
> your_magento_backup.sql

Sublime Text Preferences

Sublime Text has released a new Beta for version 3. This means i need to migrate my sublime personal preference. This post will help me copy and paste this on different workstation. The one listed are the only one i use.

{
    // instead of prompting, always reload changed files on disk.
	"autoReloadChanged": true,
    // colorscheme of choice
	"color_scheme": "Packages/Color Scheme - Default/Pastels on Dark.tmTheme",
    // my favorite coding font
	"font_face": "Inconsolata",
	"font_size": 14,

    // always know what tabs are not saved yet
	"highlight_modified_tabs": true,
	"open_files_in_new_window": false,

    // prefered tabs configuration
	"tab_size": 4,
	"translate_tabs_to_spaces": true,
	"useTabStops": true,

    // annoying wordwrap remove
	"wordWrap": false,

    // Characters that are considered to separate words
	"word_separators": "./\()"'-:,.;<>~!@#%^&*|+=[]{}`~?"
}

Starting Endeca Dgraph Manually

Sometimes Using the workbench is not enough to start a component. Below is the command to manually start your dgraph or any component

This command uses the Workbench to start the dgraph

sh /path/to/PlatformServices/6.1.3/bin/eaccmd.sh start --app app_id --comp Dgraph1

another way is to use the Dgraph command

${ENDECA_PATH}/MDEX/6.4.0/bin/dgraph  
--threads 6  
--whymatch  
--spl  
--dym  
--dym_hthresh 5  
--dym_nsug 3  
--stat-abins  
--unctrct -v  
--port 19003  
--pidfile ${ENDECA_PATH}/apps/usapseattlesmall/dgraph.pid  
--log ${ENDECA_PATH}/apps/usapseattlesmall/logs/dgraphs/Dgraph1/Dgraph1.reqlog  
--out ${ENDECA_PATH}/apps/usapseattlesmall/logs/dgraphs/Dgraph1/Dgraph1.log  
--spellpath ${ENDECA_PATH}/apps/usapseattlesmall/data/dgraphs/Dgraph1/dgraph_input  
--updatedir ${ENDECA_PATH}/apps/usapseattlesmall/data/dgraphs/Dgraph1/dgraph_input/updates  
--updatelog ${ENDECA_PATH}/apps/usapseattlesmall/logs/dgraphs/Dgraph1/Dgraph1.updatelog ${ENDECA_PATH}/apps/usapseattlesmall/data/dgraphs/Dgraph1/dgraph_input/usap

insertAfter XML on PHP, insert element after last child

I’ve been dealing with XML parsing today and I’ve been trying to add an element to the last sibling. The problem is there are no insertAfter() function on PHP, what you need is to get the last sibling and move to the next sibling before inserting your new element.


$lastChild = $searchInterface->lastChild;
$member = $this->doc->createElement('MEMBER_NAME');
$searchInterface->insertBefore($member, $lastChild->nextSibling);

Useful Endeca Tips and Commands

Fix “Failed to obtain lock” error

./runcommand.sh LockManager releaseLock update_lock
When you accidentally CTRL+C a running process or an error occurred, The flag will remain on the EAC and you need to release it before you can run a baseline process again. This command will do the trick.

Update your configuration

./runcommand.sh --update-definition
If you have edited your AppConfig.xml or any Configuration files at /config/script you need to update your configuration for your changes to be applied. The command above will let you update your definition without restarting the platform services nor force you to execute initialize_services.sh

Don’t use --equivopt dgidx flag

this dgidx flag is used to compute dimension value equivalence classes to minimize the index size, however this adds up to the indexing phase time. This flag has been deprecated starting Endeca 6.4.0. We used this before for saving some disk space but upon removal on 6.4.0 it took down our Dgidx process from 7 hrs to 45 minutes with no threads specified and down to 25 mins with 16 threads.

Maxing your Dgidx --threads

Maxing out your available CPU Cores for Dgidx’ disposal will do wonders. The speed won’t exponential based on the number of cores because –threads flags are only used on the indexing phase of Dgidx, but if you need faster execution time Add this flag.

Note: This post will be updated if i encountered other useful commands on Endeca 6.1.x or 6.4.x search platform. Some of the tips are available on the Oracle perf guide, I’ve rewritten it here based on my own experience and for easier archive retrieval.

Magento – Enabling Paypal on One page checkout in the PH

Paypal option is not showing on the one page checkout, Configurations are correct and errors are not appearing.

I changed the default currency to USD and The paypal button suddenly appeared. This concludes that Magento’s Paypal does not support Philippines natively.

To fix the problem you need to add PHP to the supported currencies.

Edit /app/code/core/Mage/Paypal/Model/Config.php

and add ‘PH’ to the array of support country codes

<?php

    /**
     * Merchant country supported by PayPal
     *
     * @var array
     */
    protected $_supportedCountryCodes = array(
'AE','AR','AT','AU','BE','BG','BR','CA','CH','CL','CR',
'CY','CZ','DE','DK','DO','EC','EE','ES','FI','FR','GB',
'GF','GI','GP','GR','HK','HU','ID','IE','IL','IN','IS',
'IT','JM','JP','KR','LI','LT','LU','LV','MQ','MT','MX',
'MY','NL','NO','NZ','PH','PL','PT','RE','RO','SE','SG',
'SI','SK','SM','TH','TR','TW','US','UY','VE','VN','ZA',
'PH');

Sublime 2 Useful tips and Resources

Learn your sublime shortcuts

https://www.shortcutfoo.com/app/tutorial/sublimetext

Tips for beginners

http://blog.alainmeier.com/post/27255145114/some-things-beginners-might-not-know-about-sublime-text

Zen-Coding

plugin for high-speed HTML, XML, XSL (or any other structured code format) coding and editing
http://code.google.com/p/zen-coding/

Lorem Ipsum Generator

https://github.com/mrmartineau/Placeholders

Git

https://github.com/kemayo/sublime-text-2-git

Sublime Api Reference

http://www.sublimetext.com/docs/2/api_reference.html

Installing Sublime Text 2 on Linux Mint 12 or Ubuntu

I have been using sublime text along side with vim for a while now and so far this is my Notepad++ replacement. This editor is fast, light weight, very customizable and really slick looking. the license costs 59 USD but an evaluation version can be downloaded for free, however a pop-up will show every some number of save.

I have defined my shortcuts just the same as Notepad++, this helped me migrate to sublime much easier. When you enter “Vintage mode” your editor will become VIM.

The Pane on the right side is effective when searching text because the text will be enclosed on a oblong and will be visible in the code overview Pane.

Installing Sublime

 

Download the version 2.0.1. Note: you can get the latest version’s downlink link at http://www.sublimetext.com/2

 wget "http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%202.0.1.tar.bz2"

 

Extract the version 2.0.1

 tar -jxvf Sublime Text 2.0.1.tar.bz2

 

Add to your $PATH variable

adding to your $PATH means you can launch sublime using “sublime_text” command on your terminal or launcher. Be sure to add restart your bash profile by restarting or logging out and loggin on your desktop/laptop.
echo "export PATH=$PATH:`pwd`" >> ~/.bash_profile