|
I think I have configured log4net SMTP appender correctly
<appender name="SmtpAppender" type="log4net.Appender.SmtpAppender">
<to value="myAddress@gmail.com" />
<from value="myAddress@gmail.com" />
<subject value="test logging message" />
<smtpHost value="127.0.0.1" />
<bufferSize value="0" />
<lossy value="true" />
<evaluator type="log4net.Core.LevelEvaluator">
<threshold value="INFO"/>
</evaluator>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%newline%date [%thread] %-5level %logger [%property{NDC}] - %message%newline%newline%newline" />
</layout>
</appender>
I know I've configured log4net appender correctly because after logging code executed successfully, I was able to found notification/logging email under H:\Inetpub\mailroot\Queue
The problem is, I don't know IIS SMTP admin well enuf these email always sit under Queue directory and never get sent out to my gmail account "myAddress@gmail.com"
Thanks!
dev
|
|
|
|
|
Hi,
I have a program running in windows .net that looks for active directory information. Is there a way I can use the object Active Directory in VS 2008 for web application?
In windows you have the object from the toolbox under components but if you create program for web it's not there. any Idea on how to use it for web purposes?
Thanks
Dabsukol
|
|
|
|
|
There is no equivilent control in the Web Forms ToolBox. You just have to write the code manually using the classes in the System.DirectoryServices namespace.
|
|
|
|
|
I am a fairly good VB.NET programmer.(Please don't laugh) I have been programming in VB.NET for 2 years. I took C++ classes in college and love C syntax in general but never got into developing real applications so I am missing much of the important information I am sure. I have been scanning the job sites for a while and find that there are many less opportunities for VB programmers while there are many jobs for C# programmers. Can someone point me toward a good tutorial in C# and it would be nice if it was one that was for someone coming from VB to C# and at the same time understand that I do know VB and not teach me obvious concepts.
Thank you for your time.
Humble Programmer
|
|
|
|
|
Try www.asp.net both all examples are thought in c# and VB codes.
go to learn.
Dabsukol
|
|
|
|
|
This site is full of C# tutorials and articles you can work through.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
There are a lot of tutorials (actually MSDN documentation has a lot of them), just google for them.
But I would recommend to read Jeffrey Richter's "CLR via C#" book, it will not only give you the basics of C#, rather it will show you the guts of .Net. This is IMO one of the best .Net books around.
Andrew Troelsen's "Pro C# 2008 and the .NET 3.5 Platform" is also very good, but read Richter first
Regards,
Lev
|
|
|
|
|
I found this link usefull clickety[^]
I also get a C# - VB conversion pocket reference from OReilly which was also usefull.
You have the advantage of some grounding in C++.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hello,
I am implementing search functionalities in C# windows form application. I want that the TextBox which accept the search text should persist the text when entered, and, whenever user types in next time, it should display the similar text as dropdown list.
It is very similar to what Google's search text box or Rediffmail's userID text box supports.
How we can implement it?
Thanks in Advance.
|
|
|
|
|
I thought the textbox in winforms had this by default, you just need to specify an autocomplete data source ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Indeed
AutocompleteSource
Autocompletemode
Are the property's
|
|
|
|
|
Ok. i've never done this before but after readn your question I decided to give it a go. All you need to do is add a textbox control to your form in designer view, click on it, then in the proprties pane, scroll all the way down the bottom til you see "Misc" and beneith that you'll see three options. play around with those it's real easy. Works for me.
j.t.
j.t.
|
|
|
|
|
Thanks all,
Still i am not able to save my custom inputs of the text fields which can be populated next time. I can see the url's from history as suggestion but not my custom entries.
I have set AutoCompleteMode = "Suggest" and AutoCompleteSource = "CustomSource".
Do i need to fill the source programmatically on each entry OR how to do it?
Thanks.
|
|
|
|
|
hello
I've been using log4net for sometime, been using file appender, just configured ADO.NET db appender - loggin code executed successfully goes into database as anticipated. I googled a bit - I fixed the problem by setting "bufferSize" to zero instead of "100" as indicated in Log4net examples! Any idea what's with "bufferSize"?
<a href="http://markmail.org/message/ox2ppgjkzuws24yd#query:log4net%20%22database%20logging%22%20problem+page:1+mid:5dlmivgrpnhyitju+state:results">http://markmail.org/message/ox2ppgjkzuws24yd#query:log4net%20%22database%20logging%22%20problem+page:1+mid:5dlmivgrpnhyitju+state:results</a>[<a href="http://markmail.org/message/ox2ppgjkzuws24yd#query:log4net%20%22database%20logging%22%20problem+page:1+mid:5dlmivgrpnhyitju+state:results" target="_blank" title="New Window">^</a>]
<a href="http://logging.apache.org/log4net/release/config-examples.html">http://logging.apache.org/log4net/release/config-examples.html</a>[<a href="http://logging.apache.org/log4net/release/config-examples.html" target="_blank" title="New Window">^</a>]
<appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
<bufferSize value="100" />
<connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<connectionString value="data source=LAPPC2;initial catalog=AuditTrail;integrated security=false;persist security info=True;User ID=sa;Password=9nfv4571" />
<commandText value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message],[Exception]) VALUES (@log_date, @thread, @log_level, @logger, @message, @exception)" />
<parameter>
<parameterName value="@log_date" />
<dbType value="DateTime" />
<layout type="log4net.Layout.RawTimeStampLayout" />
</parameter>
<parameter>
<parameterName value="@thread" />
<dbType value="String" />
<size value="255" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%thread" />
</layout>
</parameter>
<parameter>
<parameterName value="@log_level" />
<dbType value="String" />
<size value="50" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%level" />
</layout>
</parameter>
<parameter>
<parameterName value="@logger" />
<dbType value="String" />
<size value="255" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%logger" />
</layout>
</parameter>
<parameter>
<parameterName value="@message" />
<dbType value="String" />
<size value="4000" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%message" />
</layout>
</parameter>
<parameter>
<parameterName value="@exception" />
<dbType value="String" />
<size value="2000" />
<layout type="log4net.Layout.ExceptionLayout" />
</parameter>
</appender>
dev
|
|
|
|
|
I am storing all html pages in DB through SQL Navigator.IN html page , the search option is available.Now i have to declare the variable in the code to run the search item after you hit GO button.How should i declare it
|
|
|
|
|
I'm at a loss. Is this an ASP.NET question ? How does a html page have a search option, if it's not a server driven page ? Are you trying to store a page and then come back to it and run it's search ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I am using content clob to store whole page(HTML) in asp.net(C#) in sql navigator.now i want to link my code with search button in html
|
|
|
|
|
Hello,
I'm a bit of a newbie here, so would appreciate some help on this one!
I want to write a program that will display a map on a windows form. The map is built up of a 2-dimensional array of objects (either Land or Water), of size [1000, 1000], which represent whether that area of the map is land, or water. Eg. at Map[30, 50] there is a Land object, which means that at coordinates (30, 50), there is one square of land on the map. The Land and Water classes have a member called "colour", which defines the colour of that square on the map. Each square on the map has a side of length 1. So the map is just a load of squares all joined together.
Ok, so I now want to display this map on a form. To do this, I created a pictureBox on the form, and then created a graphics object, g, from this pictureBox. Next, I performed the following operations:
for (int i = 0; i < 1000; i ++)
{
for (int j = 0; j < 1000; j ++)
{
g.FillRectangle(new Pen(Map[i, j].colour).Brush, new Rectangle(i, j, 1, 1));
}
}
This basically colours in each square at coordinates (i, j) with the colour corresponding to whether it is land, or water, (green, or blue), at that location.
Essentially, this works. However, it is soooo slow to draw, and takes about 3 seconds just to draw the map. The map sweeps across the pictureBox over a period of 3 seconds, rather than just instantly displaying the map. This is not acceptable for the purpose of the program.
Therefore, I am wondering what the best way would be to display this map. I have 2 ideas, but I wouldn't know how to implement them. They are :
* Using graphics buffers, which I have heard about, but have no idea how they work. Can anybody tell me how to use them?
* Using DirectX rather than the basic graphics I am using (is it called GDI?)
Please could anybody advise on how to improve the performance of this program, so that I can just display the map instantly.
Thank you for your help
Ed.
|
|
|
|
|
Hi,
so you are creating one million pens and wondering why it is sooo slow?
furthermore, your PictureBox is not serving a real purpose, you can draw your map on top of any kind of Control, e.g. a Form itself, a Panel (that is what I prefer), etc.
Now why can't you turn the whole map into a real Bitmap; say you do something like this:
int w=1000;
int h=1000;
Bitmap bm=new Bitmap(w,h);
for (int y=0; y< h; y++) {
for (int x=0; x< w; x++) {
bm.SetPixel(x, y, someColor);
}
}
this will take a while, but has to happen only once. After that you can paint this image over and over, either yourself (e.g. in a Panel's paint handler), or automatically by setting myPictureBox.Image=bm;
BTW: you can speed up the above bitmap creation by using "unsafe" code and pointers; a little Google action will inform you about the details.
FYI: all the objects you create need to be disposed of if their class provides a Dispose() method;
this applies to pens, brushes, fonts, and many more; disposing will free unmanaged resources much sooner, improving the memory situation and the overall performance.
|
|
|
|
|
Luc Pattyn wrote: a little Google action
Haven't had any of that for a while
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Luc Pattyn wrote: so you are creating one million pens and wondering why it is sooo slow?
Not only that, he's not Disposing them either. Well, from the limited code sample he provided anyway.
|
|
|
|
|
Using SetPixel is dog slow. If more than a few pixels are modified, it's next to worthless. I know of two efficient ways to modify a bitmap on a pixel-by-pixel basis. Both methods have advantages.
First, lock the bitmap, access it with pointers in unsafe mode, then unlock it. Here's a link to a very nice article using this approach:
Code Project Article
Second, lock the bitmap, copy it to a regular array, and unlock it. Modify the data in the array, and when done, lock the bitmap, copy the data back, then unlock the bitmap. If you only want to initialize the bitmap, you can simplify the process, since there's no need to copy from the bitmap. Just write the regular array and copy it to the (locked) bitmap. This idea is also useful if you only want to individually modify pixels, and don't need to use any of the bitmap features, such as line drawing. Use the pixel array as the "master" version, and copy it into the bitmap to display it. Here's an example of this method:
<br />
using System;<br />
using System.Collections.Generic;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Drawing;<br />
using System.Text;<br />
using System.Windows.Forms;<br />
using System.Runtime.InteropServices;<br />
using System.Drawing.Imaging;<br />
<br />
const int bmB = 0;<br />
const int bmG = 1;<br />
const int bmR = 2;<br />
const int bmA = 3;<br />
<br />
int bitsPerPixel;<br />
bool hasAlpha;<br />
switch (bitmap.PixelFormat)<br />
{<br />
case PixelFormat.Format24bppRgb:<br />
bitsPerPixel = 24;<br />
hasAlpha = false;<br />
break;<br />
case PixelFormat.Format32bppRgb:<br />
bitsPerPixel = 32;<br />
hasAlpha = false;<br />
case PixelFormat.Format32bppArgb:<br />
case PixelFormat.Format32bppPArgb:<br />
bitsPerPixel = 32;<br />
hasAlpha = true;<br />
break;<br />
default:<br />
throw new ArgumentException("Unsupported pixel format.");<br />
}<br />
<br />
int bytesPerPixel = bitsPerPixel >> 3;<br />
int stride = ((bitmap.Width * bitsPerPixel + 31) & ~31) >> 3;<br />
int bitmapBytes = stride * bitmap.Height;<br />
byte[] pixels = new byte[bitmapBytes];<br />
<br />
...<br />
<br />
BitmapData bmpData = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadWrite, bitmap.PixelFormat);<br />
<br />
Marshal.Copy(bmpData.Scan0, pixels, 0, bitmapBytes);<br />
<br />
bitmap.UnlockBits(bmpData);<br />
<br />
...<br />
<br />
BitmapData bmpData = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadWrite, bitmap.PixelFormat);<br />
<br />
Marshal.Copy(pixels, 0, bmpData.Scan0, bitmapBytes);<br />
<br />
bitmap.UnlockBits(bmpData);<br />
<br />
Note this only works for direct (non-indexed) bitmaps. For 24 bit pixels, the pixels are stored in B, G, R order; for 32 bit pixels, the order is B, G, R, A. For example, to access the green component of a 24 bit pixel at (x, y), use pixels[(bytesPerPixel * x + stride * y) + bmG].
modified on Tuesday, December 16, 2008 6:20 PM
|
|
|
|
|
Is this going to be a game? If yes, you may want to take a look at the XNA Framework[^].
Drawing a million rectangles per frame is going to be very slow. With XNA you could take advantage of your GPU - additionally XNA would put the the million objects into one batch and draw them at once as one large triangle list, which would only take a few milliseconds utilizing the GPU.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
good day people
so i want to get the location for every file type (both dll and index) and i tried using SHGetFileInfo api (ICONLOCATION flag) but for some reason it only works for either the desktop or a folder, regular fyletipes like .txt, .pdf, .xml dont work
is there another way i can get the dll and index for every file type?? i tried searching in the registry and it works for me but two specific file types still give me problems (cant find their icon's dll and index) when i run my program in another computer (my OS is windows vista x32, i have problems running it in vista (x86)
i'll repeat my main question: How can i get the dll and index for every file type??
thanks in advance for your help
|
|
|
|
|
|