|
Hi All,
I have a treeView control and i am adding nodes to it dynamically.But i want to save total tree to a Binary Tree Data Structure.I don't know about Binary Tree,So any body knows how to send treeview data to binary tree pls send me the steps and if possible sample code.
thanks
sastry
|
|
|
|
|
Hi,
I am trying to download a file from server using WebRequest object. The following is my algorithm.
1. Create a WebRequest object
WebRequest req = WebRequest.Create(<URL>);
2. Set the method to the request object
req.Method = "GET";
3. Set the current user credentials
req.Credentials = CredentialCache.DefaultCredentials;
4. Get the response
WebResponse res = req.GetResponse();
5. Get the response stream
Stream inStream - res.GetResponseStream();
6. Save the stream to the local file.
GetReponse takes lot of time and I want to optimize the same. Can anyone suggest me what settings I can make so that I can reduce the time. I will be downloading the files from within the intranet.
Thanks for any suggestions
V. Srinivas
|
|
|
|
|
my suggestions, not much of a solution:
- maybe it's worth trying to use ftp for the files transfer.
- try to use a network sniffer (even windump will do) to see where, and especially when, the delays occur
there are no facts, only interpretations
|
|
|
|
|
Thanks for the suggestions. Actually I am downloading the files from Microsoft Share Point Server and the files need to be downloaded using the URL paths. I am not very sure whether ftp supports URLs.
Regards,
V. Srinivas
|
|
|
|
|
V. Srinivas wrote:
I am not very sure whether ftp supports URLs
neither am I. But try sniffing the network, this way you'll know if its a server problem, a client problem or a mysterious network problem.
there are no facts, only interpretations
|
|
|
|
|
I am myself not a great admirer of this feature and I understand we can still do the needful using interfaces. But I am interested in *technical reasons* why .NET guys decided to omit this feature from .NET This seems to be a favourite interview question.
|
|
|
|
|
Here is a little things that I read recently.
C# offers only single inheritance which means that a class can have only one direct base class. This restriction is actually imposed by the CLR so single inheritance is the rule for all .NET languages. The designers of .NET acknowledge that multiple inheritance is more powerful than single inheritance; however, they decided that the extra complications and ambiguous situations that arise in the presence of multiple base classes were not worth this extra power.
Steve Maier, MCSD MCAD
|
|
|
|
|
Hey thanks buddy, that’s right. I think, I should frame my interview answer as follows:
(1) As one of the core features, .NET platform targets to support multiple languages. The internal constructs of each language compiler to implement MI differ.
(2) The cost of implementing MI (especially due to above mentioned reason) is quite high as MI is relatively rarely used in most OOP designs. For those rare situations, interface based MI, which does not involve much of an overhead and complexities, can be used.
(3) A language or platform supporting MI becomes rather complex from developer as well as the compiler writer perspective because of the confusion involved in casting, member references ambiguity, serializing and so on. .NET aims to be a clean and intuitive platform.
Howz that?
|
|
|
|
|
Sounds pretty good. On my last .Net related interview I did not need to answer questions like that. There were some technical questions, but it was mainly system based, like how do you handle this situation on a web server farm.
Steve Maier, MCSD MCAD
|
|
|
|
|
Oh yeah, oh yeah... Exactly! I would love to hear some real-world stuff like that from those guys.
Salil Khedkar [^]
|
|
|
|
|
hi,
i am doing a custom control inherits from button but has diffrent shape
but every time i try to put it in a form and mouse over on it, it disappeared
i handled all the methods that can be handled in it but nothing
can any one help me plz?
|
|
|
|
|
showing some code (and not triple posting ) would certainly help get you an answer quicker.
|
|
|
|
|
ok that is the whole code
i think that would help
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Data;
using System.Windows.Forms;
namespace MyCustomControls
{
///
///
public class custom1:System.Windows.Forms.Button
{
private Point p1 ;
private Point p2 ;
private Point p3;
private Point p4;
private Point p5;
private Point p6;
private Point p7;
private Point p8;
private Point p9;
private Point p10;
private Point p11;
private Point p12;
private Point[] points;
int x;
int y;
int z;
int a;
private System.Drawing.Drawing2D.LinearGradientBrush lgb ;
private System.Drawing.Drawing2D.GraphicsPath gb;
private System.Drawing.Color color1;
private Color color2 ;
private Color color3;
private Graphics g;
private Rectangle rec;
private Pen pen;
public custom1()
{
Init();
}
public void Init()
{
x = this.Width ;
y = this.Height;
z = x / 2;
a = y / 2;
color1 = Color.Silver;
color2 = Color.White;
color3 = Color.Navy;
p1 = new Point(1, 0);
p2 = new Point(x-1, 0);
p3 = new Point(x-1,1);
p4 = new Point(x, 1);
p5 = new Point(x, y-1);
p6 = new Point(x-1, y-1);
p7 = new Point(x-1, y);
p8 = new Point(1, y);
p9 = new Point(1, y-1);
p10 = new Point(0, y-1);
p11 = new Point(0, 1);
p12 = new Point(1, 1);
points = new Point[12]{p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12};
lgb = new LinearGradientBrush(new Rectangle(0, 0, this.Width, this.Height),Color.FromArgb(253,253,253),Color.FromArgb(201,200,220),90.0f);
gb = new GraphicsPath();
float[] relativeIntensities = {0.0f, 0.008f, 1.0f};
float[] relativePositions = {0.0f, 0.32f, 1.0f};
Blend blend = new Blend();
blend.Factors = relativeIntensities;
blend.Positions = relativePositions;
lgb.Blend = blend;
rec = new Rectangle(0, 0, this.Width, this.Height);
//events
// this.Click+=new EventHandler(custom1_Click);
// this.MouseEnter+=new EventHandler(custom1_MouseEnter);
// this.MouseLeave+=new EventHandler(custom1_MouseLeave);
// this.MouseDown+=new MouseEventHandler(custom1_MouseDown);
// this.MouseUp+=new MouseEventHandler(custom1_MouseUp);
//
}
protected override void OnPaint(PaintEventArgs e)
{
g = e.Graphics;
g.FillPolygon(lgb, points);
gb.AddLines(points);
this.Region = new Region(gb);
//base.OnPaint (e);
}
public enum States
{
Normal,
MouseOver,
Pushed
}
States state;
protected override void OnMouseEnter(EventArgs e)
{
state = States.MouseOver;
this.Invalidate(rec);
base.OnMouseEnter(e);
}
protected override void OnMouseLeave(System.EventArgs e)
{
state = States.Normal;
this.Invalidate(rec);
base.OnMouseLeave(e);
}
protected override void OnMouseDown
(System.Windows.Forms.MouseEventArgs e)
{
// do nothing if pressed not the left button of mouse
if ((e.Button & MouseButtons.Left) != MouseButtons.Left) return;
if (rec.Contains(e.X, e.Y))
{
state = States.Pushed;
// button receives an imput focus
this.Focus();
}
else state = States.Normal;
this.Invalidate(rec);
base.OnMouseDown(e);
}
protected override void OnMouseUp
(System.Windows.Forms.MouseEventArgs e)
{
if ((e.Button & MouseButtons.Left) == MouseButtons.Left)
state = States.Normal;
this.Invalidate(rec);
base.OnMouseUp(e);
}
}
}
|
|
|
|
|
hi,
i am doing a custom control inherits from button but has diffrent shape
but every time i try to put it in a form and mouse over on it, it disappeared
i handled all the methods that can be handled in it but nothing
can any one help me plz?
|
|
|
|
|
|
i want to syncronizse between windows clock and another device which i test that has its own clock.
i'll read the Real Time Clock Of the device(through RS232) and calculate th offset between them and update the offset to whatever i want
does enyone knows how can i do it?
|
|
|
|
|
how does the pc and the device communicate? how do you obtain time from the device? does the device have a "time" or just tick-counts?
there are no facts, only interpretations
|
|
|
|
|
Hi all,
I want to write a background application that checks certain conditions periodically at a configurable period (e.g. 10sec). What is the best aproach to acheive this ? by Timer or by a looping thread or other better method ? The background application should consume small CPU power so that it won't affect the applications at the foreground.
Thanks
Patrick
|
|
|
|
|
A timer would be the best approach, cause a looping thread will definitely consume CPU power.
www.troschuetz.de
|
|
|
|
|
Yeah, use a timer or if you have a problem with that use the Thread.Sleep(So many milliseconds); statement.
Salil Khedkar [^]
|
|
|
|
|
Hi all,
how can we add history of recently viewed items into our application's menu. I have developed an interface, i want to keep track of all the recently viewed file names in my File menu (atmost 5).
is it easy to implement it or should we have to do some rigourous work...?
any ideas or suggestions?
thanks in advance,
Suman
|
|
|
|
|
You'll have to define a container where you store the names respectively the paths of your recently viewed files. This could be a simple array or maybe some more complex container.
To your MainMenu add a MenuItem which is for example named "Recently Files". In the PopUp event of this MenuItem add a MenuItem for each file in your container. At last write an event handler for Click events of the several MenuItems and load the specific file.
www.troschuetz.de
|
|
|
|
|
|
Hi guys,
thanks for ur advices and suggestions and they did help me in coding my own program.
thanks,
Suman
|
|
|
|
|
Does anyone know how to change the font size of the column header in a ListView?
I'm wrinting an App in C#
Have a great coding day.
Regards,
Tony D. Abel
|
|
|
|