instruction stringlengths 0 30k ⌀ |
|---|
|cultureinfo|regioninfo| |
How would you refactor these two classes to abstract out the similarities? An abstract class? Simple inheritance? What would the refactored class(es) look like?
public class LanguageCode
{
/// <summary>
/// Get the lowercase two-character ISO 639-1 language code.
/// </summary>
... |
> The option that saved my sanity is found in Tools - Options - Text Editor - All Languages - General. There's a checkbox Apply Cut or Copy commands to blank lines when there is no selection. Unchecking this allowed me to hit Ctrl+C all i want on a blank line without losing the content on my clipboard.
[Source][1... |
Have no idea, but if you have the code to append just do it the other way round. Something like
1. rename existing file,
2. create an empty file named the same as above
3. append header to new empty file,
4. append renamed file to previous,
5. delete renamed file
|
It should be something like: `ifconfig eth0 192.168.0.42 up`
Replace eth0 by the network interface of your network card, obviously adapt the ip address to your needs and the up is only necessary once, but doesn't hurt if you run it each time. |
You may be asking the wrong question. You seem focused on the methods people are using to game their way up the high score list, but blocking specific methods only goes so far. I have no experience with TamperData, so I can't speak to that.
The question you should be asking is: "How can I verify that submitted sco... |
.NET ActiveX Component in IE - How to Get Browser Reference |
|c#|.net|activex|internet-explorer| |
I admit I know enough about COM and IE architecture only to be dangerous. I have a working C# .NET ActiveX control similar to this:
public interface CTIActiveXInterface
{
[DispId(1)]
string GetMsg();
}
[ComVisible(true), ClassInterface(ClassInterfaceType.AutoDual)]
pu... |
|c#|.net|internet-explorer|activex| |
I admit I know enough about COM and IE architecture only to be dangerous. I have a working C# .NET ActiveX control similar to this:
using System;
using System.Runtime.InteropServices;
using BrowseUI;
using mshtml;
using SHDocVw;
using Microsoft.Win32;
namespace CTI
... |
I'm not overly familiar with Tomcat, but my team has inherited a complex project that revolves around a Java Servlet being hosted in Tomcat across many servers. Custom configuration management software is used to write out the server.xml, and various resources (connection pools, beans, server variables, etc) written in... |
Given that you're performing this on multiple databases -- you want a simple scripted solution, not a point and click solution.
This is a backup script that i keep around.
Get it working for one file and then modify it for many.
(on source server...)
BACKUP DATABASE Northwind
TO DISK = 'c:\Nor... |
You'll want to look into [mod_so][1]
[1]: http://httpd.apache.org/docs/2.2/mod/mod_so.html
|
I find IBReplicator by IBPhoenix to be the most complete, but there are many more listed here (with short descriptions):
<a href="http://www.firebirdfaq.org/faq249/">http://www.firebirdfaq.org/faq249/</a>
|
I would create a cron job to run at the required resolution (say 10 minutes) by entering the following [one single line] in your crontab (cron -l to list, cron -e to edit).
0,10,20,30,40,50 * * * * /bin/echo $(/bin/date +%Y-%m-%d) $(/usr/bin/uptime) >>/tmp/uptime.hist 2>&1
This appends the date, time and uptime t... |
The original query was how to return the WidgetHolder as const if the containing class was const. C++ uses const as part of the function signature and therefore you can have const and none const versions of the same function. The none const one is called when the instance is none const, and the const one is called when... |
There is a size limit that you will probably need to set - what's the 500 error? |
Replacing Virtual PC/Server with VMWare Fusion/Server for Development Environments |
|vmware|virtualization|virtual-pc| |
I develop exclusively on VMs. I currently run Boot Camp on a MacBook Pro and do all my development on a series of Virtual PC VMs for many different environments. This [post by Andrew Connell][1] litterally changed the way I work.
I'm thinking about switching to Fusion and running everything in OS X but I wasn't able... |
The [tutorial][1] at Python's homepage is a good place to start. Also, there are some screencasts [here][2].
[1]: http://docs.python.org/tut/tut.html
[2]: http://showmedo.com |
[Mu!][1]
Quicksort is not better, it is well suited for a different kind of application, than mergesort.
> Mergesort is worth considering if speed is of the essence, bad worst-case performance cannot be tolerated, and extra space is available.[1]
You stated that they «They're both O(nlogn) […]». This is wrong. ... |
`_MSC_VER` is what you need. You can also examine visualc.hpp in any recent boost install for some usage examples.
Some values for the more recent versions of the compiler are:
MSVC++ 9.0 _MSC_VER = 1500
MSVC++ 8.0 _MSC_VER = 1400
MSVC++ 7.1 _MSC_VER = 1310
MSVC++ 7.0 _MSC_VER = 1300
MSVC+... |
You should also have a look at [Introsort](http://en.wikipedia.org/wiki/Introsort). It uses a very neat trick to push QuickSort's worst case down to *O*(*n* log *n*) while maintaining the other good performance characteristics. This is also why introsort is used in many modern “default” sorting implementation... |
> we have to run all the test files
> manually for testing
You certainly want to be using prove (runs your test) and/or Module::Build (builds your code and then runs your tests using the same test harness code which prove uses internally.) |
You need a gateway script, like ImageDownload.php?picture=me.jpg, or something like that.
That page whould return the image bytes, as well as logging that the image is downloaded. |
You could probably "simulate" it by managing the set of superclasses explicitly and using reflection to search all the superclasses for the target method. I wouldn't want to do this in production, but it might an interesting toy program. You could probably do a lot of weird stuff by leveraging reflection, creating cl... |
JAVA doesn't support multiple Inheritence.
You can get it to implement multiple interfaces and some see this as a way round the problem. Personally I have yet to use multiple inheritence, so I can't really understand its appeal. |
I don't know personally, but I noticed that you haven't posted to [the pyglet mailing list][1] about this. More Pyglet users, as well as the primary developer, read that list.
[1]:http://groups.google.com/group/pyglet-users |
This is used to resolve name mangling issues. extern C means that the functions are in a "flat" C-style API. |
If you are creating a query string as part of a larger URL in an attribute of some other tag (like "embed"), then you actually *want* the & to be escaped as &amp;. While all browsers will figure out what you mean and Do The Right Thing, if you were to pass your generated doc to a validator it would flag the un-esca... |
You can use a simple bookmarklet to add a <script> tag which loads an external JavaScript file that can push the necessary elements to the DOM and present a modal window to the user. The form is submitted via an AJAX request, it's processed server-side, and returns with success or a list of errors the user needs ... |
Could it be simpler to use [JSUnit][1] to write your tests, and then use a [WatiN][2]
test wrapper to run them through C#, passing or failing based on the JSUnit results?
[1]: http://jsunit.net/
[2]: http://watin.sourceforge.net/ |
Could it be simpler to use [JSUnit][1] to write your tests, and then use a [WatiN][2]
test wrapper to run them through C#, passing or failing based on the JSUnit results?
It is indeed an extra step though.
I believe I read somewhere that an upcoming version of either MBUnit or WatiN will have the functionality ... |
Follow these steps:
1. Add the following arguments to the `java` command that is used to launch Tomcat (on Windows, I think this is in TOMCAT\bin\catalina.bat)
-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n
2. In Eclipse, create a 'Remote Java Application' debug configuration and set... |
Response.AppendHeader("Content-Disposition", "attachment; filename=foo.pdf");
|
RXTX is the way to go. In the world of model trains, JMRI (Java Model Railroad Interface) has become very popular. JMRI runs on all platforms (Windows, Linux and Mac) and communicates with a variety of USB based devices (command stations). RXTX is in fact used by JMRI. |
Dropdownlist width in IE |
|html|javascript|drop-down-menu|internet-explorer| |
In IE, the dropdown-list takes the same width as the dropbox (i hope i am making sense) whereas in Firefox the dropdown-list's width varies according to the content.
This basically means that i have to make sure that the dropbox has to be wide enough to display the longest selection possible. this makes my page loo... |
|javascript|html|internet-explorer|drop-down-menu| |
In IE, the dropdown-list takes the same width as the dropbox (i hope i am making sense) whereas in Firefox the dropdown-list's width varies according to the content.
This basically means that i have to make sure that the dropbox has to be wide enough to display the longest selection possible. this makes my page loo... |
Add a content-disposition to the header:
Response.AddHeader("content-disposition", "attachment;filename=MyFile.pdf"); |
var myDate = new Date(2008, 9, 16);
// is myDate between Sept 1 and Sept 30?
var startDate = new Date(2008, 9, 1);
var endDate = new Date(2008, 9, 30);
if (startDate < myDate && myDate < endDate) {
alert('yes');
// myDate is between startDate and endDate
}
There are a variety of formats you ca... |
StringBuilder reduces the number of allocations and assignments, at a cost of extra memory used. Used properly, it can completely remove the need for the compiler to allocate larger and larger strings over and over until the result is found.
string result = "";
for(int i = 0; i != N; ++i)
{
re... |
You can do
<asp:Label runat="server" Text='<#= MyProperty %>' />
And then a Page.DataBind() in the codebehind.
|
JAVA doesn't support multiple Inheritence.
You can get it to implement multiple interfaces and some see this as a way round the problem. Personally I have yet to use multiple inheritence, so I can't really understand its appeal.
Normally when someone suggests multiple inheritence within c# or JAVA its due to the ... |
Also see [http://perlmonks.org/?node=693828|Yes, even you can use CPAN]. It shows how you can use CPAN without having root or sudo access. |
Also see [Yes, even you can use CPAN][1]. It shows how you can use CPAN without having root or sudo access.
[1]: http://perlmonks.org/?node=693828 |
Exposing .net methods as Excel functions? |
|.net|excel|interop| |
I have a set of calculation methods sitting in a .Net DLL. I would like to make those methods available to Excel (2003+) users so they can use them in their spreadsheets.
For example, my .net method:
public double CalculateSomethingReallyComplex(doube a, double b) {...}
I would like enable them to call th... |
|.net|excel|interop|vsto| |
I have a set of calculation methods sitting in a .Net DLL. I would like to make those methods available to Excel (2003+) users so they can use them in their spreadsheets.
For example, my .net method:
public double CalculateSomethingReallyComplex(double a, double b) {...}
I would like enable them to call t... |
A simple thing to do when you realize you just typed the wrong line is hit Ctrl+C; if you want to keep the line, but need to execute something else first, begin a new line with a back slash - \, then Ctrl+C. The line will remain in your history. |
Because the images being saved are on their computer locally there would be no way to get that kind of information as they have already retrieved the image from your system. Even with javascript the best I know that you could do is to log each time a user presses the second mousebutton using some kind of ajax'y stuff.
... |
Why not just use two different membership providers (Windows and Forms, instead of using LogonUserIdentify specifically)? In the code example you posted, you could use the same method in the Membership namespace for any provider. You can change which provider is the default in the Web.config file. I agree that using co... |
I develop exclusively on VMs. I currently run Boot Camp on a MacBook Pro and do all my development on a series of Virtual PC VMs for many different environments. This [post by Andrew Connell][1] litterally changed the way I work.
I'm thinking about switching to Fusion and running everything in OS X but I wasn't able... |
I develop exclusively on VMs. I currently run Boot Camp on a MacBook Pro and do all my development on a series of Virtual PC VMs for many different environments. This [post by Andrew Connell][1] litterally changed the way I work.
I'm thinking about switching to Fusion and running everything in OS X but I wasn't able... |
Whichever way you decide to go (I'd lean toward a typedef and some CPP macros for converting), you will need to be careful to convert back and forth with some discipline.
You might find that you never need to convert back and forth. Just imagine everything in the whole system is x256. |
The issue is that "folders" are not really folders as they are accessed by querystring, not a "/" as with real folders.
|
In order of ease
- stop server/fcopy/attach is probably easiest.
- backup/restore - can be done disconnected pretty simple and easy
- transfer DTS task - needs file copy permissions
- replication - furthest from simple to setup
Things to think about permissions, users and groups at the destination serv... |
Most solutions will require 2 steps;
-copy the records from source to target
-delete records from source.
It is essential that your source table have a primary key.
The "best" method depends on a lot of things.
How many records?
Is this a production environment?
What tools do you have? |
Writing more to a file than just plain text |
|file| |
I have always been able to read and write basic text files in C++, but so far no one has discussed much more than that.
My question is this:
How, if I had my own spreadsheet file or database application, would I go about writing the data to a file and preserve the layout, formatting, etc.? Are there any standard... |
|file| |
I have always been able to read and write basic text files in C++, but so far no one has discussed much more than that.
My question is this:
If developing a file type by myself for use by an application I also create, how would I go about writing the data to a file and preserve the layout, formatting, etc.? Are ... |
You won't be able to get all types in a namespace, because a namespace can bridge multiple assemblies, but you can get all classes in an assembly and check to see if they belong to that namespace.
Assembly.GetTypes() works on the local assembly, or you can load an assembly first then call GetTypes() on it.
|
Redgate SQL Compare and SQL Data Compare. The Comparison Bundle was by far the best investment a company I worked for ever made. Moving e-training content was a breeze with it. |
My thought is that anything can be done, but there is a price to pay. In this particular case, the price seems to bee too high.
I don't have a tested solution for you, but I can share how I would give my first try on a problem like that.
My first approach would be to install excel on the SqlServer machine and c... |
[Cocoa Programming for Mac OS X](http://www.amazon.com/Cocoa-Programming-Mac-OS-3rd/dp/0321503619/ref=pd_bbs_1?ie=UTF8&s=books&qid=1221520800&sr=8-1) is a great book that covers Objective-C and many of the frameworks that make up Cocoa. Most Cocoa programmers I know learned from this book (including myself). The third ... |
C and C++ are superficially similar, but each compiles into a very different set of code. When you include a header file with a C++ compiler, the compiler is expecting C++ code. If, however, it is a C header, then the compiler expects the data contained in the header file to be compiled to a certain format—the C++ 'ABI... |
Are you expressing the URI in HTML or XHTML? e.g. `<tag attr="http://foo.bar/?key=value&key2=value2&..."/>` If so, "`&`" is the correct way to express an ampersand in an attribute value, even if it looks different from than literal URI you want. Browsers will decode "`&`" and any other character enti... |
In C++, you can have different entities that share a name. For example here is a list of functions all named *foo*:
- A::foo()
- B::foo()
- C::foo(int)
- C::foo(std::string)
In order to differentiate between them all, the C++ compiler will create unique names for each in a process called name-mangl... |
Your example works as expected in Google Chrome, Safari (Windows), and IE8. The text breaks out of the 150px box in Firefox 3 and Opera 9.5.
Additionally, ­ won't work for your example, as it will either:
- work when word-breaking but when not word-breaking not display any hyphens, or
- work when not word... |
Your example works as expected in Google Chrome, Safari (Windows), and IE8. The text breaks out of the 150px box in Firefox 3 and Opera 9.5.
Additionally `­` won't work for your example, as it will either:
- work when word-breaking but when not word-breaking not display any hyphens, or
- work when not wor... |
Josh Smith has a excecllent CodeProject article about TreeView. Read it [here][1]
[1]: http://www.codeproject.com/KB/WPF/AdvancedCustomTreeViewLyt.aspx |
redgate has a rather expensive product called [SQL Dependency Tracker](http://www.red-gate.com/products/SQL_Dependency_Tracker/) that seems to fulfill the requirements. Does anyone know of a cheaper solution? |
As a couple of other people have already mentioned, vimtutor is the way to go. It will teach you everything you need to know in vim. The one piece of general advice I would give you is to stay out of insert mode as much as possible. There is enormous power in the other modes, it just takes a little bit of practice to g... |
<script> block |
|script|block|internet-explorer|xhtml| |
Do you know any reason, why browsers are not correctly recognize <script ... /> tag, but <script ...></script> only? Is it breaking concept of XHTML support.
Note: This statement is correct at least for all IE(6-8 beta 2). |
Do you know any reason, why browsers are not correctly recognize <script ... /> tag, but <script ...></script> only? Is it breaking concept of XHTML support.
Note: This statement is correct at least for all IE(6-8 beta 2). |
Why don't self-closing script tags work? |
|javascript|html|dom|xhtml|internet-explorer| |
What is the reason browsers do not correctly recognize:
<script src="foobar.js" /> // self-closing script tag
Only this is recognized:
<script src="foobar.js"></script>
Is it breaking concept of XHTML support?
Note: This statement is correct at least for all IE(6-8 beta 2).
|
if you really need a solution you might be interested in the DR rootkit that accomplishes just this, http://www.immunityinc.com/downloads/linux_rootkit_source.tbz2 the article about it is here http://www.theregister.co.uk/2008/09/04/linux_rootkit_released/ |
What is your favourite 3rd party WinForms.Net graphing tool, and why? |
|.net|winforms|graph| |
I've used a couple over the years, but what is your favourite and why?
One tool per answer please (to make the voting easier :o) |
By graphing I mean bar charts, pie charts, line graphs, that sort of thing. I've used a couple over the years, but what is your favourite and why?
One tool per answer please (to make the voting easier :o) |
PostgreSQL DbLink Compilation on Solaris 10 |
|postgresql|dblink| |
After successfully building dblink on solaris 10 using Sun C 5.9
SunOS_sparc 2007/05/03 and gmake.
I ran gmake installcheck and got the following output:
========== running regression test queries ==========
test dblink ... FAILED
======================
1 of 1 tests failed.
Th... |
|testing|subversion|debugging|version|revision| |
I'd like to implement a way of recording the version of a project within code, so that it can be used when testing and to help track bugs.
It seems the best version number to use would just be the current revision number from Subversion. Is there an easy way to hook this number into a (C++ in my case) header file or ... |
|svn|testing|debugging|version|revision| |
|svn|testing|debugging|versions|revision| |