|
it depends on how and where the passwords are stored .. if you're using a database, one of the fields you might have in the account/user record is a datetime field for 'password last changed', and another might be a flag for 'needs to change password'
a) at day=0, you force a refresh of all passwords by setting the 'needs to change password flag' to true, and probably just put junk in the password field to force them to use the accepted password change procedure
b) when the user changes their password, you set the 'password last changed' field to (now), and the 'needs to change password' flag to false
c) every day, you run a procedure to go through the 'database' and calculate the difference in days between (now) and the password last changed field - if that figure is '90' you set the 'needs to change password' flag to true
|
|
|
|
|
As an addition to Garths design, I would have a settings table that stores the policy details. Instead of storing the needs to change flag and requiring a daily process to update it I would use a View which joins the settings table and the user table and calcs the need to change flag.
This eliminates a daily process and makes the policy and therefore the flag dynamic (controlled by the settings table and therefore available to be changed externally).
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Garth's way is fine, but rather than running a procedure every day, I'd do the "does it need changing" test when the user logged in. If it needs changing, then let him in, but take him directly to the "must change password" page, and don't let him in the rest of the site until it's changed.
I'd also dump the boolean "needs changing" value in favour of replacing the "last change" date with a "next change date". That way, then test is simple "is next change less than now?" and it's only one column to update when they do change it: nextChangeDueOn = CurrentDate + 90 days.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I'm using shellexecute in .NET 4.5 to run an program like notepad.
Process newProcess = new Process();
newProcess.StartInfo.UseShellExecute = true;
newProcess.StartInfo.FileName = "C:\Windows\Notepad.exe";
newProcess.Start();
How do I set this notepad.exe that it runs to be the top most window?
|
|
|
|
|
You're running a process, one which may or may not open a multitude of windows. The "top most" is a highly contested place; my 3G connection thinks it is the most important application on my machine, but my MP3 player sometimes has similar feelings*. It is frustrating to see them fight for focus while reading your answer.
You can enumerate which windows a process opened. Find yours, and set the WS_EX_TOPMOST[^] style.
--edit;
*) there can be only one
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I think the code in this solution to a QA question here: [^] will show you how to make the instance of NotePad.exe the top-most Window using the 'SetForeGroundWindow API call.
«There is a spectrum, from "clearly desirable behaviour," to "possibly dodgy behavior that still makes some sense," to "clearly undesirable behavior." We try to make the latter into warnings or, better, errors. But stuff that is in the middle category you don’t want to restrict unless there is a clear way to work around it.» Eric Lippert, May 14, 2008
|
|
|
|
|
What the suject says...
I can format the selection to bold and to italic. but when I want the text bold and italic the formation is set to regular automatically.
Thats my code:
newfont = FontStyle.Bold & FontStyle.Italic;
richTextBox1.SelectionFont = new Font(currentfont.FontFamily, currentfont.Size, newfont);
|
|
|
|
|
& is AND - a binary operation that returns a 1 in each bit only if the corresponding bit in both operands is 1, and a zero otherwise.
So if these are in Binary:
0011 & 1010 Will return 0010 because only the second bit has matching "1"s in the same position.
The operation you want is OR : | which returns a 1 is either corresponding bit is 1.
0011 | 1010 Will return 1011.
So try:
newfont = FontStyle.Bold | FontStyle.Italic;
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
thanks a lot it works
do you know how I can say that I will get the currentFontStyle without bold ?
so if the selection is bold and italic and now i just want it in italic?
i only want the code...
|
|
|
|
|
Use:
existingStyle & ~FontStyle.Bold That turns the bit off.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
perfect thank you so much!
|
|
|
|
|
You're welcome!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I want to customize serial port listener code to send an acknowledgement after every frame I receive, how do I change the code? please help.
|
|
|
|
|
Since you have not shown us the code, it is impossible to answer your question.
|
|
|
|
|
But surely you kn ow what code he is using? It's the same one everyone else does! You know, the one written in IBM S360/195 assembler in 1982?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Of course , I'll just get the listing out of my code cupboard.
|
|
|
|
|
Hi,
I have a c# windows application (Ticketing System) and I connect to the database on server (Primary Server) by the network, also I have another server used as a replication server (Secondary Server), my question is
How to make my application connect to the second server (Secondary) automatically if the first server not work or I can't connect to it.
I need my application to be online always with the database and it connect to the available server (try server # 1 if failed connect to server # 2).
Please help me ASAP.
Thank You
|
|
|
|
|
The obvious answer is to test if the first connection failed, and if so use the alternate. What exactly is the problem with this logic?
|
|
|
|
|
No it is not a problem but I don't want to depend on the exception when try to connect to the first server, I ask if there is any other way to check the SQL server is available or not.
|
|
|
|
|
That depends on what you mean by available, as there are many reasons why your connection could fail. But there is no way of knowing in advance which one to test for.
|
|
|
|
|
Google for "SQL Server High Availability". This really has nothing to do with your application code. Your code shouldn't care at all about each individual SQL Server and how to connect to it. All it should know is how to connect to the "cluster".
Keep in the mind that this is expensive and there is no way to reduce any servers downtime to zero. If you implement your "poor mans" solution, remember, you get exactly what you pay for. You may get a cheaper solution the way you want to do it but you also give yourself an administrative nightmare. If the list of servers changes how are you going to tell the clients that and update them?
You have no control over the client hardware, such as network interface, the quality of the connection between the client and the servers, the router and switch hardware between the client and servers, the server hardware itself, ...
There is no such thing as 100% uptime.
|
|
|
|
|
Dave Kreskowiak wrote: There is no such thing as 100% uptime What! Wait I'm sure I have seen volumes of marketing material that claims 100% uptime, possibly from the owners of Arvixe hah hah hah hic
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
If marketing were true we'd all be out of a job because there's all kinds of tools that make writing applications a snap!
|
|
|
|
|
I am very much a newbie, and am trying to teach myself.
I have been following through tutorials on CodeProject.
Invariably, I come across a problem, which I can't solve, so I post a message.
None of these questions get an answer, despite me giving all the details.
The latest is
MVC Study
stebo0728, 2 Jun 2016 CPOL
4.75 (3 votes)
I posted the question:
I get the error:
An error occurred attempting to determine the process id of the DNX process hosting your application.
I should hope I might some sort of reply, but I doubt it.
|
|
|
|
|
That question will be answered by the author of the article when he/she sees your message. Please learn to be patient, everyone here helps in their own time, many have full time jobs, and some even take time off at the weekend.
|
|
|
|