|
This is an interesting approach to the problem I am having. I found C# libraries to interact with existing devices, I could try to forward all the Data that is sent to a card reader to our simulator. It's kind of a hack but it could work!
Thanks for the reply!
KOM UIT DAAAAA!!!
|
|
|
|
|
Good Morning,
The reason I have prefaced this with "again" is that although I have found numerous articles on this in Code Project, I have yet to see this problem resolved with a clear answer or a suggestion as to what the problem might be (or I cannot find it). So, it's my turn in the barrel...I am trying to add an Excel reference (seems simple enough) to my application (VS 2010), and I have tried to add it from both the .NET (Microsoft.Office.Excel) and COM tabs (Microsoft.Office.Interop.Excel) under Add Reference. I have also added the Microsoft.Office.Core Excel Object (12.0). I have tried each individually and all simultaneously and each time I get the familiar error (Error 1 The type or namespace name 'Excel' could not be found (are you missing a using directive or an assembly reference?). This was done as per the instructions of a great article on Code Project by Geek13 that begins with the code
Excel.ApplicationClass ExcelApp = new Excel.ApplicationClass();
The article heading is as follows:
Exporting a DataGridView to Excel in .NET 2.0 (C# code)
Author: Geek13
If there is some other prerequisite that I need or (???), please let me know. Thank you for your attention....Pat
|
|
|
|
|
You should always add from the .NET tab. Also, you probably need to add a using Microsoft.Office.Core or something of that sort to bring the Excel namespace into scope.
|
|
|
|
|
Hammer,
Thank you for your reply. FYI...I did delete all COM references to Excel and I had already added the MSFT Core, but it still did not work. Apparently, there was a problem with different versions that were added for each reference to Interop (V11.0 vs v14.0), and this was due to the fact that the article was based on VS2.0. So I needed to change the references, make them the same, and then find the new path to the application (old was ApplicationClass and new was just .Application). However, the problem was definitely found in the area that you suggested I look. Thanks for the help....much appreciation. I have marked your answer as correct. Best Regards, Pat
|
|
|
|
|
How do I know which files on the system have different level of privileges. For example, if the 'at.exe' runs from the command prompt to open cmd.exe then the new cmd.exe has been given system privilages
Is there any way to dump the level of privileges to a text file. I managed to get the application descriptions to a listview, now just trying to get their security levels.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
namespace FileDescription
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
GetFileDescription();
}
private void GetFileDescription()
{
string[] fileInfo = Directory.GetFiles(Environment.SystemDirectory);
foreach (string str in fileInfo)
{
if (str.ToString().Contains(".exe"))
{
ListViewItem lvi = new ListViewItem();
FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo(str);
lvi = lv.Items.Add(str);
lvi.SubItems.Add(myFileVersionInfo.FileDescription);
}
}
}
private void Form1_Load(object sender, EventArgs e)
{
lv.Columns.Add("File",200,HorizontalAlignment.Left);
lv.Columns.Add("Description",400,HorizontalAlignment.Left);
}
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
Process.Start(lv.SelectedItems[0].ToString());
}
}
}
Thats what I turned out with.
|
|
|
|
|
Files don't have privileges, users have privileges.
A standard user and an admin could both start instances of the same program file, but the admin instance will have all the admin privileges, and the other will have only standard user privileges.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Hi.
First, how would I create a random number, and then add the last digit, so that it is divisable by 5?
the number should always be 5 digits long.
Second, how do I check it, I think I need to do something like...
if (int x MOD 5 ==0)
Or something like that.
The first step is the most important though.
Thank you,
Steve
|
|
|
|
|
a random multiple of five is bound to be five times some other random number.
|
|
|
|
|
Luc Pattyn wrote: a random multiple of five is bound to be five times some other random number.
?
What do you mean?
Regards,
Stephen
|
|
|
|
|
What Luc meant was that you should just create a random integer number and the go and multiply it by five. This will always give you a number which is divisible by 5, to state the obvious.
The only thing I would add is if you are given a range in which the numbers should lie you'd need some adjustment.
Random rnd = new Random();
int lowerBound = 2001;
lowerBound = lowerBound + ( 5 - lowerBound % 5 );
int upperBound = 10023;
upperBound = upperBound - ( upperBound % 5 );
int range = (upperBound - lowerBound) / 5;
int number = lowerBound + rnd.Next( range ) * 5;
Cheers!
—MRB
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925
|
|
|
|
|
surely the generated number would exceed the upper bounds:
upper bound = 10023
modded down to 10020
random number generated between lower bound and modded upper bound = anything upto 10020
10020 * 5 = 50100
50100 > 10023
perhaps divide the bounds by 5 first
|
|
|
|
|
Stating the obvious! 5+
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925
|
|
|
|
|
I'd say you're stating the obvious, but then, I remember when I was very young and inexperienced and I couldn't see stuff like this. So, it's not always obvious as one might think.
You got my five.
"To alcohol! The cause of, and solution to, all of life's problems" - Homer Simpson
|
|
|
|
|
I tend to state facts, even obvious ones, especially when it seems to OP is missing them somehow. Rather than spoon feeding, I prefer to give a gentle push in the right direction...
|
|
|
|
|
Completely agree, I'm totally against the "gimme codezzzz plz" culture.
"To alcohol! The cause of, and solution to, all of life's problems" - Homer Simpson
|
|
|
|
|
Generate a four digit random number,
multiply it by 10,
add 5 (or 10).
The result will be divisible by 5.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
The only valid measurement of code quality: WTFs/minute.
|
|
|
|
|
Does this mean that no matter what number I generate, it will always have to end in 5?
e.g. All these numbers are divisable by 5
39485
99045
12095
49385
99335
However, I was under the impression I could generate numbers that would be divisable by 5, but not end in 5?
Is this wrong?
Regards,
Stephen
|
|
|
|
|
Numbers that end in 0 are also divisible by 5 (except zero)
So you're right.
|
|
|
|
|
|
It depends on the definition of divisibility that you use.
Zero can also be divisible by anything, if you use an other definition.
|
|
|
|
|
BS.
zero times x equals zero, no matter what (finite) value x has.
so (the right side's) zero is divisible by x, and the result is (the left side's) zero.
If I hold 10 pies, 5 bacon sandwiches, and zero glasses of milk, I have no problem distributing them evenly to 5 people.
Next you'll state you could also redefine 5, so it no longer divides itself.
|
|
|
|
|
Luc Pattyn wrote: Next you'll state you could also redefine 5, so it no longer divides itself.
It doesn't. There are only four bacon sandwiches left...
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
Sorry for the late reply, I have been off-line this evening, I have another tournament going on this week. I trust all bacon sandwiches have magically disappeared by now, and so the problem got solved?
|
|
|
|
|
Nope. You seem to think that that is the only definition of divisibility.
I did not personally redefine anything.
There is no natural number n such that 0/x=n so no x evenly divides 0.
If you use the definition with integers instead of natural numbers, everything divides zero.
Also, the prime factorization of zero is empty.
|
|
|
|
|
natural numbers are the ordinary counting numbers 1, 2, 3, ... (sometimes zero is also included) is what Wikipedia[^] offers as a definition. Now you can choose: either you include zero and you are allowed to use it at both sides of your 0/x=n , or you exclude it (and then your "except zero" remark that started all this is completely irrelevant).
|
|
|
|