application variable vs static variables
i have some lookup values that will not change frequently, so i thaught of storing it in the application scope or in a static variable of a class and use it. i am sure that this value will not change at all. so which method i can use to improve the performance ie hitting the DB has to be reduced. I know if i store in the application scope the value will be loaded only once and until we reset the iis the value will be in the memory. but how abt static variables? when it will be loaded in to memory and how frequent it will be destroyed?
in short, which method to use and why?
Thank ...Shared Variable VS Instance Variable
I am a newbie to Powerbuilder. I have a question on the terms of Shared
Variable and Instance Variable. What are they? What's the difference between
I have already looked for them in books and the Internet, but due to a lack
of examples, I can't figure them out clearly.
Please kindly advise me if possible. Thanks for you kind attention.
An instance variable and a shared variable turn out to be the same *unless*
you open multiple instances of your window, say w_1.
So, suppose you have an instance window called w_1, with...Application vs shared vs cached
I need an application level hashtable. This is to prevent two sessions with the same userid from accessing the web application.
Should I do this in Global.asax:Public Shared fgh As Hashtable = New Hashtable()or this:Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
Application("cde") = New Hashtable()
End Subor this:Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
HttpRuntime.Cache("abc") = New Hashtable()
If the cache method is better, should I still use SyncLock ( I thought the cache o...variable variables?
How to make a variable receive an increment in the name?
I want to do it for example:
Label1->Caption = "1";
Label2->Caption = "2";
Label3->Caption = "3";
Label4->Caption = "4";
And I want to do something like that:
for (i=1; i<5; i++)
Label+i->Caption = i;
Any idea? Can I do something like that?
Thanks and regards
Create a vector of pointers to the various objects.
In your case below, construct a vector (called Labels) of pointers to TLable
long enough to hold pointers to...variable not a variable
Error:Must declare the variable '@cartDateTime'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Must declare the variable '@cartDateTime'.
Dim connStr As SqlConnection Dim cmdInsert As SqlCommand Dim strInsert As String &n...variable of variables
Say I have 2 scenarios and I want to use a different
variable depending on which scenario applies without coding
So I could have a database table t_variables which has:
In my Powerbuilder code I'd have values in v_name &
What I'd like to be able to do is to select which variable
to use from the table and assign that to something, e.g.
where scenario = 1
so at this point v_variable would be 'v_name'...Variable Variables
Maybe the solution is very simple, but how do I create variable variables in vb.net? I want to use the value of a variable as a part of the name of another variable. A very simple example below:
Dim a As String
a = "1"
Label a.Text = "hi"
<asp:Label id="Label1" runat="server">Label</asp:Label>
In need this to change a range of values by using just one loop. I can´t do that without creating a variable variable name.
check out this little demo application I created for you:
...Global Variables vs. instance variables declared at application object level
There is only one application object instance during the application runtime
that is instantiated at the start along with the global variables, so I am
looking for what are the major differences, advantages , and disadvantages
between Global Variables and instance variables declared for the application
I've wondered also about the application instance variables.
I think the difference with global vars is very subtle. Maybe too subtle to
be of any use.
Anyway, you shouldn't be using either one of them :-)
Geert 'Darling' Van Damme
Moh...Public Properties with private variables versus public variables
I'm an experienced windows developer, new to web technologies and asp.net, and I see a lot of code in asp.net using public variables, and my first reaction is "yuck!". Is this a normal best practice b/c web apps need the performance advantage? I always expose public properties (getters/setters) that reference private variables, but a more experienced web developer said that was too inefficient, and he said to use public variables.
Thanks, and I would welcome any suggestions/references for best practices in asp.net, particularly referencing OOP practices.
Well, from my expe...shared variable or session variable???
I've asked this question on a couple of different forums and usenet and noone has offered a reply, so I thought I'd try it here...
I have 2 different web apps that happen to do almost exactly the same things. One I did many months ago and the other is very recent. In both cases, I had data that needed to be available throughout all the functions of the page. Looking at the code, I noticed that in the older one I used a shared variable (woud be static in c#) to hold the needed data. In the newer app, I simply used a session variable. The data itself is a dataTable.
My question is:...another Application starting
Please have a look at the following log my application has made:
9:33:38Application Starting (Application_Start)
9:33:38Application variable 'server' is really null
9:33:39Session Starting (Session_Start)
9:37:12Application Starting (Application_Start)
9:37:12Application variable 'server' is really null
9:37:12Session Starting (Session_Start)
So the question is how is it ever possible that another instance of my web application is starting after 5 min when I have session timeout set to 30 min? I have problem with that because in each case the application creates ne...Use of Application Variable and Session Variable
please someone tell me when should a Application variable be used and in what conditions a session variable should be used?
As the name of the variables suggest, an Application variable is suitable when the value of this variable should be available to all users of your application from the point the Application is started for the first time. A Session variable, on the other hand, may be different for different users and only exists for the duration of a users visit to your application or until it times out.
Hth.RegardsAndre Colbiornsen ----------------...shared variable versus global variable
I plan to implement a little timer service
for a certain window class to synchronize
some actions between all instances of
this class. For some reasons I want to
avoid the declaration of a global variable.
Now I think about the usage of a shared
variable for the service in this window class.
In the open event I would check if the
shared variable is already instantiated and
create the service if necessary. On close
of the last window of the class the service
should be destroyed from the garbage collector.
Do you think that this will work?
Thanks for hints
Chris Wern...Passing variables vs session variable
what is the advantage of passing the variable in the url vs storing the variable in a session variable and retrieving it in the second webpage you are accessing?
The variable that you will pass using the QueryString will be visible to the user hence not secured. The value that you put in the Session is not available to the user as it is on the server side and hence more secured. HighOnCodingWanna get high!
performance wise does it matter?
Just my 2 cents...
I remember in college the professors would always harp upon using the Session responsibly. Most of the professors were old...global variable vs local variable
i have a scenario like function is called more than 1000 times.in that function i declared a varible and assigning a value .i felt like declare a global varible use it in that function and assign value.which is best.please tell me in performance point of view.
thanks in advance
Hai Good Morning you have call the function more than 1000 times Better use Global variables, so you can call the function, anywhere.. it has good performance.suppose it you want assign different values to the variables , whenever the function has been called for that use local ...