15,741,688 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View Javascript questions
View C++ questions
View Python questions
View Java questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Rob Philpott (Top 200 by date)
Rob Philpott
18-Jul-23 10:01am
View
As mentioned above, it appears to be the server that is disconnecting you. Could it be that its expecting a secure connection - TLS or something?
Rob Philpott
15-Jul-21 10:37am
View
Sounds like timezones alright. Dates and times can be more confusing than people think. Could you tell us your geographical position and timezone and is the server located nearby or far away and in which timezone?
Rob Philpott
24-Nov-20 9:53am
View
Hello. Try replacing the 'Add' with 'TryAddWithoutValidation' and see if that helps? I'm actually more used to using HttpWebRequest for these types of things, so I'm guessing a bit here.
Also, I replaced your */* with *.*. Old habits..
Rob Philpott
24-Nov-20 9:49am
View
Deleted
Hello. Try replacing the 'Add' with 'TryAddWithoutValidation' and see if that helps? I'm actually more used to using HttpWebRequest for these types of things, so I'm guessing a bit here.
Rob Philpott
2-Apr-20 8:54am
View
Perhaps it's just a rite or passage for those arriving at JavaScript from proper languages, but its really making me feel quite ill.
Rob Philpott
30-Jan-20 7:44am
View
Is this still a problem? If so, could you post the C++ prototype - it might be a calling convention mismatch.
Rob Philpott
30-Jan-20 7:27am
View
It's a bit odd isn't it? Can't see it going near SQL because that doesn't know about System.String (unless it's some weird managed extension), and wildcard matching is done using % not *. Some sort of DataSet maybe. I have no idea.
But the quote mismatch is most probably it I'd have thought.
Rob Philpott
21-Jan-20 9:18am
View
StreamReader, rather than the Stream itself, I'd venture in the second case. :)
Rob Philpott
15-Jan-20 11:45am
View
Quite right! I feel ill.
Rob Philpott
10-Apr-19 11:15am
View
The assembler I think. It just occurred to me to check the disassembly window, and it shows this:
push al;
000C16A0 push eax
pop al;
000C16A3 pop ax
so push AL => push EAX, and pop AL => pop AX. This is VS2015 C++ in an asm block.
Rob Philpott
10-Apr-19 10:54am
View
I agree, but that's not what I'm seeing (in the debugger).
For instance for push/pop EAX here are the values of ESP before the push, then before the pop and after the pop:
0x39f7b0
0x39f7ac
0x39f7b0
Exactly what you expect, 4 byte movement each way for a 4 byte register. For push/pop AX I got:
0x3ffc60
0x3ffc5e
0x3ffc60
Again, exactly as you'd expect with a 2 byte movement for a 2 byte register. But when I do it for just AL, I get this:
0x3ef8c8
0x3ef8c4
0x3ef8c6
So a movement of 4 bytes for the push, and 2 bytes for the pop, after which Visual Studio gets all upset because the stack is wrong.
Rob Philpott
10-Apr-19 10:22am
View
Yes, it's mighty odd if you ask me. If I push then pop EAX, everything is fine. If I push then pop AX, also everything is fine, but when you go down to AL, the push and the pop move the stack pointer by different amounts, neither what I'd expect. And I don't think it is down to word alignment either.
I'm mucking around here, the only assembly language programming I've done in earnest is on ARM where the CPU is a well organized thing of beauty, not some transistor equivalent of a teenager's bedroom with X86 daubed on the door.
It's the compiler I feel sorry for...
Rob Philpott
4-Apr-19 9:53am
View
A bit confused. So you have a traditional 'live' table which shows the latest values for these 50,000 records, and you also have a key/value audit table which stores the whole history of the other table? And I presume you want to do a 'point in time' query, where you can see how the table would have looked at that point in the past? And when you add a new row to the main table, does it create 112 rows in the audit table?
Rob Philpott
28-Feb-19 6:51am
View
Why are you creating a new form when data is received? That's weird, and it won't work. That form never gets displayed, and even if it did there would be profound threading issues as mentioned in the answer below...
Rob Philpott
15-Feb-19 9:41am
View
Well, the error states this: 'Error while loading librdkafka.dll or its dependencies from Assets/librdkafka.dll'. Is that DLL there, in a folder called Assets? It's probably an unmanaged thing used by confluent.Kafka.dll
Rob Philpott
23-Jan-19 8:25am
View
Sorry, I think I misread your post. But I don't understand what you trying to do. You are trying to convert "Á,õn O'kim José Nuñez" to "JOSNUÑ44"? I don't see the relationship between the two.
Rob Philpott
23-Jan-19 8:17am
View
Give me a moment, I'll try it...
Rob Philpott
23-Jan-19 5:24am
View
You really don't want any sleeps. A few pointers/suggestions:
1. Don't muddle the listen/accept code with stuff which handles a connection. Start a task that listens, await accepts, and fires the TcpClient off on a new task then repeat until cancelled. Making this async means the only time a thread is in play is when it actually is accepting and creating a task to handle the connection.
2. Use ReadAsync/WriteAsync methods on your NetworkStream for the conversation part. Same thing applies, thread only in play when data is received or being prepared to be sent - never blocked.
3. Be careful with Read(). It returns the number of bytes read, which may not be all that you expect, it depends on how the data is batched up into datagrams. It's usual to put the read in a loop until you get all the data you expect.
4. Separate your concerns, mostly covered in (1), but the business of listening for connections and farming them off to connection handlers is pretty much how every TCP based service works, thus try and keep this as generic as possible. You may be able to reuse it in a different application.
It's not the easiest thing TCP programming and very hard to get bang on!
Rob Philpott
22-Jan-19 10:39am
View
Not sure I understand the question. Sleep will halt execution of the current thread and won't schedule any more until the amount of time has elapsed. Meanwhile, your thread which is now in a coma, is still using its resources - stack space and the like. This probably doesn't matter too much in a typical app, but when you move server-side to a service that might handle a lot of concurrent connections you need to be careful, you could end up with a lot of sleeping threads which do nothing but consume resources. It doesn't scale.
So, you want to avoid any kind of sleep server side. You could use Task.Delay instead (if in async method) which is much better but the general premise of waiting server side is a bit alarming. Instead aim to react when things happen - data being received etc. via use of async methods.
Rob Philpott
21-Jan-19 8:29am
View
Nice! :)
Rob Philpott
8-Nov-18 8:33am
View
Yeah, the inclusive bit is weird isn't it. One assumes it means the higher bound of the array, but it could refer to the lower of both. And starting at 1 sounds like the sort of thing a 'VB Person' would do. Oh dear.
Rob Philpott
1-Nov-18 11:55am
View
** Pedant Alert **
The ToString() serves no purpose.
Well, the internet is full of annoying people so I'm just embracing it.
Rob Philpott
8-Jun-18 6:18am
View
OK, this is not an authorative answer as I'm not absolutely sure, but I think that if you have a TcpClient server-side, and presumably you have got a stream from it from which you are reading what the client sends you.
Reading from the stream synchronously will block, until bytes are received. In the event of a disconnect the call will unblock, but you will have read no bytes.
I *think* you can use this after which you should do the close/shutdown cycle.
Rob Philpott
2-May-18 12:32pm
View
Yep. I like the keypress intercept - it's a classic!
Rob Philpott
24-Jul-17 12:50pm
View
Sorry, mouse error, this was intended for comment above. Enough for one day, I'm going home!
Rob Philpott
24-Jul-17 12:50pm
View
Ah, but I understand SMTPClient doesn't support that - only an initial unencrypted connection promoted to secure by the use of STARTTLS.
Rob Philpott
7-Jul-17 10:47am
View
Wise words.
Rob Philpott
30-Jun-17 10:13am
View
Wild guess, but are they marked as public?
Rob Philpott
24-Apr-17 7:05am
View
You, sir, are a lone voice of reason on this question. I can't believe what I'm reading below and what qualifies as 'proof'.
Rob Philpott
1-Feb-17 14:06pm
View
Trade secret eh? Go on, you can tell me. Does it involve rewriting the operating system?
Rob Philpott
1-Feb-17 12:06pm
View
That's interesting. How would one delete a file in use by another process?
Rob Philpott
6-Jan-17 6:35am
View
Yes, saying things are just wrong without offering any alternative solution and without troubling my own brain on how this might be solved makes me think I should move into management. Good luck!
Rob Philpott
6-Jan-17 6:16am
View
Ah, it'd be better if computers had pens than keyboards!
On the half square triangle which has all three points on the circle, move just the point not on the hypotenuse so its outside the circle. Other 2 points stay where they are. This small change won't affect the two points farthest from each other, but a circle centred half way between them no longer contains all 3 points.
Rob Philpott
6-Jan-17 5:43am
View
Slightly bothered that I am concerning myself with this problem, but...
I'm fairly sure that assertions 3 & 4 are incorrect.
Cut a square in half diagonally to make a triangle, the farthest points are on the hypotenuse, so centre point would be half way along it. Draw a circle here r=h/2 and all 3 points touch it. Now edge the point of the triangle out a bit. It is outside the circle but doesn't affect that farthest points...
Rob Philpott
4-Nov-16 6:29am
View
Hi Rick, think you might be looking at that from a C++ perspective. In C#, static members will only get initialized the first time the type is accessed, and live in the scope and lifetime of the AppDomain they reside in.
Rob Philpott
6-Oct-16 12:05pm
View
This has me confused. What you describe doesn't match what I understood happens, and indeed when I write a simple console app which launches Notepad, Notepad stays when the console app dies.
The processes you are trying to start, what are they? Console/Windows/Services?
Rob Philpott
6-Oct-16 11:31am
View
Not necessarily bad practice to my mind - unless you have credentials in there - do you?
Rob Philpott
1-Sep-16 1:41am
View
Log4Net is by far the most common choice that I've seen. Logging every method's entry and exit sounds like overkill though. You just end up with huge log files that don't tell you much. That said, I don't know your requirements.
If you log exceptions properly, you will get the full stack trace in the log file and I'd argue this is what you need when things go wrong.
Rob Philpott
12-Aug-16 8:06am
View
This is an extremely strange error to receive. The type initializer is the static constructor of the class which suggests something has gone wrong internally within System.Data.
Can you post the full exception, including any inner exceptions to reveal any more info?
Rob Philpott
22-Jul-16 6:34am
View
Just a thought, but is it something to do with the thread you're on? The second example clearly happens on the gui thread, but the NotifyPropertyChange suggest that a second thread might be in play.
That's the sort of thing the debugger may be being helpful with.
Rob Philpott
22-Jul-16 3:36am
View
I would think seriously about switching to the new version and updating your logging code. This would not normally be required as I'm sure they maintain backward compatibility for all the normal cases.
Side-by-side/assembly redirection is something to avoid unless absolutely necessary.
Rob Philpott
12-Jul-16 16:24pm
View
find and replace in files!
Rob Philpott
12-Jul-16 11:22am
View
What is it that you wish to add to all the handlers? You might be able to do it by intercepting the underlying messages.
Rob Philpott
15-Jun-16 11:40am
View
It won't show anything in the main window as there's no coding doing so. What you program appears to do is create a book, serialise, deserialise it (effectively cloning) and stops there.
You'd need to create some mark up and binding or actually start putting controls on the screen to display it.
Rob Philpott
8-Jun-16 13:45pm
View
Wild guess casually looking at the code. I'd say the use of Waithandles is unusual and unnecessary, and in the receiver the signal comes before the EndAccept, causing it to potentially re-enter on the same instance. Try moving the Set below the EndAccept. Even better, get rid of the Wait handle and do the next BeginAccept immediately after the EndAccept.
Rob Philpott
1-Jun-16 10:33am
View
What is that, JSON? If so I'd expect the numbers not to be quoted. Do you know how to parse JSON using something like JSON.NET?
Rob Philpott
20-May-16 12:42pm
View
CHill60 seems to have the answer. Maybe - I don't fully understand. Using the example rows about (1-6) - what output do you want?
Rob Philpott
18-May-16 11:06am
View
You need to be more specific about how long it currently takes, and how long you want it to take. Readers are faster for sure but are also more difficult, but you could probably go parallel to speed things up with minimum effort.
Rob Philpott
11-May-16 12:01pm
View
How long does it take, if you execute an equivalent SQL query in SSMS or whatever?
Rob Philpott
6-Apr-16 8:55am
View
Off the top of my head, you probably don't want ToString()
try:
ConfigurationManager.ConnectionStrings["masterConnectionString"].ConnectionString
Rob Philpott
6-Apr-16 8:51am
View
Breaking the oldest rule in the book there - only the GUI thread can manipulate controls. Regardless of the practicality of ManualResetEvent, you definitely should not be attempting control updates from a worker thread.
Rob Philpott
31-Mar-16 9:07am
View
Are you on an intranet, or something which involves going through a proxy?
Rob Philpott
3-Mar-16 10:15am
View
Ok, filtering what you say, I presume the WPF is irrelevant, the whitespace is lost during the WCF call?
Which binding are you using?
Rob Philpott
8-Feb-16 5:06am
View
Firstly, as you have a client and a server and don't know which one is misbehaving, try running the server and connecting to it with telnet.
That said, I would think its the server. What's that zero about in the IPEndPoint? Try using IPAddress.Any and see if that makes any odds.
Rob Philpott
3-Feb-16 11:32am
View
Seems sound to me.
Rob Philpott
3-Feb-16 11:32am
View
The 'var' obscures the really rather useful type information.
Rob Philpott
3-Dec-15 6:30am
View
ok, is it disabled. Have a look in the services control manager. It will be disabled/manual/automatic or potentially 'automatic delayed'. It won't start if disabled. Check the event log, if there was a problem starting it may well appear in that.
Rob Philpott
6-Oct-15 5:47am
View
Can you be more precise about the exception thrown. Quite a few streams won't allow you to access to Length and Position (or to seek for instance) as it just doesn't make sense with those. A NetworkStream for instance, well you can't go back to the beginning. Should be ok with a MemoryStream.
Read/Write Timeout doesn't make much sense on a MemoryStream as they should never block.
I think there's something going on which isn't covered in your description!
Rob Philpott
5-Sep-15 2:43am
View
Looks good to me! Also interesting to see how other people do it. When I set up the parameters, I usually do something like this:
command.Parameters.Add("@name", SqlDbType.VarChar, 40).Value = "dddd";
.. and now I'm wondering whether the addition of the type information is worth doing.
Rob Philpott
17-Aug-15 11:36am
View
Unlikely to happen - the effort of spinning it off on a thread will take longer than hitting the next instruction. But either way, WaitAll will wait, if necessary, until all tasks are complete. If they are already complete, it will just step over it.
Rob Philpott
1-Jul-15 7:21am
View
Well, the filestream appears to being disposed of properly, so at that point I'd expect you to be free.
My guess is that the method is getting called twice at the same time, at which point the filestream becomes a contentious object. Easy to check with breakpoints or a bit of debug output.
Rob Philpott
26-Jun-15 8:22am
View
Do you have a release configuration?
Rob Philpott
24-Jun-15 12:20pm
View
Don't close the dialog which I would hope is not modal. Hide it when you don't want it to be seen, Show it again when you do.
Rob Philpott
12-Jun-15 4:44am
View
Patience of a saint, you.
Rob Philpott
9-Jun-15 7:24am
View
Do you need to query the data? Files are how you store data, even in a database.
Rob Philpott
21-Apr-15 4:33am
View
I hope that's not someone's real medical record...
Rob Philpott
16-Mar-15 11:37am
View
My 2 cents - design patterns often complicate simple design. Sure they can be helpful, but for me its better to think about what the objects are and their relationships. Patterns then just emerge.
Rob Philpott
11-Mar-15 12:22pm
View
Ah well, there we go. Didn't know that, the web isn't my thing. Presumably that's what MapPath shown below sorts out.
Rob Philpott
11-Mar-15 9:01am
View
The tilde is a Unix type convention, not sure it means anything to Windows. Looks like its treating it as a real directory name. That's why it can't resolve the directory.
Rob Philpott
24-Feb-15 4:53am
View
Just a guess, but don't you want to Open() the connection?
Rob Philpott
17-Feb-15 12:38pm
View
Well you should be able to get the date as a datetime with this:
DateTime startDate = dateTimePicker1.Value;
Rob Philpott
17-Feb-15 12:16pm
View
Not wishing to be argumentative here, but that's not the way I see it. Maybe this is correct in OOP parlance, but I'd argue not in .NET.
To my mind, things such as a car are types. Objects only arise out of instantiation, whereby I end up with an object of type Car. Then it gets all gets quite confusing because the base type is called - Object. But despite being called Object it is a type.
This leads to the unsatisfactory answer that objects and instances are essentially the same thing. Thinking back to my days of C++ though, I don't think the word 'type' existed formally but its such a long time ago I can't remember.
Anyway, what the hell. You're probably right. :)
Rob Philpott
17-Feb-15 8:04am
View
You are welcome!
Rob Philpott
16-Feb-15 15:19pm
View
What is the detail of the IOException? Is there any more info than that?
Rob Philpott
16-Feb-15 14:19pm
View
Thanks for posting it. First possibility - Console apps are safe for printing output to the screen from multiple threads. Gui apps aren't - updates have to be performed on the GUI thread itself. Have you ruled this out as a possible problem?
Rob Philpott
16-Feb-15 11:28am
View
Firstly, try setting your projects build to x86 and see if that fixes the problem.
Rob Philpott
16-Feb-15 11:26am
View
Could you add some code to your questions please? People are unlikely to use the dropbox link.
Rob Philpott
13-Feb-15 11:17am
View
There are no guarantees on packet delivery. Some do just go missing (usually ditched by a router along the way). TCP builds over the top of UDP to detect this and resend when required.
If you want to use UDP, you need to manage lost packets and stuff arriving out of order yourself.
Rob Philpott
13-Feb-15 6:08am
View
HashSet in .NET2.0? I thought it came in in 3.5.
Surely you can just check whether a collection .Contains() something before adding it, although this could be inefficient.
Rob Philpott
13-Feb-15 5:59am
View
If you find out what this is (perhaps one of the solutions below) please let us know. I am curious!
Rob Philpott
12-Feb-15 12:02pm
View
The error is quite explicit. Please provide some sample SQL, it's unclear what you are trying to describe.
Rob Philpott
12-Feb-15 6:01am
View
Oh yes. I am stupid.
Rob Philpott
12-Feb-15 5:26am
View
ASP.NET not my thing, but wouldn't you want a return statement after Response.Redirect?
Rob Philpott
9-Feb-15 8:08am
View
What type is takeoff? That's the problem with var, it leaves us with no idea.
I suspect you probably have an equality issue on the type, whereby you are expecting it to perform comparisons by the objects reference, but its using the Equals() method on the type. Check your identity logic.
Rob Philpott
2-Feb-15 8:35am
View
I presume the exception is thrown on the first line?
Rob Philpott
30-Jan-15 6:32am
View
We are now the string split masters. :)
Rob Philpott
30-Jan-15 6:06am
View
Ah, this is it...
string[] splits = text.Split(new[] {Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries);
Rob Philpott
30-Jan-15 6:03am
View
You're right! No implicit cast (but you can use .ToArray()), but then its splits on either /r or /n hence the blank lines.
I'm sure I've split string on more than just characters before. Need to have a think..
Rob Philpott
30-Jan-15 5:58am
View
Hmm. I need to dig out Visual Studio now...
Rob Philpott
30-Jan-15 5:54am
View
Ah!, great minds think alike, although I prefer your use of Environment.NewLine. I think Split accepts a char[], and I think string has an implicit cast so doubt you need to do the [0]/trim part.
Rob Philpott
28-Jan-15 4:20am
View
That goes against the grain of Windows rather. Applications run in windows and should not blur each other out. Are you talking about Aero effect in 7?
Rob Philpott
26-Jan-15 16:45pm
View
Yes, more information about the exception would be helpful! It *might* be that you are not specifying the type of your SqlParameters. May not be necessary, I always do this so don't know what happens if you don't.
Rob Philpott
22-Jan-15 9:26am
View
Just as an extension to this. The idea with asynchronous methods is you kick them off and get on with other stuff and they call back to you when they're ready. I'm not familiar with the library you are using but it has events (callbacks) for being connected, data transferred etc. Does it have an event for errors?
Rob Philpott
22-Jan-15 9:16am
View
I think the problem lies in the BeginConnect(). Methods that start 'Begin' imply use of the asynchronous programming model (APM), whereby the connection actually is handled by a background thread (sort of). Exceptions do 'bubble up', but only on the current thread. I think the exception is happening on a background thread. Do you have a Connect() without the Begin - if so try that and we can go from there....
Rob Philpott
21-Jan-15 6:48am
View
I think that's standard. When you bcc to a group the To: field is empty. It's actually transmitted as part of the message. I believe you'd need to send separate emails to each of the recipients.
Rob Philpott
15-Jan-15 17:03pm
View
Did you figure this out? The answer is going to be quite long and I'm heading to bed shortly but can answer tomorrow if you like.
Rob Philpott
14-Jan-15 15:35pm
View
Good point!
Rob Philpott
14-Jan-15 8:35am
View
Worth a try. Unfortunately the same story though GBR/USA/GBR. If that's the way the server has been configured then that's that really.
So if UTC offset < 8, then London else if Timezone contains the world 'Malay' Singapore else HK. Grubby, but seems to work.
Rob Philpott
14-Jan-15 5:54am
View
OK, this is undoubtedly the way to do it - in a normal place. RegionInfo.CurrentRegion.DisplayName would seem to be ideal, except that for London I get 'United Kingdom', Hong Kong 'United States', and Singapore 'United Kingdom'
I can well believe the servers aren't set up correctly. For this reason I think Timezone is probably more reliable, if that's wrong the time is likely to be wrong and picked up on, but being configured towards the UK/US is probably accidental or just normal.
Thanks for the answer.
Rob Philpott
14-Jan-15 5:43am
View
Sweet. Will investigate this and get back to you. I think I can actually do it using timezones as it turns out. Hong Kong is 'China Standard Time' whereas Singapore is 'Malay Peninsula Standard Time', but this might be better...
Rob Philpott
14-Jan-15 5:38am
View
Good idea. Server is likely to be in some underground bunker without clear site of satellites/won't satisfy management though, I suspect.
Rob Philpott
19-Dec-14 5:18am
View
Almost certainly you'll have DateTime.MinValue (Jan 1st 0001). SQL server can't store this because as stated it can only store dates from 1753 onwards.
Rob Philpott
19-Dec-14 4:44am
View
First look at the inner exception. When the exception is raised in VS, click 'View Detail' and that should tell you what the problem is.
Rob Philpott
8-Dec-14 9:10am
View
Interesting. I can see why it may not work now, (data is in the BinaryWriter buffer and may not be written to stream until the flush), but not why explicitly calling Close() on the filestream would fix it.
I'd be interested to find out!
Rob Philpott
5-Dec-14 5:42am
View
Just because its in user control should make no difference. Also, see here for one possible reason:
http://stackoverflow.com/questions/10617551/combobox-items-addrange-performance
Rob Philpott
8-Oct-14 6:21am
View
Sage advice.
Rob Philpott
1-Oct-14 6:17am
View
You don't want to do that in SQL server. That's for storing data, not formatting it for GUIs. In C# you can just use DateTime.ToString(). Consult MSDN.
Rob Philpott
22-Sep-14 11:46am
View
If I understand correctly, and you need 1000 numbers (random) between 0.1 and 3.0 which, when summed add up to another number, then, well the numbers can't be random.
For instance, if your target was 3000, the only way you could do it is to have each number set to 0.3 - that's not random.
Rob Philpott
22-Sep-14 4:50am
View
Why would they be 0.0 each time??
You *could* find yourself in the situation where the sum of all the parts isn't exactly 1 due to imperfect precision, but the thing to do there is probably just adjust the last one by some stupidly small amount to deliver an exact 1.
Rob Philpott
10-Sep-14 12:58pm
View
define STATUS_STACK_BUFFER_OVERRUN ((NTSTATUS)0xC0000409L)
.. which (googling) suggests it might be strings aren't being handled correctly. BSTR type stuff.
Rob Philpott
10-Sep-14 12:56pm
View
Anything in the event log?
Rob Philpott
1-Sep-14 13:06pm
View
Splendid.
Rob Philpott
28-Aug-14 4:41am
View
Have to ask - why? [Edit] I believe not, but being so weird I've never tried.
Rob Philpott
26-Aug-14 10:25am
View
If its in your solution, it should just turn up after doing a build.
Rob Philpott
26-Aug-14 10:23am
View
Are you using COM components? ActiveX?
You could try this (I doubt it will work but its worth a go, the apartment state will be set already)
Thread.CurrentThread.SetApartmentState(ApartmentState.STA);
[Edit] At the least, see what the value of the apartment state is on the GUI thread.
Rob Philpott
20-Aug-14 5:10am
View
Are you saying that the reference disappears each time (look in Solution explorer), or that it's there but your code doesn't recognize it?
Rob Philpott
19-Aug-14 1:59am
View
parameter is incorrect Issue certainly isn't an error raised by .NET/Windows, so it looks like the exe itself is raising it.
Therefore, we can have no idea what the problem is without more info.
Rob Philpott
14-Aug-14 5:32am
View
Yes, that's pretty much what I have, although I'm using sockets rather than the Tcp encapsulations - that's because I find they are too eager to raise exceptions.
Rob Philpott
14-Aug-14 5:03am
View
I am - once accepted each thread is dispatched off to its own thread. This is just in the acceptance stage which is done asynchronously.
Rob Philpott
14-Aug-14 5:02am
View
Thanks again. I doubt its a firewall - If I keep the London connections on one port, and the Asia connection on a neighbouring port, this doesn't happen.
Rob Philpott
13-Aug-14 9:48am
View
Thanks for the response. I'm using socket directly, not TcpClient, so it is just Socket.EndAccept.
I've stuck a stopwatch round the EndAccept, always 0 milliseconds. The delay seems to be not on any particular instruction, but a latency deeper down where accepting takes longer on this connection.
Rob Philpott
12-Aug-14 11:07am
View
Ah, yes, I should look at the documentation more closely. That is it, perfectly! Thanks.
I think setting maximum threads on the threadpool might cause the sky to fall in, because that's for your whole process.
Rob Philpott
12-Aug-14 11:05am
View
hmmm. Could do. Not very simple/neat though.
Rob Philpott
12-Aug-14 6:49am
View
Well, Calculator is spelt wrong - is that it?
Rob Philpott
7-Aug-14 7:13am
View
Start here: http://tools.ietf.org/html/rfc854
Rob Philpott
7-Aug-14 7:13am
View
Deleted
Start here: http://tools.ietf.org/html/rfc854
Rob Philpott
31-Jul-14 11:58am
View
Yes, you can. Connection string option thingy.
Rob Philpott
29-Jul-14 12:22pm
View
Don't get it. You want synchronous behavior, yet want to use asynchronous processing?
Rob Philpott
28-Jul-14 4:57am
View
Why do you want to use these patterns? It's a dangerous process deciding what pattern you want to use then trying to get your system to fit into it.
My recommendation is to sit down and think how it will work - the patterns form naturally.
Rob Philpott
25-Jul-14 9:57am
View
Can you expand a bit - the stored procedure creates some temporary tables, executes a query, and then does it drop the temporary table. Is the transaction in the scope of the stored proc or are you creating it ADO.NET?
Rob Philpott
25-Jul-14 4:06am
View
Perhaps if you start with a clear question.
Rob Philpott
24-Jul-14 8:01am
View
I don't think you can. You would need the process that holds the lock to release it, or to be terminated. That could be on another computer somewhere.
Good question though, I'd be interested to know if anyone does know how you can do this.
Rob Philpott
24-Jul-14 8:00am
View
It'd be news to me if you could solve that problem. AFAIK, there is no way other than determining what's got the lock and getting it to release it.
Rob Philpott
21-Jul-14 11:25am
View
Nice, couldn't be simpler really.
Rob Philpott
21-Jul-14 7:41am
View
ToShortDateString().ToString(). Convert a string to a string - why on earth?
Rob Philpott
21-Jul-14 7:36am
View
You don't want to go down that path. Are you attempting to execute multiple commands against the same SqlConnection?
Rob Philpott
21-Jul-14 7:32am
View
It's an exe which takes command line parameters - you can run it. You need to try in order to find out what is going wrong.
Rob Philpott
21-Jul-14 7:26am
View
There is nothing obviously wrong with the code if all reference to the DataTable are removed. Are you attempting to share the connection with two readers? That will cause problems if you are.
In general you should create a new connection for each call (the story goes that something called connection pooling is used which means overhead is minimal - not quite true in my experience).
Rob Philpott
21-Jul-14 7:20am
View
Most likely thing is that the second exe is somewhere which is not accessible to the account that the is executing the first. Try running the second exe as the first account and see what happens.
Rob Philpott
17-Jul-14 8:15am
View
I do this sort of thing a lot. What you want to avoid is making 10,000 calls. Just do one. Are you using SQL Server and is it 2008 or above? Are you using stored procs?
Rob Philpott
12-Jul-14 9:23am
View
Ok, this sounds like a typical issue where you need to 'flush' the data to get it to send. SerialPort doesn't expose this method, but looking around others have suggested that it could be down to handshaking. As a thing to try, set DtrEnable and RtsEnable to true on the serial port at the same time as setting baud/parity etc. Worth a try..
Rob Philpott
12-Jul-14 4:45am
View
Hmm. I'd argue that you can buy a car. That example is like saying you can have an abstract book class from which every book derives - that would be a lot of subclasses! Instance data, not derived classes.
Rob Philpott
4-Jul-14 11:37am
View
I hope you don't want an accurate 20ms, because the timer is unlikely to give you that.
Rob Philpott
3-Jul-14 3:16am
View
Good point!
Rob Philpott
9-Jun-14 4:56am
View
Please give an example of the format of url you are using. Why are you using FileWebRequest rather than HttpWebRequest?
Rob Philpott
2-Jun-14 11:59am
View
As Keith asks, why do you want to abandon the code that does exactly what you need? Also, you need to tell us what driver type you are using.
Rob Philpott
30-May-14 15:08pm
View
cool. :)
Rob Philpott
30-May-14 14:49pm
View
I'll write you a bit of code tomorrow if you can wait that long?
Rob Philpott
30-May-14 12:25pm
View
Why is every element called property??
Rob Philpott
30-May-14 8:15am
View
Screen scraping? Yuk.
Rob Philpott
30-May-14 4:48am
View
Why not in code just do DataContext = new CompanyViewModel() ?
Rob Philpott
23-May-14 10:27am
View
Have you thought of pasting the code? If this is just a code and not a data change, then it'll probably do it. Removing encryption from the data though, well that's a different story.
Rob Philpott
21-May-14 5:04am
View
Please state your requirement more clearly. I don't understand that you want to do.
Rob Philpott
19-May-14 6:31am
View
What would be the point of turning into a stored procedure?
Rob Philpott
19-May-14 5:07am
View
Yes it can be done. You can encrypt 24 bytes of data into 24 bytes of encrypted data so with 64 bytes you've got plenty of room to play with. To do this, you need a key though. The pertinent question is how secure does it need to be?
Rob Philpott
14-May-14 11:33am
View
What do you mean by deployment? It needs to be on the users machine in some form or another in order to execute. Are you just trying to avoid a traditional Windows installer? Who is the audience, is it the world or corporate? What is your application (forms/wpf/web/etc.)...
Rob Philpott
9-May-14 10:27am
View
You can use this approach for that, I did it once a long time ago, can't remember how but I'll look if I can find the source. TcpClient exposes a networkstream, which you can feed into a CryptoStream - have a look at that...
Rob Philpott
9-May-14 7:44am
View
virtual is a polymorphism construct. It says that you can create a class that derives from Random and override (replace) the next function with your own implementation.
Rob Philpott
9-May-14 7:31am
View
Interesting that its marked virtual actually.
Rob Philpott
7-May-14 7:52am
View
Indeed, but that's not what I want to do. I want the setting in the source code itself.
Rob Philpott
2-May-14 4:22am
View
"Didn't Work" is not an adequate description for anybody to help you further.
Rob Philpott
1-May-14 7:49am
View
I can't see a reason not to mention the name. Where is the harm? Notwithstanding, it is a dumb question.
Rob Philpott
30-Apr-14 8:14am
View
Do you mean exactly the same instances on each tab page, or just that each tab page has the same layout and controls on it?
Rob Philpott
23-Apr-14 7:50am
View
What do you mean by installed? One of the beauties of .NET is that you can do XCOPY deployment. It won't show up in your start menu, but its still 'there'.
Rob Philpott
17-Apr-14 10:00am
View
Ok, that's an easy fix, although I would say there are much better ways to do it.
Just move the List<string> list = new List<string> line after the foreach. At the moment that list is accumulating all files, but it sounds like you want to do it on a per-file basis.
Rob Philpott
17-Apr-14 4:41am
View
How big is the string?? Have you considered using a forward reader?
Rob Philpott
17-Apr-14 4:37am
View
What is it that you are trying to do? At the moment you are effectively adding all the files together into a big list of string then for each file displaying the 5th item of that list.
Do you want to show the 5th item of each file, or is it something else?
Rob Philpott
16-Apr-14 11:41am
View
Here we go again.
Not ALL forms, just the ones with appropriate custom attributes. And you absolutely want the type not an instance, or you are going to have to create 133 of them all in advance.
Please stop adding these useless comments and stick to your own solutions.
Rob Philpott
16-Apr-14 10:55am
View
Splendid, splendid.
Rob Philpott
16-Apr-14 10:55am
View
Hmm. What question are you answering exactly?
Rob Philpott
4-Apr-14 11:55am
View
Your arrogance is taking over again. Look at the code, he is performing a one minute update. The WinForms timer is entirely the correct choice in this case, NOT to use a threading based timer and post to the GUI thread.
Rob Philpott
4-Apr-14 10:42am
View
I'm missing something here. How do you know he wants to check the integrity (compare hashes) rather than actually encrypt the data?
Rob Philpott
24-Mar-14 5:56am
View
Its unlikely to be line. So is it config, config.AppSettings, config.AppSettings.Settings or config.AppSettings.Settings["Length")?
Rob Philpott
24-Mar-14 5:52am
View
Right, I'm being a bit thick. Let's start again.
In the debugger, is it line which is null or is it config.AppSettings.Settings["Length"]?
Rob Philpott
24-Mar-14 5:50am
View
Deleted
Although, I'm not so sure now...
Rob Philpott
24-Mar-14 5:48am
View
Deleted
Which line?! That would make it easier.
string appPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
I think should be:
string appPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
Rob Philpott
21-Mar-14 8:40am
View
Could it be that it is running under a separate account, and the user does not possess admin rights?
Rob Philpott
17-Mar-14 13:48pm
View
Sounds likely. I have no intention of reading all that, but this is a common error with a DateTime whose value has not been set, it defaults to DateTime.MinValue which is far too long ago for SQL Server!
Rob Philpott
17-Mar-14 12:13pm
View
Or, more likely, they are an idiot!
Rob Philpott
17-Mar-14 6:13am
View
What do you mean you have checked the services and its all running? Is this a Windows Service?
Rob Philpott
14-Mar-14 9:29am
View
It's not clear what you mean. Do you want a four character with each character set to 10 (0x0a) or do you want and 8 character string literal "0A0A0A0A"?
Rob Philpott
6-Feb-14 13:41pm
View
OK - what's the date column in the table? Is there one or two of them? What is it called?
Rob Philpott
6-Feb-14 13:21pm
View
I feel your pain.
Rob Philpott
6-Feb-14 13:16pm
View
Use .NET?
Rob Philpott
17-Jan-14 4:58am
View
Nice. I think you'd be surprised how few people know that an 'A' is 65. I suspect you could replace 65 in your code with 'A' actually (implicit cast?) but would have to try it to confirm..
Rob Philpott
14-Jan-14 8:19am
View
Extremely valid. There's a whole moral debate here - does this mean you should never contact someone without their prior consent? I wish someone would tell that to the charity muggers outside...
Rob Philpott
14-Jan-14 7:53am
View
Fair point - but how many 'spam' emails do Amazon send out each day? I guess there is a distinction between sending email about generic Viagra to everyone you can and something which is pertinent to the recepients..
Rob Philpott
14-Jan-14 7:48am
View
A few questions. Does your start-up have an SMTP mail server? Is the address this email is going out from recognized as a valid email by the SMTP server? Where are the 9000 addresses stored? Is the email the same to everyone or is it personalized?
Rob Philpott
9-Jan-14 12:32pm
View
Good stuff, very welcome - good luck!
Rob Philpott
8-Jan-14 4:55am
View
Why don't you use google. There's a whole website devoted to it oddly enough.
Rob Philpott
6-Jan-14 7:39am
View
Well it doesn't make sense to me to take three types and combine the first and second into the third. Because you don't know what the operation is and how can I convert a string into UserControl? Sure you can create something which adds an int and double and returns a string, but that's a specific case not a generic case.
Rob Philpott
13-Dec-13 4:12am
View
Well done, I think that's the dumbest question I've ever read on here, and that takes some doing.
Rob Philpott
6-Dec-13 7:43am
View
Also, you might consider using TcpClient and TcpListener as these make this sort of stuff dead easy.
Rob Philpott
6-Dec-13 7:41am
View
Usually occurs when one end crashes without terminating the connection properly. Are you saying both client/server are still running fine?
Rob Philpott
28-Nov-13 10:43am
View
Yes, equality in .NET is far more complicated than it seems. My suspicion is that if you have two ways to determine equality, the warning is there just to ensure that they are functionally equivalent.
Rob Philpott
13-Nov-13 4:37am
View
Don't get me started. Tell Resharper to shut up.
Rob Philpott
12-Nov-13 9:13am
View
My God. "chapterOneAssignmentFourteen" and you can't even be bothered to ask a question. Make some effort huh?
Rob Philpott
6-Nov-13 5:32am
View
CPallini is quite correct - you are reading the whole thing in each iteration of the loop. That *will* affect performance.
Rob Philpott
1-Nov-13 5:22am
View
ah well, good luck!
Rob Philpott
31-Oct-13 10:05am
View
That's fun, and you're right - recursion is an excellent way to solve it. You haven't provided any information on what the characters in the grid mean. But either way you're unlikely to find help here, stuff like this is there to teach you about computer theory and so you should do it yourself.
Show More