Author Archive

March 12, 2008 0

How to unzip files in .NET using SharpZipLib

By J in Uncategorized

SharpZipLib is a great open source library for handeling all kinds of gzip/zip compression/decompression. More Info – http://www.icsharpcode.net/OpenSource/SharpZipLib/
In the following example I’m passing the HtmlInputFile object directly into the ZipInputStream to decompress the PostedFile and save its contents on the server.

.
.
using System.IO;
using ICSharpCode.SharpZipLib.Zip
.
.
private void UnzipAndSave(HtmlInputFile objFileUpload)
{
ZipInputStream s = new ZipInputStream(objFileUpload.PostedFile.InputStream);

ZipEntry theEntry;
[...]

Tags: ,

March 12, 2008 7

How to manipulate video in .NET using ffmpeg

By J in Uncategorized

In this case I’m resizing the video and converting it to FLV format. For more ffmpeg commandline options - http://ffmpeg.mplayerhq.hu/ffmpeg-doc.html

private void ConvertVideo(string srcURL, string destURL)
{
string ffmpegURL = “~/project/tools/ffmpeg.exe”;
DirectoryInfo directoryInfo = new DirectoryInfo(Path.GetDirectoryName(Server.MapPath(ffmpegURL)));

ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = Server.MapPath(ffmpegURL);
[...]

Tags: ,

February 16, 2008 0

Event Driven Developement using ASP.NET & C#

By J in Uncategorized

Until recently I wasn’t entirely familiar with the concepts of Event Driven Programming, Event Bubbling, etc. Being a .NET developer I’ve been exposed to events and delegates but I never really understood the concept in its entirety. Somehow I had a hard time readily finding good sources online focusing on event driven programming especially using [...]

Tags:

February 2, 2008 0

10 ASP.NET Performance and Scalability Secrets

By J in Uncategorized

Very good article. Covers all the following topics:

ASP.NET Pipeline optimization
ASP.NET Process configuration optimization
Things you must do for ASP.NET before going live
Content Delivery Network
Caching AJAX calls on browser
Making best use of Browser Cache
On demand progressive UI loading for fast smooth experience
Optimize ASP.NET 2.0 Profile provider
How to query ASP.NET 2.0 Membership tables without bringing down the site
Prevent [...]

Tags: ,

January 21, 2008 2

The dumbing-down of programming

By J in Uncategorized

Very interesting article in Ekinoderm :
Doctors Robert Dewar and Edmond Schonberg (Professors Emeritus at NYU in Computer Science) recently penned a rather scathing paper about the sorry state of Computer Science education in the United States today. In it, we see the usual laments that Java is dumbing down Computer Science curricula and that the [...]

Tags: ,

January 17, 2008 0

The veil is lifted

By J in Uncategorized

Scott Guthrie announced today that they are finally releasing the source code to the .NET Framework libraries. So far you can now browse and debug the source code for the following .NET Framework libraries:

.NET Base Class Libraries (including System, System.CodeDom, System.Collections, System.ComponentModel, System.Diagnostics, System.Drawing, System.Globalization, System.IO, System.Net, System.Reflection, System.Runtime, System.Security, System.Text, System.Threading, etc).

ASP.NET (System.Web, System.Web.Extensions)

Windows Forms (System.Windows.Forms)

Windows [...]

Tags:

January 16, 2008 1

C# Coding Standards and Best Programming Practices

By J in Uncategorized

I was reading a best practices document created by the DotNetSpider team which covered many aspects of programming in .NET. I was really impressed by it and I think its a very good reference document. So I’ve decided to make a series of posts where I’ll post sections of their document covering a specific topic.

Tags: ,

January 12, 2008 0

A Semi-Dynamic Sitemap Solution

By J in Uncategorized

I was creating a website which had pages with multiple views. I wanted a fairly simple sitemap solution, without creating any custom sitemap provider, which could show the current view name in the breadcrumb trail like this –
Home >> Parent Page >> Current Page >> Current View 1
Home >> Parent Page >> Current Page [...]

Tags: ,

January 5, 2008 3

How to extract URLs (href property) from HTML

By J in Uncategorized

protected ArrayList getURL(string txtIn)
{
ArrayList outURL = new ArrayList();
Regex r = new Regex(“href\\s*=\\s*(?:(?:\\\”(?<url>[^\\\"]*)\\\”)|(?<url>[^\\s]* ))”);
MatchCollection mc1 = r.Matches(txtIn);

foreach (Match m1 in mc1)
{
foreach (Group g in m1.Groups)
[...]

Tags: , ,

January 5, 2008 0

Workaround for Response.Redirect

By J in Uncategorized

This is a workaround to do a redirect while using ASP.NET AJAX Framework. The traditional Response.Redirect method can not be used since it is not compatible with the .NET AJAX framework.

StringBuilder sb = new StringBuilder();
sb.Append(“<script language=\”javascript\”>\n”);
sb.Append(“function Redirect()\n”);
sb.Append(“{\n”);
sb.Append(” window.parent.location.href = \”" + ResolveUrl(myURL) + “\”;\n”);
sb.Append(“}\n”);
sb.Append(“</script>\n”);

Page.ClientScript.RegisterClientScriptBlock(this.GetType(), “Redirect”, sb.ToString());
myBtn.Attributes.Add(“onclick”, “return Redirect();”);

Tags: ,