|
I use .Net's on the fly compile in for web-apps. I'm seeking to reducing the number of web-app restarts.
If I have a general ClassName.cs file in the web-app App_Code folder and I change code in that file, the whole web-app will restart, and this causes current web sessions to become invalid.
Keep in mind that this general ClassName.cs file has code that is only used on specific pages, not throughout the whole web-app.
So, I take that class and put it into the code-behind of a user-control; I call this a User Control Embedded Class, or UCEC. When I update code in the embedded class, only those pages to which the User Control has been added are recompiled on the fly versus the whole web-app, which results in a web-app restart / lost sessions.
I do understand what MVC and MVP provide, and even in those patterns I use UCECs.
ASPX ~ Apple Simply Performs eXcellently
|
|
|
|
|
How can I tell my program to run under every system-setting with the NumberFormat of "en-US"?
I used this for a part of my project, but I am sure there is a way to tell the program once the "right" format and to use it then by default in the whole program.
Globalization::CultureInfo^ culture = gcnew Globalization::CultureInfo( "en-US",false );
Globalization::NumberFormatInfo^ format = culture->NumberFormat;
double value = Double::Parse(stringValue, format);
|
|
|
|
|
You can set the culture on the current thread:
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", false);
|
|
|
|
|
Thank you!
That's exactly what I was looking for.
|
|
|
|
|
I made class called LinqFilter
public class LinqFilter<t>
{
.......
}</t>
and I made a user control
public class lablab : usercontrol
{
linqFilter<[here i want to not put exact class but i want to still make it generic] > koko;
}
and i want to specifiy the [T] at runtime can I Do that
OR
can I Get the T from Parameter come from outside the usercontrol
I tryid this code but i get an error
public class lablab<z> : usercontrol
{
linqFilter<z> koko;
}
thanks a lot
You have To Search About The Truth Of Your Life
Why Are you Here In Life ?
modified on Monday, February 9, 2009 12:25 AM
|
|
|
|
|
You can't. Generics are (IIRC) really just syntaxic sugar that tells the compiler to write code for each Type you specify in the Generic. Say you pass two different types of objects to a Generic method. The compiler automatically writes two methods, using your code as a template, to handle both cases of those objects passed to it. Types used by Generics are determined at compile-time, not run-time.
|
|
|
|
|
Generic reference types are more than syntactic sugar; the compiler only has to produce one JIT-compiled instance of a method that uses a generic reference type, but the method can produce objects which are 'ready to go' in the desired type without the expense of a typecast or other run-time validation. I know of no way such a result could be achieved without generics.
There are limits to what generics can do, but they seem to be a very useful feature with significant semantic meaning. Extension methods, by contrast, seem more like syntactic sugar.
|
|
|
|
|
thanks a lot for your replay and explanation
but could you tell me how can I use the second choice
I mean how to make the user control accept T as Template
something like this :
public class kokoControl<t> : UserControl
{
.....
}
</t>
You have To Search About The Truth Of Your Life
Why Are you Here In Life ?
|
|
|
|
|
What are you ultimately trying to do with this??
|
|
|
|
|
ok I'm sorry my replay was not complete .
i will tell you the full story
I made generic class that can make DynamicLinq For any class
this class is
public class LinqFilter<T>
{
some of :
public Fun<T,bool> GetFilter()
{
Expression Filter ;
Filter = Expression.And(.....)
..............................
var predicate = Expression.Lambda. .... .
return (Func<T,bool> )predicate.Compile();
}
}
the previous class work well I want to use it inside
a user control called FilterControl
but I want to make the control also as a Generic Class
just to pass the T inside the control
public Class FilterControl<T> : UserControl
{
LinqFilter<T> F;
................
}
but I got an error when tried to do that
how can I pass the T from outside the control to the
[F] Variable of linqfilter .
thanks
You have To Search About The Truth Of Your Life
Why Are you Here In Life ?
|
|
|
|
|
So I fired up Snippet Compiler[^], added System.Core.dll as a reference, and wrote this little snippet of code:
public class Base<t>
{
public Func<t,> GetFilter()
{
return delegate(T t) { return true; };
}
}
public class BaseCotnrol<t> : UserControl
{
Base<t> foo;
}</t></t></t>
It compiled just fine. Could you post the compiler error?
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
first , thanks a lot for your replay
I thought that I will not get the answer !!
I will try that but could you explain more what should this code do ?
You have To Search About The Truth Of Your Life
Why Are you Here In Life ?
|
|
|
|
|
My code doesn't really do anything. &l;smile /> I just wrote some code that looked like your code to make sure that it compiles.
It compiled.
Unfortunately, that just means that I don't understand the nature of your question. Can you post something more indicative of your plight?
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
I will explain
I made this class
public class LinqFilter<T>
{
public Fun<T,bool> GetFilter()
{
var predicate = Expression.Lambda. .... .
return (Func<T,bool> )predicate.Compile();
}
}
there is a user control called FilterControl
I need to use object of previous class [LinqFilter]
inside this control but I want to get The [T]
Type from out side the user control
the following code make compiler error
when i put <T> in User Control definition
public Class FilterControl<font color="red"><T></font> : UserControl
{
LinqFilter<T> F;
................
}
I hope to not give me joking code again
thanks
You have To Search About The Truth Of Your Life
Why Are you Here In Life ?
|
|
|
|
|
When you write that you "want to get the [T] Type from out side the user control", what do you mean by that? Do you mean that you want to bind T at runtime rather than at compile time? Something like the following pseudocode?
t <- assign some resolved Type
create an instance of FilterControl<t> dynamically and bind t to T
put the instance of FilterControl`1 on your form</t>
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
What I need is :
When I put the FilterControl in the window , I want to specify the T Type
I mean in Compile Time in this way the control will be able to
make filtering on objects of any T class with support from LinqFilter class
You have To Search About The Truth Of Your Life
Why Are you Here In Life ?
|
|
|
|
|
Ah ha! Now I understand. The Visual Studio designers do not support controls with unbound generic parameters. You can't create your FilterControl<T> : UserControl and then use the forms designer to drag it onto a panel or form.
You might be able to adapt a TypeDescriptor for the user control for your forms, though I've never seen this done. There's an article on Urban Potato that does this for controls with abstract base classes: Using Visual Studio Whidbey to Design Abstract Forms[^].
|
|
|
|
|
thanks a lot I will read this article ( in sha'a allah)
and I hope to find what I want
Thanks very match
You have To Search About The Truth Of Your Life
Why Are you Here In Life ?
|
|
|
|
|
If you find or develop something interesting, then don't forget to come back and post a solution so that we all can learn!
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Okay my friend
You have To Search About The Truth Of Your Life
Why Are you Here In Life ?
|
|
|
|
|
Hi all,
I have the following problem:
We have a Sharepoint system which is being used to present Reporting Server content from a Cube based MSQL Database. All works fine so long as we use Kerberos authentication for both the Sharepoint login and for the Report Data Source. The problem is that the database contains not only data, but also the access rights to the content. It is therefore important that the content be collected as the user logged in (and not using a general admin account).
OK - so where is the problem?
We will be using Form Based Authentication for Sharepoint. In detail we are using a Single Sign-On product (Entrust GetAccess) which provides Sharepoint with the username of the user. The password is however not provided (company policy etc. and for PKI and Grid card based logins this is also not available). Our problem is how to authenticate to the Cube Database with a user but not having their credentials (just their username).
My idea was to create a new "Custom Data Processing Extension" which inherits from the standard "Microsoft SQL Server Analysis Services" passing through all of the standard functions. The connect method I would overwrite with my own code which then "magically" logs the user into the Database using their username and a secret password known only to the Extension and the Database.
Ok - That is the theory, but to be honest with you - I have not been able to find much help on how to exactly go about this.
My questions:
1: I am going about this the write way - or is their an easier way to do this?
2: Is there a way to "impersonate" the user? Login as an administrator and then "switch" to the users context in the DB? This would save me setting all of the users passwords to a secret value.
3: Does anyone have any code examples or links which would help me to get startet?
Hope someone can help,
Simon
PS: The Form Based Login to Sharepoint was not difficult to solve which gives me hope that we will find a solution for the next problem .
|
|
|
|
|
I am using Microsoft Visual Studion 2008 and is coding in C++. We are using threads where two threads are waiting for another thread to setevent. One of the thread which waits is an RPC thread. Now the interesting situation is wen the third thread sets the event. If its the the RPC thread which comes out of the wait first, the other thread never comes out of wait. Is it some problem with RPC threads ? Plz update me on the same..
thanks & Regards,
skmc
|
|
|
|
|
skmckkie wrote: Is it some problem with RPC threads ?
I never heard about RPC thread. Do you mean your thread does RPC? Your question is not clear. Please post relevant code and explain your issues clearly.
|
|
|
|
|
I guess the threads are waiting on an auto-reset event.
Try it with a manual reset event.
«_Superman_»
|
|
|
|
|
I am developing multilingual application.
Font size for fields is 9.
It gives preview & print perfectly.
But, when i am exporting report to word. it resets font size to 12(for Hindi & Gujarati Font).
Also, when i am exporting report to PDF, it doesn't show Hindi & Gujarati Data.
I have checked same issue with 8,10,11 size font also, it always resets to 12.
|
|
|
|