|
thx.
im still stock on this...
i think i got it.
[code]
StreamWriter log;
if (!File.Exists("auth.txt"))
{
log = new StreamWriter("auth.txt");
}
else
{
log = File.AppendText("auth.txt");
}
log.WriteLine(DateTime.Now);
log.WriteLine(lines);
log.WriteLine();
textBox1Message.AppendText(lines);
log.Close();
[/code]
modified 7-Jan-15 6:29am.
|
|
|
|
|
Please tell me this is for a school assignment?
Please tell me this is not a application that's going to be put into production?
You really couldn't pick a more insecure method of storing passwords (pin's) if you tried.
|
|
|
|
|
lol ya..i need to make an ATM machine...lol
i got it going.thx
|
|
|
|
|
I thought those requirements sounded familiar, but I had to check because there are those idiots who think this is a viable method of securing a production application in an enterprise environment.
Kind of explains all the corporate credit card hacks, doesn't it...
|
|
|
|
|
lol..
now im stock on a simple numeric keypad.
do i need to make it as a separate form?
|
|
|
|
|
It's "stuck", not "stock".
You don't have to but it might be nice. I would probably do a numeric keypad as a custom control, but then again, I don't work on school projects any more.
|
|
|
|
|
Ha!lol
ya looking it up.thx for the help
|
|
|
|
|
As we don't know what format your file is, I'm going to have to make some assumptions here. The first assumption is that the file is organised with one pin per line. Assuming this is true, then you can use File.ReadAllLines to read the files into an array - from there, if I were you, I'd probably load these records into a HashSet for speed of record retrieval. Here, I have to assume that you know what a HashSet is, and how to work with it. Finally, write a simple method that accepts a PIN, and looks in this HashSet to see if the file PIN is present.
|
|
|
|
|
public string connectionString = "Data Source=" + File.ReadAllText(Path.GetDirectoryName(Application.ExecutablePath) + "\\PCName.txt").ToString() + ";Integrated Security=SSPI;Initial Catalog=" + File.ReadAllText(Path.GetDirectoryName
(Application.ExecutablePath) + "\\DBSName.txt");
use a this code in your Program,and make a notepad file in your one of the drive in your computer.
just write your computer name in notpad the save it and close.
if you don't have database, you don't write DBSName.txt in codesource.
|
|
|
|
|
Hi All,
I have 3 tables (table1, table2, table3). I need to check which are the tables which does not have any rows(for ex, select count(*) from table1) and finally print the table names .
Kindly suggest a best flow chart or approach for checking the permutation and combination.
Thanks much!
Cheers
Jim
|
|
|
|
|
And what have you tried?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Select 'Table1' as TableName, count(1) as RecCount from Table1
UNION
Select 'Table2' as TableName, count(1) as RecCount from Table2
UNION
Select 'Table3' as TableName, count(1) as RecCount from Table3
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
double[] myLottoNums = new double [5];
double sum = 0;
double median = 0;
Console.WriteLine("Please enter five numbers: ");
for (int i = 0; i < 5; i++)
{
Console.Write("Number {0}: ", i+1 );
myLottoNums[i] = double.Parse(Console.ReadLine());
sum = myLottoNums[i] +sum ;
median = (myLottoNums[i]) / myLottoNums.Length;
}
Console.WriteLine("Thank you. The numbers are : ");
foreach (double x in myLottoNums)
{
Console.WriteLine("{0}", x);
}
Console.WriteLine("The sum is {0}",sum);
Console.WriteLine("The median is {0} ", median);
Heres my issue. It sums it fine but the average is 1.2 when it SHOULD BE 6 because 30/5=6 NOT 1.2 . So why is the computer reading it like this?
Thanks like always guys. You guys have been very helpful
|
|
|
|
|
Shouldn't the median be the average of the sum not the current number.
median = sum / myLottoNums.Length;
"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult." - C.A.R. Hoare
Home | LinkedIn | Google+ | Twitter
|
|
|
|
|
Thank you so much. Yes, I found my mistake. Youre awesome
|
|
|
|
|
If someone here takes their time to assist you, and really helps you solve your problem, or answer your question, it's a very good thing to vote their response up, and it's also a responsible thing to vote down any response you feel is deliberately negative, insulting, or, totally off-topic.
Feedback helps CodeProject build quality.
«A man will be imprisoned in a room with a door that's unlocked and opens inwards ... as long as it does not occur to him to pull rather than push» Wittgenstein
|
|
|
|
|
Average != Median.
In statistics and probability theory, the median is the numerical value separating the higher half of a data sample, a population, or a probability distribution, from the lower half.
see here[^]
in the series 6, 9, 2, 7, 1. The median is (1, 2, 6, 7, 9) = 6. The average = (1+2+6+7+9)/5 = 25/5 = 5
So what should be done here is order the five numbers and take the middle one.
|
|
|
|
|
Thank you so much. Thats another mistake I found.
|
|
|
|
|
|
I am catching an exception, and attempting to call out to get the exception pointers in a 32-bit space. This always returns IntPtr.Zero.
When running through 64-bit this returns the propers exception pointers.
Has anyone experienced this or have a possible resolution? I have checked MSDN, nothing of value for this particular scenario. I have googled this but have found nothing helpful as of yet. It does appear there may be solutions in other languages, but I am stuck in C# land and cannot use the others.
Thank you all too much
|
|
|
|
|
Hello. I was given a small project which compiles and runs successfully in Windows 7. I also tested the project on Windows 7. But as soon as I tried to run the project on Windows 8.1, it started giving me said exception.
This definitely is not a programming error. This has something to do with system setting which I can not find out. Here is the code in which exception occurs (calling method is fine) . . .
public static void* Alloc(int size)
{
try
{
static int ph = GetProcessHeap();
void* result = HeapAlloc(ph, HEAP_ZERO_MEMORY, size);
if (result == null)
{
throw new OutOfMemoryException();
}
return result;
}
catch(Exception ex)
{ }
return null;
}
[DllImport("kernel32")]
static extern int GetProcessHeap();
[DllImport("kernel32")]
static extern void* HeapAlloc(int hHeap, int flags, int size);
What could be wrong ?? Thanks for any pointer.
modified 6-Jan-15 4:02am.
|
|
|
|
|
Seeing the statement that causes the error might help. Have you tried the debugger?
|
|
|
|
|
Django_Untaken wrote: This definitely is not a programming error. Most likely it is a programming error, but without seeing the code it's impossible to guess where. Please edit your question and show the code extract where the error occurs, along with the values of the variables that are involved.
|
|
|
|
|
Your question is impossible to answer without knowing what the code is supposed to be doing when it explodes and showing the relevant code.
Most likely this IS a programming error because the code is making a certain assumption about what it can get away with doing under Windows 7 and it can't get away with it under Windows 8.x.
|
|
|
|
|
Django_Untaken wrote: What could be wrong ??
What user do you use on 7.1? What user do you use on 8.1?
How do you run it on the different systems? For example do you install it on both using an installer using default values and then run via that?
|
|
|
|