Wednesday, 23 December 2009

TSQL: Granting Permissions

GRANT INSERT ON table
TO sqluser
GO

GRANT UPDATE ON table
TO sqluser
GO

SQL Profiler: Wild Cards

When adding wild cards to filter by textdata column, be sure to include the percentage characters around your text string.

For example:

%WHERE bass = null%

Friday, 18 December 2009

TSQL: Newline, Carraige returns into char or varcahr field

To insert new line + carraige returns (\r\n) into a char or a varchar field you'll need to convert the to char(13)+char(10) before running your UPDATES or INSERTS.

Tuesday, 15 December 2009

Sysadmin: cURL

Found a very powerful commandline tool for transferring data across a multitude of protocols.
"curl is a tool to transfer data from or to a server, using one of the supported protocols (HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, DICT, TELNET, LDAP or FILE). The command is designed to work without user interaction."
http://curl.haxx.se/

Adobe AIR: Getting Started

Adobe AIR
" Adobe AIR is a cross-operating system runtime that enables you to use your existing HTML/Ajax, Flex, or Flash web development skills and tools to build and deploy rich Internet applications to the desktop.

Adobe AIR applications support native desktop integration, including clipboard and drag-and-drop support, local file IO, system notification, and more. " - http://www.adobe.com/devnet/air/

Essentially, AIR allows you to easily package up your browser based web application created in HTML/AJAX/Flash/Flex and deploy it to clients as a desktop application.

Getting Started

To start you'll need to download the Adobe AIR SDK. The SDK is available from Adobe's website. The SDK contains the necessary javascript libraries and also a debugger, packaging utility for creation of installation files AND self-signed certificate generator. There is no IDE that comes with the SDK. Current version is 1.5.3

For an IDE you can use any text editor, but if you wish to have a GUI interface, the options are to use Aptana Studio or Adobe Dreaweaver CS3/CS4 with Adobe Air Extensions for Dreamweaver.

A step by step guide to writing your first Hello World AIR application using any text editor can be found here.

http://help.adobe.com/en_US/AIR/1.5/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7ecc.html

Interesting

Wednesday, 9 December 2009

JQUERY: Get select value and text

Get Value:

$('#selectList').val();

Get Text:

$('#selectList :selected').text()

Get Multiple Text:

var foo = [];
$('#multiple :selected').each(function(i, selected){
foo[i] = $(selected).text();
});

Thursday, 19 November 2009

XML, XSLT - Equivalent CASE statement in XSLT

 1: <poem author="jm" year="1667">
 2:  <verse>Seest thou yon dreary Plain, forlorn and wild,</verse>
 3:  <verse>The seat of desolation, void of light,</verse>
 4:  <verse>Save what the glimmering of these livid flames</verse>
 5:  <verse>Casts pale and dreadful?</verse>
 6: </poem>
 7:  
 8: <xsl:template match="poem">
 9:  
 10:  <xsl:choose>
 11:  <xsl:when test="@year < 1638">
 12:  The poem is one of Milton's earlier works.
 13:  </xsl:when>
 14:  
 15:  <xsl:when test="@year < 1650">
 16:  The poem is from Milton's middle period.
 17:  </xsl:when>
 18:  
 19:  <xsl:when test="@year < 1668">
 20:  The poem is one of Milton's later works.
 21:  </xsl:when>
 22:  
 23:  <xsl:when test="@year < 1675">
 24:  The poem is one of Milton's last works.
 25:  </xsl:when>
 26:  
 27:  <xsl:otherwise>
 28:  The poem was written after Milton's death.
 29:  </xsl:otherwise>
 30:  
 31:  </xsl:choose>
 32:  
 33: </xsl:template>

XML, XSLT - Beginner's Guide

Create 2 files, 1 XML the other XSLT.
Populate the XML file with your XML data.
Reference your XSLT by using the following syntax.

1: <?xml-stylesheet type="text/xsl" href="poem.xslt"?>

Host your XML file on your webserver and open the XML file in your browser to view the transformed XML.

Thursday, 5 November 2009

Windows 7: System crashed, lost administrative privileges to exfat drive

I'm running Windows 7 RTM, computer just crashed an hour ago and have noticed that I've lost write access to my D drive formatted in exFat, what gives??

Seems like the entire partition has been reset with a readonly flag.

Seen a couple of solutions on the net.

Try running a new command window in elevated mode, change to drive and run "chkdsk /f".

Or try using diskpart > select disk xx > select vol xx > att vol clear readonly

The diskpart didn't work for me, but chkdsk worked!! Sigh... haven't had to do chkdsk since windows98.

Wednesday, 21 October 2009

MS Outlook: Not retrieving your style sheet

Scenario:

Have created a tool that generates a HTML email.
HTML email has references to Custom Style Sheets hosted on the corporate intranet.
The email is sent company wide to own domain and also to a child company with its own domain.
Cross domain trust is limited but the child company is able to access the parent intranet.
The email renders correctly on parent domain, but on child domain none of the styles came through.

Fix:

Seems like outlook was the culprit, and was blocking scripts on the email. This includes my reference to the stylesheet on the parent domain.

Needed to modify outlook to add sender as a safe sender in the junk mail filter list.

Steps to do this are outlined here:


Once the sender was added to the safe sender list, the email renders correctly.

If you double click on the email and click on "View" > "View in internet zone" the styles should also become visible.