Browsing Posts in coding

In one of my applications I’m using the WebClient class (from namespace System.Net) to download a file from the internet. The syntax is pretty easy:

var client : WebClient := new WebClient();
client.DownloadFile(src, dst);

With src and dst being strings. This worked always fine for me until recently after I’ve installed a proxy. To have WebClient automatically use your proxy-settings (e.g. taken from the Internet Explorer) simply add the following line after instantiating WebClient:

client.Proxy := new WebProxy;

To learn more about automatic proxy detection read on here.

It seems we’re ultimately getting rid of Flash, thanks to HTML5 and
CSS3. The web sports interesting sites demonstrating the power of the
new technologies. The following demos are worth a look:

If you intend on jumping the train you might find the following
tutorials/books useful:

This is more a hint for Windows developers coming originally from UNIX systems. If you’re missing tools like ps, top, pstree or strace you should have a look at the website www.sysinternals.com which offers a suite of advanced system utilities.

A very handy tool in the UNIX world is tail. In particular the option -F proves useful if you want to view log files. But what do you do if you’re working with Windows? Of course, you have to search the Internet for a Windows port and go through the compile-hell. I have to admit, compiling tail wouldn’t be such a pain in the ass as compiler bigger programs. Nonetheless, I wasn’t willing to spend time searching and installing a Windows port of tail and thus I coded it within a couple of minutes. The following Python script only implements tail -F filename, but that was sufficient for my purposes.

import sys, time

lastLine = 0
f = 0

def dumpFile(f, start):
  f.seek(start)
  cur = start

  for line in f:
    print line,
    cur = f.tell()

  return cur

while True:
  try:
    f = open(sys.argv[1], 'rU')
    lastLine = dumpFile(f, lastLine)
    time.sleep(1.5)
  except IOError:
    print 'no such file' + sys.argv[1]
  finally:
    if f:
      f.close

I’ve advertised Paul Harrington’s blog post on WPF in Visual Studio 2010. Here’s a list of all parts:

  1. Introduction
  2. Performance tuning
  3. Focus and Activation
  4. Direct Hosting of WPF content
  5. Window management
  6. Automated UI Testing
  7. Wrap up

Are you interested in GUI programming on the Windows platform? Then you should know about WPF: Windows Presentation Forms, the next generation of GUI toolkits on Windows. Paul Harrington discusses WPF in Visual Studio 2010.