Thomas Sowell Quotes

Read More

31. “Activism is a way for useless people to feel important, even if the consequences of their activism are counterproductive for those they claim to be helping and damaging to the fabric of society as a whole.” Thomas Sowell in twitter

30. “The problem isn’t that Johnny can’t read. The problem isn’t even that Johnny can’t think. The problem is that Johnny doesn’t know what thinking is; he confuses it with feeling.”

29. “One of the consequences of such notions as ‘entitlements’ is that people who have contributed nothing to society feel that society owes them something, apparently just for being nice enough to grace us with their presence.”

28. “Each new generation born is in effect an invasion of civilization by little barbarians, who must be civilized before it is too late.”

27. “Virtually no idea is too ridiculous to be accepted, even by very intelligent and highly educated people, if it provides a way for them to feel special and important. Some confuse that feeling with idealism.”

26. “I wonder what radical feminists make of the fact that it was men who created the rule of ‘women and children first’ when it came to rescuing people from life-threatening emergencies.”

25. “The word ‘racism’ is like ketchup. It can be put on practically anything — and demanding evidence makes you a ‘racist.’

24. “To believe in personal responsibility would be to destroy the whole special role of the anointed, whose vision casts them in the role of rescuers of people treated unfairly by ‘society.’”

23. “What sense would it make to classify a man as handicapped because he is in a wheelchair today, if he is expected to be walking again in a month and competing in track meets before the year is out? Yet Americans are given ‘class’ labels on the basis of their transient location in the income stream. If most Americans do not stay in the same broad income bracket for even a decade, their repeatedly changing ‘class’ makes class itself a nebulous concept.

22. “There is much discussion of the haves and the have-nots, but very little discussion of the doers and the do-nots, those who contribute and those who merely take.”

21. “It would be hard to think of a more ridiculous way to make decisions than to transfer those decisions to third parties who pay no price for being wrong. Yet that is what at least half of the bright ideas of the political left amount to.”

20. “When you want to help people, you tell them the truth. When you want to help yourself, you tell them what they want to hear. People with careers as ethnic leaders usually tell their followers what they want to hear.”

19. “‘We are a nation of immigrants,’ we are constantly reminded. We are also a nation of people with ten fingers and ten toes. Does that mean that anyone who has ten fingers and ten toes should be welcomed and given American citizenship?”

18. “It is amazing how many people think that the government’s role is to give them what they want by overriding what other people want.”

17. “Those who cry out that the government should ‘do something’ never even ask for data on what has actually happened when the government did something, compared to what actually happened when the government did nothing.”

16. “Four things have almost invariably followed the imposition of controls to keep prices below the level they would reach under supply and demand in a free market: (1) increased use of the product or service whose price is controlled, (2) Reduced supply of the same product or service, (3) quality deterioration, (4) black markets.”

15. “Much of the social history of the Western world, over the past three decades, has been a history of replacing what worked with what sounded good.”

14. “Weighing benefits against costs is the way most people make decisions – and the way most businesses make decisions, if they want to stay in business. Only in government is any benefit, however small, considered to be worth any cost, however large.”

13. “Considering how often throughout history even intelligent people have been proved to be wrong, it is amazing that there are still people who are convinced that the only reason anyone could possibly say something different from what they believe is stupidity or dishonesty.”

12. “Since this is an era when many people are concerned about ‘fairness’ and ‘social justice,’ what is your ‘fair share’ of what someone else has worked for?”

11. “For the anointed, traditions are likely to be seen as the dead hand of the past, relics of a less enlightened age, and not as the distilled experience of millions who faced similar human vicissitudes before.”

10. “It is amazing how many of the intelligentsia call it ‘greed’ to want to keep what you have earned, but not greed to want to take away what somebody else has earned, and let politicians use it to buy votes.”

9. “If you cannot achieve equality of performance among people born to the same parents and raised under the same roof, how realistic is it to expect to achieve it across broader and deeper social divisions?”

8. “It is amazing how many people think that they can answer an argument by attributing bad motives to those who disagree with them. Using this kind of reasoning, you can believe or not believe anything about anything, without having to bother to deal with facts or logic.”

7. “Experience trumps brilliance.”

6. “There is usually only a limited amount of damage that can be done by dull or stupid people. For creating a truly monumental disaster, you need people with high IQs.”

5. “There are few modest talents so richly rewarded — especially in politics and the media — as the ability to portray parasites as victims, and portray demands for preferential treatment as struggles for equal rights.”

4. “In short, killing the goose that lays the golden egg is a viable political strategy, so long as the goose does not die before the next election and no one traces the politicians’ fingerprints on the murder weapon.”

3. ”The charge is often made against the intelligentsia and other members of the anointed that their theories and the policies based on them lack common sense. But the very commonness of common sense makes it unlikely to have any appeal to the anointed. How can they be wiser and nobler than everyone else while agreeing with everyone else?”

2. “No one will really understand politics until they understand that politicians are not trying to solve our problems. They are trying to solve their own problems – of which getting elected and re-elected are number one and number two. Whatever is number three is far behind.”

1. “There are no solutions; there are only trade-offs.”

Original article|

Heinlein quotes

Read More
  • Throughout history, poverty is the normal condition of man. Advances which permit this norm to be exceeded — here and there, now and then — are the work of an extremely small minority, frequently despised, often condemned, and almost always opposed by all right-thinking people. Whenever this tiny minority is kept from creating, or (as sometimes happens) is driven out of a society, the people then slip back into abject poverty. This is known as “bad luck”.
  • Never underestimate the power of human stupidity.
  • An armed society is a polite society. Manners are good when one may have to back up his acts with his life.
  • Political tags – such as royalist, communist, democrat, populist, fascist, liberal, conservative, and so forth – are never basic criteria. The human race divides politically into those who want people to be controlled and those who have no such desire.
  • A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects.
  • There is no worse tyranny than to force a man to pay for what he does not want merely because you think it would be good for him.
  • Always listen to experts. They’ll tell you what can’t be done, and why. Then do it.
  • There are no dangerous weapons; there are only dangerous men.
  • Climate is what you expect, weather is what you get.
  • Violence, naked force, has settled more issues in history than has any other factor.
  • A generation which ignores history has no past — and no future.
  • You can sway a thousand men by appealing to their prejudices quicker than you can convince one man by logic.
  • At least once every human should have to run for his life, to teach him that milk does not come from supermarkets, that safety does not come from policemen, that ‘news’ is not something that happens to other people. He might learn how his ancestors lived and that he himself is no different–in the crunch his life depends on his agility, alertness, and personal resourcefulness.
  • Cheops’ Law: Nothing ever gets built on schedule or within budget.
  • Taxes are not levied for the benefit of the taxed.
  • No statement should be believed because it is made by an authority.

Magento Code Snippets

Read More

Download extension manually using pear/mage

Pear for 1.4, mage for 1.5. File downloaded into /downloader/.cache/community/

./pear download magento-community/Shipping_Agent
./mage download community Shipping_Agent

Clear cache/reindex

<?php
// clear cache
Mage::app()->removeCache('catalog_rules_dirty');
// reindex prices
Mage::getModel('index/process')->load(2)->reindexEverything();
/*
1 = Product Attributes
2 = Product Attributes
3 = Catalog URL Rewrites
4 = Product Flat Data
5 = Category Flat Data
6 = Category Products
7 = Catalog Search Index
8 = Tag Aggregation Data
9 = Stock Status
*/
?>

Load category by id

<?php
$_category = Mage::getModel('catalog/category')->load(89);
$_category_url = $_category->getUrl();
?>

Load product by id or sku

<?php
$_product_1 = Mage::getModel('catalog/product')->load(12); // won't include a valid stock item
$_product_2 = Mage::getModel('catalog/product')->loadByAttribute('sku','cordoba-classic-6-String-guitar'); // will include a valid stock item
?>

Get Configurable product’s Child products

<?php
// input is $_product and result is iterating child products
$childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null, $product);
?>

Get Configurable product’s Children’s (simple product) custom attributes

<?php
// input is $_product and result is iterating child products
$conf = Mage::getModel('catalog/product_type_configurable')->setProduct($_product);
$col = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
foreach($col as $simple_product){
	var_dump($simple_product->getId());
}
?>

Log to custom file

<?php Mage::log('Your Log Message', Zend_Log::INFO, 'your_log_file.log'); ?>

Call Static Block

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('block-name')->toHtml(); ?>

Add JavaScript to page

First approach: page.xml – you can add something like

<action method="addJs"><script>path/to/my/file.js</script></action>

Second approach: Find page/html/head.phtml in your theme and add the code directly to page.html.

Third approach: If you look at the stock page.html mentioned above, you’ll see this line

<?php echo $this->getChildHtml() ?>

Normally, the getChildHtml method is used to render a specific child block. However, if called with no paramater, getChildHtml will automatically render all the child blocks. That means you can add something like

<!-- existing line --> <block type="page/html_head" name="head" as="head">
	<!-- new sub-block you're adding --> <block type="core/template" name="mytemplate" as="mytemplate" template="page/mytemplate.phtml"/>
	...

to page.xml, and then add the mytemplate.phtml file. Any block added to the head block will be automatically rendered. (this automatic rendering doesn’t apply for all layout blocks, only for blocks where getChildHtml is called without paramaters).

Check if customer is logged in

<?php $logged_in = Mage::getSingleton('customer/session')->isLoggedIn(); // (boolean) ?>

Get the current category/product/cms page

<?php
$currentCategory = Mage::registry('current_category');
$currentProduct = Mage::registry('current_product');
$currentCmsPage = Mage::registry('cms_page');
?>

Run Magento Code Externally

<?php
require_once('app/Mage.php'); //Path to Magento
umask(0);
Mage::app();
// Run you code here
?>

Programmatically change Magento’s core config data

<?php
// find 'path' in table 'core_config_data' e.g. 'design/head/demonotice'
$my_change_config = new Mage_Core_Model_Config();
// turns notice on
$my_change_config->saveConfig('design/head/demonotice', "1", 'default', 0);
// turns notice off
$my_change_config->saveConfig('design/head/demonotice', "0", 'default', 0);
?>

Changing the Admin URL

Open up the /app/etc/local.xml file, locate the <frontName> tag, and change the ‘admin’ part it to something a lot more random, eg:

<frontName><![CDATA[supersecret-admin-name]]></frontName>

Clear your cache and sessions.

Magento: Mass Exclude/Unexclude Images

By default, Magento will check the ‘Exclude’ box for you on all imported images, making them not show up as a thumbnail under the main product image on the product view.

# Mass Unexclude
UPDATE`catalog_product_entity_media_gallery_value` SET `disabled` = '0' WHERE `disabled` = '1';
# Mass Exclude
UPDATE`catalog_product_entity_media_gallery_value` SET `disabled` = '1' WHERE `disabled` = '0';

getBaseUrl – Magento URL Path

<?php
// http://example.com/
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
// http://example.com/js/
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);
// http://example.com/index.php/
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
// http://example.com/media/
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
// http://example.com/skin/
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
?>

Get The Root Category In Magento

<?php
$rootCategoryId = Mage::app()->getStore()->getRootCategoryId();
$_category = Mage::getModel('catalog/category')->load($rootCategoryId);
// You can then get all of the top level categories using:
$_subcategories = $_category->getChildrenCategories();
?>

Get The Current URL In Magento

<?php echo Mage::helper('core/url')->getCurrentUrl(); ?>

Category Navigation Listings in Magento

Make sure the block that you’re working is of the type catalog/navigation. If you’re editing catalog/navigation/left.phtml then you should be okay.

<div id="leftnav">
	<?php $helper = $this->helper('catalog/category') ?>
	<?php $categories = $this->getStoreCategories() ?>
	<?php if (count($categories) > 0): ?>
		<ul id="leftnav-tree" class="level0">
			<?php foreach($categories as $category): ?>
				<li class="level0<?php if ($this->isCategoryActive($category)): ?> active<?php endif; ?>">
					<a href="<?php echo $helper->getCategoryUrl($category) ?>"><span><?php echo $this->escapeHtml($category->getName()) ?></span></a>
					<?php if ($this->isCategoryActive($category)): ?>
						<?php $subcategories = $category->getChildren() ?>
						<?php if (count($subcategories) > 0): ?>
							<ul id="leftnav-tree-<?php echo $category->getId() ?>" class="level1">
								<?php foreach($subcategories as $subcategory): ?>
									<li class="level1<?php if ($this->isCategoryActive($subcategory)): ?> active<?php endif; ?>">
										<a href="<?php echo $helper->getCategoryUrl($subcategory) ?>"><?php echo $this->escapeHtml(trim($subcategory->getName(), '- ')) ?></a>
									</li>
								<?php endforeach; ?>
							</ul>
							<script type="text/javascript">decorateList('leftnav-tree-<?php echo $category->getId() ?>', 'recursive')</script>
						<?php endif; ?>
					<?php endif; ?>
				</li>
			<?php endforeach; ?>
		</ul>
		<script type="text/javascript">decorateList('leftnav-tree', 'recursive')</script>
	<?php endif; ?>
</div>

Debug using zend

<?php echo Zend_Debug::dump($thing_to_debug, 'debug'); ?>

$_GET, $_POST & $_REQUEST Variables

<?php
// $_GET
$productId = Mage::app()->getRequest()->getParam('product_id');
// The second parameter to getParam allows you to set a default value which is returned if the GET value isn't set
$productId = Mage::app()->getRequest()->getParam('product_id', 44);
$postData = Mage::app()->getRequest()->getPost();
// You can access individual variables like...
$productId = $postData['product_id']);
?>

Get methods of an object

First, use get_class to get the name of an object’s class.

<?php $class_name = get_class($object); ?>

Then, pass that get_class_methods to get a list of all the callable methods on an object

<?php
$class_name = get_class($object);
$methods = get_class_methods($class_name);
foreach($methods as $method)
{
	var_dump($method);
}
?>

Is product purchasable?

<?php if($_product->isSaleable()) { // do stuff } ?>

Load Products by Category ID

<?php
$_category = Mage::getModel('catalog/category')->load(47);
$_productCollection = $_category->getProductCollection();
if($_productCollection->count()) {
	foreach( $_productCollection as $_product ):
		echo $_product->getProductUrl();
		echo $this->getPriceHtml($_product, true);
		echo $this->htmlEscape($_product->getName());
	endforeach;
}
?>

Update all subscribers into a customer group (e.g. 5)

UPDATE
	customer_entity,
	newsletter_subscriber
SET
	customer_entity.`group_id` = 5
WHERE
	customer_entity.`entity_id` = newsletter_subscriber.`customer_id`
AND
	newsletter_subscriber.`subscriber_status` = 1;

Get associated products

In /app/design/frontend/default/site/template/catalog/product/view/type/

<?php $_helper = $this->helper('catalog/output'); ?>
<?php $_associatedProducts = $this->getAllowProducts() ?>
<?php //var_dump($_associatedProducts); ?>
<br />
<br />
<?php if (count($_associatedProducts)): ?>
	<?php foreach ($_associatedProducts as $_item): ?> 
		<a href="<?php echo $_item->getProductUrl() ?>"><?php echo $_helper->productAttribute($_item, $_item->getName(), 'name') ?> | <?php echo $_item->getName() ?> | <?php echo $_item->getPrice() ?></a>
		<br />
		<br />
	<?php endforeach; ?>
<?php endif; ?>

Get An Array of Country Names/Codes in Magento

<?php
$countryList = Mage::getResourceModel('directory/country_collection')
                    ->loadData()
                    ->toOptionArray(false);
     
    echo '<pre>';
    print_r( $countryList);
    exit('</pre>');
?>

Create a Country Drop Down in the Frontend of Magento

<?php
$_countries = Mage::getResourceModel('directory/country_collection')
                                    ->loadData()
                                    ->toOptionArray(false) ?>
<?php if (count($_countries) > 0): ?>
    <select name="country" id="country">
        <option value="">-- Please Select --</option>
        <?php foreach($_countries as $_country): ?>
            <option value="<?php echo $_country['value'] ?>">
                <?php echo $_country['label'] ?>
            </option>
        <?php endforeach; ?>
    </select>
<?php endif; ?>

Create a Country Drop Down in the Magento Admin

<?php
    $fieldset->addField('country', 'select', array(
        'name'  => 'country',
        'label'     => 'Country',
        'values'    => Mage::getModel('adminhtml/system_config_source_country')->toOptionArray(),
    ));
?>

Return Product Attributes

<?php
$_product->getThisattribute();
$_product->getAttributeText('thisattribute');
$_product->getResource()->getAttribute('thisattribute')->getFrontend()->getValue($_product);
$_product->getData('thisattribute');
// The following returns the option IDs for an attribute that is a multiple-select field: 
$_product->getData('color'); // i.e. 456,499
// The following returns the attribute object, and instance of Mage_Catalog_Model_Resource_Eav_Attribute: 
$_product->getResource()->getAttribute('color'); // instance of Mage_Catalog_Model_Resource_Eav_Attribute
// The following returns an array of the text values for the attribute: 
$_product->getAttributeText('color') // Array([0]=>'red', [1]=>'green')
// The following returns the text for the attribute
if ($attr = $_product->getResource()->getAttribute('color')):
    echo $attr->getFrontend()->getValue($_product); // will display: red, green
endif;
?>

Cart Data

<?php
$cart = Mage::getModel('checkout/cart')->getQuote()->getData();
print_r($cart);
$cart = Mage::helper('checkout/cart')->getCart()->getItemsCount();
print_r($cart);
$session = Mage::getSingleton('checkout/session');
foreach ($session->getQuote()->getAllItems() as $item) {
    echo $item->getName();
    Zend_Debug::dump($item->debug());
}
?>

Get Simple Products of a Configurable Product

<?php
if($_product->getTypeId() == "configurable") {
    $ids = $_product->getTypeInstance()->getUsedProductIds();
?>
<ul>
    <?php
    foreach ($ids as $id) {
        $simpleproduct = Mage::getModel('catalog/product')->load($id);
    ?>
        <li>
        	<?php
        	echo $simpleproduct->getName() . " - " . (int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($simpleproduct)->getQty();
        	?>
        </li>				
    <?php
    }
    ?>
</ul>
<?php
}
?>

Turn template hints on/off via database

UPDATE
`core_config_data`
SET
`value` = 0
WHERE
`path` = "dev/debug/template_hints"
OR
`path` = "dev/debug/template_hints_blocks";

Delete all products

TRUNCATE TABLE `catalog_product_bundle_option`;
TRUNCATE TABLE `catalog_product_bundle_option_value`;
TRUNCATE TABLE `catalog_product_bundle_selection`;
TRUNCATE TABLE `catalog_product_entity_datetime`;
TRUNCATE TABLE `catalog_product_entity_decimal`;
TRUNCATE TABLE `catalog_product_entity_gallery`;
TRUNCATE TABLE `catalog_product_entity_int`;
TRUNCATE TABLE `catalog_product_entity_media_gallery`;
TRUNCATE TABLE `catalog_product_entity_media_gallery_value`;
TRUNCATE TABLE `catalog_product_entity_text`;
TRUNCATE TABLE `catalog_product_entity_tier_price`;
TRUNCATE TABLE `catalog_product_entity_varchar`;
TRUNCATE TABLE `catalog_product_link`;
TRUNCATE TABLE `catalog_product_link_attribute_decimal`;
TRUNCATE TABLE `catalog_product_link_attribute_int`;
TRUNCATE TABLE `catalog_product_link_attribute_varchar`;
TRUNCATE TABLE `catalog_product_option`;
TRUNCATE TABLE `catalog_product_option_price`;
TRUNCATE TABLE `catalog_product_option_title`;
TRUNCATE TABLE `catalog_product_option_type_price`;
TRUNCATE TABLE `catalog_product_option_type_title`;
TRUNCATE TABLE `catalog_product_option_type_value`;
TRUNCATE TABLE `catalog_product_super_attribute`;
TRUNCATE TABLE `catalog_product_super_attribute_label`;
TRUNCATE TABLE `catalog_product_super_attribute_pricing`;
TRUNCATE TABLE `catalog_product_super_link`;
TRUNCATE TABLE `catalog_product_enabled_index`;
TRUNCATE TABLE `catalog_product_website`;
TRUNCATE TABLE `catalog_product_entity`;
TRUNCATE TABLE `cataloginventory_stock_item`;
TRUNCATE TABLE `cataloginventory_stock_status`;

Getting Configurable Product from Simple Product ID in Magento 1.5+

<?php
$simpleProductId = 465;
$parentIds = Mage::getResourceSingleton('catalog/product_type_configurable')
    ->getParentIdsByChild($simpleProductId);
$product = Mage::getModel('catalog/product')->load($parentIds[0]);
echo $product->getId(); // ID = 462 (aka, Parent of 465)
?>

Create a category using parent id

<?php
/* supply parent id */
$parentId = '10';
 
$category = new Mage_Catalog_Model_Category();
$category->setName('Storybloks');
$category->setUrlKey('new-category');
$category->setIsActive(1);
$category->setDisplayMode('PRODUCTS');
$category->setIsAnchor(0);
 
$parentCategory = Mage::getModel('catalog/category')->load($parentId);
$category->setPath($parentCategory->getPath());               
 
$category->save();
unset($category);
?>

Create a category within another category, which you know by name

<?php
$parentId = null;

$collection = Mage::getModel('catalog/category')->getCollection()
->setStoreId('0')
->addAttributeToSelect('name')
->addAttributeToSelect('is_active');
foreach ($collection as $cat) {
    if ($cat->getName() == 'Storybloks Parent Category') {
        $parentId = $cat->getId();
        break;
    }
}
 
if ($parentId) {
 
    $urlKey = 'new-category';
 
    $currentCategory = Mage::getModel('catalog/category')->getCollection()
        ->addFieldToFilter('url_key', $urlKey)
        ->setCurPage(1)
        ->setPageSize(1)
        ->getFirstItem();
 
    if (!($currentCategory && $currentCategory->getId())) {
        $category = Mage::getModel('catalog/category');
        $category->setName('Storybloks Subcategory')
        ->setUrlKey($urlKey)
        ->setIsActive(1)
        ->setDisplayMode('PRODUCTS')
        ->setIsAnchor(0)
        ->setDescription('This is a storybloks subcategory')
        ->setCustomDesignApply(1)
        ->setCustomDesign('storybloks/new-category-style') /* create this template and layout
                                                                                 in your design directory */
        ->setAttributeSetId($category->getDefaultAttributeSetId());
 
        $parentCategory = Mage::getModel('catalog/category')->load($parentId);
        $category->setPath($parentCategory->getPath());               
 
        $category->save();
        unset($category);
    }
}
?>

Add a new category or update existing

<?php
function createCategory($data, $parentId=false, $storeId=false)
{
	echo "create category {$data['name']}\n";

	$category = Mage::getModel('catalog/category')->loadByAttribute('name', $data['name']);

	if (!$storeId)
	{
		$storeId = Mage_Core_Model_App::ADMIN_STORE_ID;
	}

	if (!$parentId)
	{
		$parentId = Mage_Catalog_Model_Category::TREE_ROOT_ID;
		
		if ($storeId) 
		{
			$parentId = Mage::app()->getStore($storeId)->getRootCategoryId();
		}
	}

	if (!$category)
	{
		$category = new Mage_Catalog_Model_Category();
		
		$parentCategory = Mage::getModel('catalog/category')->load($parentId);
		$category->setPath($parentCategory->getPath());
	}

	$category->setName($data['name']);
	$category->setUrlKey(isset($data['urlKey']) ? $data['urlKey'] : $data['name']);
	$category->setIsActive(isset($data['isActive']) ? $data['isActive'] : 1);
	$category->setDisplayMode('PRODUCTS_AND_PAGE');
	$category->setIsAnchor(0);

	try 
	{
		$category->save();
		echo "Success\n";
		return $category->getId();
	}
	catch (Exception $e)
	{
		echo "Exception: ".$e->getMessage()."\n";
	}
		
	return false;
}
?>

Add a new product or update existing

<?php
function createProduct($data)
{
	echo "create product {$data['name']} {$data['price']}\n";

	$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $data['sku']); 

	if (!$product)
	{
		$product = new Mage_Catalog_Model_Product();
 
		$product->setTypeId('simple');
		$product->setWeight(1.0000);
		$product->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH);
		$product->setStatus(1);
		$product->setSku($data['sku']);
		$product->setTaxClassId(0);
		$product->setWebsiteIDs(array(1));
		$product->setStoreIDs(array(1));
			
		$product->setStockData
		(
			array
			(
				'is_in_stock'   => 1,
				'qty'           => $data['count'],
				'manage_stock'  => 0,
			)
		);
	}
    
	$fileName = Mage::getBaseDir('media').'/import/'.basename($data['image']);

	if (is_file($filePath))
	{
		try 
		{
			$product->addImageToMediaGallery($fileName, array('thumbnail','small_image','image'), false, false);
		} 
		catch (Exception $e) 
		{
			echo $e->getMessage();
		}
	}

	$product->setAttributeSetId(4); 
	$product->setName($data['name']);
	$product->setCategoryIds($data['categoryIds']);
	$product->setKeywords($data['keywords']);
	$product->setDescription($data['description']);
	$product->setShortDescription($data['shortDescription']);
	$product->setPrice($data['price']);

	/** Yandex.Market **/
	$product->setYmlExport(1);
	$product->setBid(0);
	$product->setCBid(0);
	$product->setModel($data['name']);

	try
	{
		$product->save();
		echo "Success\n";
		return $product->getId();
	}
	catch (Exception $e)
	{
		echo "Exception: ".$e->getMessage()."\n";
	}

	return false;
}
?>

Remove all products from store with id 1

<?php
$products = Mage::getResourceModel('catalog/product_collection')->setStoreId(1)->getAllIds();

if(is_array($products))
{
    foreach ($products as $key => $productId)
    {
        try 
        {
            $product = Mage::getSingleton('catalog/product')->load($productId);
            Mage::dispatchEvent('catalog_controller_product_delete', array('product' => $product));
            $product->delete();          
        } 
        catch (Exception $e) 
        {
            echo "<br/>Can't delete product w/ id: $productId";
        }
    }
}
?>

Add a new user

<?php
$user = Mage::getModel("admin/user")
		->setUsername('username')
		->setFirstname('Firstname')
		->setLastname('Lastname')
		->setEmail('username@example.com')
		->setPassword('demopass123')
		->save();
$role = Mage::getModel("admin/role");
$role->setParent_id(1);
$role->setTree_level(1);
$role->setRole_type('U');
$role->setUser_id($user->getId());
$role->save();
?>

Change user’s password

UPDATE admin_user SET password=CONCAT(MD5('qX[password]'), ':qX') WHERE username='[username]';
/**
 * where:
 *	[password] - user password
 * 	[username] - user name
 **/

Add a new product to cart

<?php
	function addProductToCart($product_id, $count)
	{
		try
		{
			$session = Mage::getSingleton('core/session', array('name'=>'frontend'));
			$cart = Mage::helper('checkout/cart')->getCart();
			
			$product = Mage::getModel('catalog/product')->load($product_id);
			$cart->addProduct($product, $count);

			$session->setLastAddedProductId($product->getId());
			$session->setCartWasUpdated(true);

			$cart->save();

			return true;
		}
		catch (Exception $e)
		{
			Mage::log("[addProductToCart] ".$e->getMessage());
		}

		return false;
	}
?>

Remove product from cart

<?php
	function removeProductFromCart($product_id)
	{
		try
		{
			$session = Mage::getSingleton('core/session', array('name'=>'frontend'));
			$cart = Mage::helper('checkout/cart')->getCart();
			$cart->getProductIds();
			$items = $cart->getItems();

			foreach ($items as $item)
			{
				if ($item->getProduct()->getId() == $product_id)
				{
					$cart->removeItem($item->getId());
					break;
				}
			}

			$session->setCartWasUpdated(true);

			$cart->save();

			return true;
		}
		catch (Exception $e)
		{
			Mage::log("[removeProductToCart] ".$e->getMessage());
		}

		return false;
	}
?>

Is product in cart?

<?php
	function isProductInCart($product_id)
	{
		try
		{
			$productIds = Mage::helper('checkout/cart')->getCart()->getProductIds();

			if (in_array($product_id, $productIds))
			{
				return true;
			}
		}
		catch (Exception $e)
		{
			Mage::log("[isProductInCart] ".$e->getMessage());
		}

		return false;
	}
?>

Get header cart html and products count

$result["cart_html"] = $app->getLayout()->getBlockSingleton('checkout/cart_sidebar')->setTemplate("checkout/cart/header.cart.phtml")->toHtml();
$result["cart_count"] = Mage::helper('checkout/cart')->getSummaryCount();

Get product quantity

(int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty(); 

Clear all orders

-- here are the tables modified for 1.5.0.1
 
SET FOREIGN_KEY_CHECKS=0;
 
TRUNCATE `sales_flat_order`;
TRUNCATE `sales_flat_order_address`;
TRUNCATE `sales_flat_order_grid`;
TRUNCATE `sales_flat_order_item`;
TRUNCATE `sales_flat_order_status_history`;
TRUNCATE `sales_flat_quote`;
TRUNCATE `sales_flat_quote_address`;
TRUNCATE `sales_flat_quote_address_item`;
TRUNCATE `sales_flat_quote_item`;
TRUNCATE `sales_flat_quote_item_option`;
TRUNCATE `sales_flat_order_payment`;
TRUNCATE `sales_flat_quote_payment`;
TRUNCATE `sales_flat_shipment`;
TRUNCATE `sales_flat_shipment_item`;
TRUNCATE `sales_flat_shipment_grid`;
TRUNCATE `sales_flat_invoice`;
TRUNCATE `sales_flat_invoice_grid`;
TRUNCATE `sales_flat_invoice_item`;
TRUNCATE `sendfriend_log`;
TRUNCATE `tag`;
TRUNCATE `tag_relation`;
TRUNCATE `tag_summary`;
TRUNCATE `wishlist`;
TRUNCATE `log_quote`;
TRUNCATE `report_event`;
 
ALTER TABLE `sales_flat_order` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_address` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_grid` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_status_history` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_address` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_address_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_item_option` AUTO_INCREMENT=1;
ALTER TABLE `sendfriend_log` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_payment` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_payment` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_shipment` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_shipment_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_invoice` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_invoice_grid` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_invoice_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_shipment_grid` AUTO_INCREMENT=1;
ALTER TABLE `tag` AUTO_INCREMENT=1;
ALTER TABLE `tag_relation` AUTO_INCREMENT=1;
ALTER TABLE `tag_summary` AUTO_INCREMENT=1;
ALTER TABLE `wishlist` AUTO_INCREMENT=1;
ALTER TABLE `log_quote` AUTO_INCREMENT=1;
ALTER TABLE `report_event` AUTO_INCREMENT=1;
 
-- lets reset customers
TRUNCATE `customer_address_entity`;
TRUNCATE `customer_address_entity_datetime`;
TRUNCATE `customer_address_entity_decimal`;
TRUNCATE `customer_address_entity_int`;
TRUNCATE `customer_address_entity_text`;
TRUNCATE `customer_address_entity_varchar`;
TRUNCATE `customer_entity`;
TRUNCATE `customer_entity_datetime`;
TRUNCATE `customer_entity_decimal`;
TRUNCATE `customer_entity_int`;
TRUNCATE `customer_entity_text`;
TRUNCATE `customer_entity_varchar`;
TRUNCATE `log_customer`;
TRUNCATE `log_visitor`;
TRUNCATE `log_visitor_info`;
 
ALTER TABLE `customer_address_entity` AUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity_datetime` AUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity_decimal` AUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity_int` AUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity_text` AUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity_varchar` AUTO_INCREMENT=1;
ALTER TABLE `customer_entity` AUTO_INCREMENT=1;
ALTER TABLE `customer_entity_datetime` AUTO_INCREMENT=1;
ALTER TABLE `customer_entity_decimal` AUTO_INCREMENT=1;
ALTER TABLE `customer_entity_int` AUTO_INCREMENT=1;
ALTER TABLE `customer_entity_text` AUTO_INCREMENT=1;
ALTER TABLE `customer_entity_varchar` AUTO_INCREMENT=1;
ALTER TABLE `log_customer` AUTO_INCREMENT=1;
ALTER TABLE `log_visitor` AUTO_INCREMENT=1;
ALTER TABLE `log_visitor_info` AUTO_INCREMENT=1;
 
-- Now, lets Reset all ID counters
TRUNCATE `eav_entity_store`;
ALTER TABLE `eav_entity_store` AUTO_INCREMENT=1;
 
SET FOREIGN_KEY_CHECKS=1;

##Product navigation (getting previous and next items)

<?php
	/**
	 * Determine the previous/next link and link to current category
	 */
	$_ccat        = $this->helper('catalog/data')->getCategory();
	$ppos         = $_ccat->getProductsPosition();
	$current_pid  = $this->helper('catalog/data')->getProduct()->getId();
	// build array from products positions
	$plist = array();
	foreach ($ppos as $pid => $pos) {
		$plist[] = $pid;
	}
	$curpos   = array_search($current_pid, $plist);
	// get link for prev product
	$previd   = isset($plist[$curpos+1])? $plist[$curpos+1] : $current_pid;
	$product  = Mage::getModel('catalog/product')->load($previd);
	$prevpos  = $curpos;
	while (!$product->isVisibleInCatalog()) {
		$prevpos += 1;
		$nextid   = isset($plist[$prevpos])? $plist[$prevpos] : $current_pid;
		$product  = Mage::getModel('catalog/product')->load($nextid);
	}
	$prev_url = $product->getProductUrl();
	// get link for next product
	$nextid   = isset($plist[$curpos-1])? $plist[$curpos-1] : $current_pid;
	$product  = Mage::getModel('catalog/product')->load($nextid);
	$nextpos  = $curpos;
	while (!$product->isVisibleInCatalog()) {
		$nextpos -= 1;
		$nextid   = isset($plist[$nextpos])? $plist[$nextpos] : $current_pid;
		$product  = Mage::getModel('catalog/product')->load($nextid);
	}
	$next_url = $product->getProductUrl();
	// get link for current category
	$more_url = $_ccat->getUrl(); 
?>

##Add custom columns to the Magento administration Catalog > Product grid

<?php
class Zyn_Common_Block_Adminhtml_Catalog_Product_Grid extends Mage_Adminhtml_Block_Catalog_Product_Grid {

    protected function _prepareColumns() {	
        
	$this->addColumn('zyn_featured',
        array(
            'header'=> 'Show on Homepage',
            'width' => '50px',
			'index' => 'zyn_featured',
			'type'  => 'options',
			'options' => array(0 => 'No', 1 => 'Yes')
    	));

        parent::_prepareColumns();

    }

    protected function _prepareCollection() {
	$store = $this->_getStore();
        $collection = Mage::getModel('catalog/product')->getCollection()
            ->addAttributeToSelect('sku')
            ->addAttributeToSelect('name')
            ->addAttributeToSelect('attribute_set_id')
            ->addAttributeToSelect('type_id')
            ->addAttributeToSelect('zyn_featured');

        if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) {
            $collection->joinField('qty',
                'cataloginventory/stock_item',
                'qty',
                'product_id=entity_id',
                '{{table}}.stock_id=1',
                'left');
        }
        if ($store->getId()) {
            $adminStore = Mage_Core_Model_App::ADMIN_STORE_ID;
            $collection->addStoreFilter($store);
            $collection->joinAttribute(
                'name',
                'catalog_product/name',
                'entity_id',
                null,
                'inner',
                $adminStore
            );
            $collection->joinAttribute(
                'custom_name',
                'catalog_product/name',
                'entity_id',
                null,
                'inner',
                $store->getId()
            );
            $collection->joinAttribute(
                'status',
                'catalog_product/status',
                'entity_id',
                null,
                'inner',
                $store->getId()
            );
            $collection->joinAttribute(
                'visibility',
                'catalog_product/visibility',
                'entity_id',
                null,
                'inner',
                $store->getId()
            );
            $collection->joinAttribute(
                'price',
                'catalog_product/price',
                'entity_id',
                null,
                'left',
                $store->getId()
            );
        }
        else {
            $collection->addAttributeToSelect('price');
            $collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner');
            $collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner');
        }

        $this->setCollection($collection);

        //parent::_prepareCollection();
        $this->getCollection()->addWebsiteNamesToResult();
        return $this;
    }
}
?>


Original article

Inverse selection in File Explorer

Read More

Use Invert Selection for Easier File Selection in Windows Explorer

The next time you need to select most of the files in an open Explorer window don’t waste your time holding down Ctrl and clicking each file manually. It’s much easier to select the ones you DON’T need, and then let Windows reverse your selection.

Inside an open window, hold down Ctrl as you select the file(s) you DON’T want to select (sounds backward, but wait…).

Select Edit, then Invert Selection, and Windows will turn your selection inside out leaving you with the files you wanted to select.

You can then delete or copy them as needed.

Excel tips

Read More

Freezing Rows and Columns

If you have a lengthy spreadsheet containing tons of data, you may have to scroll too far down or even across to view it all. This means you will lose sight of your headings and find yourself constantly scrolling back to see them. However, if you freeze the rows and columns, then those headers will remain as you move through your spreadsheet.

  1. Navigate to the View tab and select Freeze Panes on the ribbon.
  2. In the Freeze Panes dropdown, select Freeze Top Row, Freeze First Column, or choose both if needed.

tips to save time in microsoft excel

Now when you scroll up, down, right, or left, you will notice your headers will remain visible. To unfreeze those rows and columns, just select Freeze Panes command again and click Unfreeze Panes. How to Manage Columns in Excel How to Manage Columns in Excel Do you need to add, move, hide, or change columns in a complex spreadsheet? Don’t panic. We’ll show you basic Excel column operations to organize your data. Read More

Note that in older versions of Excel, the process is a bit different. Select the cell that is common to both the row and column you want to freeze and then click Freeze Panes.

Operating the Fill Handle

The fill handle in Excel can be a huge time-saver when you need to populate multiple cells and there are a few different ways this feature can be used. First, you can quickly create a list of numbers that count up by entering 1 into the first cell and 2 in the cell below it. Then, select both cells and when the fill handle appears, just drag to populate the cells as needed.

tips to save time in microsoft excel

When using the feature for dates, you can easily fill a column or row in increments of one day. For instance, you can enter 12/25/16 into the cell, select that cell, and when the fill handle appears just drag to add subsequent dates. This maneuver also works with days of the week and months of the year as well as downward through a column and across through a row.

tips to save time in microsoft excel
Another handy use for the fill handle is if you need to populate an entire column with the same value for your spreadsheet. If you enter a word or letter, for example, select the cell and double-click the fill handle. This will enter that value into the remaining cells of the column as far down as your spreadsheet has data. How To Save Time In Excel By Using The Fill Handle How To Save Time In Excel By Using The Fill Handle Read More

Transposing Columns and Rows

If you have a spreadsheet using headings in columns or rows (or both) and decide they would work better the opposite way, there is an easy process to make the change. This saves you from having to retype those headings. Here are the steps to move cells from row headings to column headings.

  1. Select the cells in the column that contain the headings.
  2. Either right-click and select Copy or click the Copy button on the Home tab of the ribbon.
  3. Select the cell in the row and column where you want the headings to start.
  4. Either right-click and select Paste Special or click Paste and then Paste Special on the Home tab of the ribbon.
  5. Select the checkbox near the bottom right that says Transpose.
  6. Click OK.

tips to save time in microsoft excel

Accessing the Calculator

While you may use an add-in that pops a calculator into the sidebar of your spreadsheet, you can also take advantage of the built-in calculator feature. This is convenient when you want to perform quick calculations that are not formulated into your spreadsheet. And you can add the calculator to either your ribbon or Quick Access toolbar. Doing Your Taxes? 5 Excel Formulas You Must Know Doing Your Taxes? 5 Excel Formulas You Must Know It’s two days before your taxes are due and you don’t want to pay another late filing fee. This is the time to leverage the power of Excel to get everything in order. Read More

To add the calculator to either location, begin by selecting File > Options. Then choose either Customize Ribbon or Quick Access Toolbar, depending on where you want it. In the Choose commands from dropdown box, pick All Commands. Scroll down, click Calculator, and then hit the Add button to insert it into the toolbar. Note that if you choose to add it to your ribbon, you will have to create a custom group and add it there.

tips to save time in microsoft excel

Linking to Tabs or Cells

If your workbook contains several spreadsheets with data being cross-referenced between them, creating a direct link provides speedy access. This is especially helpful if you are sharing a workbook so that others can jump to that data quickly. Follow these simple steps to create the link:

  1. Select the cell containing the data that you want to link.
  2. Either right-click and select Hyperlink or go to the Insert tab and click Hyperlink in the ribbon.
  3. In the popup window, select Place in this Document.
  4. Then enter the text to display in that cell, a specific cell reference if desired, and the spreadsheet in the workbook with the data you are linking to.
  5. Click OK.

tips to save time in microsoft excel

Using Keyboard Shortcuts

If you are an avid Excel user, then keyboard shortcuts can certainly save you time. While there are almost too many keyboard shortcuts to list, here are several that can speed up your tasks. 3 Essential Time-Saving Excel Shortcuts You Should Know 3 Essential Time-Saving Excel Shortcuts You Should Know Excel can be a headache for the uninitiated, but with these shortcuts in hand, you’ll save yourself a ton of time going forward! Read More

  • F4 (or Fn + F4) to repeat the last command, including formatting changes such as color or font.
  • Alt + H, E, A to erase the contents, formatting, and other data attached to the selected cells.
  • Ctrl + W to close a spreadsheet and Ctrl + O to open one.
  • Ctrl + Shift + Colon to enter the current time and Ctrl + Shift + Semicolon for the current date.
  • Shift + F9 to calculate the active worksheet.
  • Shift + Tab to move to the previous cell or option.
  • Ctrl + Home to move to the beginning of the spreadsheet.
  • Ctrl + Page Down to move to the next spreadsheet in a workbook and Ctrl + Page Up to move to the previous one.

Working With AutoSum

Some might think that working with formulas in Excel is too time-intensive to get into. But even for simple equations, these built-in functions can definitely move your spreadsheet work along faster.

Unless you have moved or deleted it from your ribbon, the AutoSum button should be on your Home tab. This handy feature gives you the most common formulas with a click. You can add, count, or average a group of numbers or obtain the minimum or maximum of them. Just click the arrow on the AutoSum button to choose your formula.

tips to save time in microsoft excel

In addition to the AutoSum feature, your Formulas tab contains even more options. Each formula is grouped into a category to make it easy to find. You can select from financial, logical, math, statistical, or engineering functions.

But for the most widely-used formulas, the AutoSum feature is quick and convenient.

Using Simple Conditional Formatting

Conditional formatting is another one of those Excel features that many might find intimidating. However, for data that you want to see pop off the page, it’s a great tool.

For example, say you have a spreadsheet of data from a survey and at a quick glance you want to see how many Yes answers you have as opposed to No answers. These steps show you how to apply simple formatting.

  1. Select the cells containing the Yes/No answers.
  2. On the Home tab, click the Conditional Formatting dropdown box.
  3. Choose Highlight Cells Rules and then Text That Contains.
  4. Type the word Yes in the left box and choose the formatting for it from the right box.
  5. Follow the same steps for the No answers.

tips to save time in microsoft excel

You will then see all of the Yes and No answers formatted the way you chose, making them easy to spot.

If you plan to continue to add data, you can also apply this conditional formatting to the entire column or row instead of just a group of cells. This way, future data will be automatically formatted as you enter it. Eager to learn more? Have a look at our dedicated article on conditional formatting. Automatically Format Data in Excel Spreadsheets With Conditional Formatting Automatically Format Data in Excel Spreadsheets With Conditional Formatting Excel’s conditional formatting feature lets you format individual cells in an Excel spreadsheet based on their value. We show you how to use this for various everyday tasks. Read More

Quickly Inserting Charts

The Charts feature within Excel is a terrific tool for displaying your data visually. And, you can choose from a variety of chart types such as pie, bar, line, column, and many others.

Using the above example of conditional formatting for Yes/No answers, you can insert a chart with just a few clicks.

  1. Select the cells containing the Yes/No answers.
  2. On the Insert tab, click Recommended Charts. With this option, Excel will take your data and put it into the type of chart it fits best.
  3. If you like the chart, click OK and it will be inserted into your spreadsheet.

tips to save time in microsoft excel

This is the easiest and fastest way to create a chart in Excel and takes only a minute. However, if you do not like the chart created for you, you can click the All Charts tab in the popup window and experiment with other types.

For further information on formatting your chart, learn all about creating a pie chart. How to Create a Pie Chart in Microsoft Excel How to Create a Pie Chart in Microsoft Excel Everyone can create a simple pie chart. But can you format it to perfection? We’ll take you through the process, one step at a time. Read More

 Sorting With Filters

When you have a spreadsheet containing many columns of data, you may want to sort or filter it all by a certain column. While there are a couple of ways you can do this, using a filter is the quickest and safest way to do it.

  1. Select the entire sheet by clicking the triangle button next to your first column at the top left.
  2. On the Home tab, click Sort & Filter.
  3. Choose Filter.

That’s it! This fast move will put an arrow into the first row for each of your columns. When you click an arrow, you can sort the entire sheet by that column in the way you choose. If it’s a date field, you can sort from oldest to newest and if it’s a text field, you can sort alphabetically.

In addition, you can filter the data to see only the entries you want. When you click an arrow you will notice checkboxes next to your entries. Marking and unmarking these boxes will filter the data so that you see exactly what you need.

tips to save time in microsoft excel

The nice thing about using the Filter feature is that it does not negatively affect the rest of your data. If you sort an entire sheet, Excel will adjust all columns. And if you filter, Excel will simply hide what you do not want to see.

Using the Format Painter

If you use other Microsoft Office applications such as Word, you may already be familiar with the Format Painter. In Excel, this convenient tool lets you apply the same formatting from one or more cells to others with a single click.

  1. Select the cell, group of cells, row, or column that you want to copy the formatting from.
  2. On the Home tab, click Format Painter.
  3. Select the cell, group of cells, row, or column that you want to copy the formatting to.

This is a fantastic way to quickly apply helpful formatting of cells to others without manual work.

 Switching and Viewing Windows

Are there times when you need to work with more than one Excel workbook at the same time? Maybe you need to review data, compare it, or even copy data from one workbook to another. Excel provides a useful set of viewing features to help. Head over to the View tab to check out these options.

  • Arrange All: When you click this button, you can arrange all of your open workbooks on one screen. Choose from a tiled, horizontal, vertical, or cascade view.
  • View Side by Side: This option lets you choose two open workbooks to view next to or on top of each other, which is perfect for comparisons.
  • Switch Windows: Click this button when you have many Excel workbooks open at once and want to switch between them quickly. No minimizing and maximizing windows is necessary with this awesome feature.

tips to save time in microsoft excel

 Installing Handy Add-Ins

Office Add-ins are similar to browser extensions in that they are tools to enhance your application experience, data, and efficiency. And in Excel, you have many helpful add-ins to choose from depending on your needs.

Select the Insert tab and click Store. You can then check out tools by category. For instance, the Productivity category contains add-ins for document automation and a template gallery. And, the Project Management category has add-ins for Gantt charts and activity timers.

tips to save time in microsoft excel

Some add-ins are free while others are paid, so be sure to check the details before installing one. And if you are looking for free Excel add-ins to help with visualizations, we have you covered.

 

Original article in https://www.makeuseof.com/tag/7-tips-save-time-microsoft-excel/

Windows 10 annoyances

Read More

1. You can not map a network drive with different users on the same remote server.
Microsoft says “it is by design”. Why?. There is no clear answer… but there are no technical barriers.

2. Control Panel has disappeared.
But there is no substitute for many functionalities.

3. Selecting default app for a file extension
You can not add easily a more detailed command.

4. Unstoppable automatic updates
Microsoft has decided: if you have Windows Home, your system will be updated whatever your circumstances, you might defer it for a while, but that is all.
Additionally, your system will auto reboot at some point in the next 24 hours.
They do not realise the task you might be doing could be much more important than any security threat.

5. Cortana
It does by default whatever a genius has decided in each update. At least, you can disable it completely.
Additionally, you have to send to MS your private life for it to work.

6. Edge
It is simply not compatible with a lot of web pages.

7. Select all context menu option
Select all, has disappeared almost everywhere. The button is hidden in Office as a customization.

8. Initial crapware

9. Take out apps or utils, instead of adding new ones
Modems, DVD, Fax, etc. are out of fashion, there is no need for MS to update the software, but take it out…?

10. Difficult to set a local account.
Microsoft is trying to make local accounts a thing of the past and push all new Windows 10 users to a Microsoft account.
To create a local account during setup, you may have to disconnect the computer from the Internet

11. Sign in with a local account instead of a Microsoft account
They are really trying to hide how to do it. Unfortunately, this is giving a clue that in a future update iteration, it is going to dissppear, creating big additional problems for the end user.

12. Not stopping telemetry completely.
You just have the possibility of sending a Basic set.
Update
Open the Task Scheduler. Modify the entry Microsoft/Windows/Application Experience/Microsoft Compatibility Appraiser to Disable.

13. Deciding how to see folders depending on content
Windows tries to be more intelligent than you on deciding how to see things on the file explorer

14. Right-button context menu functionality, changing on updates

15. More, more and more tasks running in the background.
No idea of what they are doing, they are possibly there for some reason, but MS and software companies are disconsiderate with resources.

Bash Reference

Read More

The Shebang (#!)

  • In the beginning, first line of the file, no spaces.
  • Next, absolute path to the script interpreter (might change, but better to execute anywhere), in this case: /bin/bash
  • Call to the script does not look in current directory, so ./ is necessary or it has to be included in PATH

Special System Variables

  • $0 – The name of the Bash script.
  • $1 – $9 – The first 9 arguments to the Bash script.
  • $# – How many arguments were passed to the Bash script.
  • $@ – All the arguments supplied to the Bash script.
  • $? – The exit status of the most recently run process.
  • $$ – The process ID of the current script.
  • $USER – The username of the user running the script.
  • $HOSTNAME – The hostname of the machine the script is running on.
  • $SECONDS – The number of seconds since the script was started.
  • $RANDOM – Returns a different random number each time is it referred to.
  • $LINENO – Returns the current line number in the Bash script.

Variable Assignment

variable=value

  • No $ sign at the beginning.
  • No space at either side of the equal.
  • Case sensitive.
  • Variables set by a program must not have = or nul, but for the shell environment, they have more limitations: consist solely of uppercase letters, digits, and the ‘_’ (underscore) and do not begin with a digit. User variables follow the C variable definition rules (lowercase allowed). Regex:[a-zA-Z_]+[a-zA-Z0-9_]*

Quotes

Bash uses a space to determine separate items. When we enclose our content in quotes we are indicating to Bash that the contents should be considered as a single item. You may use single quotes ( ‘ ) or double quotes ( ” ).

  • Single quotes will treat every character literally.
  • Double quotes will allow you to do substitution (that is include variables within the setting of the value) nvar="Add $var"

Command Substitution

The output of command or program is saved into a variable variable=$(command) ex. directoryls=$(ls -al)
Adequate for just one word or line, newlines are removed and stored in a single line in the variable.

Exporting Variables

Exporting variables make them available for child subprocesses created in the running script
export var
Note: exporting a variable to the environment only works in the interactive console, not in scripts. To export it, modify /etc/environment from a script

Arithmetic

    • let expression Make a variable equal to an expression. Ex. let a=5+4
    • expr expression Print out the result of the expression.
    • $(( expression )) Return the result of the expression.
    • ${#var} Return the length of the variable var.
Operator Operation
+, -, /*, / addition, subtraction, multiply, divide
var++ Increase the variable var by 1
var– Decrease the variable var by 1
% Modulus (Return the remainder after division)

 

Control Statements

IF
if [ <some test> ] then
<commands>
elif [ <some test> ] then
<different commands>
else
<other commands>
fi

CASE
case <variable> in
<pattern 1>)
<commands>
;;
<pattern 2>)
<other commands>
;;
esac

WHILE

while [ <some test> ] do
<commands>
done

UNTIL

until [ <some test> ] do
<commands>
done

FOR

for var in <list>
do
<commands>
done

SELECT Present list items for selection with a number before each item
select var in <list>
do
<commands>
done

break Goes out of the loop
continue Goes to the beginning of next iteration
Range ex. for value in {1..5}
Range with step ex. for value in {10..0..2}

Operator Description
&& And
|| Or
! EXPRESSION The EXPRESSION is false.
-n STRING The length of STRING is greater than zero.
-z STRING The lengh of STRING is zero (ie it is empty).
STRING1 = STRING2 STRING1 is equal to STRING2
STRING1 != STRING2 STRING1 is not equal to STRING2
INTEGER1 -eq INTEGER2 INTEGER1 is numerically equal to INTEGER2
INTEGER1 -gt INTEGER2 INTEGER1 is numerically greater than INTEGER2
INTEGER1 -lt INTEGER2 INTEGER1 is numerically less than INTEGER2
-d FILE FILE exists and is a directory.
-e FILE FILE exists.
-r FILE FILE exists and the read permission is granted.
-s FILE FILE exists and it’s size is greater than zero (ie. it is not empty).
-w FILE FILE exists and the write permission is granted.
-x FILE FILE exists and the execute permission is granted.

 

Functions

function <name> or <name>() {  <commands>  } Create a function called name. Must appear in the script before any calls to the function. Arguments are passed as to the script $1, $2…
return <value> Exit the function with a return status of value.
local <name>=<value>  Create a local variable within a function.
command <command> Run the command with that name as opposed to the function with the same name.

print_something () {
echo Hello $1
return 5
}
print_something Mars
print_something Jupiter
echo The previous function has a return value of $?

Hello Mars
Hello Jupiter
The previous function has a return value of 5

tput


#!/bin/bash
# Print message in center of terminal
cols=$( tput cols )
rows=$( tput lines )
message=$@
input_length=${#message}
half_input_length=$(( $input_length / 2 ))
middle_row=$(( $rows / 2 ))
middle_col=$(( ($cols / 2) - $half_input_length ))
tput clear
tput cup $middle_row $middle_col
tput bold
echo $@
tput sgr0
tput cup $( tput lines ) 0

tput cols will tell us how many columns the terminal has.
tput lines will tell us how many lines (or rows) the terminal has.
Take all the command line arguments and assign them to a single variable message.
Find out how many characters are in the string message. We had to assign all the input values to the variable message first as ${#@} would tell us how many command line arguments there were instead of the number of characters combined.
We need to know what 1/2 the length of the string message is in order to center it.
Calculate where to place the message for it to be centered.
tput clear will clear the terminal.
tput cup will place the cursor at the given row and column.
tput bold will make everything printed to the screen bold.
Now we have everything set up let’s print our message.
tput sgr0 will turn bold off (and any other changes we may have made).
tput cup $( tput lines ) 0Place the prompt at the bottom of the screen.

Bash Tutorial
Advanced Bash Scripting

Check Ubuntu Hardware

Read More

List summary of hardware:
lshw -short
List summary of PCI devices:
lspci -v

H/W path Device Class Description
===========================================================
system PowerEdge R420 (SKU=NotProvided;ModelName=PowerEdge R420)
/0 bus 0K29HN
/0/0 memory 64KiB BIOS
/0/400 processor Intel(R) Xeon(R) CPU E5-2403 v2 @ 1.80GHz
/0/400/700 memory 128KiB L1 cache
/0/400/701 memory 1MiB L2 cache
/0/400/702 memory 10MiB L3 cache
/0/401 processor Intel(R) Xeon(R) CPU E5-2403 v2 @ 1.80GHz
/0/401/703 memory 128KiB L1 cache
/0/401/704 memory 1MiB L2 cache
/0/401/705 memory 10MiB L3 cache
/0/1000 memory 16GiB System Memory
/0/1000/0 memory 4GiB DIMM DDR3 Synchronous 1600 MHz (0,6 ns)
/0/1000/1 memory 4GiB DIMM DDR3 Synchronous 1600 MHz (0,6 ns)
/0/1000/2 memory DIMM DDR3 Synchronous [empty] /0/1000/3 memory DIMM DDR3 Synchronous [empty] /0/1000/4 memory DIMM DDR3 Synchronous [empty] /0/1000/5 memory DIMM DDR3 Synchronous [empty] /0/1000/6 memory 4GiB DIMM DDR3 Synchronous 1600 MHz (0,6 ns)
/0/1000/7 memory 4GiB DIMM DDR3 Synchronous 1600 MHz (0,6 ns)
/0/1000/8 memory DIMM DDR3 Synchronous [empty] /0/1000/9 memory DIMM DDR3 Synchronous [empty] /0/1000/a memory DIMM DDR3 Synchronous [empty] /0/1000/b memory DIMM DDR3 Synchronous [empty] /0/100 bridge Xeon E7 v2/Xeon E5 v2/Core i7 DMI2
/0/100/1 bridge Xeon E7 v2/Xeon E5 v2/Core i7 PCI Express Root Port 1a
/0/100/1/0 scsi0 storage MegaRAID SAS 2008 [Falcon] /0/100/1/0/0.20.0 generic BP12G+
/0/100/1/0/2.0.0 /dev/sda disk 999GB PERC H310
/0/100/1/0/2.0.0/1 /dev/sda1 volume 243MiB Linux filesystem partition
/0/100/1/0/2.0.0/2 /dev/sda2 volume 930GiB Extended partition
/0/100/1/0/2.0.0/2/5 /dev/sda5 volume 930GiB Linux LVM Physical Volume partition
/0/100/3 bridge Xeon E7 v2/Xeon E5 v2/Core i7 PCI Express Root Port 3a
/0/100/5 generic Xeon E7 v2/Xeon E5 v2/Core i7 VTd/Memory Map/Misc
/0/100/5.2 generic Xeon E7 v2/Xeon E5 v2/Core i7 IIO RAS
/0/100/11 bridge C600/X79 series chipset PCI Express Virtual Root Port
/0/100/16 communication C600/X79 series chipset MEI Controller #1
/0/100/16.1 communication C600/X79 series chipset MEI Controller #2
/0/100/1a bus C600/X79 series chipset USB2 Enhanced Host Controller #2
/0/100/1c bridge C600/X79 series chipset PCI Express Root Port 1
/0/100/1c.4 bridge C600/X79 series chipset PCI Express Root Port 5
/0/100/1c.4/0 em1 network NetXtreme BCM5720 Gigabit Ethernet PCIe
/0/100/1c.4/0.1 em2 network NetXtreme BCM5720 Gigabit Ethernet PCIe
/0/100/1c.7 bridge C600/X79 series chipset PCI Express Root Port 8
/0/100/1c.7/0 bridge SH7757 PCIe Switch [PS] /0/100/1c.7/0/0 bridge SH7757 PCIe Switch [PS] /0/100/1c.7/0/0/0 bridge SH7757 PCIe-PCI Bridge [PPB] /0/100/1c.7/0/0/0/0 display G200eR2
/0/100/1c.7/0/1 bridge SH7757 PCIe Switch [PS] /0/100/1d bus C600/X79 series chipset USB2 Enhanced Host Controller #1
/0/100/1e bridge 82801 PCI Bridge
/0/100/1f bridge C600/X79 series chipset LPC Controller
/0/100/1f.2 storage C600/X79 series chipset 6-Port SATA AHCI Controller
/0/1 generic Xeon E7 v2/Xeon E5 v2/Core i7 QPI Link 0
/0/2 generic Xeon E7 v2/Xeon E5 v2/Core i7 QPI Link 1
/0/4 generic Xeon E7 v2/Xeon E5 v2/Core i7 Power Control Unit 0
/0/6 generic Xeon E7 v2/Xeon E5 v2/Core i7 Power Control Unit 1
/0/7 generic Xeon E7 v2/Xeon E5 v2/Core i7 Power Control Unit 2
/0/8 generic Xeon E7 v2/Xeon E5 v2/Core i7 Power Control Unit 3
/0/9 generic Xeon E7 v2/Xeon E5 v2/Core i7 UBOX Registers
/0/a generic Xeon E7 v2/Xeon E5 v2/Core i7 UBOX Registers
/0/b generic Xeon E7 v2/Xeon E5 v2/Core i7 Unicast Registers
/0/c generic Xeon E7 v2/Xeon E5 v2/Core i7 Unicast Registers
/0/d generic Xeon E7 v2/Xeon E5 v2/Core i7 Unicast Registers
/0/e generic Xeon E7 v2/Xeon E5 v2/Core i7 Unicast Registers
/0/f generic Xeon E7 v2/Xeon E5 v2/Core i7 Home Agent 0
/0/10 generic Xeon E7 v2/Xeon E5 v2/Core i7 Home Agent 0
/0/11 generic Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 0 Target Address/Thermal Registers
/0/12 generic Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 0 RAS Registers
/0/13 generic Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 0 Channel Target Address Decoder Registers
/0/14 generic Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 0 Channel Target Address Decoder Registers
/0/15 generic Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 0 Channel Target Address Decoder Registers
/0/16 generic Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 0 Channel Target Address Decoder Registers
/0/17 generic Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 1 Channel 0-3 Thermal Control 0
/0/18 generic Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 1 Channel 0-3 Thermal Control 1
/0/19 generic Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 1 Channel 0-3 ERROR Registers 0
/0/1a generic Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 1 Channel 0-3 ERROR Registers 1
/0/1b generic Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 1 Channel 0-3 Thermal Control 2
/0/1c generic Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 1 Channel 0-3 Thermal Control 3
/0/1d generic Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 1 Channel 0-3 ERROR Registers 3
/0/1e generic Xeon E7 v2/Xeon E5 v2/Core i7 R2PCIe
/0/1f generic Xeon E7 v2/Xeon E5 v2/Core i7 R2PCIe
/0/20 generic Xeon E7 v2/Xeon E5 v2/Core i7 QPI Ring Registers
/0/21 generic Xeon E7 v2/Xeon E5 v2/Core i7 QPI Ring Performance Ring Monitoring
/0/22 generic Xeon E7 v2/Xeon E5 v2/Core i7 System Address Decoder
/0/23 generic Xeon E7 v2/Xeon E5 v2/Core i7 Broadcast Registers
/0/24 generic Xeon E7 v2/Xeon E5 v2/Core i7 Broadcast Registers
/0/3 bridge Xeon E7 v2/Xeon E5 v2/Core i7 PCI Express Root Port 3a
/0/5 generic Xeon E7 v2/Xeon E5 v2/Core i7 VTd/Memory Map/Misc
/0/5.2 generic Xeon E7 v2/Xeon E5 v2/Core i7 IIO RAS
/0/25 generic Xeon E7 v2/Xeon E5 v2/Core i7 QPI Link 0
/0/26 generic Xeon E7 v2/Xeon E5 v2/Core i7 QPI Link 1
/0/27 generic Xeon E7 v2/Xeon E5 v2/Core i7 Power Control Unit 0
/0/28 generic Xeon E7 v2/Xeon E5 v2/Core i7 Power Control Unit 1
/0/29 generic Xeon E7 v2/Xeon E5 v2/Core i7 Power Control Unit 2
/0/2a generic Xeon E7 v2/Xeon E5 v2/Core i7 Power Control Unit 3
/0/2b generic Xeon E7 v2/Xeon E5 v2/Core i7 UBOX Registers
/0/2c generic Xeon E7 v2/Xeon E5 v2/Core i7 UBOX Registers
/0/2d generic Xeon E7 v2/Xeon E5 v2/Core i7 Unicast Registers
/0/2e generic Xeon E7 v2/Xeon E5 v2/Core i7 Unicast Registers
/0/2f generic Xeon E7 v2/Xeon E5 v2/Core i7 Unicast Registers
/0/30 generic Xeon E7 v2/Xeon E5 v2/Core i7 Unicast Registers
/0/31 generic Xeon E7 v2/Xeon E5 v2/Core i7 Home Agent 0
/0/32 generic Xeon E7 v2/Xeon E5 v2/Core i7 Home Agent 0
/0/33 generic Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 0 Target Address/Thermal Registers
/0/34 generic Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 0 RAS Registers
/0/35 generic Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 0 Channel Target Address Decoder Registers
/0/36 generic Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 0 Channel Target Address Decoder Registers
/0/37 generic Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 0 Channel Target Address Decoder Registers
/0/38 generic Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 0 Channel Target Address Decoder Registers
/0/39 generic Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 1 Channel 0-3 Thermal Control 0
/0/3a generic Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 1 Channel 0-3 Thermal Control 1
/0/3b generic Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 1 Channel 0-3 ERROR Registers 0
/0/3c generic Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 1 Channel 0-3 ERROR Registers 1
/0/3d generic Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 1 Channel 0-3 Thermal Control 2
/0/3e generic Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 1 Channel 0-3 Thermal Control 3
/0/3f generic Xeon E7 v2/Xeon E5 v2/Core i7 Integrated Memory Controller 1 Channel 0-3 ERROR Registers 3
/0/40 generic Xeon E7 v2/Xeon E5 v2/Core i7 R2PCIe
/0/41 generic Xeon E7 v2/Xeon E5 v2/Core i7 R2PCIe
/0/42 generic Xeon E7 v2/Xeon E5 v2/Core i7 QPI Ring Registers
/0/43 generic Xeon E7 v2/Xeon E5 v2/Core i7 QPI Ring Performance Ring Monitoring
/0/44 generic Xeon E7 v2/Xeon E5 v2/Core i7 System Address Decoder
/0/45 generic Xeon E7 v2/Xeon E5 v2/Core i7 Broadcast Registers
/0/46 generic Xeon E7 v2/Xeon E5 v2/Core i7 Broadcast Registers

Latin Common Expressions

a posteriori from the latter — knowledge or justification is dependent on experience or empirical evidence
a priori from what comes before — knowledge or justification is independent of experience
faber est suae quisque fortunae every man is the arquitect of his own fortune –quote by Appius Claudius Caecus
acta non verba deeds, not words
ad calendas graecas never — there is no greek calendas (Roman months)
ad hoc to this — improvised or made up
ad hominem to the man — below-the-belt personal attack rather than a reasoned argument
ad honorem for honor
ad infinitum to infinity
ad nauseam used to describe an argument that has been taking place to the point of nausea
ad victoriam to victory — more commonly translated into “for victory,” this was a battle cry of the Romans
alea iacta est the die has been cast
alias at another (time, place…) [Accusative of alius] — an assumed name or pseudonym
alibi elsewhere
alma mater nourishing mother — used to denote one’s college/university
amor patriae love of one’s country
amor vincit omnia love conquers all
annuit cœptis He (God) nods at things being begun — or “he approves our undertakings,” motto on the reverse of the Great Seal of the United States and on the back of the United States one-dollar bill
ante bellum before the war
ante meridiem before noon — A.M., used in timekeeping
aqua vitae water of life — used to refer to various native distilled beverages, such as whisky (uisge beatha) in Scotland and Ireland, gin in Holland, and brandy (eau de vie) in France
arte et marte by skill and valour
astra inclinant, sed non obligant the stars incline us, they do not bind us — refers to the strength of free will over astrological determinism
audemus jura nostra defendere we dare to defend our rights — state motto of Alabama
audere est facere to dare is to do
audio I hear
aurea mediocritas golden mean — refers to the ethical goal of reaching a virtuous middle ground between two sinful extremes
auribus teneo lupum I hold a wolf by the ears — a common ancient proverb; indicates that one is in a dangerous situation where both holding on and letting go could be deadly; a modern version is, “to have a tiger by the tail”
aut cum scuto aut in scuto either with shield or on shield — do or die, “no retreat”; said by Spartan mothers to their sons as they departed for battle
aut neca aut necare either kill or be killed
aut viam inveniam aut faciam I will either find a way or make one — said by Hannibal, the great ancient military commander
barba non facit philosophum a beard doesn’t make one a philosopher
bellum omnium contra omnes war of all against all
bis dat qui cito dat he gives twice, who gives promptly — a gift given without hesitation is as good as two gifts
bona fide good faith
bono malum superate overcome evil with good
carpe diem seize the day
caveat emptor let the buyer beware — the purchaser is responsible for checking whether the goods suit his need
circa around, or approximately
citius altius fortius faster, higher, stronger — modern Olympics motto
cogito ergo sum “I think therefore I am” — famous quote by Rene Descartes
contemptus mundi/saeculi scorn for the world/times — despising the secular world, the monk or philosopher’s rejection of a mundane life and worldly values
corpus christi body of Christ
corruptissima re publica plurimae leges when the republic is at its most corrupt the laws are most numerous — said by Tacitus
creatio ex nihilo creation out of nothing — a concept about creation, often used in a theological or philosophical context
cura te ipsum take care of your own self — an exhortation to physicians, or experts in general, to deal with their own problems before addressing those of others
curriculum vitae the course of one’s life — in business, a lengthened resume
de facto from the fact — distinguishing what’s supposed to be from what is reality
deo volente God willing
deus ex machina God out of a machine — a term meaning a conflict is resolved in improbable or implausible ways
dictum factum what is said is done
disce quasi semper victurus vive quasi cras moriturus learn as if you’re always going to live; live as if tomorrow you’re going to die
discendo discimus while teaching we learn
docendo disco, scribendo cogito I learn by teaching, think by writing
ductus exemplo leadership by example
ducunt volentem fata, nolentem trahunt the fates lead the willing and drag the unwilling — attributed to Lucius Annaeus Seneca
dulce bellum inexpertis war is sweet to the inexperienced
dulce et decorum est pro patria mori it is sweet and fitting to die for your country
dulcius ex asperis sweeter after difficulties
e pluribus unum out of many, one — on the U.S. seal, and was once the country’s de facto motto
emeritus veteran — retired from office
ergo therefore
et alii and others — abbreviated et al. — et alia(neuter plural) et aliae(femenine plural)
et cetera and the others
et tu, Brute? last words of Caesar after being murdered by friend Brutus in Shakespeare’s “Julius Caesar,” used today to convey utter betrayal
ex animo from the heart — thus, “sincerely”
ex libris from the library of — to mark books from a library
ex nihilo out of nothing
ex post facto from a thing done afterward — said of a law with retroactive effect
fac fortia et patere do brave deeds and endure
fac simile make alike — origin of the word “fax”
flectere si nequeo superos, acheronta movebo if I cannot move heaven I will raise hell — Virgil’s Aeneid
fortes fortuna adiuvat fortune favors the bold
fortis in arduis strong in difficulties
gloria in excelsis Deo glory to God in the highest
habeas corpus you should have the body — a legal term from the 14th century or earlier; commonly used as the general term for a prisoner’s legal right to challenge the legality of their detention
habemus papam we have a pope — used after a Catholic Church papal election to announce publicly a successful ballot to elect a new pope
historia vitae magistra history, the teacher of life — from Cicero; also “history is the mistress of life”
hoc est bellum this is war
homo unius libri (timeo) (I fear) a man of one book — attributed to Thomas Aquinas
honor virtutis praemium esteem is the reward of virtue
hostis humani generis enemy of the human race — Cicero defined pirates in Roman law as being enemies of humanity in general
humilitas occidit superbiam humility conquers pride
igne natura renovatur integra through fire, nature is reborn whole
ignis aurum probat fire tests gold — a phrase referring to the refining of character through difficult circumstances
imprimatur let it be printed — applied loosely to any mark of approval or endorsement
in absentia in the absence
in aqua sanitas in water there is health
in flagrante delicto in flaming crime — caught red-handed, or in the act
in memoriam into the memory — more commonly “in memory of”
in omnia paratus ready for anything
in situ in position — something that exists in an original or natural state
in toto in all or entirely
in umbra, igitur, pugnabimus then we will fight in the shade — made famous by Spartans in the battle of Thermopylae and by the movie 300
in utero in the womb
in vitro in glass — biological process that occurs in the lab
incepto ne desistam may I not shrink from my purpose
intelligenti pauca few words suffice for he who understands
invicta unconquered
invictus maneo I remain unvanquished
ipso facto by the fact itself — something is true by its very nature
labor omnia vincit hard work conquers all
laborare pugnare parati sumus to work, (or) to fight; we are ready
labore et honore by labor and honor
leges sine moribus vanae laws without morals [are] vain
lex parsimoniae law of succinctness — also known as Occam’s Razor, the simplest explanation is usually the correct one
lex talionis the law of retaliation
magna cum laude with great praise
magna est vis consuetudinis great is the power of habit
magnum opus great work — said of someone’s masterpiece
mala fide in bad faith — said of an act done with knowledge of its illegality, or with intention to defraud or mislead someone; opposite of bona fide
malum in se wrong in itself — a legal term meaning that something is inherently wrong
malum prohibitum wrong due to being prohibited — a legal term meaning that something is only wrong because it is against the law
mea culpa my fault
meliora better things — carrying the connotation of “always better”
memento mori remember that [you will] die — was whispered by a servant into the ear of a victorious Roman general to check his pride as he paraded through cheering crowds after a victory; a genre of art meant to remind the viewer of the reality of his death
memento vivere remember to live
memores acti prudentes futuri mindful of what has been done, aware of what will be
modus operandi method of operating — abbreviated M.O.
montani semper liberi mountaineers [are] always free — state motto of West Virginia
morior invictus death before defeat
morituri te salutant those who are about to die salute you — popularized as a standard salute from gladiators to the emperor, but only recorded once in Roman history
morte magis metuenda senectus old age should rather be feared than death
mulgere hircum to milk a male goat — to attempt the impossible
multa paucis say much in few words
nanos gigantum humeris insidentes dwarfs standing on the shoulders of giants — commonly known by the letters of Isaac Newton: “If I have seen further it is by standing on the shoulders of giants”
nec aspera terrent they don’t terrify the rough ones — frightened by no difficulties, less literally “difficulties be damned”
nec temere nec timide neither reckless nor timid
nil volentibus arduum nothing [is] arduous for the willing
nihil obstat no objection to an initiative or an appointment — attestation by a church censor that a book contains nothing damaging to faith or morals
nolo contendere I do not wish to contend — that is, “no contest”; a plea that can be entered on behalf of a defendant in a court that states that the accused doesn’t admit guilt, but will accept punishment for a crime
non ducor, duco I am not led; I lead
non loqui sed facere not talk but action
non progredi est regredi to not go forward is to go backward
non scholae, sed vitae discimus we learn not for school, but for life — from Seneca
non sequitur it does not follow — in general, a comment which is absurd due to not making sense in its context (rather than due to being inherently nonsensical or internally inconsistent), often used in humor
non sum qualis eram I am not such as I was — or “I am not the kind of person I once was”
nosce te ipsum know thyself — from Cicero
novus ordo seclorum new order of the ages — from Virgil; motto on the Great Seal of the United States
nulla tenaci invia est via for the tenacious, no road is impassable
obliti privatorum, publica curate forget private affairs, take care of public ones — Roman political saying which reminds that common good should be given priority over private matters for any person having a responsibility in the State
panem et circenses bread and circuses — originally described all that was needed for emperors to placate the Roman mob; today used to describe any entertainment used to distract public attention from more important matters
para bellum prepare for war — if you want peace, prepare for war—if a country is ready for war, its enemies are less likely to attack
parvis imbutus tentabis grandia tutus when you are steeped in little things, you shall safely attempt great things — sometimes translated as, “once you have accomplished small things, you may attempt great ones safely”
pater familias father of the family — the eldest male in a family
pecunia, si uti scis, ancilla est; si nescis, domina if you know how to use money, money is your slave; if you don’t, money is your master
per angusta ad augusta through difficulties to greatness
per annum by the year
per capita by the person
per diem by the day
per se through itself
persona non grata person not pleasing — an unwelcome, unwanted or undesirable person
pollice verso with a turned thumb — used by Roman crowds to pass judgment on a defeated gladiator
post meridiem after noon — P.M., used in timekeeping
post mortem after death
postscriptum thing having been written afterward — in writing, abbreviated P.S.
praemonitus praemunitus forewarned is forearmed
praesis ut prosis ne ut imperes lead in order to serve, not in order to rule
primus inter pares first among equals — a title of the Roman Emperors
pro bono for the good — in business, refers to services rendered at no charge
pro rata for the rate
quam bene vivas referre (or refert), non quam diu it is how well you live that matters, not how long — from Seneca
quasi as if or as though
qui totum vult totum perdit he who wants everything loses everything — attributed to Seneca
quid agis what’s going on? — what’s up, what’s happening, etc.
quid pro quo this for that — an exchange of value
quidquid Latine dictum sit altum videtur whatever has been said in Latin seems deep — or “anything said in Latin sounds profound”; a recent ironic Latin phrase to poke fun at people who seem to use Latin phrases and quotations only to make themselves sound more important or “educated”
quis custodiet ipsos custodes? who will guard the guards themselves? — Juvenal
quod erat demonstrandum what was to be demonstrated — abbreviated Q.E.D.
quorum of whom — the number of members whose presence is required under the rules to make any given meeting constitutional
requiescat in pace let him rest in peace — abbreviated R.I.P. — also requiescat in pacem with accusative instead of ablative or requiescant in plural
rigor mortis stiffness of death
scientia ac labore knowledge through hard work
scientia ipsa potentia est knowledge itself is power
semper anticus always forward
semper fidelis always faithful — U.S. Marines motto
semper fortis always brave
semper paratus always prepared
semper virilis always virile
si vales, valeo when you are strong, I am strong
si vis pacem, para bellum if you want peace, prepare for war
sic parvis magna greatness from small beginnings — motto of Sir Frances Drake
sic semper tyrannis thus always to tyrants — attributed to Brutus at the time of Julius Caesar’s assassination, and to John Wilkes Booth at the time of Abraham Lincoln’s assassination; whether it was actually said at either of these events is disputed
sic vita est thus is life — the ancient version of “it is what it is”
sola fide by faith alone
sola nobilitat virtus virtue alone ennobles
solvitur ambulando it is solved by walking
spes bona good hope
statim (stat) immediately — medical shorthand
status quo the situation in which or current condition
subpoena under penalty
sum quod eris I am what you will be — a gravestone inscription to remind the reader of the inevitability of death
summa cum laude with highest praise
summum bonum the supreme good
suum cuique to each his own
tabula rasa scraped tablet — “blank slate”; John Locke used the term to describe the human mind at birth, before it had acquired any knowledge
tempora heroica Heroic Age
tempus edax rerum time, devourer of all things
tempus fugit time flees — commonly mistranslated “time flies”
terra firma firm ground
terra incognita unknown land — used on old maps to show unexplored areas
vae victis woe to the conquered
vanitas vanitatum omnia vanitas vanity of vanities; everything [is] vanity — from the Bible (Ecclesiastes 1)
veni vidi vici I came, I saw, I conquered — famously said by Julius Caesar
verbatim repeat exactly
veritas et aequitas truth and equity
versus against
veto I forbid
vice versa to change or turn around
vincit qui patitur he conquers who endures
vincit qui se vincit he conquers who conquers himself
vir prudens non contra ventum mingit [a] wise man does not urinate [up] against the wind
virile agitur the manly thing is being done
viriliter agite act in a manly way
viriliter agite estote fortes quit ye like men, be strong
virtus tentamine gaudet strength rejoices in the challenge
virtute et armis by virtue and arms — or “by manhood and weapons”; state motto of Mississippi
vive memor leti live remembering death
vivere est vincere to live is to conquer — Captain John Smith’s personal motto
vivere militare est to live is to fight
vox populi voice of the people