|
Hi,
Does anyone know whether it is possible to write managed code that utilised the L1 and L2 cache? The reason I'm asking is because it is faster to access the L1 and L2 cache.
Thanks
kk
|
|
|
|
|
The most recently used data and code are stored in the cache automatically, and only swapped out to main memory when something else needs the space. You don't need to do anything special to make this work. For computationally intensive code you want to try and keep your working set of data and the hot loop of your code small enough to fit into the cache if possible, but these days that's almost never needed unless you're doing scientific computing in which case you should probably be using C++ to begin with so you can ultimately rewrite the innermost sections of the hot loop in assembler This ofc assumes you are or have the skills of a good assembler programmer available, an average coder is probably going to be out performed by the compiler now.
--
You have to explain to them [VB coders] what you mean by "typed". their first response is likely to be something like, "Of course my code is typed. Do you think i magically project it onto the screen with the power of my mind?" --- John Simmons / outlaw programmer
|
|
|
|
|
Hi Dan,
Thanks for replying. I'm actually involved in high performance computing. I've read an article on whether CLI-based virtual machine is suitable for high performance computing and the conclusion is it is possible. Code becomes more efficient as JIT compiler progresses from one version to a new version. I believe Java Grande has also proven that Java is suitable for high performance computing.
Regards,
kk
|
|
|
|
|
Has anyone got crystal to work with MySQL and VS 2005?
I've tried connecting via ODBC and everytime i touch the database expert VS encounters problems and has to close. I've had a really good search on Google and can't find any pointers as to how to get these things to work.
If anyone's got a website that might help me i'd be really grateful,
Thanks in advance,
Russell
|
|
|
|
|
|
|
Hi,
I want to search a specific string in .txt file and copy that string in to another file. How can i do this in C#?
|
|
|
|
|
Try this out:
StreamReader reader = new StreamReader("c:\\test.txt");
String line = "";
while(line != null)
{
line = reader.ReadLine();
if(line.IndexOf("is line two") != -1)
{
StreamWriter writer = new StreamWriter("c:\\testOut.txt");
writer.Write("found!");
writer.Close();
break;
}
}
|
|
|
|
|
Hi everyone,
I just wanna know how do u compare a password with the one given in the login form when its been encrypted with MD5 technique. How can u check that the user has entered correct password.
thanks
Rocky
|
|
|
|
|
Rocky71 wrote: I just wanna know how do u compare a password with the one given in the login form when its been encrypted with MD5 technique. How can u check that the user has entered correct password.
By encrypting (or, to be accurate, hashing) the password that the user typed in then comparing the two MD5 hash values.
|
|
|
|
|
I need to start a Webbrowser and control it's behaviour afterwards (Navigate, show/hide menu...). To simply call iexplore.exe with an URL or use the WebBrowser-Control is not an option
Previous to C# I used the IWebBrowser2-Interface out of SHDocVw which worked just fine, I tried to do the same C# but every time I want to .Navigate I got a ComException with HRESULT of 0x80004005 (E_FAIL).
Anybody got an idea?
Thanks in advance
|
|
|
|
|
I did something of this sort with the WebBrowser control in VS 2005. But this is just a control and does not open IE in a separate window. You need to develop a windows form which has this control embedded. You can control almost all the navigation and display options of IE using the methods and properties of the control.
Regards
SG
|
|
|
|
|
Thank you for the answer, I tried several possibilities and nothing worked as wanted. I will stick to your solution, it's the easiest and fastest way
Regards
apet
|
|
|
|
|
Hi.
I have this problem, i can't figure out what i should do.
I want to make an application where i can insert people to a database.
I'm using textboxes to write info about the person and so on.
And i want it all into a database where i can edit it again after..
Please help me, i hope you understand what i'm writing..
I'm new at this..
|
|
|
|
|
|
Please tell what the problem you are facing. We are not here to write code for you. Supply code snippet or scinario which you are facing problem.
I suggest you should try google first and see how database connection works with c# application and so on.
Mubashir
Software Architect
Storan Technologies Inc, USA
Every job is a self portrait of the person who did it.
|
|
|
|
|
Stoumann wrote: ease help me, i hope you understand what i'm writing..
Your question was easy enough to understand, unfortunately it is not one that can be answered in a single post.
Stoumann wrote:
I'm new at this.
Everyone has to start somewhere! At least you have not shosen a ridiculously difficult first project like "I want to write a face recognistion service that interops with 2 cameras to track movement "
Start by lookin g into ADO.NET - this provides you with database access capabilities. You could also look at DataBinding if its a windows forms app, otherwise look at ASP.NET page lifecycle to discover how to link web controls to data drawn from a database.
|
|
|
|
|
hey Stoumann are you a new Developer.
Have you ever heard of the ADO.Net or just did you google that how to insert people to database using C#.
So first try to google it and get the Articles there are lot of articles are there.
SO try with the articles and then if you have got any problem ie., error tell here.we will help you in solve that problem.
this is not a single step answer to tell in this regards.
Regards,
Satips.
|
|
|
|
|
Hello everybody!
Can someone tell me why the following code comes to the conclusion that using an event instead of a direct method call is about 3 times faster????
Its pretty simple, just copy it at give it a go!
------------------------------------------
public class Class1
{
event TestDelegate TestEvent;
delegate void TestDelegate(String test);
public static void Main(String[] args)
{
//Number of cycles
int n = 10000000;
Class1 c = new Class1();
//register events
c.TestEvent += c.Test;
c.TestEvent += c.Test1;
c.TestEvent += c.Test2;
Console.WriteLine("Calling event {0} times....", n);
DateTime startTime = DateTime.Now;
//Call the event n times
for (int i = 0; i < n;i++ )
{
if(c.TestEvent != null)
c.TestEvent("i = " + i);
}
DateTime stopTime = DateTime.Now;
TimeSpan duration = stopTime - startTime;
Console.WriteLine("Calling normal {0} times....", n);
startTime = DateTime.Now;
//Call the event n times
for (int i = 0; i < n; i++)
{
c.Test("i = " + i);
c.Test1("i = " + i);
c.Test2("i = " + i);
}
stopTime = DateTime.Now;
TimeSpan duration2 = stopTime - startTime;
Console.WriteLine("Event based call took: {0},{1} sec", duration.Seconds, duration.Milliseconds);
Console.WriteLine("Normal call took: {0},{1} sec", duration2.Seconds, duration2.Milliseconds);
double eventTime = duration.Seconds*1000 + duration.Milliseconds;
double normalTime = duration2.Seconds*1000 + duration2.Milliseconds;
Console.WriteLine("Normal calling is about {0} times faster.", eventTime/normalTime);
Console.ReadLine();
}
private void Test(String test)
{
//do sth
int i = 0;
int x = i * 2;
}
private void Test1(String test)
{
//do sth
int i = 0;
int x = i * 2;
}
private void Test2(String test)
{
//do sth
int i = 0;
int x = i * 2;
}
}
------------------------------------------
Thanks in advance!
|
|
|
|
|
Hi,
the difference is
c.Test("i = " + i);
c.Test1("i = " + i);
c.Test2("i = " + i);
does generate three new strings, whereas c.TestEvent("i = " + i);
generates only one.
|
|
|
|
|
Your right, of course! Thanks!
So with the application changed, the result is that using the event mechanism is about 7% slower (for my example application). This seams reasonable.
Steffen
|
|
|
|
|
A main hashtable is populated with a Dictionary entry and several other hashtables with keys and values.
Now I would like to loop through the main hashtable and retrieve the value of each key in each item i.e. hashtables and Dictionary item.
This is what I am trying to do but it gives an error because the first item in the main hashtable is a disctionary entry.
Thanks
foreach (Hashtable ht in Globals.CacheHashTablesMain)
{
}
|
|
|
|
|
Hello,
You have to look for DictionaryEntry in Hashtable.
foreach(DictionaryEntry de in YourHT)
{
//de.Key
//de.Value
}
All the best
Martin
-- modified at 7:57 Tuesday 8th May, 2007
|
|
|
|
|
Hi,
please note that each hashtable inside the main hashtable has many items.
so I think de.value does not work.
Thanks
|
|
|
|
|
Hello,
Ok, I didn't got your question write at first.
You have to iterate to the main hashtable and cast the falues to Hashtable and iterate again threw that, to get your items.
foreach(DictionaryEntry de in MainHashtable)
{
Hashtable subHT = de.Value as Hashtable;
if(subHT!=null)
{
foreach(DictionaryEntry deSub in subHT)
{
}
}
}
To make it look a little more OOP, you could create a recursive method call, but in this special case it's not neccesary as it is not to abstract.
Hope it helps!
All the best,
Martin
|
|
|
|