|
Wht is F# .... what is advantage of f# ....
have any relation between c# and F#
Give Some valid article
|
|
|
|
|
F# is a programming language[^]. It's focus is on functional programming[^]. It is based on ML[^] but targets the .net framework (so compiles to MSIL). Functional programming is useful in many mathematical domains where it's the functions and their application that is important as opposed to state.
The only similarity between F# and C# is that they both target the .net framework, their syntax is very different. (And they have a sharp sign in their name)
Simon
|
|
|
|
|
|
Hello!
I'm building an application for communication with several devices (not PCs) over Network, using both TCP and UDP protocols.
For this I need two kinds of connexions:
- a connexion (one at the time) with the targeted device, initiated only for parameters setting and device servicing purposes;
- simultaneous multiple connexions with several devices for collecting data (by polling devices).
First one was solved using asynchronous sockets methods, and a timer to periodically check connection status and some other relevant parameters.
See below the basic code for initiating connexion:
'Initialize Socket
Private testSocket As Socket
'Open connexion
Public Sub OpenConnexion(ByVal addressIP As String, ByVal portNo As String, ByVal IPportType As String)
Dim remoteIP As IPAddress = IPAddress.Parse(addressIP)
Dim remotePort As Int32 = CInt(portNo)
If IPportType = "TCP" Then
testSocket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
testSocket.BeginConnect(remoteIP, remotePort, AddressOf CheckConnection, Nothing)
ElseIf IPportType = "UDP" Then
testSocket = New Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)
testSocket.BeginConnect(remoteIP, remotePort, AddressOf CheckConnection, Nothing)
End If
End Sub
'Connexion result event
Public Sub CheckConnection(ByVal ar As IAsyncResult)
Try
testSocket.EndConnect(ar)
'CallDeviceConnected()
Catch ex As Exception
'CallDeviceDisconnected()
End Try
End Sub
For the second one, using the the same way by simply repeating the code and manually indexing each Sub, the code will become rapidly too large, too complicated and not productive at all.
I've tried a different approach building an Array of Sockets but then I encountered another issue: how to pass the connexion index to connexion result, in order to determine which connexion is active or not.
See below the attempt of code:
'Maximum no. of simultaneous connections
Private maxConnexions As Int32 = 10
'Initialize Socket
Private testSocketArr(maxConnexions) As Socket
'Open connexion
Public Sub OpenConnexionArr(ByVal index As Int32, ByVal addressIP As String, ByVal portNo As String, ByVal IPportType As String)
Dim remoteIP As IPAddress = IPAddress.Parse(addressIP)
Dim remotePort As Int32 = CInt(portNo)
If IPportType = "TCP" Then
testSocketArr(index) = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
testSocketArr(index).BeginConnect(remoteIP, remotePort, AddressOf CheckConnectionArr, index)
ElseIf IPportType = "UDP" Then
testSocketArr(index) = New Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)
testSocketArr(index).BeginConnect(remoteIP, remotePort, AddressOf CheckConnectionArr, index)
End If
End Sub
I have found on Web a lot of examples about dealing with multiple connexions or building a server which can manage hundreds of clients. What I need is a kind of reverse job: to build a client which connects to multiple servers and then poll each of them.
Please help me with some ideas for putting this application on the right track.
Thanks!
Cristian
|
|
|
|
|
I want to write a keylogger in C#.NET.
Also I want it to be executed in a target machine without alerting the user of that machine.
Since .NET languages are dependant on the Framework, I think it will be hard to predict that the executable will get properly executed. Is there any way to make a C#.NET program to a native exe working without the need of the .NET framework?
|
|
|
|
|
There is a very expensive professional one, where you buy a tool to do the conversion and include all required .NET code (probably resulting in a huge EXE file).
Luc Pattyn [Forum Guidelines] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
modified on Sunday, November 15, 2009 7:56 PM
|
|
|
|
|
yeah rewrite it in c++
|
|
|
|
|
It is like building a 100 floor skyscrapper without a foundation
|
|
|
|
|
Gjm wrote: I want to write a keylogger in C#.NET.
Also I want it to be executed in a target machine without alerting the user of that machine.
Get lost dipshit. This is illegal in the United States. Anyone helping you write this can be considered an accomplice in your crime.
|
|
|
|
|
example as: Product has 'Category' property, it's a class, the following code can update the product's simple property(such as string, int, etc), but cannot update it's navigation property.
public void UpdateProduct(Product product, Category category, Model model)<br />
{<br />
Product target = _context.Product.FirstOrDefault(a => a.ProductID == product.ProductID);<br />
_context.ApplyPropertyChanges("Product", product);<br />
_context.SaveChanges();<br />
}
|
|
|
|
|
A number of questions:
1. What is _Context? clearly it is a custom class of some sort.
2. What does ApplyPropertyChanges do? that would be the code to show us.
3. If you try to update the Navigation property what error occurs?
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
www.JacksonSoft.co.uk
|
|
|
|
|
1 & 2 are self explanatory if you know about Enitity Framework.
3 is ridiculous to ask if you don't know anything about 1 & 2.
I know the language. I've read a book. - _Madmatt
modified on Monday, November 16, 2009 7:27 AM
|
|
|
|
|
Thanks very much.
1. _context is System.Data.Objects.ObjectContext
2. ApplyPropertyChanges(string entitySetName, object changed) is the method of System.Data.Objects.ObjectContext
In my tests, the ApplyPropertyChanges method don't do its job for EntityReferences.
finally, I modify the code as following, It work fine.
public void UpdateProduct(Product updated, Category category, Model model)
{
Product original = _context.Product.FirstOrDefault(a => a.ProductID == updated.ProductID);
if (category != null && original.ProductCategory.CategoryId != category.CategoryId) original.ProductCategory = category;
if (model != null && original.ProductModel.ModelID != model.ModelID) original.ProductModel = model;
_context.Attach(original);
_context.ApplyPropertyChanges("Product", updated);
_context.SaveChanges();
}
modified on Monday, November 16, 2009 11:18 PM
|
|
|
|
|
Please use pre tags when posting code. I think you meant to reply to the other poster.
I know the language. I've read a book. - _Madmatt
modified on Monday, November 16, 2009 10:06 AM
|
|
|
|
|
Try having a look here[^]. Look for ApplyReferencePropertyChanges
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi,How do I Export data from SQL Server to Excel by vb.net codes
|
|
|
|
|
A few seconds of search would have given you: [This]
|
|
|
|
|
1>connect to the server (sqlserver)
2>go to the database
3>right click to the database the task->export..
4>wizard will pop up
5>then go throught that wizard.....
|
|
|
|
|
hi i'm creating a program with two listview.
one get the "Group" and other get the "members of the selected Group"
but i have problem
only get the first member .
Private Sub ListView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged
lstestacoes.Clear()
lstestacoes.View = View.LargeIcon
Try
If con.State = ConnectionState.Open Then con.Close()
con.Open()
Dim ind As Integer
Dim temp As String
For Each item As ListViewItem In ListView1.SelectedItems
If item.Selected = True Then
temp = item.SubItems(0).Text
itemSelected = item.SubItems(0).Text
Dim cmd As New OleDbCommand("select * from Estacao WHERE idGrupo= '" & temp & "'", con)
Dim drdr As OleDbDataReader
drdr = cmd.ExecuteReader
If drdr.Read() Then
ind = ind + 1
Dim i As New ListViewItem(ind)
i.Text = drdr.Item("Nome")
i.ImageIndex = 0
lstestacoes.Items.AddRange(New ListViewItem() {i})
Else
cmd.Cancel()
con.Close()
End If
End If
Next item
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
My database have two tables "Grupo" and "Estacoes"
obs : "Grupo" is the Group and "Estacoes" is the members
at the group i have = id,name
and in Estacoes i have = id,name,ip,descricao,grupo
how can i set to get all members ?
SORRY LONG TIME I'M NOT SPEAK ENGLISH
modified on Friday, November 13, 2009 6:09 PM
|
|
|
|
|
Hi,
1.
please use PRE tags instead of CODE tags to make things readable.
You can still edit your original message...
2.
I doubt Dim i As New ListViewItem(ind) is correct.
Try Dim i As New ListViewItem()
Luc Pattyn [Forum Guidelines] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
ok i will use.
but in the data base the colunn idGrupo is "Lab1" for exemple not number.
in group the items are inserted correctly but foe members no, why ?
the problem is when the code are debugin only get one member "the first"
is because i'm searching for string at database for example "Lab1" in colunn "idGrupo" ?
i don't know why he get only the first provabily the code is wrong ^^"
|
|
|
|
|
I think this line is the culprit
If item.Selected = True Then
Remove this If condition and try again.
|
|
|
|
|
i'm used other code to resolve this problem .
i'll post where for know how code i used.
Private Sub ListView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged
lstestacoes.Clear()
lstestacoes.View = View.LargeIcon
Try
If con.State = ConnectionState.Open Then con.Close()
lstestacoes.Clear()
lstestacoes.View = View.LargeIcon
Dim ind As Integer
Dim temp As String
For Each item As ListViewItem In ListView1.SelectedItems
If item.Selected = True Then
temp = item.SubItems(0).Text
Dim adptr As New OleDbDataAdapter("select * from Estacao WHERE Grupo= '" & temp & "'", con)
Dim ds As New DataSet
Dim dr As DataRow
Dim dt As New DataTable
Dim imageListSmall As New ImageList()
Dim imageListLarge As New ImageList()
Dim grupoquant As Integer
Try
adptr.Fill(ds, "Grupo")
dt = ds.Tables(0)
For Each dr In dt.Rows
ind = ind + 1
Dim i As New ListViewItem(ind)
i.Text = dr.Item("Nome")
i.ImageIndex = 0
lstestacoes.Items.AddRange(New ListViewItem() {i})
Next
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
Next
Catch ex As Exception
MsgBox(ex.Message)
End Try
con.Close()
end sub
|
|
|
|
|
Dear Sir
I have many forms in my vb.net projects
I have to write(copy) all connection codes to connect DB for each form
Is any better way???? for example a class or a dll to help me ????
Generally I want another method (class or dll file) to call for loading of my forms...
Sorry about my bad english...
Thanks
|
|
|
|
|
yu can create a class with this code:
Public con As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & My.Settings.dbBase.ToString & ";Jet OLEDB:Database Password=" & My.Settings.dbBasePass.ToString & ";")
where i use a settings option to store the informations converted to string :
data base : My.Settings.dbBase.ToString
password : My.Settings.dbBasePass.ToString
i hope help you ^^
my english is not good too ^^"
|
|
|
|