|
As a sidenote; it will find "similar" result, not duplicates.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi,
Is it possible NOT to open the EXE itself and opening instead from within my application only.
What I mean is: I want to launch the WinApplication2 from my WinApplication1 but I don't want the user to go to the windows folder and be able to launch the WinApplication2 direcrly.
Technology News @ www.JassimRahma.com
|
|
|
|
|
Without applying security policies, you cannot prevent the user from being able to launch an application directly. The ability to arbitrarily deny the ability to launch an application would recommend a massive security risk.
|
|
|
|
|
No, you can't prevent someone from launching the other EXE.
Why? Because when a application is launched it's launched AS THE PERSON WHO LAUNCHED IT. This means the process inherits all the security permissions (called a security token) of the account that launched it. Any other process that this process launches also inherits the security token. When your first process launches a second one, it's doing it the exact same way you would. If you try to deny users from launching the second process independently of the first process, your first process won't be able to launch the second process either.
There is a way around this though. In your second process code, check to see if the first process is already running. If not, immediately quit the application.
|
|
|
|
|
Generate two Guids from App1. Start App2 and give on of the guids as a switch. Send the other using TCP/IP, a pipe or a Memory-mapped file.
Shouldn't be too hard to break though (using ILSpy).
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
how to select all check boxes in Repeater when I select the Header check box like a g mail trash work
|
|
|
|
|
Either by data binding or event handling. But you need to provide more detail of your problem for a more definitive answer.
|
|
|
|
|
|
Hi guys,
I'm taking C# class, and I got the mark "F" for my assignment.
However, I don't know whether my work was the waste as much as get the zero.
My prof. said me my solution does not satisfy the requirements, but I can't agree with her. I think it was not zero even if I made some mistakes. So, I wanna you guys check my solution whether it was really zero. If you guys also said me I was wrong, I can accept it. but, if otherwise, I'm gonna apply grade appeal.
Here is her direction:
Write a generic method, Search, that implements the linear-search algorithm. Method Search should compare the search key with each element in its array parameter until the search key is found or until the end of the array is reached. If the search key is found, return its location in the array; otherwise, return -1. Write a test app that inputs and searches an int array and a double array.
Here is my code as test code including main():
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GenericSearchLib;
namespace GenericSearch
{
class GenericTest
{
private static GenericStack<int> intStack;
private static GenericStack<double> doubleStack;
private static int[] intArray;
private static double[] doubleArray;
private static int n;
static void Main(string[] args)
{
Console.WriteLine("Enter a number of arraies what you want : ");
string arrN = Console.ReadLine();
n = Convert.ToInt32(arrN);
if (n == 0)
Console.WriteLine("Please enter the number is bigger than 0");
else
intStack = new GenericStack<int>(n);
doubleStack = new GenericStack<double>(n);
intArray = new int[n];
doubleArray = new double[n];
for ( int i = 0; i < intArray.Length; i++ )
{
Console.WriteLine("Enter a integer for int array, one number as 1 : ");
string value = Console.ReadLine();
intArray[i] = Convert.ToInt32(value);
}
TestPush("intStack",intStack,intArray);
Console.WriteLine();
Console.WriteLine("-----------------Complete pusing the array-------------------");
Console.WriteLine();
for (int i = 0; i < doubleArray.Length; i++)
{
Console.WriteLine("Enter a integer for double array, one double number as 2.00 : ");
string value = Console.ReadLine();
doubleArray[i] = Convert.ToDouble(value);
}
TestPush("doubleStack",doubleStack,doubleArray);
Console.WriteLine();
Console.WriteLine("-----------------Complete pusing the array-------------------");
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("-----------------Start searcing the array-------------------");
Console.WriteLine();
Console.WriteLine("Enter the name of array what you want to search, int or double : ");
string arrName = Console.ReadLine();
Console.WriteLine("Enter the keyword what you want to search : ");
string keyword = Console.ReadLine();
if(arrName == "int")
TestSearch(keyword, "Int Array", intStack);
else
TestSearch(keyword, "Double Array", doubleStack);
}
private static void TestPush<T>(string name, GenericStack<T> stack, IEnumerable<T> elements)
{
try
{
Console.WriteLine("\nPushing elements onto " + name);
foreach (var element in elements)
{
Console.Write("{0} ", element);
stack.Push(element);
}
}
catch (FullStackException exception)
{
Console.Error.WriteLine();
Console.Error.WriteLine("Message: " + exception.Message);
Console.Error.WriteLine(exception.StackTrace);
}
}
public static T To<T>(this string text)
{
return (T)Convert.ChangeType(text, typeof(T));
}
private static void TestSearch<T>(string searcKey, string name, GenericStack<T> stack)
{
int result=0;
int savePosition=-1;
try
{
for (int i = 0; i < n; i++)
{
result = stack.Search(searcKey, i);
if (result != -1)
savePosition = result;
}
if (savePosition == -1)
{
Console.WriteLine("Searching fail. Your keyword is not matched from array. -1");
}
else
{
Console.WriteLine("Searching success. Keyword : {0} . Index(location) of array : {1}", searcKey, savePosition);
}
}
catch (EmptyStackException exception)
{
Console.Error.WriteLine();
Console.Error.WriteLine("Message: " + exception.Message);
Console.Error.WriteLine(exception.StackTrace);
}
}
private static void TestPop<T>(string name, Stack<T> stack)
{
try
{
Console.WriteLine("\nPopping elements from " + name);
T popValue;
while (true)
{
popValue = stack.Pop();
Console.Write("{0} ", popValue);
}
}
catch (EmptyStackException exception)
{
Console.Error.WriteLine();
Console.Error.WriteLine("Message: " + exception.Message);
Console.Error.WriteLine(exception.StackTrace);
}
}
}
}
This is GenericStack.cs :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GenericSearchLib
{
public class GenericStack<T>
{
private int top;
private int position=0;
private T[] elements;
public GenericStack()
: this( 10 )
{
}
public GenericStack(int stackSize)
{
if (stackSize > 0)
elements = new T[stackSize];
else
throw new ArgumentException("Stack size must be positive.");
top = -1;
position = 0;
}
public void Push(T pushValue)
{
if (top == elements.Length - 1)
throw new FullStackException(String.Format("Stack is full, cannot push {0}", pushValue));
++top;
elements[top] = pushValue;
}
public T Pop()
{
if (top == -1)
throw new EmptyStackException("Stack is empty, cannot pop");
--top;
return elements[top + 1];
}
public int Search(string searckyKey, int position)
{
int reVal=-1;
if (top == -1)
throw new EmptyStackException("Stack is empty, cannot search");
if (searckyKey.Equals(elements[position].ToString()))
{
reVal = position;
}
return reVal;
}
public void Display(string arrName)
{
Console.WriteLine( arrName + " ArrayList : " );
int arrN = elements.Length - 1;
foreach(var value in elements)
{
Console.WriteLine( "Location : {0}, Value : {1}", arrN, value);
--arrN;
}
}
}
}
She pointed out me 2 things.
1. I used stack instead of array.
2. I didn't provide Generic method.
Guys, please let me know, I had to get the zero.
Please show me whether this mark was just her opinion.
If it's unfair, please tell me how I can professionally say it to prof. lol
modified 9-Feb-15 2:18am.
|
|
|
|
|
I'm afraid I have to agree with her: the instructions were pretty explicit as to exactly what she wanted: a Generic search method using an array. You provided a generic method using a stack.
That's not the same. It doesn't meet the requirements: If you were selling cars she asked for a red Ferrari and you supplied a red Ford.
She is right. Possibly harsh, but right. You did not complete the task that she asked you to.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Thanks your answer
now, I can understand I provided the solution in a wrong way.
But this different is really big problem as much as get the zero?
I can accept some miss point, but...I don't know..
anyway thank you for your time..
|
|
|
|
|
Would you be happy with a red Ford if you had asked for a Red Ferrari?
Computing is a lot about details: so not reading the assignment correctly could be a significant problem.
As V says: redo it "properly" and ask her if that was what she wanted. It may not improve your grade, but it might be a better solution than annoying the person who will mark your next assignment...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Just out of interest, how much of your own work did you put into that?
Did you write it all, or find something on the internet and "bend it to fit"?
How long did it take you?
How did you test it?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Some teachers only have like three possible grades. if you have a score between 0 and 10 they have 0 if you were wrong, 5 when you only made a very small error and 10 when you're correct. I've always had trouble with teachers using this way of grading, but that's the way life is.
That said, you're application looks very complicated for an assignment which just needs to loop an array front to back and provide the index of the matching searchkey. Secondly, many of the output lines contain spelling mistakes. Native language or not, when you produce something that others see, make sure to use correct spelling.
I haven't looked into detail to the code and have no idea if it works, but although 0 might be a little on the low end, it surely doesn't deserve the 10 out of 10.
My personal advice, I always use the KISS (Keep It Simple Stupid) principle. Don't overcomplicate things .
|
|
|
|
|
Yeap, of course, I never expect the perfect mark, but my point is zero was too harsh...
Now, I know my solution was too complicated as you said, and I provided wrong solution.. but..
I still don't understand it must be the zero.
Second thing you said, yeap, I agree with you. It was my fault, even I haven't known this spelling mistake. lol
Anyway, your advice helped me, don't overcomplicate things.
Thanks V.
|
|
|
|
|
For what it's worth. It never hurts to question something and it's good to being able to accept a criticism, even if that hurts sometimes. I doubt you'll get a higher grade (and is it worth it to fight your teacher for it ?).
What I should do, is redo the assignment, as requested. And show it to her. Tell her you don't want a higher grade for the assignment, but you just want to know if that new version would be correct. That you want to make sure you understand. That way you show her you want to put in an effort and you know what she wants to see next time around. When it comes down to a borderline grade, chances are she'll let you pass because of your attitude.
|
|
|
|
|
Good advice!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
In addition to this being a case of "not doing what the assignment said you should do", the code is sprinkled with many odd things.
For example:
Deviation from the standard formatting. That wouldn't be so bad by itself, but it's not even consistent. Spaces are missing or added randomly.
Lots of static fields. Why? They look like "escaped locals". If you actually communicated through them, I'd probably deduct a point for effectively using globals. Anyway, there are use cases for static fields, but this isn't any of them.
position in GenericStack . What is it? Does it even do anything? Even if it did do something, should it be doing that?
Using anything from the class Convert .
This gem:
public static T To<T>(this string text)
{
return (T)Convert.ChangeType(text, typeof(T));
}
Missing brackets or suggestive formatting near
else
intStack = new GenericStack<int>(n);
The combination
--top;
return elements[top + 1];
So, I don't know about a zero, but I'm afraid I would give you a low grade too. 3/10 if I were generous. Probably 2/10, reserving the 1/10 for those who deliver absolutely nothing. I'm sure you can do better.
|
|
|
|
|
To really know how appropriate, or inappropriate, your solution was, and evaluate the "fairness" of the grade, I'd have to understand the context of the class you are taking, and know more about the Instructor's assignment.
On the most general level (based on the information you provide here), I'd say your solution is definitely not what was asked for, and also "too clever by half."
If I were your Instructor, I'd just ask you to redo the assignment in a simpler way; I wouldn't give any grade. I'd do this based on my perception that you are (probably) curious, eager, and you did (probably) more work than other students. I'd rather have a student who is "swept away" in enthusiasm, but makes an error in judgement, than have a student who just does what is required with no enthusiasm ! But, your Instructor may have a completely different mind-set.
You are the only person who can answer the question: "Did you decide to use a Stack because you concluded, for logical reasons, it was the best way to implement the solution, or did you do this because you wanted to 'show off'?"
In any case, your Instructor does have the right to hold you accountable for mastery of the "fundamentals."
Why not talk to your Instructor about your project, trying to be as non-confrontational as possible ?
«I'm asked why doesn't C# implement feature X all the time. The answer's always the same: because no one ever designed, specified, implemented, tested, documented, shipped that feature. All six of those things are necessary to make a feature happen. They all cost huge amounts of time, effort and money.» Eric Lippert, Microsoft, 2009
modified 9-Feb-15 9:07am.
|
|
|
|
|
I'd say the grade is justified.
Writing a bunch of code in a business environment that completely ignored the requirements would get you a bad review at best and fired at worst. Consider that the next time you have questions about the requirements and don't ask them.
|
|
|
|
|
Hi, all.
Thank u guys so much
All your answers will make me better than before, and now I can know what my problem was, and she was right.
The happiest thing is I don't need to struggle with incomprehensible to me.
thank you guys, thank you for your time
|
|
|
|
|
You're welcome!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I need source code for (Providing Hop-by-Hop Authentication and Source
Privacy in Wireless Sensor Networks)this project title in c#..i didn't get that project source code..plz help me
|
|
|
|
|
If that is an article on this site and you can't download the source, then either use the forum at the bottom of the article to raise the matter with the author, or provide us with a link so we can look at the same article.
If it isn't, then we have no control over the article content / download availability.
If you are trying to get code to fulfill your homework project, then it doesn't work like that.
We do not do your work for you.
If you want someone to write your code, you have to pay - I suggest you go to Freelancer.com and ask there.
But be aware: you get what you pay for. Pay peanuts, get monkeys.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
You already got a link to a source implementation here[^]. It's up to you now to do some work.
|
|
|
|
|