Last few months I haven’t really done a lot of .Net work, apart from the .Net DownloadLib project, and therefore also not released anything. After someone on The Code Project gave me a poke on an update to my custom made ProgressbarWithPercentage component I had promised, I made an update to that component and released it.
ProgressbarWithPercentage is not at version 1.0.10. The changes I made since the last release are:
I also updated the demo, to include both an XP and a Vista/Win7 layout, and added a property grid that enables you to change the properties of the progress bars at runtime. On top of that, I decided it was a good idea to create a repository for this component on SourceForge, where you can now freely download and browse the code. I’ve send an update request to TCP with a new version of my article, but this has yet to appear.
Downloads:
Some nice screenshots of the new demo (click to enlarge):
Yesterday I went to my first VISUG event. VISUG stands for Visual Studio User Group and is the independent professional user group for Microsoft Visual Studio users in Belgium. The presentation, titled “C# 4.0 and testability”, and given by Dino Esposito, addressed the importance of testability in applications, and how this is made easier with code contracts.
Code Contracts provide a language-agnostic way to express coding assumptions in .NET programs. The contracts take the form of preconditions, postconditions, and object invariants. They act as checked documentation of your external and internal APIs. The contracts are used to improve testing via runtime checking, enable static contract verification (yay!), and documentation generation. In short, they bring the advantages of design-by-contract programming to all .NET programming languages.
Remix is a Microsoft event I attended yesterday that focuses on what’s coming next on the web. I arrived half an hour late due to some problems with the public transportation, but still was able to see the biggest part of the keynote.
I’m really happy I attended it, cause I learned about quite some things I didn’t know about yet. There where 2 tracks you could follow: designer (UX) and developer. I of-course followed the dev track. The main focus was on Silverlight 3, the latest version of microsoft’s answer to technologies such as Flash and Google Web Toolkit. From what I’ve seen, which included some impressive demo’s, I concluded that Silverlight 3, together with the development tools that are needed for it, probably form the most advanced set of RIA development sets out there. I’ve been considering getting into it for quite a while now, and still can’t decide due to the pretty important drawbacks that come with choosing Silverlight. These include the fact that Silverlight is as much Microsoft as it can be, making it a very improbably candidate for most open source projects, the costs of all the dev tools, and the Silverlight client required for you to be able to view a Silverlight site. There also where presentations about the involved development tools, which are Expression Studio 3, and Visual Studio 2008. A few very nice demo’s of Expression Blend 3, part of Expression Studio, where given, introducing the public to the basics of control, template and style creation, as well as things like animation and import options.
At some point in a demo, Google was used to demonstrate an SEO aspect of a Silverlight app. A few moments later the following entry appeared on the remix2009 twitter channel: Attention Steve Ballmer; A Microsoft employee is using Google. This drew a laugh from most of the public.
Although FOSDEM is way cooler, I’m already looking forward to MS Remix 2010.
While working on the Download class of the .Net Download Library yesterday, I came across the need to add and retrieve items from a HashTable of a fixed type. After asking at MSDN forums, someone suggested creating for example a StringHashTable, which then contains a number of Shadow methods that ctype a parameter of the type String to Object, and then pass it along to the corresponding native method of the base class. I extended a little on this by creating a general type defined HashTable extension class: TypeHashTable. This class is pretty identical to the String variant, but I added one variable type (see the code below), making it usable for whatever type you need it, without any manual converting. I’m probably not implementing this in the .Net Download library, since the conversion there only requires a one line function, and the philosophy is to keep it as simple and small as possible. Anyway, I’ve put this class on my forums so that anyone can use it. It’s also a neat example of the usage of variable type definitions IMHO
While working on .Net download library, I realized I still didn’t know how to fire events from the background threads onto the main thread (meaning the thread that started the download by calling Start). I posted query on how to do this in vb.net on several forums, and got some helpful responses at MSDN. Apparently, the thing I’ve been searching for is called the Event-based Asynchronous Pattern, which is a general pattern for asynchronous operation’s with events. I have done some familiarization with it by doing the entire walk-through, and I also started implementing it into the Download class. I’ll probably commit my current code this weekend, hopefully with working cross thread events
While translating some of the C# code of MyDownloader to VB.Net for the .Net download library, I’ve already come across quite some awkward code. IMHO, the underneath example could go into the code horrors section of The Code Project.
Why? It uses breaks and returns in the middle of the code, like if C# is some lame generic language without selection structures. The use of the try-catch bloks also seems odd. Also have a look at the condition for the do while loop – lol. The only thing missing are a few GoTo statements, which would have convinced me to print this out and torture fellow geeks with
I started off translating this literally, but got so annoyed by the bad coding practice I decided to attempt to rewrite it. I say ‘attempt’, cause code written like that is not easy to understand, esp for people who are used to ‘decent’ structured code. I splitted the code into 2 subs instead of one, removed all breaks, returns, the insane do while true and put only the required code in try catches.
Today I again did some work on my .Net download library project. I added some stuff to the main class, Download, and also created the base of the DownloadManager class. This class will allow you to work with multiple downloads at once, by putting them in a list, and providing a variety of methods and properties that enable you to gather info or work with all or selections of the downloads.
I’m getting close to actually be able to start debugging the code, something which can take up quite some time with so much untested code.
Today did quite some work on .Net download library, the successor to my current FileDownloader class.
I started off with finishing the protocol provider code (see revision 4), and then went on adding a lot of the still missing stuff to the Download class (see revision 5), which now counts almost 800 lines of code. Most changes I made are pretty much C# to VB.Net translation from MyDownloader, one of the projects I’m basing this library upon. Doing this translating also comes with the challenges of leaving out code that’s not needed (for example a hook system for protocol providers), holding into account all the name changes I’ve made, and at some points revising the logic layout of the code, since I don’t agree with the original design. I also had some great fun with working with SyncLock statements and interfaces.
Although the project is still far from a first release, the basic structure is taking form, and I’m beginning to see where and how future features will need to be added
Now the Google Summer of Code coding period has finished, I can divide my attention between multiple projects again. Since I’ve been doing PHP and JavaScript only for over 2 months now, I’m starting off with taking a PHP-break. This means I won’t do any development of mayor new features for Maps or Semantic Maps, and definitely won’t work on any other PHP project. Of course I’ll still ensure bugs get fixed for my mapping extensions, and help people out with code when needed, but that’s about it. So basically I’m closing my Zend Studio, which has become one of my most used applications in the last months, and starting my Visual Studio again. Now I think of it, this is really awkward. I used to start my VS practically every time I booted my computer for over a year, and then only opened it a handful of times in a 2 month period.
So, what am I going to work on now? One of my last projects before I started GSoC was a VB.Net background file downloader, of which I released an article on The Code Project, and later on created a C# version. I got quite some positive feedback on this project by people, although it was initially created with the sole purpose of helping that needed a simple downloader someone out, to improve my own skills, and to demonstrate how to create a simple to implement downloader. I’m now continuing this project, by rewriting it from scratch, to both add some mayor new features, and mess around with some multi-threading stuff I’ve been wanting to try out for months now.
The mayor new features that will be added are simultaneous downloads (the current classes only support one download at a time), segmented downloads (woot!), download priorities and bandwidth limitation options. This will require a nice OOP approach, with some more advanced multi-threading. I’m basing part of my code on MyDownloader, an extremely nice C# downloader, which has quite some more functionality then what I’m doing. It’s more extensive then required for most people though, and not all that easy to implement. I also don’t really agree with some naming choices, and it lacks both code docs for devs that want to modify it, and devs that want to implement it. So clearly, I’ll put a lot of effort in keeping the new project as small and to-the-point as possible, and pay attention to easy of implementation, and usability. Another obvious difference is that this project is in VB.Net and not C#.Net. This has more advantages then disadvantages IMHO. If the project is compiled to a .dll or is used in a multi-project solution, it simply doesn’t matter what language it uses. A lot of casual programmers don’t know how to handle either, and the majority of these uses VB.Net, and not C#. And the ones that do know C# are more likely to know VB.Net then the other way around.
I’ve created a project on SourceForge to host the code, and be able to commit to the project’s SVN. Since the project now contains multiple classes, I renamed it to .Net DownloadLib.
After that project I’m planing to put some real effort into my mapping extension for MediaWiki again, and possibly to have a look at Python and Ruby. When school starts again, somewhere half way through September, some new project opportunities will probably arise for me, but I guess I’ll see that then. I’m also looking forward to ‘learning to program’ at school, which is destined to give me some great laughs. Luckily for me I’ll have to learn C++ at university, so I won’t be totally bored with it. I hope they don’t drive the low-level aspects of the language to far, since that’s pretty useless in today’s world IMHO.
I’ve just released a new version of BN+ framework. It features a variety of new classes since version 2.0.2 plus some bug fixes and stability improvements. Also some classes have been added the the class library or control library repositories on BN+ Discussions, and a few of them now have detailed articles on The Code Project. Here you have an outtake from the release notes:
New classes
* BugSubmitter: A dialog that enables user to submit variouse types of bugs with build in validation. Sends it’s info to a webservice.
* PasswordDialog: Password editting dialog with optional authentication and live validation .
* SimpleLoginDialog: A simple login dialog that prompts for a password.
* FileDownloader: A class for downloading files in the background that supports info about their progress, the total progress, cancellation, pausing, and resuming. The downloads will run on a separate thread so you don’t have to worry about multihreading yourself.
Revised classes
* CryptoProvider: Now allows you to pass more advanced settings for AES and offers easier to use methods for RSA, DES and TrippleDES.
* CryptoStr: Has been rewritten to work with the new CryptoProvider and is now easier to use.
* Updater: A bug in the version compare algorithm has been fixed
* BruteForceAttacker: New version included (BN+ Framework 2.0.2 contained an unstable alpha build of this version)
* …
Further development
* The CyrptoProvider class will be rewritten from scratch and be made abstract, and serve as a base for separate DES, TDES, RSA and AES CryptoProviders.
* BruteForceAttacker will be made more modular and work on multiple threads.
* FileDownloader will get support for multiple downloads at the same time and segmented downloads.
I’d also like to thank everyone who helped with this project by providing bug reports, suggestions, contributions, or by simply using it!
If you are interested and consider to use this framework, please review the official topic and framework documentation.

Categories
Tag Cloud
Blog RSS
Comments RSS
Last 50 Posts
Back
Void « Default
Life
Earth
Wind
Water
Fire
Light 