Click here to Skip to main content
14,936,036 members

Comments by Timberbird (Top 200 by date)

Timberbird 14-Jul-15 5:56am View
You are passing ddlC.GetDistricts(), which is of type IEnumerable (and actually is a List according to public GetDistricts() method implementation), while the model accepts @model FarmerRegisterFormAndPrint.Models.DDLCombined. I guess the error is expected in this case
Timberbird 10-Jul-15 7:34am View
This line
seems rather suspicious. What is NonJSTargetURL? Could it be that you keep redirecting user to the same login page again and again? Even if JS is enabled on client side, it could be that by some weird logic browser still executes Refresh action included in noscript element.

So, I suggest that you check if you are redirecting visitor's browser on each request - by monitoring browser's network activity (using built-in tools or eg Fiddler proxy) or checking IIS logs, for example.

Also, why do you introduce testJS variable if you don't actually use it?
Timberbird 16-Jun-15 6:46am View
Excuse me, but how do you want to see the results like "Date = 01/06/2015, Date = 02/06/2015, Date = 03/06/2015" and so on if you group loans by year and month, not year, month and day? .GroupBy(c => new DateTime(c.CreatedDate.Year, c.CreatedDate.Month, 1)) effectively groups your loans using "First day of loan's month" as a key, so loans made on 01/06/2015, 02/06/2015 and 03/06/2015 will fall under the same group with "01/06/2015" key
Timberbird 2-Apr-15 4:38am View
If I understand you correctly, you want to call wrapper class method when button is pressed - and WITHOUT generating Page_Load event? Then I'd change your question as following: "How to call server method from client without running common page lifecycle" (yes, Page_Load is not the only method being executed, see here). In this case you have a number of possibilities - you can implement web method and call it from client with AJAX, or move the call to a service, or event create a specific handler for this purpose.
Timberbird 24-Mar-15 11:08am View
My bad - didn't pay atention to the tags, as I've met this problem previously in plain JavaScript. I'll update the solution.
Timberbird 24-Mar-15 10:59am View
And you're creating a new instance of this class (i.e. new form) each time text is changes in one of the controls, then attach control to its handler... no wonder text is not changed. You should access current form instead - the one your controls are placed on - for example, by traversing control parents. Also, don't attach event in textBox1_TextChanged() (otherwise it'll be called billion times) - do that in initializer.
Timberbird 24-Mar-15 10:48am View
_mainform = new MainForm();
Do you really create new MainForm object on client event? It looks somewhat messy. I hope this is not your main form where both user controls are placed?
Timberbird 20-Mar-15 5:28am View
Oh, I see I was a bit late :). Yes, this solution with buffer variable should work. I can only advice that you also release memory allocated for buf variable by calling delete. Also, you don't need
strN = "";
assignments when reading. And, finally, instead of string.append() (which appends a string to already contained value) you can use string.assign().
Timberbird 20-Mar-15 5:23am View
Your code seems a bit strange - do you really intend to read std::string object in file, not the string (char*) itself? When you read like<char *="">(&str3), size3);
, it's not like "take size3 bytes from file and place them into string str3", it's "read size3 bytes from file and place them into memory, starting with address &str3". You may occasionally corrupt memory state this way. I suggest you try to read into buffer variable (char*) and them assign its value to std::string objects.
Timberbird 16-Mar-15 7:23am View
I suspect that could be because you block the thread and thus prevent your application from handling Windows messages completely. To check if that's the reason try to increase interval to eg 15 seconds and see if you get "No response" message more often :).

If that's the case, you obviously would need to lock for any finite amount of time (say 1 second), then check result and either proceed with your cycle (if lock obtained successfully) or let your application process events (when lock couldn't be obtained - for example, check this question).

Also, if you're planning to run many instances of your application, consider adding Global namespace prefix to your mutex name - to make sure it'll be visible from all user sessions
Timberbird 16-Mar-15 4:09am View
Though this is most probably not your case (considering that your problem only appears on IE), I recently ran into similar issue and eventually found out the reason was a migration to .NET 4.5, where authentication token is calculated differently. So if you have one domain auth cookie and several web applications under the same domain, and you've switched to using .NET 4.5 from earlier version recently, consider enabling compatibility mode.
Otherwise it's always a good idea to clean all cookies :)
Timberbird 4-Mar-15 3:19am View
Does your argument string really look like this: "F:\Boooksmaster/198011_OU_Harida_Saragu.pdf"? Actually '\B' may be interpreted as escape sequence. Try to rewrite this string as either
Timberbird 4-Feb-15 3:56am View
And what do you expect it to return? You assign male variable only once - when it's created. Any user input is stored in gender variable which doesn't affect print output. And since male=true, check if (male!=true) returns false, so Console.WriteLine("Your gender is male"); is executed
Timberbird 22-Jan-15 4:46am View
Did you check Event Log to see if there are any error records?
Timberbird 26-Dec-14 2:46am View
I can only assume that TS checked Task Manager and discovered his application process uses just one core, 50/25/12.5% of total CPU time. Isn't that ineffective for highly loaded applications?! :)
I agree with you: before you start working with thread priority and processor affinity, you need a good understanding of what you want to achieve and what are the consequences.
Timberbird 25-Dec-14 3:01am View
Actually I'd try to completely avoid calling two functions from each other (for example, by moving retry connection call to processStart() method), but that doesn't seem the source of the problem by now.<br/>
I'd recommend to inspect requests your application makes. One of the simplest ways to do that is using Fiddler tool. It's a great web debugger tool - simply install and run it and it'll work as a proxy, capturing any HTTP traffic between your PC and the outer world. So you can do the following:
1) Run Fiddler (or any other traffic inspection tool).
2) Start your application having only one troublesome URL in your input file.
3) Switch to Fiddler and see how many requests does your application send and which HTTP headers do these requests contain. "Host" and "User-Agent" headers are of particular interest, since HTTP server work often depends on them. Also you should check server response.
Timberbird 25-Dec-14 1:07am View
Have you tried to put only one URL in your input file - the first which gives you error? I don't think 30-40 is a huge amount of URLs, especially considering that you get an error after 3 or four requests :). BTW, it looks like you code will create an infinite loop if server returns response with code 500+ - in this case you catch WebException, call RetryforSuccess() without any checks for IsCalledforRetry, which, in turn, calls GetStatusofURLs() again, which gets WebException... you get the point. And the fact that your link is opened in browser doesn't mean that you get the same result with HttpWebRequest - browser also sends a couple of headers HttpWebRequest doesn't possibly provide (haven't tried it myself, but are you sure that at least Host an User-Agent are included?)
Timberbird 27-Jun-14 8:34am View
It appears that in this line:
önclick='return hs.htmlExpand(this, { objectType: 'iframe', align: 'left', width: 810, height: 520 });'
you have single quotes inside single quotes. Try to resolve it, for example, by replacing first single quotes with double quotes:

önclick=""return hs.htmlExpand(this, { objectType: 'iframe', align: 'left', width: 810, height: 520 });""

("" generates double quotes in verbatim - i.e. @"..." - strings).
Timberbird 17-Jun-14 7:38am View
You're welcome! (and pardon my English) I've updated the solution proposing slightly modified implementation based on CloneMenu() method
Timberbird 10-Jan-14 7:45am View
Have you tried to use any traffic analyzer to see if actual data sent/received is equal in both cases?
Timberbird 27-Dec-13 2:00am View
Are you trying to find out the selected radio button value with code

document.getElementById("<%=rbtnwhomtovisit.ClientID %>").selectedValue
? (it's hard to say for sure because you didn't provide the markup)

If you do, probably that's the reason. Check that value (for example, by alerting it or writing a debug message) - chances are you'll get "undefined". Try enumerating through radio buttons in the group to find the checked one. See this question, for example
Timberbird 26-Dec-13 23:54pm View
I'm not sure the original question was about web application. Since there weren't additional tags (namely ASP.NET), I decided it to be WinForms application - have I missed something?
Timberbird 26-Dec-13 6:43am View
Sorry, I must have not written it clearly. Everything's ok with code delete [some variable], it's totally legit way to remove an object/whatever when it's no longer needed. But you must never try to delete this, since it leads to the consequences explaied above.
If you want to remove the dynamically created object when it goes out of scope, do it explicitly by calling delete [variable]. If you wand to create an object dynamically and be sure it is removed automatically when going out of scope, not bothering yourself with delete statement, use auto_ptr, for example (I prefer to keep track of my variables myself, so I don't use it much, but it's certainly a valid option).

As to the destructor: when you write delete [object], object's destructor is called automatically. You don't have to call it from your code explicitly, like object->~class(), delete this or whatever
Timberbird 24-Dec-13 7:09am View
Yes, you shouldn't call destructor explicitly. And one more thing about your code

delete this;

Don't do that. Never. That was causing infinite print of your "Deleting memory" message, since deleting an object calls the destructor implicitly. And remember - you should never delete an object from one of its own methods (unless it's a class method, but that's not the case), not only destructor. Every time you write a line

delete this;

, you are dooming your program to experience a hard to discover, unexpected critical errors.

When delete call is finished, control is returned to the method which called it... or at least where this method should be. But now it's not there, since the object is already removed! Well, in most cases that's not the problem, in fact method implementation is still there. But if this block of memory has already been overwritten, your program executes a random block of code it finds in place of a former method. Results? Crash in most cases
Timberbird 24-Dec-13 5:28am View
If you know what proper values are, could you give us an example (if possible, together with corresponding .dat file)?

Another notice: long size is not standardized, it depends on the architecture. You read a file in chunks of 8 bytes, I see ( ReadInt64() ). Try reading 4 bytes a time ( ReadInt32() ) and see if it gives you correct structure members.
What I'm trying to say: if you attempt to read single long value with each call of ReadInt64(), changing to ReadInt32() should help. If, however, you expect to get the whole structure in one call, i.e. read a structure with two members into a single Int64 value... well, you can't do that, you need to implement corresponding structure in your C# code as well :)
Timberbird 16-Dec-13 5:50am View
Good explanation. I'll also add a result of quick Googling by CLSID: they mention Fingerprint SDK and a license in this topic, OP could check it out
Timberbird 13-Dec-13 7:25am View
So it doesn't receive your string at all? Here it is said that blocking until socket is closed is normal for BufferedReader, but you should at least receive the first string you send
Timberbird 11-Nov-13 3:50am View
What is "Service1"? Could you show its start method?
Timberbird 8-Nov-13 5:35am View
I'd check regional settings - this is often the cause of weird behaviour, though I don't know what could cause such effect (right to left text direction? :) ). Also, could it be that these computers use standard windows magnification of 100/125/150%?
Timberbird 1-Nov-13 8:21am View
I'm not sure if there's "appropriate" method for a popup window: just use method, but it requires you to make sure new window doesn't appear above your link itself (the one with "onmouseover" handler). It also may cause browsers to open a new tab instead of popup window.
Anyway, an example of is
pWindow ="", "_blank", 'height=500,width=650, left=200');

Personally, I'd use divs with dynamically loaded content instead of new browser window. There are many tools that allow you to create popups with dynamically or statically loaded content, especially jQuery plugins (for example, colorbox.js)
Timberbird 1-Nov-13 5:53am View
You're welcome :)
Timberbird 31-Oct-13 4:32am View
Which line produces the exception?
Also, some general notices:

1) What's the purpose of the cycle?
for (int i = 0; i < WebDataGrid1.Rows.Count; i++)
you just add the same arguments many times, which is pointless
2)In your example of method call you send the same arguments:

I believe in actual code these are different?

3) You said you call this method in rowadding event. Could it be that new added row is not initialized at the moment?
Timberbird 30-Oct-13 3:05am View
I offer you to try the following:

IF Enddateparameter < cast(getdate() as date) SET @presentstatus = 'Inactive'

By the way, is it just Enddateparameter, not @Enddateparameter?
Timberbird 30-Oct-13 2:36am View
So in the line
IF Enddateparameter < cast(getdate() as date) then @presentstatus = 'Inactive'

then is not used?
Timberbird 30-Oct-13 2:32am View
You don't need then here
Timberbird 30-Oct-13 2:16am View
Have you considered BULK INSERT?
Timberbird 29-Oct-13 16:51pm View
It's described pretty clearly in the article I referenced. Try the following:

function ShowPage(name, url) {
popupWindow = window.showModalDialog(url + '?name=' + name, window,

function ClosePage() {

As you can see, first we open a modal dialog and assign a reference to it to the "popupWindow" variable. Then, in ClosePage() method we close the window currently referenced by "popupWindow" - i.e. the one we created in ShowPage().

Some things to note:
1) You use window.showModalDialog() method. As far as I know, it opens a modal window - which means you can't switch back to the parent window until modal one is opened. Therefore visitors will have to close the modal browser window themselves, as onmouseout event can't be generated (you need to see the link to move the mouse out of it, but the link is hidden behind the opened modal window - and that modal window won't let you select the page with link). I haven't tested it but chances are you'll experience that problem. If you do, you could try calling method instead.
2) Though normally that shoudn't happen, this code potentially allows to open multiple popup windows if onmouseout event is not generated by some reason. I recommend you to check if "popupWindow" variable is assigned in ShowPage(), and if it is - close that window first. Also, clear the variable in ClosePage().
Timberbird 29-Oct-13 9:18am View
What are you trying to achieve? According to your code on onmouseover() you open a new window and on onmouseout() you close the current window - i.e. not the one opened as popup but the one which contains the link.
If that's what you are trying to achieve, then your code should work in all browsers except Firefox (which doesn't allow to close pages not opened by the current one). But if your purpose is to close popup window on mouse out event, please see example from this link
Timberbird 28-Oct-13 7:27am View
I guess you need to select this option and submit the form to the server? If I'm right here are two ways to achieve this purpose: invoke "click" event or set "checked" attribute (I believe you must set it to either "true" or "checked")
Timberbird 25-Oct-13 10:08am View
Oh I see. You messed it up a bit. Instead of lines:

List<HtmlElement> pList = new List<HtmlElement>();
foreach (HtmlElement pItem in theElementCollection) { pList.Add(pItem); }
HtmlElement pElement = (HtmlElement)filters.GetElementById("filterSortBy").GetElementsByTagName("option");
pList.Where(pOption => pOption.GetAttribute("value").Equals("price_low_high", StringComparison.InvariantCultureIgnoreCase)).SingleOrDefault();

there must be the following:

HtmlElementCollection pCollection = filters.GetElementById("filterSortBy").GetElementsByTagName("option");
List<HtmlElement> pList = new List<HtmlElement>();
foreach (HtmlElement pItem in pCollection) { pList.Add(pItem); }
HtmlElement pElement =
(HtmlElement) pList.Where(pOption => pOption.GetAttribute("value").Equals("price_low_high", StringComparison.InvariantCultureIgnoreCase)).SingleOrDefault();
Timberbird 25-Oct-13 9:32am View
Aren't you missing .SingleOrDefault(); part? Could you post the code you have now?
Timberbird 25-Oct-13 8:36am View
Oh yes, one more line I didn't copy:
HtmlElementCollection pCollection = filters.GetElementById("filterSortBy").GetElementsByTagName("option");
Timberbird 25-Oct-13 4:13am View
Actually I'm not familiar with PHP and MVC pattern implementation there. I would suggest looking here - it proposes to include JavaScript (which will work in all cases) and also mentions something about controllers and output
Timberbird 25-Oct-13 3:48am View
I believe that's because you wrote something like StringComparison.InvariantCultureIgnoreCase(). As to the code - my bad, I thought HtmlElementCollection implements IEnumerable<t> interface. You can either use foreach/while cycles then, or convert HtmlElementCollection to any collection that supports LINQ queries, e.g.:

List<HtmlElement> pList = new List<HtmlElement>();
foreach (HtmlElement pItem in pCollection)

HtmlElement pElement = (HtmlElement)
pList.Where(pOption => pOption.GetAttribute("value").Equals("price_low_high", StringComparison.InvariantCultureIgnoreCase)).SingleOrDefault();

What do you mean by "pElement isn't directly used"? pElement is the one you're trying to find - "<option>" with ID "price_low_high"
Timberbird 24-Oct-13 10:27am View
Unchanged URL is usually a result of server redirects, but since it's unclear... Have you checked server response and next browser request - for example, with Fiddler2 tool? What does it show? Does this issue exist in all browsers? The problem can be reproduced locally on the server itself?
Timberbird 24-Oct-13 10:08am View
You could try the following:

HtmlElement pElement = (HtmlElement) filters.GetElementById("filterSortBy").GetElementsByTagName("option").Where(pOption => pOption.GetAttribute("value").Equals("price_low_high", StringComparison.InvariantCultureIgnoreCase) ).FirstOrDefault();
Timberbird 24-Oct-13 9:36am View
Hey, if you need a simple button that doesn't cause a postback, why using ASP.NET Button? Use HtmlInputButton control or insert plain html markup like <input type="button" value="Login" /> .
I believe, though, that if you are implementing login functionality, then postback is required (since usually login logic is run on server). And in this case JavaScript is inserted correctly, since your button is a server control which additionally has CommandName and CausesValidation attributes
Timberbird 24-Oct-13 9:27am View
So let me guess: you have a structure like the following:
<select id="filterSortBy">
<option value="val1"> Filter type 1 </option>
<option value="val2"> Filter type 2 </option>
<option value="price_low_high"> Sort by price ascending </option>

and you want to select an "option" element that has value "price_low_high" (i.e. the third one), right? Correct me if I'm wrong. It would be good to add sample HTML fragment you're trying to parse to the original question.
Timberbird 24-Oct-13 8:21am View
Looks like the problem is in this part: .Select("price_low_high"). GetAttribute("option") returns a string containg the value of the "option" attribute, and then you try to select something from that string. I must admit I don't understand what you are trying to achieve with this method call, but anyway String.Select() has different syntax.
Timberbird 24-Oct-13 4:17am View
You have to use Load event? No option to use others, like LoadComplete on page or PreLoad on control?
Timberbird 23-Oct-13 3:23am View
And the same goes for empty strings, since it rarely matters if string value is empty or null, though conceptually these are different values with different meaning and must be differentiated at all times. The main problem with DateTime.MinValue I see is the common problem with all magic numbers - these can't be told from actual business data (if user indeed tries to enter minimal DateTime value possible, why should we restrict him?). In that sense I totally agree with you - nullable types are better
Timberbird 23-Oct-13 2:58am View
Absolutely agree about avoiding the magic numbers, but some are quite popular - how often do you see usage of String.Empty (or plain "") when it's not truly necessary? :) Using DateTime.MinValue adds the same - maybe questionable - advantages: for example, you can call methods like .Equals() or .ToString() of the object without extra checks and a danger of getting NullReferenceException
Timberbird 23-Oct-13 2:45am View
Oh, I posted the second comment about nullable DateTime before I saw your comment and solution. I didn't mean there's a special "non-defined" value in .NET Framework, it just can be considered so by program logic - some kind of magic number
Timberbird 23-Oct-13 2:40am View
Glad I could help. It's just the first thing that came to my mind - possibly there's a better solution (like using nullable DateTime, i.e. "DateTime?" - it's possile, but I'm not sure which is more suitable for you)
Timberbird 23-Oct-13 2:25am View
DateTime is a structure, so yes, it can't be nulled. You could try using DateTime.MinValue as a special "non-defined date and time" value
Timberbird 22-Oct-13 3:59am View
Do you mean service description in WSDL?
Timberbird 21-Oct-13 4:16am View
Have you tried using .SelectedValue property instead of .SelectedItem?
Timberbird 21-Oct-13 4:12am View
And what is the problem? Apparently Visual Studio (or one of its extensions) generated a code for you, including a stub for BindRepeaterData() method. This metods explicitly generates an exception of specific type, which just shouts: "You haven't implemented this method, you must put some code in it and remove 'throw exception' lines!" So what you need to do now is to write the actual code in BindRepeaterData(). You know what this method must do, right?
Timberbird 21-Oct-13 3:45am View
Ah, these common Excel problems. I'm not sure which one you are experiencing, but you could try the following:
1) Check the type of the cell in the Excel file. You may want to explicitly set it to Text.
2) Try reading different cell properties: as far as I rememeber, there are at least Text, Value and Value2.
Timberbird 21-Oct-13 3:38am View
Looks like you are not creating items object in the cycle, instead you add THE SAME object three times. Instead try creating new object (items = new [whatever object it is]) into for loop
Timberbird 19-Oct-13 6:03am View
I meant see the Java Script code. Do IDs match (i.e. script contains the line $('#ContentPlaceHolder1_TextBox1').width(150); line)?
Timberbird 18-Oct-13 9:56am View
Have you checked this article? Please note the following line: "Also, the only way to share the user control between applications is to put a separate copy in each application, which takes more maintenance if you make changes to the control"
Timberbird 18-Oct-13 9:51am View
Ok, when you view page source and see this id="ContentPlaceHolder1_TextBox1", can you check the code and make sure textbos ID is actually "ContentPlaceHolder1_TextBox1"? If it is, your problem is not in incorrect ID. Also, have you checked your browser console? Does it contain any error messages?
Timberbird 18-Oct-13 8:44am View
Have you tried adding XML header with encoding attribute?
Timberbird 18-Oct-13 8:19am View
Wait. Do you need a windows application (.exe file) or ASP.NET application?
Timberbird 18-Oct-13 8:17am View
One more questions on C++/OOP basics. I hope you're not using this site to get your homevork/exercise done
Timberbird 18-Oct-13 8:12am View
Because we are not able to create class instance in any other way - its constructor is private and therefore closed to "outer world". Static method belonging to the same class, hovewer, can access its constructor and create a class instance. Is this a test?
Timberbird 20-Nov-12 11:04am View
Well, if you didn't change any namespace/class name and also checked spelling (for example, using Ctrl+F)... have you tried to clean and rebuild the project?
Timberbird 20-Nov-12 10:05am View
When do you receive this message? When you build your project or during runtime?
Timberbird 20-Nov-12 9:54am View
Since it's a service... have you tried putting your assembly to GAC?
Timberbird 19-Nov-12 7:49am View
And code-behind is? Please use "Improve question" link to insert this code inside original question text
Timberbird 19-Nov-12 7:23am View
Oh, and by the way - in this case you shouldn't mark your question with ASP.NET tag, it's rather misleading :)
Timberbird 19-Nov-12 7:21am View
Then you should add each line as a separate item in Items property. BTW, how do you assign the text now - listBox1.Items.Add(errorMessage);?
Timberbird 19-Nov-12 7:04am View
Which control do you use for output?
Timberbird 19-Nov-12 6:48am View
Where do you output errorMessage? If you write it to log/console/Windows form, everything should work. If you want to display this message in browser, use <br/> instead of Environment.NewLine
Timberbird 16-Nov-12 6:10am View
Add more details about the exception, machine configuration, .NET version, config files used etc
Timberbird 2-Nov-12 9:34am View
If you need to change element's style it's bad solution, but I guess these are the requirements you have. Well then, what do you have trouble with: action logic or implementation?
Timberbird 2-Nov-12 9:00am View
Do you have access to Execute() implementation? If yes, please show code which creates and assigns result
Timberbird 31-Oct-12 10:12am View
If it's common CLOSE_WAIT, you'll have to wait a bit - port will be released soon. But if the socket is active and, for example, listening, then it's definitely not closed properly. In this case you could try to use Dispose() method after Close(). Also, could you post the code with Close() call - the one you tried?
Timberbird 31-Oct-12 8:16am View
What's the state of the port? (and small note: if you do want the person you're replying to to be notified about your response, use "reply" link on the right side of the original comment instead of commenting your original question)
Timberbird 31-Oct-12 8:00am View
And have you checked socket state after that? Using netstat command you can check whether socket is actually closed - it often stays in CLOSE_WAIT for some time after closing, and that may be the reason you can't use the same address/port
Timberbird 31-Oct-12 4:44am View
And what is this CatchConsole() function?
Timberbird 31-Oct-12 4:29am View
Have you tried UdpClient.Close()?
Timberbird 27-Sep-12 6:30am View
Some general recommendation is to set current position at the beginning of the stream, but I do believe it's not the reason :). Try saving content of the msSource to the file and then check it to make sure it's correct just before encoding
Timberbird 27-Sep-12 4:40am View
If you dump your msSource stream content to a text file while compressing, does that text file still contain the original string, without prefix?
Timberbird 26-Sep-12 5:27am View
Well, in foreach (Purchase p in c.Purchases.Select(x => new { i.Id, i.Name })) you have cycle variable p which has explicitly defined type - Purchase. Strange thing it can be cast from anonymous type... I can only guess due to cast Select() returns original objects, not created ones, or Purchase has corresponding constructor/cast operator (unlikely)
Timberbird 26-Sep-12 4:38am View
May be caused by many reasons - usually it's related to the code-behind model. Do you use CodeFile instead of CodeBehind? Is you textbox included in .designer file? Code and markup would help
Timberbird 18-Sep-12 8:38am View
Because you never set Session["DETAILS"] and it's always null, maybe?
Timberbird 18-Sep-12 8:35am View
Is your project WinForms application or a web form? WinForms usually don't use javascript at all, unless you implement/use some kind of browser control. How does your task sound exactly?
Timberbird 17-Sep-12 12:08pm View
Because this process is synchronous. You started handling the event, and though there may be other events recently arrived in the queue (key up, another key down and so on), you will only receive them when you end handling current event and ask for others. Imagine you sit in a room (your event handling routine with both cycles) and interview one person while others gather outside. This is asynchronous process, new people may arrive at any time and stay at the end of the queue, but you won't notice it. They are very polite, like your events, and won't interrupt your conversation knocking at the door and shouting "I'm here, stop anything you're doing there and let me in". Only when you say goodbye to the person you're currently talking with and invite the next one, new guest will enter the room - and you'll speak to him in the very same manner, two cycles one inside another :).
This is very weak analogy, I must admit, but it could explain why you wouldn't notice new events while running cycles to handle current one: because you have to ask whether there are new events yourself, calling SDL_PollEvent (&sdlEvent).
I suggest you remove all cycles altogether and make column and row variables external to the event handling loop, increasing them accordingly on SDL_KEYDOWN events
Timberbird 17-Sep-12 11:08am View
Actually looking at the picture I began to doubt again :). The solution I proposed allows you to do approximately the following: when you press and release 'a', it displays single 'a' character. When you press and hold 'a', it types 'a' characters while you hold the key and stops typing as soon as you release the button.
Timberbird 17-Sep-12 9:47am View
Oh, I guess I figured it out. Well, a soultion would be to generate your own event and put it into queue, I guess. When user first presses the button, you store a pressed key and display it on the screen; then you generate your own event and put it into queue. On next sdlEvent you check a type of event: if it's your own one AND you have last pressed key stored, you simply print that key on the screen again and regenerate the event. If it's SDL_KEYUP, you just clear last pressed event
Timberbird 17-Sep-12 9:32am View
Could you elaborate your problem? From the code I see that for each event you run two cycles, outer with 10 iteration and inner with 20 iterations. So it's basically not event being generated multiple times, it's your code running multiple times on single event. And what do you want to change?
Timberbird 14-Sep-12 3:24am View
Could you show the code that sends file to client? If you use the stream that is only closed when file is sent to client, you could consider reading file to memory first, then closing file and sending content to client from memory.
Anyway, first suggestion that comes to my mind is to store file content in application-level cache, renewing it periodically
Timberbird 7-Sep-12 10:07am View
It's common behaviour to encode non-ASCII (and some of ASCII) symbols in URLs this way. Does this link work when you click it?
Timberbird 7-Sep-12 8:58am View
I believe using DateTime.ParseExact() method you can define any date time format, including custom. Setting format provider for DateTime.Parse() can help with standard formats
Timberbird 7-Sep-12 4:14am View
Looks like the server can't find your assembly. Is it placed directly in the "bin" folder on server?
Timberbird 6-Sep-12 3:45am View
Which language is that? If it's C#, try string.Split()
Timberbird 4-Sep-12 3:06am View
I would only add that this check will give "empty" message even if textbox is actually empty (has no text at all, even spaces), which may be implied, but not technically requested by TS. Checking text length as well would fix it (if needed)
Timberbird 3-Sep-12 7:33am View
Good old (yet not 100% reliable) Autorun.inf is not an option?
Timberbird 3-Sep-12 7:29am View
That's kind of "last resort" step, but you could give it a try :). Actualy, there can be tons of reasons - for example, some banner-blocking add-on, incorrectly set IE mode... impossible to say for sure
Timberbird 3-Sep-12 6:48am View
It may depend on computer (installed IE updates, for example, or simply enabled/disabled JavaScript scenarios, which is browser setting). And it's not Java, it's JavaScript - script language that doesn't require anything except browser being installed
Timberbird 3-Sep-12 5:09am View
Have you checked if there are JavaScript errors? "Developer tools" (F12) -> "Script" tab -> check "Console" window. Also, try pressing "Start debugging" button and then opening "Origen" combobox - you'll notice if there are exceptions
Timberbird 30-Aug-12 7:47am View
Please see my comment to a solution below
Timberbird 30-Aug-12 7:46am View
I guess you refer to that post (I add this reference just to make sure TS won't be confused by "Reports.dll" and other out-of-context parts). TO TS: it's possible that you're signing your assembly - open project properties, go to "Signing" tab and check whether "Sign the assembly" checkbox is set.
If it is, then your assembly will be signed (which, among other things, means that its origin and integrity may be verified). You can read more about strong names and signing here. But your assembly can only be signed if all referenced assemblies are signed as well.
Looks like assembly "Bll" isn't signed, and you have to fix that. What can you try:
- find signed version of "Bll" assembly;
- find source code "Bll" assembly and build it yourself, signing;
- not to sign your own assembly (uncheck "Sign the assembly" checkbox);
- loading assembly dynamically could also help (not sure, never checked myself)
Timberbird 30-Aug-12 2:58am View
Calm down. Bugs are way too common to get excited every time you get one. First, what is your problem? "I am enter FNAME text box but didn't show error" looks like valid logic. If you didn't enter fname, that's another thing. First, are you sure you need "&&", not "||"? Second, you could consider adding "return false;" explicitly.
Providing more information would help us to understand the situation better
Timberbird 23-Aug-12 2:59am View
Are you sure it hasn't been created? In project properties, check "Output path" parameter on "Build" tab and "Post-build event command line" parameter on "Bulid Events" tab.
Timberbird 16-Aug-12 7:12am View
You mean you first force client's browser to download 20k records and then make user select one item from that huge list? Simply don't do that. You can split the list into different categories and first let user pick a category, or use any other workaround, but keeping that long list is just unacceptable
Timberbird 14-Aug-12 6:35am View
Looks like you work with database in your development environment, and this database is unavailable from the server you install your software on
Timberbird 13-Aug-12 6:36am View
Put a breakpoint on that line and check Reader["CompanyPrice"] value when debugging to see what you're trying to cast. BTW, why not Convert.ToDecimal(Reader["CompanyPrice"])?
Timberbird 8-Aug-12 8:31am View
Static "sessionID - isCorrect" dictionary? Application state? Cache object?
Timberbird 8-Aug-12 8:30am View
Static "sessionID - isCorrect" dictionary? Application state? Cache object?
Timberbird 8-Aug-12 7:58am View
If you intend to use this site for test purposes only, edit %WINDIR%\System32\drivers\etc\hosts file, adding record like

If this site should be available from web, then, as Kenneth said, you need to register your site wih DNS server
Timberbird 1-Aug-12 9:11am View
Yes, my bad, sorry for misleading answer. Well, at least part about int/floating point values division was relevant, though it definitely should have been explained, not just mentioned :)
Timberbird 15-Jun-12 6:55am View
This code can show only div_error control. Do you mean that in case of error you don't see corresponding error message in div_error?
Timberbird 15-Jun-12 6:45am View
Ok, a couple of additional questions:
1) What is the source of the exception? Can you debug your website and check whether redirection actually occurs? For example, put a breakpoint at the end of your ASPxButton1_Click method; if it's hit, error is somewhere else, possible on the page you're redirecting user to

2) Have you tried to log in in different order? If User1 logs in after User2, does error differ from the one when User2 logs in after User1?
Timberbird 15-Jun-12 5:56am View
What's the error? I mean if it's an exception, could you provide its type and text?
Timberbird 14-Jun-12 8:11am View
Check your TicketId value, it cannot be converted to Int32 - put a breakpoint and see its value. Also, entry.ToString() is not needed as entry is already a string
Timberbird 9-Jun-12 2:46am View
Well, it complicates things. I think you'll have to create a new class derived from SqlReader and add IEmployee interface realization to that class. Another option I initially forgot, you could overload cast operator, but that also requires new class derived from SqlReader to be created
Timberbird 6-Jun-12 6:56am View
What seemed strange to me is that in first check you require that BeatDetector has exactly the same X-coordinate, and in the second you actually check if label Y-coordinate is 0, which may be written simply as if (pLabel.Location.Y == 0).
Of course I don't know details of your task, so I could be wrong, but I just thought you want to check whether BeatDetector completely/partially overlaps any label, so I proposed Intersect method which seems to suit this task
Timberbird 6-Jun-12 6:06am View
One more note: I haven't worked with WinForms controls much, but if you need to check whether two controls overlap, aren't there some convenient functions for that in .NET? For example, you could determine controls' bounds and then use Rectangle.Intersect() -
Timberbird 6-Jun-12 5:59am View
Something like that (may contain errors, I just wrote it in notepad):

foreach (Control pControl in panel1.Controls)
Label pLabel=pControl as Label;
if (null != pLabel)
// and here goes your logic:
if (BeatDetector.Location.X == pLabel.Location.X)
if (pLabel.Location == new Point (0, pLabel.Location.Y)) // strange check, BTW

Timberbird 6-Jun-12 5:18am View
Er... is this the actual code you use (particulary first code sample)? Is it is, then each call of Createlabel() simply creates a new label control, not even adding it to fotms control. I.e. you just have object (actually, a lot of objects, as you call Createlabel() many times) somewhere in memory and nothing on the form. Instead, you could enumerate all the form's controls, check whether they are labels and if yes - well, then you can start coordinates check
Timberbird 18-May-12 8:12am View
Encrypt it. Seriously, you don't mention which encryption algorythm you used (maybe it's not even encryption but hashing), so who can help you? It sounds like "I broke arbitrary thing, how do I fix it?".
And why would you want your passwords decrypted, anyway?
Timberbird 18-May-12 7:49am View
You found no advantage compared to explicit cast? What about exception cast produces while "as" doesn't? I believe MSDN mentions it clearly. Or maybe you're talking about checking with "is" keyword?
Timberbird 18-Jan-12 3:02am View
This code block only shows inserting record to database. As your project is a firewall, you definitely have code that analyzes network traffic - add this code your question
Timberbird 28-Dec-11 5:55am View
Strange, I can only suspect that some .NET objects are being reused or MechineID is not actually unique. For tests, I'd
1. Place FileStream and BinaryWriter in using statement
2. Add some more unique info in file name - for example, appeng GUID after current time
Timberbird 28-Dec-11 5:25am View
Is it mixed in the DB or in files? And where MechineID comes from - I guess it is the part of the message from the device, but just in case?
Timberbird 28-Dec-11 5:10am View
Sorry, I couldn't see: which files are mixing? Files from different devices cannot mix - they have different names. Files sent one after another from the same device can mix, second overwriting the first, but you mention writing them to different directories - where does second folder come from?
Timberbird 20-Dec-11 7:57am View
Either I misunderstand the question, or it may easily be done by dir [directory path here] command, e.g. dir d:\Data\Books
Timberbird 19-Dec-11 6:56am View
Could you upload your file somewhere or add it to your question for investigation? Looks like formatting gets broken when you post it in the comments
Timberbird 19-Dec-11 6:32am View
Xml needs root element, which would contain all the other elements: <?xml version="1.0"?><root>...(all the other elements here)...</root>. You can see example structure here
Timberbird 19-Dec-11 6:28am View
Oh I see. Forgout about cast in my solution
Timberbird 19-Dec-11 5:57am View
Is title really the first element of your xml file? If yes, then this xml doesn't actually have root element and really is malformed.
Timberbird 13-Dec-11 2:02am View
Which kind of item do you use? I mean - what is the type of file you created to drag'n'drop controls onto? Is it HTML page?
Timberbird 9-Dec-11 9:52am View
Well, it should :). Breaks only interrupt current cycle, while return forces your program to leave the function
Timberbird 9-Dec-11 9:42am View
What is the outer (for (int b = 0; b <= 5; b++)) loop for? return will exit this method as soon as you reach Length_Command. Should Command value be changed inside that second loop?
Timberbird 9-Dec-11 7:13am View
Have you checked this page? Some people there seem to have the same problem
Timberbird 8-Dec-11 9:41am View
Provide the code you use to open the file dialog
Timberbird 8-Dec-11 3:15am View
You didn't show the most interesting part: how ds and ds1 are defined and which values are assigned to them :)
Timberbird 25-Nov-11 11:29am View
That's how you can tell a real developer - he uses submarine for diving? :) Debugging provides much more information than text output, but do you need it simply to tell whether it's client or server script error? If server returns correct result and everything indeed worked fine before, time to view page source, check jQuery version, read info on val() method, and, if needed, enable client script debugging. Otherwise - obviously debug server code and leave client be
Timberbird 25-Nov-11 10:42am View
But why would you pass a TextBox between processes (which I believe is what you intend to do)? Just to read its text? Then it's the text you should pass, not the control (actually, control copy or possibly handle) itself
Timberbird 25-Nov-11 10:35am View
Why loading the DLL manually? Try to demove it from project and add standard Systed.Data assembly (from the "Add Reference" dialog, ".NET" tab)
Timberbird 25-Nov-11 9:43am View
Try alerting returned value - what does it show?
Timberbird 25-Nov-11 9:20am View
Check property type (Button) in your property declarations. Are these the same? They may come from different namespaces in interface and class
Timberbird 23-Nov-11 7:29am View
After users selects the file and submits it on the server, you already have that file contents and therefore there's no need to save it on disk - it can be written to database directly
Timberbird 22-Nov-11 6:10am View
It is impossible to answer this question until you provide more info on class A - at least its fields and default constructor (and, possibly, base classes' constructors as well)
Timberbird 22-Nov-11 4:05am View
Then you should leave while cycle only, with file eof as an exit condition. Inside the loop you read new structure, add it to array and increase Idx value by one (it should be set to zero before loop). If Idx value reaches 100, you should also exit the while loop, like that:

int Idx=0;

while(!iFile.eof() and Idx<100)
// read data here

As to using arrays of fixed length - you should really consider replacing them with more convenient objects. std::list or std::deque from STL could help here.
Timberbird 22-Nov-11 1:48am View
Maybe I misunderstood your question - do you actually use these lines:
int counter =100;
for( Idx = 0; Idx < counter; Idx++)
They force your program to attempt to read 100 lines from a file before a new check on file eof is done.
BTW, wouldn't it be better to use
Timberbird 18-Nov-11 9:28am View
If you list fields to select explicitly instead of using "SELECT *", does result change?
Timberbird 18-Nov-11 5:02am View
It is very well covered in UML standard - have you read it? Any answer would only retell that standard, so why not refer to the original document? :)
I, myself, would also advise you to install Visio. Not only this product allows you to draw UML diagrams, it, AFAIR, has integration with VS to the point that it can reverse engineer class structure, turning it into UML diagram
I missed the part about Visio in the beginning. So what't the problem? You can reverse engineer your project as described here:
Then just create new class diagram and drag'n'drop your classes on it. No Word required at all :)
Timberbird 18-Nov-11 4:54am View
No wonder at all, it is VERY common, and Google has proof :). But what is your question?
Timberbird 18-Nov-11 4:52am View
In which way are they opened? The file may be opened by an application exclusively, when write access to that file is blocked, or it may be just loaded in memory. For example, when you open a file with notepad, the latter loads file content into memory and then closes the file, so it can be viewed and edited by other programs.
I know this is quite obvious, just in case
Timberbird 18-Nov-11 4:28am View
PRINT or TYPE file.txt > PRN actually print contents of a file, i.e. all the symbols inside it. Do I understand your task wrong? You don't need to print file contents?
Timberbird 18-Nov-11 3:29am View
I agree, it seems that CFileFind holds directory handle open, so that directory cannot be removed its handle is released
Timberbird 17-Nov-11 9:55am View
What does GetLastError() say?
Could it be due to missing finder.Close() ?
Timberbird 17-Nov-11 4:22am View
Well, you can replace Sleep() with ManualResetEvent.WaitOne(), but I doubt it'll help. Sleep() shouldn't be that harmful :). Have you checked memory usage?
Timberbird 17-Nov-11 4:01am View
Another way to pause is to wait for event or timer, but Sleep usually don't throw exceptions anyway. Could it be due to this call:
Maybe you have no rights to kill the process, or it doesn't exist by that time, or processlist array is just empty? Put this line in try...catch block and see if it causes the exception
Timberbird 17-Nov-11 3:43am View
What does debug show: it doesn't receive the text or just doesn't display it? BTW: why do you assign received data
MainScreen._message = ByteToHex(comBuffer);
instead of appending it
MainScreen._message += ByteToHex(comBuffer);
Timberbird 16-Nov-11 8:38am View
In selectedIndexchanged event you should have index of currently selected item. Check SelectedIndex property - does it point to currently selected item?
Timberbird 16-Nov-11 7:18am View
Do you have only one resource file or you would like to switch between different files? Why not embed resources?
Timberbird 16-Nov-11 2:20am View
What do you want to bind it to? You're already on new page, why would you want to do something with previous page?
Besides, do you actually have to use Response.Redirect()? It sends 302 response code to the browser, making access to redirecting page more difficult. Server.Transfer() or form's action attribute, on the other hand, provide you with access to the PreviousPage object
Timberbird 16-Nov-11 2:11am View
What do you mean by "ping a system by telnet"? Does "telnet cu-ekhtiari" (without port) work?
Timberbird 15-Nov-11 5:56am View
1. You don't provide the code necessary to help you.
2. I'm not an expert, but I could help.
3. I won't. I don't like the header. I don't like your attitude. I don't like your behaviour (including shouting and deleted solution). Solve your problems yourself, be it wrong code, ignorance or rudeness
Timberbird 15-Nov-11 5:14am View
Well, it's nice to know that your problem is solved :). Sorry that I couldn't help you in the end with all the blind shooting, but now we at least know one more reason for service inaccessibility - maybe it'll help someone else :).
BTW, it seems that the client program was using incorrect network interface. Maybe it worth it to enumerate interfaces until one responds or determine required interface using route table?
Timberbird 15-Nov-11 3:57am View
Ok, keeping generating blind guesses :). Does Wireshark show outgoing packets on XP/ Win7x32 machines? There are no firewalls in your network at all, including server in question, right? Has anything else, like antivirus, been installed besides of updates?
Timberbird 15-Nov-11 3:43am View
Does disabling IPv6 in network connection properties change anything?
Timberbird 15-Nov-11 3:33am View
My bad, telnet won't show anything anyway - it's UDP after all, there are other utilities for this protocol (like netcat). Unfortunately I've never used Wireshark myself, sticking with CommView... which filters do you set?
Timberbird 15-Nov-11 3:21am View
OK, didn't figure out that is your application and can be debugged. So this application at least connects to DB and gets server address/port pair. Then it attempts to send data and... nothing, no data sent on any network interface and no error?
About telnet: does it work on XP machines?
Timberbird 15-Nov-11 2:53am View
Well, if you know which updates were installed, you can always uninstall them one by one :).
The only recent update concerning UDP I've heard about is that one: ; however, it is said to be critical and not causing any problems. Are you sure the problem is with UDP? The client part that you use, does it start normally and then say it cannot connect to the server? Is there anything on that error in Event Log?
Timberbird 14-Nov-11 7:16am View
Thank you. It appears the reason was not crossing buffer boundaries - see my edited answer or Richard's
Timberbird 14-Nov-11 7:13am View
Thank you. I found out what OP problem actually is after his comment, and then went to msdn. Should have done it in the beginning, I guess, but that extra cycle could definitely be the reason :)
Timberbird 14-Nov-11 4:44am View
What happens when you run this code? You see image for the last file only? If yes, the reason may be that you don't set each new image coordinates so they all stack in one place and overlap
Timberbird 14-Nov-11 3:32am View
Are you sure Cells collection itemas are numbered correctly? Collections usually number from 0, not 1. Try changing indexes, replacing
TextBox box3 = (TextBox)ItemGv.Rows[rowIndex].Cells[3].FindControl("qtytb");
TextBox box3 = (TextBox)ItemGv.Rows[rowIndex].Cells[2].FindControl("qtytb");

(and in previous lines as well)
Timberbird 14-Nov-11 3:19am View
Have you checked Event Log and IIS log files? Are there any errors that may refer to the application pool's work?
Timberbird 10-Nov-11 10:08am View
You're welcome :)
Timberbird 10-Nov-11 6:14am View
It contains an answer (you asked what's wrong with your code? it tries to convert obviously incorrect data, nothing more) and a question: what should your code actually do? You have an answer for the question now, and if you bother to explain what do you actually try to achieve, you could also get some help
Timberbird 10-Nov-11 5:37am View
Ok, have you tried cast?
I mean:
SharpPcap.LibPcap.LibPcapLiveDevice pDevice = devices[i] as SharpPcap.LibPcap.LibPcapLiveDevice;
if (null != pDevice)
CaptureFileWriterDevice captureFileReader = new CaptureFileWriterDevice(pDevice, "D:\\Documents and Settings\\amin\\Mes documents\\file.pcap");
Timberbird 10-Nov-11 5:09am View
According to this error, there may be mess with namespaces. You use SharpPcap.LibPcap.CaptureFileWriterDevice.CaptureFileWriterDevice and it rejects SharpPcap.ICaptureDevice object... is there SharpPcap.CaptureFileWriterDevice class in this framework?
Timberbird 10-Nov-11 4:54am View
Haven't worked with that framework, but according to description article... do you call captureFileReader.Write(e.Packet) later?
Timberbird 8-Nov-11 8:23am View
My mistake, SCOPE_IDENTITY() does suit OP purpose better
Timberbird 5-Oct-11 14:17pm View
Is SETFD a function or a macros? If it is macros, find and check its body, maybe include it in your question
Timberbird 3-Oct-11 4:57am View
These classes I'm talking were part of the project I've been working on, and I don't have access to them any more :). Which references would you like to see? There are really tons of examples, both for mapping class structure to database structure (like this link) and for serialization (eg this one)
Timberbird 30-Sep-11 4:03am View
No it's not. Multithreading should serve some particular purpose. In your case there are two threads running on server in a hope they can finish their job before response is sent to client :)
Timberbird 30-Sep-11 3:14am View
You have already asked this question. Have you tried to wait on your threads, calling tid1.Join() and tid2.Join() at the end of Button1_Click() try block?
Timberbird 30-Sep-11 3:06am View
Could you provide more info? For example, when do you want to delete these files? Are you going to delete all files or just files of specific type? Do you want to delete inner directories, if any?
BTW, this code screams for method like "EnsureDirectoryExists(string sPath)" :)
Timberbird 28-Sep-11 2:46am View
Do you mean you only have one zero in each ListBox upon button click, or there's a hundred of zeros? If it's only one zero, the reason may be that your main thread doesn't wait for tid1 and tid2 to finish their job
Timberbird 26-Sep-11 3:50am View
As your code looks now - just in the same folder where your application exe file is. On your computer (during development) this is Debug folder.
If you deply your application on other computers simply copying files, copy ASD.exe with your application exe. If you use installers, include ASD.exe in the package and instruct your installer to put in the same folder with application exe
Timberbird 21-Sep-11 9:19am View
Examine your FillCombo method - what does it contain? The error is caused by this method called from your LoginForm_Load event handler. Are you using, for example, config files?
Timberbird 19-Sep-11 7:11am View
Sorry, I'm definitely not an expert in this area, so all I can think of is a clumsy solution like saving file streams in files with corresponding names before archiving, and restoring them after decompression. But this requires extra actions to be performed.
Timberbird 19-Sep-11 5:12am View
It's strange, this article says it is. Have you tried -os switch or corresponding option in GUI as this article describes? It also says this feature works on RAR files only
Timberbird 19-Sep-11 2:47am View
As far as I know, WinRAR allows you to preserve alternate streams in an archive
Timberbird 16-Sep-11 2:19am View
Yes, I can see that, but these types are of different size :). As Chuck o'Toole mentioned in his solution, int usually takes four bytes while char occupies one byte only
Timberbird 15-Sep-11 17:22pm View
Maybe the reason is that you are incrementing your vpTmp as int* and accessing values to it like char*?
Timberbird 15-Sep-11 9:27am View
How are these custom properties stored? The reason could be that your attributes are stored in a file stream
Timberbird 13-Sep-11 7:07am View
Clearly something's wrong with ASP.NET settings. Which IIS and .NET version do you use?
Timberbird 12-Sep-11 6:02am View
I don't know how you deploy it, that's hard to tell :). Try putting this assembly in your site bin directory, or register it in GAC
Timberbird 12-Sep-11 5:14am View
Could you elaborate your question a bit? Explain network structure: from where and to where you are trying to connect (for example: is you server behind a router? and is your client machine behind a router?)
Timberbird 9-Sep-11 9:05am View
That's why I thought OP has written the code and now wants to check if everythings works fine, so he intentionally moved === test before assignment. Don't know where this decision comes from - maybe I was sure (esp. from "every thing write correct" header) that assignment misplacement is too obvious not to be intentional :). And it may - let's wait for the OP to explain
Timberbird 9-Sep-11 7:56am View
I thought that was the idea of the OP - check what would be contained in the array before its elements are initialized. Actually, I'm a bit interested too :)