What are the approaches used for horizontal/vertical alignment and rectification of inaccurately orientated polylines? inaccurately alligned structure I believe as a starting point a graph representation is needed for further processing
Чесноков
What are the approaches used for horizontal/vertical alignment and rectification of inaccurately orientated polylines? inaccurately alligned structure I believe as a starting point a graph representation is needed for further processing
Чесноков
that is interesting approach! never thought of it before
Чесноков
I have a web page with a method called to display some images in the DataList control
MyImage.cs
class MyImage
{
string Name { get; set; }
byte[] Jpeg { get; set; }
}
MyImages.aspx.cs
pubic void DisplayMyImages(IEnumerable myImages)
{
this.myImagesDataList.DataSource = myImages;
this.myImagesDataList.DataBind();
}
...
protected void myImagesDataList_ItemDataBound(object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item ||
e.Item.ItemType == ListItemType.AlternatingItem)
{
MyImage myImage = (MyImage)e.Item.DataItem;
Image myImageImage = (Image)e.Item.FindControl("myImageImage");
// How to pass myImage.Jpeg to ImageHandler? form here
myImageImage.ImageUrl = "~/Handlers/ImageHandler.ashx";
}
}
But how to pass jpeg image to ImageHandler if it is already extracted from the database and passed to DisplayMyImages() function? Remarks: I do not want to save them back to files and pass the paths in a query string to ImageHandler Having a standard query string approach is not possible as I do not want to violate model view presenter approach
Чесноков
returns string of letters
Чесноков
I use model view presenter approach for ASP.NET web site. The presentation part is compiled in separate class library where view contracts and presenters are defined:
MyPresentation assembly
IMyView
{
DisplayText(string text);
}
MyPresenter
{
public IMyView View { get; set; }
public DisplayText()
{
string text = Generate();
View.DisplayText(text);
}
}
MyWebApplication assembly
public partial class MyForm : System.Web.UI.Page, IMyView
{
public void DisplayText(string text)
{
this.myLabel.Text = text;
}
...
protected void myButton_Click(object sender, EventArgs e)
{
Presenter.DisplayText(); // calls this.DisplayText()
}
}
However after stepping out of Presenter.DisplayText() Text property of myLabel becomes null again as though no assignment were done. By all means if you replace the only line in myButton click event with direct setting of myLabel Text property everything stays assigned.
Чесноков
Is there available a good introductory tutorial with code for that problem?
Чесноков
thank you for the link... are there some tools in visual studio or windows to trace the reason of the leak?
Чесноков
I've got a long running application what reads some data and store it in Dictioinary field. I persist that class containing dictionary using serialization. During the application run there is small memory consumtion going on about 1 Mb a minute. However serialized object grows about 100 bytes a minute or less. What is the best and fastest way to discover the reason of the leak? Is it possible to determine exact size of that class with Dictionary collection in memory during the program run?
Чесноков
many thanks that solved the problem. I never paid attention to the addition order of the controls to the form. I remeber there were no problems with docking before due to that issue as it turned out
Чесноков
There is a wierd problem: in the windows form I added ToolStrip, which docks to top and then added ListView to span entire form by design. When I set its dock property to Fill it was docked below ToolStrip. I expected the docking would not interfere with ToolStrip and stop exactly at its bottom border? Thus ToolStrip occludes by itself top part of the ListView control.
Чесноков
yes, thanks, that one works
Чесноков
How to convert with DateTime.ToString() method given date to yyyy\MM\dd format? e.g. "2011\06\17" I would not like to use String.Format(@"{0:D4}\{1:D2}\{2:D2}")
Чесноков
yes, thanks, that was the variable to set to, stream.TimeOut by default it is 5 minutes to read and write, quite large value. I would never discover the problem had it not been to wifi connection. It is surprising that ordinary landline disconnection immediatly result in Read() failure but with wifi it waits entire timeout.
Чесноков
jschell wrote:
But if you want to deal with all situations and not a just a few then you need to set up a timeout. Either via the protocol itself or via a secondary thread
I do set timeout in web request but I do not know how to set it for Read() operation as it just blocks.
Чесноков
I already do the reading in the thread. The problem discovered with wifi internet connection type. Once the wifi is off Read blocks. How can I return from the background worker if it is blocked in the Read() method call? It was supposed to quit the thread if any error happen as it is with internet plugged into LAN. But wireless somehow blocks the method.
Чесноков
I send web requests and read data web response:
using (Stream stream = response.GetResponseStream())
{
Data = new byte[response.ContentLength];
int offset = 0;
int count = (int)response.ContentLength;
int nBytes = 0;
int nTotalBytes = 0;
while ((nBytes = stream.Read(Data, offset, count)) > 0)
{
offset += nBytes;
count -= nBytes;
nTotalBytes += nBytes;
}
}
If internet connection is suddenyl down Read() function blocks forever. Is there a way to avoid it using the same Read() method?
Чесноков
Will you argue with MSDN? http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.dowork.aspx[^]
If the operation raises an exception that your code does not handle, the BackgroundWorker catches the exception and passes it into the RunWorkerCompleted event handler, where it is exposed as the Error property of System.ComponentModel.RunWorkerCompletedEventArgs. If you are running under the Visual Studio debugger, the debugger will break at the point in the DoWork event handler where the unhandled exception was raised. If you have more than one BackgroundWorker, you should not reference any of them directly, as this would couple your DoWork event handler to a specific instance of BackgroundWorker. Instead, you should access your BackgroundWorker by casting the sender parameter in your DoWork event handler
Чесноков
Either I throw exception or induce it naturally in DoWork it is not caught and control is not passed to worker completion routine instead getting that exception which I catch in Program.cs file
Type: System.Reflection.TargetInvocationException
Source: mscorlib
Message: Exception has been thrown by the target of an invocation.
Target Site: System.Object _InvokeMethodFast(System.IRuntimeMethodInfo, System.Object, System.Object[], System.SignatureStruct ByRef, System.Reflection.MethodAttributes, System.RuntimeType)
Module Name: mscorlib.dll
Module Path: C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll
Stack:
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
Thanks, but I'm not sure that is suitable for my design. I'm coding video surveillance application, server runs video capture and sends captured frames to connected clients. There can be any number of clients connected to a server and a client can be connected to any number of servers. There are video capture service and video data transfer service (the server). As the frame is captured video capture service invokes send method from the video data transfer service which sends the frame to all clients connected. WCF as I understood provides service contract and public methods to call. In that case I need to add WCF logic to video capture service and declare public method as e.g. GetRecentFrame(). And a client needs to call that method. I do not want to combine video capture and video data transfer services. As video capture service is running on despite the fact if someone is connected to transfer it a frame. And network connection may be slow, video capture service may get 10 frames in a time 1 frame is finished with the transfer to the client.
Чесноков
Well I'm developing according to domain-driven design DDD and was going to write a service for server and client. What is the advanatage of WCF over ordinary .NET sockets apprach? I need several services running on the same machine each with a different port.
Чесноков