|
I need to check whether password has at least 6 characters with at least 1 letter and one special character. I am checking the condition !Regex.IsMatch(strPassword,"(?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-zA-Z0-9]{6,24})$"). But it doesnot allow special character.
I need to change the expression to check if there is at least one special character.
Please help me out.
|
|
|
|
|
In .NET regex language there is a character class "\W" that represents "non-word characters" (i.e. characters other than letters, digits, or underscores). You could also replace your [0-9] with "\d" (note the lower case).
P.S. I think this question may be better suited for the regular expressions forum.
|
|
|
|
|
I am assuming you consider # and @ to be the allowable special characters:
^(?=.*[#@].*)(?=.*[a-zA-Z].*)[a-zA-Z0-9#@]{6,24}$
Anything that matches that will be a valid password (between 6 and 24 characters, contains only letters/numbers/special characters, contains at least one letter, and contains at least one special character).
Martin Fowler wrote: Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
|
|
|
|
|
|
How do you make repeatable backgrounds for things in XAML?
Back when I was working with HTML, I remember having bitmaps as backgrounds for either a page or for an area.
Now I find I want this same sort of thing in my XAML page for Silverlight. How do I do that? How do I make it repeatable so that the image pattern exists across, for example, a header area no matter how wide the browser window is?
|
|
|
|
|
I think this question belongs in the Silverlight / WPF[^] forum.
If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun
|
|
|
|
|
|
Hi,
I was just woundering if anyone knows how I would do this...
I have an image of a roulette wheel, and I would like to animate it as it was spinning, faster to slower and then stop.
How would I achive this using c# and winforms, as I am not ready to delve into WPF just yet?
Thank you,
Kind Regards,
Steve
|
|
|
|
|
Yes, WPF makes things like that considerably easier.
No concern though. First thing to do is rotate the image, which is presumably represented as a bitmap in code. Get to the graphics object, and that's got two methods TranslateTransform and RotateTransform (as I recall) which should do the rotation. If everything's perfectly circular you may not need the translate transform. Then, create a method which rotates the image as needed. I'd probably create a custom control for just this purpose.
You'll have to use the System.Windows.Forms timer to update the angle in such a way to make it look like real movement.
Regards,
Rob Philpott.
|
|
|
|
|
Would that be better than using BitBlt and 36 separate bitmaps in memory?
Or maybe creating an AVI and using DirectX?
|
|
|
|
|
DirectX would be overkill, as it would add a lot of complexity before getting anywhere.
Whether 36 separate bitmaps are better mostly depends on how fast GDI+ (which is used by WinForms) can transform the image. If it is real-time enough, then it is fine to do the transform every time (don't forget to keep the original image in memory and do the transform on a copy every time).
If the performance is too low, then you'll need to go for the multiple images (but this will use a lot more memory).
|
|
|
|
|
there are 37 numbers on a roulette wheel (without number zero the casino could be in trouble pretty soon); and you probably also want some intermediate positions, especially when the wheel slows down, so 37*5 images seems more like it.
|
|
|
|
|
|
PIEBALDconsult wrote: 38 in the U.S. -- 00 .
0 for the casino.
00 for the government?
|
|
|
|
|
Heck no, the guv'mint takes more than that.
|
|
|
|
|
Rob Philpott wrote: Yes, WPF makes things like that considerably easier.
I am excited to get started with WPF, however, I think I should get through my "Head First C#" Book first, and learn C# properly.
I will look into what you have sugested, and see if I can get something going.
Thank you for the sugestion,
Regards,
Stephen
|
|
|
|
|
Not entirely on-topic, but... I can't stand games that waste time doing crap like that. Just randomize the number already!
I'll always remember that the Amstrad that my father bought (mid-80s) had a Wheel Of Fortune game installed, but the clock was much slower than the developers had intended -- waiting for the wheel to stop spinning was horrible.
What I recommend is randomizing a number and displaying just that number. Do it a few (10?) times so the user sees the numbers flashing. That's what I do for a dice game I wrote; it's much quicker and easier.
|
|
|
|
|
PIEBALDconsult wrote: I can't stand games that waste time doing crap like that.
Maybee. I do see where your comming from, but the idea is to design a realistic and working mini roulette game, so the spinning wheel is a real big part of it.
Also, this is just a fun app, and a doubt many other people will use it.
The main idea for this is a learning curve for a beginner, and not so much the spinning wheel, but the fact that I can learn how to spin the wheel realisticaly, which may be usefull for other stuff.
but thank you for your point of view!
Steve
|
|
|
|
|
You should just bite the bullet and learn WPF.
Doing this in, well, GDI/GDI+ is the correct term here since Winforms has nothing to do with your question, will require you to worry about such silly things as multi-threading, timers, double buffering, geometry, etc and you'll have to write a lot of code.
In WPF, you just attach an animation that animates the rotation angle from 0 to 360 degrees and you're done. 5 minute job max. ZERO code as it can all be done with one line of XAML.
|
|
|
|
|
SledgeHammer01 wrote: You should just bite the bullet and learn WPF.
What? While learning C#?
SledgeHammer01 wrote: one line of XAML.
Could you show one line that does this?
Either way, I am starting to lean toward the idea of WPF.
Thank you,
Steve
|
|
|
|
|
|
Thank you,
That has gave me something to look over the weekend.
Regards,
Stephen
|
|
|
|
|
For a more realistic spinning roulette wheel (even on a slow system) use blurred intermediate images. These will give an appearance more like what a person would actually perceive seeing a real wheel spinning. Transition to actual images as the wheel slows down.
|
|
|
|
|
Alan Balkany wrote: For a more realistic spinning roulette wheel (even on a slow system) use blurred intermediate images. These will give an appearance more like what a person would actually perceive seeing a real wheel spinning. Transition to actual images as the wheel slows down.
This sounds like a very interesting idea, however, I would not have a clue where to start by doing this. Would you possibly be able to provide a little more information please?
Thank you,
Regards,
Stephen
|
|
|
|
|
This http://www.blackpawn.com/texts/blur/default.html[^] gives basic blurring algorithms, but they're rectangle-oriented, and you need to adapt them for rotation.
So, instead of averaging in a rectangular region for each pixel, you'd use an arc representing a fraction of the roulette wheel's rotation, at the pixel's distance from the center +/- a delta constant.
|
|
|
|