|
Yes, you will need to do some stuff with network streams. The only network games I've written were over LANs (my home network). That's a lot easier, since you don't have to worry about security issues (at least at my house ), and you don't have to worry about dynamic ip addresses and all that...
It is possible, but a little tricky. First, it's a good idea to do all of the network communications asyncronously (such as with a backgroundworker. I have a link to a vb source code I wrote to help me with developing a couple of network programs I wrote a while ago. It basically encapsulates all of the details of the network stuff in a class. You can take a look at it and how it works.
You can take a look at http://lance.mckendree.edu/~klschaefer/temp/NetworkHelper.vb[^]. As the name suggests, it makes doing network stuff a little easier, but feel free to learn how it works and expand on it. If you haven't done any network stuff at all, I would suggest making a simple chat program just so you can get something under your belt.
I would consider what I've done to be a server/client program, so one of the machines is designated as a "server" and the other as a "client", although beyond initially setting up the connection, that designation pretty much doesn't do anything: both can send and receive exactly the same.
Anyways, I hope this helps!
|
|
|
|
|
thanks, its looks great. Ill have to play with it some.
|
|
|
|
|
am dev. a school man. so i need to computer student performance but the problem is how to get the highest in class base on their percentage
i have ther percentage but som have thesame perc so how to know who is 1st,2nd 3rd ....
am using vb.net
just a clue i need
|
|
|
|
|
Not enough to really give you a good answer. Are you calculating the percentages on the fly?
If you are using a generic list then have a look at this
MSDN Sort Method[^]
if you are using a dataset then use
Dataset select method[^]
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
You need to define a new parameter which can be measured and used as a tie-breaker when 2 or more students have the same percentage. For example: Attendance.
OR
First try using more decimal places in your percentage calculation, maybe there will be a difference.
Good luck.
|
|
|
|
|
i hav calculated their percentage. but don wana include attendance.
the db table is lik
sn,studid,class,totalmark,markObtain,percentage.
the query is "select * from tb_exam where class 'classA' order by percentage asc".
wanted to get the highest base on per. but its not workin
so how to conditon it to match with the total student in that class and geting their positon base on their percentage.
thanks
|
|
|
|
|
Insufficient information.
Maybe, just maybe, totalmark is a constant number much larger than 100, and the percentage value in the database corresponds to the formula round(100*markObtain/totalmark); in that case markObtain would be a larger number and hence a better criterion to sort your query than percentage is.
BTW: if so, the database isn't normalized; the percentage column should be removed as it is redundant (it can be calculated on the spot).
Anyway, it is always possible for two students to have identical marks, so you (or someone for you) has to decide how to handle such case. You can't properly implement what hasn't been specified.
|
|
|
|
|
Thank u, yes totalmark is constant and larger dan 100.
But the percentage has been goten from diff table base on student totalmarkobtain.
But can u giv me proses how to rearange thisn query each student, compare their percentage or anyth u may wish base on total stud in class.
E.g
1 out of 20
2 out of 20
.
.
.
20 out of 20
For class of total student of 20.
|
|
|
|
|
Hi Zakari,
I am assuming that if 3 students get 80% then they score the same placement.
Return query sorted by percent, then iterate through the collection and also keep 2 local Integer variables called say currentPercent and currentPosition
For value as Integer = 1 to class.count
If student.percent = currentPercent Then
student.position = currentPostion
Else
student.position = value;
currentPercent = student.percent;
currentPosition = value;
End if
Next
Sorry I'm working on a mac at the moment so maybe the VB code is not right. Hopefully you get the idea.
Also "need help pls", don't we all. Think of a more specific subject heading next time. You are more likely to get an answer that way.
"You get that on the big jobs."
|
|
|
|
|
Thnks. But the problem is how to even asign position to each student in the base on the percentage. Not to talk about deeling with thesame percentage first.
|
|
|
|
|
If they have the same percentage, you need to look at some other critera for ranking.
e.g. use methematics marks (and print them out in the result).
|
|
|
|
|
I just found a message from 2004 that said there is no option for opening a file and adding text to the beginning. I want to validate whether that is still true or not.
What I want to do is add some data to the beginning of a file without reading and writing the entire file. The files are large text files, a lot of the time they are gigabytes in size so it is inefficient and most of the time not possible to read it into memory and manipulate the data.
Is there an option through a FileStream or some other type of I/O class that will open a file allow me to point to the beginning and write text as an "insert" type of operation and save the file?
An example of what I am trying to do is below.
Start
Middle
End
Open file and add to the beginning
New Text
Start
Middle
End
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
CleaKO wrote: I just found a message from 2004 that said there is no option for opening a file
and adding text to the beginning. I want to validate whether that is still true
or not.
Yes, it's still true, until someone creates an entirely new file system that supports writing at either end of a file instead of just the end.
CleaKO wrote: What I want to do is add some data to the beginning of a file without reading
and writing the entire file.
Can't be done. The only way to prep for an operation like that would be to pad the beginning of the file to save room for writing from the beginning of the actual content of the file.
|
|
|
|
|
It was your reply that I found earlier, .
Thanks for confirming.
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
If you feel a need to do that, it should tell you huge text files are not the right approach.
If your data would reside in a series of files, with some particular order imposed (maybe alphabetically sorted file names), then you could insert at the beginning, at the end, and at each file switching point, simply by adding one more file with the appropriate characteristics (e.g. filename) that make it sit where it belongs.
|
|
|
|
|
Writing a file isn't an "insert operation". It's modifying what's there, or writing beyond it's limits if there's room.
--edit;
Just reread Luc's post
Bastard Programmer from Hell
|
|
|
|
|
My application is in VB.NET and environment is Window XP. We are using WebBrowser control to display data of Word doc files i.e. we are opening word files always inside the WebBrowser control and then modifying word file using bookmarks by VB code.Our VB code is perfectly working. We are doing following changes in window registry via VB.NET code for temporary basis:
1)..HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Word.Document.8\
updating BrowserFlags value to H80000024
2)..HKEY_CLASSES_ROOT\Word.Document.8\
updating EditFlags value to 65536
3)..HKEY_CLASSES_ROOT\Word.Template.8\
updating EditFlags value to 65536
4)..HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Word.Document.12\
updating BrowserFlags value to H80000024
5)..HKEY_CLASSES_ROOT\Word.Document.12\
updating EditFlags value to 65536
6)..HKEY_CLASSES_ROOT\Word.Template.12\
updating EditFlags value to 65536
Now we are migrating environment from WinXP to Win7. I have following query for Win7 environment :
We do not have rights to change registry on Win7 machine , so without changing values of BrowserFlags and EditFlags , how word docs files will always open inside webBrowser control on win7 machine? Currently I am getting popup dialog box (Open/Save/Cancel) for word doc on win7 machine at running the application.
I want to avoid it.Please help me to find the solution.
|
|
|
|
|
|
Bumping is frowned upon around here.
|
|
|
|
|
Hi guys,
I hope you had a nice start into 2012!
I've been trying to convert this^ piece of code into VB, using VS Express 2010 and #Develop. In order to avoid problems with conversion of c# 'yield' operator, I put the extensions into a DLL and set a reference to that.
The translated code of the test implementation reads like:
Shared Sub Main(ByVal args() As String)
Dim worker As New BackgroundWorker()
worker.WorkerReportsProgress = True
AddHandler worker.DoWork, Function(sender, e)
' pretend we have a collection of items to process
Dim items(999) As Integer
items.WithProgressReporting(Function(progress) worker.ReportProgress(progress)).ForEach(Function(item) Thread.Sleep(10)) ' simulate some real work
End Function
AddHandler worker.ProgressChanged, Function(sender, e)
' make sure the figure is written to the
' same point on screen each time
Console.SetCursorPosition(1, 0)
Console.Write(e.ProgressPercentage)
End Function
worker.RunWorkerAsync()
Console.Read()
End Sub
Unfortunately in VB the line
items.WithProgressReporting(Function(progress) worker.ReportProgress(progress).ForEach(Function(item) Thread.Sleep(10))) throws an exception "Expression does not produce a value" at the underlined place. There's no such exception in C# where the test code compiles and executes fine.
Having to implement the technique into my VB application, I'd like to understand where the problem arises. Could anyone of you tell me what's wrong in the (automatic) translation of the Lambda expression?
Thank you
Mick
modified 10-Jan-12 5:23am.
|
|
|
|
|
Seems to me one of your right parentheses is not at the correct position; you need one more before ForEach .
|
|
|
|
|
I changed it to
items.WithProgressReporting((Function(progress) worker.ReportProgress(progress))).ForEach(Function(item) Thread.Sleep(10)) as you said, but the same exception remains.
|
|
|
|
|
Michael Schäuble wrote: I'd like to understand where the problem arises. Could anyone of you tell me what's wrong in the (automatic) translation of the Lambda expression?
Where is the original C# code?
Bastard Programmer from Hell
|
|
|
|
|
In my initial message "this" is a link to the code (it should appear written in blue?). But it leads to the "Functional Fun" code which YOU yourself had recommended in my LINQ-to-SQL question yesterday
|
|
|
|
|
..someone having fun with your clipboard?
Bastard Programmer from Hell
|
|
|
|