|
I'm looking for an C# API, subscription-based service, or database that will allow me to pass a zip or city/state/zip with a distance parameter i.e. ("redmond","wa","98052",20) and get back the surrounding cities within the specified distance, without getting into some kind of gps coding nightmare. Does anyone know of such a thing?
Cliff Robinson
|
|
|
|
|
cliffr wrote: Does anyone know of such a thing?
SQL Server 2008? (The functionality got released last week in CTP5)
|
|
|
|
|
How would I publish and deploy a program that has DirectX references and how to do this in general?
- I love D-flat!
|
|
|
|
|
By shipping the DirectX runtime installer with it and making sure that any interop dlls that get build with your proejct are included.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi All,
What is the design pattern (Interfaces?) to use in C# for a object Factory?
Thanks,
Jeff
|
|
|
|
|
Err... the design pattern to use is the Factory Pattern, if you want to use the Factory Pattern, that is...
As to the how to, I've found this a worthwhile (if not free) resource:
http://www.dofactory.com/Patterns/PatternFactory.aspx[^]
"On one of my cards it said I had to find temperatures lower than -8. The numbers I uncovered were -6 and -7 so I thought I had won, and so did the woman in the shop. But when she scanned the card the machine said I hadn't.
"I phoned Camelot and they fobbed me off with some story that -6 is higher - not lower - than -8 but I'm not having it."
-Tina Farrell, a 23 year old thicky from Levenshulme, Manchester.
|
|
|
|
|
Hi Martin,
Thanks. It's been too long since I had a Design Patterns class (and I cannot find the text book from college).
In the examples, it seems Main() must know 'a priori' what classes to instaniate. Is this knowledge included in the Factory, or is this a poor example?
Perhaps if I briefly explain my problem domain, it will help cut to the chase.
Jeff
I parse a flat text file. Each token will become a distinct object. So I would like to:
Token t = NextToken()
Object o = Factory.CreateObject(t) o will then be Type1, Type2, Type3, etc. Factory::CreateObject would be a message cracker:
if( t.field = 1 ) { return new Type1(t); }
...
if( t.field = n ) { return new TypeN(t); }
|
|
|
|
|
Hey Jeff,
I had to have a good long think about what you're trying to do (I'm no pattern guru myself, which is why I recommend DoFactory) and came accross this article which might prove useful:
http://www.codeproject.com/cs/design/csdespat_4.asp[^]
and this one:
http://www.codeproject.com/useritems/BuilderPattern.asp[^]
"On one of my cards it said I had to find temperatures lower than -8. The numbers I uncovered were -6 and -7 so I thought I had won, and so did the woman in the shop. But when she scanned the card the machine said I hadn't.
"I phoned Camelot and they fobbed me off with some story that -6 is higher - not lower - than -8 but I'm not having it."
-Tina Farrell, a 23 year old thicky from Levenshulme, Manchester.
|
|
|
|
|
I have a problem where I've got a large amount of nested if statements.
they were all working and executing the correct numbe of times until I added some loops at the start.
The debugger is showing that it executes the first section and then starts again without going to the next condition. I know I have to change the condition maybe. This is the first section that gets executed continuously. Obviously there will always be rows, but the rest of conditions say, if checkedbox is ticked, or combobox is selected bla bla, so I can't see why (if I select a combobox item and click search, it is not executing). Is there a way of telling the code that you want to end the loop after all the entries in the database have been covered? Make sense?
foreach (DataRow row in dsapps.Tables[0].Rows)<br />
{<br />
<br />
if (row["EmployeeID"].ToString().Equals(EmployeeID.ToString()) == false)<br />
{<br />
if (EmployeeID > 0)
|
|
|
|
|
Missing a curly brace somewhere? How about an errant ";"?
"On one of my cards it said I had to find temperatures lower than -8. The numbers I uncovered were -6 and -7 so I thought I had won, and so did the woman in the shop. But when she scanned the card the machine said I hadn't.
"I phoned Camelot and they fobbed me off with some story that -6 is higher - not lower - than -8 but I'm not having it."
-Tina Farrell, a 23 year old thicky from Levenshulme, Manchester.
|
|
|
|
|
Thanks yes I worked it out. It was just a silly curly brace. i wasn't missing one as such, I just had to move them around.
Wasn't worth the question. Sorry about that.
|
|
|
|
|
falles01 wrote: It was just a silly curly brace. i wasn't missing one as such, I just had to move them around.
Wasn't worth the question. Sorry about that.
Don't worry about it. There has been many a time I've sat in front of a compiler in despair at the apparently cryptic error message only to discover after I've asked someone else to have a look they spotted in seconds the missing semi-colon or some such trivial detail.
|
|
|
|
|
As Colin says - easy mistake to make.
"On one of my cards it said I had to find temperatures lower than -8. The numbers I uncovered were -6 and -7 so I thought I had won, and so did the woman in the shop. But when she scanned the card the machine said I hadn't.
"I phoned Camelot and they fobbed me off with some story that -6 is higher - not lower - than -8 but I'm not having it."
-Tina Farrell, a 23 year old thicky from Levenshulme, Manchester.
|
|
|
|
|
Hi,
I need to generate release notes from code, but if I use XML comments to let the parser generate the html for me the notes will keep adding up. Is there a way to tell the parser to parse only the tags that have a certain value? Something like: if I want the release notes for today's build, I want to parse only the tags that have today's date as a value.
If this is not doable, is there any other way of getting release notes from code without keeping a separate document that someone would have to manually update after each build?
thanx
|
|
|
|
|
|
Alright, moving along to next post
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi, I am a an absolute novice to C# and have just about managed to get my first(simple) project off the ground. I am now trying to populate a listiew on a form from data retreived from Sql server in another class but I just get the message The listview does not exist in the class or namespace.
If I place the code in the form it works but not in a different class can some help please?
regards
kenwen
|
|
|
|
|
The ListView control has to be placed on a form. The class for the form is therefore aware of the existence of the control. This is why you can write code that references the control in the form's code-behind file. However other classes you create don't know anything about the ListView control unless you pass an object reference to it in one of its properties or methods.
I'm not sure what you are trying to do. Perhaps if you posted a bit of your code your requirements might make more sense.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Thanks Paul, Here is the bit of code that opens SQL and the recordset
using System;
using System.Data.SqlClient;
using System.Windows.Forms;
namespace LoomScheduler
{
///
/// Summary description for LoadLooms.
///
public class LoadLooms
{
private System.Data.SqlClient.SqlDataReader SqlReader;
public LoadLooms()
{
SqlConnection myConnection = new SqlConnection("user id=username; password=sa;" +
"server=Brintons_NT03; Trusted_Connection=yes; database=LoomSchedules; connection timeout=30");
SqlCommand LoadLooms = new SqlCommand("Select LoomNo, Type," +
"ShortType From tblLoomMastShortVersion Where Plant = '12'" +
"Order By ShortType, LoomNo",
myConnection );
cnSchedule.Open();
SqlReader = LoadLooms.ExecuteReader();
while(SqlReader.Read())
{
ListViewItem lvi = new ListViewItem();
lvi.Text = (SqlReader["LoomNo"].ToString());
// Here I want to add each record to a listview called lvTopLooms on a form called frmMain
//lvTopLooms Items.Add(lvi.Text);
}
}
}
}
|
|
|
|
|
As I previously explained, you need to pass a reference to your ListView control to your class. Change the declaration of your constructor to:
public LoadLooms(ListView lvTopLooms)
and pass a reference to your control from the code in your form that instantiates LoadLooms .
Your code looks a bit odd though. I'm don't think it's good practice to pass references to controls around to other classes. It would probably be better if your class simply provided a method to retrieve data from your database. Your form class could then call this method to get the data to populate the ListView control and you would'nt have to pass a reference to this control anywhere. Also, you're doing stuff in the class constructor that would be better suited to being placed in a method. The class constructor should really only be used for the initialization of variables, resources etc.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Thanks Paul,
I think I see how it works also thanks for the other tips
Kenwen
|
|
|
|
|
when it release ?
(not the beta or the expres)
|
|
|
|
|
I currently sell the beta and express versions for a astronomicalreasonable fee. The full versions are available from Microsoft.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
Right now, only for MSDN subscribers to download, I thought.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Did they stop selling MSDN subscriptions? :p
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|