Archive

Archive for the ‘Uncategorized’ Category

Reset a phpStorm project

December 5th, 2011 No comments

I had a problem upgrading to phpStorm 3.0. Needed to kill the project data, for phpStorm to reset.

$> rm -rf .idea

to clear the project data.

Categories: Uncategorized Tags:

Hosting with Apache and SVN

November 18th, 2011 No comments

I have a requirement to not serve SVN meta data with the project, once deployed on a server.

So what can I do?
Prevent Apache from serving the content:

Put an apache directive:

<DirectoryMatch .*\.svn/.*>
Deny From All
</DirectoryMatch>

 

or:

Remove all the SVN metadata altogether

While in the *nix prompt:

find . -name ".svn" -type d -exec rm -rf {} \;
Categories: Uncategorized Tags:

Magento DB transaction commit rollback sniplet

January 18th, 2011 1 comment

Took me a while to find out how to do this… as there was no good examples on the web.
So, here it is… so I can find it again.

keywords:
db database transaction rollback commit magento zend.

try {
    $write = Mage::getSingleton('core/resource')->getConnection('core_write');
    $write->beginTransaction();

// do stuff here

    $write->commit();
} catch (Exception $e) {
    mage::log(__METHOD__ . ':' . __LINE__ . ': Rollback happened.');
    $write->rollback();
}

Please drop a line if you found this useful. Thanks!

Categories: Uncategorized Tags:

linux find the last modified file in directory

October 22nd, 2010 No comments

ls -tr | tail -n 1

Categories: Uncategorized Tags:

Symfony 1.4 quick commands

October 8th, 2010 No comments

I always forget these commands… so I’m posting it here, so I can find them again easily.

Getting a value out of a loaded yaml config file.

[project root]/app/frontend/config/app.yml

all:
.general:
api_key: ASDFASDFASDFASDF

sfConfig::get(‘app_api_key’);
will return “ASDFASDFASDFASDF”;

Categories: Uncategorized Tags:

Build PHP 5.3.3, on centos 5.5

October 1st, 2010 1 comment

I’m assuming you have a fresh install of centos 5.5.


$> yum groupinstall "Development Tools"

$> wget http://us.php.net/get/php-5.3.3.tar.bz2/from/www.php.net/mirror

$> tar xvf php-5.3.3.tar.bz2
$> yum install mysql-server httpd-devel-* libxml2-devel-* openssl-devel* xmlsec1-openssl-devel-* libpng* libjpeg* curl-devel libmcrypt* mysql-devel* mysql.*

$> cd php-5.3.3
$> ./configure --with-mysql=shared --with-openssl --enable-pdo --with-pdo-mysql=shared --with-mhash=shared --enable-soap=shared --with-config-file-path=/etc/ --with-apxs2 --with-mysqli --enable-zip --enable-shared --with-curl --enable-mbstring=all --enable-maintainer-zts --with-jpeg-dir=/usr/lib/ --with-libdir=lib64 --enable-soap --with-pdo-mysql --with-gd --with-mcrypt

$> make; make install;

$> service httpd restart

and there you go… php 5.3.3 on the box…

Categories: Uncategorized Tags:

Find SVN directories and remove them

October 20th, 2009 No comments

http://www.lloydleung.com/2009/06/17/find-svn-directories-and-remove-them/

Useful linux command to remove svn data, when you need to clean it up for some reason.

Note: Use sparingly.

Categories: Uncategorized Tags:

shared dev environments… don’t DOs.

April 6th, 2009 No comments

SV…. thanks…

If you’re about to do the following, notify others.  Or people start yelling at you.

  1. Drop tables/columns/data
  2. Restart the database / HTTPD / other services

Or… alternatively, make your own sandbox, and you can play all you want…

Categories: Uncategorized Tags:

Why are the dates different?

January 5th, 2009 No comments

<?php
echo date('Y-m-d H:m:s', 1229367412.43);
// gives 2008-12-15 13:12:52

echo date('Y-m-d H:m:s', 1229367412);
// givse 2008-12-15 13:12:52

mysql
select from_unixtime(1229367412.43);
// gives 2008-12-15 13:09:22

select from_unixtime(1229367412);
// gives 2008-12-15 13:09:21

The problem is your date function is calling for H:m:s -> Hour:Month:Seconds. Next time try H:i:s -> Hour:Mintues:Seconds.

You are dumb!

Categories: Uncategorized Tags:

found myself doing the start of a botched code…

December 3rd, 2008 No comments

“XSLT is a pain in the ass”. That was coming out of my mouth… until, you start understanding it. Best tool for the job, XSLT. It’s designed to style XML…

The solution to my problem was easy once you see samples. My problem was XSLT scoping was never discussed in much detail, in any example I saw.

I may eventually write a little code bit, for future reference.

Categories: Uncategorized Tags: