instruction stringlengths 0 30k ⌀ |
|---|
This is just something that I thought of, but check to see how much memory SQL Server is using when you have 20+ users - one of the limitations of the Express version is that it is [limited to 1GB of RAM][1]. So it might just be a simple matter of there not being enough memory available to to server due to the limitati... |
My vote is two parameters for conversion types, one for the value (as in your first example). I would use enums instead of string literals, however. |
Use enums, if your language allows it, for the unit specifications.
I'd say the code inside would be easier with two. I'd have a table with pre-add, multiplty, and post-add, and run the value through the item for one unit, and then through the item for the other unit in reverse. Basically converting the input temper... |
Generally you have to have your data ready before you start writing a session. What you could do is grab the first image before starting the first session and then grabbing the rest in the background and write new sessions as they've been paged down.
Also, vbAccelerator has a great [IMAPI Wrapper for .NET][1]
... |
To expand on the link given in the question:
1. Create a package variable
2. Double click on the package variable name. (This allows you to access the properties of the variable)
3. Set the property 'EvaluateAsExpression' to true
4. Enter the query in the expression builder.
5. Set the OLE DB source query t... |
In general, you should favor interfaces over abstract classes. One reason to use an abstract class is if you have common implementation among concrete classes. Of course, you should still declare an interface (IPet) and have that abstract class (PetBase) implement that interface. Interfaces allow the maximum amount of ... |
In general, you should favor interfaces over abstract classes. One reason to use an abstract class is if you have common implementation among concrete classes. Of course, you should still declare an interface (IPet) and have that abstract class (PetBase) implement that interface. Interfaces allow the maximum amount of ... |
In general, you should favor interfaces over abstract classes. One reason to use an abstract class is if you have common implementation among concrete classes. Of course, you should still declare an interface (IPet) and have an abstract class (PetBase) implement that interface. Interfaces allow the maximum amount of fl... |
In general, you should favor interfaces over abstract classes. One reason to use an abstract class is if you have common implementation among concrete classes. Of course, you should still declare an interface (IPet) and have an abstract class (PetBase) implement that interface.Using small, distinct interfaces, you can ... |
You can use the `:binary` type in your ActiveRecord migration and also constrain the maximum size:
class BlobTest < ActiveRecord::Migration
def self.up
create_table :files do |t|
t.column :file_data, :binary, :limit => 1.megabyte
end
end
end
ActiveRecord exposes... |
Use source control to keep a central repository of all your code. Then each user checks out their own copy of the source code and works locally. Then submits only the code that changed.
http://en.wikipedia.org/wiki/Revision_control
|
Here's a much more efficent implementation:
static SortedDictionary<T,bool>.KeyCollection FindCommon<T> (List<List<T>> items)
{
SortedDictionary<T, bool>
current_common = new SortedDictionary<T, bool> (),
common = new SortedDictionary<T, bool> ();
foreach (List<T> list in i... |
What you need is source control.
You should definitely not open the same files over the network on multiple machines. For one thing, Visual Studio has safeguards in place to prevent you from modifying certain files during a build, but it has none of that that will prevent others from modifying the same files over th... |
This might sound snide, but if you're opening up the solution from a shared location then you're doing something wrong. If that's the case then you should start using source control (something like Subversion) and have everyone check out a copy of the project to work on.
However if you're already using source contr... |
Hmm... I'd define "building" as something like "preparing, packaging and deploying all artifacts of a software system". The compilation to machine code is only one of many steps in the build. Others might be checking out the latest version of the code from scm-system, getting external dependencies, setting configuratio... |
Hmm... I'd define "building" as something like "preparing, packaging and deploying all artifacts of a software system". The compilation to machine code is only one of many steps in the build. Others might be checking out the latest version of the code from scm-system, getting external dependencies, setting configuratio... |
Your simple case can easily be built using the `string::find` method. However, take a look at [Boost.Tokenizer](http://www.boost.org/doc/libs/1_36_0/libs/tokenizer/index.html). It's great. Boost generally has some very cool string tools. |
Depends how many conversions you are going to have. I'd probably choose one parameter, given as an enum: Consider this expanded version of conversion.
enum Conversion
{
CelsiusToFahrenheit,
FahrenheitToCelsius,
KilosToPounds
}
Convert(Conversion conversion, X from);
You n... |
1. You may be running into concurrency issues, depending on how your application runs. Try performing your reads with the "nolock" keyword.
2. Try adding in table aliases for your columns (and avoid the use of SELECT *), this helps out MSSQL, as it doesn't have to "guess" which table the columns come from.
3. I... |
1. You may be running into concurrency issues, depending on how your application runs. Try performing your reads with the "nolock" keyword.
2. Try adding in table aliases for your columns (and avoid the use of SELECT *), this helps out MSSQL, as it doesn't have to "guess" which table the columns come from.
3. I... |
Change it to:
protected static <T extends Comparable<T>> int nullCompare(T o1, T o2) {
You need that because Comparable is itself a generic type. |
Does your App use RMI over TCP? If not, is it possible that this is a heisenbug, caused by instrumenting the VM? I assume VisualVM must use RMI calls to figure out what's going on in the JVM.... |
Part of the confusion is that "Flash" means multiple things. Flash can mean one of a multitude of applications, OR the general technology behind SWFs.
There's the [Flash CS3][1] product that Adobe sells. This is generally targeted at designers and uses a Timeline-based approach to creating SWFs. Previously the Fl... |
You can't. Alert boxes don't support html. You should display the error as part of the page, it's nicer than JS alerts anyway. |
You might consider inserting placeholders like `<my:contact-us-form/>` in the database on specific pages; that way the database can describe all the static text content instead of completely replacing that database-driven content with an `.ascx` control. |
If you are on windows and need to handle errors like divide by zero and access violation you can use a structured exception translator. And then inside of your translator you can throw a c++ exception:
void myTranslator(unsigned code, EXCEPTION_POINTERS*)
{
throw std::exception(<appropriate string ... |
If you are on windows and need to handle errors like divide by zero and access violation you can use a structured exception translator. And then inside of your translator you can throw a c++ exception:
void myTranslator(unsigned code, EXCEPTION_POINTERS*)
{
throw std::exception(<appropriate string ... |
If you want each Alpha to be related to by only one Bravo I would vote for the possibility with using a combined FK/PK:
Bravos
--------
FK PK AlphaId
BravoOne
BravoTwo
BravoThree
This way one and only one Bravo may refer to your Alphas.
If the Bravos a... |
Thanks for the input. I figured it was impossible without parsing (or using xsl, etc)... Oh well. |
The only disadvantage I can see is that it makes the API slightly more confusing. Let's say you have some collection object with a remove() method that would normally return void. Now you want to return a reference to the collection itself. The new signature would look like:
public MyCollection remove(Object ... |
What are you currently using for data access? |
|data-structures|persistence|data-access|data-binding| |
What particular method/application are you using to communicate between your application and a database? Custom code with stored procedures? SubSonic? nHibernate? Entity Framework? LINQ? |
|data-structures|data-binding|persistence|data-access| |
|.net|data-structures|data-binding|data-access| |
I have used the open-source [com0com][1] on windows for this before, and it worked well. The related com2tcp project was more challenging to get working reliably.
[1]: http://com0com.sourceforge.net/ |
As mentionned in the Qt documentation about [QCoreApplication::postEvent](http://doc.trolltech.com/4.3/qcoreapplication.html#postEvent) :
>When control returns to the main event loop, all events that are stored in the queue will be sent using the notify() function.
...which explains why the Qt Event Handler holds ... |
If you're willing to use C, you can use the [strtok][1] function. You should pay attention to multi-threading issues when using it.
[1]: http://www.cplusplus.com/reference/clibrary/cstring/strtok.html |
I used Hibernate in my previous job to connect to both MySql and Sql Server but I have since switched over to .NET so currently I work with LINQ and I really enjoy it. |
I believe [Firebug][1] includes profiling of JS code. Of course, it's not available in all the major browsers--only Firefox.
[1]: https://addons.mozilla.org/en-US/firefox/addon/1843 |
We're currently using WindowsFormsHost in our software to host the WinForms DataGridView control, and we've not had any real problems with it. A few things to watch out for though:
The first is the [air-space restrictions](http://msdn.microsoft.com/en-us/library/aa970688.aspx). Practically speaking, this means that ... |
Microsoft ships all its C/C++ software optimized for size. After benchmarking they discovered that it actually gives better speed (due to cache locality). |
I have to agree with Thomas. If you use lists like arrays then that's just going to be slow (and possibly awkward). So you should either use arrays or stick with the functions you've written but move them "up" in a way so that you can easily replace the slow lists with arrays later. |
|methodology|quality|success|roi| |
UPDATED: I'm asking this from a **development perspective**, however to illustrate, a canoical *non-development* example that comes to mind is that if it costs, say, $10,000
to keep a uptime rate of 99%, then it theoretically can cost $100,000 to keep a rate
of 99.9%, and possibly $1,000,000 to keep a rate of 99.99... |
<I>truncate table client_log</I>
is your best bet, truncate kills all content in the table and indices and resets any seeds you've got too. |
Hidden features of Ruby |
|ruby| |
Continuing the "Hidden features of ..." meme, let's share the lesser-known but useful features of Ruby programming language.
Try to limit this discussion with core Ruby, without any Ruby on Rails stuff.
See also:
* [Hidden features of C#](http://stackoverflow.com/questions/9033/hidden-features-of-c);
* [Hidde... |
Continuing the "Hidden features of ..." meme, let's share the lesser-known but useful features of Ruby programming language.
Try to limit this discussion with core Ruby, without any Ruby on Rails stuff.
See also:
* [Hidden features of C#](http://stackoverflow.com/questions/9033/hidden-features-of-c);
* [Hidde... |
|ruby|hidden-features| |
The following works in IE7, IE6, and FF3. The key was to use a:link:hover. IE6 turned the A element into a block element which is why I added the float stuff to shrink-wrap the contents.
Note that it's in Standards mode. Dont' know what would happen in quirks mode.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4... |
A few things:
- I'd use an enumerated type that a syntax checker or compiler can check rather than a string that can be mistyped. In Pseudo-PHP:
define ('kCelsius', 0); define ('kFarenheit', 1); define ('kKelvin', 2);
$a = ConvertTemperature(22, kCelsius, kFarenheit);
Also, it seems more natural to m... |
I would choose
> Example 1 - separate parameters: function convertTemperature("celsius", "fahrenheit", 22)
Otherwise within your function definition you would have to parse "c-f" into "celsius" and "fahrenheit" anyway to get the required conversion scales, which could get messy.
If you're providing something ... |
I spent a while working with search engine software - You wouldn't believe how many web sites serve up content with HTTP headers or meta tags which lie about the encoding of the pages. Often, you'll even get a document which contains both ISO-8859 characters and UTF-8 characters.
Once you've battled through a few of... |
In this case single parameters looks totally obscure;
Function convert *temperature* from *one scale* to *another scale*.
IMO it's more natural to pass source and target scales as separate parameters. I definitely don't want to try to grasp format of first argument.
|
Nothing is less secure than storing plain-text passwords. If you're using a decent hashing algorithm (at least SHA-256, but even SHA-1 is better than nothing) then yes, collisions are possible, but it doesn't matter because given a hash, it's impossible* to calculate what strings hash to it. If you hash the username WI... |
What platforms JavaFX is/will be supported on? |
|java|javafx| |
I have read about JavaFX, and like all new technologies I wanted to get my hands "dirty" with it. However, although it talks of multiplatform support, I can't find specifics on this.
What platforms support a JavaFX application? All those with Java SE? ME? Does it depend upon the APIs in JavaFX that I use? |
A regexp is not a best tool for the job.
[Perl FAQ][1]:
C comments:
#!/usr/bin/perl
$/ = undef;
$_ = <>;
s#/\*[^*]*\*+([^/*][^*]*\*+)*/|([^/"']*("[^"\\]*(\\[\d\D][^"\\]*)*"[^/"']*|'[^'\\]*(\\[\d\D][^'\\]*)*'[^/"']*|/+[^*/][^/"']*)*)#$2#g;
print;
C++ comments:
#!/usr/local/... |
Or use window.open and put the [link there][1].
[1]: http://qa.techinterviews.com/q/20060809080754AAs7gKM |
Even if you could, `alert()` boxes are generally modal - so any page opened from one would have to open in a new window. Annoying! |
alert("There was an error. Got to this page to fix it.\nwww.TheWebPageToFix.com");
That's the best you can do from a javascript alert. Your alternative option is to try and open a new tiny window that looks like a dialog. With IE you can open it modal.
|
Saikuro and Flog can be good for getting a basic idea of code complexity. You can also use a tool like rcov to look at your test coverage.
There is a plugin for Rails projects that combine all those metrics into a single rake task. It is called [metric_fu][1].
[1]: http://metric-fu.rubyforge.org/ |
Yes/No dialog in Java ME |
|user-interface|java-me|midlet| |
I'm looking for a simple solution for a yes/no dialog to use in a Java ME midlet. I'd like to use it like this but other ways are okey.
if (YesNoDialog.ask("Are you sure?") == true) {
// yes was chosen
} else {
// no was chosen
}
|
|java|user-interface|java-me|midlet| |
cvs history -u username
gives a history of changes the user has made |
Is this what you are trying to accomplish? If not, please explain what is different than the image below?
![alt text][1]
[1]: http://content.screencast.com/users/jessegavin/folders/Jing/media/a7adbb3d-dfc9-4f57-9cca-c47e9d399dd0/2008-09-11_1259.png |
Take advantage of the namespace settings. You can get to it in properties from clicking in the white space of the ORM.
This allows me to have a Users table and a User class for one set of business rules and a second (but the same data store) Users table and a User class for another set of business rules.
Or, brea... |
I started using the side\palm of my hands to hit the control key instead of my pinky fingers. My understanding is that on more ergonomic keyboards the control key button is bigger which makes it easier to perform that motion. |
You can try sorting using the Windows API and callbacks: [Link][1]
Alternatively, you could try switching to a [vbAccelerator ListView][2]; I highly recommend it.
[1]: http://vbnet.mvps.org/index.html?code/callback/lvsortcallback.htm
[2]: http://www.vbaccelerator.com/home/VB/Code/Controls/ListView/article.... |
For the sake of keeping things simple, I think this is pretty much a non-issue. Your implementation is flexible enough that if the requirements change in the future, you aren't forced into a refactoring. Also, adding more logic to your code for a hybrid solution just isn't worth it taking into account your small data s... |
Can a Linq query retrieve BLOBs from a Sql Database? |
|sql-server|linq-to-sql|blob| |
And how do they come out? |
We've got an oracle back end with something like 500 stored procedures where applications run directly against the data.
I started building a custom or-mapped domain model that I've been integrating but I did it wrong initially and now am stuck dealing with that headache as well...ugh |
You can make the sub classes child classes, something like this:
public abstract class AbstractClass
{
public static AbstractClass MakeAbstractClass(string args)
{
if (args == "a")
return new ConcreteClassA();
if (args == "b")
return new ConcreteClassB()... |
You can make the sub classes child classes, something like this:
public abstract class AbstractClass
{
public static AbstractClass MakeAbstractClass(string args)
{
if (args == "a")
return new ConcreteClassA();
if (args == "b")
return new ConcreteClassB()... |
You can make the sub classes child classes, something like this:
public abstract class AbstractClass
{
public static AbstractClass MakeAbstractClass(string args)
{
if (args == "a")
return new ConcreteClassA();
if (args == "b")
return new ConcreteClassB()... |
As [@Kent Boogaart mentioned][1], I've run into the situation where a WPF application hosted in WinForms doesn't have the WPF Application object (i.e. Application.Current). This can cause many issues such as Dispatchers not invoking threads back to the UI thread. This would only apply if you're hosting in WinForms, not... |
Hopefully you can't.
A service running as the local machine should not be clearing my Recycle bin, ever.
You could promote the service to run as an Admin account then it would have the right (and be a security risk), but why do you want to do this? It sounds like the sort of think Viruses try to do. |
I can't claim to know much about it, but I don't think it's that straightforward - Carl Franklin of [DotNetRocks][1] fame has done a fair bit with it - have you seen [his DNRTV][2]?
[1]: http://www.dotnetrocks.com/
[2]: http://dnrtv.com/default.aspx?showID=110 "DNR TV" |
First, have you tried running the service on an interactive user account? Maybe SHEmptyRecycleBin requires an interactive user even though it doesn't necessarily display a Window.
Second, I'm not sure it's a good idea to delete other users' stuff but I guess you have a very good reason? |
I found [iphone-universal][1] on Google Code the other day. Haven't had a chance to try it out but it looks promising.
[1]: http://code.google.com/p/iphone-universal/ |
I think you'll need to p/invoke out to the windows api to be able to play midi files from .net.
I thought this codeproject article did quite a good job on explaining how to do this:
[vb.net article to play midi files][1]
To rewrite this is c# you'd need the following import statement for mciSendString:
[D... |
I'm working on a C# MIDI application at the moment, and the others are right - you need to use p/invoke for this. I'm rolling my own as that seemed more appropriate for the application (I only need a small subset of MIDI functionality), but for your purposes the <A href="http://www.codeproject.com/KB/audio-video/MIDITo... |
It's possible to open multiple databases at once in Sqlite, but it's doubtful if can be done when working from Flex/AIR. In the command line client you run <code>ATTACH DATABASE path/to/other.db AS otherDb</code> and then you can refer to tables in that database as <code>otherDb.tableName</code> just as in MySQL or SQL... |
This *looks* good, but unfortunately it's being licensed under GPLv3, so I'm actually a bit afraid to start looking at that code. The framework I either need to find, or develop if needs be, must be able to be used as part of a commercial program, without having to license the entire program different. Commercial libra... |
I discovered the **TRUNCATE TABLE** in the msdn transact-SQL reference. For all interested here are the remarks:
TRUNCATE TABLE is functionally identical to DELETE statement with no WHERE clause: both remove all rows in the table. But TRUNCATE TABLE is faster and uses fewer system and transaction log resources than ... |
It took them long enough to add support for this,
[System Tray][1]
[1]: http://java.sun.com/docs/books/tutorial/uiswing/misc/systemtray.html |
What you want to look at is the WS-Discovery protocol. I found a sample on [netfx3's][1] website of using the [specification][2]. I would recommend searching services based on scope, by probing for services based on a specific endpoint.
[1]: http://wcf.netfx3.com/files/folders/protocol_channels/entry7909.aspx
... |
UserControl Property of type Enum displays in designer as bool or not at all |
|c#|visual-studio|enums|user-controls| |
I have a usercontrol that has several public properties. These properties automatically show up in the properties window of the VS2005 designer under the "Misc" category. Except two of the properties which are enumerations don't show up correctly.
The first on uses the following enum:
public enum VerticalCo... |
To output the list into multiple grouped tag you can loop in this fashion.
<cfset list="1,2,3,4,5,6,7,8,9,10,11,12,13,14">
<cfset numberOfColumns = "3">
<cfoutput>
<cfloop from="1" to="#numberOfColumns#" index="col">
<ul>
<cfloop from="#col#" to="#listLen(list)#" index="i"... |
A regexp is not the best tool for the job.
[Perl FAQ][1]:
C comments:
#!/usr/bin/perl
$/ = undef;
$_ = <>;
s#/\*[^*]*\*+([^/*][^*]*\*+)*/|([^/"']*("[^"\\]*(\\[\d\D][^"\\]*)*"[^/"']*|'[^'\\]*(\\[\d\D][^'\\]*)*'[^/"']*|/+[^*/][^/"']*)*)#$2#g;
print;
C++ comments:
#!/usr/loca... |
When writing such designs, I like to think to myself, "If I needed to add an extra unit, what would design would make it the easiest to do so?" Doing this, I come to the conclusion that enums would be easiest for the following reasons:
1) Adding new values is easy.
2) I avoid doing string comparison
However, how... |