|
You can't just give him permission to proceed like that!
He hasn't even got a form 37/B/14 countersigned by Accounts yet!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Crap. I forgot, it's all about the red tape!
|
|
|
|
|
I have a file copy app. I need to determine if the app is running in-house (over the LAN) or is the client running remote.
What's the best way to determine this?
Thanks
If it's not broken, fix it until it is
|
|
|
|
|
We usually query the domain name of the current logged in user.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
That'll work...
Thanks!
If it's not broken, fix it until it is
|
|
|
|
|
I'm getting back the Machine Name of my dev PC. What about using Workgroup name?
If it's not broken, fix it until it is
|
|
|
|
|
As long as it is not named "workgroup"..
Wouldn't use it as a security-feature though.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I'm not sure I fully understand the question. From the perspective of your app, what criteria establishes it "running remote"? Different domain (as has already been suggested), different subnet, different AD server, or something else altogether? Or just "any" remote machine (in which case SystemInformation.TerminalServerSession might do)...?
Incidentally, I came here to ask a similar (but not identical). As I don't want to hijack your thread, I'll start a new one...
|
|
|
|
|
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
|
|
|
|