Saturday, December 21, 2013

Excel extarct words before and after a specific word

Excel extarct words before and after a specific word

For example, you have the following text in a cell “A1″ and you’d like to extract the text before the comma (the last name):
“Alam, Afroz”
To extract the last name before the comma “Alam” from A1, use one of the following formula:
=LEFT(A1,(FIND(",",A1,1)-1))
The result: Alam
To extract the first name after the comma from A1, use one of the following formula:
=MID(A1,FIND(",",A1)+2,256)
The result: Afroz

Friday, December 20, 2013

Compare data in Excel in two columns to find duplicates

Compare data in Excel in  two columns to find duplicates

To use a formula to compare the data in two columns:

  1. In a new worksheet, enter the following data (leave column B empty):
    X1: 1   Y1:     Z1: 3
    X2: 2   Y2:     Z2: 5
    X3: 3   Y3:     Z3: 8
    X4: 4   Y4:     Z4: 2
    X5: 5   Y5:     Z5: 0
         
  2. Type the following formula in cell B1:
    =IF(ISERROR(MATCH(X1,$Z$1:$Z$5,0)),"",X1)
  3. Select cells Y1:Y5.
  4. The duplicate numbers are displayed in column B, as in the following example:
     
    X1: 1   Y1:      Z1: 3
    X2: 2   Y2:2     Z2: 5
    X3: 3   Y3:3     Z3: 8
    X4: 4   Y4:      Z4: 2
    X5: 5   Y5:5     Z5: 0 
     
         

Thursday, December 12, 2013

Import large database from command line in windows

Import large database from command line in windows

Use
gzip -d [DATABASE_FILE.SQL.GZ]
to unzip .sql.gz 

If you are in the command prompt, type there
CD C:\wamp\bin\mysql\mysql5.1.36\bin {you can replace mysql5.1.36 with your version of mysql}
mysql -u [DATABASE_USERNAME] -p [DATABASE_NAME] < [DATABASE_FILE.SQL]


From the mysql console:
mysql> use DATABASE_NAME;
mysql> source path/to/file.sql;

Friday, May 3, 2013

Magento : Change options of configurable product to radio button

Magento : Change options of configurable product to radio button

Replace the configurable.phtml code with below code:
<?php
$_product    = $this->getProduct();
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
?>
<?php if ($_product->isSaleable() && count($_attributes)):?>
    <dl>
    <?php foreach($_attributes as $_attribute): ?>
        <dt><label class="required"><em>*</em><?php echo $_attribute->getLabel() ?></label></dt>
        <dd<?php if ($_attribute->decoratedIsLast){?> class="last"<?php }?>>
            <div class="input-box">
                <select style="display:none;" name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]" id="attribute<?php echo $_attribute->getAttributeId() ?>" class="required-entry super-attribute-select">
                   
                  </select>
              </div>
        </dd>
    <?php endforeach; ?>
    </dl>
    <script type="text/javascript">
        var spConfig = new Product.Config(<?php echo $this->getJsonConfig() ?>);
    </script>
<?php endif;?>
<div id="r"></div>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#attribute<?php echo $_attribute->getAttributeId() ?> option").each(function(i, e) {
    if(jQuery(this).val() == '')
    {}
    else
    {
    jQuery("<input type='radio' name='r' />")
        .attr("value", jQuery(this).val())
        .attr("checked", i == 0)
        .click(function () {
            jQuery("#attribute<?php echo $_attribute->getAttributeId() ?>").val(jQuery(this).val());
        })
        .appendTo("#r");
        jQuery("<span >&nbsp;&nbsp;&nbsp;"+jQuery(this).html()+"&nbsp;&nbsp;&nbsp;</span>")
        .appendTo("#r");
    }
       
});
});


</script>