|
I am working on AD RMS so can u plz tell me that how to get the machine certificate and
how to get the User License and How to get RAC(Rights Account Certificate)
PLease tell me that what is needed the first.
|
|
|
|
|
Can we use .Net Remoting if we have a COM client? That is, have a .net remoting object, a .net listener and a com client to request for the .net remote object?
|
|
|
|
|
Hi,
I can´t understand this:
help!
I´m developing application, and it´s using iText Library for generate PDF. The text input must be Rich formated. The pdf document generated, must be exactly equal to text. I´m parsed the text, for generated font name, color,size and then, the objects needed for iText ( it´s not support RTF to PDF conversions )
I´m using RichEdit Control, but the font size is not correct in comparission with the generated pdf. ( also are images objects ).
Then, I did a SIMPLE test with the DrawString method (gdi), ( same text, same font name and font size ), but they are not equal WIDTH. ( Richtext and drawtext ).
Conclusion: using a DrawString method generated the correct pdf (correct size).
The height and the size of each character are equal. The only diference is the char spacing
Why occurs this ?
I need resolve this problem with the fuc... Rich Edit Control.
Thanks!
PS: sorry for my poor english
modified on Wednesday, May 13, 2009 1:31 AM
|
|
|
|
|
According to msdn the IRunningObjectTableRegister method takes 4 parameters. See http://msdn.microsoft.com/en-us/library/ms680747(VS.85).aspx
However, the one in System.Runtime.InteropServices.ComTypes only takes 3. See http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.comtypes.irunningobjecttable.register.aspx .
Does anyone know if the return value of the .Net Register method is the dwRegister value required for the IRunningObjectTable.Revoke method? The explanation just says the return value is “An HRESULT value that indicates the success or failure of the operation.”
Thanks in advance.
|
|
|
|
|
Sorry, I just saw the "Community Content" bit at the end of the .net article saying the return value is the dwRegister value for the Revoke method.
I have a windows service which instantiates a class and would like to register this object in the ROT. I have found that testing this registry to the ROT works fine when it's done in a standalone exe but not within a windows service. I have read a case for why it doesn't work when in the Windows Service, that there is this flag ROTFLAGS_ALLOWANYCLIENT which you can pass to the Register method to allow any client to see it. Have I understood that the .net's IRunningObjectTable is the one that accepts this flag whereas the Ole32 one does not?
private int myRegisterActiveObject(object pUnk)
{
string sDelim = "!";
string sProgID = "MyNamespace.ClassName";
IBindCtx bc;
Ole32.CreateBindCtx(0, out bc);
IMoniker moniker;
Ole32.CreateItemMoniker(sDelim,sProgID, out moniker);
IRunningObjectTable rot;
bc.GetRunningObjectTable(out rot);
int register = rot.Register((ROTFLAGS_REGISTRATIONKEEPSALIVE | ROTFLAGS_ALLOWANYCLIENT), pUnk, moniker);
return register;
}
I get in the EventLog, "Service cannot be started. System.Runtime.InteropServices.COMException (0x80004015): The class is configured to run as a security id different from the caller (Exception from HRESULT: 0x80004015)..."
The Service is run under account type LocalSystem.
|
|
|
|
|
Notes I've read indicate that I also need to add registry below...
[HKEY_CLASSES_ROOT\APPID\myApp.exe]
"APPID"="{guid}"
But I don't know where i can find this AppId guid. Tried the assembly guid, the Service class's guid, the class guid and still I got the same security erro. I looked in dcomcnfg and my windows service didn't appear there (maybe b/c it failed to start).
|
|
|
|
|
I currently have a program which queries LDAP (Active Directory) and stores that data into a Multi-dimensional array.
I am trying to find another way to store the data that will allow me to manage easier.
My application:
- Runs in System Tray
- Starts at Windows Startup
- Retains Active Directory information in Memory for Quick Lookup
- Only Queries LDAP (AD) at application open
The application is used to quickly retrieve information, send emails, view group memberships.
I have just learned how to use a Dataset and Datatables and tried to store the data into that structure instead of an Array.
There are 18 pieces of data being stored for roughly 400 users so I guess that translates to about 7200 records.
I can store the data into the dataset/datatable, but I'm have a few issues:
Speed - Storing to the Datatable takes 23 seconds, versus 2 seconds for storing to an Array
Processor - While storing to the Datatable the processor is at 15-30%
Memory - Even after flushing the memory using a class I have my application is taking 6MB now instead of roughly 800k-1024k it was before.
My question is this, what is the best way to store the data in memory?
Am I doing anything wrong with the way I'm storing the data to a datatable?
Here is a picture of my application:
http:\\www.jkfweb.com\files\example.jpg
The code is in the following post.
modified on Tuesday, May 12, 2009 1:58 PM
|
|
|
|
|
Imports System.IO
Imports System.DirectoryServices
Imports System.Data
Module Module1
Public dsCSIDir As New DataSet("CSIDIR")
Public Users_Table As New DataTable
Public drUser As DataRow
Sub ImportUsers()
Dim direntry As New DirectoryEntry("LDAP://OU=CSI Users, DC=csileasing, DC=com")
Dim searcher As New DirectorySearcher(direntry)
Dim i As Integer = 0
Dim result As SearchResult
Console.WriteLine("Started Data Import at : " & TimeOfDay)
Try
searcher.Filter = "(&(objectClass=user)(samaccountname=*))"
searcher.ClientTimeout = TimeSpan.FromSeconds(5)
For Each result In searcher.FindAll
If result.Properties("samaccountname")(0) = Nothing Then
Continue For
End If
drUser = Users_Table.NewRow
drUser("index") = i
If result.Properties.Contains("company") Then
drUser("Company") = result.GetDirectoryEntry.Properties("company").Value
Else
Continue For
End If
drUser("LoginID") = result.GetDirectoryEntry.Properties("samaccountname").Value
drUser("DisplayName") = result.GetDirectoryEntry.Properties("cn").Value
If result.Properties.Contains("title") Then
drUser("Title") = result.GetDirectoryEntry.Properties("title").Value
End If
If result.Properties.Contains("telephoneNumber") Then
drUser("OfficePhone") = result.GetDirectoryEntry.Properties("telephoneNumber").Value
End If
If result.Properties.Contains("mobile") Then
drUser("CellPhone") = result.GetDirectoryEntry.Properties("mobile").Value
End If
If result.Properties.Contains("mail") Then
drUser("Email") = result.GetDirectoryEntry.Properties("mail").Value
End If
If result.Properties.Contains("streetAddress") Then
drUser("Street") = result.GetDirectoryEntry.Properties("streetAddress").Value
End If
If result.Properties.Contains("l") Then
drUser("City") = result.GetDirectoryEntry.Properties("l").Value
End If
If result.Properties.Contains("st") Then
drUser("State") = result.GetDirectoryEntry.Properties("st").Value
End If
If result.Properties.Contains("postalCode") Then
drUser("PostalCode") = result.GetDirectoryEntry.Properties("postalCode").Value
End If
If result.Properties.Contains("memberof") Then
Dim groups As DirectoryServices.ResultPropertyValueCollection = result.Properties.Item("MemberOf")
Dim groupslist As String = ""
Dim groupname As String = ""
For k As Int16 = 0 To groups.Count - 1
Dim fullname As String = result.Properties("memberof").Item(k).ToString
groupname = Left(Split(fullname, "=")(1), Len(Split(fullname, "=")(1)) - 3)
groupslist = groupslist & groupname & ","
Next
groupslist = Left(groupslist, Len(groupslist) - 1)
drUser("Groups") = groupslist
End If
If result.Properties.Contains("manager") Then
Dim managername As String() = Split(result.Properties("manager")(0), ",")
drUser("Manager") = Right(managername(0), Len(managername(0)) - 3)
End If
If result.Properties.Contains("sn") Then
drUser("FirstName") = result.GetDirectoryEntry.Properties("sn").Value
End If
If result.Properties.Contains("givenname") Then
drUser("LastName") = result.GetDirectoryEntry.Properties("givenname").Value
End If
If result.Properties.Contains("directReports") Then
Dim groups As DirectoryServices.ResultPropertyValueCollection = result.Properties.Item("directReports")
Dim groupslist As String = ""
Dim groupname As String = ""
For k As Int16 = 0 To groups.Count - 1
Dim fullname As String = result.Properties("directReports").Item(k).ToString
groupname = Left(Split(fullname, "=")(1), Len(Split(fullname, "=")(1)) - 3)
groupslist = groupslist & groupname & ","
Next
groupslist = Left(groupslist, Len(groupslist) - 1)
drUser("DirectReports") = groupslist
End If
If result.Properties.Contains("department") Then
drUser("Department") = result.GetDirectoryEntry.Properties("department").Value
End If
i += 1
Users_Table.Rows.Add(drUser)
Next
Catch ex As Exception
End Try
Users_Table.AcceptChanges()
dsCSIDir.Tables.Add(Users_Table)
End Sub
Public Sub CreateDataStructure()
Users_Table.TableName = "Users"
Console.WriteLine("Start of Create Columns at: " & TimeOfDay)
Users_Table.Columns.Add("index", GetType(Integer))
Users_Table.Columns.Add("LoginID", GetType(String))
Users_Table.Columns.Add("FirstName", GetType(String))
Users_Table.Columns.Add("LastName", GetType(String))
Users_Table.Columns.Add("DisplayName", GetType(String))
Users_Table.Columns.Add("Title", GetType(String))
Users_Table.Columns.Add("Company", GetType(String))
Users_Table.Columns.Add("Email", GetType(String))
Users_Table.Columns.Add("OfficePhone", GetType(String))
Users_Table.Columns.Add("CellPhone", GetType(String))
Users_Table.Columns.Add("Street", GetType(String))
Users_Table.Columns.Add("City", GetType(String))
Users_Table.Columns.Add("State", GetType(String))
Users_Table.Columns.Add("PostalCode", GetType(String))
Users_Table.Columns.Add("Manager", GetType(String))
Users_Table.Columns.Add("Department", GetType(String))
Users_Table.Columns.Add("Groups", GetType(String))
Users_Table.Columns.Add("DirectReports", GetType(String))
Console.WriteLine("End of Create Columns at: " & TimeOfDay)
End Sub
|
|
|
|
|
An array will work just fine for what youre trying to do. Datasets and Datatables will add a lot more overhead and processing then what is required for what you are trying to do. There isnt anything wrong with what you are trying to do but again datatables and especially datasets will take more resources.
Also the code you are using for storing into a datatable is correct.
On a side note: Why do you need to cache everyone in AD, wouldnt an on-demand query of a specific person be much more viable and only get everyone when needed?
|
|
|
|
|
Ian McCaul wrote: An array will work just fine for what youre trying to do. Datasets and Datatables will add a lot more overhead and processing then what is required for what you are trying to do. There isnt anything wrong with what you are trying to do but again datatables and especially datasets will take more resources.
Thanks for your response Ian.
What other structures can I store data in besides an Array and Dataset/Datatable?
I'm still learning quite a bit, and it may be that an Array is the best choice.
Thanks,
|
|
|
|
|
Well an array in .NET is a very general term. You have
List
ArrayList
Dictionary
HybridDictionary
etc.
There are many arrays and each have certain benfits depending on the size of the collection you are going to use and what functionality you would like with the collection. Google the 4 I gave you and specifically their generic versions. It should help steer you in the right direction.
|
|
|
|
|
You have been of great assistance.
I will look into what you mentioned.
Thanks alot!
|
|
|
|
|
thanks very much
but am sad to tell you that iam using C# and not familiar with VB
so maybe if you can supply me with some C code it would be good
sorry for the inconvinience
regards
|
|
|
|
|
|
Well, you have 400 records, not 7200, unless your database is laid out funky... You have 7200 total fields of data.
The DataTable class has quite a large overhead compared to an Array. So, if an array works for you, great! If not, you may want to look into a Generic collection solution.
glumlord wrote: Processor - While storing to the Datatable the processor is at 15-30%
30%?? Who cares??
glumlord wrote: Memory - Even after flushing the memory using a class I have my application is taking 6MB now instead of roughly 800k-1024k it was before.
Memory as measured by what?? Please don't tell me you used TaskManager! It's kind of lying to you when it comes to .NET apps. You really have to understand what TaskManager is looking at. If you want more accurate numbers of what your APPLICATION is using, use Performance Monitor and the .NET Memory counters.
Task Manager is showing you what is RESERVED for your process, not necessarily "in use". .NET CLR applications run inside a "virtual machine", not unlike what Java uses. What you're seeing is the memory that is sitting in the Managed Memory Pool for your application inside the "virtual machine". The .NET CLR maintains a pool of memory to speed allocations of future objects. It tunes itself to try and predict how your app is going to use memory in the future, based on what it's done in the past. It gets this memory from Windows and adds it to the Managed Pool. If Windows starts running low on memory, it can ask the .NET CLR to free up however much memory it needs and the CLR will be more than happy to return whatever it can spare.
Basically, unless you have a condition where your app runs the machine out of memory, or is using excessive amounts of memory, you're worrying about nothing. The .NET CLR does a very good job of managing memory and playing nice with the rest of the system.
|
|
|
|
|
Dave Kreskowiak wrote: Memory as measured by what?? Please don't tell me you used TaskManager! It's kind of lying to you when it comes to .NET apps. You really have to understand what TaskManager is looking at. If you want more accurate numbers of what your APPLICATION is using, use Performance Monitor and the .NET Memory counters.
I do use Task Manager and I added all the columns that refer to Memory. I compared that to the previous version of my application using Arrays. It may not be accurate completely but I would beg to differ if you think it's useless It tells me that the version with Datatables instead of an Array is taking 6 x as much memory.
I use the following to flush memory, which I have good luck with in the past.
Public Class MemoryManagement<br />
<br />
Private Declare Function SetProcessWorkingSetSize Lib "kernel32.dll" ( _<br />
ByVal process As IntPtr, _<br />
ByVal minimumWorkingSetSize As Integer, _<br />
ByVal maximumWorkingSetSize As Integer) As Integer<br />
<br />
Public Shared Sub FlushMemory()<br />
GC.Collect()<br />
GC.WaitForPendingFinalizers()<br />
If (Environment.OSVersion.Platform = PlatformID.Win32NT) Then<br />
SetProcessWorkingSetSize(Process.GetCurrentProcess().Handle, -1, -1)<br />
End If<br />
End Sub<br />
<br />
End Class
Dave Kreskowiak wrote: glumlord wrote:
Processor - While storing to the Datatable the processor is at 15-30%
30%?? Who cares??
It does matter because this app is on every single desktop pc in our organization and opens at windows startup when processor time will directly affect how quickly a user can use his/her pc.
Dave Kreskowiak wrote: The DataTable class has quite a large overhead compared to an Array. So, if an array works for you, great! If not, you may want to look into a Generic collection solution.
Thanks for that suggestion, I'll do some research into that. I appreciate any help I can get as most of this stuff I have learned from reading and am still quite wet under the ears.
|
|
|
|
|
glumlord wrote: I do use Task Manager and I added all the columns that refer to Memory. I compared that to the previous version of my application using Arrays. It may not be accurate completely but I would beg to differ if you think it's useless
Considering TaskManager is showing you the memory that is reserved by the .NET CLR and not your actual application usage - yeah, it's pretty useless. Yes, TM can show your app as using 100MB of RAM when it's really only using 18MB. What would you think about it if you saw that??
BTW: I got that on a 64-bit machine with 64GB of RAM in it.
|
|
|
|
|
Dave Kreskowiak wrote: 30%?? Who cares??
The user probably cares; he is sitting in front of the monitor waiting 23 seconds for things to happen. With a CPU load of 100% it might last only 8 seconds. And with a better design probably only a fraction of that.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Sadly, what doesn't show up in the 30% is all the idle time the CPU has waiting for disk I/O to complete.
If the CPU is at 30% during all of this, there really isn't too much he can do, other than redesign and try and bypass the off-CPU bottleneck.
|
|
|
|
|
Disk I/O can be a factor, but I understood with arrays, i.e. without DataTables, it only took 2 seconds; so everything exceeding that needs scrutinized.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Luc Pattyn wrote: it only took 2 seconds; so everything exceeding that needs scrutinized.
I wonder about his users! If they're complaining that it takes 2 seconds longer to get a Desktop they can use, they really need professional mental help!
Where I work, it can take upwards of 10 minutes (worst case) to get into a machine on the first login! My laptop takes 5 minutes to get to the point where I can use it! 23 seconds is nothing...
|
|
|
|
|
Dave Kreskowiak wrote: I wonder about his users! If they're complaining that it takes 2 seconds longer to get a Desktop they can use, they really need professional mental help!
Where I work, it can take upwards of 10 minutes (worst case) to get into a machine on the first login! My laptop takes 5 minutes to get to the point where I can use it! 23 seconds is nothing...
I feel for ya! Thats horrible, luckily we have all new machines here and usually within 10 seconds of logging in the users is fully able to use machine.
I'm also in charge of the login scripts and we keep the stuff it does to a minimum. User impact will be minimal but there is a perception with the users that their computers are slow if we have stuff like this happening. They don't understand it's poor programming, nor do they care.
I actually started writing out console.writeline with time stamps through the loop process of writing the data to the datatable and it was taking 80-120 ms per user in loop. It takes 10 ms for example to create a new row.
I did change two things and was able to shave about 2 seconds off. Something doesn't quite seem right because I was talking to a web developer friend up here and they have a web database that can write/query 40k records in about 5 seconds.
He said my code looked fine also. I'll mess with this in a day or two when I have more and post an update for those of you curious.
Either way I appreciate all the advice everyone has given.
|
|
|
|
|
Hi ,
I have a asp.net application which was built in vs 2005 sp using .net framework 2.0 sp1.
when i used the same application in vs 2005 RTM with .net framework 2.0 sp2 , am getting a
lot of errors (compilation).
Is the change in service packs effects this scenario in any way?
Thanks in advance!
suchiT
|
|
|
|
|
Sounds likely. If it worked before, and doesn't work now and the only thing that's changed is the service pack then it stands to reason that this is the problem.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
look at the first compilation error first. Maybe show us some...
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|