|
Hi Friends,
This is Aruna.I am working on .Net.I want to know something about SCP(Secure Copy Protocol).Past i am using FTP for file trasfer from one system to another system.Now i have to run with SCP .I don't know how to run that tool. Please How to run SCP with SSH in Windows Application.Can you give the suggestion to do this application.I am WindowsXp.
Aruna.K
|
|
|
|
|
You're going to have to find a 3rd party library that handles this for you, such as this[^]. The .NET BCL doesn't have any support for this built in.
|
|
|
|
|
Hi,
I've narrowed down a memory leak in my application to a single Sub, however, I can't figure out what's doing it. Whenever this Sub is called (SelectedIndexChanged), my memory usage grows by ~100 kb and doesn't go down, according to Task Manager.
Here's my code:
Note:
The following names are Global Variables:
appSelPath
appSelName
appSelAlt
appSelPos
appSelID
canEnable
beenFound
And yes, I need all of these variables as they are used in many other methods within my application.
<br />
Dim selectedText As String = ""<br />
If lbApps.SelectedItems.Count = 1 Then<br />
btnLaunch.Enabled = True<br />
<br />
pbSel.Image = ilApps.Images(lbApps.SelectedIndex + 1) 'lvApps.SelectedItems(0).ImageList.Images(selImg)<br />
<br />
selectedText = lbApps.SelectedItem.ToString<br />
btnLaunch.Text = "Launch " + selectedText<br />
btnMove.Text = strMoveText.Replace("|", selectedText)<br />
'Add Application Routine<br />
If selectedText <> "Add Application..." Then<br />
'set app selected path<br />
For i As Integer = 0 To appListing.Count - 1<br />
Dim lineData() As String = appListing.Item(i).ToString.Split("|")<br />
If selectedText = lineData(0) Then<br />
appSelPath = lineData(1)<br />
appSelName = lineData(0)<br />
If lineData.Length = 3 Then<br />
If lineData(2) = "True" Then appSelAlt = True<br />
Else<br />
appSelAlt = False<br />
End If<br />
End If<br />
Array.Clear(lineData, 0, lineData.Length)<br />
lineData = Nothing<br />
Next<br />
<br />
Dim enableIt As Boolean = True<br />
' Dim appPos As Integer = -10<br />
For i As Integer = 0 To appLaunched.Count - 1<br />
Dim lineData() As String = appLaunched.Item(i).ToString.Split("|")<br />
If lineData(1) <> "wait" Then<br />
If appSelName = lineData(0) Then<br />
enableIt = False<br />
If CInt(lineData(1)) > 0 Then<br />
appSelPos = CInt(lineData(1))<br />
appSelID = CInt(lineData(2))<br />
canEnable = True<br />
End If<br />
End If<br />
End If<br />
Array.Clear(lineData, 0, lineData.Length)<br />
lineData = Nothing<br />
Next<br />
<br />
ContextMenuStrip1.Enabled = True<br />
btnLaunch.Enabled = True <br />
lbScreens.SelectedItems.Clear()<br />
If enableIt = False Then<br />
lbScreens.Enabled = True<br />
btnMove.Enabled = False<br />
canEnable = True<br />
beenFound = True<br />
Else<br />
lbScreens.Enabled = True<br />
btnMove.Enabled = False<br />
beenFound = False<br />
canEnable = False<br />
End If<br />
End If<br />
End If<br />
selectedText = Nothing<br />
I have no idea what's wrong. I've looked at this chunk of code for hours now, and it doesn't seem like I'm making any unusual calls to anything.
Any help is appreciated.
Thanks,
Mitch F
|
|
|
|
|
Mitch F. wrote: Note:
The following names are Global Variables:
appSelPath
appSelName
appSelAlt
appSelPos
appSelID
canEnable
beenFound
Nasty....
What makes you think this is leaking memory ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hmm... so even if global variables are handled correctly, they will still cause an extremely large growth in memory consumption? Is there any more efficient way to carry variables from one sub to another?
|
|
|
|
|
I see no reason for this to leak memory. I assume you really mean it uses more memory than you would like. No object in this method can leak memory.
Globals won't leak, they are just a poor design. Yes, you can pass variables as parameters, or use delegates if classes need to communicate when a value changes.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi,
Thanks for the responses.
I've created a quick application (using one textbox and one button) to see if global variables are eating up memory and not releasing it, and that seems to be the case.
<br />
Public Class Form1<br />
Dim globalString As String = ""<br />
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged<br />
globalString = TextBox1.Text<br />
End Sub<br />
<br />
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
TextBox1.Text = ""<br />
globalString = Nothing<br />
End Sub<br />
End Class<br />
When I add text to the global variable, the memory starts to get eaten pretty quickly, but when I click the button to set the variable to Nothing, the memory still isn't released, but more memory is taken.
Thanks,
Mitch F
|
|
|
|
|
Well, if that's true, that's one more reason not to use globals. However, I'd be inclined to suggest that your methods of watching memory usage are flawed. Do you watch the memory in the task manager ? That's not really accurate.
Also, when I run this, the extra memory usage is minimal. Also, global is not a global, it's a member variable. To be the .NET equivelant of a global, it would need to be static.
Based on the minimal memory usage in the test I just did, I think you're worried about nothing, and certainly should do some reading regarding how the garbage collector works.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
TaskManager ais about the worst tool you can use to see how much memory your app is using. Why??
This is because TaskManager isn't showing you the memory your app is using. It's showing you how much memory is reserved by the .NET CLR Virtual Machine that is running your app. If your app releases managed memory back to the runtime, the runtime holds onto it (as seen by TaskManager) because it's not being released back to Windows. The runtime holds onto it to fill future requests for memory by your application faster. If Windows needs the memory back, the .NET CLR will release any it memorys it has in reserve back to Windows.
If you really want to see how much memory your app is using, use the Performance Monitor and the .NET CLR counters to monitor your app. Task Manager isn't show you how much memory your app is REALLY using.
|
|
|
|
|
Mitch F. wrote: The following names are Global Variables
No, they are not. There are no global variables in VB.NET.
Mitch F. wrote: my memory usage grows by ~100 kb and doesn't go down, according to Task Manager.
The Task Manager doesn't show how much memory your application uses, it shows how much memory the memory management has allocated. When memory is released back to the memory management, it doesn't get released to the system unless the system needs it.
Mitch F. wrote: Array.Clear(lineData, 0, lineData.Length)
lineData = Nothing
Doing things like that only uses CPU time, it doesn't release any memory earlier.
Clearing the array is pointless. When the array is no longer used, the references that it contains are no longer concidered, so all the strings also counts as unused. Actually, clearing the array will keep it in memory longer than if you didn't.
Setting a reference to Nothing only serves a purpose if you later in the code actually check for that Nothing value. Clearing references for the purpose of releasing memory has no effect at all.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
hi everyone!!
i have a huge problem and i've been working out this one for a long time now. i need your help..
does anyone knows how am i supposed to set the database connection for access if the target computer (the one i am about to deploy the application) is not connected on the network? i have created some applications and executables before and it had perfectly worked because i am using a database that is stored in a server computer and i just configure the connection string based on the shared folder.
my current project work well with that too but i need to install this application to a laptop which is to be brought anywhere (of course) and is not connected on the network. how am i supposed to do this..? i badly need your help guys...
btw, i am using visual studio .net 2002 and my database is in ms access.
thanks a lot in advance!!!
crookshanks
|
|
|
|
|
If your DB is access, then it's just an MDB file, deploy it with your app.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
thanks. i have included the database file in my project. but i dont know how to set the oledbconnection datasource..? i mean, i do not know how to declare the datasource path if my database is included in the project.
pls help.thanks.
crookshanks
|
|
|
|
|
The connection string will just be a path to the file - well, not just that, but it will contain the path to the file. So, you may have to build it in code.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
please help me how i am supposed to do that one.
i need to make a connection to the dataadapter that i am using to access my database. and since the database is included in the project which is stored in my C drive(for example), the path for the connection is in Cdrive also.
my problem is that when i install the application to the target computer, an error occur saying that it can't find the path to the database (since the target computer is not connected to the network)
crookshanks
|
|
|
|
|
crookshanks wrote: an error occur saying that it can't find the path to the database (since the target computer is not connected to the network)
Are you not deploying the database ? You should not keep the files in C drive. Keep it in your application directory and .NET framework provides method to access the current application working directory. So you won't miss the path.
|
|
|
|
|
i have the database included in the project.but i don't get what you mean by "deploying the database". i'm sorry i'm new in vb.net..
and also what you mean by application directory? thanks a lot.
crookshanks
|
|
|
|
|
deploying the database means copying the mdb file onto the target PC
the application directory is the directory in the file system that contains your exe, and presumably your mdb
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi,
I would like to add a button column on each row in datagrid.
How should i do it? I searched the forum from google.
The codes look like this: -
' Set datagrid XP Style Button ColumnStyle for City field
.Add(New DataGridXPButtonColumn(SystemColors.ControlText, SystemColors.Control))
' Also you may set datagrid Button ColumnStyle for City
' field without XP Button Style as the following:
' .Add(New DataGridButtonColumn())
With .Item(3)
.MappingName = "City"
.HeaderText = "City"
.Width = 60
.NullText = String.Empty
End With
But the problem that I'm facing is, i can't add "New DataGridXPButtonColumn" or "New DataGridButtonColumn" in datagridtablestyle.
There is no "datagridbuttoncolum" for me to add.
It's not allow for me to do so. How should i do?
Pls help.....
thanks in advance.
regards,
eunice
|
|
|
|
|
Are you using the DataGrid (.NET 1.0 and 1.1) or the DataGridView (.NET 2.0 and above)??
Google results for "add button to datagridview[^]".
|
|
|
|
|
Hi Dave,
I'm using DataGrid (.net 1.1) version, for vb.net window application.
It doesn't have "DataGridButtonColumn" control.
How can i add the button column in datagrid.
Pls guide me.
Thanks.
|
|
|
|
|
If like me, you have been waiting for a version of Crystal Reports 2008 that integrates with Visual Studio 2008, then the wait is over.
You can download Crystal Reports 2008 Service Pack 0 (yes, zero) from here[^], which includes VS 2008 integration.
Steve Jowett
-------------------------
I may not always be right, but I'm never wrong !
|
|
|
|
|
I have just started working for a company and I am having to learn vb.net.
I have been set a task to write a web app that will check a specified folder periodically for a new file. I was just wondering if you guys had any advice on what areas to concern my studies on?
Thanks in advance,
Aaran
|
|
|
|
|
The following are the namespaces you should research :-
System.IO<br />
System.IO.Directory<br />
System.IO.File
Also have a look at the FileSystemWatcher
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
Now my friend, the first thing you should start buying a book in vb.net ,or Download some E-books. and try to Google. they already gave you an answer, but as a Beginner , you might be wonderig what does he means about the text he just sent you, he just mean look for those namespaces and start googling and look for answers your self, Good Programmers try to make a research before start asking people how somethings are done
hoope that helps
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|