|
Yes...there are many algorithms and i think i should go by shortest path algo.
|
|
|
|
|
Don't put your email in posts. (Do you want to be buried under a pile of spam? You can bet that spam crawlers will be trawling CP.) You should edit that ASAP.
Have you done what your lecturer suggested? Google Maps has an extensive API and it sounds like you're expected to use that.
If you're in your final year and you don't know how to start a project, perhaps you have chosen the wrong career.
|
|
|
|
|
Well, the normal place to start with an assignment like this is to actually define what the problem is that you are trying to solve. If you don't know what the problem is, how can you hope to solve it. As it stands, your title is too vague - you can't get a feel for the problem from it. When you talk about tracking, what are you actually talking about? Are you talking about receiving signals back from the vehicles with their current co-ordinates (in which case, you are looking at messaging, message compression, communications, and a whole lot more).
When it comes to road routing algorithms, it's traditional to look at Dijkstra and A* algorithms, but there are a lot of things to consider here. Here are some points to ponder (there are lots more, but these should get you started):
1. Not all vehicles are equal. Some roads are accessible for one type of vehicle, but not another.
2. Not all roads are equal. Different roads have different speeds
3. Not all parts of all roads are equal. Roads have different speeds at different sections.
4. Not all parts of all roads are equal all of the time. Congestion, planned closures, accidents, etc, affects the speed of roads.
Above all, this is your chance to shine. Your final project is your chance to prove that you have the skills necessary to join the world of the professional programmer. With this thought foremost in your mind, consider how a professional should approach this problem. Talk to users. Document requirements. Perform analysis and design your application. Test your code works, and test your code copes with bad inputs. If you can, get others to test your code as well; have well defined tests that cover negative tests as well as positive ones.
Most of all. Have fun - this is the project where you really get to shine. I wish you luck.
|
|
|
|
|
It's easy...just follow these simple steps....
1. Open a text editor...
2. Type the following: "Sir, I wish to quit my current course, since despite the fact I'm in my final year, I really don't have a clue what I'm doing, so being a computer programmer isn't for me...btw - can I haz rply soon - iz urgentz"
3. Print this document.
4. Hand to your lecturer as soon as physically possible
5. Decide on a new career
C# has already designed away most of the tedium of C++.
|
|
|
|
|
Hi, i'm working on a 2 player board game which plyer 1 runs in C# and player 2 in Java.... i'm using thread to pass data using XMLserilization and JAXB Marshaller in java.
I want to do C# part in WPf and its gives exception
"invalidOperationException" "The calling thread cannot access this object because a different thread owns it"
heres my c# code and wpf... someone pls help....
**************************CORRECT c# CODING**************************
private void button1_Click(object sender, EventArgs e)
{
GameData g = new GameData();
g.Turn = true;
g.PlayerValue = int.Parse(textBox1.Text);
FileStream fs = new FileStream(@"C:\Users\IsH\Desktop\Podi wadak\GameData\GameData.xml", FileMode.Create);
XmlSerializer xs = new XmlSerializer(typeof(GameData));
xs.Serialize(fs, g);
fs.Close();
button1.Enabled = false;
Thread.Sleep(2000);
Thread t2 = new Thread(new ThreadStart(getData));
t2.Start();
}
getdata metherd
public void getData()
{
GameData g = null;
do
{
try
{
FileStream fs = new FileStream(@"C:\Users\IsH\Desktop\Podi wadak\GameData\GameData.xml", FileMode.Open);
XmlSerializer xs = new XmlSerializer(typeof(GameData));
g = (GameData)xs.Deserialize(fs);
fs.Close();
Thread.Sleep(2000);
}
catch (Exception ex)
{
}
} while (g.Turn != false);
if (this.InvokeRequired)
{
callMethod m = new callMethod(getData);
this.Invoke(m);
}
else
{
textBox2.Text = "" + g.PlayerValue;
button1.Enabled = true;
}
}
*********************************************************************
here is my wpf code wich gives me the error
private void button1_Click(object sender, RoutedEventArgs e)
{
GameData g = new GameData();
g.Turn = true;
g.PlayerValue = int.Parse(textBox1.Text);
FileStream fs = new FileStream(@"C:\Users \IsH\Desktop\Podi wadak\WpfApplication1\GameData\GameData.xml", FileMode.Create);
XmlSerializer xs = new XmlSerializer(typeof(GameData));
xs.Serialize(fs, g);
fs.Close();
button1.IsEnabled = false;
Thread.Sleep(2000);
Thread t2 = new Thread(new ThreadStart(getData));
t2.Start();
}
****************Get DATA Method that gives the error********************
public void getData()
{
GameData g = null;
do
{
try
{
FileStream fs = new FileStream(@"C:\Users\IsH\Desktop\Podi wadak\WpfApplication1\GameData\GameData.xml", FileMode.Open);
XmlSerializer xs = new XmlSerializer(typeof(GameData));
g = (GameData)xs.Deserialize(fs);
fs.Close();
Thread.Sleep(2000);
}
catch (Exception ex)
{
}
} while (g.Turn != false);
if (this.Dispatcher.Thread == Thread.CurrentThread)
{
callMethod m = new callMethod(getData);
this.Dispatcher.BeginInvoke(m);
}
else
{
textBox2.Text = "" + g.PlayerValue;
button1.IsEnabled = true;
}
}
|
|
|
|
|
You cannot access UI controls from another thread. Use the Dispatcher. In this case you've simply got your if test the wrong way around, though I think Dispatcher.RequiresInvoke or something like that will be better.
On a broader level, though, your data reading thread shouldn't be directly setting things in the view anyway. It should notify the view model that the game data has changed, probably by assigning to a property on the view model, and then that should notify the view. The data binding in WPF should manage the cross thread issue itself in that case.
|
|
|
|
|
BobJanova wrote: I think Dispatcher.RequiresInvoke or something like that will be better.
They changed the name for WPF:
Dispatcher.CheckAccess() (Returns true on the GUI thread, false otherwise)
Dispatcher.VerifyAccess() (Throws an exception if not on the GUI thread)
Just FYI.
|
|
|
|
|
Got it....
public void getData()
{
GameData g = null;
do
{
try
{
FileStream fs = new FileStream(@"C:\Users\IsH\Desktop\Podi wadak\WpfApplication1\GameData\GameData.xml", FileMode.Open);
XmlSerializer xs = new XmlSerializer(typeof(GameData));
g = (GameData)xs.Deserialize(fs);
fs.Close();
Thread.Sleep(2000);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
} while (g.Turn != false);
if (this.Dispatcher.CheckAccess())
{
callMethod m = new callMethod(getData);
this.Dispatcher.Invoke(m);
}
else
{
Action job = delegate
{
textBox2.Text = "" + g.PlayerValue;
button1.IsEnabled = true;
};
textBox2.Dispatcher.Invoke(job);
}
}
*********************** thanks everybody for your help........
|
|
|
|
|
Thanks ... I'll try to remember (though I'll probably fail, as I'm not using WPF in actual code).
|
|
|
|
|
hi i am using window 7, and vs2008.net c#
i want to capture my screen image and identify words from a certain section.
is this possible? anyidea how its implemented? i am trying to make a school project. thanks
|
|
|
|
|
One way to achieve this would be to use OCR to read the text in from that position in the image. It's not going to be easy - OCR is not a trivial task. Andrew Kirillov is probably the best place to start to get an idea of how complex this is. Try his article here[^] for more information.
|
|
|
|
|
Not a real "solution", just a theoretical long-shot. How are you gonna clip the area that you need to capture under the cursor?
No, don't asnwer - once you're there, you need to realize that you'll have to run this CPU-intensive task on each mouse-move.
It would have been more realistic to answer that it's not possible, even though one could think of a dozen workarounds. It would have even been more rewarding if you explained the difference between a control and a picture, and would have explained that one (with a bit of work) can fetch it's text[^] if it ain't a drawing - asking whether his project would be limited by this.
Bastard Programmer from Hell
|
|
|
|
|
Eddy Vluggen wrote: No, don't asnwer - once you're there, you need to realize that you'll have to
run this CPU-intensive task on each mouse-move.
Actually, sod that, I will answer - seeing you thought it necessary to one vote. Read what he actually asked, not what you took it to mean. At no stage did he mention basing the read on mouse position. You have overcomplicated the problem, and haven't actually answered what he asked.
This is what he really asked:
"hi i am using window 7, and vs2008.net c#
i want to capture my screen image and identify words from a certain section.
is this possible? anyidea how its implemented? i am trying to make a school project. thanks"
Now, where does that say anything about mouse position? So, my answer still stands.
|
|
|
|
|
Pete O'Hanlon wrote: Actually, sod that, I will answer - seeing you thought it necessary to one vote. Read what he actually asked, not what you took it to mean. At no stage did he mention basing the read on mouse position. You have overcomplicated the problem, and haven't actually answered what he asked.
You're right, I interpreted his question and jumped to a conclusion. He doesn't say anything about capturing the text under the mouse-cursor.
And yes, I strongly disagreed with someone whose answers are usually valuable - hence the one. I can see my mistake and will rectify it after posting this reasoning. Next time, I'll make it a two if I simply disagree. 1's imply a lot of crap, which it certainly is not.
Pete O'Hanlon wrote: Now, where does that say anything about mouse position? So, my answer still stands.
It indeed does not say that.
Bastard Programmer from Hell
|
|
|
|
|
Don't worry about the one vote. You had me doubting my memory though, which at my age, I can't afford.
|
|
|
|
|
Pete O'Hanlon wrote: Don't worry about the one vote.
Cool
Just noticed that one can only flag it as a good/bad answer. A bad answer translates to a one-vote. I'm off to the suggestions-forum; it'd be nice to have a "hold on" or "say what?" indicator.
Pete O'Hanlon wrote: You had me doubting my memory though, which at my age, I can't afford.
You already forgotten that kids forget things too? You were more alert than I was when answering the TS.
Bastard Programmer from Hell
|
|
|
|
|
neodeaths wrote: is this possible?
Only in theory, as we have yet to find a CPU that can do OCR for different fonts at high speed.
In pratice, there are controls that can hold text, and controls that don't hold the text but who are simply displaying drawn pixels.
neodeaths wrote: i am trying to make a school project.
Too complicated for a school-project. First, it's not always possible to read the "word" under the cursor, as it might not be saved in memory as a text; as said, it might have been drawn. Although it's possible to have the computer guess what words there are in the picture, it's slow and error-prone.
Bastard Programmer from Hell
|
|
|
|
|
its my suggestion to my teacher for my school project as we are supposs to think of an application to do, i have not talk to him about it yet, just want to see how complex and what i should know before i decide what to do.
from what i have read about ocr its pretty deep, and will probably have a very long time complexity to run.
still considering though
|
|
|
|
|
neodeaths wrote: its my suggestion to my teacher for my school project as we are supposs to think of an application to do
What kind of application where you planning? Perhaps there's another way to get the required input, like the ClipBoard ?
neodeaths wrote: just want to see how complex and what i should know before i decide what to do.
A good project would be any project that has been done already. Ask the students of the previous year; at least you'll now it's viable within the given time.
neodeaths wrote: from what i have read about ocr its pretty deep, and will probably have a very long time complexity to run.
With some people (like me) doing a lot of travelling by mouse, with the cursor hitting a lot of words when I'm working.
Bastard Programmer from Hell
|
|
|
|
|
While you are deliberating, you should consider whether Eddie has actually answered the question you asked. In my opinion, he's interpreted your question - you need to decide whether his interpretation is actually what you were asking.
|
|
|
|
|
hi i am using window 7, and vs2008.net c#
to create a simple
to use my mouse to click a certain area of my desktop when like
every 12pm click on the 50,50 of my screen
is this possible? if so please give advice on the website and class file i should check out. thanks
|
|
|
|
|
This StackOverflow question[^] has the answer to your question.
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
public class Form1 : Form
{
[DllImport("user32.dll",CharSet=CharSet.Auto, CallingConvention=CallingConvention.StdCall)]
public static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint cButtons, uint dwExtraInfo);
private const int MOUSEEVENTF_LEFTDOWN = 0x02;
private const int MOUSEEVENTF_LEFTUP = 0x04;
private const int MOUSEEVENTF_RIGHTDOWN = 0x08;
private const int MOUSEEVENTF_RIGHTUP = 0x10;
public Form1()
{
}
public void DoMouseClick()
{
int X = Cursor.Position.X;
int Y = Cursor.Position.Y;
mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, X, Y, 0, 0);
}
}
0100000101101110011001000111001011101001
|
|
|
|
|
In order to control a PLC with a "complex data structure" the PLC class expects a structure that is unmanaged.
This structure runs fine:
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public class PinStructureQuality
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)]
public int[] iPinValues = new int[24];
public PinStructureQuality()
{
iPinValues = new int[24];
}
}
The problem I have is that I don't know at the time this Class is constructed whether I have 10, 24 or any other number of pins. I would like to read this from a settings file or an XML file containing a parameter telling what the size the array is.
The line
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)]
causes the problem, since the value 24 must be known in front.
Does anybody have an idea on how to solve this?
|
|
|
|
|
What's the C declaration? I suspect you want to marshal as a pointer not as a fixed size array within the structure.
|
|
|
|
|
the structure is directly used in the API provided with the PLC. This is the declaration of the wrapper:
public void WriteAny(int variableHandle, object value);
and my call to it is:
public void SetAllLow()
{
for (int i = 0; i < iNrIO; i++)
_PinStructureQuality.iPinValues[i] = (int)(65535);
try
{
if (e._ErrorCode == 0)
adsClient.WriteAny(hcomplexStruct, _PinStructureQuality);
}
catch
{
e._ErrorCode = 1;
e._ErrorMessage = "Could not write pinning data to PLC";
ErrorEvent(this, e);
e._ErrorCode = 0;
e._ErrorMessage = "";
}
}
The reason I want to use this WriteAny call is that it allows me to sent also strings and other types in the same structure.
|
|
|
|