Thursday, 29 May 2008

Misc: Forward and Back Slashes

Just a reminder not to get confused.

This is a slash: /. Because the top of it leans forward, it is sometimes called a “forward slash.”

This is a backslash: \. Notice the way it leans back, distinguishing it from the regular slash.

Slashes are often used to indicate directories and subdirectories in computer systems such as Unix and in World Wide Web addresses. Unfortunately, many people, assuming “backslash” is some sort of technical term for the regular slash, use the term incorrectly, which risks confusing those who know enough to distinguish between the two but not enough to realize that Web addresses rarely contain backslashes.

.NET: Ignoring Thread Abort Exception in Enterprise Library Exception Handling

Noticed that the trace.log in TRAKIT was filling up rather quickly.
Whenever it hits a response.redirect, .NET was generating a thread abort exception.

To ignore, do this:

try{
//your try block
}catch(System.Threading.ThreadAbortException ex)
//exception ignored to prevent logging in trace.log
}catch(Exception ex){
//catch error using Enterpise Library logging
bool rethrow = ExceptionPolicy.HandleException(ex, "Business Layer Policy");
if (rethrow){
//throwing the error again to write to page
throw;
}finally{
//Do something
}

MSSQL: Truncate large Transaction Log files

Needed to truncate log files on prod server, found this nice tsql code snippet to handle this task.

/**SHRINK TRANSACTION LOGS**/
/**RUN EACH STEP SEPARATELY **/

--STEP 1 - Select database & get its logical name
USE [drd-data];
SELECT * FROM sysfiles;

--STEP 2 - From result window input file name to shrinkfile command
BACKUP LOG [drd-data] WITH TRUNCATE_ONLY
DBCC
SHRINKFILE('drd-data_log', 95);

Action Script: Open Source Action Script IDE

Summary

FlashDevelop is a popular open source ActionScript 2/3 and web development environment.
FlashDevelop seemlessly integrates with Adobe Flash IDE, Adobe
Flex SDK, Mtasc, Haxe and Swfmill.

Main Features

* AS3 Project management with seamless and optimized Adobe Flex SDK integration
* AS2 Project management with seamless Swfmill and Mtasc integration (using a portable standalone command line tool)
* Advanced ActionScript 2 and ActionScript 3 completion & code exploration with automatic classpath detection (even without project)
* Smart contextual Actionscript code generators
* SWF and SWC classes and symbols exploration
* Test movie in Adobe Flash IDE and with clickable error results (Flash CS3)
* MTASC compilation/code checking with clickable error results

Other Features

* Types Explorer
* Automatically cleans ASO files of modified AS2 classes
* Files explorer (can create Flash 8 Trust Files for you)
* Automatic

JavaDoc creation from methods

* Smart Actionscript help websearch on F1
* Jump to class/member declaration on F4
* XML, HTML/PHP, JS, CSS code highlighting,
* Multibyte character encoding
* Program menucustomization with XML files
* as2api GUI for documentation generation
* Snippets
* Lines bookmarks
* Code folding
* Zoom

http://www.flashdevelop.org/community/viewforum.php?f=11

Wednesday, 28 May 2008

Persits ASPEmail: Email using an external Templates

<%
dim strTextBody
dim objMail
set objMail = Server.CreateObject("Persits.MailSender")
objMail.Host = "your mailhost"
objMail.From = "your_email@a.com"
objMail.AddAddress = "your_email@a.com"
objMail.Subject = "career fair"
objMail.IsHTML = True
' Add embedded image for logo
objMail.AddEmbeddedImage Server.MapPath(".") & "\banner.jpg", "_Banner"
objMail.AddEmbeddedImage Server.MapPath(".") & "\footer.gif", "_Footer"
' append body from file
objMail.AppendBodyFromFile Server.MapPath(".") & "\BODY.htm"
objMail.AltBody = strTextBody
objMail.Send

set objMail = nothing
%>

In your HTML file place the following code:

<HTML>
<HEAD>
<TITLE>CAREER FAIR</TITLE>
<STYLE>
body{margin:0px;}
table.content{width:600px;}
td.content{background:#CCE5FF;font-family:verdana;font-size:11px;padding-top:20px;padding-bottom:20px;padding-left:40px;padding-right:40px;}
</STYLE>
</HEAD>
<BODY>
<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0" CLASS="content">
<TR><TD><IMG SRC='cid:_BANNER'></TD></TR>
<TR><TD CLASS="content">
Hi
<P>Blah
<P>Kindest Regards
<BR><b>Blah</b>
<BR>Graduate Team
</TD></TR>
<TR><TD><IMG SRC='cid:_FOOTER'></TD></TR>
</TABLE>
</BODY>
</HTML>

Ajax: Caching Problem with Requests

http://radio.javaranch.com/pascarello/2005/10/21/1129908221072.html

"The question: The Ajax request is grabbing the cached page from the previous request, how do I stop this from happening?
Well I have seen some fancy approaches by people, but there is one easy solution that works: a random query string value appended to the request.

So how and why does this work. Well it simple terms, when the browser looks at the destination, if it has a match, then it uses the data it has. Now this is great for when you are going to a static website, but since we are looking for new data, it sucks. By appending a random value to our parameters that we are sending back, it forces the browser to say, "Stop the press! We got new info here! Lets go get the data!"

"... a simple "+Date()" appended to the request URL and viola!"

OR

"Hey guys, just wanted to add a way to ad this random string to the URL. When passing the url you can append the random function Math.random(); to the url string like this: var urlVar = urlVar + '&' + Math.random();"

OR

"A much more elegant solution would be to use the following code:

xmlhttp.open("GET", theURL ,true);
xmlhttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
xmlhttp.send();

The second line of the code instructs the XMLHttp object to avoid
caching content that has been modified after the mentioned date.
It worked fine for me..."

Thursday, 8 May 2008

Google code search

Google code search supports POSIX extended regex syntax.

http://www.google.com.au/codesearch?hl=en

Some advance search examples:
  • The lang: operator, which restricts by programming language (e.g., lang:"c++", -lang:java, or lang:^(c|c#|c\+\+)$)
  • The license: operator, which restricts by software license (e.g., license:apache, -license:gpl, or license:bsd|mit)
  • The package: operator, which restricts by package URL (e.g., package:"www.kernel.org" or package:\.tgz$)
  • The file: operator, which restricts by filename (e.g., file:include/linux/$ or -file:\.cc$)

Google Search Tricks from Tom's Guide

  1. Get firefox extension, Customize Google
  2. Surround keywords with quotes
  3. Use at least 3 keywords
  4. Use the * wild card
  5. Limit search by using minus (-) character. Chewy -food, returns chewy but not food
  6. Specific filetypes, chewy filetype:pdf
  7. Specify number of results, &num=5 in result querystring
  8. Brackets, (“www.tomguide.com and AMD” or “Pentium*”)
  9. Limit search to a website, site:www.tomsguide.com firefox
  10. Remove spam filters by adding this to querystring, &filter=0
  11. Synonyms (doesn't seem to work), ~vicarious
  12. Spelling Options, Penryn|Penrin
  13. Google Calculator, 100 m to ft
  14. Word Definition, define:isotope
  15. Currency Conversion, 50 dollars in euros
  16. Language Translation
  17. Google preferences, link is located right side of search bar
  18. Google News
  19. World News
  20. Finding the right image size, in google images click on the "all image sizes" box, below the search bar.
  21. Images search setting, filter based on format, colors, size

Tuesday, 6 May 2008

Nifty trick to hide your emails address when published online - prevent copy and pasting

CSS:

.fakelink {
color: #6699ff;
}

.hide {
display:none
}

HTML:

<span class="fakelink">youremail@gmail<span class="hide">.bugger_off</span>.com</span>.

When copied and paste, it will show up as
youremail@gmail.bugger_off.com

Sunday, 13 April 2008

Action Script 2: Howto and Tutorials for creating 3D games

Really good site to create 3D objects and games in AS2.
He is generous enough to provide all source code to this work.

http://alejandroquarto.com/