|
Like I said, you plain do not understand your own code.
As I said, going to i+=2 means that you're not starting a new row for every item. Now you need to add code to draw every second item on the same row, or you will plainly get every second item only printed.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi,
Can you please refer me to a website where I can follow an asp.net 3.5 case study from start to finish?
I have searched msdn but have not found anything yet.
Thanks
|
|
|
|
|
Check here [^]
This is C# Forum Please Post it Asp.net Forum
|
|
|
|
|
|
Wondering if anyone has a state machine diagram on how regular expressions accomplish there job?
This way i can trace the diagram given a pattern and string input.
Regex.IsMatch
Regex.Replace
Regex.Split
just for learning purposes since i want to move deeper into interpretors and compilers. I already know how to implement regex in practice.
|
|
|
|
|
The book 'mastering Regular Expressions' from O Reilly has big chapters on how it all works internally.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi, I am new to c#, but I am a vb.net programmer. I have a line
strLastServer = drowData["ServerName"].ToString;
where strLastServer is declared
string strLastServer = "";
I am getting an error on build:
Cannot convert method group 'ToString' to non-delegate type 'string'. Did you intend to invoke the method?
I looked at an article on this site which seemed to suggest what I was doing was OK, but....
What am I doing wrong?
|
|
|
|
|
In C# method calls should have parathesis/()...
You will get used to it very soon
strLastServer = drowData["ServerName"].ToString();
Software - Bundle of bugs covered with features.
|
|
|
|
|
So simple - and I have been racking my brain for hours. Thanks a million!
|
|
|
|
|
public class UserSettings
{
public UserSettings[]
{
}
}
so that I can access it like so:
Console.WriteLine(UserSetting["ITEMNAME"]);
Thank you to everyone in advance.
QMuffs
|
|
|
|
|
What are you trying to accomplish?
"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
|
|
|
|
|
I think it is called an accessor to my class but I'm not sure.
Let's say I have this
UserSettings["ITEMNAME"]
When it does this I have to Validate the ItemName and return the default if it doesn't exist. I basically want the [] to act as a property in a way. Would it be an operator?
QMuffs
|
|
|
|
|
I think C# Indexers can help you. Please check this link to know more about Indexers
Indexer In C#[^]
Software - Bundle of bugs covered with features.
|
|
|
|
|
That is it. I did it before but couldn't remember how or what it was called. I was looking everywhere. You saved me from going insane. Thank you very much.
QMuffs
|
|
|
|
|
This is a strange problem to describe so you will have to bear with me! I have developed a web application using c#.net that utilises server side ASPX pages that connect to a SQL2000 database. I have been load testing my application with the Microsoft Application Test Center that comes with Visual Studio 2003, with simulated loads of 10 - 400 users.
When I run a test against my web application for upwards of 10 concurrent users I start to get strange results from the database for what should be routine queries. I execute a simple query looking for a row in a table which I know is there (100% certain!) and the query returns the results to a dataset. I then get the first datatable from the dataset and check that the dataset.rows.count variable is greater then 0. Which it always is! I then proceed to look for a column that exists in the table which I specifically selected and an exception is thrown telling me the column doesnt exist in the datatable. This is actually impossible the data is DEFINATLEY there!
I can log into SQL Query analyser as the same SQL logon that the ASPX page uses to connect and run the same query and it returns the expected results without error or anaomoly.
Once an error of this type has occured, I can replicated it upto 10 minutes after it first has happened. During this 10 minute period I can switch the SQL logon the ASPX uses and it runs fine. As soon as I switch it back to the user on which the error occured it demonstrates the same problem again. After 10 minutes the problem disappears and wont happen again until I apply a heavy load to the server.
As an important note, I have now managed to replicate an identical problem with just 2 users trying to concurrently login.
Here is the snippet of code iam using to query the database:
public static DataSet execute_DataTable(String SQL_Command_String)
{
String connectionString;
connectionString = getConnectionString(@"..\xml_Settings\DB_Connect.xml");
makeConnection(connectionString);
DataSet dsResults = new DataSet();
try
{
SqlDataAdapter dbAdapter = new SqlDataAdapter(SQL_Command_String, dbConn);
dbAdapter.Fill(dsResults, "Results");
}
catch (Exception exp)
{
throw new Exception(exp.Message + " " + exp.StackTrace, exp);
}
finally
{
dbConn.Close();
}
return dsResults;
}
This function is located in a static class in a class library that compiles to a DLL that is then referenced in my web project. Every time an ASPX page requires to query the database this method is called.
When I load test my application a typical session will involve 2000 queries in a very short period of time. This is because I use a recursive c# function for generating a tree that executes alot of SQL queries.
Iam really out of ideas here guys , does any one have any ideas? All I can think of is disposing of the dataset when iam done?
Thanks in advance!
Mike
|
|
|
|
|
Without looking too closely, it sounds like with liberal use of the static keyword you've ended up with a whole bunch of non-thread-safe code. Have a second look at your data layer and imagine how multiple simultaneous calls will affect it.
If you are dealing with trees, try querying for the entire subtree in a single recordset to speed things up. Common Table Expressions are useful for recursively pulling out data in a single query.
|
|
|
|
|
Hey There thanks for the advice, I think I could do with reading up on thread safe code! Would it be worth while turning my Database connection code into an instanciable object and totally removing the static keywords to try and avoid these issues?
Thanks Mike
|
|
|
|
|
Hi,
I am new to C#, tried working with Validation Application blocks using the .config file approach and have run into some issues.I have created a solution file with 2 projects, 1 project has a form and am passing a value to the other project ( basically a class library )which has the app.config file and the class which contains the properties for which i have the get and set values.
Project 1
using ClassLibrary1;
using Microsoft.Practices.EnterpriseLibrary.Validation;
using Microsoft.Practices.EnterpriseLibrary.Validation.Validators;
namespace Trial
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Class1 cw = new Class1();
cw.iNum = 1110;
ValidationResults results = Validation.ValidateFromConfiguration(cw, "Default");
if (!results.IsValid)
MessageBox.Show("error");
}
}
}
Project 2 has Class1.cs and the config file
Class1.cs
public class Class1
{
public int iNum;
public Class1()
{
}
#region Properties
public int Num
{
get { return iNum; }
set { iNum = value; }
}
#endregion
}
app.config
<configuration>
<configsections>
<section name="validation" type="Microsoft.Practices.EnterpriseLibrary.Validation.Configuration.ValidationSettings, Microsoft.Practices.EnterpriseLibrary.Validation, Version=4.0.0.0, Culture=neutral" />
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=4.0.0.0, Culture=neutral" />
</configsections>
<validation>
<type assemblyname="ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
name="ClassLibrary1.Class1">
<ruleset name="Default">
<properties>
<property name="Num">
<validator lowerbound="2" lowerboundtype="Inclusive" upperbound="100">
upperBoundType="Inclusive" negated="false" messageTemplate=""
messageTemplateResourceName="" messageTemplateResourceType=""
tag="" type="Microsoft.Practices.EnterpriseLibrary.Validation.Validators.RangeValidator, Microsoft.Practices.EnterpriseLibrary.Validation, Version=4.0.0.0, Culture=neutral"
name="Range Validator" />
</validator></property>
</properties>
</ruleset>
</type>
</validation>
</configuration>
my problem is that i am passing a value of 1110, but the range value is from 2 till 100, yet the validation is succeeding. Am i missing out on any details
|
|
|
|
|
my app get slow when i select items in ListView because the event SelectedIndexChanged called everytime an item get select, for example if i select an item, scroll down and select another item with SHIFT after around 1000+ items then that event will be 1000+ times, i searched on google and found some solutions, like using Timer, but i want to know that is there any other good solution ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
My only suggestion to you would be to rethink your approach. Surely having 1000+ records in a list view cannot be user friendly at all...
|
|
|
|
|
so can you tell me what should i use then ??
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
you need to separate your ui thread from data access thread.
use the background worker class.
attach your binding logic to "progress" event in the background worker and send 10 records (adjust accordingly) at a time to the ui.
that said i kinda agree with J$
being able to filter and doing lazy loading might be a better approach. so you give more information as the user requests it.. .not just send them everything in 1 request.
|
|
|
|
|
no its not what you think, i have to give all info. to user then (s)he will select items from ListView and do some tasks...thats why List controls were created, isnt it ?
ListView is too slow in everything, like deleting, selection .... but it looks better than DataGridView
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
guysss
suppose i select two imagess
and i want to compare them
like if they are exactly same or not
(by selecting sum random selected rectabgular portion of the images)
then how will i compare them by pixel by pixel
or any other method
|
|
|
|
|
no, you have to compare pixel by pixel
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|