Posterous

Søren Jacob Lauritsen’s Weblog

development in .NET and other related stuff 

ASP.NET tab is missing from IIS 6.0

Problem Description

We all know this problem, the ASP.NET tab is missing from the IIS 6.0 website properties and you know, that you have more than one version of ASP.NET installed. Great, what do you do?

Solution

Doing a manual check on the configuration can be a very difficult task, since you will have to check a lot of different settings. The ASP.NET Debugging blog have posted a script that will check your configuration settings for you, and better yet, it will fix any problems you might have. I have tested this on my server, and the ASP.NET tab re-appeared immidiatly.

http://blogs.msdn.com/b/tom/archive/2008/04/17/asp-net-tab-missing.aspx

Also note that when installing ASP.NET you must use the command:

aspnet_regiis.exe -ir -enable

This will install ASP.NET and enable it for use, but it will not upgrade or touch existing ASP.NET sites. In order to make the existing sites work with ASP.NET you must select the desired ASP.NET version from your newly recovered ASP.NET tab in the website properties dialog.

Happy programming!

Filed under  //   ASP.NET  

Comments [0]

Injection Proof'd - The Daily WTF

Injection proof'd code:
internal static string FQ(string WhichField)
{
   string expression = "";
   int num2 = Strings.Len(WhichField);
   for (int i = 1; i <= num2; i++)
   {
      string str = Strings.Mid(WhichField, i, 1);
      if (str == "'")
      {
         str = str + "'";
      }
      expression = expression + str;
   }
   return Strings.Trim(
      Strings.Replace(Strings.Replace(Strings.Replace(Strings.Replace(
      Strings.Replace(Strings.Replace(Strings.Replace(Strings.Replace(
      Strings.Replace(Strings.Replace(Strings.Replace(Strings.Replace(
      Strings.Replace(Strings.Replace(Strings.Replace(Strings.Replace(
      Strings.Replace(Strings.Replace(Strings.Replace(Strings.Replace(
      Strings.Replace(Strings.Replace(Strings.Replace(Strings.Replace(
         expression, 
            "xp_", "", 1, -1, CompareMethod.Text), 
            "sp_", "", 1, -1, CompareMethod.Text), 
            "--", "-", 1, -1, CompareMethod.Binary), 
            "alter table", "", 1, -1, CompareMethod.Text), 
            "drop table", "", 1, -1, CompareMethod.Text), 
            "create table", "", 1, -1, CompareMethod.Text), 
            "create database", "", 1, -1, CompareMethod.Text), 
            "alter table", "", 1, -1, CompareMethod.Text), 
            "alter column", "", 1, -1, CompareMethod.Text), 
            "drop column", "", 1, -1, CompareMethod.Text), 
            "drop database", "", 1, -1, CompareMethod.Text), 
            "1=1", "", 1, -1, CompareMethod.Text), 
            "union select", "", 1, -1, CompareMethod.Text), 
            "/*", "", 1, -1, CompareMethod.Text), 
            "*/", "", 1, -1, CompareMethod.Text), 
            "boot.ini", "", 1, -1, CompareMethod.Text), 
            "../", "", 1, -1, CompareMethod.Text), 
            "%27", "", 1, -1, CompareMethod.Text), 
            ";dir", "", 1, -1, CompareMethod.Text), 
            "|dir", "", 1, -1, CompareMethod.Text), 
            "<script", "", 1, -1, CompareMethod.Text), 
            "</script>", "", 1, -1, CompareMethod.Text), 
            "language=javascript", "", 1, -1, CompareMethod.Text), 
            "language=\"javascript\"", "", 1, -1, CompareMethod.Text));
}

The above example from TDWTF is so typical. I really hate finding stuff like this in code and it makes me worry every time. Why are companies paying for code like this? I really do not understand. Quality assurance, quality assurance, quality assurance - learn it!

Comments [0]

How Fanboys See Operating Systems — The Adventures of Accordion Guy in the 21st Century

How Fanboys See Operating Systems

by Joey deVilla on December 16, 2009

how fanboys see operating systems

This is the way true fanboys see other operating systems. I must say, the way Windows fanboys look at Apple are pretty spot on. ;-)

Comments [0]

Certified PRINCE2 Practitioner

Today I have passed my PRINCE2 Practitioner exam. I can now call myself “Certified PRINCE2 Practitioner”.

The exam itself is a lot more work than the Foundation exam. In the Practitioner exam you have to prove, not only, that you have understood the principles of PRINCE2, but also that you can use them and combine them in a real project.  

:-)

Happy programming

Filed under  //   PRINCE2  

Comments [0]

Hooray! I passed my PRINCE2 Foundation exam.

Today I passed the PRINCE2 Foundation exam. This leads the way to the PRINCE2 Practitioner exam, which I will be sitting through some time later.

I really find it rewarding to work on a project for some time and see the benefits realised. You can say that passing the PRINCE2 exam was the benefit of me reading the PRINCE2 manual the for the duration of the last month. One thing I have learned is that it is very, very benefitial to download exam questions from the internet and work with them while you read. I also got the book "Passing the PRINCE2 Examinations". It contains a syllabus and a trial exam.

If you would like to know more about PRINCE2, visit the PRINCE2 website.

Filed under  //   PRINCE2  

Comments [4]

How to find the equation of a parabola using the slope of two tangents.

Calculus is fun! I just love whenever I solve a cute little problem, much like when you have found the solution to some programming problem.

How do I find the equation of a parabola using the slope of two tangents?

I got this question from a friend of mine who needed help on a Calculus test. At first I thought: "This is just plain easy!", but I must have been a bit rusty in Calculus, since I had to actually read up on it. Embarrassing. Anyway, here is the solution.

The pictures included are from the fine tool called Graphmatica. Remember you do not need a rocket science calculator to do Calculus! ;-) I prefer pencil, paper, a super simple calculator and a tool like Graphmatica. :-)

I will try to explain the solution to the utmost detail. You can solve the problem with a lot less explaining, but if you would like to understand the "why" in the solution, and, believe me, you will, you will have to take these steps.

The problem:

The two tangents T and S touches the parabola in T (30; 12) and S (60; y).
T's angle is 59,53 degrees and S's angle is 26,56 degrees.

Explain why the parabola's function is:

f(x) = -0,02x^2 + 2,9x - 57.

The problem illustrated:

The solution:

In Calculus, I always find it rewarding to approach these types of problems with an example based on letters. This gives me the "recipe" for solving the problem. We cannot use the standard way of finding the function of the parabola, since we only have one and a half point to deal with. So we will have to use the two tangents to find the function. This is just as good, as we know the x where the tangents touches the parabola, the key to solving the problem is to find the slopes of the tangents. Why? Read on!

A tangent is a straight line with a slope. The slope is called m and the straight line is defined by the function:

f(x) = mx +b

The slope m is defined by:

 m = (y - y0 / x - x0) 

The (y - y0 / x - x0) is also called dy / dx and is actually just another way of saying f'(x). You can say dy / dx is the derivative of y with respect to x. It is all the same. Simple huh? :-)

We know that the parabola's function is defined by:

f(x) = ax^2 + bx + c

And we know that the slope m of a tangent at any x on f(x) is the same as f'(x). In our case:

f'(x) = 2ax + b

These two functions will be our recipe for solving the problem.

Let us take a look at the information we have. The best lead on finding the slope must come from the angles provided. Since the angle says something about - well - the slope, we must be able to extract m from the angle. How to do that?

Remember the definition of the slope m?

m = dy / dx

Imagine this as a triangle:

We know that dy / dx is equal to m. But how do we connect the dots? Remember your trigonometry lessons? The tangent function says that the opposite over the adjacent is equal to tangent of the angle A. As the illustration clearly shows dy is the opposite and dx is the adjacent. Meaning that the tangent of the angle A must be equal to dy / dx, which again is equal to f'(x) and finally m. :-)

Now we know that f'(x) is also equivalent to the tangent of the tangent's angle with the x-axis. ;-) And to our luck, this angle has been provided to us.

We now have the following information:

f'(30) = 1.7 = tan(59,53)
 f'(60) = 0,5 = tan(26,56)

We also have one point on the parabola. The point where the tangent T touches the parabola and that is in (30; 12).

Now let us use our recipe functions to solve this problem.

  1. x = 30 and f'(30) = 1,7 : 2a(30) + b ==> 60a + b = 1,7
  2. x = 60 and f'(60) = 0,5 : 2a(60) + b ==> 120a + b = 0,5
  3. The point (30, 12) in the parabola function definition ==> 900a + 30b + c = 12

Great! Now we have three functions with three unknowns.

Subtract function number two from function number one and isolate a:

-60a = 1,2
a = 1,2 / -60 = -0,02

Put this information into function number two and isolate b:

120(-0,02) + b = 0,5
-2,4 + b = 0,5
b = 0,5 + 2,4 = 2,9

Now put this information into function number three and isolate c:

900(-0,02) + 30(2,9) + c = 12
-18 + 87 + c = 12
 c = -57
 

Putting it all together leaves us with the result that the function of the parabola is:

f(x) = -0,02x^2 + 2,9x - 57

Happy programming

Filed under  //   Calculus  

Comments [0]

Hacker News | Ask HN: Anyone know how to publish code samples to Posterous?

All you have to do is surround your code block with the following tags:

your code here


Additionally, if you want to get fancy, you can specify a language with the following syntax:



public static boolean isAwesome = true;


This should work for both through the web interface and through the email interface.

The available list of languages is: 'cpp', 'c', 'c++', 'c#', 'c-sharp', 'csharp', 'css', 'delphi', 'pascal', 'java', 'js', 'jscript', 'javascript', 'php', 'py', 'python', 'ruby', 'rails', 'ror', 'sql', 'vb', 'vb.net', 'xml', 'xhtml', 'xslt', 'html', 'xhtml'

Current known issues: HTML formatting might be a little spotty at the moment. Will be fixing asap. I also see some intermittent errors where the code isn't getting properly recognized.

There you go! A quick and easy way to post code snippets to you Posterous - and you do not even have to edit the HTML. :-) I use this with all my coding posts.

Happy Programming!

Comments [0]

I moved the weblog to Posterous.

Today I was told about this very cool tool called Posterous. :-) I have looked for a way to outsource my old home-hosted weblog and Posterous seems to be "the man" for the job.

The thing about this cool tool is that it just works. It is simple to use, I like that, and I can customize it the way I like. I have not done so yet, but I will be creating my own Posterous theme anytime soon. One minor issue is the lack of being able to support flawless XHTML. I guess I will have to live with that. You cannot have it all. Although I still think the XHTML validation errors are of the type that could easily be fixed. I would fix them if I could, but I cannot... ;-)

Now the weblog is the same, the content is the same (Posterous can actually import the dotnetblogengine using metaweblogapi).

Enjoy!

...and Happy Programming! ;-)

Filed under  //   Blogglestar Gablogtica   Posterous  

Comments [0]

PRINCE2 - Exam

This fall is going to be the fall where I will take my PRINCE2 exam. :-)

I am currently reading for the PRINCE2 Foundation exam and I will continue with the PRINCE2 Practitioner.

What is PRINCE2?

The official PRINCE2 website says:

PRINCE2 (PRojects IN Controlled Environments) is a process-based method for effective project management. PRINCE2 is a de facto standard used extensively by the UK Government and is widely recognised and used in the private sector, both in the UK and internationally. The method PRINCE2 is in the public domain, offering non-proprietorial best practice guidance on project management.

I am reading the official PRINCE2 book from OGC and it is very informative and good reading. If you think of going into project management I can really recommend reading this book.

Happy programming!

Filed under  //   Education   PRINCE2  

Comments [0]

ASP.NET DataSet: Remember the length of parameters

Problem:

You have just changed the size of a varchar column (perhaps a size 20 to a size 50) in your database. You have then manually updated your data set to use the new size, but your data set does not save values with the new size. It keeps cutting off text.

Solution:

You have forgot to set the size of the parameter in your customized query.

  • Select the query in on the table adapter.
  • Right click and select properties.
  • Expand the Parameters property and change the size of your column.

Now your problem is solved!

Happy programming!

Filed under  //   ASP.NET   Programming  

Comments [0]