instruction stringlengths 0 30k ⌀ |
|---|
|math|latex|symbols|angle| |
How do I set the symbol for the *angle* or *annuity* operation in LaTeX? Specifically, this is the actuarial *a* angle *s* = (1-v<sup>s</sup>)/i. |
You could probably insert the data from Application A into a 'temporary' area so that Application B can do the inserts of both A and B without changing much in either appplications. It's not particularly elegant but it might do the trick.
In another scenario you could add a 'confirmation' flag field to your data wh... |
SQL: IF clause within WHERE clause |
|mssql| |
Is it possible to use an **IF** clause within a **WHERE** clause in MS SQL?
Example:
WHERE
IF IsNumeric(@OrderNumber) = 1
OrderNumber = @OrderNumber
ELSE
OrderNumber LIKE '%' + @OrderNumber |
|sql-server|sql|t-sql| |
|sql|sql-server|t-sql| |
Is it possible to use an **IF** clause within a **WHERE** clause in MS SQL?
Example:
WHERE
IF IsNumeric(@OrderNumber) = 1
OrderNumber = @OrderNumber
ELSE
OrderNumber LIKE '%' + @OrderNumber + '%' |
This [article][1] seems to Discuss something quite like what you're talking about.
Good luck.
Ola
[1]: http://www.codeguru.com/csharp/.net/net_general/visualstudionetadd-ins/article.php/c12645__2/ |
Take a look at .htaccess if you're using apache: [.htaccess tutorial][1]
[1]: http://httpd.apache.org/docs/1.3/howto/htaccess.html |
Like @Alexander-Klyubin suggests, do the move in the repository. It's also going to be much faster, especially if you have a large amount of data to move, because you won't have to transfer all that data over the network again.
svn mv https://username@server/svn/old/ https://username@server/svn/new/
should wo... |
I agree with the answer that the semantics are highly database specific, which is why I think the important answer is that you *shouldn't* do this. A change in JDBC driver or something similar could cause the implicit behaviour to break.
Instead, If using raw JDBC, have the code take the boolean and convert it to a... |
I don't know Hyper-V, but I know in VMWare you can create a network connection in Bridged mode (meaning the VM will get it's own IP address via DHCP if that's enabled) or host-only mode (meaning the VM can only communicate with the host). When Vista could see the card, could it communicate with the host machine (which... |
The question isn't really specific enough to answer. From a high level point of view, presumably this notification would be sent from the server process and not client side via JavaScript. Without knowing the server side development language I can't say what specific libraries might be available, however there is the... |
If you're writing a comparator class, you should implement your own compare method that will compare two strings character by character. This compare method should check if you're dealing with alphabetic characters, numeric characters, or mixed types (including spaces). You'll have to define how you want a mixed typ... |
This post is really quite unclear. The question appears to be "Are there compilers for functional languages which can produce native executables without the need to install additional software?"
The answer, generally, is yes. For example, [Haskell](http://www.haskell.org/) has [a compiler](http://www.haskell.org/g... |
For the most part, false is defined as 0, and true is non-zero. Some programming languages use 1, some use -1, and some use any non-zero value.
For Unix shells though, they use the opposite convention.
Most commands that run in a Unix shell are actually small programs. They pass back an exit code so that you can ... |
Yes. A very simple example is:
var metadata=<>
// ==UserScript==
// @name Reading metadata
// @namespace http://www.afunamatata.com/greasemonkey/
// @description Read in metadata from the header
// @version 0.9
// @include http://stackoverflow.com/qu... |
Funny enough, I just solved this issue by ensuring that I specify the iframe dimensions by pixel.
|
How to unit-test inheritance? |
|inheritance|unit-testing|oop|php| |
When you use composition, then you can mock the other objects
from which your class-under-test depends, but when you use
inheritance, you can't mock the base class. (Or can you?)
I generally try to [prefer composition over inheritance](http://stackoverflow.com/questions/49002/prefer-composition-over-inheritance),
... |
|inheritance|unit-testing|oop|php|phpunit| |
How do I unit-test inheriting objects? |
|php|unit-testing|oop|inheritance|phpunit| |
My definition would be a language that is typically distributed as source rather than as a binary. |
How do I read text from the (windows) clipboard from python? |
|python| |
How do I read text from the (windows) clipboard from python? |
The answer to this question also depends on how expensive it is to create the value type you're storing in the map:
typedef std::map <int, int> MapOfInts;
typedef std::pair <MapOfInts::iterator, bool> IResult;
void foo (MapOfInts & m, int k, int v) {
IResult ir = m.insert (std::make_pair (k,... |
If you only need to read/write the data, without any checking or manipulation done in database, then both should do it fine. Firebird's database file can be copied, as long as the system has the same endianess (i.e. you cannot copy the file between systems with Intel and PPC processors, but Intel-Intel is fine).
How... |
If you do something like this:
if(x)
{
somecode;
}
else
{
morecode;
}
This works out better for source control and preprocessor directives
on code that lives a long time. It's easier to add a #if or so without
inadvertently breaking the statement or having to add ... |
UserIDs? Requiring passwords to be alphanumeric is generally a good idea, since it makes them more resistant to a dictionary attack. It doesn't really make any sense for usernames. The whole point of having a name/password combo is that the name part doesn't have to be kept secret. |
Just use Images.Add from the ImageList to add in the individual images. So, something like:
<pre><code>
Image img = Image.FromStream( /*get stream from resources*/ );
ImageList1.Images.Add( img );
</code></pre> |
Why do you need your interface to be container-independent? Scott Meyers in his "Effective STL" gives a good reasoning for _not_ trying to make your code container-independent, no matter how strong the temptation is. Basically, containers are intended for completely different usage: you probably don't want to store you... |
Why do you need your interface to be container-independent? Scott Meyers in his "Effective STL" gives a good reasoning for _not_ trying to make your code container-independent, no matter how strong the temptation is. Basically, containers are intended for completely different usage: you probably don't want to store you... |
Reduce startup time of .NET windows form app running off of a networked drive |
|.net|performance|startup| |
I have a simple .NET 2.0 windows form app that runs off of a networked drive (e.g. \\MyServer\MyShare\app.exe). It's very basic, and only loads the bare minimum .NET libraries. However, it still takes ~6-10 seconds to load. People think something must be wrong that app so small takes so long to load.
Are there an... |
Ian Griffiths of Microsoft has a C# implementation he calls [Natural Sorting][1]. Porting to Java should be fairly easy, easier than from C anyway!
[1]: http://www.interact-sw.co.uk/iangblog/2007/12/13/natural-sorting |
Ian Griffiths of Microsoft has a C# implementation he calls [Natural Sorting][1]. Porting to Java should be fairly easy, easier than from C anyway!
**UPDATE:** There seems to be a Java example on [eekboom][2] that does this, see the "compareNatural" and use that as your comparer to sorts.
[1]: http://www.int... |
You can draw two triangles:
void DrawLine(float x1, float y1, float x2, float y2, float t1, float t2, float r, float g, float b)
{
float angle = atan2(y2 - y1, x2 - x1);
float t2sina1 = t1 / 2 * sin(angle);
float t2cosa1 = t1 / 2 * cos(angle);
float t2sina2 = t2 / 2 * sin(angle);
... |
You can draw two triangles:
// Draws a line between (x1,y1) - (x2,y2) with a start thickness of t1 and
// end thickness t2.
void DrawLine(float x1, float y1, float x2, float y2, float t1, float t2)
{
float angle = atan2(y2 - y1, x2 - x1);
float t2sina1 = t1 / 2 * sin(angle);
floa... |
Sounds to me like that componentname.exe is not using the ProgID/GUID that you think it's using. Either that or its register/unregister commands aren't working. Do you have the source? You could step through the registration routine and see what it's doing. |
can you add the movieclips to a parent clip and have the event handler drag the parent?
|
On Linux glibc provides strverscmp(), it's also available from gnulib for portability. However truly "human" sorting has lots of other quirks like "The Beatles" being sorted as "Beatles, The". There is no simple solution to this generic problem.
|
If you are looking for ad-hoc items rather than something that you would put into SSIS. From within SSMS simply highlight the results grid, copy, then paste into excel, it isn't elegant, but works. Then you can save as native .xls rather than .csv |
C++ unit testing framework |
|c++|unit-testing| |
I use the Boost Test framework for my C++ code but there are two problems with it that are probably common to all C++ test frameworks:
- There is no way to create automatic test stubs (by extracting public functions from selected classes for example).
- You cannot run a single test - you have to run the entire ... |
Why are you looking to be convinced to start using an editor? If you're happy with what you have now, stick. If not, perhaps ask about editors with features that you lack. |
Why are you looking to be convinced to start using a different editor? If you're happy with what you have now, stick. If not, perhaps ask about editors with features that you lack. |
I would think OCI would be the way to go. PHP has a [module][1] for it.
[1]: http://us3.php.net/manual/en/book.oci8.php |
I think this works for SQL 2000:
SELECT
CASE WHEN C.autoval IS NOT NULL THEN
'Identity'
ELSE
'Not Identity'
AND
FROM
sysobjects O
INNER JOIN
syscolumns C
ON
O.id = C.id
WHERE
O.NAME = @TableName
AND
C.NAME = @ColumnName |
It's the same in javascript. Someone must have been smoking something when they think it's a good idea to let 2008 mean the year 2008, 31 to mean the 31st day in the month, and - this is the best part - 11 to mean the 12th month.
On the other hand, they got it right on two out of three. |
Add a title="text here" to any tag and it should show a text when hovering on it. Internet Explorer shows the text when you use the alt="text here" attribute, although that is not accoring to the standards. |
Add a title="text here" to any tag and it should show a text when hovering on it. Internet Explorer shows the text when you use the alt="text here" attribute, although that is not accoring to the standards.
I tested now, and you can add <h2 title="some explanation here">headline</h2> to any system based on wik... |
Without any additional insight into what kind of processing is going on, here are some general thoughts from when I have done similar work.
1. Write a prototype of your application (maybe even "one to throw away") that performs some arbitrary operation on your data set. See how fast it goes. If the simplest, most... |
Writing deadlock-proof code is really hard. Even when you access the tables in the same order you may still get deadlocks. I wrote [a post on my blog][1] that elaborates through some approaches that will help you avoid and resolve deadlock situations.
If you want to ensure two statements/transactions will never dea... |
This is a good reference for [efficiently representing sets in .Net][1]
[1]: http://msdn.microsoft.com/en-us/library/aa289153(VS.71).aspx |
Update: This is for .Net 2.0. For .Net 3.5, refer posts by aku, Jon..
This is a good reference for [efficiently representing sets in .Net][1].
[1]: http://msdn.microsoft.com/en-us/library/aa289153(VS.71).aspx |
Both wx and QT have embedded/universal versions where the widgets are drawn directly.
They can both be called from python,but if you have a very small system python or py2exe might not be available. |
_NOTE: please edit the question itself, rather than replying with an answer -- this is not a discussion thread, and they can re-order themselves at any time_
If you're searching for all Contents that are marked with any one of a set of tags:
IEnumerable<Tag> otherTags;
...
var query = from content i... |
If you need to test GUI components I've found [SWTBot][1] gets the job done.
[1]: http://swtbot.org/ |
Add options to select box without Internet Explorer closing the box? |
|javascript|ajax| |
I'm trying to build a web page with a number of drop-down select boxes that load their options asynchronously when the box is first opened. This works very well under Firefox, but not under Internet Explorer.
Below is a small example of what I'm trying to achieve. Basically, there is a select box (with the id "sel... |
Do you have access to the actual server config? If so depending on the server you could do it in the configuration.
See [this][1] thread for some information that may be helpful.
[1]: http://www.webmasterworld.com/forum92/3546.htm |
You could use [SWFAddress][1], it has a setTitle method. Plus, you get the added benefit of beng able to modify the URL for deep-linking.
EDIT: This won't work if the SWF is loaded directly in the browser, only if it is embedded in HTML.
[1]: http://www.asual.com/swfaddress/ |
You could use [SWFAddress][1], it has a setTitle method. Plus, you get the added benefit of being able to modify the URL for deep-linking.
This won't work if the SWF is loaded directly in the browser, only if it is embedded in HTML.
[1]: http://www.asual.com/swfaddress/ |
You could use [SWFAddress][1], it has a setTitle method. Plus, you get the added benefit of beng able to modify the URL for deep-linking.
EDIT: This won't work if the SWF is loaded directly in the browser, only if it is embedded in HTML.
[1]: http://www.asual.com/swfaddress/ |
CScript/WScript Prevent an error from being blocking |
|vbscript|wsh|automation| |
Currently, WScript pops up messagebox when there is a script error. These scripts are called by other processes, and are ran on a server, so there is nobody to dismiss the error box.
What I'd like is for the error message to be dumped to STDOUT, and execution to return the calling process. Popping as a MSGBox just ... |
|automation|vbscript|wsh| |
Currently, WScript pops up message box when there is a script error. These scripts are called by other processes, and are ran on a server, so there is nobody to dismiss the error box.
What I'd like is for the error message to be dumped to STDOUT, and execution to return the calling process. Popping as a MSGBox just... |
What's the best way to run Wordpress on the same domain as a Rails application? |
|php|ruby-on-rails|apache|wordpress|nginx| |
I've got a standard Rails app with Nginx and Mongrel running at http://mydomain. I need to run a Wordpress blog at http://mydomain.com/blog. My preference would be to host the blog in Apache running on either the same server or a separate box but I don't want the user to see a different server in the URL. Is that pos... |
You can actually do something really cool in Python to solve this. You can create a list comprehension that would reference itself as it is being built. As follows:
# remove duplicates...
def unique(my_list):
return [x for x in my_list if x not in locals()['_[1]'].__self__]
The _[1] i... |
Why do you need your interface to be container-independent? Scott Meyers in his "Effective STL" gives a good reasoning for _not_ trying to make your code container-independent, no matter how strong the temptation is. Basically, containers are intended for completely different usage: you probably don't want to store you... |
I'm guessing you're using RGB with byte values (0 to 255) as that's very common everywhere.
For brighter, average the GB values with the RGB of white. Or, to have some control over how much brighening, mix in them in some proportion. Let fvary from 0.0 to 1.0, then:
Rnew = (1-f)*R + f*255
Gnew = (1-f)*G ... |
Use a [BSP][1] tree to store the rectangles.
[1]: http://en.wikipedia.org/wiki/Binary_space_partitioning |
Flash can play the following formats:
FLV with AAC or MP3 audio, and FLV1 (Sorenson Spark H.263), VP6, or H.264 video.
MP4 with AAC or MP3 audio, and H.264 video (mp4s must be hinted with qt-faststart or mp4box).
ffmpeg is an overall good conversion utility; mencoder works better with obscure and proprie... |
How can I fix this delphi 7 compile error - "Duplicate resource(s)" |
Include instant messenger fields in your account details. When your application processes an expedited order, stick the notification in a queue. If their instant messenger field is blank, prompt them. Write an XMPP (Jabber) bot that consumes items in that queue and send them out. Use transports to enable functional... |
I was able to fix my problem by changing it to a template field. Not sure why it wouldn't work the other way. |
You should always close all JDBC resources explicitly. As Aaron and John already said, closing a connection will often only return it to a pool and not all JDBC drivers are implemented exact the same way.
Here is a utility method that can be used from a finally block:
public static void closeEverything(Result... |
Setup Clickonce for the app so it's deployed to the local machine. |
General rule:
1. Shells (DOS included) use "0" as "No
Error"... not necessarily true.
1. Programming languages use non-zero
to denote true.
That said, if you're in a language which lets your define TRUE of FALSE, define it and always use the constants. |
[The Alphanum Algorithm][1]
From the website
"People sort strings with numbers differently than software. Most sorting algorithms compare ASCII values, which produces an ordering that is inconsistent with human logic. Here's how to fix it."
[1]: http://www.davekoelle.com/alphanum.html |
[The Alphanum Algorithm][1]
From the website
"People sort strings with numbers differently than software. Most sorting algorithms compare ASCII values, which produces an ordering that is inconsistent with human logic. Here's how to fix it."
Edit: Here's a link to the [Java Comparator Implementation][2] from th... |
Usually I make all my select statements order by "order, name"; Then I always insert the same value for Order (either 0 or 9999999 depending on if I want them first or last). Then the user can reorder however they like. |
InnoDB supports transactions. Before the insert do a 'begin' statement and when your finished do a commit. See [this article][1] for an explanation of transactions in mySql.
[1]: http://www.databasejournal.com/features/mysql/article.php/3382171 |
You could cheat like Microsoft Office (and Adobe I think) and add an app in the Startup group that tells the app to load and then immediately unload. That way the DLL's are pre-cached in memory for when the user tries to start the app. Only catch: I'm not completely sure if it works this way with networked files -- a... |
select * from books
where title like "%text%" or description like "%text%"
order by date, case when title like "%text%" then 0 else 1 end
|
Since your are passing the pointer by value, the arr pointer inside main isn't pointing to the allocated memory. This means two thing: you've got yourself a memory leak (NO, the memory isn't freed after the function foo completes), and when you access the arr pointer inside main you are accessing some arbitrary range o... |
The procedure for going from big-endian to little-endian is the same as going from little-endian to big-endian.
Here's some example code:
void swapByteOrder(unsigned short& us)
{
us = (us >> 8) |
(us << 8);
}
void swapByteOrder(unsigned int& ui)
{
ui = (ui... |
The procedure for going from big-endian to little-endian is the same as going from little-endian to big-endian.
Here's some example code:
void swapByteOrder(unsigned short& us)
{
us = (us >> 8) |
(us << 8);
}
void swapByteOrder(unsigned int& ui)
{
ui = (ui... |