Click here to Skip to main content
15,214,134 members

Comments by Christoph Keller (Top 82 by date)

Christoph Keller 10-Sep-13 4:28am View
Thanks for your answer, this would be a solution, but is not an option with using an xslt transformation for this (because we're trying to refactor the current xslt processing and replace it by standard .net object structure and controls for displaying).

But thanks anyway for your appreciated help!

Best regards,
Christoph Keller 10-Sep-13 4:26am View
Ok, we will generate a new schema according the XML output of the transformation we got.
There seems no other way around, I just hope to catch all properties correctly.. :)

Thanks for your help!
Christoph Keller 10-Sep-13 3:04am View
Ok, you are right. I now tried to implement the overrides, but now the data inside the xml do not exactly match (attribute definied in xml, but defined as normal nodes in xsd). So this will never work...

After digging around in the actual code, I found out that the resulting XML is generated using the original xml-data (where the xsd really matches) which will be pulled through an xslt transformation where no output-scheme exists..

Is there any way to generate a xsd scheme for a given xslt (for the output xml)?
Christoph Keller 9-Sep-13 15:55pm View
Hey SA,

I created a small test-project with both serializing and deserializing. Here is the code (open for pulling).

I know, the serialize part is a bit silly using the XmlAttributeOverrides, but this produces exactly the XML I got. And unfortunately it is not possible to make changes to the XML output nor to the XSD scheme.

By creating the test-project, I saw a (very hacky) workaround, by adding such overrides for each class defined in the XSD, but this should be really the last solution. Are there any other possibilities to deserialize the XML where there are no namespaces defined?

Thanks for your help.

Best regards,
Christoph Keller 9-Sep-13 14:07pm View
Hey SA,

Thanks for your reply. The xml unfortunately was generated using the schema I used to generate the classes.. They match except for the xmlns on the root node, and that is the source of the problem I think.

How can I get the XmlSerializer to deserialize the xml data without lookung at the xmlns, or other way around, how can I inject the xmlns attribute onto the xml string?

Thank you very much for your help.

Best regards,
Christoph Keller 29-Aug-12 15:38pm View
Nice link! Never saw this! :)
My 5+ :)
Christoph Keller 10-Aug-12 10:05am View
Thanks for the ManagedEsent hint! Never heard about it and sounds really interesting!

my 5* :)

Thanks again and happy coding,
Christoph Keller 30-Jun-12 2:04am View
I'm sorry, but we're not here to do your homework...
If you have a specific question about a problem, please ask it. But dont just copy your homework into a question...

my 5 cent,
Christoph Keller 30-Jun-12 2:03am View
I'm sorry, but we're not here to do your homework...
If you have a specific question about a problem, please ask it. But dont just copy your homework into a question...

my 5 cent,
Christoph Keller 29-Jun-12 7:52am View
Thanks! :)
Christoph Keller 29-Jun-12 7:10am View
Thanks! :)
Christoph Keller 19-Apr-12 3:36am View

Unfortunately, I have no clue about what you're talking about. I think the best would be that you open up a new Question (menu QuickAnswers / Ask a Question).

Best regards and happy coding,
Christoph Keller 27-Sep-11 4:15am View
until 2000 eggs?
Please be a bit more specific in your question.

Thank you and have a nice day,
Christoph Keller 16-Sep-11 4:57am View
With my answer, I asked you for some code. I do not have an idea of what you already done so that's what I asked :)
Christoph Keller 27-Aug-11 7:14am View
That means that RaisKazi improved your solution by adding a "pre" tag around your code. This was just a readability improvement. You could do this by yourself when you write a post on CodeProject by surrounding any code you paste with a <pre> tag.

Hope this helps.

Have a nice day,
Christoph Keller 27-Aug-11 7:10am View
Great overview and explanation, my 5+
Christoph Keller 27-Aug-11 2:09am View
Could you please supply some code to verify or check what you have done?
Thanks :)
Christoph Keller 11-Aug-11 15:18pm View
Just correct, my 5+ :)
Christoph Keller 11-Aug-11 15:07pm View
You're welcome :)

If the answer helped, please mark it as "answer". Thank you :)
Christoph Keller 8-Aug-11 1:14am View
Could you be more specific in what your stored procedure is doing? This would be helpful to answer your question.

Thanks and have a nice day,
Christoph Keller 6-Aug-11 4:03am View
You're welcome, I'm glad to hear that it helped.

If the question is solved, please mark the answer as "answer", thank you :)

Have a nice day and always happy coding,
Christoph Keller 6-Aug-11 3:54am View
If you set the Timeout programmatically before the upload, the timeout is valid for the whole user-session. So you should still have the longer timeout after the processing.

If you want to reset the timeout after the generate process, do it the same way as you did it to make it longer, and everything should be fine :)
Christoph Keller 6-Aug-11 2:56am View
This Facebook library you posted is very old (last update in 2008). The newest Facebook SDK is this here:

Best regards and happy coding,
Christoph Keller 28-Jul-11 3:21am View
That's good to hear!
You're welcome :)
Christoph Keller 28-Jul-11 3:14am View
you're welcome, hope this helps really! :)
Christoph Keller 19-Jul-11 8:32am View
you're welcome! :)
Christoph Keller 19-Jul-11 3:25am View
You could write it this way:

var filtered = from c in country
where (c.Condition == 1 && c.Id >= 5) ||
(c.Condition != 1 && c.Id <= 5)
select c;

so first check for the condition and combine it (by using '&&') with the second check.

As far as I know, there is no possibility to have a "dynamic" check, whathever this means. The check must be defined somewhere so it is always static.

Hope this helps.
Christoph Keller 18-Jul-11 16:20pm View
You're welcome! I'm glad to hear that it worked! :)

Have a nice day :)
Christoph Keller 16-Jul-11 13:47pm View
Why you don't look at the answers of your previous posted (same) question here:
Christoph Keller 15-Jul-11 9:43am View
Good links for starting using masterpages! Thank you, my 5+
Christoph Keller 15-Jul-11 9:37am View
You're absolutely right and you made my day! Thank you, my 5+ :)
Christoph Keller 8-Jul-11 3:27am View
Exactly. Poor webserver hosting such a calc app... ;) my 5!
Christoph Keller 8-Jul-11 3:25am View
Totally agree, my 5!
Christoph Keller 28-Jun-11 1:30am View
Yes, thats true, it was just an example :)

After some research, I found this: jQuery bPopup plugin / bPopup demos, just as a starting point for custom JS Messageboxes.

Hope this helps!

Have a nice day and happy coding! :)
Christoph Keller 22-Jun-11 11:20am View

What is the exact problem? Do you get any error, executing the above code?

Best regards and happy coding,
Christoph Keller 20-Jun-11 8:26am View

You can try it this way:

SELECT B.cat_ID as [cat_ID],
SUM(A.article_visit) AS [Article_Visit]

FROM article_list A

LEFT JOIN category B
ON A.cat_ID = B.cat_ID

WHERE A.article_status = 1
AND B.article_allow = 1


Hope this helps.

Best regards,
Christoph Keller 16-Jun-11 10:13am View
Thank you! :)
Christoph Keller 16-Jun-11 5:57am View
If you google this, you will find many sites providing such a proxy.

But BE AWARE that nobody should ever enter any sensitive informations (for example passwords for Social Media sites) on a site (except the original site of course). You never know if such a page is logging / stealing your passwords! So please pay attention!
Christoph Keller 24-May-11 8:29am View

Please look at the links in the Solution 1 from S Mevara. There you will find the stored procedure (SP) related links. In your case, I would prefer a SP which have one output declared parameter (see Using a Stored Procedure with Output Parameters). And inside the SP you write something like: SET @outputParameterName = SCOPE_IDENTITY()

Hope this helps.

Best regards and good luck,
Christoph Keller 24-May-11 6:57am View
Can you explain from which URL to which URL the session gets lost (for example to

Perhaps this is a domain-issue (sessions are domain-specific because they're saved in a domain-dependant cookie on the client). But this is just a big guessing ;)

Best regards,
Christoph Keller 24-May-11 6:54am View
unforunately comments cannot be voted...
you made my day!! :)
Christoph Keller 24-May-11 6:36am View
He means this:

The first result of the google search is this, and it should explain it for you.

my 5+ ;)
Christoph Keller 24-May-11 5:44am View
Nice link, thank you for sharing!
My 5+
Christoph Keller 24-May-11 2:33am View
Thanks! :)
Christoph Keller 23-May-11 11:08am View
Thank you! :)
Christoph Keller 23-May-11 10:55am View
Yes, that's right, anonymous objects are only valid in the scope they're created so you need to fill the data into any other object / structure if you want to do further processing / returning the data.

Perhaps it is easier if you have a consistent datasource / DB with correct primary keys and correct relations, that Linq to SQL can give you the possibility to access for example the UserGroups by accessing User.UserGroups..

But I think this would go beyond the scope of this question :)

Hope this helps.

Best regards,
Christoph Keller 23-May-11 5:01am View
Thank you! :)
Christoph Keller 23-May-11 3:24am View
Thank you for sharing this! Never heard of it and I will definitely try this out next time!
my 5+!
Christoph Keller 20-May-11 8:26am View
Thank you for the link, nice to know that such a library exists!
my 5+!

Have a nice day and happy coding,
Christoph Keller 19-May-11 5:59am View
you're welcome :)
Christoph Keller 19-May-11 5:21am View
It depends on which solution you take ;)

If you realize your blog with, you can test it locally and deploy it to the live website (a sub-domain works perfectly, a sub-directory of your hosting should work too (perhaps it needs a virtual-directory for this)).

Here you will find a guide, how to install the
Christoph Keller 17-May-11 16:42pm View
Thank you! :)
Have a nice day and happy coding,
Christoph Keller 17-May-11 5:46am View
You're welcome!

Thank you for the wishes and until next time! :)
Have a perfect day!

Best regards and happy coding,

p.s.: Just say "Stops" and not "Sir stops", please ;)
Christoph Keller 17-May-11 5:12am View
Hi :)

You have to update the method signature (and also the main method / dump method):

in Main():
IDictionary<string, IDictionary<string, int>> Region = new Dictionary<string, IDictionary<string, int>>();

ParseLine signature:
private static void ParseLine(string recLine, IDictionary<string, IDictionary<string, int>> Region)

dump signature:
private static void Dump(IDictionary<string, IDictionary<string, int>> main_area)

also update the dump method:
foreach (string MainArea in main_area.Keys)
foreach (string Cluster in main_area[MainArea].Keys)

Console.WriteLine("There are {0} {1} named {2}", main_area[MainArea][Cluster], Cluster, MainArea);

Hope this helps :)
Christoph Keller 17-May-11 5:06am View
It seems that the edit form removed the "int" out of all IDictionary<string, int> textes, don't forget to add them properly.

Sorry for this.
Christoph Keller 17-May-11 4:56am View
If I understand you right, then the Dictionary<string, int=""> at the end is too much.

Use it this way:

static void Main(string[] args)
IDictionary<string, idictionary<string,="" int="">> Region = new Dictionary<string, idictionary<string,="" int="">>();
// Reading input text file
string dirFile = @"C:\temp\input.txt";
string recLine;
int recCounter = 0;
StreamReader srTable = new StreamReader(dirFile);
while ((recLine = srTable.ReadLine()) != null)
if (recCounter < 3)
ParseLine(recLine, Region);
private static void ParseLine(string recLine, IDictionary<string, idictionary<string,="" int="">> Region)
if (recLine.Trim() == String.Empty)
string main_area = recLine.Substring(0, 11).Trim();
string cluster = recLine.Substring(12, 11).Trim();
string excDays = recLine.Substring(24, 16).Trim();

// adding cluster type key
if (!Region.ContainsKey(main_area))
Region[main_area] = new Dictionary<string, int="">();
// adding cluster name key
if (!Region[main_area].ContainsKey(cluster))
Region[main_area][cluster] = 0;

// summing up total
if (Region[main_area].ContainsKey(cluster))
Region[main_area][cluster] += 1;
int excDays2 = Convert.ToInt32(excDays);
if (excDays2 < 2)
else if (excDays2 > 1 && excDays2 < 4)
else if (excDays2 > 3)
private static void Dump(IDictionary<string, idictionary<string,="" int="">> main_area)
foreach (string MainArea in main_area.Keys)
foreach (string Cluster in main_area[MainArea].Keys)

Console.WriteLine("There are {0} {1} named {2}", main_area[MainArea][Cluster], Cluster, MainArea);
Console.WriteLine("Total 24hrs: {0} ", T24);
Console.WriteLine("Total 3days: {0} ", T3);
Console.WriteLine("Total 4days: {0} ", T4);

is this working?

Best regards,
Christoph Keller 17-May-11 4:35am View
You're welcome :)
I realized this problem exactly after I posted the answer. So I updated the answer immediately:

if (!Region[main_area][cluster].ContainsKey(excDays))
Region[main_area][cluster][excDays] = 0;

then it should work.

Best regards and happy coding,
Christoph Keller 17-May-11 4:34am View

You're welcome :)
I realized this problem exactly after I posted the answer. So I updated the answer immediately:

if (!Region[main_area][cluster].ContainsKey(excDays))
Region[main_area][cluster][excDays] = 0;

then it should work.

Best regards and happy coding,
Christoph Keller 17-May-11 4:00am View
nice to know! My 5 :)
Christoph Keller 16-May-11 10:28am View
As I said in the comment before, I think you need to use an external component.
There are possibilities by using a WebBrowser control, but this is not working in ASP.NET (you would need to create a background worker process using the WebBrowser component).

I only see the following possibilities:
- Use a component that renders a website into a image (example:
- Use a PDF component which is capable of rendering HTML input / URL input (example:

If you use the above PDF component, you can get through this example: You can also test if the component is working with your HTML/CSS by using the trial version first (

Hope this helps and happy coding,
Christoph Keller 16-May-11 9:52am View

Until now, I never had a requirement to render a HTML into a image. Anway, I found the following component which is doing it for you:

Another way would be, that you directly use a PDF component which can render HTML content (or even directly renders a URL into a PDF):

Hope this helps.

Best regards,
Christoph Keller 5-May-11 3:29am View
I'm sorry, but I don't see why this should not work :(

One last try, have you allready tried to change the Framework version for example from 4.0 to 3.5 (in the properties page of your application)? Perhaps this would help in any way?

Sorry that my tips were not successfull... :(
Christoph Keller 4-May-11 5:21am View
Have you tried it this way:

Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition","attachment; filename=TheFileNameForTheClient.docx");
Response.TransmitFile( Server.MapPath("~/_generated/data.docx") );

You have to run the above code in a seperate handler (as I said, for example a .ashx handler). On your Save-Button, you just link to the URL, where the handler is lying (for example if your handler is here:, you create a donwload link which points to the URL /_service/GenerateDocument.ashx).
Christoph Keller 4-May-11 4:30am View
Was it working before? ;)
Christoph Keller 4-May-11 4:08am View
Can you explain where you get this error (is any code involved)?
Also is any recent change responsible for this error (what where the last things you did before the error occured)?
Did you allready tried to restart the machine?
Christoph Keller 4-May-11 3:17am View
I just found the following:
Delete all temporary ASP.NET files, by removing the folders under the following directory:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\

(The Windows directory may vary)

This is from

Perhaps this helps.
Christoph Keller 4-May-11 3:09am View
Thank you :)
Christoph Keller 20-Apr-11 0:48am View
Hi, could you post the exact JS error and perhaps any additional JS Frameworks you're using (for example mootools or JQuery)?

What exactly breaks after the Async refresh?
Christoph Keller 22-Mar-11 17:30pm View
Compensated too, see my explanation before ;)
Christoph Keller 22-Mar-11 16:57pm View
Please see my answer to John Simmons.

Thats completely true, I was focusing on the Substring of a Guid (which is less unique than a Guid self).

Sorry again for the confusion.
Christoph Keller 22-Mar-11 16:43pm View
I never said that a GUID is not unique, a GUID self is random for sure.

But what I mean is that if you Substring a Guid and shorten it, the possibility of duplicates is much higher.

O.k., I did not test your source (now I did and saw that no duplicates are generated), nor I did not see that you put it into a HashSet. Sorry for that. :)

I just saw the "Substring" and started to write ;)
So, sorry again!
Christoph Keller 22-Mar-11 10:46am View
SubString'ing a Guid would produce a lot of equal passwords, so this would not be a good solution (expecially if he want to generate 1000 PW's without any delay).

Just my 5 cents ;)
Christoph Keller 17-Mar-11 5:18am View
That's really an interesting thing! Thank you for pointing this out!! My 5! :)
Christoph Keller 14-Mar-11 11:55am View
You're welcome!
It is really the best way to start looking at a performance problem, I think. :)
Christoph Keller 14-Mar-11 11:07am View
Is it possible that this is a casing problem?
Try to .ToLower() the currentGroupName and write all cases in lower cases.

Also you could set a breakpoint at the switch-statement to see which groupName you got currently. Perhaps there you see what is going wrong.

Hope this helps.
Christoph Keller 14-Mar-11 8:34am View
You're welcome! Glad to hear that it may help :)
Christoph Keller 14-Mar-11 6:38am View
Hmm, this sounds strange... ;)
Perhaps the XDocument.Save() just resets the Response State, but this would be very strange...

Anyway, the essence is that you found the source of the problem and I hope you can do a workaround for this.

A good day to you too!

Christoph Keller 14-Mar-11 4:59am View
I have now tried it locally. Could you test the following code:

File SessionTest.cs

using System;
using System.Web;
using System.Web.SessionState;

namespace WebTest
public class SessionTest : IHttpHandler, IRequiresSessionState
public bool IsReusable
get { return false; }

public void ProcessRequest(HttpContext context)
context.Response.ContentType = "text/html";

context.Response.Write("Session Test<br />============<br /><br />TestVar Value:<br />");

context.Session["TestVar"] = DateTime.Now + " Hello World";

Entry in the Web.config:

<compilation debug="true" targetframework="4.0"></compilation>
<sessionstate mode="InProc"></sessionstate>
<add verb="*" path="*.test" type="WebTest.SessionTest"></add>

the .cs file must be in the web project, otherwise you have to set the assembly-name in the httpHandlers/add/type.

When I test this code, it fails the first time (true, because no data is in the session) and all additional requests write out the current DateTime and the text "Hello World".
Christoph Keller 14-Mar-11 3:45am View
Hi again,

Have you allready tried to just put a string or a int into the session and check if this would work?
How is your Game class defined, is it marked [Serializable] (required for objects which will be hold in the session / cache)?

Perhaps you could post the Game class in the answer (just the accessor definitions, code should not be required)?
Christoph Keller 14-Mar-11 3:36am View
You're welcome, glad to hear that I could help :)
Christoph Keller 11-Mar-11 7:13am View
Could you post the sessionState entry in your web.config, perhaps there is something wrong.

Also could you try just writing out the session id (Session.SessionId), is it changing on each request or is it permanently the same?
Christoph Keller 10-Mar-11 2:28am View
You're welcome, I'm happy that I was able to help.
Would love to read your article about the Response.Filter!