Thursday, October 20, 2011

Sample Coldfusion Code for Paypal

If you need to integrate PayPal into your website.  PayPal has some good sample code for you.

Thursday, October 6, 2011

Command Line to save Directory Structure to a file

 I wanted to be able to save only the directories to a file.

Here is the command.

dir /A:D /S /B E:\Inetpub\wwwroot\Domains > e:\randyfiles.csv

/A:D -- Only show directories

/S -- Recurse through the directory and subdirectories

/B  -- Users the bare format.  1 directory per line

Tuesday, September 20, 2011

jQuery Ajax and Passing Data

I was having an issue the other day with passing an ampersand into a script via jQuery Ajax. 

I was doing this: data:"category="+category+"&groupname="+groupname, If the groupname had an ampersand in it the variable was getting cut off. After do some research on the issue I found a better way to pass in data. This improved way of passing in the data automatically url encodes the data to be passed in properly.


Sunday, September 11, 2011

Chrome extensions I use on a regular basis

Google Chrome Sync feature makes it easy for me to remember what extensions I use because if I reinstall and  re-enter my account credentials it will reinstall the extensions for me.  It is a pretty cool feature.

Here are the chrome extensions I use on a regular basis.  I have a few more installed that I have tried, but these are the extensions I use on a regular basis.

Screen Capture (By Google)

Auto Refresh Plus

Last Pass

Mail Checker Plus for Google Mail

Which extensions can you not live without?

Tuesday, August 23, 2011

How to Increase Memory in Tomcat - Railo Setup

This might be common knowledge to most, but I have to look it up every time.

If you need to increase the memory in Apache Tomcat.

Look here:  /opt/railo/tomcat/bin/setenv.sh

JAVA_OPTS="-Xms256m -Xmx512m -XX:MaxPermSize=128m ";   # memory settings.

Remember to restart Railo / Tomcat   afterwards:

/etc/rc.d/init.d/railo_ctl restart




Monday, August 22, 2011

How to get ProxyPass to ignore a URL so you can still use Apache HTACCESS

On a few of my servers I use Apache with Apache Tomcat. and ProxyPass to forward requests from apache over to Tomcat for my Coldfusion pages.

The part I have been struggling with for so long was how to do password protected directories in apache.  Either by adding the config to the VirtualHost directive or by .htaccess.

It seemed no matter what I did, requests were getting proxied and there was nothing I could do about it.

Tonight I finally found my answer:

The ProxyPass !  combo:

ProxyPass /dealers/ !

Here is the whole apache configuration I use for connecting Apache to Tomcat and URL Rewriting:






I found this mentioned on a Sitepoint Post

Saturday, August 20, 2011

ColdFusion By Example - Comparing strings

After a slow start I finally completed the first post of my Coldfusion By Example series.  I am not extremely happy with it yet, but I need to start somewhere.  I feel like I did not add enough explanation to the post. There is not much to say about comparing strings.  I will review the post again in a couple days and see if I can add any more to it.  I am also open to any suggestions.

How to compare strings in Coldfusion



Monday, April 18, 2011

FTP Script from the command line

For the longest time I have always used wget to handle command line ftp downloads.

For one particular download I was doing wget stopped working with wildcards.  Probably something to do with the server I was connecting to.

I started researching and found a cool windows batch file to do this:

 

Windows server 2003 and Windows XP – How to script file download from FTP server

 

Here is the script from the example altered for my needs.

@echo off
echo user MyUserName> ftpcmd.dat
echo MyPassword>> ftpcmd.dat
echo bin>> ftpcmd.dat
echo prompt>>ftpcmd.dat
echo cd IDX>>ftpcmd.dat
echo mget pics-*-2*.tar>> ftpcmd.dat
echo quit>> ftpcmd.dat
ftp -n -s:ftpcmd.dat SERVERNAME.COM
del ftpcmd.dat

Monday, April 11, 2011

Javascript date format

I thought it weird that Javascript didn't / doesn't really have an easy way to format Dates.  I ended up using the first link.

 

1. http://blog.stevenlevithan.com/archives/date-time-format

 

2.  http://jacwright.com/projects/javascript/date_format

 

Thursday, March 31, 2011

Egg Solutions Virtual Tour Mime Types

Today we had to setup mime types in IIS for Egg Solution Virtual Tours.

 

We added

File Extension: .class

File Extension: .ear

File Extension: .egg

 

Mime Type: application/java-archive

Friday, March 25, 2011

Installing sun-java6-jre on Ubuntu 10.10

 

Today I was trying to install Sun Java JRE.

 

to install sun-java6-jre on Ubuntu 10.04 LTS, type the commands below in Terminal:

Code:
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
Code:
sudo apt-get update
Code:
sudo apt-get install sun-java6-jre

 

Credit http://www.ubuntugeek.com/how-to-install-java-runtime-environment-jre-in-ubuntu-10-10-maverick-using-ppa.html

 

When I ran the first command above I received the following error:

sudo: add-apt-repository: command not found

 

I ended up having to run this command and everything was made better

sudo apt-get install python-software-properties

Sunday, March 20, 2011

Turbo Charge Eclipse / CFEclipse / Aptana

Today I was going through my google reader and I found an article on how to turbo charge Eclipse by Mike Henke.

I replaced my eclipse.ini file with the options he suggested and the startup time and performance has been better.  I will report back after a few days if I have any issues.

Wednesday, March 16, 2011

Javascript Rounding

I had a javascript calculation that was displaying a ton of decimal points.

 

Here is a way to round to 2 decimal places in Javascript:

 

 

var total = 123.433

total = Math.round(total*100)/100  //returns 123.43

Credit Goes to Javascript ToolKit

 

Break up a large filename for transfer

Today I was trying to transfer a file from 1 server to another.  At first I thought the file was too large, so I set out to break up the file.

 

Credit goes to Techie Corner.

 

To Split the file:

split --bytes=500m /home/photosrandycc.tar.gz /home/bu

 

 

To Restore the file:

cat bu* > photosrandycc.tar.gz

 

Turns out the real issue was virtualmin actually set a 1GB quota.

 

 

Thursday, March 10, 2011

Flush Logs on MySQL Without Restarting the Server

For the longest time I thought you had to stop mysql and rename the log files and then restart when on Windows.

That's definitely not the case.

Simply rename the error log file and then run this command and it will reset the error log file.  Be sure to change out the username to your username.
mysqladmin -urandy -p flush-logs

Thursday, January 6, 2011