|
Why were my answers voted down? They damn well provided a correct answer. This is complete bullsh|t.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
@john-simmons-outlaw-programmer @cyborgkagaw
edit ...
After thinking this over, I have decided that my down-voting posts from Simmons and Gayo was a mistake. I apologize to both of them, and I have up-voted their posts to counteract the down-vote,
While I find the posting of ... what I perceive as ... homework solutions for obviously gimme-codez OP's disturbing, it's obvious to me that my taking this on ... without being part of a sanctioned and widely supported effort by many MVP'a and Mentors ... will just create chaos and bad-feeling.
We're here because we love to code ... aren't we ?
sincerely, Bill
... end edit ...
I have up-voted posts from Vluggen and Schmitz, and down-voted posts from Simmons and Gayo for the following reasons:
If we provide code to people that helps them avoid/shirk their homework, we are degrading the educational process, and contributing to the OP's failure to learn and grow: we are fostering dependency and laziness.
«... thank the gods that they have made you superior to those events which they have not placed within your own control, rendered you accountable for that only which is within you own control For what, then, have they made you responsible? For that which is alone in your own power—a right use of things as they appear.» Discourses of Epictetus Book I:12
modified 14-Apr-18 8:40am.
|
|
|
|
|
BillWoodruff wrote: If we provide code to people that helps them avoid/shirk their homework, we are degrading the educational process, and contributing to the OP's failure to learn and grow: we are fostering dependency and laziness.
Down-voting CORRECT answers is bullsh|t, Bill, regardless of whether or not YOU believe that the user should have gotten said answer.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
John Simmons / outlaw programmer wrote: Down-voting CORRECT answers is bullsh|t, Bill I take the responsibility I believe is involved in being a Mentor on this site seriously.
You continue to be someone I respect technically, and whose many contributions to this site, I have learned from.
sincerely, Bill
«... thank the gods that they have made you superior to those events which they have not placed within your own control, rendered you accountable for that only which is within you own control For what, then, have they made you responsible? For that which is alone in your own power—a right use of things as they appear.» Discourses of Epictetus Book I:12
|
|
|
|
|
Yes. The "good samaritan" law should apply. Just don't move them.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Yeah, I've been snarky in the past with people asking questions regarding their homework, but I've NEVER down-voted someone's answer simply because the guy asking the question is too lazy to figure it out on his own. NEVER.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Should we get your approval before answering questions from now on?
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
John Simmons / outlaw programmer wrote: Should we get your approval before answering questions from now on? No !
«... thank the gods that they have made you superior to those events which they have not placed within your own control, rendered you accountable for that only which is within you own control For what, then, have they made you responsible? For that which is alone in your own power—a right use of things as they appear.» Discourses of Epictetus Book I:12
|
|
|
|
|
Oh wait! If you'll give me your email address, I'll send you all my code for either your approval, or a list of ambiguous hints and criticisms about where I might have gone wrong before I check it in to TFS. Oh yeah, don't forget to include a lecture on the evils of asking a question on CodeProject. You know - so we don't foster dependency and laziness.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
At least he is honest about it and providing a comment to explain it. You'd be usually the first to sneak something into the solution to get the kid in trouble
A downvote just costs some points, and we have enough to spend.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
It's not about the points. It's about down-voting an answer the is CORRECT, because that reflects on ME.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
So does the rest of the thread.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
And I already had that rep, so no harm, no foul. You should have seen the stuff I didn't post...
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
So here we are. I provided an answer (two, in all actuality), and my answers were down-voted because some pompous ass decided that you didn't deserve the answer I provided.
I didn't provide any guidance, because I don't know if you're TRULY serious about being a programmer, or just taking an elective course to fulfill diploma requirements.
If you're serious, you gotta learn to THINK like a programmer. That means taking a project, breaking it down into logical steps, writing psuedo-code, and then writing actual code.
I'm assuming your instructor taught you about functions, and how they work. Actually, they're called METHODS, and all methods technically return a value, whether it's void or some other type. Methods also (optionally) accept one or more parameters. So let's break down your requirement into easily consumable requirements:
0) write a program that demonstrate the use of a function (method)
1) the function calculates an average of five values
2) the function returns the calculated average
Notice that there is no specification regarding WHERE the function gets the five values. This means you can set up a globally accessible collection of values, or pass parameters to the function. It's your choice how to proceed here.
Once you've decided which way you're going to provide the consumable data (the five values), you can craft your method prototype accordingly.
The body of the method has two processes - calculate the average of the values provided, and return the resulting average.
It's really just that simple (if you were in class for the instructor's guidance regarding the assignment, and paying attention).
If you want definitions for any of the nomenclature I've used above, google is your friend. You certainly shouldn't expect any specific help here, because after all, this is a homework question, and Bill simply won't let that happen.
----------------
Now, that too way too much f*ckin time to type. I don't really care if you are serious about being a programmer, or that this is even homework. I'm not your instructor, and it took LESS of my VALUABLE time to simply "give you the codez" than to give you most of the lesson you should have gotten from your instructor.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
modified 13-Apr-18 15:31pm.
|
|
|
|
|
|
With what? I did what Bill should have done if he was truly concerned with the OP learning something. Instead, he chose to treat everyone that provided real answers like they were 12-year-olds, and scold us for just giving the OP what he wanted.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
John Simmons / outlaw programmer wrote: ... all methods technically return a value, whether it's void or some other type A method with the 'void specification does not return anything: if the compiler encounters a 'return statement in a 'void Method followed by any .NET Type instance, it will throw an error. Of course, the 'return flow of control statement ... by itself ... is valid.
«... thank the gods that they have made you superior to those events which they have not placed within your own control, rendered you accountable for that only which is within you own control For what, then, have they made you responsible? For that which is alone in your own power—a right use of things as they appear.» Discourses of Epictetus Book I:12
modified 15-Apr-18 4:07am.
|
|
|
|
|
Hello
Below id my C# code for finding the status of a website. I get a ok, what I want is to get a 200.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace _200_Test2
{
class Program
{
static void Main(string[] args)
{
{
WebRequest request = WebRequest.Create("http://www.cnn.com/");
try
{
using (WebResponse response = request.GetResponse())
{
HttpWebResponse httpResponse = (HttpWebResponse)response;
Console.WriteLine(httpResponse.StatusCode);
Console.ReadKey();
}
}
catch (WebException e)
{
using (WebResponse response = e.Response)
{
HttpWebResponse httpResponse = (HttpWebResponse)response;
Console.WriteLine("Error code: {0}", httpResponse.StatusCode);
using (Stream data = response.GetResponseStream())
{
string text = new StreamReader(data).ReadToEnd();
Console.WriteLine(text);
}
}
}
}
}
}
}
I try for days now to get a simple 200.
Maybe someone can look at this and tell me what I am going wrong.
Thank You
renny
|
|
|
|
|
But 200 is OK! The property you are referring to also says the same, HttpStatusCode Enumeration (System.Net), only the difference is that your property is an enum and it might be getting translated to a readable form. Try this,
Console.WriteLine((int)httpResponse.StatusCode);
But again, remember, it is always better to use the readable/understandable names of the state; OK, Bad request, etc. Rather than the HTTP codes.
And yes, similarly for the error printing, you would need to use the following,
Console.WriteLine("Error code: {0}", (int)httpResponse.StatusCode);
Read the guide on MDN for more on HTTP codes and also the MSDN link I provided above to understand a bit more about this HTTP status code and how .NET supports it.
200 OK - HTTP | MDN
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Thank you all very much
|
|
|
|
|
See HttpStatusCode Enumeration (System.Net)[^] for the enumeration details. The 200 value is interpreted by the HttpWebResponse object. If you want to see the actual status line then you need to use POST/GET to receive the raw HTML source.
|
|
|
|
|
Thank you all for your help.
renny
|
|
|
|
|
Hello,
I created a new user defined function in excel using c#,what i want to get is when a user open an excel file, clic on a cell and write =myFunction() press enter, data should be displayed in the excel file. these data are retrieved from sql server database and stocked in a 2D array of object, my problem is when i try to display this array in excel range i got this exception
Exception de HRESULT : 0x800A03EC
Below is my code :
public static void LoadViewData()
{
var target = (ExcelReference)XlCall.Excel(XlCall.xlfCaller);
var sheetName = (string)XlCall.Excel(XlCall.xlSheetNm, target);
var application = (Microsoft.Office.Interop.Excel.Application)ExcelDnaUtil.Application;
var sheet = application.Sheets[Regex.Replace(sheetName, @"\[[^]]*\]", string.Empty)];
object[,] result = LoadFromDbData();
var startCell =sheet.Cells[target.RowFirst + 1, target.ColumnFirst];
var endCell =sheet.Cells[target.RowFirst+ result.GetUpperBound(0) - result.GetLowerBound(0) + 1,
target.ColumnFirst+ result.GetUpperBound(1) - result.GetLowerBound(1) + 1];
var writeRange = sheet.Range[startCell, endCell];
writeRange.Value2 = result;
}
target returns the correct value of the cell where the user has written the formula (=myFunction())
sheetName returns the correct activeSheet in which the user writes the formula
result contains the data retrieved from sql server, it is an array of object[854,8]
startcell and endcell represents the range from which cell to which cell data will be displayed
when debugging, all variables contain the correct values, the exception appears in this instruction :
writeRange.Value2 = result;
Anyone has already worked with this or can help please ?
Thanks
|
|
|
|
|
0x800A03EC in Excel is a rather generic error.
In this case, you can't assign an array to a single cells Value2 property. You actually have to iterate through each cell in the array and assign the value of that cell to the corresponding cell in the worksheet.
|
|
|
|
|
We have a medical device that is connected to the LAN but is not on Active Directory. The instrument is running Windows Embedded as a service.
When a user logs into the device we want to validate them against AD. I've found plenty of example of validating users, but they all seem to assume that the code is being run under an account of an AD user.
How to I validate a user against AD when the instrument isn't on AD?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|