|
dandy72 wrote: what criteria establishes it "running remote
Either the user is sitting in the office attached (either wired or wireless) to the LAN, or is outside the office not connected to the LAN. If someone where to remote in then they would by nature be "on the LAN".
For example, if I installed the app onto my laptop and was using it at the office I would plug into the LAN and be connected "in office".
Now I go home and take my laptop with me. I connect to my wireless through my router and my IP provider, so now I'm actually "remote".
What it comes down to is this - can I copy a file to the network, or do I need to FTP it in?
If it's not broken, fix it until it is
|
|
|
|
|
Sounds to me like you just need to verify whether the machine you're trying to copy files to is reachable at all or not...no?
If you can reach a file share, then you're all set...otherwise, fall back to FTP, or whatever other mechanism you'd normally use under those circumstances.
Do you need to take any special consideration if you're connected via VPN?
|
|
|
|
|
dandy72 wrote: Sounds to me like you just need to verify whether the machine you're trying to copy files to is reachable
Exactly. I had thought of trying
string AppFolder = @"P:\somefolder";
bool isOnLan = Directory.Exists(AppFolder);
But what if someone who was NOT really connected created a mapping with the same name.. then my app no longer works.
I think I need a more reliable way.
As far as VPN.. I hadn't thought of that.
There's got to be a way to identify the network I'm physically attached to.
If it's not broken, fix it until it is
|
|
|
|
|
Check this out:
I just ran the following:
string name1 = System.Net.Dns.GetHostName();
string name2 = Environment.UserDomainName;
string name3 = System.Net.Dns.GetHostEntry("").HostName;
At my office name1 is the PCName, name2 is the NetworkName and name3 is PCname.NetworkName
At home all 3 are the PCName
This clarifys the problem... I need a reliable way to determine if client is on the network.
If it's not broken, fix it until it is
|
|
|
|
|
Interesting.
So if you're at home, but your laptop is connected to the office network (via VPN or whatever), are you getting the expected results?
Off-topic: I've been working with PowerShell lately, and I must say I like the ability to call anything from .NET right from a command prompt. I was able to run all 3 of your calls without firing up VS...(yeah, I know, welcome to a few years ago...)
|
|
|
|
|
No, I ran those lines of code in my app at my office.
I then TeamViewered into my home PC and ran the same against my home network (Win 7 pro on a home LAN. My server is Win Server 2013)
Two entirely different networks. I just wanted to see what that code would return. But the fact that at home I get the same results from all 3 functions bothers me.
If it's not broken, fix it until it is
|
|
|
|
|
Is LOGONSERVER (the environment variable) of any use? Can you look for an AD server?
|
|
|
|
|
I have downloaded the source code of {
Open Source Extensible Enterprise n-tier Application Framework with Multilayered Architecture
} I have open it in visual studio it compiles well and giving no error when i run the application it gives me error
"
No connection could be made because the target machine actively refused it 127.0.0.1:13000
please help me to configure this project into my laptop.
modified 14-Feb-16 3:04am.
|
|
|
|
|
You should post your question in the forum below the article so the author can help you.
|
|
|
|
|
|
Hi,
I'm using System.Windows.Forms.DataVisualization.Charting in WindowsForms (C#). I'm looking for a solution to show only whole numbers on the X-axis (time-axis) in a dynamically (every 100ms) updated chart.
Every time-step data is added to the chart (and old data is removed), so the labels on the x-axis should dynamically "move" form the right to the left. But I want only see whole number e.g. 4, 5, 6. Of course, the first and last label can not be placed at the min and max of the axis. And, I do not want to see a first label like 4.3!
Would this be possible? Does anyone have a solution for this problem?
Thanks in advance!
CJ2010
|
|
|
|
|
DataPointCustomProperties.LabelFormat
Gets or sets the format of the data point label.
You can set this property in the designer via the Series Collection Editor (on the chart "Series" collection property).
|
|
|
|
|
hey everyone , i am actually trying to implement an algorithm in which missing values of a datagrid is to be identified and if there is an empty cell that whole row will be compared to the all next rows and it will be checked that which row is highly matched to the row which is having missing cells . and that missing cell will be assigned the value of that matching rows same cell.for example if following is the data
name class age
ain 3 45
jow 4 48
3 45
goerge 5 42
ain 40
result:
ain 3 45
jow 4 48
ain 3 45
goerge 5 42
ain 3 40
i have done the coding till finding the missing values . hope anyone help with the rest
|
|
|
|
|
Step 1: Define the minimum requirements a row must meet to be considered a match. E.g. Do the names have to be equal? Or do both names converted to lower or upper case have to be equal? Or does one name have to be contained in the other? Do the numeric values have to be in a certain range of each other?
Step 2: Define a scoring-function that calculates the matching-score of a row to the row with missing values. E.g.: initial score = 0. Names are equal? -> score=score+100. Names are "lower-case-equal"? -> score=score+80. Numeric values of column X are equal? -> score=score+50. Numeric values of column X are within a certain (absolute or relative) range of each other? -> score=score+30. (Values are totally made up, you need to find values that make sense for your data, only you know what's important there.) Or, for numeric columns: score=score+Math.Abs(value1-value2)
Step 3: For each row (except the one with missing values): If it meets the minimum requirements for a match calculate the matching score. If it's higher than the last one calculated, "memorize" the row-object in a variable and update the variable for the highest-score-so-far.
Step 4: Write the values of the found best matching row that are missing in the row for which you did all this to the same.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
modified 12-Feb-16 16:36pm.
|
|
|
|
|
hey there thanks for your help but i am new to C# and getting the first missing and matching with all other record ad so n i becoming really difficult to code. even if i focus of missing cells .
|
|
|
|
|
Please use the "Reply"-link below a reply (my answer in this case) to respond to it. Here you replied to your own question and I didn't get notified of it.
Please show the code you have to far and I'll try to help you.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
In my current project I have to look up a lot of objects by their name. In order to make this "semantically type-safe" I thought of wrapping the name-strings in semantic types for the different types of those objects. I haven't seen this done in any other project yet, only with semantic types for strings that for human understanding actually present a specific type of entitiy, like email addresses, phone numbers etc. and then also encapsulate the functionality to ensure that the string is semantically valid. In my case I would just need something like this:
class NameOfSomeType
{
public readonly string Name;
public NameOfSomeType (string name) { Name=name; }
}
As I haven't seen something like this done anywhere yet I would like to ask for your opinion of this.
Sascha
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Sounds like a good idea to me.
Would it make sense to use a struct rather than a class ? That way, you'd have less memory overhead and GC churn.
I'd be inclined to use a read-only property instead of a field, but only because it "feels" cleaner.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard Deeming wrote: Would it make sense to use a struct rather than a class ? That way, you'd have less memory overhead and GC churn. The types for which I would use these semantic name types belong to a type hierarchy and are polymorphically used in several places; so with structs I would probably have to have several new method overloads which I could prevent with classes (and sub-classes) instead of structs. Also I'm guessing that the performance degradation will be insignificant because although those name lookups happen at a lot of places it's anything but the "main business". I'll probably profile both ways
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Opinion on how to do it or opinion if it is worthwhile and valid?
|
|
|
|
|
RugbyLeague wrote: Opinion on how to do it or opinion if it is worthwhile and valid? The latter. As I haven't seen this done anywhere yet I thought maybe I'm missing something which is why it's not being done.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
If you think it will bring something to your code - compile time checks etc. then go for it.
|
|
|
|
|
There are several articles here on CP about using Semantic Types in .NET. You might want to take a look at some of these[^] (I have read the first three articles before and they are all really enjoyable).
This space for rent
|
|
|
|
|
I've read those (more or less thoroughly) - what made me ask my question anyway is the fact that those articles deal with semantic types for "real world entities" (ZipCode, EmailAddress, etc.) including conversions or validity checking or formatting - while I would just need a surrogate for something like
typedef string NameOfSomeType
for application-internal use only.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Addressing the requirement of looking up "object type names":
class Program {
private static List<Type> _types = new List<Type>();
static void Main( string[] args ) {
_types.Add( typeof( DateTime ) );
_types.Add( typeof( int ) );
_types.Add( typeof( bool ) );
double d = 1.0D;
Register( d );
int index = _types.IndexOf( d.GetType() );
Console.Write( index );
Console.ReadKey();
}
static void Register( object o ) {
_types.Add( o.GetType() );
}
}
|
|
|
|