instruction
stringlengths
0
30k
|winforms|multithreading|
I'm sure there is a good (or at least decent) reason for this. What is it?
I looked at the ruby documentation for StringIO, and it looks like what you want is [strio.string][1], not strio.to_s Thus, change your code to: s = StringIO.new s << 'foo' s << 'bar' s.string [1]: http://ruby-doc.org/core/classes/StringIO.html#M000400
How do I add an additional window.onload event in Javascript
|javascript|asp.net|c#|
In my asp.net User Control I'm adding some script to the window.onload event like so: if (!Page.ClientScript.IsStartupScriptRegistered(this.GetType(), onloadScriptName)) Page.ClientScript.RegisterStartupScript(this.GetType(), onloadScriptName, String.Format("window.onload = function(){{ {0}(); }...
In my asp.net User Control I'm adding some script to the window.onload event like so: if (!Page.ClientScript.IsStartupScriptRegistered(this.GetType(), onloadScriptName)) Page.ClientScript.RegisterStartupScript(this.GetType(), onloadScriptName, "window.onload = function() {myFunction();};", true)...
In my asp.net User Control I'm adding some script to the window.onload event like so: if (!Page.ClientScript.IsStartupScriptRegistered(this.GetType(), onloadScriptName)) Page.ClientScript.RegisterStartupScript(this.GetType(), onloadScriptName, "window.onload = function() {myFunction();};", true)...
|c#|asp.net|javascript|
In my asp.net User Control I'm adding some script to the window.onload event like so: if (!Page.ClientScript.IsStartupScriptRegistered(this.GetType(), onloadScriptName)) Page.ClientScript.RegisterStartupScript(this.GetType(), onloadScriptName, "window.onload = function() {myFunction();};", true)...
The one reason this might be the case is that the XML file is no longer being created/updated. Make sure the XML Documentation file is set in the project property pages. Has your XML file been put under source control and if so is it checked out on a build. If not then it won't update.
How can I compile Asp.Net Aspx Pages before loading them with a webserver?
|asp.net|
It's really annoying that visual studio hides typos in aspx pages (not the code be hind). If the compiler would compile them, I would get a compile error.
It's really annoying that visual studio hides typos in aspx pages (not the code behind). If the compiler would compile them, I would get a compile error.
I think your plan is pretty good, really. How will you account for branches where a programmer is wandering off on their own just trying something? Maybe like /development/jfm3-messing-around ?
Generally, the tips here: [http://www.sql-server-performance.com/][1] have been high quality and useful for me in the past. [1]: http://www.sql-server-performance.com/
-operation [parameters] -command [your command] -anotherthings [otherparams].... For example, YourApp.exe -file %YourProject.prj% -Secure true
If you use one of the standard tools for generating command line interfaces, like getopts, then you'll conform automatically.
I think flexibility and avoiding ambiguity is your answer. By using version numbers you do not tie yourself to where that version is deployed. For example you might have version 1.3 which is deployed as development, 1.2 which is in test and 1.1 which is in production. If you wanted you could easily add another st...
It's not clear if you're trying to do inline error messaging or new page error messaging, but if you want to improve the text around inline error messaging, [this post][1] provides good information. [1]: http://www.softiesonrails.com/2008/4/23/better-messages-for-activerecord-validation-errors
Best thing to do is don't assume anything if you can. When the operator types in your application name for execution and does not have any parameters either hit them with a USAGE block or in the alternative open a Windows Form and allow them to enter everything you need. c:\>FOO FOO USAGE ...
What about `<value xsi:nil="true"></value>`? That's what's [in the spec](http://www.w3.org/TR/xmlschema-0/#Nils).
In the past when I've had XML elements that were null I could either not include them or send them empty so, in your case it'd be: `<value />` Have you tried that?
Web designer for simple reports
|report|designer|
Users of my web app need to edit and "save as" their reports and then execute and export them to PDF or Excel files. I need to know if there is a designer (web) for simple reports (open source would be better). Reports are not complex: just data fields, master-detail, labels, simple formulas, lines, static images... ...
odds are there are triggers on the database side keeping a log so when you hack yourself into the database they will know when and how you did it. Not a good idea.
I've been reading [Real World Functional Programming][1] With examples in F# and C# by:Tomas Petricek So far I find it very good at teaching F# concepts by showing the implementations in C# on the side. Great for OO Programmers. [1]: http://www.manning.com/petricek/
The best that I've seen is RsInteract thier url is http://www.rsinteract.com/
I tend to use if (DBNull.Value.Equals(value)) { // } or if (Convert.IsDBNull(value)) { // }
You should break your query up into multiple chunks that each execute within the timeout period.
The dollar sign: $
How do I use the softkeys with a CDialog based application in windows mobile 6 via MFC?
|mfc|windows-mobile|
How do I use the softkeys with a CDialog based application in windows mobile 6 via MFC? I have a CDialog based Windows Mobile 6 (touchscreen) Professional app that I am workign on. The default behavior of a CDialog based app in WM6 Professional is to not use any softkeys by default... I want to map the softkeys t...
If you absolutely cannot increase the timeout, your only option is to reduce the time of the query to execute within the default 30 second timeout. Depending on your query and your requirements, you could consider breaking the query down into several chunks that each execute within the default 30 second timeout.
If you absolutely cannot increase the timeout, your only option is to reduce the time of the query to execute within the default 30 second timeout.
You are looking for [subcontrollers](http://groups.google.com/group/mvccontrib-discuss/browse_thread/thread/b050e21fe322c08a). This implementation is the best way to do what you are talking about.
You are looking for [subcontrollers](http://groups.google.com/group/mvccontrib-discuss/browse_thread/thread/b050e21fe322c08a). This implementation is the best way to do what you are talking about. Edit: I just posted about this here: http://mhinze.com/subcontrollers-in-aspnet-mvc/
I don't think I ever was in a position to have shared ownership in my design. In fact, from the top of my head the only valid case I can think of is Flyweight pattern.
I'd call it bloated, but not leaky. (If it was leaky it would climb and climb until something crashed.) As others have said, memory is ***cheap!*** It seems like a simple decision to me: spend a tiny bit on more memory vs. loosing productivity because you don't have the memory budget to run Eclipse @ 500MB *Summa...
Maven2 Multiproject Cobertura Reporting Problems During mvn site Build
|code-coverage|maven2|cobertura|
We've got a multiproject we're trying to run Cobertura test coverage reports on as part of our mvn site build. I can get Cobertura to run on the child projects, but it erroneously reports 0% coverage, even though the reports still highlight the lines of code that were hit by the unit tests. We're using mvn 2.0.8. I've ...
You typically catch and re-throw for one of two reasons, depending on where the code sits architecturally within an application. At the core of an application you typically catch and re-throw to translate an exception into something more meaningful. For example if you're writing a data access layer and using custom ...
I would recommend using a helper method instead of an attribute. Something like this: public static class ExceptionAssert { public static T Throws<T>(Action action) where T : Exception { try { action(); } catch (T ex) { return...
The zebra barcode reader ([http://zebra.sourceforge.net/][1]) is a small, layered bar code scanning and decoding library implemented in C (C++ wrappers are also provided). It supports many popular symbologies (types of barcodes), including EAN-13. However, I'm not aware about any Ruby bindings. The library is availabl...
For a simple class it is often easiest to implement hashCode() based on the class fields which are checked by the equals() implementation. public class Zam { private String foo; private String bar; private String somethingElse; public boolean equals(Object obj) { ...
This sounds like a question based on a background in java? The answer that [dysfunctor][1] gave is good. The important thing to realise is that in C assigning a pointer is no different to assigning an integer. Consider the following modification to your original code: int temp1 = 1; int temp2; ...
This is an example from Excel documentation: With Worksheets("Sheet1").Range("B1") .Value = "New Title" .Characters(5, 5).Font.Bold = True End With So the Characters property of the cell you want to manipulate is the answer to your question. It's used as Characters(_start_, _length_).
This is an example from Excel documentation: With Worksheets("Sheet1").Range("B1") .Value = "New Title" .Characters(5, 5).Font.Bold = True End With So the Characters property of the cell you want to manipulate is the answer to your question. It's used as Characters(_start_, _length_). ...
Of course it's horribly inefficient. But at the point that an exception occurs that is important enough to show to the end user, you should not care about that.
Did some digging in the lib and it seems that if you want to use TLS (as you do with Gmail) then it adds a new option to the ActionMailer::Base.smtp_settings of :tls (default of which is false) which you should set to true. The only thing the installation instructions mention regarding TLS is to remove any other smt...
Based on your last paragraph, what you're trying to do is inject some 'extra methods' into unit testing since you're already testing a specific class. I do not know of a testing harness that allows you to attach tests based on the hierarchy of a class. However, with your own suggestion of using TestNG for building s...
Generally when you're dealing with exceptions, performance and efficiency are the least of your worries. You should be more worried about doing something to help the user recover from the problem. If there was a problem writing a certain record to the database, either roll the changes back or at least dump the row in...
What port is a given program using?
|windows|networking|
Greetings, I want to be able to figure out what port a particular program is using. Are there any programs available online or that come with windows that will tell me which processes are using which ports on my computer? PS - before you downmod this for not being a programming question, I'm looking for the prog...
Google Docs? It is capable of storing PDFs but your word documents will be converted to the the google doc format. (which then can be converted back to Word or RTF or PDF etc'
It looks to me like you really want to print out the names of each enum, rather than the values. In which case **Enum.GetNames** seems to be the right approach. public enum Suits { Spades, Hearts, Clubs, Diamonds, NumSuits } pu...
From [this][1] OTN Forum thread: > you just need to set the environment > variable NLS\_TIMESTAMP_FORMAT to tell > SQL*Loader what format to expect the > timestamp to be in: > > set NLS\_TIMESTAMP_FORMAT=YYYY-MM-DD > HH24:MI:SS.FF > > ..and remove the reference to the > to_timestamp function completely fr...
An index basically sorts your data on the given columns and then stores that order, so when you want to find an item, the database can optimize by using binary search (or some other optimized way of searching), rather than looking at each individual row. Thus, if the amount of data you are searching through is large...
An index can be explained as a sorted list of the items in a register. It is very quick to lookup the position of the item in the register, by looking for it's key in the index. Next the the key in the index is a pointer to the position in the register where the rest of the record can be found. You can have many ind...
If you are the only coder on a project, I would suggest testing it by hand. That said, you will likely suffer from coder myopathy. Since you wrote the code and know what it is supposed to do, you may subconsciously avoid actions that will break it. I have worked with different automation methods and they tend to b...
Take a look into the [FasterCSV][csv] gem. If all you need is excel support, you might also look into generating a xls directly. (See Spreadsheet::Excel) gem install fastercsv gem install spreadsheet-excel [csv]:http://fastercsv.rubyforge.org/classes/FasterCSV.html I find these options good for ope...
Take a look into the [FasterCSV][csv] gem. If all you need is excel support, you might also look into generating a xls directly. (See Spreadsheet::Excel) gem install fastercsv gem install spreadsheet-excel [csv]:http://fastercsv.rubyforge.org/classes/FasterCSV.html I find these options good for ope...
I'd look at the [Microsoft Velocity][1]. If you plan on creating an Enterprise application, this might be a good solution [1]: http://msdn.microsoft.com/en-us/data/cc655792.aspx
Other GUI-testing tools I can offer are: [Thoughtworks White][1], [PyWinAuto][2], [AutoIt][3], [AutoHotKey][4]. One thing to keep in mind when trying to automate GUIs is that the only way you can do that is to build the GUI with automation in mind. Crush devs that think their GUIs should not support testability ...
Gentoo is ultraminimalist by default. The install CD gets you a basic working system, a basic compile environment ( Some version of the GCC suite ), and package management. Its up to you then to install what you want to use. Its not like many other distributions where theres a big set of "default" packages ...
For a simple class it is often easiest to implement hashCode() based on the class fields which are checked by the equals() implementation. public class Zam { private String foo; private String bar; private String somethingElse; public boolean equals(Object obj) { ...
For a simple class it is often easiest to implement hashCode() based on the class fields which are checked by the equals() implementation. public class Zam { private String foo; private String bar; private String somethingElse; public boolean equals(Object obj) { ...
flungabunga: Your solution is very close to what I'm looking for. The only thing keeping me from doing this is having to store the relationships in memcache after each request and loading them back. I'm not sure how much of a performance hit this would mean, but it seems a little inefficient. I will do some tests ...
Yes, exceptions are expensive so there is a cost involved in catching and rethrowing or throwing a more useful exception. But wait a minute! If the framework code or the library you're using throws an exception then things are already coming unstuck. Do you have non-functional requirements for how quickly an error m...
Using iptables-save and iptables-restore to query and regenerate rules is easily the most efficient way of doing it. These used to, once, be shell scripts, but now they are C programs that work very efficiently. However, I should point out that there is a tool that you can use which will make maintaining iptables mu...
You should also check out the WAI-ARIA stuff: - [http://www.w3.org/WAI/intro/aria][1] - [http://alistapart.com/articles/waiaria][2] - [http://juicystudio.com/article/wai-aria-live-regions.php][3] And, for a perspective on the challenges actually faced by users with various disabilities when they try to u...
Your larger problem is blocking in signal handlers. This is usually discouraged since it can lead to strange timing conditions. But it's not quite the cause of your problem since the timing condition you're vulnerable to exists because of your choice of signal handlers. Anyway, here's how to at least minimize th...
What specifically does that question mean? Does *reverse* mean setting 1's to 0's and vice versa? Or does it mean *00001100* --> *00110000* where you reverse their order in the byte? Or perhaps just reversing the part that is from the first 1 to the last 1? ie. *00110101* --> *00101011*?
What specifically does that question mean? Does *reverse* mean setting 1's to 0's and vice versa? Or does it mean *00001100* --> *00110000* where you reverse their order in the byte? Or perhaps just reversing the part that is from the first 1 to the last 1? ie. *00110101* --> *00101011*? Assuming it means reve...
byte ReverseByte(byte b) { return b ^ 0xff; }
Reversing the order of bits: byte ReverseByte(byte b) { byte r = 0; for(int i=0; i<8; i++) { int mask = 1 << i; int bit = (b & mask) >> i; int reversedMask = bit << (7 - i); r |= (byte)reversedMask; } return r; ...
Reversing the order of bits in C#: byte ReverseByte(byte b) { byte r = 0; for(int i=0; i<8; i++) { int mask = 1 << i; int bit = (b & mask) >> i; int reversedMask = bit << (7 - i); r |= (byte)reversedMask; } retu...
Reversing the order of bits in C#: byte ReverseByte(byte b) { byte r = 0; for(int i=0; i<8; i++) { int mask = 1 << i; int bit = (b & mask) >> i; int reversedMask = bit << (7 - i); r |= (byte)reversedMask; } retu...
For the definitive answer go to the spec. :) Partition I, Section 12.6.6 of the CLI spec states: "A conforming CLI shall guarantee that read and write access to properly aligned memory locations no larger than the native word size is atomic when all the write accesses to a location are the same size." So that con...
Think of an index similar to a card catalog in the library. An index keeps you from having to search through every isle or shelf for a book. Instead, you may be able to find the items you want from a commonly used field, such as and ID, Name, etc. When you build an index the database basically creates something separat...
1) get the key with the same number of value 2) get the row with the same key/value in both tables 3) the key with the number of key value equal to the number of value is the target I hope its clear (you don't search performance don't you ?) declare @a table( pkid int, value int) declare @b table( oth...
the apple developer guide has a human computer interface guide - http://developer.apple.com/documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGIntro/chapter_1_section_1.html#//apple_ref/doc/uid/TP30000894-TP6 . Even though its targeted at the mac platform, you could learn something from it - its the reas...
If you ask a user to pick form a list of options and limit the number of choices it is likely that the first choice is there primary choice. e.g. Pick two, you will never have any of what you don't choose: - Money - Power - Sex - Excitement - Gadgets - Army of Coders. Was your first choice you primary ch...
Because it introduces a constraint on the possible values.
Password: No, this is not retained for security reasons - it's used, then discarded. You could retrieve the encrypted password for this user from the registry, given sufficient privileges, then decrypt it using something like [rainbow tables][1], but that's extremely resource intensive and time consuming using current ...
Note sure how it is done, but "Network Password Recovery" tool from http://www.nirsoft.net/utils/network_password_recovery.html seems to get the password from some cache.
[sventon][1] looks very interesting. It is a servlet/jsp solution written on top of the svnkit Java library. It can act as a true client, so it does not need direct access the repository (like ViewVC for example). It can use the access control of the repository itself. [1]: http://www.sventon.org/
jBPM, concurrent execution and process variables
|workflow|business-process-management|jbpm|
When a process in jBPM forks into concurrent paths, each of these paths gets their own copy of the process variables, so that they run isolated from each other. But what happens when the paths join again ? Obviously there could be conflicting updates. Does the context revert back to the state before the fork? Can...
These are interesting times for "the person backup question". There are several schools of thought now: 1. Frequent Automated Local Backup + Periodic Local Manual Backup >Automated: Scheduled Nightly backup to external drive. Manual: Copy to second external drive once per week / month / year / _oops-forgot_ ...
We're using [Xplanner](http://xplanner.org) right now, with pretty good results.
Make sure the AdsQueries use Synchronize to access the TAdsSettings if they are not in the main thread
Make sure the AdsQueries use Synchronize to access the TAdsSettings directly (or use a messaging system to comunicate between worker threads and main thread instead of accessing directly) if they are not in the main thread (i.e. `System.MainThreadID <> Windows.GetCurrentThreadID`)
You need to set the Content-Type header in your response, then send the data. Content_Type: application/vnd.ms-excel should do the trick. You may also want to set the Content-Disposition header so that it looks like an Excel document, and the browser picks a reasonable default file name; that's something like Conten...