|
Don't Cross Post.
Regards,
Satips.
|
|
|
|
|
Man, you fired that question off three times in three different forums. And you missed putting it in the obvious one - the SQL Forum.
|
|
|
|
|
Hi, I have a web site and store DB in it, I want to created window application to access those DB, Can i?
One thing with my window application can i get how many user one my web site?
Socheat
|
|
|
|
|
A web site and a database server are two differnt things, having your site live doesn't mean your database can be connected to, via the web ( thank goodness ). The logical thing to do here is to write a web service, which has methods to access the DB, and one to return a user count, if you want it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I don't understand what you mean, can you clearify my question?
Socheat
|
|
|
|
|
I can clarify my answer - having a web site that is live, doesn't in any way expose any database that may be in use on that web site. You need a web service to do that, with methods that call the database.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
So, can you give me an example?
Socheat
|
|
|
|
|
Hi guys.
My company just bought and installed Share Point. I hope someone has/had experience with Share Point and can point me to the right direction. I just need some guidance for development.
As a .NET developer I need to know how do I create and integrate my applications (we have bunch of them (that I built) which are used by different departments within the company. For example: We will use Share Point as Intranet (calendars, documents, project flows, etc) so how do I create and integrate custom made application into Share Point Intranet? I have never used Share Point but heard some things about it (easy to use, great value, etc.) so please understand my confusion and forgive me if I ask stupid questions?
Any books, links, examples will be greatly appreciated.
Thanks a lot.
|
|
|
|
|
Hi,
I'm using the invoke method on some reflection, and don't really understand what I'm passing into the function.
My function passes an object reference which needs to be passed down into the reflected assembly.
The assembly then creates an object and then passes a reference back to this newly created object through the passed in object "ConfigObj"
<br />
Public Sub ShowConfig(ByRef ConfigObj As Object)<br />
<br />
' ShowConfig() function inside my plugin takes in 1 argument, <br />
' the reference to an (config) 'object'<br />
<br />
' Create args array for the invoke() function, <br />
' containing our reference<br />
Dim args = New Object() {ConfigObj}<br />
<br />
' display the Config window <br />
' wait for it to close <br />
pShowConfig.Invoke(tsInterfaceObj, args)<br />
<br />
' all done. ConfigObj now points to something interesting<br />
<br />
' actually we're not, args(0) contains the object <br />
' we want, not ConfigObj. Therefore make sure<br />
' ConfigObj is the correct reference is given back<br />
ConfigObj = args(0)<br />
<br />
' Mmm, this now works!<br />
<br />
End Sub<br />
I *thought* that if I set args to contain my passed in ConfigObj object, when passing that down into the pShowConfig methodinfo, it would return insided the ConfigObj object passed down (inside the args() array)
BUT
I'm finding that after the .Invoke() method, ConfigObj still references Nothing, but args(0) references the object which is being passed back. Therefore I'm needing to copy the args(0) reference into my ConfigObj variable.
It looks like when I perform the args = {} line, it just create a completely new object, with objects in the array OF TYPES of ConfigObj (Object Type), and not a reference to my ConfigObj Object passed in.
Is this correct?
It doesn't "feel" right....?
any points on this?
This is fundamental stuff, which I'm not getting
Thanks for your help,
Phil.
|
|
|
|
|
twista wrote:
It looks like when I perform the args = {} line, it just create a completely new object, with objects in the array OF TYPES of ConfigObj (Object Type), and not a reference to my ConfigObj Object passed in.
Is this correct?
Not at all. It creates an array of references to Object with the size of one, and populates it with a reference to ConfigObj.
The method that you are calling is simply not populating the object that you are passing in, it creates a new object and returns it.
---
single minded; short sighted; long gone;
|
|
|
|
|
I try to not post many questions here (Google is a programmers best friend) but I thought I might get a better answer here than from a Google search. Here's what I'm trying to do: I have a process (a bulk insert into a SQL 2000 table) where ti could literally insert up to 65,000 rows (depending on how many people we are traveling in any given travel year) and I'm wanting to show some kind of progress meter to the user so they don't think the application's just froze up.
Anyone got any ideas on what is the best process for implementing something like this?
"Okay, I give up: which is NOT a real programming language????"
Michael Bergman
"Well yes, it is an Integer, but it's a metrosexual Integer. For all we know, under all that hair gel it could be a Boolean."
Tom Welch
"Let's face it, the average computer user has the brain of a Spider Monkey."
Bill Gates
|
|
|
|
|
are you inserting while in a loop or are you doing an insert into from a select statement? if the 2nd choice, then it would make it shard to show progress...
|
|
|
|
|
There's really no way you can track progress, unfortunately, as you're tracking an atomic process in another program.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Psycho-*Coder*-Extreme wrote: could literally insert up to 65,000 rows
Are you Inserting from within a loop? Or Are you using a Stored Procedure? Please make it clear..
Anyway, if you are doing the DML inside the loop, then there sure is a chance
The name is Sandeep
|
|
|
|
|
Iam using a Stored Procedure, but it is an INSERT INTO....SELECT FROM Stored Procedure.
"Okay, I give up: which is NOT a real programming language????"
Michael Bergman
|
|
|
|
|
Hi,
Usually I used image animation like windows when copying file.
GoodID
|
|
|
|
|
I am using the DataGridView unbound but now I have need to present boolean information to the user with the DataGridViewCheckBox class. Normally I format a DataTable and populate a datarow into that table like thus as below, but when I add the DataGridViewCheckBoxColum in, I cannot populate the DataTable it has to be inseerted into the grid itself. Any help would be appreciated.
Dim column As New DataGridViewCheckBoxColumn(), rDesc As New DataColumn(), tb as New DataTable
With rDesc
.DataType = System.Type.GetType("System.String")
.ColumnName = "Description"
.Caption = "Description"
.ReadOnly = True
End With
Me.tb.Columns.Add(rDesc)
//Problem Area
With column
.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells
.FlatStyle = FlatStyle.Standard
.CellTemplate = New DataGridViewCheckBoxCell()
.CellTemplate.Style.BackColor = Color.Beige
End With
DataGridView1.Columns.Insert(0, column)
Me.DataGridView1.DataSource = tb
Dim r As DataRow
r = tb.NewRow()
r(0) = "hello"
tb.Rows.Add(r)
"I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones."
Einstein
|
|
|
|
|
I can't seem to dispose of a singleton object that my web page has created. Here is the class code:
Public Class Class1
Implements IDisposable
Private Shared myInst As Class1
Private Shared myMutex As New System.Threading.Mutex
Public Shared myVal As Integer
Private Shadows disposed As Boolean
Public Shared Function GetInstance() As Class1
myMutex.WaitOne()
If myInst Is Nothing Then
myInst = New Class1
End If
myMutex.ReleaseMutex()
myInst.myVal += 1
Return myInst
End Function
Public Sub Dispose() Implements IDisposable.Dispose
If Not disposed Then
disposed = True
GC.SuppressFinalize(Me)
End If
End Sub
Public Shared Sub DisposeIt(ByVal Cls1 As Class1)
Cls1.Dispose()
End Sub
End Class
In my web form, I have this code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myclass1 As Class1 = Class1.GetInstance
Class1.DisposeIt(myclass1)
Response.Write(myclass1.myVal)
End Sub
When I run this program, the object will be created and myVal will be incremented every time the program is run, whether I close the browser beforehand or not. In other words, the "Class1.DisposeIt(myclass1)" statement simply doesn't dispose of the object in memory. I am trying to understand singleton objects and disposing of them, but I am missing some critical concept here. Any help would truly be appreciated.
|
|
|
|
|
You have misunderstood the meaning of disposal. To call the Dispose method doesn't remove the object from memory, it's just used to tell the object to prepare for removal. As long as you are holding on to the reference to the object, it will not be garbage collected. As you are not really doing anything in the Dispose method, the object will keep working eventhough Dispose is called repeatedly.
If you want the object to be released, you have to set the reference to Nothing. Then a new object will be created the next time GetInstance is called.
If your object will not contain any unmanaged resources, there is no reason to use the IDisposable interface at all. Just set the reference to Nothing, and the garbage collector will take care of it.
---
single minded; short sighted; long gone;
|
|
|
|
|
Thanks Guffa, and what you say about setting the reference to Nothing was my original understanding, but it didn't seem to work, which lead to my wrong path down the Dispose lane. Here was my original code from my calling program:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myclass1 As Class1 = Class1.GetInstance
Response.Write(myclass1.myVal)
myclass1 = Nothing
End Sub
Now, when a person opens his browser, he will see the value "1" displayed on his screen. Open another browser instance, and he will see "2", and so on. Even though the reference was set to nothing, the second browser instance will use the shared value from the object that is supposed to be Nothing. Ok, I can't tell when the garbage collector would have released it from memory, but it seems to me that the second browser instance shouldn't have access to it anyway. So, I am still seem to be stuck with this thing hanging out in memory.
By the way, excuse me, but I think I may have posted this question to the wrong discussion group since this has a bit of a web orientation, but perhaps it applies to workstation applications too.
|
|
|
|
|
If your code in Class1.GetInstance() is the same as per your first posting then the reference is being maintained by - Private Shared myInst As Class1 - which will persist as long as the appdomain (process, more or less) does.
Setting a reference to an instance of an object on the heap to nothing only clears that reference. As long as the number of references to a heap object is greater then zero the GC can't collect it.
If each request needs a new object I'm not sure why you are trying to use a singleton approach?
If you only want one per runtime then just call GetInstance() and don't worry about removing it.
If you do need to remove it once in a while, write a method like ...
Public Shared Sub ReleaseInstance()
myInst = Nothing
End Sub
... and call that.
------------------------------------------------
I'm largely language agnostic -
After a while they all bug me
------------------------------------------------
|
|
|
|
|
Thanks MidwestLimey, but that doesn't work either. Here is the class now:
Public Class Class1
Private Shared myInst As Class1
Private Shared myMutex As New System.Threading.Mutex
Public Shared myVal As Integer
Private Shadows disposed As Boolean
Public Shared Function GetInstance() As Class1
myMutex.WaitOne()
If myInst Is Nothing Then
myInst = New Class1
End If
myMutex.ReleaseMutex()
myInst.myVal += 1
Return myInst
End Function
Public Shared Sub ReleaseInstance()
myInst = Nothing
End Sub
End Class
Here is the calling code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myclass1 As Class1 = Class1.GetInstance
Response.Write(myclass1.myVal)
Class1.ReleaseInstance()
End Sub
Again, if I open this web page, it should kill the object, making any shared variables not accessible to another page that is opened. But, if I open another page, I will see "2" displayed, meaning that it incremented the value from the killed object. I can close all web pages, wait an hour, and if I start another page, I will then see the value "3" displayed. It just stays out there!
I am experimenting with this because I do want a single object in memory, which is to be shared among web pages, but I do want to be able to control when it is disposed of.
|
|
|
|
|
You never decrement myVal that I can see...
A good way to determine if instances are different is via object.GetHashCode()
------------------------------------------------
I'm largely language agnostic -
After a while they all bug me
------------------------------------------------
|
|
|
|
|
It is true that myVal is never decremented or set to Nothing. Does it need to be? It is a public shared variable within Class1. Shouldn't it be that if the Class1 instance is set to Nothing, then all variables within that class are automatically set to Nothing, even if they are shared?
|
|
|
|
|
Nope. It might help to think of shared fields/methods etc as existing in a separate class that is by default a singleton.
Shared fields exist on this singleton object that is created once and only once per appdomain (an appdomain is a subsection of a process - can be considered synonymous with process for most situations). This singleton object is referenced via the class name i.e. Class1.fieldY or Class1.methodX() and is available anywhere in the appdomain, accessors (public, friend etc) permitting.
Any values set will persist until the appdomain is unloaded. In this case myVal will continue to increase with every call to GetInstance() until IIS is restarted.
You can create and destroy as many Class1 instances as you wish, it will have no bearing on the shared fields defined in Class1.
To determine if the current instance of Class1 is the same as the last, call cls1.GetHashCode() where cls1 is an instance of Class1. If the values are different then you have different instances.
------------------------------------------------
I'm largely language agnostic -
After a while they all bug me
------------------------------------------------
|
|
|
|
|