jump to navigation

Getting the link from A tags /Getting all the links from a string in ColdFusion April 2, 2009

Posted by scoopseven in ColdFusion, MediaPost.
add a comment

I thought for sure that this would be something fairly easy to find. Alas, it was not.

I did find a way to get all of the text from between the a tag, but not the links.  Here’s how you do it:

<cfset beginlink = REFindNoCase(“https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?”, myText)>
<cfset endlink = findnocase(‘”‘, myText, beginlink)>
<cfset linklen = endlink – beginlink>
<cfset mylink = mid(myText, beginlink, linklen)>

Obviously, you can optimize this into a couple of lines, but there it is.

Virtual Hosts with Jboss / Apache / ColdFusion March 25, 2009

Posted by scoopseven in ColdFusion, Linux, MediaPost.
add a comment
So I needed to do something that I used to consider simple. I had www.mysite.com up and running with Apache / Jboss / ColdFusion and I wanted to create a virtual host, sitetwo.mysite.com to point the same configuration as www.mysite.com. I used to do this easily in IIS by creating a new Host Header entry under the website properties in IIS. Not so simple with the new configuration.
Step 1: Setup the DNS record. All starts with the CNAME record pointing sitetwo.mysite.com to www.mysite.com.
Step 2: Let Apache know about sitetwo.mysite.com.
ServerName www.mysite.com
ServerAlias sitetwo #added this line to Apache .conf file.
After doing updating the Apache .conf file and restarting Apache, you should be able to get to sitetwo.mysite.com but since JBoss hasn’t been setup to deal with it, you’ll get some annoying JBoss error that says the site hasn’t been configured in JBoss.
Step 3: Modify jboss-web.xml. For my install, this file was located in JBoss/server/default/deploy/mysite.war/WEB-INF/.
<jboss-web>
<context-root> /</context-root>
<virtual-host>www.mysite.com</virtual-host>
<virtual-host>sitetwo.mysite.com</virtual-host>
</jboss-web>
After I added the virtual host line for sitetwo.mysite.com and restarted JBoss I could access the new site aok. Here’s the BIG caveat. When you go to sitetwo.mysite.com/cfide/administrator, you’re presented with a complete *separate copy* of your original ColdFusion settings. If you have scheduled tasks setup, be careful, now there’s two of them, so they’ll run twice unless you delete them from your new administrator.  And be super careful of deleting your scheduled tasks!  After I did that, they disappeared from both of my administrators, so make sure you backup your scheduled tasks. You have two different ColdFusion administrators now, so be aware of caching, scheduled tasks, debugging, logins, etc.

Spidering and Saving Images with CFHTTP and CFFILE March 11, 2009

Posted by scoopseven in ColdFusion, Linux, MediaPost.
add a comment

Goal: To spider a site (our own site) and save all image files from the pages on that site to a hard disk on another server.

Thanks to Ben Nadel for showing me the way on this one.  For some reason the path/file attributes on cfhttp were not allowing me to save a image file to the hard disk on our linux (CentOS) server. I thought I could save the file using cfcontent somehow, which led me to Ben’s post. Never thought to just save the binary stream using cffile. Not sure if there was a permissions problem or what, but here’s the work-around.

<!— Grab the image file. —>
<cfhttp
method=”get”
url=”http://www.myurl.com/someimage.jpg”
useragent=”#CGI.http_user_agent#”
getasbinary=”yes”
result=”objGet”  />

<!— Save the image file. —>
<cffile action=”write” 
output=”#objGet.FileContent#” 
mode=”777″ 
file=”/mypath/myimage.jpg”>

This worked like a charm.  Again, not sure if this was cfhttp doesn’t support the “mode” attribute or what, but it helped immensely.  Thanks, Ben.

PayPal Merchant Sevices Phone Number July 29, 2008

Posted by scoopseven in MediaPost.
add a comment

If you’re looking to call PayPal re: a Merchant Services or Payflow Pro account, here’s the direct number, so you don’t have to call India. 866-445-3167.

Earthlink Blacklist Email April 4, 2007

Posted by scoopseven in MediaPost.
add a comment

Send this to: blockedbyearthlink@abuse.earthlink.net and blocked@corp.earthlink.net

Hello, I am the email administrator for MediaPost Communications, Soccer America LLC., American Illustration American Photography and Images.com.

I have recently been made aware that Earthlink is blocking email communications from one of our email servers, [mail.mydomain.com] [192.168.1.1]. Earthlink email servers are responding with the following error.

04/02/2007 01:01:49 AM [006] WARNING: 550 550 Dynamic/zombied/spam IPs blocked. Write blockedbyearthlink@abuse.earthlink.net

We have proper reverse DNS entries, SPF records and we’re strictly an opt-in email communication based company. We ARE NOT LISTED IN ANY OF YOUR LISTED SPAM DATABASES. Please remove us from any blacklists and, if possible, forward instructions on how we can be white-listed on Earthlink, like we are on AOL and Comcast.

I have instructed all Earthlink subscribers to contact their ISP or use a different email address to resolve this matter.

Furthermore, I refuse to believe that you continue to use SORBS as a legitimate source of information. Hopefully this is something of a legacy system which you won’t continue to use.

Thank You.

Comcast Blacklist March 27, 2007

Posted by scoopseven in MediaPost.
add a comment

Comcast continually blacklists us as spam.  After emailing a couple of high level executives about this issue I finally got someone to call me back. The blacklist number is (856) 317-7272.

KTML problems “Illegal Request” March 7, 2007

Posted by scoopseven in MediaPost.
add a comment

KTML is a great online HTML editor, except for the following problem I discovered.

When I installed KTML I put it in a global folder, as described below. Then I aliased that folder as “includes/” in IIS in every application I needed to have access to a KTML editor. Everything worked great until I went to upload an image, or do anything requiring the “Remote Folder Browser”. I would get this annoying error, “Illegal Request”.
Ok so I solved the problem, but not the way I wanted to. In order to get it to work correctly I had to put the includes folder in the root of my app. Here was my initial directory structure:

[wwwroot]
–[global]
—-[js]
—-[cfcs]
—-[ktml] (was aliased in IIS as includes for app1 and app2)
–[app1]
—-filea.cfm
—-fileb.cfm

–[app2]
—-filed.cfm
—-filee.cfm

KTML worked fine like this, except for the image button (or anything else that used the file browser). www.app1.com/includes/ just pointed to global/ktml/, everything seemed ok.

So I moved the [ktml] folder into the [app1] folder and viola! Everything worked. The good, everything worked. The bad, for every app I have installed I have to install a different version of ktml, that stinks! This has to do with the way KTML deals with session management. Is there any way of getting around that? So I can have the ktml files in a global folder and use it in app1 and app2?

Fusebox uses the cfapplication name=”app1″ setting in application.cfm to keep it’s sessions separate, and it works quite well. I only need one fb_core directory, and I can put it at a high level, to run multiple fusebox applications. It seems to me that KTML should be able to implement this same type of way, no?

Comcast Blacklist January 25, 2007

Posted by scoopseven in MediaPost.
add a comment

As a new Comcast subscriber I jumped through hoops to see if we could get white-listed and finally ended up being forwarded to this form. It, apparently is the only way for a subscriber or mail administrator to get off the black list. But let’s call one more time, to see if we can’t get this expedited. Error message is:

01/24/2007 02:07:33 AM [198] WARNING: 550 [Insert IP] blocked by ldap:ou=rblmx,dc=comcast,dc=net -> BL004 Blocked for spam. Please see http://www.comcast.net/help/faq/index.jsp?faq=SecurityMail_Policy18628

So, as instructed by the message, I’m going to send the error above, including the sending (offending) IP to blacklist_comcastnet@cable.comcast.com. Email is as follows:

Hello, I am the email administrator for MediaPost Communications, Soccer America LLC., American Illustration American Photography and Images.com. I am also a Comcast subscriber.

I have recently been made aware that Comcast is blocking email communications from one of our email servers, [Insert server domain] [Insert IP]. Comcast email servers are responding with the following error. [Insert Error]

We have proper reverse DNS entries, SPF records and we’re strictly an opt-in email communication based company. Please remove us from any blacklists and, if possible, forward instructions on how we can be white-listed on Comcast, like we are on AOL.

Thank You.

MySQL “Explain” January 3, 2007

Posted by scoopseven in MediaPost.
add a comment

This command would have saved me a couple of hours today should I have known about it. While running a query that returned 48k rows, I needed to run a subquery to check against another table to exclude certain other rows. (Querying a list of people to send a promotional email to while trying to make sure the email didn’t go to any people who were already registered for a show [show registrants stored in that separate table]).

I attempted to do this using several different techniques:

  • and m_email not in (select email from attendees where shw_id = 19)
  • and NOT EXISTS (SELECT * FROM attendees WHERE m_email = email AND shw_id=’19′)
  • left outer join attendees on email = m_email where email IS NULL

All of these queries would hang.  The queries would lock access of all other queries to our main people table and the hanging query had a status of “Sending”. When the same query was run without including the subquery it would never have a status or “sending”, only “preparing” and “writing”, hence it never hung.

Then I simply put the word “Explain” in front of my select query and MySQL nicely broke down, in great detail, exactly how the query was being handled by MySQL server. It was very apparent that the subquery was being run against an un-indexed column. I added an index to that column and viola!

New MediaPost.com March 7, 2006

Posted by scoopseven in MediaPost.
1 comment so far

Finally, after months of work, and 2 weeks of labor and pushing, we’ve finally launched the new MediaPost.com website using CFMX 6.1, FuseBox 4.1 and MySQL on a DELL computer running Windows 2003 Enterprise Server. The site was moved from a really old computer running NT, CF5 and Microsoft SQL Server.

Most of the work involved the extensive changes we made to our folder structure to better house all of our websites, including those from our other companies, to better utilize shared resources. Although this took more time then some management would have liked it will help standardize all of our sites and significantly cut down on future development time and effort.

Moving all of my old FuseBox 2 index files to circuits was also a challenge. Many of them were done by simply re-creating the fuseactions in the circuit file, and including the old fusebox 2 index file. Although this may be considered messy programming it saved a bunch of time and worked perfectly, proving again that FuseBox rules.