|
chubbsy wrote: What I want to be able to do is resize (Vector not Raster to retain scale) and centre the image as required to ensure the document prints properly. The image you get from the control is a collection of pixels, not a vector-image.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Hi Eddy,
Thanks for the response.
I agree, the control simply returns a collection of pixels, which is not possible to rescale (not that I've been able to at least).
Are you saying there is no way to properly re-scale the graphic being displayed using the AxVisioViewer ActiveX control?
Is there a different way to output from the control as a scaleable image for printing??
Cheers,
Simon.
|
|
|
|
|
Only by zooming. If the original is low-quality, the printed result will be too.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Hello,
How can we save .pdf file to a remote server?
Below template is ok at local but I need to save the file at remote host.
I created folder and gave permission at remote host.
Directory.CreateDirectory("d:\\folder\\");
PdfWriter.GetInstance(pdfDosya, new FileStream("d:\\folder\\" + ".pdf", FileMode.Create));
Thanks.
modified 13-Feb-19 21:02pm.
|
|
|
|
|
It depends on how the remote folder is shared (which protocol is used).
Is it within a local network using SMB/CIFS (Windows share) or NFS (Unix)? Or is the remote server accessed using an internet protocol like [S]FTP?
|
|
|
|
|
It's SMB (Windows share)
modified 13-Feb-19 21:02pm.
|
|
|
|
|
Use
//ComputerName/ShareName/[SubDirectory/]FileName when the user account of the local machine has write access to the share on the remote system (e.g. when using domain accounts).
If you have to pass the credentials from your code it is getting more complicated. Search the web for something like "c# access network share with credentials".
|
|
|
|
|
[EDIT] There was a bug in VectorDot, now corrected. Vector2 doing better.
I am trying to compare various operation with normal .NET struct vs SIMD / System.Numerics.Vectors.Vector2 one.
I created this plain C# normal struct and SIMD extensions:
public struct Point2
{
public float X, Y;
<pre>
public Point2(float x, float y)
{
X = x;
Y = y;
}
public float Dot(Point2 p) => X * p.X + Y * p.Y;
public static Point2 operator +(Point2 p, Point2 p2) => new Point2(p.X + p2.X, p.Y + p2.Y);
public static float operator ^(Point2 p, Point2 p2) => p.Cross(p2);
public float Cross(Point2 p2)
{
return X * p2.Y - Y * p2.X;
}
}
public static class VectorExtensions
{
public static float Cross(this Vector2 v, Vector2 v2)
{
return v.X * v2.Y - v.Y * v2.X;
}
}</pre>
And made this text program
class Program
{
static void Main(string[] args)
{
int N = 10_000_000;
<pre>
DoVectorCross(1);
using (new MeasureBlock("Vectors Cross"))
DoVectorCross(N);
DoPointCross(1);
using (new MeasureBlock("Points Cross"))
DoPointCross(N);
DoVectorDot(1);
using (new MeasureBlock("Vectors Dots"))
DoVectorDot(N);
DoPointDot(1);
using (new MeasureBlock("Points Dots"))
DoPointCross(N);
DoVectorAdd(1);
using (new MeasureBlock("Vectors Add"))
DoVectorAdd(N);
DoPointAdd(1);
using (new MeasureBlock("Points Add"))
DoPointAdd(N);
Console.ReadLine();
}
static float DoVectorCross(int N)
{
var v1 = new Vector2(1, 2);
var v2 = new Vector2(2, 3);
float result = 0;
for (int i = 0; i < N; i++)
result += v1.Cross(v2);
return result;
}
static float DoVectorDot(int N)
{
var v1 = new Vector2(1, 2);
var v2 = new Vector2(2, 3);
float result = 0;
for (int i = 0; i < N; i++)
result += Vector2.Dot(v1, v2);
return result;
}
static Vector2 DoVectorAdd(int N)
{
var v1 = new Vector2(1, 2);
var v2 = new Vector2(2, 3);
for (int i = 0; i < N; i++)
v1 += v2;
return v1;
}
static float DoPointCross(int N)
{
var v1 = new Point2(1, 2);
var v2 = new Point2(2, 3);
float result = 0;
for (int i = 0; i < N; i++)
result += v1.Cross(v2);
return result;
}
static float DoPointDot(int N)
{
var v1 = new Point2(1, 2);
var v2 = new Point2(2, 3);
float result = 0;
for (int i = 0; i < N; i++)
result += v1.Dot(v2);
return result;
}
static Point2 DoPointAdd(int N)
{
var v1 = new Point2(1, 2);
var v2 = new Point2(2, 3);
for (int i = 0; i < N; i++)
v1 += v2;
return v1;
}
}</pre>
I get the following measurement for each compile target (x86, x64/ AnyCPU):
x64
Vectors Cross took 24ms.
Points Cross took 17ms.
Vectors Dots took 16ms.
Points Dots took 21ms.
Vectors Add took 35ms.
Points Add took 109ms.
x86
Vectors Cross took 41ms.
Points Cross took 38ms.
Vectors Dots took 49ms.
Points Dots took 40ms.
Vectors Add took 38ms.
Points Add took 47ms.
AnyCPU
Vectors Cross took 40ms.
Points Cross took 39ms.
Vectors Dots took 43ms.
Points Dots took 39ms.
Vectors Add took 49ms.
Points Add took 58ms.
Vector2 has now similar performance to Point2 , except when compiled for x64, Dot() is 25% faster and Add() is 3 times faster.
Custom Cross() operations is slower though.. How do I write efficient Cross operation?
modified 29-Apr-18 23:10pm.
|
|
|
|
|
I'm not a C# programmer and have only basic knowledge. So this might not be correct.
I guess that your Vector2 Cross function does not use any SIMD instructions or is at least not parallelised.
Have a look at the Vector2 source (Vector2_Intrinsics.cs[^]):
using System.Runtime.CompilerServices;
namespace System.Numerics
{
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Dot(Vector2 value1, Vector2 value2)
{
return value1.X * value2.X +
value1.Y * value2.Y;
}
} You might try to implement Cross similar.
|
|
|
|
|
This was actually a good idea!
Except, sadly, [Intrinsic] is not available to us, non MS programmer. I fear this might not just be possible to implement 3rd SIMD extension method. How sad....
|
|
|
|
|
Super Lloyd wrote: Except, sadly, [Intrinsic] is not available to us, non MS programmer So that is the reason why there is not much documentation about it.
But it seems to be the option that enables usage of processor specific instructions like SIMD.
|
|
|
|
|
Is it worth it?
I am writing a lib that do shape operation (shape being like polygon, just with bezier curve for contour instead of lines)
I have a lot of custom Math code, including custom Point2D, Vecto2D and Matrix3x2 and today.. I just saw that System.Numerics is such a library with such types but hardware accelerated (SIMD) maths.
Since my lib is quite performance intensive I wonder if it is worth rewriting?
Any link on performance guide and comparison with Numerics.Vectors?
I found some post on the internet where people had bad experience an unexpectedly worst performance with it.....
modified 29-Apr-18 20:59pm.
|
|
|
|
|
Hi All,
I am working on a project using c# .net and its related to connecting to device and streaming the information over the network . We are using RTSP protocol for connecting to that device. We have developed code using media-player-vlc, while testing the code we have observed a strange behavior , where we are able to play local file and public streaming url. where as when we try with our customer url. its giving the below error. the same url when we try to play using VLC media player its working fine.
[0b7204c0] live555 demux error: Failed to connect with rtsp:
[0b7204c0] live555 demux error: TCP rollover failed, aborting
Could any one please update me on this.
|
|
|
|
|
That is most probably a problem with the network configuration on a router or the firewall on the server that blocks traffic from/to specific IPs and/or ports (assuming that the service at your customer URL is up).
Ensure first that the service is up testing it locally or from a client in the same (local) network segment. Once that is working check the configuration of the router that connects the server to the internet. If that provides logs, check those too. Ensure that the IP and port from the URL are allowed for UDP.
|
|
|
|
|
Hi Jochen ,
thanks for the quick response, I agree with you and tried by playing same url in VLC media player. If this is because of network issue, the same url should not work through VLC Media Player.
But its working. Not sure , whether is there anything which is blocking in libVLC.dll.
When I try to debug into code.. i found the following code is causing issue.
https://github.com/Tilka/vlc/blob/master/modules/demux/live555.cpp
else if( !p_sys->b_multicast && !p_sys->b_paused &&
p_sys->b_no_data && ( p_sys->i_no_data_ti > 34 ) )
{
bool b_rtsp_tcp = var_GetBool( p_demux, "rtsp-tcp" ) ||
var_GetBool( p_demux, "rtsp-http" );
if( !b_rtsp_tcp && p_sys->rtsp && p_sys->ms )
{
msg_Warn( p_demux, "no data received in 10s. Switching to TCP" );
if( RollOverTcp( p_demux ) )
{
msg_Err( p_demux, "TCP rollover failed, aborting" );
return 0;
}
return 1;
}
msg_Err( p_demux, "no data received in 10s, aborting" );
return 0;
}
Do we need to change anything to overcome this?
Best Regards
|
|
|
|
|
If it is working with the VLC media player it is not a general network issue.
But I think you are debugging at the wrong location. The above code (and the error message) tells you there was a failure to connect using UDP and a fallback to TCP has been initiated which is also failing.
I'm sorry that I can't help more. I even think that debugging will not help much with such connection timeout errors. All I can suggest is asking at the GitHub project site.
|
|
|
|
|
Thanks Jochen for your time and effort
|
|
|
|
|
Hi Jochen,
After lot of analysis found the root cause of the issue but don't know how to fix this issue.
In VLC Media player , its working , because , we explicitly set Live 555 Stream transport to RTP Over RTSP(TCP), due to this the streaming is working and able to view the video.
But same way not sure how to set this option to below code
IMedia media = m_factory.CreateMedia<imedia>(rtspAddress);
//media.AddOptions(new List<string>() {output });
//media.AddOptions(mediaOptions);
m_player.WindowHandle = p.Handle;
m_player.Open(media);
//media.Parse(true);
m_player.Play();
could you please suggest us on this.
thanks in advance.
|
|
|
|
|
So we are working on a project that involves creating a simple mobile application using Xaml and C#. We are done with the design but we are having difficulties programming the calculator.
Here in the UAE we have 5% Tax on some goods, so we want the users to be able to enter the items price to see how much it will be after adding the 5% tax and the amount added to it.
For example, a user wants to be a 250 AED item and used the App to see how much it would cost with taxes so once they input the item price and hit the calculate button they will see the price with taxes and how much was added to the original price.
FYI: I am a beginner at this and just taking a course with C# fundamentals I really could use someones help with this.
Regards
|
|
|
|
|
Assuming the user inputs via a TextBox:
decimal price;
if (!decimal.TryParse(userInputPriceTextBox.Text, out price))
{
... report problem to user ...
return;
}
decimal total = price * 1.05m; You can then display the total any way you wish...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Console.WriteLine("Enter the price of item");
double price = double.Parse(Console.ReadLine());
double totalPrice = ((price * 5) / 100 + price);
Console.WriteLine("Total price of the item " + totalPrice);
|
|
|
|
|
Unfortunately stack overflow just crash / exit the program when they happen in UWP App. It can't be caught and broke into with the debugger. At least it looks like it (using Visual Studio 2017 professional).
I enabled mixed mode debugging, enabled all exception, native exceptions, managed assistance, downloaded MS symbols, etc...
Whatever I do the program gently churn along and then ... close suddenly.
All I have left is this post mortem line in the debug output:
The thread 0x1ce4 has exited with code -2147023895 (0x800703e9).
I have been scratching my head all day for that. Unfortunately, I have a few weeks of changes that were not tested and I am a bit lost as to what could cause that... Plus it might have been there before anyway...
Any idea on how to track what could be the cause of that?
As a side note my app is compiled for x64. I also tried to compile for x86. Same results.
Unfortunately there is no MSIL targets possible for UWP, apparently... (Which, I imagine, would offer better debugging regarding StackOverflow)
[EDIT]
The plot thickens though.
I just tried a simple test UWP App where I changed the constructor as follow:
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
var u = Moo(42);
}
public static int Moo(int seed)
{
var r = new Random(seed);
var next = r.Next();
if (next == 0)
return seed;
return Moo(next);
}
And the debugger successfully broke on my code... Somehow I have some suspicion on the UI code... but I didn't set the model at all in one test, i.e. no model or data context => no binding and update, stumped....
modified 28-Apr-18 12:07pm.
|
|
|
|
|
Stackoverflow usually means you have some recursive code that is consuming all the space.
|
|
|
|
|
yeah... but which code? that is exactly my question?
I feel asleep reading the last month of commit...
And VS doesn't stop when the stack overflow happen, so I dunno where it is..
It's where I need a tip. How to break on the damn recursive code?
|
|
|
|
|
Super Lloyd wrote: but which code? that is exactly my question? Of course it is, but only someone who knows the code can figure it out.
|
|
|
|