Codebender

not the last of his kind

Follow me on TwitterRSS Feeds

  • Home
  • About Codebender
  • LiquidSilver SharePoint Framework

Flowchart: which open source license should I use?

May 21st

Posted by denni in Software

1 comment

Choosing open source license flowchart This is a common question when one wants to publish a new open source project, especially if he/she is new to open source licensing scheme. The many available choices of the license can be very confusing and many people simply pick a license without really understanding the meaning or the clauses in the license. Some choose a license by the popularity. Some because a particular license is used in their favorite projects. Even worse, some even choose a license because it looks or sounds cool.

There are many resources on the Web that provide comparison of the available licenses. I want to make it simpler by creating a flowchart to guide you to pick the right license for your project. To reduce confusion, I’ll only list the most common open source licenses. You can click on the flowchart to enlarge it.

flowchart, tips

System.Net.WebException: An exception occurred during a WebClient request

Apr 26th

Posted by denni in Programming

No comments

When using either WebClient or HttpWebRequest to download file from a remote location, sometimes I got the following exception:

System.Net.WebException: An exception occurred during a WebClient request

For some reasons, IIS (the Web server) may deny to serve a request that doesn’t specify the user-agent property in the request header. So, although it’s not really obvious, this can be solved pretty easily by specifying the particular user-agent property. You can set it to anything, it doesn’t matter as long as it exists.

For example, here how you provide the property using WebClient:

using (var wc = new WebClient())
{
	wc.Credentials = CredentialCache.DefaultCredentials;
	wc.Headers.Add(HttpRequestHeader.UserAgent, "anything");
	wc.DownloadFile(fileUrlToDownload, fileNameToSafe);
}

And, here how to do it with HttpWebRequest:

var req = (HttpWebRequest)HttpWebRequest.Create(fileUrlToDownload);
req.Credentials = CredentialCache.DefaultCredentials;
req.UserAgent = "anything";
 
var resp = (HttpWebResponse)req.GetResponse();
 
using (var stream = resp.GetResponseStream())
{
	using (var fstream = new FileStream(fileNameToSafe)
	{
		var buffer = new byte[8192];
		var maxCount = buffer.Length;
		int count;
		while ((count = stream.Read(buffer, 0, maxCount)) > 0)
			fstream.Write(buffer, 0, count);
	}
}
 
resp.Close();

You may also notice that downloading a file using WebClient is much simpler than using HttpWebRequest. The later, however, gives you much more control.

c#, tips

Typing ASCII or accented characters in Linux rdesktop

Mar 23rd

Posted by denni in Software

No comments

My thin-client desktop is running Debian Linux with the Gnome window manager. When I use it to connect to my Windows Server VM using rdesktop, I usually get a problem when trying to type ASCII or accented (French) characters. For example, when typing Alt 130, I am expecting to get the é character. Instead, it’s only printing 30 (the 1 character was omitted).

It drives me crazy since I have to type a lot of these accented, especially French, characters. Fortunately, later I found that turning off the Num Lock fixed this problem. Yes, for some reason, I can’t type the ASCII characters with the keyboard’s Num Lock on.

Actually, working with Linux rdesktop to connect to a Windows machine is very annoying. Aside from the problem I just described, I still have more issues that yet to be solved:

  1. I can’t set the window title bar to auto-hide like the Windows’ remote desktop functionality. This title bar takes some very valuable screen estate. And it looks ugly having two cascading title bars: from the Linux rdesktop program and from the Windows applications.
    Sure I can maximize the rdesktop window to full screen, but then, it doesn’t work very well with my multi-monitor configuration.
  2. Sometimes, the mouse pointer will break and the pointer’s image get corrupted. I haven’t found a quick way to fix or restore it aside from restarting the window manager or the OS session.
  3. The Ctrl+Alt key combination sometimes behaves erratically that messes up the subsequent key presses. I have to change the focus outside the rdesktop window if this happens. I tried to remove all key bindings from the host Linux OS but still no improvement.

I love how this just works in Windows.

linux, rdesktop, tips, windows
«12345»...Last »
  • Recent Posts

    • InfoPath 2010 breaks SharePoint 2007 installation
    • Common coding issues when working with anonymous SharePoint sites
    • Office 2010 breaks stsadm -o copyappbincontent
    • Flowchart: which open source license should I use?
    • System.Net.WebException: An exception occurred during a WebClient request
  • Recent Comments

    • sunny on Common coding issues when working with anonymous SharePoint sites
    • denni on Change Your Fonts, Change Your Mood
    • Deb Ramirez on Change Your Fonts, Change Your Mood
    • Yuva on Flowchart: which open source license should I use?
    • Office 2010 breaks stsadm -o copyappbincontent on InfoPath 2010 breaks SharePoint 2007 installation
  • Tags

    adobe best practices c# codeplex css design design pattern dynamic language flash flowchart font forefront freehand internet explorer javascript linq linq to sql linux liquidsilver mercurial office 2010 rdesktop security sharepoint subsonic tips visual studio windows windows 2003
  • Archives

    • User Login






      • Lost your password?
    • Links

      • Denni on LinkedIn My LinkedIn Profile
      • Denniland My personal blog
      • Ragnarok Online Database A database for the Ragnarok Online MMORPG
Mystique theme by digitalnature | Powered by WordPress
RSS Feeds XHTML 1.1 Top