|
There's entire teams of people out there who devoted YEARS of their lives comming up with Mozilla and FireFox, and you want to create your own?? Does that fact tell you anything about how long it's going to take a single person to do??
|
|
|
|
|
Dave Kreskowiak wrote: devoted YEARS of their lives comming up with Mozilla and FireFox, and you want to create your own?? Does that fact tell you anything about how long it's going to take a single person to do??
Shhhhhhh. Don't burst his bubble
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Good luck, you're going to need it.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
rio_p wrote: I want to create a new web browser without using windows component!
Yeah! And you could call it something like..."Chrome"!
Oh wait...d*mmit!!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
rio_p wrote: any one know how to create the web browser basicly?
Brainstorm and research and you shall get it!
But rather join the Mozilla team and code modules for Firefox. That way you will have a greater understanding of browser concepts than having us tell you some random thoughts on browser design.
And your friends will see you in much better books if you tell them you belong to Firefox dev team rather than ABCBrowse (or whatever name you thought for it) dev team
-------------------------------------------
It's code that drives you - Shyam
|
|
|
|
|
Hi,
I have a requirement where in we need to fetch the member details within a DL. The DL resides within a Organizational Unit (OU). The DL name is DistributionList1 & OU name is Container1
I have written the below code to fetch the list of members to get individual member details & add it to my Member collection object
public void GetDLMembers()
{
string _displayName;
string _givenName;
string _mail;
DirectorySearcher search;
DirectoryEntry entry;
ArrayList listOfMatchingItems = new ArrayList();
entry = new DirectoryEntry("LDAP://my.domain.com/CN=DistributionList1,OU=Container1,DC=my,DC=domain,DC=com");
entry.AuthenticationType = AuthenticationTypes.Secure;
search = new DirectorySearcher(entry);
search.PropertiesToLoad.Add("mail");
search.PropertiesToLoad.Add("givenName");
search.PropertiesToLoad.Add("displayName");
string _Name;
SearchResultCollection searchResults = search.FindAll();
foreach (SearchResult result in searchResults)
{
foreach (String objName in result.GetDirectoryEntry().Properties["member"])
{
int selIndex = objName.IndexOf("CN=") + 3;
int selEnd = objName.IndexOf(",OU") - 3;
_Name = objName.Substring(selIndex, selEnd).Replace("\\", "");
DirectorySearcher dsSearch = new DirectorySearcher(entry);
dsSearch.Filter = "CN=" + _Name;
SearchResultCollection searchResults1 = dsSearch.FindAll();
foreach (SearchResult rs in searchResults1)
{
_displayName = rs.Properties["displayName"][0].ToString();
_givenName = rs.Properties["givenName"][0].ToString();
_mail = rs.Properties["mail"][0].ToString();
...
Logic to add it to the my customised collection object
}
}
}
}
For some reason the searchResults1 count is 0. Where its expected that the count for the searchResults1 collection should be 1. It will fetch the data of an account based on the CN. Any idea whats wrong in the code? Is there some thing wrong with the LDAP Path? Is there any better approach for accomplishing the functionality? If yes then any pointers to this will be very helpful.
Regards,
Vipul Mehta
|
|
|
|
|
Hi This is febin,
I have an C#.net project, I cannot able to run the application because I am getting the below error,
An unhandled exception of type 'System.Security.Policy.PolicyException' occurred in Unknown Module.
Additional information: Required permissions cannot be acquired
Please guide me to proceed,
Thanks in Advance
-
|
|
|
|
|
Have you tried running the application as an Administrator. (In vista it is not enough to run with the account as an administrator. You need to adjust the app for UAC prompts to elevate the process to administrative rights.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
Hi
I am trying to modify class instance members using reflection. I am having problem when trying to add/remove/display elements related to List<int> member.
Following is the code.
[CODE]
class TestClass
{
public int i = 0;
public int IValue
{
get
{
return i;
}
set
{
i = value;
}
}
public List<int> m_intList = new List<int>();
}
class Program
{
static void Main(string[] args)
{
TestClass tcObject = new TestClass();
tcObject.i = 1;
tcObject.m_intList.Add(1);
tcObject.m_intList.Add(2);
{
FieldInfo fieldInfo = tcObject.GetType().
GetField(
"i",
BindingFlags.Static |
BindingFlags.Instance |
BindingFlags.NonPublic |
BindingFlags.Public);
fieldInfo.SetValue(tcObject, 2);
System.Console.WriteLine("I value '{0}'", fieldInfo.GetValue(tcObject));
}
{
PropertyInfo propertyInfo = tcObject.GetType().
GetProperty(
"IValue",
BindingFlags.Static |
BindingFlags.Instance |
BindingFlags.NonPublic |
BindingFlags.Public);
MethodInfo propertySetMethodInfo =
propertyInfo.GetSetMethod(true);
propertySetMethodInfo.Invoke(tcObject, new Object[] { 3 });
System.Console.WriteLine("Property IValue '{0}'", tcObject.i);
}
{
FieldInfo fieldInfo = tcObject.GetType().
GetField(
"m_intList",
BindingFlags.Static |
BindingFlags.Instance |
BindingFlags.NonPublic |
BindingFlags.Public);
foreach (int intItem in tcObject.m_intList)
{
System.Console.WriteLine("List Item value '{0}'", intItem);
}
}
}
}
</string></int></int></int> [/CODE]
Thanks
Chandra
modified on Thursday, October 16, 2008 1:56 AM
|
|
|
|
|
At compile time I do not know whether the type is List<int> or List<string>. At runtime I should interpret it from the fieldInfo.FieldType.
|
|
|
|
|
I even tried the following code
MethodInfo addMethodInfo = fieldInfo.FieldType.GetMethod("Add");
object[] intValue = { 5 };
addMethodInfo.Invoke(tcObject, new Object[] { 5 });
But the above code gives me error "Unhandled Exception: System.Reflection.TargetException: Object does not match target type." when executing the "invoke"
|
|
|
|
|
chandrap wrote: I am trying to modify class instance members using reflection.
Why?
led mike
|
|
|
|
|
Its a requirement in my application. Given an instance of class and values for the members, we should be able to update the members with the corresponding values.
|
|
|
|
|
chandrap wrote: Given an instance of class and values for the members, we should be able to update the members with the corresponding values.
Where in there is the requirement to use Reflection?
led mike
|
|
|
|
|
Hello everyone, thanks for your help. I was able to find the solution for my requirement. Following is the code
class ListElement
{
public ListElement()
{
m_element = 0;
}
public ListElement(int element)
{
m_element = 1;
}
public int m_element;
}
class TestClass
{
public int i = 0;
public int IValue
{
get
{
return i;
}
set
{
i = value;
}
}
public List<int> m_intList = new List<int>();
public List<listelement> m_lstElement = new List<listelement>();
}
class Program
{
static void Main(string[] args)
{
TestClass tcObject = new TestClass();
tcObject.i = 1;
tcObject.m_intList.Add(1);
tcObject.m_intList.Add(2);
tcObject.m_lstElement.Add(new ListElement(1));
{
FieldInfo fieldInfo = tcObject.GetType().
GetField(
"i",
BindingFlags.Static |
BindingFlags.Instance |
BindingFlags.NonPublic |
BindingFlags.Public);
fieldInfo.SetValue(tcObject, 2);
System.Console.WriteLine("I value '{0}'", fieldInfo.GetValue(tcObject));
}
{
PropertyInfo propertyInfo = tcObject.GetType().
GetProperty(
"IValue",
BindingFlags.Static |
BindingFlags.Instance |
BindingFlags.NonPublic |
BindingFlags.Public);
MethodInfo propertySetMethodInfo =
propertyInfo.GetSetMethod(true);
propertySetMethodInfo.Invoke(tcObject, new Object[] { 3 });
System.Console.WriteLine("Property IValue '{0}'", tcObject.i);
}
{
FieldInfo fieldInfo = tcObject.GetType().
GetField(
"m_intList",
BindingFlags.Static |
BindingFlags.Instance |
BindingFlags.NonPublic |
BindingFlags.Public);
MemberInfo[] listMemberInfoArray = tcObject.GetType().GetMember("m_intList");
MemberInfo listMemberInfo = listMemberInfoArray[0];
MethodInfo addMethodInfo = fieldInfo.FieldType.GetMethod("Add");
object[] elementValue = { 5 };
addMethodInfo.Invoke(fieldInfo.GetValue(tcObject), elementValue);
foreach(int currElement in tcObject.m_intList)
{
System.Console.WriteLine("INt List element {0}", currElement);
}
Console.WriteLine();
}
{
FieldInfo fieldInfo = tcObject.GetType().
GetField(
"m_lstElement",
BindingFlags.Static |
BindingFlags.Instance |
BindingFlags.NonPublic |
BindingFlags.Public);
MethodInfo addMethodInfo = fieldInfo.FieldType.GetMethod("Add");
Object listElementObject = Activator.CreateInstance(fieldInfo.
FieldType.
GetGenericArguments()[0]);
FieldInfo listElementFieldInfo = listElementObject.GetType().
GetField(
"m_element",
BindingFlags.Static |
BindingFlags.Instance |
BindingFlags.NonPublic |
BindingFlags.Public);
listElementFieldInfo.SetValue(listElementObject, 2);
object[] elementValue = { listElementObject };
addMethodInfo.Invoke(fieldInfo.GetValue(tcObject), elementValue);
foreach (ListElement currListElement in tcObject.m_lstElement)
{
System.Console.WriteLine("List Item value '{0}'", currListElement.m_element);
}
}
}
}
</listelement></listelement></int></int>
|
|
|
|
|
Hello,
This might be an easy question! But I was wondering if there is any library in .net for simulation?
If I want to simulate a Network of a few computer nodes in C#, what is the best way?
Thanks a lot for your help.
|
|
|
|
|
Sareh khanoom wrote: But I was wondering if there is any library in .net for simulation
Nope. This would have to be provided by you or some other third party library.
Sareh khanoom wrote: If I want to simulate a Network of a few computer nodes in C#, what is the best way?
That's determined by your simulation requirements. You'll have to limit this by asking yourself "What aspects of a network are am I going to simulate and for what purpose?"
|
|
|
|
|
I have a database which has a unique primary key defined key on two columns, in the example below the columns are type and data.
type | value | data | 9 | 0 | 'ABC' | 9 | 0 | 'ABC ' |
When I read in a datatable and then set the PrimaryKey collection with the designated columns I get an exception saying that 'These columns don't currently have unique values'.
So, to me it appears that ADO is ignoring the spaces with respect to determining uniqueness (although the whitespace appears in the rows collection).
I started looking into the DataTable and DataColumn object to see if there was anything that jumped out, but nothing so far.
Can anyone confirm this behavior and/or offer any assistance?
Thanks!
|
|
|
|
|
calhuskerfan wrote: I have a database
calhuskerfan wrote: So, to me it appears that ADO is
ADO is NOT a database. If you are setting up the keys and constraints in the database it is the database product that will contain your answer not ADO.
led mike
|
|
|
|
|
The constraints in the database are fine. They allow the described scenario where 'ABC' and 'ABC ' are considered unique.
When I read, with ADO, from the database into a datatable object ADO does not bring along the primary key identified in the database. So it allows at this point the two above rows to exist.
When I set the PrimaryKey property on the DataTable object (after the rows have been read) to include the column containing the above data I get the constraint exception.
Edit - The exception is actually an ArgumentException stating that the values are not unique.
|
|
|
|
|
calhuskerfan wrote: The constraints in the database are fine. They allow the described scenario where 'ABC' and 'ABC ' are considered unique.
What database are you using? I cannot reproduce that behavior using SQL Express 2005.
led mike
|
|
|
|
|
Sybase SQL Anywhere 10.
Thanks.
|
|
|
|
|
Here is a very quick (and sloppy) example that reproduces the behavior.
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Data;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
Test1();
}
public static void Test1()
{
DataTable dt1 = new DataTable();
dt1.Columns.Add("col0");
dt1.Columns.Add("col1");
dt1.Columns.Add("col2");
dt1.Columns[0].DataType = typeof(Int32);
dt1.Columns[1].DataType = typeof(String);
dt1.Columns[2].DataType = typeof(String);
DataRow dr = dt1.NewRow();
dr["col0"] = 1;
dr["col1"] = "Column 2";
dr["col2"] = "Column 3";
dt1.Rows.Add(dr);
dr = dt1.NewRow();
dr["col0"] = 1;
dr["col1"] = "Column 2";
dr["col2"] = "Column 3 ";
dt1.Rows.Add(dr);
try
{
dt1.PrimaryKey = new DataColumn[] { dt1.Columns[0], dt1.Columns[2] };
}
catch (ArgumentException ae)
{
MessageBox.Show(ae.Message);
}
}
}
}
|
|
|
|
|
calhuskerfan wrote: Here is a very quick (and sloppy) example that reproduces the behavior.
You didn't understand my post. Using SQL Express 2005 with a Table1 designed as your example with the two column primary key constraint.
One row in the table as follows:
Type Value Data
------ ------ --------------------------------------------------
1 2 ABC
Executing the following SQL
insert into Table1 (Type, Value, Data) VALUES(1, 3, 'ABC ')
Produces this error:
Cannot insert duplicate key row in object 'dbo.Table1' with unique index 'IX_Table1'.
led mike
|
|
|
|
|
I tried your test case and ran into the same problem. Seems that when the values are compared, the trailing spaces are removed (or added until the length is the same).
Actually the same effect can happen in SQL Server when varchar data type is used so this may be by design.
Quickly cannot think anything else than replacing trailing spaces with a special character that can be later removed (like ascii 255).
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|