|
Posted
about 13 years
ago
by
James Craig
1) Fixed Google static maps.
|
|
Posted
about 13 years
ago
by
jw7965
Thank you that would be great.
What I want to do is create a random salt string.
|
|
Posted
about 13 years
ago
by
JaCraig
To be honest, I've never used Webmatrix so I'm not 100% sure at present. Give me a day or two and I can take a look (basically I'll install it and give it a try tonight). That said, it sort of depends on the section as to what you would want to do.
... [More]
In terms
of randomization, they're mostly extension methods built off of System.Random. So, in MVC/C# (which I do most of my work in lately), you would simply add this to the controller:
using Utilities.Random.ExtensionMethods;
Then create a System.Random object.
Random MyRandomGenerator=new Random(MySeedNumber);
At this point you can use the Next, Shuffle, and NextEnum extension methods. In order to randomly generate a class, you would create your class and mark the properties with the various attributes in the Utilities.Random namespace (StringGenerators contains
string specific attributes, NameGenerators contain name specific attributes, DefaultClasses contains integer, float, etc. attributes, and ContactInfoGenerators contains contact info specific attributes):
public class MyClass
{
[NameGenerator]
public string Name{get;set;}
[IntGenerator(1,99)]
public int Age{get;set;}
}
With that you could make the following call which would generate a random object of MyClass:
MyClass Result=MyRandomGenerator.NextClass<MyClass>();
[Less]
|
|
Posted
about 13 years
ago
by
JW7965
I'm using Webmatrix.
I installed Craig's Utility Library via Nuget. I now have a Utilities.dll in my Bin folder.
So far so good, I guess, but how do I actually use or invoke a utility in this library, in particular Randomization?
Thank you.
|
|
Posted
about 13 years
ago
by
James Craig
1) Updated a number of items to be a bit better designed (items set to private that were never meant to be set publicly, etc).
2) Fixed TaskQueue so that it doesn't limit the size of the queue itself.
3) Created a basic ruleset for going forward (may
... [More]
change it over time).
4) Starting to change items to try and get the library CLS compliant.
5) Started considering switching out much of the data checking for code contracts (still a bit worried as it's only in research currently. Really should be part of visual studio, language, etc.). [Less]
|
|
Posted
about 13 years
ago
by
James Craig
1) Fixed a couple issues with validation if the object is null.
2) Fixed issue with Table if the names contain duplicates.
|
|
Posted
about 13 years
ago
by
JaCraig
Actually, I am looking into converting it (or part of it) into a portable library. Basically it would be a CUL Lite version (as some of the classes simply will not work if I try to target some of the platforms). My guess though is that it wouldn't
... [More]
contain
half of the functionality. And actually some of the merging of namespaces was due to the fact that I want to see what I can salvage if I go this route. If I go this route, the plan is to have a CUL Lite which will have the basic functionality (stuff I can
put into the portable library), then have the full version which will actually use the Lite version as a dependency and add on the extra functionality.
[Less]
|
|
Posted
about 13 years
ago
by
vbgraphix
Are there any plans for a portable version?
|
|
Posted
about 13 years
ago
by
JaCraig
Well, is there an issue with the built in windows authentication in ASP.Net (http://support.microsoft.com/kb/323176)? Or are you trying to do some sort of hybrid forms/windows approach? I had to do that in the past (not fun). Just curious as the
... [More]
built in
authentication may be the easier approach. But if you're doing something where you need the functionality, basically you would just do the following:
using(Directory mydir=new Directory("",username,password,path))
{
bool mybool=mydir.Authenticate();
}
Where username and password are the individual user's username and password. Path would point to whatever LDAP server you wanted to authenticate against. To check if the user is part of a specific group, you would do the following:
using (Directory Dir = new Directory("", UserName, Password, Path))
{
Entry User = Dir.FindUserByUserName(UserName);
foreach (string MemberOf in User.MemberOf)
{
...
}
}
The MemberOf list will contain the list of groups they're a member of. However this only does the ones they are directly members of. So you may want to go this approach:
using (Directory Dir = new Directory("", UserName, Password, Path))
{
bool mybool = Dir.FindGroupMembers(groupname, true)
.FirstOrDefault(x => x.SamAccountName == UserName) != null;
}
Note that groupname is the group's CN field in this case. But this will find the group members recursively (in case there are sub groups, etc), then find out if anyone has the proper user name, and if they do mybool will be true, false otherwise.
As far as the different versions. Craig's Utility Library is everything. Every namespace, every class, everything. The Events Namespace, IO Namespace, DataTypes Namespace, etc. are the individual namespaces broken out so, if you want to, you can pick and
choose the items that you need. For instance, you may not need or want the image manipulation, web helpers, ORM, etc. and just want the IO, DataTypes, and LDAP namespaces. Note that if you do this, I suggest using NuGet as some of the namespaces require each
other (for instance, DataTypes is required by almost everything as it has a ton of extension methods and classes that I use regularly).
[Less]
|
|
Posted
about 13 years
ago
by
pogue1000
Also,,, what is the difference in the different versions I see there is a Craigs Utility Library, then Events Namespaces and IO Namespace
|