|
Gee, all I did was take the formula you were using, and write a C# test app, making sure to include the greater Antwerp region to make sure the results made sense, and they did to me.
I had to look on the map to find and see relative position of Paradise and San-Diego, and I accepted the outcome. But then for me zero degrees has always pointed to the right, as with a protractor[^] (another word I learned todsy).
If you want to see an article on the subject, I suggest we work together; maybe you could do text and images, I could take care of coding and downloads (I could proofread too, finding most typo's, but I trust you would be better as far as vocabulary, grammar and style go).
|
|
|
|
|
Well, yeah I do have a different meaning to fix something.
I would be willing to do the wording, and put in the final code.
All articles I saw about converting to the range I needed said to use a form of a modulus operator, but NONE of them took into account that the modulus operator required integer operators.
Reminds me of years ago, I wanted to write a screen saver but all the code out there fell on it's face, and then I wanted to write one that worked on multiple monitors. The existing examples were not compilable or incomplete.
So I wrote one in C# under Visual Studio that worked with 2003, or 2005 with no mods. Folks loved it, as far as I know it's the best out there. You can replace my functions with your own graphics functions and plug it right in and go.
I spent weeks trying to iron out a problem where the screen saver would just mysteriously lock up. I finally got it fixed and then a windows update caused it to come back again.
I was not willing to go revisit the thing and go through weeks of hell, where the thing might crash immediately or crash in 2 days of constant running.
If you are curious it should be among my articles. I put it on Code Project a few years ago.
Been there, done that, forgot why!
|
|
|
|
|
Hi Garry,
I did send you an email message several days ago trying to get in touch with you directly, but since the CP email is not working reliably again, I now suggest you create a geodesic problem solvers group, which I could join, so we can collaborate on the article.
Groups are a new feature on CP, I don't know exactly how it works, but we'll see...
Regards,
Luc Pattyn [Forum Guidelines] [My Articles]
I use ListBoxes for line-oriented text output (not TextBoxes), and PictureBoxes for pictures (not drawings).
modified on Friday, June 10, 2011 12:32 PM
|
|
|
|
|
Garry Freemyer wrote: don't be too fast to try to fix it
"to fix" seems to have a special meaning with you
Luc Pattyn [Forum Guidelines] [My Articles]
I use ListBoxes for line-oriented text (not TextBoxes), and PictureBoxes for pictures (not drawings).
modified on Friday, June 10, 2011 12:32 PM
|
|
|
|
|
I am trying to to do a similar thing in C# (don't worry I am also a C++ developer).
Did you managed to work this out.
I actually need to plot a point on a line given the start point and distance. I also happen to know the end point.
Therefore I should be able to calculate the bearing between to points, then use this bearing, distance and start point to work out the lat long.
However I am stuck working out the bearing!
Can you help?
|
|
|
|
|
Please can some one help me how to split a single mp3 file into 2 or 3 mp3 files??
Thanx
Noor
|
|
|
|
|
Simply speeking, search BinaryReader and BinaryWriter in MSDN, you will find what you want.
I Love KongFu~
|
|
|
|
|
You decompress the mp3 data into an array of samples, split the samples, and compress each as new mp3 files.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi all, I'm new to socket programming and need help with an error.
I'm coding a project that will send Hex bytes to a comm port on a network. So far I can connect and send the correct values to the comm port no problem but when I hit the disconnect Button I get a "Program has encountered a problem and needs to close" message.
I've posted my code below, if anyone can please help I would be extremely grateful.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Net.Sockets;
namespace AsyncTcpClient
{
public partial class Form1 : Form
{
private Socket client;
private byte[] data = new byte[1024];
private int size = 1024;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void connectButton_Click(object sender, EventArgs e)
{
string ipAddress;
ipAddress = ipAddressTextBox.Text;
connStatusTextBox.Text = "Connecting ...";
Socket newsock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IPEndPoint iep = new IPEndPoint(IPAddress.Parse(ipAddress), 49510);
newsock.BeginConnect(iep, new AsyncCallback(Connected), newsock);
}
private void disconnectButton_Click(object sender, EventArgs e)
{
client.Close();
connStatusTextBox.Text = "Disconnected";
}
private void Connected(IAsyncResult iar)
{
client = (Socket)iar.AsyncState;
try
{
client.EndConnect(iar);
connStatusTextBox.Text = "Connected to: " + client.RemoteEndPoint.ToString();
client.BeginReceive(data, 0, size, SocketFlags.None, new AsyncCallback(ReceiveData), client);
}
catch (SocketException)
{
connStatusTextBox.Text = "Error connecting";
}
}
private void ReceiveData(IAsyncResult iar)
{
Socket remote = (Socket)iar.AsyncState;
int recv = remote.EndReceive(iar);
string hex1 = BitConverter.ToString(data, 0,recv);
resultsRichTextBox.Text = hex1.ToString();
if (hex1 == "50-01")
{
label01.BackColor = Color.Green;
label02.BackColor = Color.Red;
label04.BackColor = Color.Red;
}
else if (hex1 == "50-02")
{
label02.BackColor = Color.Green;
label01.BackColor = Color.Red;
label04.BackColor = Color.Red;
}
else if (hex1 == "50-04")
{
label04.BackColor = Color.Green;
label01.BackColor = Color.Red;
label02.BackColor = Color.Red;
}
else if (hex1 != "50-01" || hex1 != "50-02" || hex1 != "50-04")
{
label04.BackColor = Color.Red;
label01.BackColor = Color.Red;
label02.BackColor = Color.Red;
}
}
private void SendData(IAsyncResult iar)
{
Socket remote = (Socket)iar.AsyncState;
int sent = remote.EndSend(iar);
remote.BeginReceive(data, 0, size, SocketFlags.None, new AsyncCallback(ReceiveData), remote);
}
private void sendButton_Click(object sender, EventArgs e)
{
byte[] message = Encoding.ASCII.GetBytes(enterTextTextBox.Text);
enterTextTextBox.Clear();
client.BeginSend(message, 0, message.Length, SocketFlags.None, new AsyncCallback(SendData), client);
}
private void sendIntButton_Click(object sender, EventArgs e)
{
String toHex;
toHex = intTextBox.Text;
int NumberChars = toHex.Length;
byte[] bytes = new byte[NumberChars / 2];
for (int i = 0; i < NumberChars; i += 2)
{
bytes[i / 2] = Convert.ToByte(toHex.Substring(i, 2), 16);
}
Byte[] message = bytes;
intTextBox.Clear();
client.BeginSend(message, 0, message.Length, SocketFlags.None, new AsyncCallback(SendData), client);
}
private void timer1_Tick(object sender, EventArgs e)
{
}
}
}
|
|
|
|
|
SALAM SIR;
HOW ARE YOU?HOW CAN EASY LEANING VISUAL STUDIO .NET 2005 OR 2003?PLEASE HELP ME
AND ANY ONE PROGRAMMER HELP ME ONLINE IN YAHOO MESSENGER
MY ID IS mohammedali1989@yahoo.com
how can made clinic project in c#.net?please send me coding of clinic project in visual studio .net 2005 or 2003?
thanks sir you are great man.
mohammedali
|
|
|
|
|
...
"Well, we're getting "F"'d at work. WPF, WCF, and WWF... WTF?" --John Simmons
|
|
|
|
|
So, you want to write a rather complicated piece of software, having no experience in .NET?? And, you want to learn programming, having someone walk you through everything over Yahoo Messenger?? Is that correct??
|
|
|
|
|
this.bindingcontest[dataset,"datamember].postion++;
is it true to go from one record to the next record
thanks;
|
|
|
|
|
Sorry, I just didn't understand your question.
|
|
|
|
|
i am used the wizered to load and show the data from the data base
by drag and drop the table from dataset
and as you know all the control added to the form
i dont want to use nivagater the added automaticaly
i want make button for next,privious,move end ,move start
how can i make it
|
|
|
|
|
abu rakan wrote: I want [to] make button for next, previous, move end, move start
Start by putting buttons on your form.
Give the buttons proper IDs so they can be identified easily in code.
Double click each button will generate a code stub for handling the button event.
By the way, is this a Web application or a Windows application?
|
|
|
|
|
Neither could I, I think he wants to move around in a table, but I have no bloody idea.
|
|
|
|
|
Basically yes. From: BindingManagerBase.Position Property [^]:
Use the Position property to iterate through the underlying list maintained by the BindingManagerBase. To go to the first item, set the Position to 0. To go to the end of the list, set the Position to the value of the Count property minus 1.
The PositionChanged event occurs when the Position property value changes
|
|
|
|
|
thanks
i tried to use inside the button next
this.bindingcontext[dataset,"name of the table"].postion++;
but an error was occured
and thanks
|
|
|
|
|
What was the error?
Most likely you have to use:
this.BindingContext[dataset,"table.column"].Position++;
Also this should refer to an object which is bound to the dataset you use (textbox, label etc).
|
|
|
|
|
Folks,
I have a sharepoint site with a list of servers to which I occassionally need to RDP (remote desktop). I can't get my Sharepoint admins to provide me a web part that will let me just click on the DNS and automatically launch the RDP session with the destination filled in.
So, what I'm looking for is advice on how to import and read the server list, so I can pick my application, environment (dev, cert, prod, etc), function (webserver, app server, db server), and so forth.
I'd prefer not to have to export my data from sharepoint periodically. This app should read it from the live site. Would it some sort of DB connection to Sharepoint? Or flat file? ANyone done stuff like this?
I appreciate your assistance! --pip
|
|
|
|
|
Not completely want you want but this[^] shows how to connect to a SharePoint site and access the list.
only two letters away from being an asset
|
|
|
|
|
Hello I am looking for how to insert a page break in msword using C#. what I need is i have a textfile i want to read the textfile line by line and send it to one table i am able to do that one and then i want to fetch the data from that table and export to word up to this i can achieve it but what i need when ever i found certain text (ex:- programme ) and i need a page break and start on new document . I am not getting any idea i am searching in google but no luck could any one give us some example greatly appreciated. i am putting my code how i am exporting to ms word . I made a dll for word this is my code on button click
public void Exporttoword_Click(object sender, EventArgs e)
{
WORDDLL.WORDDLL wordApp = new WORDDLL.WORDDLL();
//Microsoft.Office.Interop.Word.Application Word = new Microsoft.Office.Interop.Word.Application();
//Microsoft.Office.Interop.Word. Word = new Microsoft.Office.Interop.Word._Document();
DataSet ds = SelectScAppRepository();
string sbContent = "";
sbContent = wordApp.Exporttoword(ds);
Response.Clear();
Response.AddHeader("contentdisposition", "attachment;filename=FileName.doc");
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.word";
Response.Write(sbContent.ToString());
Response.End();
}
THIS IS MY DLL CODE:-
using System.Configuration;
using System.Web;
using System.Data.OleDb;
using System.IO;
using System.Data.OracleClient;
using System.Text;
namespace WORDDLL
{
public class WORDDLL
{
public String Exporttoword(DataSet ds)
{
System.IO.StringWriter excelDoc;
// if (File.Exists(fileName)) File.Delete(fileName);
excelDoc = new System.IO.StringWriter();
StringBuilder sbContent = new StringBuilder();
for (int x = 0; x < ds.Tables[0].Columns.Count; x++)
{
sbContent.Append(" " + ds.Tables[0].Columns[x].ColumnName + " ");
}
sbContent.Append(" \r\n");
//Insert the page break.....when it read CUSTOMER SERVICE WORKSHEET
for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)
{
for (int j = 0; j <= ds.Tables[0].Columns.Count - 1; j++)
{
sbContent.Append(" " + ds.Tables[0].Rows[i][j].ToString() + " ");
}
sbContent.Append("\r\n");
}
return sbContent.ToString();
}
}
}
|
|
|
|
|
check out this[^] article, it shows how to do page breaks and lots of other stuff using Word automation (which you have commented out at the top of your button handler)
|
|
|
|
|
After a discussion yesterday I'm playing around with the idea of a Singleton 'Notifier' class that can be subscribed to application wide. To make this more useable by allowing any type to be passed in event args, I figured generics would be a good idea. The genric TEventArgs<T> : EventArgs is set up and working fine
A generic class for the singleton is not possible as then the instance would be tied to a single type so I've got a generic method that in turn calls
protected virtual void OnNotify<T>(TEventArgs<T> e) { }
Because the class itself isn't generic, I can't figure out how to create a generic event
public event EventHandler<TEventArgs<T>> Notification;
as T isn't yet defined of course. Is there a way?
Failing that, is it possible to raise a specific event that has the type hard coded
(e.g. public event EventHandler<TEventArgs<int>> Notification )
based upon the type of T in the OnNotify method and use the e parameter?
I could be barking up the wrong tree here but I'm sure it should be possible!
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|