dever

Stories submitted by dever

XML Literals in JavaScript?(prettycode.org)

submitted by deverdever(350) 2 years, 3 months ago

If you're a web developer and haven't heard of E4X (EMCAScript for XML), it's a shame, but you're likely in the majority. From the Mozilla Developer Center: "ECMAScript for XML (E4X) is a programming language extension that adds native XML support to JavaScript. It does this by providing access to the XML document in a form that feels natural for ECMAScript programmers. The goal is to provide an alternative, simpler syntax for accessing XML documents than via DOM interfaces." Translation? E4X allows you create variables out of well-formed inline XML. read more...

add a comment |category: |Views: 5

tags: another

Syntactic Sugar for C#(prettycode.org)

submitted by deverdever(350) 2 years, 3 months ago

I have a small list of demands for C# that comes only out of love. Hell, they even make sense. Can we get these supported in C# 4.0, or what? Unlikely, but ideally. read more...

add a comment |category: |Views: 35

tags: another

.NET humor--and .NET 4.0 gets Guid.TryParse(), Enum.TryParse()(prettycode.org)

submitted by deverdever(350) 2 years, 6 months ago

Question: Who disappoints you more—the Microsoft BCL developer who brilliantly decided to name his Uri method TryCreate, or the "Sr. Engineer" on your team who neglected to ever use Intellisense and instead decided to drop this little gem into your already-herniating codebase? read more...

add a comment |category: |Views: 92

tags: another

Config files for DLLs(prettycode.org)

submitted by deverdever(350) 2 years, 6 months ago

Every once in a while I'll write a DLL and wish I could easily externally configure settings for it like you one do with web.config files and ConfigurationManager in ASP.NET applications or with .exe.config files. I finally got around to doing something about not having this same functionality for DLLs. Now, with AssemblyConfig, you can access settings from a .config file for your DLLs just like you can with ASP.NET read more...

1 comment |category: |Views: 435

tags: another

Short GUID(prettycode.org)

submitted by deverdever(350) 2 years, 6 months ago

new Guid() creates a 32-character GUID as a string. You can actually shorten that to 22 characters. Check out this post for the how-to! read more...

add a comment |category: |Views: 367

tags: another

Automatically Expiring Cache (prettycode.org)

submitted by deverdever(350) 2 years, 7 months ago

Ever need a simple cache that automatically expires items, removing them after a given time has elapsed? Well now you've got it: ExpiringValueCache and ExpiringObjectCache. read more...

add a comment |category: |Views: 11

tags: another

Recursively processings XML elements in C#(prettycode.org)

submitted by deverdever(350) 2 years, 9 months ago

Recursion can be tricky. But when you've nailed it, it's damn sexy. Below is a basic outline for recursively processing an XML document for all its child elements, and keeping track of what depth the element is at (how many ancestors, or parents, are above it). read more...

add a comment |category: |Views: 36

tags: another

JavaScript Date Ago(prettycode.org)

submitted by deverdever(350) 2 years, 9 months ago

In case you hadn't noticed, one of the hip things to do with user-visible timestamps these days is to format them as a how long ago the time was. Instead of seeing a date and time like "08/02/2009 2:41 PM PST," these so-called passed/relative/pretty/friendly dates appear like "2 hours ago" or "1 week ago." Being a hip person myself (hah), I've written a few bytes of code to get these type of dates. One is JavaScript (here), and another is a C# clas read more...

add a comment |category: |Views: 15

tags: another

Fade background color in JavaScript(prettycode.org)

submitted by deverdever(350) 2 years, 9 months ago

How to fade the background color of an element using JavaScript without any external script dependencies. read more...

add a comment |category: |Views: 41

tags: another

A QueryString collection for JavaScript(prettycode.org)

submitted by deverdever(350) 3 years, 1 month ago

Used to Request.QueryString? It doesn't exist in JavaScript. Here's a script to create it with no other script dependencies. read more...

4 comments |category: |Views: 284

tags: another

How to add or remove a CSS class to a control in ASP.NET easily(prettycode.org)

submitted by deverdever(350) 3 years, 1 month ago

Nothing big. Just for reference if anyone needs it. read more...

add a comment |category: |Views: 25

tags: another

Simplify jQuery with ASP.NET Web Services and JSON(prettycode.org)

submitted by deverdever(350) 3 years, 1 month ago

Introduces an easy-to-use script, jsonAspNet, that makes using jQuery with ASP.NET JSON web services much easier. read more...

add a comment |category: |Views: 47

tags: another

Using jQuery with ASP.NET Web Services and JSON(prettycode.org)

submitted by deverdever(350) 3 years, 1 month ago

A quick how-to for using jQuery to communicate with ASP.NET web services (ASPX pages with WebMethods, ASMX services, and WCF services). read more...

add a comment |category: |Views: 51

tags: another

Static constructors(seattlesoftware.wordpress.com)

submitted by deverdever(350) 3 years, 8 months ago

Know what a static constructor is? Are you sure? It's a little-known feature in C# that can come in handy. read more...

add a comment |category: |Views: 19

tags: another

Serialize an Exception to XML(seattlesoftware.wordpress.com)

submitted by deverdever(350) 3 years, 9 months ago

Have you ever wanted to represent an Exception as XML data? If you've tried, you know that XmlSerializer won't do it. It can still be done, however, without much work, and without having to implement some tricky workaround. read more...

1 comment |category: |Views: 403

tags: another

Void instance methods will get you fired!(seattlesoftware.wordpress.com)

submitted by deverdever(350) 3 years, 11 months ago

Not really, but they're pretty freakin' lame. Wanna know why? read more...

1 comment |category: |Views: 32

tags: another