Richard Castera - Explorations in Software Development
Richard Castera - Explorations in Software Development
Browsing Category
Scripts
Scripts Web Server

Recursively remove .svn folders on Windows

September 14, 2011 No Comments

I’m not an SVN guy; I love my GIT but, sometimes you inherit projects where SVN was the choice used for version control. There are many ways to do this of course but my preferred method is creating a Batch (.bat) file in the root of the target folder, add this line and run it.

1
FOR /F "tokens=*" %%G IN ('DIR /B /AD /S *.svn*') DO RMDIR /S /Q "%%G"
Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts Web Server

Drupal – How to install Drush

August 27, 2010 3 Comments

What is Drush?

It’s a command line shell and scripting interface for Drupal. The Drush Package Manager allows you to download, enable, disable, uninstall, update modules/themes/profiles/translations from the command line in a very simple way (apt-get style) – just type,

1
drush dl views

and

1
drush pm-enable views

in a Drupal directory to install the Views project! Additionally, the Drush Package Manager also allows you to update all your modules and even Drupal core with just one command,

Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Scripts Web Server

Magento – Add Static Block to CMS Page

July 29, 2010 5 Comments

Static blocks are a great way to add sections of HTML to your CMS or Catalog pages. I’m going to show you how to add a static block to a CMS page.

It’s a 2 step process and a very simple one. First, create your static block by going to CMS->Static Blocks. You will use the identifier of your static block to reference it on the CMS page. Edit the CMS page you would like this block to appear in, and add this code in the location where you would like it to show up:

1
{{block type="cms/block" block_id="home-page-promo"}}
Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Scripts Web Server

MySQL – Using a Column Name Inside the LIKE Keyword

June 14, 2010 7 Comments

When using the LIKE keyword in a MySQL query, I use it the most typical way, LIKE ‘%STRING%’. One day, I was in need to use a column name instead and could not figure out how to do it! At first, I tried to just replace the string value with the column name like this, LIKE (%t.column%). The end-result was not good as the LIKE keyword expects a string.

So, I thought of trying the CONCAT() function since that returns a string. And it worked!

MySQL
1
LIKE CONCAT('%', t.column)

Hope this helps someone!

Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Scripts Web Server

MySQL – How to Export and Import tables with the Command Line

June 13, 2010 2 Comments

2 commands I use often throughout the day is importing and exporting large databases into MySQL VIA the command line. Here is how I do it where “USERNAME” is your username, “PASSWORD” is your password and “DATABASE” is your database name.

To Export:

MySQL
1
mysqldump -uUSERNAME -pPASSWORD DATABASE | gzip -c > ~/dump_2010-06-14.sql.gz

To Import:

MySQL
1
mysql -uUSERNAME -pPASSWORD DATABASE < database.sql

Also, you may have a large database that may give you errors while importing. You can use this command to force the import without warnings or errors:

MySQL
1
mysql -f -uUSERNAME -pPASSWORD DATABASE < database.sql
Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts

Magento – Get the Total Price of items currently in the Cart

June 10, 2010 12 Comments

Ever wanted to get the total price of items in your Magento cart? Here you go:

PHP
1
<?php echo $this->helper('checkout')->formatPrice(Mage::getSingleton('checkout/cart')->getQuote()->getGrandTotal()); ?>
Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts

Magento – Contact Form Not Submitting Bug

June 7, 2010 5 Comments

Since the new release of Magento, people have been encountering a lot of problems. One of them in particular, seem to be the contact form. The error is, “Unable to submit your request. Please, try again later.” If you’re on Magento 1.4 and get this error when submitting the contact form, that’s because your template (theme) is not fully compatible with 1.4. Your Magento theme is overriding the form.phtml file with its own version, which doesn’t have the new line in it. Here’s what you’ll need to do to quickly fix this error:

Open this file in your theme folder:

XHTML
1
app/design/frontend/default/YOUR_THEME/template/contacts/form.phtml

And add the following hidden field somewhere before the submit button:

XHTML
1
<input id="hideit" style="display: none !important;" name="hideit" type="text" />
Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts

Google Analytics – How to manually Track Clicks on Outbound Links

May 20, 2010 6 Comments

You can use Google Analytics to track clicks on links that lead away from your site. Because links that lead away from your site are not automatically tracked, you will need to manually tag all outbound links you want to track. To do this, you’ll add some JavaScript customizations to your page and to the links you want to track.

Continue reading
Reading time: 2 min
Share:
Written by: rcastera
Resources Scripts Web Server

Enable cURL with XAMPP

May 3, 2010 3 Comments

cURL is disabled by default in your XAMPP installation. To enable it, you have to modify the php.ini files in your XAMPP folder. Follow the steps below to get it up and running.

  1. Locate the following files:
    INI
    1
    2
    3
    C:\Program Files\xampp\apache\bin\php.ini
    C:\Program Files\xampp\php\php.ini
    C:\Program Files\xampp\php\php4\php.ini
  2. Uncomment the following line on your php.ini file by removing the semicolon.
    INI
    1
    ;extension=php_curl.dll
  3. Restart your Apache server.
  4. Check your phpinfo if curl was properly enabled.
Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts Web Server

How to setup a local web server on your computer using XAMPP

April 3, 2010 20 Comments

Web development work should always be done locally. When developing a website, all the development work should be done on a local LAMP Stack environment installed on your computer. That way, the production time is greatly reduced and you can fully test your work before launching.

When you are completely done developing your project, the migration to the live server is seamless. Here are the simple steps to install a local server on your PC to easily develop websites.

This article applies to the installation on Windows 98, NT, 2000, 2003, XP and Vista, of Apache, MySQL, PHP + PEAR, Perl, mod_php, mod_perl, mod_ssl, OpenSSL, phpMyAdmin, Webalizer, Mercury Mail Transport System for Win32 and NetWare Systems v3.32, Ming, JpGraph, FileZilla FTP Server, mcrypt, eAccelerator, SQLite, and WEB-DAV + mod_auth_mysql.

Continue reading
Reading time: 2 min
Share:
Written by: rcastera
Page 2 of 9«1234»...Last »

About me

Hello, my name is Richard Castera. I have more than 12 years of experience architecting, implementing, leading and launching large scale, high performance software products in a fast-paced agile environment.

Popular Posts

Magento – Display new products on the home page

May 20, 2009

How to Fix “Internet Explorer Cannot Open the Internet Site- Operation Aborted” Error

May 9, 2009

PHP – Convert Array to Object with stdClass

July 5, 2009

Categories

  • Home Automation
  • Resources
  • Scripts
  • SEO
  • Thoughts
  • Web Server

Tags

Apache Apple Bash CSS Drupal Free home automation htaccess Java Javascript Magento PHP raspberry pi SEO SQL thoughts Wordpress

© 2019 copyright Richard Castera // All rights reserved