|
the difference is that is you do the running around then the OP only needs look at 1 page lol
So... Go Fetch!
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Explaining this seems a bit pointless, as if you cannot understand the general purpose of the delegate keyword in this context then you need to read up on the C# language.
Saying that working backwards:
delegate(int value){return Convert.ToString(value);}
This line is an inline way of writing:
public static string MyConvertMethod(int value)
{
return Convert.ToString(value);
}
new Converter<int, String>(...)
This instantiates a Generic class (or delegate) named Converter with the item in parenthesis being the delegate itself.
Converter<int, String> converter = ...
The instantiated class (or delegate) is assigned to a variable named 'converter'.
I hope ive explained every word for you!
|
|
|
|
|
J4amieC wrote: read
What is the meaning of this word?
only two letters away from being an asset
|
|
|
|
|
Taken out of context, it could be the present or past tense of the verb "to read". It could be an item made of wood that is placed in the mouthpiece of a wind instrument, a mis-spelling of a common plant found beside a lake or finally an acronym for "Relative Element Address Designate" from the field of cryptography.
Take your pick and run with it.
|
|
|
|
|
J4amieC wrote: It could be an item made of wood that is placed in the mouthpiece of a wind instrument
I belive that is spelled "reed"...
|
|
|
|
|
He must yoose a splell chekker!
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Goood
Thanks!!
I really appreciate your help!
|
|
|
|
|
The Thread object getting with Thread ID <---- is possible?
There will be what kind of method and peels?
exam 1)
System.Diagnostics.ProcessThreadCollection ptc = curProc.Threads;
foreach (System.Diagnostics.ProcessThread ptt in curProc.Threads)
{
System.Threading.Thread th = ptt.id <--------- casting failed : ID is int type
Or
System.Threading.Thread th = (System.Threading.Thread)ptt.id <-------- casting failed
}
exam 2)
System.Diagnostics.ProcessThreadCollection ptc = curProc.Threads;
System.Diagnostics.StackTrace[] st = new System.Diagnostics.StackTrace[ptc.Count];
foreach (System.Diagnostics.ProcessThread ptt in curProc.Threads)
{
st[iPtCnt] = new System.Diagnostics.StackTrace(ptt, true); <--- casting failed ptt
}
MSDN) OverLoad List ---> StackTrace(Thread, Boolean)
.
|
|
|
|
|
Hi,
AFAIK you can't get a Thread unless you are creating one, as in Thread thr=new Thread(...);
The ManagedThreadId is a number that helps you in differentiating threads, I use it when logging application progress and intermediate results.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Didn't you ask a verbatim question here[^] and get the same answer?
|
|
|
|
|
i user this code to get all users on the domain but it only returns me 1,000 users the problem is i have over 3,000 users in my domain what can i do to get the entire user list from AD
public static ArrayList GetAllADDomainUsers()
{
string domainpath = @"LDAP://DC=tshospital,DC=com";
ArrayList allUsers = new ArrayList();
DirectoryEntry searchRoot = new DirectoryEntry(domainpath);
DirectorySearcher search = new DirectorySearcher(searchRoot);
search.Filter = "(&(objectClass=user)(objectCategory=person))";
search.PropertiesToLoad.Add("samaccountname");
SearchResult result;
SearchResultCollection resultCol = search.FindAll();
if (resultCol != null)
{
for (int counter = 0; counter < resultCol.Count; counter++)
{
result = resultCol[counter];
if (result.Properties.Contains("samaccountname"))
{
allUsers.Add((String)result.Properties["samaccountname"][0]);
//allUsers.Add(result.GetDirectoryEntry());
}
}
}
return allUsers;
}
|
|
|
|
|
You have to perform a paged seach, you can't exceed the server side limit of
1000 objects returned.
See DirectorySearcher.PageSize [^]property.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
PLEASE HELP ME TO GENERATE DYNAMIC CRYSTAL REPORTS BY SETTING DATE AS PARAMETER FIELD.
RAJESH
|
|
|
|
|
Umm, take it easy with the capitals.
What's the problem?
|
|
|
|
|
dont try any more. i had your question for a long time.
it has no answer.i searched a lot on the web.but you search again for it. you may find it. i made a
code to serialize it into xml and create a dynamic report.
i have this code for microsoft reports(.RDLC) it is not CrystalReport but it may solve your problem. it is incomplete. and also has errors. its incomplete because i tried to print my views directly.
if you fixed it send it to me.
namespace Proj.RDLC_Reports
{
enum Alignment
{
Right,
Left,
Center
}
interface IXMLExportable
{
string ToXml();
bool IsAvailable { get; }
}
static class Class_RDLCReportCreator
{
static Report CreateReportByGrid(System.Windows.Forms.DataGridView DataGridView, System.Drawing.Printing.PaperKind PaperKind, bool Portrait, DataSources DataSources, Proj.RDLC_Reports.ReportParameters ReportParameters)
{
Report R = new Report();
R.DataSources = DataSources;
R.Language = "en-US";
R.ReportParameters = ReportParameters;
Table T = new Table();
foreach (System.Windows.Forms.DataGridViewColumn DGVC in DataGridView.Columns)
{
}
return R;
}
}
class Style : IXMLExportable
{
private string fontFamily;
public string FontFamily { get { return fontFamily; } set { fontFamily = value; } }
private int fontSize;
public int FontSize { get { return fontSize; } set { fontSize = value; } }
private int fontWeight;
public int FontWeight { get { return fontWeight; } set { fontWeight = value; } }
private int paddingLeft;
public int PaddingLeft { get { return paddingLeft; } set { paddingLeft = value; } }
private int paddingRight;
public int PaddingRight { get { return paddingRight; } set { paddingRight = value; } }
private int paddingTop;
public int PaddingTop { get { return paddingTop; } set { paddingTop = value; } }
private int paddingBottom;
public int PaddingBottom { get { return paddingBottom; } set { paddingBottom = value; } }
private Alignment textAlign;
internal Alignment TextAlign { get { return textAlign; } set { textAlign = value; } }
public string ToXml() { return ""; }
public bool IsAvailable { get { return false; } }
}
class Report : IXMLExportable
{
private int interactiveHeight; internal int InteractiveHeight { get { return interactiveHeight; } set { interactiveHeight = value; } }
private int interactiveWidth; internal int InteractiveWidth { get { return interactiveWidth; } set { interactiveWidth = value; } }
private int rightMargin; internal int RightMargin { get { return rightMargin; } set { rightMargin = value; } }
private int leftMargin; internal int LeftMargin { get { return leftMargin; } set { leftMargin = value; } }
private int bottomMargin; internal int BottomMargin { get { return bottomMargin; } set { bottomMargin = value; } }
private int width; internal int Width { get { return width; } set { width = value; } }
private string language = "en-US"; internal string Language { get { return language; } set { language = value; } }
private int topMargin; internal int TopMargin { get { return topMargin; } set { topMargin = value; } }
private DataSets dataSets; internal DataSets DataSets { get { return dataSets; } set { dataSets = value; } }
private DataSources dataSources; internal DataSources DataSources { get { return dataSources; } set { dataSources = value; } }
private Body body; internal Body Body { get { return body; } set { body = value; } }
private ReportParameters reportParameters; internal ReportParameters ReportParameters { get { return reportParameters; } set { reportParameters = value; } }
public string ToXml() { return ""; }
public bool IsAvailable { get { return true; } }
}
class DataSources : System.Collections.ObjectModel.Collection<DataSource>, IXMLExportable
{
public string ToXml() { return ""; }
public bool IsAvailable { get { return false; } }
}
class ConnectionProperties : IXMLExportable
{
private string dataProvider;
public string DataProvider { get { return dataProvider; } set { dataProvider = value; } }
private string connectString;
public string ConnectString { get { return connectString; } set { connectString = value; } }
public string ToXml() { return ""; }
public bool IsAvailable { get { return false; } }
}
class DataSource : IXMLExportable
{
private ConnectionProperties connectionProperties;
internal ConnectionProperties ConnectionProperties { get { return connectionProperties; } set { connectionProperties = value; } }
public string ToXml() { return ""; }
public bool IsAvailable { get { return false; } }
}
class DataSet : IXMLExportable
{
private string name;
public string Name { get { return name; } set { name = value; } }
private Fields fields;
internal Fields Fields { get { return fields; } set { fields = value; } }
private Query query;
internal Query Query { get { return query; } set { query = value; } }
public string ToXml() { return ""; }
public bool IsAvailable { get { return false; } }
}
class Fields : System.Collections.ObjectModel.Collection<Field>, IXMLExportable
{
public string ToXml() { return ""; }
public bool IsAvailable { get { return false; } }
}
class Field : IXMLExportable
{
private string name;
public string Name { get { return name; } set { name = value; } }
private string dataField;
public string DataField { get { return dataField; } set { dataField = value; } }
public string ToXml() { return ""; }
public bool IsAvailable { get { return false; } }
}
class Query : IXMLExportable
{
private string dataSourceName;
public string DataSourceName { get { return dataSourceName; } set { dataSourceName = value; } }
private string commandText;
public string CommandText { get { return commandText; } set { commandText = value; } }
public string ToXml() { return ""; }
public bool IsAvailable { get { return false; } }
}
class DataSets : System.Collections.ObjectModel.Collection<DataSet>, IXMLExportable
{
public string ToXml() { return ""; }
public bool IsAvailable { get { return false; } }
}
class Body : IXMLExportable
{
private int height;
public int Height { get { return height; } set { height = value; } }
private ReportItems reportItems;
internal ReportItems ReportItems { get { return reportItems; } set { reportItems = value; } }
public string ToXml() { return ""; }
public bool IsAvailable { get { return false; } }
}
class ReportItems : System.Collections.ObjectModel.Collection<ReportItem>, IXMLExportable
{
public string ToXml() { return ""; }
public bool IsAvailable { get { return false; } }
}
abstract class ReportItem : IXMLExportable
{
private Style style;
internal Style Style { get { return style; } set { style = value; } }
public abstract string ToXml();
public abstract bool IsAvailable { get; }
}
class TextBox : ReportItem, IXMLExportable
{
private int zIndex; public int ZIndex { get { return zIndex; } set { zIndex = value; } }
private bool canGrow = true; public bool CanGrow { get { return canGrow; } set { canGrow = value; } }
private string value; public string Value { get { return this.value; } set { this.value = value; } }
public override string ToXml() { return ""; }
public override bool IsAvailable { get { return false; } }
}
class ReportParameters : System.Collections.ObjectModel.Collection<ReportParameter>, IXMLExportable
{
public string ToXml() { return ""; }
public bool IsAvailable { get { return false; } }
}
class ReportParameter : IXMLExportable
{
private string dataType = "String";
public string DataType { get { return dataType; } set { dataType = value; } }
private bool allowBlank = true;
public bool AllowBlank { get { return allowBlank; } set { allowBlank = value; } }
private string prompt;
public string Prompt { get { return prompt; } set { prompt = value; } }
private string name;
public string Name { get { return name; } set { name = value; } }
public string ToXml() { return ""; }
public bool IsAvailable { get { return false; } }
}
class Table : ReportItem, IXMLExportable
{
private string name; public string Name { get { return name; } set { name = value; } }
private string dataSetName; public string DataSetName { get { return dataSetName; } set { dataSetName = value; } }
private TableSection details; internal TableSection Details { get { return details; } set { details = value; } }
private TableSection header; internal TableSection Header { get { return header; } set { header = value; } }
private TableSection footer; internal TableSection Footer { get { return footer; } set { footer = value; } }
public override string ToXml() { return ""; }
public override bool IsAvailable { get { return false; } }
}
class TableSection : System.Collections.CollectionBase
{
private TableRows tableRows; internal TableRows TableRows_ { get { return tableRows; } set { tableRows = value; } }
}
class TableRows : System.Collections.ObjectModel.Collection<TableRow>, IXMLExportable
{
#region IXMLExportable Members
public string ToXml()
{
throw new NotImplementedException();
}
public bool IsAvailable
{
get { throw new NotImplementedException(); }
}
#endregion
}
class TableRow : System.Collections.CollectionBase, IXMLExportable
{
private int height; internal int Height { get { return height; } set { height = value; } }
private TableCells tableCells; internal TableCells TableCells { get { return tableCells; } set { tableCells = value; } }
#region IXMLExportable Members
public string ToXml()
{
throw new NotImplementedException();
}
public bool IsAvailable
{
get { throw new NotImplementedException(); }
}
#endregion
}
class TableCells : System.Collections.ObjectModel.Collection<TableCell>, IXMLExportable
{
#region IXMLExportable Members
public string ToXml()
{
throw new NotImplementedException();
}
public bool IsAvailable
{
get { throw new NotImplementedException(); }
}
#endregion
}
class TableCell : System.Collections.ObjectModel.Collection<ReportItem>, IXMLExportable
{
#region IXMLExportable Members
public string ToXml()
{
throw new NotImplementedException();
}
public bool IsAvailable
{
get { throw new NotImplementedException(); }
}
#endregion
}
}
|
|
|
|
|
The below command writes not fast enough. Is there any way to fasten it.
Stored procedure is not an option for now.
It writes to Access via data reader from as400
<pre> olecmd.CommandText = "INSERT INTO NXAC08 " + "([Article], [Store], [Year], [Month], [Day],
[Unit], [Value], [Discount]) Values (" + dr["Article"].ToString() + ", " + dr["Store"].ToString()
+ ", " + dr["Year"].ToString() + ", " + dr["Mounth"].ToString() + ", " + dr["Day"].ToString() + ", "
+ dr["UNIT"] + ", " + dr["VALUE"].ToString() + ", 0)";
olecmd.ExecuteNonQuery();</pre>
|
|
|
|
|
Ladies and gentlemen, please fasten your .. datareaders?
I assume you want it to be faster, but I see absolutely no way to do that. This is a string. Creating it is fast enough. If the database is being slow than your database is slow, but then we already knew that since you are using Access.
Solution: don't use Access.
|
|
|
|
|
how fast or slow is it? how did you establish that? is that for the first insert only, or have all your insert commands such speed? and how fast do you want it to be?
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
If you execute this code many times you can probably hasten it by using parameters (and eliminating the ToString s).
|
|
|
|
|
Hi,
There is a string such as:
string s = "12445-65432 abc, 98767-45364 th, 56749-23198"
How can I remove the letters so that I end up with:
s = "12445-65432, 98767-45364, 56749-23198"
Thanks
|
|
|
|
|
|
Use
Regex.Replace("your String", "[A-Za-z]", "");
himanshu
|
|
|
|
|
forget regex, simple function...
public string RemoveLetters(string original)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
for(int i = 0; i < original.Length; i++)
{
if(!char.IsLetter(original, i))
sb.Append(original[i]);
}
return sb.ToString();
}
EDIT:
my answer does exactly what is required, how it get 2 'bad answer' hits?
3.0 - getting better...
4.0 - much more respectable, thou it can never be a 5...
Life goes very fast. Tomorrow, today is already yesterday.
modified on Thursday, June 25, 2009 10:59 AM
|
|
|
|
|
At the risk of starting a flamewar how is
public string RemoveLetters(string original)<br/>{<br/> System.Text.StringBuilder sb = new System.Text.StringBuilder();<br/> for(int i = 0; i < original.Length; i++)<br/> {<br/> if(!char.IsLetter(original, i))<br/> sb.Append(original[i]);<br/> }<br/> return sb.ToString();<br/>}
Simpler than:
Regex.Replace("your String", "[A-Za-z]", "");
Despite the common belief that string builders are better, they are inefficient for most applications, it'd be much quicker cycling through an array of chars (a-z) (or their equivalient integer values & converting) and removing them in a loop.
The regex will allow other caracters he'll probably need to remove to be added with ease.
|
|
|
|
|
I didn't say it was simpler, just there is a simple way of doing it yourself.
If you loop the chars you will have to create a new string with each remove anyway. I don't know the exact performance difference so I'm not trying to argue its better in that respect. I just basically like to give answers that show the logic involved (when its a simple task like this), that way people can learn the logic and apply that when 'out the box' functions either are not available or simple don't do exactly what you want.
For example, lets say the OP really wants to do this task over a 1GB file with a background worker. Now obviously you don'd load 1GB into a string, you would do a ReadByte loop or something similar, but my method shows how easy it is to detect if a character is a letter and then progress can be reported after each loop (or 1000 loops etc.)
Don't get me wrong, was not trying to start an argument, both Regex suggestions are perfectly valid - just wanted to give an alternative
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|