Tag: programming


The most common shortcuts for code editing | OSX

Most Common Text Editor Hot Keys For Programmers Here are a list of hot keys that work the most universally as possible for text editing. There are so many hot keys and yet so little time. Which hot keys should you learn? If you work in the command l...

How to open multiple Iterm windows on startup

Find your self having to run a server or turn on some sort of process every time you open up your development environment? The script bellow will help you set up your own custom default tabs in iterm running what ever scripts you want when the window i...

Running different ANT tasks depending on the operating system

How to run a different series of tasks inside of a single target tag based on the operating system so that your build script will work on all operating systems. There are three ways to do it: 1.) The first way is to have a different task for each ope...

Installing xdebug in XAMPP 5.5.19 on Mac OSX

This was tested on OSX Lion. Please let me know if it works on Mountain Lion or later. Here is what we will be doing in a nut shell. You will need to download the correct source code for your version of xdebug and then you will need to use the correct...

Replace a token with a variable using ANT

You may be looking for the following: How do you replace a string in a file using a property in ANT? How do you replace a string using a variable in ANT? There are a few ways to do this. First question is what do you mean by a variable? Do you mean ...

Don't insert when maximum is reached

How to control if a record is inserted based on a condition? Don't insert a record if certain conditions are not met. There is a way of using pure MySQL to stop inserting records when a certain number of them has been reached. Let us say that you have...

MySQL CONCAT limitation

So you're trying to concat two large strings and it keeps resulting in a truncated or empty string? The problem may be that CONCAT can only result in a string of length 1024 bytes long. Worse is there is no setting in MySQL that allows you to increat...

Installing xdebug in XAMPP 1.8.3 on Linux

If you have installed XAMPP 1.8.3-0 for Linux and you want to install x-debug here is how to do it using PECL. 1.) Check to make sure /bin is in your path echo $PATH; if :/bin: is in the path then bin is in your path. This makes sure that when you c...

GB vs. GIB | 1024 vs. 1000

Looking for answers to these questions? Why are there two types of GB? Why is a KB 1024 and not 1000 bytes? Did you know there are two types of Gigabytes (GB)? What if I told you that they are not the same amount of bytes? That manufacturers list th...

Get size of database in bytes and rows

How to get the size of the database in MySQL? Replace database_name with the database name from which you want the size in bytes and rows: SELECT t.table_schema,SUM(t.table_rows) AS row_count,SUM(t.data_length) AS data_volume FROM information_schema.t...

Ipoint interface | ActionScript 3.0 AS3

It amazes me that ActionScript (AS3) does not have interfaces listed for all its classes. Often you want to create a class that inherits from something like MovieClip and MovieClip inherits all the way down a long list of classes. So you are left with ...

Using Table Names With Spaces in PHP and mySQL

The key to writing SQL queries using table names that contain spaces is to make sure you use the correct quotes.This is wrong:SELECT * FROM tablename ORDER BY ''field name'' ASCThis is correct:SELECT * FROM tablename ORDER BY `field name` ASCThese (`) ...

Unix style options and flags with command line PHP

Looking for a more intelligent way to parse in options from the command line into your PHP script other than $argv? For example, you may want to be able to place options in any order like the following: php somescript.php -pv -o value or php somescr...

Parse a date by a specific date format in PHP

In the name of code readability and functionality, if you want to parse a date of a certain format you should do it in a way so that other programmers that look at your code can tell what you were doing. Here is a way as of PHP >= 5.3.0 to parse a st...

Design your code to be grep'ed or searched

Seriously. So that future developers who work with your code can reverse engineer your code. 1.) Store code in flat text files When you are looking for a variable you want to refactor you should not have to find it in some code stored in a database...

Increment date by one day | < PHP 5.2

If you want to increment a date by one day you need to do it using the PHP DateTime function so that you can account for leap years. date_default_timezone_set('UTC'); $time_stamp = strtotime('0000-00-00 00:00:00'); $date = new DateTime(); $date->setTi...

Generate a list of dates between two dates in PHP

If you want to create a list of dates between two different Unix time stamps, here is how to do it: //2001-09-09T01:46:4 $starting_unix_timestamp = 1000000000; //now $ending_unix_timestamp = time(); date_default_timezone_set('America/Denver'); $star...

Installing PECL command on a Linux box

PECL is a command that comes with PEAR. PECL allows you to load PHP extensions which are programmed in C. to install it use the package manager that comes with your brand of Linux: apt-get install php5-pear or yum install php-pear or... rpm php-pear

Set up Squirrel to connect to a MySQL database.

We are assuming you have already installed Squirrel In order to set up Squirrel Database Client to connect to a MySQL database you must: 1.) go to http://dev.mysql.com/downloads/connector/j/#downloads 2.) select your platform, if you are running it on...

Convert string to list of ASCII codes in bash

If you want to take a string and get the ascii code for each character in the string using a bash script then use the following function: function string2ascii_codes { str=$1; list=($(echo $str|sed 's/\(.\)/\1 /g')); ascii_result=''; ...

Boulder apps - tech blog

Hello, My name is Nicholas Dunbar. I am a web app designer and developer who lives in Boulder, Colorado. This is where I collect my thoughts on programming, design and entrepreneurship. My code and solutions are copied and pasted into hundreds of appl...

Reset Drupal MySQL password | Drupal 6 | SQL

If you have access to mysql through the root user and want to just change the drupal database user this will work for you. Otherwise check out [http://www.thegeekstuff.com/2009/07/how-to-reset-forgot-mysql-root-password-on-unix-linux-windows/](http...

Hide a block on all admin pages | Drupal 6

There are two main ways to do disable a certain block on all admin pages. The first way involves using the administrative tools provided in the backend. The second uses custom script. -----------------------------------option 1 -----------------------...

Merge documentation | Mailchimp | Drupal

If anyone has more complete information on this subject please comment below. If you installed the drupal MailChimp Module you might want to know how to "Merge Variables" If you were like me you created a list on mailchimp Added the Drupal Mai...

Detecting an iframe with JavaScript

How do you tell if your content has loaded into an IFRAME container? I use a very simple JavaScript to detect an IFRAME. This can be used to determine if some one is loading your content into their external page without cross domain permisions...

How to recursively traverse an XML object in AS3

I found lots of examples on how to recusively parse through an XML object using E4X in ActionScript 3 (AS3). None of these examples were very simple or to the point. Most relied on the specifics of the XML instead of making general code that could acce...

Why is PHP so ugly?

In short... PHP is old and has gone through many versions. In long... PHP's syntax is influenced by Unix bash shell style scripting, C langauge, object oriented programming and dynamic language constructs (similar to what you would find in a languag...

Naming code | SEO for technical documentation

In the age of Google, the success of a technical product relies on more than just the search-ability of your documentation. If you are successful a community of users will spring up. They will post on forums looking for solutions and others will answer...

Generate a MySQL query string using MySQL

Sometimes you may want to use MySQL to generate a series of SQL statements. In this example we want to create a series of colon (;) delimited MySQL commands that the contents of a series of tables that exists in many different databases. The secret t...

How to get today's date in ActionScript 3 (AS3)

The Date() constructor takes up to seven parameters (year, month, ..., millisecond) to specify a date and time to the millisecond. The date that the newly constructed Date object contains depends on the number, and data type, of arguments passed. If...

AS3 design pattern | Organize packages for a multi SWF project

Design Pattern - How to organize packages for decoupling externally loaded SWFs.Here is a design pattern that will show you how the hierarchy should work when building a complicated program that loads in multiple external SWFs. There is a root to the p...

Decouple Externally Loaded SWFs in AS3

How to decouple externally loaded movieClips from their loader in Actionscript 3 (AS3) Here is a common problem: TypeError: Error #1034: Type Coercion failed: cannot convert com.yourUrl.mainClass.SomeClass@48cb821 to com.yourUrl.mainClass.SomeClass at ...

Tree menu with ActionScript AS3

##An Example of How to Customize a Tree Component## I came across some open source code developed by Yahoo! called the Yahoo Atra components. VERY HARD TO CUSTOMIZE! I found the documentation to be particularly inadequate for the degree that I wanted t...

Code for a resizable window in AS3

Flex handles window resizing really well so there is little need anymore to program your own custom window code. But for those of you who want a manually resizable window without loading some massive amount of flex code just to get resizable window cod...

Customizing Flash Paper 2 with Actionscript 2.0 (AS2)

I set out to customize Flash Paper using ActionScript 2. There is a lot of info on the web, the best pages being: http://www.adobe.com/support/documentation/en/flashpaper/2/flashpaper_api/But they don''t include very many examples of how to use the A...