|
I have written all code of backend.exe file into service and it is working fine now. thanks a lot
Khan
|
|
|
|
|
You're welcome!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
The comments about the UI in the other sub-thread, as far as I can tell, have no relevance to the code posted.
Presumably your log messages are showing up. Your code appears to be correctly handling potential exceptions HOWEVER you should log the stack trace also.
Finally, as to your problem...
Far as I can tell you do not seem to be actually starting the timer.
If true then what will happen is that your OnStart method will exit, which means no threads will be running in the service. Windows knows that threads are running and will not mark it as running unless one thread is running.
|
|
|
|
|
Any idea how to include thread in this service and backend.exe application
Khan
|
|
|
|
|
There are several ways. Your code is already mostly there except you are not starting the timer.
|
|
|
|
|
Looks like you're using Oracle.
In SQL Server, one just adds a (console) app to the server, and has it run on a schedule using SQL Server Agent. Easy.
One would think that Oracle has something similar. Or use the Windows Task Scheduler.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
I'm searching for a good unit testing and mocking framework for C# (not necessarily open source).
Any suggestions?
|
|
|
|
|
I used to use nunit. Used to only because I haven't done any C# for a while. As long as it is being maintained I presume it is very usable.
I didn't use mocks then but googling certainly suggest that they exist.
|
|
|
|
|
For mocking, I love JustMock from Telerik. It allows you to mock things that other mocking frameworks just can't cope with.
This space for rent
|
|
|
|
|
|
How how can I download a PDF from PDF drive.net programmatically????
|
|
|
|
|
You will not get any help from this site to download illegally copied files: and that is exactly what the site you reference specializes in. The files it contains are copyrighted to the various authors and publishers and are effectively stolen.
Since we have many book authors here - and even more of us write technical documents and know exactly how hard it is to do - downloading books from illegal sites is not something we wish to be associated with.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hi everybody
I have a DataGrid control for which one of the columns consists in ComboBox controls defined in a DataTemplate (refer to the xaml snippet below).
The ComboBox controls are populated through data binding and everything works fine.
My problem: I would like to disable (from code behind) the selected ComboBox control item as long as the treatment associated to that selection is not complete.
Any idea, comment, suggestion?
Here is the xaml snippet:
<datagrid name="onGoingActionsGrid" autogeneratecolumns="False" background="Transparent" borderbrush="Transparent"
="" canuseraddrows="False" canuserdeleterows="False" canuserresizerows="False" canuserresizecolumns="False">
<datagrid.columns>
<datagridtextcolumn header="Actions" width="235" binding="{Binding Name}">
<datagridtemplatecolumn header="State" isreadonly="True" width="40">
<datagridtemplatecolumn.celltemplate>
<datatemplate>
<datagridtemplatecolumn header="Control" width="50">
<datagridtemplatecolumn.celltemplate>
<datatemplate>
<combobox x:name="ControlActionComboBox"
="" itemssource="{Binding CollectionOfPictograms, Mode=TwoWay}" selectionchanged="controlAction_SelectionChanged" selecteditem="{Binding SelectedItem, Mode=TwoWay}" selectedvaluepath="Content">
<combobox.itemcontainerstyle>
<Setter Property="Padding" Value="4.3"/>
<Setter Property="BorderBrush" Value="LightGray"/>
<Setter Property="BorderThickness" Value="1"/>
<combobox.itemtemplate>
<datatemplate>
<dockpanel>
|
|
|
|
|
You said you want to "disable" the combo box "item" ...
You can't disable "items"; you can only handle / not handle them explicitly.
As for "controls", add a bool "Enabled" property to the code-behind / view-model that has GET logic related the treatment and is bound to the .IsEnabled property of the control (i.e. combo) in the XAML.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
(You should respond in the forums so everyone can see your answer).
Set the “IsEnabled” on the “combo box” in the XAML; not in the “item container” style.
Each “row” / item has it's own combo box (in this case).
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp2
{
class Program
{
static void Main(string[] args)
{
double wip;
double hii;
double bmi;
Console.Write("Eneter Weight in pounds:");
wip = Double.Parse(Console.ReadLine());
Console.Write("Enter height in inches:");
hii = Double.Parse(Console.ReadLine());
bmi = wip * 703 / Math.Pow(hii, 2);
Console.WriteLine($"bmi is: {bmi}");
Console.ReadLine();
if (bmi > 18.50)
{
Console.WriteLine("You are under weight.");
}
else if (bmi >= 24.9)
{
Console.WriteLine("Your weight is normal.");
}
else if (bmi > 30)
{
Console.WriteLine("You are obse.");
}
}
}
}
|
|
|
|
|
The BMI classification is defined like this:
- Underweight = <18.5
- Normal weight = 18.5-24.9
- Overweight = 25-29.9
- Obesity = >=30
(Source: Calculate Your BMI - Metric BMI Calculator[^])
To write that in your code, you can do this:
if (bmi < 18.5)
{
}
else if (bmi < 25)
{
}
else if (bmi < 30)
{
}
else
{
}
The quick brown ProgramFOX jumps right over the Lazy<Dog> .
|
|
|
|
|
C# program and the client is running it on a server. It is installed on the remote server and it is accessed by different user under different accounts. It was written to be installed on the same computer that it is run from but I just found out the client installed it on a server. It appears that all the users are sharing the same user.config file. Could someone explain to me how the config files work when a .net program is run on a server? I need to fix it so it can be run either from the server or from a workstation. Could someone either point me to the right place to look I am either searching using the wrong words or explain to me what happens with the config files when you run from a server. I'm currently using the settings.settings built into C#
|
|
|
|
|
The processing of config files does not change if the app is running on the server version of Windows.
You have to find out HOW they are running your app on the server. For example, are they running the app under Remote Desktop? Terminal Services? Citrix? Or something similar? What's the configuration of the application objects in whatever sharing app they're using your app under.
Either they are going to change the configuration of the server and whatever app/desktop sharing they're using or your app would have to be modified to support running under these systems successfully.
System.ItDidntWorkException: Something didn't work as expected.
-- said no compiler, ever.
C# - How to debug code[ ^].
Seriously, go read this article.
Dave Kreskowiak
|
|
|
|
|
|
how i get the object location in image by pixel coordinate ?
|
|
|
|
|
Google for "machine vision" and you'll find out just how hard this is to implement.
You're never going to get a full explanation about how this works or how to do it in a forum environment. There's just far too much information to convey. Think entire sets of university classes.
Having said that, start with this[^] and go check out the OpenCV library[^] and Emgu[^], which is a .NET wrapper for OpenCV.
System.ItDidntWorkException: Something didn't work as expected.
-- said no compiler, ever.
C# - How to debug code[ ^].
Seriously, go read this article.
Dave Kreskowiak
|
|
|
|
|
Message Closed
modified 4-Jan-18 9:19am.
|
|
|
|
|
Strings are immutable: you cannot change a string once created. Any attempt to change it generates a new string.
So this:
string a = "hello";
string b = a;
b += " world"; Means that a and b do not contain the same string: a has "hello" and b has "hello world". All string modification operations return a new string, the old is unmodified.
That's a problem if you are generating a big string in little pieces: adding lines to a chunk of text before you write it to a file for example:
string myBook = "";
foreach(string line in myDatabaseRows)
{
myBook += line;
} This allocates a new string each time you add, so it starts to use up memory at a rapid rate of knots - and it starts to get quite slow, as each time you add a new line, you have to allocate memory for the new output, and copy the whole of the existing text into it, add the extra line, and move on. That's very inefficient!
That's where a StringBuilder comes in: It's a string which can be changed, or grown:
StringBuilder myBook = new StringBuilder();
foreach(string line in myDatabaseRows)
{
myBook.Append(line);
}
string output = myBook.ToString(); This does a lot fewer allocate-and-copy operations (it allocates an amount of space at the start and if you exceed that, it allocates twice as much and copies everything over) so it's a whole load more efficient - particularly if you can guess how much space you need and allocate that at the beginning:
StringBuilder myBook = new StringBuilder(1000000); Will give you a megabyte to start with, and if you don't exceed that it's the only allocation that is done - no "extra" copyiong is ever needed.
They are also needed if you start interop working with native code which doesn't know that strings are immutable - you hand them a StringBuilder and they can fill it in as needed. But that's the advanced stuff!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
The end reason is performance: Stringbuilder can cancatenate strings faster (for the reasons previously mentioned).
But you need to be doing a bit more than simply combining "a few"; though it can help readability of code in cerain cases.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|