So I've been trolling around through the www trying to find a quick (and dirty way) to determine if a file exists before executing some SQL. I found a few articles through the wonders of googling and there are a lot of ways (SSIS:: Test for Data Files Existence, Determining if a File Exists in SSIS Using Wildcards, Check if File Exists, Does File Exist Check in SSIS) to skin this cat, but I felt there had to be a simpler way.
Basically, I ended up using the "Set Attributes" operation in a File System Task Editor and an existing SourceConnection.
There are a few assumptions here...
1. The source connection file should exist when first creating the connection.
2. Setting all of the attributes (hidden, read-only, archive, system) to False is ok.
3. You don't mind hacks.
So here are the steps you can take to check if one or more file exists before executing your SQL:
1. Set up a new file connection pointing to the file to be loaded.
2. Create a File System Task using the "Set Attributes" operation.
3. Add your precedence constraint/connectors.
Test the steps by executing the task once (should turn green). Then rename the source file and executing the step again (should turn red).
I haven't tested this in a production environment but figured I'd write it down and see if it works for others.
Good luck and happy coding!
Tuesday, October 13, 2009
Wednesday, June 3, 2009
DSN-less ColdFusion queries
<cfscript>
// DNSless DB connection
// http://www.datapackethelp.net/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=47&nav=0
// http://www.ibmpressbooks.com/articles/printerfriendly.asp?p=170336
classLoader = createObject("java", "java.lang.Class");
classLoader.forName("macromedia.jdbc.MacromediaDriver");
dm = createObject("java","java.sql.DriverManager");
con = dm.getConnection("jdbc:macromedia:db2://myserver.com:55000;DatabaseName=SMWDB","username","password");
st = con.createStatement();
rs = st.ExecuteQuery(PreserveSingleQuotes(mySql));
q = createObject("java", "coldfusion.sql.QueryTable").init(rs);
st.close();
con.close();
</cfscript>
Friday, December 26, 2008
Beginning to hate IX Web Hosting
Today, I discovered that a couple of my sites were no longer responding correctly--they're hosted with IX Web hosting.
The site boasts "unlimited" disk storage, and yet, I found an arm-twisting "support" message saying that I've violated the "fair-use" resource assignment. Very odd indeed...
This just plain stinks of false advertising...
something is wrong with some of the sites that are hosted under my domain... parkapps.com, jin-park.com, mtcarmelchurch.org
you: they are all requiring a password... nothing has changed on the server for a few days now
you: 401 Error - Unauthorized HTTP Error 401.3 - Unauthorized: Access is denied due to an ACL set on the requested resource. You are recieving this message because the resource you have requested is unauthorized to your connection. You must first be authenticated in order to access the requested resource. No further information on authenticating for use of that resource is available.
Oleg Kovalenko : Please hold on, let me check
you: also, when i go to use the file manager, i get the following error...
you: ERROR: Unable to change dir "/" Check directory permissions
The site boasts "unlimited" disk storage, and yet, I found an arm-twisting "support" message saying that I've violated the "fair-use" resource assignment. Very odd indeed...
We are notifying you that your account has been found to violate our “Fair-Use” Resource Assignment portion of our Terms of Service, due to the amount of disk usage that is being taken.
We ask that you either reduce disk usage (now you use 51GB) or look for dedicated hosting for this site.
We have a shared hosting environment that we must maintain at a certain level of performance. This performance is monitored and balanced by us, however there are times when accounts can cause the server’s load to increase degrading the performance for all other customers on this server.
To protect your account from further action you must agree to our request for compliance. Please respond to this message stating your intent to do so. You may either log into your control panel with us, and access this ticket via the 24/7 help desk, or provide this ticket number to our Live Chat or phone representatives. Failure to respond to this message within 72 hours will result in the suspension of the affected domain with us until such a time as this matter is resolved.
Should you have any further questions or problems, please feel free to contact us anytime, we are available 24/7.
This just plain stinks of false advertising...
Wednesday, December 17, 2008
Developer tools
I have some development tools I've used day-to-day, you might like them too...
Quickly find and replace stuff (commas to line breaks, regular expressions, etc)
http://www.parkapps.com/tools/changeDelims.cfm
Other tools:
http://www.parkapps.com/tools/
Quickly find and replace stuff (commas to line breaks, regular expressions, etc)
http://www.parkapps.com/tools/changeDelims.cfm
Other tools:
http://www.parkapps.com/tools/
Friday, December 5, 2008
Minify Javascript
We're having some problems with JavaScript not loading entirely for some users... I'm not sure why yet, but I came across this JSMin - JavaScript minifier. Excellent stuf.
http://fmarcia.info/jsmin/test.html
http://fmarcia.info/jsmin/test.html
Saturday, October 18, 2008
Tuesday, September 23, 2008
Vertical multi-column list
/*
Reorder a list that normally flows horizontally and refactor to flow vertically in the same area.
Assumes that the li element has a css width and uses the shortcut function ge()
*/
function vertMultiColList(parentObj) {
var nextColHtml = '<'+'/li><'+'/ul><'+'ul class=vert_cont>'; // no quotes b/c IE is weird about rewriting HTML
// if this has already run take out any continued lists
parentObj.innerHTML = parentObj.innerHTML.replace(/<\/ul>
- /ig,''); // Firefox
parentObj.innerHTML = parentObj.innerHTML.replace(/<\/ul>
- /ig,''); // IE
var arrUl = document.getElementsByTagName('UL');
for(var j=0;j
//arrUl[j].style.border='1px solid red';
var arrLi = arrUl[j].getElementsByTagName('LI');
var lenArrLi = arrLi.length;
if(lenArrLi==0) {
break;
}
// get outer width of container
var padOffset = -30;
var container_width = parentObj.clientWidth+padOffset; // gives a little padding
if(container_width==padOffset) { //IE6 problem
container_width = document.body.clientWidth+padOffset;
}
// get width of list item
var item_width = arrLi[0].clientWidth;
if(item_width==0) item_width = arrLi[0].style.width;
// calculate the number of columns that can fit in the space
var cols = Math.floor(container_width/item_width);
// divide the number of list items by the number of columns to
// find out how many items should be in a column
var li_per_col = Math.ceil(lenArrLi/cols);
for(var i=0;i
}
if(i>1000) {
cLog('over 1000 LI');
return;
break;
}
}
parentObj.innerHTML = parentObj.innerHTML.replace(/<\/li>/ig,nextColHtml);
cLog('parentObj.id: ' + parentObj.id);
cLog('container_width: ' + container_width);
cLog('item_width: ' + item_width);
cLog('lenArrLi: ' + lenArrLi);
cLog('cols: ' + cols);
cLog('li_per_col: ' + li_per_col);
//cLog('parentObj.innerHTML: ' + parentObj.innerHTML);
}
if(j>100) {
cLog('over 100 UL');
return;
break;
}
}
//window.onresize = vertMultiColList; // IE can't handle this and spikes memory
//parentObj.ondblclick = function() { alert(this.innerHTML); }
//parentObj.onmouseover = vertMultiColList;
}
Subscribe to:
Posts (Atom)