Click here to Skip to main content
12,701,237 members (31,982 online)

Comments by Amund Gjersøe (Top 59 by date)

Amund Gjersøe 28-Sep-12 7:37am View
When establishing connection, the Timeout is not used. The Timeout is just used when sending and receiving. Start a timer, and abort you connection attempt when your timer has elapsed.
Amund Gjersøe 10-Sep-12 6:44am View
This is a question; not a solution. When building strings the data values are converted to text using all objects ToString-method. So the solution for you is: MessageBox.Show("The sum of " + intX + "+" + intY + "=" + (intX + intY).ToString());
Amund Gjersøe 6-Sep-12 13:26pm View
Why can't filesavedialogbox be used, but your imaginary filecreatedialogbox? You'll get the full file path from the regular filesavedialogbox, and you set the FileMode in the FileStream to CreateNew if that is the issue.
Amund Gjersøe 28-Aug-12 16:47pm View
This is my assumption: Since you have put both the service and the client on an other machine, it should have worked if Visual Studio was installed on that as well (hosting the 8732 port). If VS isn't installed, you could simply just use a named pipe binding "net.pipe//localhost/MyPipe" instead.
Amund Gjersøe 28-Aug-12 15:08pm View
WCF don't allow properties on interfaces. The 'get' will work as a method, but the 'set' won't. You could do a regular basic authentication. It is some work, but it is a better way to handle user name and passwords.
Amund Gjersøe 28-Aug-12 14:18pm View
I had the same issue some weeks ago, and I can't understand why the readerQuotas aren't defined by default.
Amund Gjersøe 3-Aug-12 8:50am View
Feel free to comment when voting 1 for no apparent reason.
Amund Gjersøe 3-Aug-12 6:22am View
Sure you don't want the individual columns of your selected row?
Amund Gjersøe 1-Aug-12 2:09am View
Amund Gjersøe 15-Jun-12 3:06am View
You do a Client.Close() that renders the Client useless for later use. You have to re-initialize it, or keep it open.
Amund Gjersøe 15-Jun-12 2:52am View
As Click-handlers usually are running in the GUI thread, and the timer in the thread pool, you should consider testing for InvokeRequired in the button1_Click.
Amund Gjersøe 11-Jun-12 17:14pm View
You're spot on :)
Added the original solution anyhow.
Amund Gjersøe 8-Jun-12 17:45pm View
I've used to set the Pack-attribute when Marshalling structs, just to be aware of what it is and adjust it to what's expected on the other side of the PInvoke. Just a tip along the way.
Amund Gjersøe 8-Jun-12 17:33pm View
Isn't this really a comment on the other solution?
Amund Gjersøe 8-Jun-12 17:16pm View
You are looking for an implementation of SortableBindingList<>. There are many examples found on the web. I've used one i pull of the web, and it worked like a charm as long as the properties of T supports IComparable
Amund Gjersøe 8-Jun-12 14:54pm View
I started thinking about multicast when I saw the IP ending with 255. Reading about UDP multicast could clear things up. You could test my app Basic UDP Receiver to see if you get the same behavior using UdpClient, which is in the System.Net.Sockets-namespace.
Edit: Broadcast was it I was thinking about of course ;)
Amund Gjersøe 27-Feb-12 13:43pm View
Excuse me? We posted simultaneously. I posted the solution when the question was 10 minutes old, and so did you. Keep the record straight man. It is a pretty straight forward solution, so it is not a surprise that there comes two solutions that includes 'lock'.
Amund Gjersøe 27-Feb-12 9:23am View
Have you considered using asynchronous updating of the database? Asynchronous methods often starts with Begin.....
Amund Gjersøe 2-Aug-11 7:37am View
Vote 1? Ok it says datatable, but it is still a string operation, and the way it is written it looks like column 1 contains the data, and column 2 is empty.
Amund Gjersøe 2-Aug-11 3:23am View
No, I've tested, and it's the other way around.
Amund Gjersøe 2-Aug-11 3:22am View
Hehe, maybe I should have refreshed the page before posting.
Amund Gjersøe 2-Aug-11 3:12am View
Use comments to respond to an solution, not a new solution
Amund Gjersøe 1-Aug-11 8:41am View
Not a solution. Use comments to ask further questions to the solution in question.
Amund Gjersøe 1-Aug-11 8:37am View
In your 28 question history you have only accepted one solution. It's always nice to get the solution accepted by the questioner.
Amund Gjersøe 1-Aug-11 3:43am View
My 5 for bothering to give a "Let me google that for you"-answer.

I've done them all. And they are explained in the link. My additions are: Builder NE has a license-fee, and a slight performance impact. The un-managed lets you use the same dll in Matlab and C/C++ (and then wrapped: .NET), and the for-loops gets a boost when extracting them from the Matlab-script to the dll (mex).

The automationserver gives flexibility. This solution is usable when the user of the application is familiar with Matlab as well.
Amund Gjersøe 1-Aug-11 3:24am View
Surprised no one came with a solution involving regular expressions (regex) :)
Amund Gjersøe 1-Aug-11 3:21am View
I updated the code accordingly.
Amund Gjersøe 1-Aug-11 3:12am View
ZedGraph: have your searched the project's forum? I've used ZedGrapg a bit, but I don't understand what you want to do. I think you perhaps should use 'y2axis', but try once more to write your first paragraph. It just one long sentence.
Amund Gjersøe 28-Jul-11 17:46pm View
Amund Gjersøe 28-Jul-11 17:41pm View
First, that is a big number. Since you write them separated, it would seem like it is a array of numbers rather than one big. But since that has been suggested I would suggest an other idea: Try doing it mathematically.
You have in hex '87D',
8 = 16^2 * 8 = 2048, write 2 to the string and keep the remaining 48.
7 = 16*7 = 112, 112 + 48 = 160, write 1 to the string and keep the remaining 60.
D = 13, 13 + 60 = 73, write 73 to the string.

You now have converted 0x87D to 2173.

Don't think 16^50 will compute without some rounding-off.
Amund Gjersøe 28-Jul-11 16:54pm View
Use Visual Studio to build the tableadapters and datasets, then you get strong typed datasets and thus it becomes easier to see the data type in each column.
Amund Gjersøe 28-Jul-11 16:46pm View
You say the files is within the reports folder, so I assume ASPxDropDownEdit1.SelectedItem.Text is the file name. Could it be the '*' that is the illegal character?
Amund Gjersøe 28-Jul-11 13:36pm View
Be more specific. It could be that you are using the same ports on both apps for all I know. Maybe you can test the sending app with the app from my article.
Amund Gjersøe 28-Jul-11 13:31pm View
Could you update your question with a link to the article(?) in question?
Amund Gjersøe 28-Jul-11 6:59am View
Thats strange. Do you do the test in the Validating-event? And just curious: Do you use the datatype decimal because you want to accept decimals in the textbox? Decimal is a 128-bit floating-point datatype, and the double datatype is more common.
Amund Gjersøe 28-Jul-11 6:48am View
I would say singleton should only be used when nothing else is possible. Singleton-classes introduce ambiguities when reading the code, since they look just the same as regular classes. Maintenance on code with lurking singletons is something near a nightmare.
Amund Gjersøe 28-Jul-11 6:01am View
Depending on the size of your project, you should decide on a type of architecture. Simple applications can be implemented using a monolithic architecture, while bigger systems use layered architecture. Some applications can be implemented as a transcript (where a main function call all functions like GetData, ProcessData and SaveData), and some as fully object-oriented designs.

The classes you implement depends on your decided architecture and on your evolving design. So with your "few years experience" you should be able to do some architecture decisions and some sketching on the design of your application, before you start implementing your classes. And when you start implementing, most of the thinking is already done.
Amund Gjersøe 28-Jul-11 5:48am View
Some good links there.
Amund Gjersøe 28-Jul-11 5:38am View
Agreed. Hide your application and show it again when your timer triggers.
Amund Gjersøe 28-Jul-11 5:17am View
Your solution is now great, voted 5.
Amund Gjersøe 19-May-11 6:03am View
I think you would be fine using the standard SerialPort class. Since they suggest using the parity-bit, they probably have their commands first byte giving a parity-bit of 1.

And: "SAS Protocol"? There is nothing here to do with the SAS Protocol.
Amund Gjersøe 8-Apr-11 9:43am View
Some votes weigh more than other I guess ;)
Short questions often get short answers.
Amund Gjersøe 8-Apr-11 9:14am View
I haven't tested this one, but it should work.
Amund Gjersøe 8-Apr-11 9:10am View
Is the item order guaranteed to be fixed?
No. If you implement a sortable BindingList and use that as the data source, you would get a mismatch. A safe way is:
void dgvFoo_CellClick(object sender, EventArgs e)
foreach (DataGridViewRow row in dgvFoo.SelectedRows)
Foo myFoo = row.DataBoundItem as Foo;
if (myFoo != null)
_foos.SelectedItem = myFoo;
Amund Gjersøe 8-Apr-11 7:42am View
If that worked, then please be so polite as to mark the question as solved.
Amund Gjersøe 8-Apr-11 6:38am View
Use Opera or equal to save web pages as mht. But, I'm guessing you want to do this in your own application. Have you searched using Google?
Amund Gjersøe 7-Apr-11 6:57am View
Please respond when a possible solution is provided.
Amund Gjersøe 7-Apr-11 6:56am View
Remember to respond when a proposed solution is given.
Amund Gjersøe 6-Apr-11 8:18am View
Plz elaborate. Write your question in detail using your native language, using simple words, and the use Google Translate to translate it to English. Then update your question please.
Amund Gjersøe 6-Apr-11 7:28am View
You have already asked this question. Edit that one. And you should elaborate even more.
Amund Gjersøe 31-Mar-11 9:07am View
One could think Google is blocked or something in some countries, because there are some questions here that should be quicker to google than writing a full question. ;)
Amund Gjersøe 30-Mar-11 9:22am View
Where did you get the string you want to convert, and are you really sure it is only base64-converted? Is the text written in arabic encoding?
Amund Gjersøe 30-Mar-11 8:00am View
Like setting progressBar1.Style = ProgressBarStyle.Marquee;
Amund Gjersøe 29-Mar-11 13:38pm View
Hard to figure out what you are thinking about when reading your question, but it seem like you want the user to add new items even when he is out of credits (or Rs). So instead of making the user choose what row to delete to be able to continue to use credits, you will delete a previously selected item automatically.

how to remove from gridview list.
You do this in the DataTable, not in the DataGridView. The only thing you do in a DataGridView is altering the presentation of the data, not the data them selves.
So get the row index in you event, find its equal in the datatable and copy that row to a variable (i.e. myRow), then call datatable.rows.remove(myRow), and the store myRow in the DB.
Amund Gjersøe 29-Mar-11 12:54pm View
Search Mathworks for examples in how to connect to Matlab Automation server using COM, and then pass the variables and execute the function of choice.
Amund Gjersøe 29-Mar-11 12:49pm View
I see. I guess he is just spamming the Q&A instead of googling it. Many basic tutorials would had answered his questions, I think.
Amund Gjersøe 29-Mar-11 12:22pm View
On that few bytes I think you need to have stream.Flush(); between the Write() and the Close().
Amund Gjersøe 29-Mar-11 8:46am View
Where did you get the command 32,0,0? The manual indicates that you need to send much more.
Try the example instead (even though I'm a bit confused about the explanation):
byte[] message = new byte[] {0x04, 0x81, 0x02, 0x18, 0x01,
0x01, 0x00, 0x00, 0x10, 0x05, 0x00, 0x0A, 0x00,
0x40, 0x41, 0x42, 0x43, 0x03, 0xB2};

Advertise | Privacy | Mobile
Web02 | 2.8.170118.1 | Last Updated 1 Jan 1900
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid