BlockLeftTop, PRELOAD BlockLeftBottom, PRELOAD BlockLeftStretch, PRELOAD BlockTop, PRELOAD BlockBottom, PRELOAD BlockStretch, PRELOAD BlockRightTop, PRELOAD BlockRightBottom, PRELOAD BlockRightStretch, PRELOAD
DeltaEngine

Moving to DasBlog v1.8

by Benjamin Nitschke 20. October 2005 05:30
I am using DasBlog for about 1 year now. I think I started with v1.5 and upgraded to v1.6 a long time ago. I still think DasBlog is one of the best blog engines around and overall it is one of the few good online tools that don't cause much headaches.

Download link to DasBlog 1.8.

The new rich text box add post capabilities are nice (not only html, but also a design view for direct editing or previewing), but they don't really have all the features I need (for example there is no search feature for writing a new post at all). I still think it is more effective to write everthing in some powerful text editor (or some html editor if you like) first and then just copy it over and test it. Still, all improvements and new features are a good thing.


So today Jeff Clark wrote me an email telling me that SharpReader wasn't able to use my RSS feeds. He also did sent a link to http://feedvalidator.org/ to help me check on that issue.

For some strange reason the returned feed was not in the usual Xml format, but in a html format and the validator did not really like that "feature":

I used http://feedvalidator.org/ for this and the returned error was "This feed does not validate. Feeds should not be served with the "text/html" edia type"

I didn't know where to fix that. Instead I thought updating DasBlog from v1.6 to v1.8 could help and I wanted to do that sometime anyway. The upgrade readme is quite long and looks complicated with a lot of single steps and warnings, but it didn't took long to replace everything, do the important stuff for ASP.NET 2.0 and just restart the IIS. Everything worked fine after that. Even my custom theme didn't cause any troubles. I just had to adjust the config files (web.config, site.config) a bit to get rid of obsolete parameters and setting new parameters.

However, the RRS feeds where still wrong in html instead of xml. I checked some other sites using DasBlog v1.8 and their feeds worked fine, sometimes with a couple of warnings. After some more testing I was guessing that maybe the main site linking to the blog sub directory was the cause and not the blog itself (since a browser still points to the http://abi.exdream.com even if we are on another page). And it turns out that you only get an invalid RRS feed if pointing to http://abi.exdream.com/..., but you will get an valid feed if pointing to http://exdream.dyn.ee/blog/...

I changed the links and RRS worked fine then, there are still some warnings left, especially about relative links instead of absolute URLs for images and other files (http://feedvalidator.org/ returns "description should not contain relative URL references"). I will try to remember that for future posts and I changed some important items, but I'm not going to fix all posts now to be 100% valid (who cares anyway, at least it works again). If you are using an old RRS url like
http://abi.exdream.com/blog/SyndicationService.asmx/GetRssCategory?categoryName=Programming
please change it to:
http://exdream.dyn.ee/blog/SyndicationService.asmx/GetRssCategory?categoryName=Programming

If you find other problems (e.g. with other RRS readers) and think there are really important, drop a comment or write an email if you want to see it resolved. Thanks again to Jeff for reporting this, I wouldn't have noticed it.

Generating Xml data from Xml Schemas

by Benjamin Nitschke 19. October 2005 02:01
Today I was playing around with Xsd (Xml Schema) files a bit for automatic Xml generation of specific types I need for an editor. Starting to work with Xsd files isn't that hard, looks like Xml, but stuff is named "element", "complexType", "sequence", etc. Once you are familar with that you can easily write Xsd files (but please, not another "Customer" example, I'm going to puke), which validate your Xml data automatically for you. But I don't wanted to do that, I just need a clean and easy way to generate specific types like Colors, Vectors, Material parameters, etc. Btw: Everthying shown here is only intended to be used by the Editor, Artists don't want to work with Xml files and I don't think Programmers should either. Let the work be done by the computer.

The things I will cover here don't use much of the keywords in Xsd. See References and your MSDN help for a complete overview what you can do with Xsd (or any other Xml Schema for Validation). For a more complex and longer example of an useful Xsd file see the Google sitemap xsd file. I on the other side try to keep things simple. Instead of using 6 xml lines for describing just a color, I prefer 1 simple line (using xml attributes instead of child nodes).

Here is the sourcecode for this article (requires .NET 2.0 and uses NUnit). Take a look at the unit tests to see how to use this code.

Ok, here is an examples using Xsd (you might notice I don't use namespaces or annotations, they only bloat things up ^^ If your Xsd files get more complex, you should think about expanding them.):

And this would generate by default:

Or a more useful example inside the Material node:

So, how do we do all that stuff? Yes, exactly, by using the System.Xml.Schema namespace. All the required classes are in there, but most function do only check your code or help you to analyse. We want to create xml. Anyway, we have always start with loading and compiling the Xsd file first. If anything goes wrong here, you will get an exception explaining what you did wrong in the Xsd file. This is the handy dandy method I use for loading XmlSchemas:

If you want to load a bunch of Xsd files (I already have created around 30 of them in just a couple of hours ^^), it is much better to add them all to the same XmlSchemaSet and compile them all at once. Note: This has the disadvantage that any compiling error will result in all the rest of the schemas not to be loaded. But it is much faster this way.

We need 2 more methods for our goal to generate a xml node. This first one will create the xml node and go through all schema items (only ComplexType items are handled in this example) if possible. Then it returns the child node to allow maybe changing some more things.

And finally we use this method to fill in all the xml elements and using the default values (you can specify them with default="value" in the xsd file). First we go through all child nodes and recursively call this function again until all nodes are handled. Then we go through all schema attributes and add them as well.

Ok, there is one helper method missing for getting the default value. Lets assume that most elements don't have a default element and will return an empty string for the default value. It is much more useful to have "real" default values like 0 or false and thats excatly what TryToFindDefaultValue is for:

Ok, that it. Now you can create nodes from any loaded schema using code like this one from the unit tests (see project files above):

Btw: You can also use Visual Studio to edit or create xsd files in a more fancy way, but I didn't found it more productive than typing in xsd directly for small xsd files.

References:

Have fun.

Migrating ASP.NET VS2005 Beta to VS2005 RC/final

by Benjamin Nitschke 12. October 2005 16:27
Well, I installed the new .NET 2.0 Framework of VS2005 RC on my server and most of my web apps and services stopped working. This site was also down for a couple of hours because I had a problem with MSDE (which had to be reinstalled as well and caused trouble).


Parser Error Message: Error parsing attribute 'compilewith': Type 'System.Web.UI.Page' does not have a public property named 'compilewith'.

The first thing to check after uninstalling the old .NET 2.0 Beta Framework and installing the new .NET 2.0 RC (or final, I guess there won't be much difference) is to restore all aspnet appslications back to .NET 2.0 (they will link to .NET 1.1 after uninstalling .NET 2.0 Beta).

You can do this with the command "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis /i" (this will install .NET 2.0 for all ASP.NET apps, if you just want to use .NET for certain apps use /? to learn more about the allowed arguments). Alternatively you can use the ASP.NET Version Switcher (dunno if this works perfectly, but the tool looks cool).

The next problem might be that .NET 2.0 changed quite a bit. You might have to change some .aspx files from

  • <%@ Page Language="C#" CompileWith="Default.aspx.cs" ClassName="Default_aspx" %>

  • to
  • <%@ Page Language="C#" CodeFile="Default.aspx.cs" Inherits="Default_aspx" %>

  • and modify the code behind classes to derive from Page or UserControl:
  • public partial class Default_aspx : Page
    { [...]
  • WebServices can still use CodeBehind and Class, but because of a strange "Could not create type ..." Error I had to recompile them and found out that you have to change the class attribute a little:

  • [WebServiceBinding(ConformanceClaims = WsiClaims.None, EmitConformanceClaims = true)]

  • to
  • [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

  • That's it, your websites should run the way they are supposed to again. If not, ask google for more help ^^

    Get ready for October 2005 DirectX SDK

    by Benjamin Nitschke 5. October 2005 19:48
    Yeah, finally Microsoft released the first DirectX SDK supporting .NET 2.0 (well, its still very early stuff, most samples are still missing, etc.). Time to debug DirectX in VS2005 finally :)

    Download the October 2005 DirectX SDK here.

    But beware, according to this and this threads in the gamedev.net boards there are still a lot of problems with the october sdk. For this reason you should maybe leave your august sdk installed.

    Another strange thing is that downloading with firefox only gives me 7-8 kB/s, while on the internet explorer I get 25-30 kB/s (still very slow, 200 MB take more than 2 hours).

    I will report later or tomorrow if this sdk sucks or not, depending on if I can compile my code or not ^^

    Update: As ZMan reports here and here the current DirectX SDK works only with VS2005 Beta2, not with any later version. Another issue is the missing documentation and samples for all that .NET 2.0 stuff, so thats gonna be hard ...

    Another update: You will get immediately an FileWasNotFoundException (HRESULT 0x8007007E) in VS2005 RC as soon as you call any DirectX method when using the DirectX 9 October 2005 .NET 2.0 runtimes. I also noticed a lot of changes, even a simple new Device(...) call has changed. Since I rely on VS2005 RC, I won't use the DirectX .NET 2.0 runtime yet (hopefully it works better in december).

    CR_Commenter Update v1.4

    by Benjamin Nitschke 5. October 2005 05:12
    I've done a little update of the CodeRush Commenter tool (click here for the full article). Basically I was annoyed of some old bugs like namespace commenting (which produces a compiler warning in vs2005) or auto-commenting of initialized variables inside methods with xml (again, a compiler warning, but this happend only if all commenting features were turned on).

    Click here to download CR_Commenter.zip v1.4.
    And here is the sourcecode for CR_Commenter v1.4.

    Anyway, I fixed those things and added a couple of cool new features:

    • Fixed: No more Xml Generation of namespace sections or for variables in methods.
    • Fixed: All sections are updated, the first one is not skipped anymore.
    • Fixed: Using directives section generation works now fine with multiple lines for a single using statement.
    • Fixed: Structs, enums and switch statements to now correctly generate comments and xml comments.
    • New feature: Added a bunch of keywords to translate abbrivations to full names. This one is very cool, it makes the Commenter look smart because it will automatically generate meaningful comments for methods and parameters. For example "xPos" becomes "X coordinate position" or "bmp" becomes "Bitmap", "descNum" becomes "Description number", etc.
    • Also made some of the choices smarter where to generate which xml parameters, e.g. variables and classes do not longer use the return xml comment.

    I've also started working on a couple of new features like automatic region generation and automatic refactoring of code and maybe supporting FxCop rules (automatically fixing them, since that is a lot of work by hand, many rules can be fixed automatically). But that is still a lot of work and I will continue that pursuit sometime later.

    Wanna know some cool Visual Studio hotkeys? Here they are:

    • Ctrl + M + M: Expand/Collapse current selection.
    • Ctrl + M + O: Collapse all regions of the current file (very useful imo).
    • Ctrl + M + L: Collapse everything (not only regions, but also code blocks and comments).
    • F12: Go to definition (most useful hotkey ever, but not many people know about it ^^).
    • Shift+F12: Go to reference (vs2003) or find all references (vs2005).
    There are millions more in VS->Tools->Options->Keyboard, but it is really hard to find anything there (way to thin list). For example I use F5 to Run (obviously), F6 to compile all, F7 to compile only selected, F8 to start (NUnit) test, F9 to debug test. The last 2 shortcuts work only in VS2003 and earlier VS2005 versions, on VS2005 RC I don't have any shortcuts available for Testing except the ones from VSTF. Does anyone know how to fix that?

    Update: Found out why my hotkeys didn't work in VS2005, a complete removal (including all files and settings) of TestDriven.Net and reinstall did fix these problems finally :) F8 for unit testing again!

    Disclaimer: The opinions expressed in this blog are own personal opinions and do not represent the companies view.
    © 2000-2011 exDream GmbH & MobileBits GmbH. All rights reserved. Legal/Impressum

    Poll

    Which platform should Soulcraft be released on next?











    Show Results Poll Archive

    Recent Games

    Soulcraft

    Fireburst

    Jobs @ exDream

    Calendar

    <<  April 2014  >>
    MoTuWeThFrSaSu
    31123456
    78910111213
    14151617181920
    21222324252627
    2829301234
    567891011