Design-time alternatives to a GUID? [closed] - c#

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
This isn't a complicated question. I was just thinking through best practice and thought the community might be able to help.
SOLUTION
Have one file that contains an enumeration. Source control can take care of collisions between multiple projects / developers. If all assemblies are compiled and deployed at the same time, the ID will be unique (if cast to int). Alternatively, we could assign a number to each enum. The enum file will be added to each project via "Add As Link".
Original question
I'd like a unique id that begins at one, is set at design time, and is easy to implement in code to identify different classes. In Visual Studio, we have a Tools / Create GUID. That's convenient, but at 16 bytes it's a little larger than I'd like.
It'd be nice to able to retrieve unique sequential integers from a web service.
Has someone already done this? Does such a service already exist?
One alternative is to have a file that acts as a central register for developers... but I'd rather not if possible. It would be nice to have two steps: 1. create class, 2. assign id. Done.

You can create this yourself if you want, make a web service and generate numbers. If you generate the number at design time, alter your code at design time so that no other program cares what your magic number is.
GUIDs can be created relatively quickly on anyone's computer. This means that you don't have to have some "central" database for numbers, which assists performance of certain applications. Otherwise, use the GUID, which is a globally unique identifier that you can generate at run time and design time.

Related

Reverse engineer c# into a format that can be imported to LucidCharts [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I am trying to come up with a way to import our current large application into a UML diagram for LucidCharts. LucidCharts supports a vdx XML format from visio. I'm just mainly trying to find a way to do this easily instead of typing each class name and method into LucidCharts. Linking and call chain linking I don't care about as much as I can do that myself.
Are there any easy solutions, or something I can do to read the meta data and make a vdx complaint file?
Actually, there are several open source & commercial tools that will create UML diagram from the C# project and visa-verse. As example, i will try to list three of them:
Option #1: Try to use the Modelmaker. It can work with both Delphi and C#.
I should add that it does more than just diagrams, it can be used for reverse engineering, refactoring and the like. It's been going for a while now and has many great features.
Option #2: You may also try NDepend tool for .NET developers. It comes with both a dependency graph and a dependency matrix and integrates in VS. The graph and matrix can be generated from .NET assemblies and they are interactive. You can download and use the free trial edition for a while and make your own opinion.
Option #3: The Guys at Tigris.org have also done some work on this.
Here is the Open Source Link to the project. It is also very impressive.

How to deal with multiple xml standards? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I am attempting to write a local set of wrapper classes into our institution API (I work at a post secondary institution). The purpose of these classes are to securely pull transcripts from a remote service, and to allow the abstraction away from how that service works to our programmers. How the service works is confidential however the question I need an answer too is this:
How to deal with this when each transcript response comes in a different xml format depending on which of the schools it comes from. There are over 30.
As an example: Institution A has the tag, at the top of the document near the root, for GPA of a student to be |GPA|4.0|/GPA| whereas another institution might have it in a completely different part of the XML, near the bottom and perhaps 3 children deep, and name the tag |GradePointAverage|4.0|/GradePointAverage| (Pretend | is xml angle brackets)
Any suggestions how to deal with this lack of standardization?
It sounds like you should aim for one common data model, and then 30 different classes which are able to deserialize from XML to that data model. Depending on exactly how different they are, there may be significant aspects of reuse, and you may even be able to parameterize some differences. Using LINQ to XML makes it reasonably easy to parse any one format.
I would aim for lots of simple code rather than a small amount of "clever" code: parsing each individual format should be reasonably straightforward, and hopefully easy to test. Yes, it'll be tedious to write this code, but it should end up being easy to follow, and easy to add more formats if you need to.
You could use XSLT to perform a transformation into a single format of course, but personally I'd rather write C# :)
This assumes you can create a common data model - if the formats are very different, you may find that you can't accurately represent the data in each file without having a horrible lowest-common-denominator. Coming up with a good data model is likely to be as hard as writing each individual parser.

How to make a form simulate a desktop [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Right, this "might" be a tough one, as I do not even know where to start with this.
Ok, I am working on a program, which can load visual studio solutions and display them within a form when debugging.
Actually, the program does a whole lot more, but what it does, is strictly classified, so I can not go into that.
Anyway, whatever it does, does not matter in this case.
Here is the plot:
You create a project in visual studio, but when you debug it, it does so on your desktop.
What I need it to do, is debug it within a form, effectively acting as a desktop with a different resolution.
So if the specific program for example, uses Screen.PrimaryScreen.Bounds.Width - 30, as a this.left property, it needs to think that the boundaries of the form it is displayed in, is in fact the Screen.PrimaryScreen.Bounds.
I am having difficulties, trying to find out how to handle this.
Should I perhaps catch this type of code and then covert it, to work within the form?
Is there perhaps another way, to make windows simulate a different PrimaryScreen size, based on the size of the form?
EDIT: Perhaps a little more simplified.
I want the from to act as if it was my windows desktop, so any solution i load into the program, get's debugged and viewed in that form.
Handy for if you need to check how your application will look on a phone or simply in another resolution.
Point is that the program itself is going to be an IDE, but rather an online one, in which a group of people can work together on the same application/file, at the same time.
People tend to use virtual machines for these kinds of 'challenges'. It's surprising how efficient this method is! :-)

Idea to create setup project [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I want to create a setup project that in setup time requires serial number to perform installing action and any serial-key can use only in one computer. So, i want all to give me an idea about how to design my setup project ? What things are required to design it ?
Firstly you'll need to come up with an algorithm to generate the keys.
You'll need to decide how to issue the keys. If it's a download only title you could generate the key at the time of purchase.
Once you have a valid key generated you can do one of two things.. Create a key validation algorith, or store the issued keys. Both have their ups and downs.
Upon the user trying to activate the software you'll have to create a machine key of some type. It's up to you what information you base it on but a lot of people would use the computer name, may be store the ip address it's activated from, and some other information that to your requirements fits the bill of the same pc reactivating the software. You can here again generate a unique key based off of this information, sometimes called the activation key.
You'll want the user to be able to reactive the software on the same PC, and most likely a way for them to deactivate it (so should they buy a new computer they can carry the license forward, this is up to you again.)
This is the basics of activating software to a PC. You can integrate this into some setup projects, however there are a lot to choose from and I'd suggest picking one out and seeing what capabilities it already has. Some installers support software activation or at least have a way to add that feature so you may be better off going that route.
Pedro's answer above is also a good start.
If you have custom methods for validating keys then you could create a separate project to handle your own logic and include it in the Setup Project's Custom Actions.
If you are going to leave the capturing of the data to the Setup Project itself you can look here and here. Also, if you're going to have a license agreement you can check this other SO question.

c# how do i programmatically create a replica [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I am developing winform app that runs in two differen pc's
I want to create a replica and get the changes over the internet
How can i do that?
& how can I create replica and sync it using C#?
any ideas will be appreciated
I assume that you are talking about replicating changes in one ms-access "database" such that two instances stay in sync, As such, you'd be better off abandoning ms-access and upscaling to a single centralised database.
this sounds like a bad idea all around.
The common patterns apply;
use GUID id's,
send offline datasets,
cross fingers and look for a job that allows you to use other free tools, suited for the job http://www.microsoft.com/sqlserver/en/us/editions/express.aspx
Avoid conflict resolution (don't edit the same entities on both ends)
Edit
PS. after visiting hamsaweb.net; if you need this to be web deployable on a shared host:
How to deploy SQL CE 4 CTP to shared hosting?

Categories