Wednesday, November 16, 2011

Quickly disable triggers and keys


/* run before importing data */
-- SQL disable all triggers - disable all triggers sql server - t sql disable trigger
EXEC sp_MSforeachtable @command1="ALTER TABLE ? DISABLE TRIGGER ALL"
GO
-- SQL disable all constraints - disable all constraints sql server
EXEC sp_MSforeachtable @command1="ALTER TABLE ? NOCHECK CONSTRAINT ALL"
GO
/* deletes all existing data */
-- SQL disable all constraints - disable all constraints sql server
EXEC sp_MSforeachtable @command1="DELETE FROM ? "
GO

/* run after importing data */
-- SQL enable all triggers - enable all triggers sql server - t sql enable trigger
EXEC sp_MSforeachtable @command1="ALTER TABLE ? ENABLE TRIGGER ALL"
GO
-- SQL enable all constraints - enable all constraints sql server
-- sp_MSforeachtable is an undocumented system stored procedure
EXEC sp_MSforeachtable @command1="ALTER TABLE ? CHECK CONSTRAINT ALL"
GO

Tuesday, May 24, 2011

T410 USB not working - SOLVED

I tried posting this to the Lenovo Community thread but after I registered, everything was in German and it wouldn't let me post.

But, for those struggling with the same issue, here's how I solved it.

1. Right-click on "My Computer"
2. Select Manage
3. Expand the "Universal Serial Bus controllers"
4. Right-click on the first "USB Root Hub"
5. Select Properties
6. Select the "Power Management" tab
7. Uncheck "Allow the computer to turn off this device to save power."
8. Click OK
9. Repeat steps 4-8 for the other "USB Root Hub"
10. Right-click each USB Root Hub and uninstall each one
11. Right-click on the "Universal Serial Bus controllers"
12. Select "Scan for hardware changes"
13. Let all the stuff reconnect (USB hubs, camera, fingerprint, AND MOUSE! :)
14. Done!

Tuesday, February 8, 2011

CSS Compressor

I found this the other day. Another nice compressing tool, but this one is for CSS.

http://www.cssdrive.com/index.php/main/csscompressor

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>

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/find_replace.cfm

Other tools can be found at 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 stuff.

http://fmarcia.info/jsmin/test.html

Tuesday, September 23, 2008

Vertical multi-column list

function ge(obj) {
	return document.getElementById(obj);
}
/*
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 = '
    '; // 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= 0) { //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; } function cLog(s) { //alert(s); if(document.all) { return; } else { //console.log(s); return; } }