This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
how can i make my product as a trial version for 30 days?
I want to create a 30 day trial version of my software, I can record the installation date and compare it with the sysdate of the machine. The problem is how to validate that the user changed the sysdate and how much time I have to adjust in my trial period.
One option is to consume a web service, but the problem are the offline customers.
This is stand alone windows application.
Is there any method I can use to count XX days since the installation?
There is no way, which is one hundred percent reliable. You can query online website for current date, and users will reverse the requests with network sniffer and spoof the server. You can compare most recent temporary file date to detect clock rewinding, but it might cause other issues. You can do something else, and users will patch your code to remove the protection.
Do it the way that makes sense to you, still without having an obsession around it. Your code will stay hackable anyway. You will be better of reasonably pricing it so that hacking makes no sense.
Related
This question already has answers here:
Mapping US zip code to time zone [closed]
(12 answers)
Closed 2 years ago.
I have a list of around 400 zip codes. I need to use this code's time zone in the application. For Example:- If my code zip code 35242, after googling I found the time zone for 35242 is GMT-5. Now in the application, I need to add DateTime.Now.AddHours(-5). Is there any way to do this from code or do I have to search the timezone for all zip codes and do it manually?
Q: Is there any way to get time zone from zip code programmatically?
A: Sure. There are lots of databases, programming libraries and web services available. Some paid, some free; some "static" (e.g. a .csv download), others dynamic (e.g. a REST API).
SUGGESTION: Consider trying Google's Timezone API
Getting started with Google Maps Platform
Getting started with Google TimeZone API
C#/VB/Net example code
This question already has answers here:
How to Query an NTP Server using C#?
(6 answers)
Closed 3 years ago.
I need to get the same time on all Instances of my program. How do I do that. DateTime.Now is not accurate(is different on different hardware) enough, I need to get the Time down to 100 ms difference-precision.
You don't want it read locally from each computer, as you don't know that each PC's clock is perfectly in sync (and you can see that they aren't).
So you have two options:
Write something on each computer to maintain precise time.
Get a web based time and all of your computers will be reading the same data. Here is an example from SO: How to get DateTime from the internet?
This question already has answers here:
How to get client date and time in ASP.NET?
(6 answers)
How to detect the timezone of a client?
(4 answers)
Closed 6 years ago.
I am using ASP.NET Webforms to get the data of client. till now I figured out the IP address of client and the city & country of the client. I am trying to find a way of how to retrieve the time zone by using its IP Address or country name or city name. I have googled and couldn't find any appropriate answer as everyone talks about injecting javascript to get timezone.
My question is: Is there any way to find timezone of the client? If so then how?`
It is not possible to do this in a reliable way purely with C#. The HTTP spec does not provide any hints of the client's time zone.
You can guess at a client's time zone by using IP geolocation, and there are many free and commercial services that provide time zone information. However there is only a limited degree of accuracy with such an approach.
Even with JavaScript, the current solutions can still only guess the client's time zone. There are improvements happening for this with in the ECMAScript Intl API, but not all browsers fully implement that yet. See more here.
Ultimately, if you need to know the time zone of the client from your back end code, the best thing to do is to ask the user. Provide a time zone picker somewhere in your application.
You may also find this related answer useful.
Have you tried using the TimeZoneInfo Class
It represents any time zone in the world.
https://msdn.microsoft.com/en-us/library/system.timezoneinfo(v=vs.110).aspx
This question already has answers here:
How can I create a product key for my C# application?
(14 answers)
Closed 9 years ago.
How can i generate serial key for the C# Desktop Application (Windows application) ?
E.g. Software expires after a month. (Trial version).
If user changes Machine time then hoe could it be possible to validate the software for the specified time ?
There are many ways you can generate serial keys for your application in C#. You will most likely have make some sort of trade off between the simplicity (ie. the length of the key, readability, etc), and the security of a particular system.
I would recommend Software Protector(http://softwareprotector.clizware.net/) and SKGL (https://skgl.codeplex.com/). Software Protector would give you a user interface where you can generate your keys and SKGL API would allow you to validate those inside your own application. If you like, you can also include the source code of SKGL API (currently available in C# and VB.NET). You can set a time limit from 0 to 999, 8 custom features, and machine locking.
Regarding the time changing issue, the only way I see is to look up the local time (for that time zone) online using time.windows.com and check if that is equal to the current time on the pc. Please check this article: https://skgl.codeplex.com/discussions/472444
Please note that I am developing both SKGL API and Software Protector, which means that my answer might have a slight tendency!
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I am working with a consulting group on a program which currently uses a .net C# script to send e-mails in HTML format at regular intervals.
The e-mail itself aside from being in HTML format although the content is text with some tags and contains less then a page of text.
I would like the consultant to change this to text format replacing the tags with line feed/carriage returns. I have been told that this is a four hour job but that seems excessive to me.
When I look online at a page such as this http://www.mattvanandel.com/771/c-sending-an-email/ it would seem the change could be completed in less than 4 hours including recompiling the .net code into a DLL, testing and uploading the code to a server.
Not all developers are created equal, but assuming that the .Net developer is experienced enough to warrant a $250 per hour salary does this seem reasonable? If it is something less than 4 hours (i.e. more like 4 min) can someone tell me what might have to be done to make the modification. From what I can see its likely 2 lines of code that need to be modified (i.e. the body string and the IsBodyHtml statement). What else may I be missing?
Dependant upon what kind testing would be required to verify that the system is stable after the change, then perhaps 4 hours may or may not be excessive.
For a simple looking change in a tightly coupled system may have massive implications and risk. On the other hand in a loosely coupled system, the risk should be minimal.
So the question is, why 4 hours. If it was me. I'd request a breakdown of what the 4 hours represents. You are after all the customer and if you need a cost breakdown I'd suggest you're within your purview to request it.
However I'd suggest that you ask in a non confrontational way (i.e. don't jump in with all guns blazing) as the there may well be serious implications that the developer knows about but you don't. Maybe just ask for a simple - 'what is involved in implementing this change'.
And don't feel you have to accept the first answer given, you should if you are dissatified, request further clarification from the developer.
It all depends on how the code is written - and on that we can only speculate currently. It may be that they use a really complex 3rd party tool - in which case it might take four hours.
However, if it is done using System.Net.Mail then it could be as simple as setting the IsBodyHtmlproperty on a MailMessage to true, which is a four-second job.
Changing that 'IsBodyHtml' property would make it send text, but you would also need to modify the text to insert the line feeds - on static text this is not totally difficult, but you need to consider when a line feed is proper (what in the html has "block" layout and what is simple in-line styled). Also you do not mention if the text is dynamic or static which adds complications if it IS dynamicly generated.
Time you pay for, but also knowlege. I get someone else to fix things on my car, not because I can't, but because they are better and have the tools I might not have.
Just from a time spent perspective:
Get knowlege/use knowlege already present
Estimate time to communicate with you
Design the change
Code the change
Deploy the change
Test the change/functional test
Solicit feedback on the change/acceptance test (from you?)
There is only one property "IsBodyHtml" of MailMessage Class in .net to switch between Html/Text mail message type.
So you can check yourself, how big is the job excepting removing html tags and pumblishing the updated dll on server.
The mechanics of switching the code itself is as simple as you say above, replacing the HTML body string with the new string and changing the IsBodyHtml property. (Assuming the code uses the built in .NET Framework mailing components).
Remember though, that text based emails will remove all formatting, so you won't be able to have font colours, images, hyperlinks or anything else in the content except as plain text.
If you really want to cut the estimate down, get someone internal to edit the text and all the developer will have to do is switch 2 lines of code and then test/deploy.
I can't comment on the time required to test/deploy as that's entirely dependent on your system.