|
Just generate a random answer.
Sort of like the "Magic 8-Ball" ...
Question: "Will I be happy?"
Answer: "Outlook good".
(Kept them spell-bound for hours back when).
|
|
|
|
|
Hello,
I am new to C#. I have an application which has easy interface for File search. I want to trigger that application using Ctrl+F only when Windows Explorer is active.
Is it possible in .net ?
Is there any available example codes ?
Please help.
|
|
|
|
|
|
|
No code ... no help.
Suggest you review one of the many samples that comes with DevExpress; focusing on "tool bars".
Or just focus on a non-DevExpress tool bar; if it makes no difference. Will probably get more help that way.
|
|
|
|
|
how to fix that error in visual studio 2013 i use inputsimulator but it gave me an error
s.get_Keyboard().ModifiedKeyStroke((VirtualKeyCode) 17, (VirtualKeyCode) 68);
it show me an error no virtualkeycode
Error 2 'WindowsInput.InputSimulator.Keyboard.get': cannot explicitly call operator or accessor
|
|
|
|
|
Properties are accessed with the same syntax as fields:
s.Keyboard.ModifiedKeyStroke((VirtualKeyCode) 17, (VirtualKeyCode) 68);
There actually are methods for getting and setting but the C# compiler doesn't allow you to explicitly use them.
Just as an info-tidbit: You would be able to call these methods via reflection.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
|
I showed you already
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
its not working still
Error 2 Non-invocable member 'WindowsInput.InputSimulator.Keyboard' cannot be used like a method.
|
|
|
|
|
You didn't copy my corrected code. Take another look.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
yes its no error on that now but have to manage now another errors
|
|
|
|
|
Hello everyone,
I use two differents Modbus TCP library for slave server.
Each library use TcpListener.
I have a problem with both.
When my client is disconnected :
CLIENT SERVER
FIN, ACK ---->
<---- ACK
and nothing else...!
The server don't send FIN to client.
After timeout, client send RST to server.
And when client try to reconnect, server send a bad SEQ number.
CLIENT SERVER
SYN seq0 ---->
<---- ACK seq1 (Wireshark said TCP ACKed unseen segment)
RST seq0 ---->
Result, just the first connection after the start of server is done.
Image : Viewing image omOLI.png[^]
Please, do you have any idea ?
(PS. no problem with other Modbus library and server in Java)
Thanks !
Aurélien
from France
modified 1-Apr-16 10:06am.
|
|
|
|
|
I would say that the TCP driver is responsible for sending the FIN. This problem likely has nothing to do with the TcpListener .
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
OK, thanks.
I go to see the code source of Modbus library this monday.
|
|
|
|
|
I thought one of the points of MODBUS was that the "slave" only responded to direct commands from the "master", and did not initiate communications on its own (which you seem to be doing); regardless of disconnects or timeouts.
(Ignore me if MODBUS has expanded beyond my apparent limited view and use).
|
|
|
|
|
Modbus on Ethernet not really have the same definition with master and slave.
An equipement is master when it reads/writes to another equipement.
And, the same equipement is slave when it responds to a query (read/write).
In my situation, my C# server is only slave because it not reads/writes anything to an other equipment.
Only PLCs writes holding registers to the server.
|
|
|
|
|
I am beginner in Multi-threading in C# & confuse in current task.
My task is to read datatable and display datatable in C# console application using multi threading.
I have three threads and one datatable which have 50000 Rors.
All thread must start same time.
I want :
1st thread print 1st row.
2nd thread print 2nd row.
3rd thread print 3rd row.
again
1st thread print 4st row.
2nd thread print 5nd row.
3rd thread print 6rd row. Continue till last row.
How to implement this???
Is there any other technique to do this????
|
|
|
|
|
|
crystal report 10.0 is created with unicode fonts to display data(from Oracle DB) and text in VietNamese. Then I use PdfSharp.dll tool to export this report to pdf document. Everything is ok until I have a new issue to edit the report. And some text fields do not display properly VietNamese, like the machine (or the pdf engine) doesn't have this font. The other text fields which are the sasme font (Unicode) still work well. I changed 'times new roman', 'arial'... but not worked.
I also searched and someone told to uninstall Update for Microsoft Windows(KB3102429 and KB3104002) but it doesn't work with me.
I find that if I export from crystal report viewer to .rtf document and then open it in Office 2007 and choose save as PDF, then the PDF file now display properly. Just to show some clues.
My OS is window7x32
Please give me advice.
|
|
|
|
|
If you want to use a font that may not be available on the users' machine, you'd embed it in the PDF file. There's an example here[^].
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Thanks Eddy. The matter is that the some text fields which the same font (times new roman) still display properly. while some ones also in times new roman does not display properly. If the pdf don't have that font, while it displays properly some of them?
And, my code to export from report document to pdf file like this:
rpt.ExportToDisk(ExportFormatType.PortableDocFormat, String.Format("C:\\pdf\\BrkFee{0}\\{1}", firmno, fName));
How can I apply your code suggestion into this? I don't have any PdfPage object. thks again.
|
|
|
|
|
I'm in the process of breaking the link we currently have between EF and our application code. In order to do this, I've created a collection of "Domain" objects to match our "Database" objects, so I have an Entity Framework Account type, and a Domain Account type, both of which have the same fields, notably an int AccountId field.
I've also implemented a simple repository to allow us to pull domain objects. The issue I'm having is I my Find method - the prototype of which is;
Find(Expression<Func<Domain.Account, bool>> predicate)
Obviously, this method deals with domain objects. However, in the EF specific implementation of the repo I'm working on, I can't simply apply the same predicate to a Where() since the predicate refers to domain types rather than database types.
To that end, I've been looking at the ExpressionVisitor class in order to "mutate" the expression into one that deals with database types. Since I want to change the Parameter, I've created the following implementation;
public class ExpressionParameterModificationVisitor<TTo> : ExpressionVisitor
{
public Expression Modify(Expression expression)
{
return this.Visit(expression);
}
protected override Expression VisitParameter(ParameterExpression expression)
{
return Expression.Parameter(typeof (TTo));
}
}
This appears to work as intended (based on examining what I get and my *limited* understanding of this), however, when I attempt to use it;
Expression<Func<Domaain.Account, bool>> predicate = account => account.AccountId == 1;
I'm seeing the error;
Additional information: Property 'Int32 AccountId' is not defined for type 'Data.Account'
The Data.Account type definitely has the correct field, so I'm assuming I need to do more with my Visitor, and override another method - the obvious suspect is to do the following;
protected override Expression VisitMember(MemberExpression node)
{
return Expression.MakeMemberAccess (base.Visit(node.Expression), typeof(TTo).GetProperty(node.Member.Name));
}
Now the issue I'm seeing is that the VisitMember method is called before the VisitParameter method, and hence I'm getting;
ParameterExpression of type 'Data.Account' cannot be used for delegate parameter of type 'Domain.Account'
Perhaps I'm approaching the issue incorrectly, but anyone have any ideas what I'm missing here?
C# has already designed away most of the tedium of C++.
|
|
|
|
|
This sort of expression rewriting can get very complicated. Something like this should work for fairly simple expressions:
public sealed class ExpressionParameterModificationVisitor<TFrom, TTo> : ExpressionVisitor
{
private readonly Stack<Dictionary<ParameterExpression, ParameterExpression>> _parameterMaps = new Stack<Dictionary<ParameterExpression, ParameterExpression>>();
protected override Expression VisitLambda<T>(Expression<T> node)
{
var parameters = VisitAndConvert<ParameterExpression>(node.Parameters, "VisitLambda");
var parameterMap = node.Parameters.Zip(parameters, (source, dest) => new { source, dest }).ToDictionary(p => p.source, p => p.dest);
_parameterMaps.Push(parameterMap);
try
{
var body = Visit(node.Body);
return Expression.Lambda(body, parameters);
}
finally
{
_parameterMaps.Pop();
}
}
protected override Expression VisitParameter(ParameterExpression expression)
{
if (typeof(TFrom) != expression.Type) return expression;
return Expression.Parameter(typeof(TTo), expression.Name);
}
private Expression MapParameter(Expression expression)
{
var param = expression as ParameterExpression;
if (param != null)
{
ParameterExpression result;
if (_parameterMaps.Count != 0 && _parameterMaps.Peek().TryGetValue(param, out result))
{
expression = result;
}
}
return expression;
}
protected override Expression VisitMember(MemberExpression node)
{
if (typeof(TFrom) != node.Expression.Type) return node.Update(Visit(node.Expression));
var expression = MapParameter(node.Expression);
var member = typeof(TTo).GetProperty(node.Member.Name);
return Expression.MakeMemberAccess(expression, member);
}
public static Expression<Func<TTo, TResult>> Modify<TResult>(Expression<Func<TFrom, TResult>> expression)
{
if (expression == null) throw new ArgumentNullException(nameof(expression));
var visitor = new ExpressionParameterModificationVisitor<TFrom, TTo>();
var result = visitor.Visit(expression);
return (Expression<Func<TTo, TResult>>)result;
}
}
NB: You need to maintain a stack of parameter maps to cope with nested lambdas - for example:
foo => foo.SomeCollection.Count(bar => bar.SomeFlag)
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
modified 31-Mar-16 11:48am.
|
|
|
|
|
Just a small kind of typo:
public static Expression<Func<TTo, TResult>> Modify<TResult>(Expression<Func<TFrom, TResult>> expression)
^^^^
Don't tell me you just typed that in Notepad!?
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|