|
Thanks for the quick reply ! Though I don't really understand what you mean with the different shapes for each formulae and colors for the test... ?
|
|
|
|
|
for algorithms A,B,C draw a little square, circle, triangle; for test points 1,2,3 use red, green, blue. With all this on a single drawing you might see a pattern indicative of a bug, an algorithmic weakness, I don't know.
|
|
|
|
|
I don't know about what approximations you will use, but your gold standard (enshrined by law in Australia and probably many other countries) is Redfearn's formulae for WGS84 <=> UTM. They are accurate to literally atomic dimensions. Geoscience Australia[^]has a good discussion of all this sort of stuff on its website, and includes Redfearn (and other transformations) as Excel spreadsheets for free download. There are online convertors too. Google Redfearn and take it from there.
[edit] forgot shameless plug. For a 'real world' application of Redfearn, have a peek at gridlle.no-ip.org[^] Also added GA link. [/edit]
Software rusts. Simon Stephenson, ca 1994.
modified on Tuesday, August 24, 2010 7:22 PM
|
|
|
|
|
Thanks ! This is really helpful, I will take a look at Redfearn
|
|
|
|
|
Just a few days ago, I published a little tool for GPS tracks (Bernie’s Trackviewer[^]). The part relevant for you was taken from 'GMap.NET - Great Maps for Windows Forms and Presentation'[^] by 'radioman.lt'.
I guess the "precision" issue does relate to the map where your GPS coordinates are to be shown. Some algorithms for some projections can be found in the referenced project.
Or does it relate to the precision of the coordinates read from the GPS device which were calculated from the data sent from the satellites?
|
|
|
|
|
Hi Guys,
I'm working on a project where I need to parse data coming from flat files into XML. All was working well until I was sent a csv file which contained a › character (nb: this is not a > (62), but › (155)). When this is written to my XML, it is displayed as a square box. I'd assumed that if I set the stream reader to automatically determine the file's encoding, and set the XML writer to use unicode, all character conversions would take place automatically, but it seems that either that's not the case, or I've missed something. Does anyone know what about the following code could cause extended characterset chars to not be correctly converted?
public XmlDocument ToXmlDocument(string filename, bool headerRow)
{
string tempfile = System.IO.Path.GetTempFileName();
XmlTextWriter writer = new XmlTextWriter(tempfile, Encoding.Unicode);
writer.WriteStartDocument(false);
writer.WriteStartElement(XML_ROOT_ELEMENT);
using (TextReader reader = new StreamReader(filename,true))
{
string line;
while ((line = reader.ReadLine())!=null)
{
if (headerRow)
{
headerRow = false;
}
else
{
ProcessCsvRow(line, ref writer);
}
}
}
writer.WriteEndElement();
writer.WriteEndDocument();
writer.Close();
XmlDocument result = new XmlDocument();
result.Load(tempfile);
System.IO.File.Delete(tempfile);
return result;
}
Thanks in advance,
JB
|
|
|
|
|
Hi,
Inverso1 wrote: using (TextReader reader = new StreamReader(filename,true))
AFAIK a text stream constructor without explicit encoding will:
1. look for a byte order mask indicating the stream holds Unicode/UTF8 characters
2. lacking that, assume it is an 8-bit encoding corresponding to the thread's CultureInfo which defaults to your system's default "code page", which would be e.g. 1252 in Western Europe.
As you said 155 would be "single right-pointing angle quotation mark" in standard ANSI (see e.g. here[^]). And it should work well if your system or your thread were set to ANSI.
It also maps OK in Windows code page 1252 (see here[^]). But it wouldn't in many others.
I suspect your system/app is not using a code page that interprets 155 as "single right-pointing angle quotation mark".
I suggest:
1. you have a look at the file using Notepad
2. you check your code page (I don't know how by heart!)
3. you explicitly set the encoding when opening the stream, assuming you know it to be constant.
And of course you'll risk getting in trouble again when dealing with 8-bit text files from different origins, that was after all the reason they invented Unicode.
|
|
|
|
|
Hey Luc,
thanks for your response; adding the encoding fixed the issue. I am a little worried about the possibility of other codepages, since the idea is that this system can take data from any source. Guess I'll have to configure it to allow different data sources (i.e. file locations) to have a custom codepage specified.
For people following this thread, you may be interested in the code below, which gives the systems' default codepage (as Luc mentioned, for me it's 1252).
Console.WriteLine(Encoding.Default.CodePage.ToString());
I've now modified one line of my code to read as follows, which seems to have fixed the issue:
using (TextReader reader = new StreamReader(filename,Encoding.Default,true))
It seems a bit strange that the system's not using the default by default, but hey, all's good. I've also tried chucking UTF-8 and UTF-16 formatted text documents through and these were also encoded correctly.
Thanks again,
JB
|
|
|
|
|
I noticed a weird behaviour in ListView . When its MultiSelect property is set to true and I press a mouse button while the cursor is inside the control, I get a MouseDown event. Then I release the button and get a MouseUp event, just as I would expect. However, when I set the MultiSelect property to false and press a mouse button, I suddenly get the MouseUp event immediately after the MouseDown one. When I then actually release the button, no MouseUp fires. Is this intentional? How can I then properly determine when the mouse button was actually released?
|
|
|
|
|
Can you check the control's MultiSelect property in your mouse event handlers?
/ravi
|
|
|
|
|
I can confirm what you are experiencing - this only occurs when the control itself is clicked. When a ListViewItem is clicked (MouseDown ) the behaviour is normal (even if the mouse is moved away from the clicked item).
Very odd.
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.(Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
Yes, that's true, unfortunately I need to properly handle all clicks in the control, not just those on a ListViewItem . It even doesn't work on a ListViewSubItem .
|
|
|
|
|
It works on sub items if you set FullRowSelect to true... wired bahavior...
|
|
|
|
|
This is a semi-solution.
Subclassing the ListView and overriding WndProc , listen for the left mouse button up message and raise the MouseUp event passing the correct parameters.
With a bit more work you may be able to use a flag to allow/disallow MouseUp messages to supress the erroneous one that you are getting.
public class FixedListView : ListView
{
private const int WM_LBUTTONUP = 0x0202;
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_LBUTTONUP)
{
Point point = new Point(((int)m.LParam) & 0x0000FFFF, (int)m.LParam >> 16);
OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, point.X, point.Y, 0));
return;
}
base.WndProc(ref m);
}
}
WM_LBUTTONUP Message[^]
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.(Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
Thanks for the proposed semi-solution. I put together different pieces and came up with this solution which seems to do what I want First, I leave the MultiSelect property set to false and set FullRowSelect to true . Then I use this code:
public class CustomListView : ListView
{
public CustomListView()
{
InitializeComponent();
}
bool fakeMouseUp = false;
bool mouseDownOnItem = false;
protected override void OnMouseDown( MouseEventArgs e )
{
mouseDownOnItem = HitTest( e.Location ).Item != null;
Debug.WriteLine( "OnMouseDown" );
base.OnMouseDown( e );
}
protected override void OnMouseUp( MouseEventArgs e )
{
if( mouseDownOnItem || fakeMouseUp )
{
Debug.WriteLine( "OnMouseUp" );
mouseDownOnItem = false;
fakeMouseUp = false;
base.OnMouseUp( e );
}
}
protected override void WndProc( ref Message m )
{
if( !mouseDownOnItem && m.Msg == 0x0202 )
{
fakeMouseUp = true;
Point point = new Point( ((int) m.LParam) & 0x0000FFFF, (int) m.LParam >> 16 );
OnMouseUp( new MouseEventArgs( MouseButtons.Left, 1, point.X, point.Y, 0 ) );
}
base.WndProc( ref m );
}
}
But I always have a feeling of wasted time when I need to do such workarounds for weird .NET behaviour. Why on Earth do I get a MouseUp event when the mouse button was not physically released?
|
|
|
|
|
Hello
I need help in editing a datagridview's row.
I have a grid which is dynamically populated in a way that user adds some data in the form of rows.
Now, I want to give the user the option to edit the row as well. I want to provide the functionality just like asp.net's editable gridview. that is, i want that when a user click on a cell to edit it, a dropdown should be displayed containing selected values. I also want that user may have a cell with text 'edit' and user should click that to start editing the row. as soon as the user click the 'edit', the text should be changed to 'update'.
Please guide me for it.
saq!b
"Our scientific power has outrun our spiritual power. We have guided missiles and misguided men."
Dr. Martin Luther King Jr.
|
|
|
|
|
Look into DataGridViewComboBoxColumn and DataGridViewButton column. That must suite your needs.
|
|
|
|
|
thanks danish.
i was just looking into DataGridViewComboBoxColumn. please tell me if it is possible to change the column type of a row at runtime?
saq!b
"Our scientific power has outrun our spiritual power. We have guided missiles and misguided men."
Dr. Martin Luther King Jr.
|
|
|
|
|
Set the DisplayStyle property to nothing for the combobox column. HTH.
|
|
|
|
|
can you write the syntax here plz?
saq!b
"Our scientific power has outrun our spiritual power. We have guided missiles and misguided men."
Dr. Martin Luther King Jr.
|
|
|
|
|
Hi,
Go through this code........
<asp:GridView ID="gv" runat="server" AutoGenerateColumns="False"
BackColor="#CCCCCC" BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px"
CellPadding="4" CellSpacing="2" ForeColor="Black" Height="285px"
onrowcancelingedit="gv_RowCancelingEdit" onrowdeleting="gv_RowDeleting"
onrowediting="gv_RowEditing" onrowupdating="gv_RowUpdating" Width="493px">
<FooterStyle BackColor="#CCCCCC" />
<RowStyle BackColor="White" />
<Columns>
<asp:BoundField DataField="Name" HeaderText="Item Name" />
<asp:TemplateField>
<HeaderTemplate>
<asp:Label ID="lblHead" runat="server" Text="Price"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblPrice" runat="server" Text='<%#Eval("Price")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="ddl1" runat="server">
<asp:ListItem>1000</asp:ListItem>
<asp:ListItem>2000</asp:ListItem>
<asp:ListItem>3000</asp:ListItem>
<asp:ListItem>4000</asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
</asp:TemplateField>
<asp:ButtonField DataTextField="Description" HeaderText="Desription" />
<asp:CommandField ShowCancelButton="true" ShowDeleteButton="true" ShowEditButton="true" />
</Columns>
<PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />
<SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
</asp:GridView>
|
|
|
|
|
i found a solution for invalidoperation in net , force handle to create. but i get the exception still.
let me explain the situation
in Form A ,in the constructor i call a method named startmodule(), in this method it invokes a static delegate that is in From A ,from a separate thread. so in the Form A constructor i called this.handle
as the first step, but still i get the exception any idea about what is wrong..!
thanx in advance.
|
|
|
|
|
While inside a Form constructor, the Form does not yet exist. Can't you postpone your failing stuff to some later point, say the Load event or even maybe the Shown event?
|
|
|
|
|
I would recommend moving the call to startmodule() out of the constructor and into the form's OnLoad() method. Do you work after the base.OnLoad() call, and I expect you'll find things work properly.
|
|
|
|
|
I don't know if this is relevant to your situation (but you may find it useful sometime even if not), you can force the handle to be valid inside a constructor by getting the value of the Handle property i.e.
public FormA()
{
IntPtr handle = Handle;
}
More info here[^].
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.(Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
modified on Tuesday, August 24, 2010 3:37 PM
|
|
|
|
|