|
Well, that's a pretty stupid spec you have there. Why would anyone want to work at a place that asks that?
And is your second result correct?
|
|
|
|
|
Maybe it is unreasonable.. I thought I might be missing something.
You are right; the second result is incorrect, just noticed it.
|
|
|
|
|
Is that the code they gave you or the code you started writing?
Seriously, that's a really stupid way of adding arrays together. It's slower than just doing it in a single call because of the call overhead, limited in the size of the arrays it can handle because of limited stack space, a bit of a memory hog as you're creating new AddResult objects to hold the pile of results that get generated.
It's probably the most inefficient way you could possibly come up with to add those two arrays together.
|
|
|
|
|
Its the code they gave me.
I understand that it is inefficient but I think the question is just to test your understanding of recursive functions.
|
|
|
|
|
Well, they found out.
On top of everything else I said, there's also no way to put any kind of level parameter in there and, therefor, no way to put a bailout condition in either. The way they started the code, there's no way it'll work.
|
|
|
|
|
I have been programming for a little over a year now. I have learned the basics to a degree (through many headache induced nights) and have noticed a trend. I tend to be more enthralled with higher level concepts and avoid taking baby steps like the plague. For example, I couldn't tell you gow to programatically build a UI or make a delegate event for saving a file, but I know the MVVM pattern and how to make a lambda expression from a delegate. How bad is this trend?
|
|
|
|
|
To me this implies you have an interest in general programming concepts but aren't interested in building applications.
/ravi
|
|
|
|
|
Ironically, I make quite a few applications while learning more and more. I started off trying to make games and switched to applications because it was easier to be inspired.
|
|
|
|
|
Interesting. In my experience, most devs acquire knowledge of design patterns and more abstract concepts after several years of just writing code and building apps. It's good that you've developed an interest in MVVM early in the game.
/ravi
|
|
|
|
|
Haha yeah, the more abstract and difficult the concept is, the more likely it is for me to obsess over learning about it.
|
|
|
|
|
Speaking as someone at the other end of a career of developing and learning, you end up with a set of tools that do the LOB job and get you paid but have a VERY narrow range of capabilities.
You will also tend to miss a lot of the more elegant solutions because you simply do not understand the concepts and cannot relate them to your problem (building a really good app).
I wish I had had a formal education in computer science rather than a self taught bag of tricks. Don't get me wrong, I'm good at what I do but it a very narrow field.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I'm actually self taught but I have a mentor that will help me if he knows the content i'm studying (MVVM wasn't one of those, OOP concepts though, he taught me about in detail).
|
|
|
|
|
When I was learning the only support was the other side of the planet and CompuServe was the medium for communication. A mentor was the manuals, not Microsoft but Superbase, almost as bad!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
+1 for Compuserve , before that I had a huge collection of expensive and outdated books.
We can’t stop here, this is bat country - Hunter S Thompson RIP
|
|
|
|
|
hi
i have this C# code for reading port via rs232
port = new SerialPort(MyParam._COM, Brate, Parity.None, 8, StopBits.One);
port.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(Recepcion);
private SerialPort port;
string Recibidos;
private void Recepcion(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
{
try
{
Recibidos = "";
Application.DoEvents();
System.Threading.Thread.Sleep(122);
Recibidos += port.ReadExisting();
this.Invoke(new EventHandler(Actualizar));
}
catch { }
string text;
decimal dTEXT;
private void Actualizar(object s, EventArgs e)
{
text = Recibidos.Trim();
lblMSG.Text = text;
}
I have a weight attached to rs232 and i get Strange reading.
for example - if the weight show 14.23 Kg
i see:
14.23 Kg
0
14.
14.2
14.23
14.23 Kg
How to show the exact weight without breaking the string ?
|
|
|
|
|
Maybe don't use port.ReadExisting() ?
Also, try using a StringBuilder rather than a string.
|
|
|
|
|
It seems you need to call port.DiscardInBuffer() after each call to ReadExisting() .
/ravi
|
|
|
|
|
thanks for the help, i'll try this and I'll update the findings.
|
|
|
|
|
Using Silverlight and c#:
I have a datagrid having PropertyGroupDescription added to it and also have Item templates in it.. If I edit a row which is exist in the middle of the grid..after saving that data by using that save button in the panel...what happened is the data grid rebinding and the pointer goes to the first record in the datagrid. I want the scroll to maintain its position to the row which is edited after its ItemSource is changed. I tried using ScrollIntoView as follows:
tblSessionDataGrid.Focus();
tblSessionDataGrid.SelectedItem = objSelectedItem;
tblSessionDataGrid.CurrentColumn = tblSessionDataGrid.Columns[0];
tblSessionDataGrid.ScrollIntoView(objSelectedItem, tblSessionDataGrid.Columns[0]);
But its now working. Can anyone please suggest where I am going wrong?
|
|
|
|
|
hi
looking for C# sample code reading weight Through rs232 - WinForm
I found some on the net - but none worked,
Even after I pointed all settings (com....BaudRate....)
thanks
|
|
|
|
|
We probably can't help: you are going to have to talk to the manufacturers of the specific make and model of weighing machine you are connecting. There is no one standard method of communicating, so you need to get hold of an manual, or better a person who knows what is provided.
Anything else is just guesswork!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Most scale serial protocols are very simple. Typically you send a single character ('W' or 'P' are common) and get a 'CR' or 'CR' 'LF' terminated string in response.
HyperTerminal is a decent way to debug serial communication(to ensure you have the parameters right). You can copy two files from any XP machine to get it back. The files you need are hypertrm.dll and hypertrm.exe.
A pretty highly regarded alternative to HyperTerminal is Putty. You can learn more about Putty here.
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html[^]
I used to design scales in my previous job, and am familiar with scale RS232 and USB communication. Post the manufacturer and model number of the scale you are trying to talk to and I might be able to give more direct help.
Another thing to keep in mind is that most scales have configurable protocols so you will need to verify how the scale is configured when writing your software. You are going to need the scale's tech manual to be able to do this.
|
|
|
|
|
Hi all.
when I get the value of ifInObtets with oid = 1.3.6.1.2.1.2.2.1.10, it's not return values.
modified 7-Aug-15 5:16am.
|
|
|
|
|
What are you talking about?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|