Q. How do I know which ports are currently in use?
A. Run the following from the terminal window:
sudo lsof -i -P | grep -i "listen"
monkey love coldfusion
Q. How do I know which ports are currently in use?
A. Run the following from the terminal window:
sudo lsof -i -P | grep -i "listen"
For as long as I can remember I have wanted a formatted, printable report of Dreamweaver search results. Since Dreamweaver’s “Save Report” of the results pane is an xml file I have always been too lazy to pursue it. I have finally put forth a little effort to generate one using XSLT. XSLT stands for XSL Transformations. XSLT “transforms” XML documents into other formats, like XHTML.
Download the search_results.xsl file here. Unzip it. It is the file that will perform the styling of your XML results file. Hang on to it for now.
Open Dreamweaver’s “Find and Replace” window (Command + F). Enter your search criteria and click “Find All”.
In the “Results” pane click the save icon.
You can accept Dreamweaver’s default file name or give the file a name related to your search. I’ll call mine Post.xml. Save it in the same directory where you put search_results.xsl. Open Post.xml (or whatever you called it) with Dreamweaver and add the one line of code annotated below with the red arrow.
Now open your Post.xml file with a web browser such as Safari. You should see your search report formatted as follows:
You now have a nice printable report complete with results total.
*** UPDATED 2/27/2015 ***
As a security measure Chrome blocks access to local files. You must open Chrome from the command line with a flag to allow access to local files.
Follow these steps to allow local file access in Chrome on the Mac:
open /Applications/Google\ Chrome.app --args --allow-file-access-from-files
Comments
REM Comment Style 1
:: Comment Style 2
Set a variable
SET myCat=Dante
Output a variable
ECHO %myCat%
If then Else statement
if %yCat%== "Dante" (ECHO MY CAT) ELSE (ECHO NOT MY CAT)
Output a command’s result to a file
dir >> log.txt
Split a command across 2 lines (use ^ at the end of the line)
ECHO This is line one and ^
this is line 2.
Two commands on 1 line (separate with &)
echo command 1 & echo command2
List only directory names and no info
dir /b /ad
For-in-do (For every item do something)
FOR /F %%G IN ('dir /b /ad %repodir%') DO ECHO %%G
Assumptions (Kind of major assumptions):
/Applications/MAMP/conf/appache/httpd.conf
/Applications/MAMP/htdocs/csimmons
$ sudo pico /etc/hosts
# VIRTUAL HOST START
127.0.0.1 csimmons.dev
# VIRTUAL HOST STOP
$ dscacheutil -flushcache
$ pico /Applications/MAMP/conf/apache/httpd.conf
Change the following:ServerName localhost:8888
ServerName 127.0.0.1:8888
Continue to the very bottom of the file (use CTRL+V to page down faster) and you will find “Section 3: Virtual Hosts”. Add the following at the very end:
NameVirtualHost 127.0.0.1
<virtualhost 127.0.0.1>
DocumentRoot /Applications/MAMP/htdocs
ServerName localhost
</virtualhost>
# DEVELOPMENT HOSTS START
<virtualhost 127.0.0.1>
DocumentRoot /Users/username/Sites/csimmons
ServerName csimmons.dev
</virtualhost>
# DEVELOPMENT HOSTS STOP
CTRL+O to write the file (then hit ENTER)
CTRL+X to exit pico
hosts file:
# VIRTUAL HOST START
127.0.0.1 csimmons.dev
127.0.0.1 site2.dev
# VIRTUAL HOST STOP
Apache config file:
# DEVELOPMENT HOSTS START
<virtualhost 127.0.0.1>
DocumentRoot /Users/username/Sites/site2
ServerName csimmons.dev
</virtualhost>
<virtualhost 127.0.0.1>
DocumentRoot /Users/username/Sites/site2
ServerName site2.dev
</virtualhost>
# DEVELOPMENT HOSTS STOP
I recently had to implement Subversion at work to manage our source code. Part of that implementation was coming up with a way to automate the backup process. Since developers could be accessing code repositories at any time there is a special command (called hotcopy) in Subversion for copying a repository to another location, which you can then backup to disk, tape, etc.
I started out just doing a simple DOS .bat file to run the hotcopy. My plan was to schedule this to run in the Windows scheduler prior to the nightly backup. As I started working on the script though I found myself trying to improve it to be as generic and hands off as possible. I also wanted to backup multiple repositories.
Here are some “features” of the script:
Here is a look at the actual hotcopy command in the .bat file:
ECHO Starting SVN backup for %%G... >> %repolog% & ^
svnadmin hotcopy %repodir%%%G %repodirhot%%%G --clean-logs >> %repolog% & ^
Download it here and rename it from svn_backup.txt to svn_backup.bat.
I had to do some basic analysis of email addresses at my company the other day.¬ Here are a few useful SQL queries.
Show 10 records with the most data in field ’email’ (10 longest email addresses)
SELECT TOP 10 email, LEN(email) AS fieldLength
FROM person
ORDER BY fieldLength DESC
Count all records with field ’email’ over 20 chars
SELECT COUNT(*) AS emailOver20
FROM person
WHERE LEN(email) > 20
Display the average length of data (in characters) of field ’email’
SELECT AVG(LEN(email)) AS emailAvgLength
FROM person
It’s never too early to start thinking about Georgia football. Even though it is only May I thought I would start getting psyched up by putting together a list of the top 10 games I’ve been to in the last 10 years or so.
Enjoy, Dawg fans.
Running shoes last about 350 to 550 miles. This mostly depends on the surface(s) you run on, your weight, and your running style. Since I weigh a little more than the average runner and I run on asphalt and sidewalks my shoes are bald around 350 miles. Today I retired my Air Pegasus in favor of a sweet new pair of Nike Air Zoom HAYWARD (pictured above). The Hayward’s run a lot like my old Nike Air Zoom Moire’s.
For some reason when you have a datetime field in a cfgrid column it displays in a long format like this: Nov 17 2006 01:00:00
If we work a little SQL magic (using “CONVERT”) in the cfquery though we can do the formatting we want, which is: 11/17/2006. Refer to the “styles” listed in Figure 3 to see what formatting is available.
Coldfusion Query:
SELECT note_id,note_text,
CONVERT(varchar,note_date,101) as note_date
FROM tbl_notes
ORDER BY note_date
Style ID | Style Type |
0 or 100 | mon dd yyyy hh:miAM (or PM) |
101 | mm/dd/yy |
102 | yy.mm.dd |
103 | dd/mm/yy |
104 | dd.mm.yy |
105 | dd-mm-yy |
106 | dd mon yy |
107 | Mon dd, yy |
108 | hh:mm:ss |
9 or 109 | mon dd yyyy hh:mi:ss:mmmAM (or PM) |
110 | mm-dd-yy |
111 | yy/mm/dd |
112 | yymmdd |
13 or 113 | dd mon yyyy hh:mm:ss:mmm(24h) |
114 | hh:mi:ss:mmm(24h) |
20 or 120 | yyyy-mm-dd hh:mi:ss(24h) |
21 or 121 | yyyy-mm-dd hh:mi:ss.mmm(24h) |
126 | yyyy-mm-dd Thh:mm:ss.mmm(no spaces) |
130 | dd mon yyyy hh:mi:ss:mmmAM |
131 | dd/mm/yy hh:mi:ss:mmmAM |
Disclaimer: This tip will probably be really basic for most SQL folks.
The task: The company I work for has a web application that does some basic tracking of grants. The system feeding information to this application just had an across the board change to the numbering scheme of the grants. All grants must have a prefix of “999-“. Therefore, any grant not beginning with “999-” must be updated. Example: a grant with the current number 8789966 needs to be 999-8789966.
The solution: The SQL below does two things. It updates all the grants to prepend the 999- prefix while also skipping any grants that are already correctly prefixed.
UPDATE tbl_grants
SET grant_no = '999-' + grant_no
WHERE grant_no NOT LIKE '999-%'