473,799 Members | 2,999 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to make an object instance available to all members of a page?

I have an instance of an object that needs to be accessed by all members of
a page like page_load, button_click events and so on. Where in the
codebehind would I put the creation of the object instance?

Jun 27 '08 #1
7 1310
VB or C#?

in C# it's called member variable.

class MyClass
{
int _iCounter = 0;
...page_Load(.. ..)
{
_iCounter = 0;
}
.... page_Render(... )
{
_iCounter = 5;
}
}

George.
"Andy B" <a_*****@sbcglo bal.netwrote in message
news:Oa******** ******@TK2MSFTN GP02.phx.gbl...
>I have an instance of an object that needs to be accessed by all members of
a page like page_load, button_click events and so on. Where in the
codebehind would I put the creation of the object instance?

Jun 27 '08 #2
You can create the object in the constructor, if you have enough
information. If this object is dynamic, you will have to go back to
something like PreInit.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

*************** *************** *************** ****
| Think outside the box!
|
*************** *************** *************** ****
"Andy B" <a_*****@sbcglo bal.netwrote in message
news:Oa******** ******@TK2MSFTN GP02.phx.gbl...
>I have an instance of an object that needs to be accessed by all members of
a page like page_load, button_click events and so on. Where in the
codebehind would I put the creation of the object instance?

Jun 27 '08 #3
It is dynamic in the sense that there is a wizard control feeding it all of
its values, otherise it is always there. This is done in c#. I tried all
sorts of things like putting it just in the page class, but the compiler
tells me that it doesn't like that idea. I keep getting some invalid token
problems or something. Here is the errors I get along with the page
codebehind.

Error 1 Invalid token '=' in class, struct, or interface member declaration
C:\Documents and Settings\Andy\M y Documents\Visua l Studio
2008\Projects\E ternityRecordsW ebsite\Main\Adm in\Contracts\St ock\Add.aspx.cs
18 26 Main
Error 2 Method must have a return type C:\Documents and Settings\Andy\M y
Documents\Visua l Studio
2008\Projects\E ternityRecordsW ebsite\Main\Adm in\Contracts\St ock\Add.aspx.cs
18 32 Main
Error 3 Invalid token '=' in class, struct, or interface member declaration
C:\Documents and Settings\Andy\M y Documents\Visua l Studio
2008\Projects\E ternityRecordsW ebsite\Main\Adm in\Contracts\St ock\Add.aspx.cs
19 27 Main
Error 4 Invalid token '(' in class, struct, or interface member declaration
C:\Documents and Settings\Andy\M y Documents\Visua l Studio
2008\Projects\E ternityRecordsW ebsite\Main\Adm in\Contracts\St ock\Add.aspx.cs
19 65 Main

using System;

using System.Collecti ons;

using System.Configur ation;

using System.Data;

using System.Linq;

using System.Web;

using System.Web.Secu rity;

using System.Web.UI;

using System.Web.UI.W ebControls;

using System.Web.UI.W ebControls.WebP arts;

using System.Web.UI.H tmlControls;

using System.Xml.Linq ;

using ContractService Provider.Contra ctModel;

namespace Main.Admin.Cont racts.Stock {

public partial class Add : System.Web.UI.P age {

Contract StockContract = new Contract();

StockContract.D ictionary = new ContractDiction ary();

StockContract.S ections = new ContractSection s<string, string>();
protected void Page_Load(objec t sender, EventArgs e) {

}

protected void AddStockContrac tWizard_ActiveS tepChanged1(obj ect sender,
EventArgs e) {

AddStockContrac tWizard.HeaderT ext = AddStockContrac tWizard.ActiveS tep.Title;

}

protected void AddDefinitionBu tton_Click(obje ct sender, EventArgs e) {

StockContract.D ictionary.Add(W ordTextBox.Text , DefinitionTextB ox.Text);

}

}

}

"Cowboy (Gregory A. Beamer)" <No************ @comcast.netNoS pamMwrote in
message news:OM******** ******@TK2MSFTN GP02.phx.gbl...
You can create the object in the constructor, if you have enough
information. If this object is dynamic, you will have to go back to
something like PreInit.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

*************** *************** *************** ****
| Think outside the box! |
*************** *************** *************** ****
"Andy B" <a_*****@sbcglo bal.netwrote in message
news:Oa******** ******@TK2MSFTN GP02.phx.gbl...
>>I have an instance of an object that needs to be accessed by all members
of a page like page_load, button_click events and so on. Where in the
codebehind would I put the creation of the object instance?


Jun 27 '08 #4
You have a problem in your code
Contract StockContract = new Contract(); -- correct
---incorrect-----
StockContract.D ictionary = new ContractDiction ary(); ---incorrect
StockContract.S ections = new ContractSection s<string,
tring>(); ---incorrect
---You can only declare variables here and set their default values.
StockContract.D ictionary = new ContractDiction ary();
is actually a code that needs to be moved to "code execution" portion of
your program. I.E method or constructor.
You need to move incorrect lines to constructor.
So it will be
public partial class Add : System.Web.UI.P age {
Contract StockContract = new Contract();

public Add ()
{
StockContract.D ictionary = new ContractDiction ary();
StockContract.S ections = new ContractSection s<string, string>();
}
.....
}
George.
"Andy B" <a_*****@sbcglo bal.netwrote in message
news:uw******** ******@TK2MSFTN GP06.phx.gbl...
It is dynamic in the sense that there is a wizard control feeding it all
of its values, otherise it is always there. This is done in c#. I tried
all sorts of things like putting it just in the page class, but the
compiler tells me that it doesn't like that idea. I keep getting some
invalid token problems or something. Here is the errors I get along with
the page codebehind.

Error 1 Invalid token '=' in class, struct, or interface member
declaration C:\Documents and Settings\Andy\M y Documents\Visua l Studio
2008\Projects\E ternityRecordsW ebsite\Main\Adm in\Contracts\St ock\Add.aspx.cs
18 26 Main
Error 2 Method must have a return type C:\Documents and Settings\Andy\M y
Documents\Visua l Studio
2008\Projects\E ternityRecordsW ebsite\Main\Adm in\Contracts\St ock\Add.aspx.cs
18 32 Main
Error 3 Invalid token '=' in class, struct, or interface member
declaration C:\Documents and Settings\Andy\M y Documents\Visua l Studio
2008\Projects\E ternityRecordsW ebsite\Main\Adm in\Contracts\St ock\Add.aspx.cs
19 27 Main
Error 4 Invalid token '(' in class, struct, or interface member
declaration C:\Documents and Settings\Andy\M y Documents\Visua l Studio
2008\Projects\E ternityRecordsW ebsite\Main\Adm in\Contracts\St ock\Add.aspx.cs
19 65 Main

using System;

using System.Collecti ons;

using System.Configur ation;

using System.Data;

using System.Linq;

using System.Web;

using System.Web.Secu rity;

using System.Web.UI;

using System.Web.UI.W ebControls;

using System.Web.UI.W ebControls.WebP arts;

using System.Web.UI.H tmlControls;

using System.Xml.Linq ;

using ContractService Provider.Contra ctModel;

namespace Main.Admin.Cont racts.Stock {

public partial class Add : System.Web.UI.P age {

Contract StockContract = new Contract();

StockContract.D ictionary = new ContractDiction ary();

StockContract.S ections = new ContractSection s<string, string>();
protected void Page_Load(objec t sender, EventArgs e) {

}

protected void AddStockContrac tWizard_ActiveS tepChanged1(obj ect sender,
EventArgs e) {

AddStockContrac tWizard.HeaderT ext =
AddStockContrac tWizard.ActiveS tep.Title;

}

protected void AddDefinitionBu tton_Click(obje ct sender, EventArgs e) {

StockContract.D ictionary.Add(W ordTextBox.Text , DefinitionTextB ox.Text);

}

}

}

"Cowboy (Gregory A. Beamer)" <No************ @comcast.netNoS pamMwrote in
message news:OM******** ******@TK2MSFTN GP02.phx.gbl...
>You can create the object in the constructor, if you have enough
information. If this object is dynamic, you will have to go back to
something like PreInit.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

************** *************** *************** *****
| Think outside the box! |
************** *************** *************** *****
"Andy B" <a_*****@sbcglo bal.netwrote in message
news:Oa******* *******@TK2MSFT NGP02.phx.gbl.. .
>>>I have an instance of an object that needs to be accessed by all members
of a page like page_load, button_click events and so on. Where in the
codebehind would I put the creation of the object instance?



Jun 27 '08 #5
At that rate, wouldn't it be even better to move the Contract StockContract
= new Contract() line to the constructer?
"George Ter-Saakov" <gt****@cardone .comwrote in message
news:e5******** ******@TK2MSFTN GP04.phx.gbl...
You have a problem in your code
Contract StockContract = new Contract(); -- correct
---incorrect-----
StockContract.D ictionary = new ContractDiction ary(); ---incorrect
StockContract.S ections = new ContractSection s<string,
ring>(); ---incorrect
---You can only declare variables here and set their default values.
StockContract.D ictionary = new ContractDiction ary();
is actually a code that needs to be moved to "code execution" portion of
your program. I.E method or constructor.
You need to move incorrect lines to constructor.
So it will be
public partial class Add : System.Web.UI.P age {
Contract StockContract = new Contract();

public Add ()
{
StockContract.D ictionary = new ContractDiction ary();
StockContract.S ections = new ContractSection s<string, string>();
}
....
}
George.
"Andy B" <a_*****@sbcglo bal.netwrote in message
news:uw******** ******@TK2MSFTN GP06.phx.gbl...
>It is dynamic in the sense that there is a wizard control feeding it all
of its values, otherise it is always there. This is done in c#. I tried
all sorts of things like putting it just in the page class, but the
compiler tells me that it doesn't like that idea. I keep getting some
invalid token problems or something. Here is the errors I get along with
the page codebehind.

Error 1 Invalid token '=' in class, struct, or interface member
declaration C:\Documents and Settings\Andy\M y Documents\Visua l Studio
2008\Projects\ EternityRecords Website\Main\Ad min\Contracts\S tock\Add.aspx.c s
18 26 Main
Error 2 Method must have a return type C:\Documents and Settings\Andy\M y
Documents\Visu al Studio
2008\Projects\ EternityRecords Website\Main\Ad min\Contracts\S tock\Add.aspx.c s
18 32 Main
Error 3 Invalid token '=' in class, struct, or interface member
declaration C:\Documents and Settings\Andy\M y Documents\Visua l Studio
2008\Projects\ EternityRecords Website\Main\Ad min\Contracts\S tock\Add.aspx.c s
19 27 Main
Error 4 Invalid token '(' in class, struct, or interface member
declaration C:\Documents and Settings\Andy\M y Documents\Visua l Studio
2008\Projects\ EternityRecords Website\Main\Ad min\Contracts\S tock\Add.aspx.c s
19 65 Main

using System;

using System.Collecti ons;

using System.Configur ation;

using System.Data;

using System.Linq;

using System.Web;

using System.Web.Secu rity;

using System.Web.UI;

using System.Web.UI.W ebControls;

using System.Web.UI.W ebControls.WebP arts;

using System.Web.UI.H tmlControls;

using System.Xml.Linq ;

using ContractService Provider.Contra ctModel;

namespace Main.Admin.Cont racts.Stock {

public partial class Add : System.Web.UI.P age {

Contract StockContract = new Contract();

StockContract. Dictionary = new ContractDiction ary();

StockContract. Sections = new ContractSection s<string, string>();
protected void Page_Load(objec t sender, EventArgs e) {

}

protected void AddStockContrac tWizard_ActiveS tepChanged1(obj ect sender,
EventArgs e) {

AddStockContra ctWizard.Header Text =
AddStockContra ctWizard.Active Step.Title;

}

protected void AddDefinitionBu tton_Click(obje ct sender, EventArgs e) {

StockContract. Dictionary.Add( WordTextBox.Tex t, DefinitionTextB ox.Text);

}

}

}

"Cowboy (Gregory A. Beamer)" <No************ @comcast.netNoS pamMwrote in
message news:OM******** ******@TK2MSFTN GP02.phx.gbl...
>>You can create the object in the constructor, if you have enough
information . If this object is dynamic, you will have to go back to
something like PreInit.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

************* *************** *************** ******
| Think outside the box! |
************* *************** *************** ******
"Andy B" <a_*****@sbcglo bal.netwrote in message
news:Oa****** ********@TK2MSF TNGP02.phx.gbl. ..
I have an instance of an object that needs to be accessed by all members
of a page like page_load, button_click events and so on. Where in the
codebehin d would I put the creation of the object instance?





Jun 27 '08 #6
Yes, and no....
Contract StockContract = new Contract()
This line defines a default value.

If you move it to constructor then default value will become null... So you
will lose some runtime because first compiler will assign null to
StockContract and only then execute constructor which will execute "new" and
override null.

Obviously assigning null is very fast and it becomes more theoretical than
practical concern :)

For example I always prefer to define my default values. So I always know
what to expect.

PS. You might have more than one constructor and then you forced to have
that line in every constructor. As opposed to just define it as a default
value once.
George.

"Andy B" <a_*****@sbcglo bal.netwrote in message
news:Om******** ******@TK2MSFTN GP02.phx.gbl...
At that rate, wouldn't it be even better to move the Contract
StockContract = new Contract() line to the constructer?
"George Ter-Saakov" <gt****@cardone .comwrote in message
news:e5******** ******@TK2MSFTN GP04.phx.gbl...
>You have a problem in your code
Contract StockContract = new Contract(); -- correct
---incorrect-----
StockContract. Dictionary = new ContractDiction ary(); ---incorrect
StockContract. Sections = new ContractSection s<string,
ing>(); ---incorrect
---You can only declare variables here and set their default values.
StockContract. Dictionary = new ContractDiction ary();
is actually a code that needs to be moved to "code execution" portion of
your program. I.E method or constructor.
You need to move incorrect lines to constructor.
So it will be
public partial class Add : System.Web.UI.P age {
Contract StockContract = new Contract();

public Add ()
{
StockContract.D ictionary = new ContractDiction ary();
StockContract.S ections = new ContractSection s<string, string>();
}
....
}
George.
"Andy B" <a_*****@sbcglo bal.netwrote in message
news:uw******* *******@TK2MSFT NGP06.phx.gbl.. .
>>It is dynamic in the sense that there is a wizard control feeding it all
of its values, otherise it is always there. This is done in c#. I tried
all sorts of things like putting it just in the page class, but the
compiler tells me that it doesn't like that idea. I keep getting some
invalid token problems or something. Here is the errors I get along with
the page codebehind.

Error 1 Invalid token '=' in class, struct, or interface member
declaration C:\Documents and Settings\Andy\M y Documents\Visua l Studio
2008\Projects \EternityRecord sWebsite\Main\A dmin\Contracts\ Stock\Add.aspx. cs
18 26 Main
Error 2 Method must have a return type C:\Documents and Settings\Andy\M y
Documents\Vis ual Studio
2008\Projects \EternityRecord sWebsite\Main\A dmin\Contracts\ Stock\Add.aspx. cs
18 32 Main
Error 3 Invalid token '=' in class, struct, or interface member
declaration C:\Documents and Settings\Andy\M y Documents\Visua l Studio
2008\Projects \EternityRecord sWebsite\Main\A dmin\Contracts\ Stock\Add.aspx. cs
19 27 Main
Error 4 Invalid token '(' in class, struct, or interface member
declaration C:\Documents and Settings\Andy\M y Documents\Visua l Studio
2008\Projects \EternityRecord sWebsite\Main\A dmin\Contracts\ Stock\Add.aspx. cs
19 65 Main

using System;

using System.Collecti ons;

using System.Configur ation;

using System.Data;

using System.Linq;

using System.Web;

using System.Web.Secu rity;

using System.Web.UI;

using System.Web.UI.W ebControls;

using System.Web.UI.W ebControls.WebP arts;

using System.Web.UI.H tmlControls;

using System.Xml.Linq ;

using ContractService Provider.Contra ctModel;

namespace Main.Admin.Cont racts.Stock {

public partial class Add : System.Web.UI.P age {

Contract StockContract = new Contract();

StockContract .Dictionary = new ContractDiction ary();

StockContract .Sections = new ContractSection s<string, string>();
protected void Page_Load(objec t sender, EventArgs e) {

}

protected void AddStockContrac tWizard_ActiveS tepChanged1(obj ect sender,
EventArgs e) {

AddStockContr actWizard.Heade rText =
AddStockContr actWizard.Activ eStep.Title;

}

protected void AddDefinitionBu tton_Click(obje ct sender, EventArgs e) {

StockContract .Dictionary.Add (WordTextBox.Te xt, DefinitionTextB ox.Text);

}

}

}

"Cowboy (Gregory A. Beamer)" <No************ @comcast.netNoS pamMwrote
in message news:OM******** ******@TK2MSFTN GP02.phx.gbl...
You can create the object in the constructor, if you have enough
informatio n. If this object is dynamic, you will have to go back to
something like PreInit.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

************ *************** *************** *******
| Think outside the box! |
************ *************** *************** *******
"Andy B" <a_*****@sbcglo bal.netwrote in message
news:Oa***** *********@TK2MS FTNGP02.phx.gbl ...
>I have an instance of an object that needs to be accessed by all
>members of a page like page_load, button_click events and so on. Where
>in the codebehind would I put the creation of the object instance?
>
>
>




Jun 27 '08 #7
This makes sense as far as having:
Contract StockContract = new Contract();

Being a default value. But if the above line is an assignment of a default
value, then why is the 2 lines below illegal outside of a constructer or
method? Don't they assign default values as well?

StockContract.D ictionary = new ContractDiction ary<string, string>();
StockContract.S ections = new ContractSection s<string, string();

I don't see much difference in the 3 lines unless the difference comes into
play because of the Dictionary/Sections properties. Is this the case? And if
Dictionary/Sections properties are assigned their values in a Button_Click
event, will those assigned properties be available inside of another method?
I.e. another button_Click event? In my original posted example, the
Dictionary property was assigned its values in a AddDictionaryBu tton_Click
event. Will they be available to the WizardFinishBut ton_Click event where
the whole StockContract object gets serialized into an xml file? or is there
other things that need to be done to make them available elsewhere?
"George Ter-Saakov" <gt****@cardone .comwrote in message
news:e3******** ******@TK2MSFTN GP03.phx.gbl...
Yes, and no....
Contract StockContract = new Contract()
This line defines a default value.

If you move it to constructor then default value will become null... So
you will lose some runtime because first compiler will assign null to
StockContract and only then execute constructor which will execute "new"
and override null.

Obviously assigning null is very fast and it becomes more theoretical than
practical concern :)

For example I always prefer to define my default values. So I always know
what to expect.

PS. You might have more than one constructor and then you forced to have
that line in every constructor. As opposed to just define it as a default
value once.
George.

"Andy B" <a_*****@sbcglo bal.netwrote in message
news:Om******** ******@TK2MSFTN GP02.phx.gbl...
>At that rate, wouldn't it be even better to move the Contract
StockContrac t = new Contract() line to the constructer?
"George Ter-Saakov" <gt****@cardone .comwrote in message
news:e5******* *******@TK2MSFT NGP04.phx.gbl.. .
>>You have a problem in your code
Contract StockContract = new Contract(); -- correct
---incorrect-----
StockContract .Dictionary = new ContractDiction ary(); ---incorrect
StockContract .Sections = new ContractSection s<string,
ng>(); ---incorrect
---You can only declare variables here and set their default values.
StockContract .Dictionary = new ContractDiction ary();
is actually a code that needs to be moved to "code execution" portion of
your program. I.E method or constructor.
You need to move incorrect lines to constructor.
So it will be
public partial class Add : System.Web.UI.P age {
Contract StockContract = new Contract();

public Add ()
{
StockContract.D ictionary = new ContractDiction ary();
StockContract.S ections = new ContractSection s<string, string>();
}
....
}
George.
"Andy B" <a_*****@sbcglo bal.netwrote in message
news:uw****** ********@TK2MSF TNGP06.phx.gbl. ..
It is dynamic in the sense that there is a wizard control feeding it
all of its values, otherise it is always there. This is done in c#. I
tried all sorts of things like putting it just in the page class, but
the compiler tells me that it doesn't like that idea. I keep getting
some invalid token problems or something. Here is the errors I get
along with the page codebehind.

Error 1 Invalid token '=' in class, struct, or interface member
declaratio n C:\Documents and Settings\Andy\M y Documents\Visua l Studio
2008\Project s\EternityRecor dsWebsite\Main\ Admin\Contracts \Stock\Add.aspx .cs
18 26 Main
Error 2 Method must have a return type C:\Documents and
Settings\And y\My Documents\Visua l Studio
2008\Project s\EternityRecor dsWebsite\Main\ Admin\Contracts \Stock\Add.aspx .cs
18 32 Main
Error 3 Invalid token '=' in class, struct, or interface member
declaratio n C:\Documents and Settings\Andy\M y Documents\Visua l Studio
2008\Project s\EternityRecor dsWebsite\Main\ Admin\Contracts \Stock\Add.aspx .cs
19 27 Main
Error 4 Invalid token '(' in class, struct, or interface member
declaratio n C:\Documents and Settings\Andy\M y Documents\Visua l Studio
2008\Project s\EternityRecor dsWebsite\Main\ Admin\Contracts \Stock\Add.aspx .cs
19 65 Main

using System;

using System.Collecti ons;

using System.Configur ation;

using System.Data;

using System.Linq;

using System.Web;

using System.Web.Secu rity;

using System.Web.UI;

using System.Web.UI.W ebControls;

using System.Web.UI.W ebControls.WebP arts;

using System.Web.UI.H tmlControls;

using System.Xml.Linq ;

using ContractService Provider.Contra ctModel;

namespace Main.Admin.Cont racts.Stock {

public partial class Add : System.Web.UI.P age {

Contract StockContract = new Contract();

StockContrac t.Dictionary = new ContractDiction ary();

StockContrac t.Sections = new ContractSection s<string, string>();
protected void Page_Load(objec t sender, EventArgs e) {

}

protected void AddStockContrac tWizard_ActiveS tepChanged1(obj ect sender,
EventArgs e) {

AddStockCont ractWizard.Head erText =
AddStockCont ractWizard.Acti veStep.Title;

}

protected void AddDefinitionBu tton_Click(obje ct sender, EventArgs e) {

StockContrac t.Dictionary.Ad d(WordTextBox.T ext, DefinitionTextB ox.Text);

}

}

}

"Cowboy (Gregory A. Beamer)" <No************ @comcast.netNoS pamMwrote
in message news:OM******** ******@TK2MSFTN GP02.phx.gbl...
You can create the object in the constructor, if you have enough
information . If this object is dynamic, you will have to go back to
something like PreInit.
>
--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA
>
Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss
>
or just read it:
http://gregorybeamer.spaces.live.com/
>
*********** *************** *************** ********
| Think outside the box! |
*********** *************** *************** ********
"Andy B" <a_*****@sbcglo bal.netwrote in message
news:Oa**** **********@TK2M SFTNGP02.phx.gb l...
>>I have an instance of an object that needs to be accessed by all
>>members of a page like page_load, button_click events and so on. Where
>>in the codebehind would I put the creation of the object instance?
>>
>>
>>
>
>




Jun 27 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1483
by: Rob Long | last post by:
Hey I'm building a webapp with tons of objects all over the place, a lot of which are quite complex, meaning they could have many subclasses and many nested object members. I'm implementing a memory caching mechanism to store these objects between requests and share them between different user sessions. In order for my memory caching mechanism to work, objects must be serialised before they are placed into the cache. In PHP5, this
28
20348
by: Daniel | last post by:
Hello =) I have an object which contains a method that should execute every x ms. I can use setInterval inside the object construct like this - self.setInterval('ObjectName.methodName()', this.pinginterval); - but is there no way to do this without using the literal ObjectName? If I write 'this.methodName()' I get "Line 1 Char 1: Object doesn't support this property or method." in IE, and nothing happens in Firebird.
11
2207
by: Vani Murarka | last post by:
Hi Everyone, Does .NET offer any collection class which will give me objects last *accessed* such that I may build a least-recently-used cache that kills off objects that haven't been used for awhile? Or is there any other way to implement this kind of a cache / collection where one can do this kind of cleanup based on least-recently-used objects?
6
22539
by: Martin | last post by:
I'd like to be able to get the name of an object instance from within a call to a method of that same object. Is this at all possible? The example below works by passing in the name of the object instance (in this case 'myDog'). Of course it would be better if I could somehow know from within write() that the name of the object instance was 'myDog' without having to pass it as a parameter. //////////////////////////////// function...
4
1887
by: Luke Matuszewski | last post by:
Here are some questions that i am interested about and wanted to here an explanation/discussion: 1. (general) Is the objectness in JavaScript was supported from the very first version of it (in browsers) ? What about the new syntax of creating a object using { 'propName1':'propValue1', 'propName2':'propValue2', 'propName3':{ /* another object */ } } - from what version of JScript/JavaScript it was supported (from what browsers versions) ?...
11
3846
by: Kevin Prichard | last post by:
Hi all, I've recently been following the object-oriented techiques discussed here and have been testing them for use in a web application. There is problem that I'd like to discuss with you experts. I would like to produce Javascript classes that can be "subclassed" with certain behaviors defined at subclass time. There are plenty of ways to do this through prototyping and other techniques, but these behaviors need to be static and...
8
2023
by: a | last post by:
I'm trying to save data from a custom object into the profile object, but it is not structured the way that I want. I'm trying to get the custom object to serialize as xml to a Profile object like so: <Teachers> <Teacher> <Classes> <Class>
0
1837
by: a | last post by:
I need to create an instance of a custom object 'School.Teacher' and use it in a Profile object. I'm developing a bad case of "Pretzel Logic" thinking about this. Filling the custom object 'School.Teacher' as an ArrayList creates the proper information (see aspx code below), but I'm unable to use this ArrayList in the Profile object. The aspx code below shows the attempt and error message.
6
1887
by: burningodzilla | last post by:
Hi all - I'm preparing to dive in to more complex application development using javascript, and among other things, I'm having a hard time wrapping my head around an issues regarding "inheritance" using the prototype property. I realize there are no classes in JS, that code therefore lives in objects instead of class definitions, and that "inheritance" must be achieved prototypically and not classically. That said, on with the code. Say I...
0
9688
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9546
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10268
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10031
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9079
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7571
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6809
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5593
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.