instruction
stringlengths
0
30k
|sql|sql-server|
Given this data: CREATE TABLE tmpTable( fldField varchar(10) null); INSERT INTO tmpTable SELECT 'XXX' UNION ALL SELECT 'XXX' UNION ALL SELECT 'ZZZ' UNION ALL SELECT 'ZZZ' UNION ALL SELECT 'YYY' SELECT CASE WHEN fldField like 'YYY' THEN 'OTH...
Specman macro to do set subtraction with int_range_list objects
|specman|
I work with a bunch of sets in order to generate constrained random traffic, but I want to be able to call a Specman macro that computes the complement of a set with syntax like: COMPLEMENT begin domain=[0..10,24..30], complmenting_set=[2..3,27..30] end and have it generate: [0..1,4..10,24..26] E...
deleting subdomain cookies
|cookies|browser|http|
If there is a cookie set for a subdomain, metric.foo.com, is there a way for me to delete the metric.foo.com cookie on a request to www.foo.com? The browser (at least Firefox) seems to ignore a Set-Cookie with a domain of metric.foo.com.
Deleting subdomain cookies
Is it possible to delete subdomain cookies?
Shocking, but almost every response here included some form of CAPTCHA. The OP wanted something different, I guess maybe he wanted something that actually works, and maybe even solves the real problem. CAPTCHA **doesn't** work, and even if it did - its the wrong problem - humans can still flood your system, and by d...
From [here][1]: The path (without drive) where the script is : ~p0 The drive where the script is : ~d0 [1]: http://www.rgagnon.com/gp/gp-0008.html
It is a condition you know to always be true at a particular place in your logic and can check for when debugging to work out what has gone wrong.
`%~d0` gives you the drive letter of argument 0 (the script name), `%~p0` the path.
I have used Ironspeed extensively for the past two years for most of our ASP.NET forms over data projects. It works. Does several things well: stored procs, fast layout of table browse and CRUD screens, fast layout of single record CRUD screens. It manages the round-trip (or half-round trip) process decently, detec...
I usually view them more in terms of algorithms or structures. For example, you could have a loop invariant that could be asserted--always true at the beginning or end of each iteration. That is, if your loop was supposed to process a collection of objects from one stack to another, you could say that |stack1|+|sta...
vUsing adjHungarian nnotation vmakes nreading ncode adjdifficult.
Pointers are not some sort of magical stuff, you're using them all the time!<br> When you say:<br> int a;<br> and the compiler generates storage for 'a', you're practically saying that you're declaring<br>an int and you want to name its memory location 'a'.<br> When you say:<br> int *a;<br> you're de...
Use [str_replace()][1]: $text = str_replace('http://stackoverflow.com/xyz1', 'http://yahoo.com/abc1', $text); That will replace the first URL with the second URL in $text. [1]: http://php.net/str_replace
Try this: preg_replace('#(https?://)(www\.)?stackoverflow.com\b#', '\1\2yahoo.com', $text); If you want to change the path after the url, add another group and use `preg_replace_callabck`. More information in the PHP documentation.
The only layout manager that I have found, that I actually **like** is the [Relative Layout Manager][1]. The Relative Layout Manager works in a way that is consistent with how dialog boxes are *conceptually* organized. One draw-back is that while this layout manager deals with additive constraints. It does *not* see...
We use something locally based on http://opentcdb.org/ but that does scrum tracking, and draws pretty graphs.
Actually, we have a drools based project, you could try to mimic that. :-) Suppose you have incoming SMS messages arriving on an HTTP based protocol. An HTTP request contains the Anumber (telephone number of the sender) the Bnumber (telephone number of the recipient) and the text of the message. Your goal is to u...
How do I totally disable caching in nHibernate?
|nhibernate|
How do I totally disable caching in nHibernate?
GCC is smarter than most of us in producing machine code from our source code; however, I shiver if it was smarter than us in re-arranging our structs, since it's data that e.g. can be written to a file. A struct that starts with 4 chars and then has a 4 byte integer would be useless if read on another system where GCC...
You may also want to consider the [csv](http://docs.python.org/lib/module-csv.html) module. I haven't tried it, but it looks like your input data is closer to CSV than to shell syntax (which is what shlex parses).
function replace_url($text, $newurl) { $text = preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', $newurl, $text); return $text; } Should work. Regex stolen from [here][1]. This will replace all URLs in the string with the new one. [1]: http://snipplr.com/view/2371/r...
module Main where ranges :: [Int] -> [[Int]] ranges [] = [] ranges list@(x:xs) = let adj = adjacent list in let len = length adj in if length adj == 1 then [[x]] ++ ranges xs else [[x,(last adj)]] ++ ranges (drop ((length adj) - 1) xs) where adjacen...
Using JQuery with ASP.NET MVC Framework
|asp.net-mvc|
I have searched the forum, and google for this topic. Most of the articles are talking about using JSON to call the controller/action on the server and do ajax effect on the result. I am trying to use some very basic JQuery features, like the JQuery UI/Tabs, and JQuery UI/Block for a dialog window. I cannot get thes...
Store the user from your web application in the database and let your triggers go off that stored data. It might even be better to let the web app handle writing all logging information to the database.
You can give Emacs with Vim emulation a try, is not perfect, but it may be somewhat familiar. I think Lisp shines if you use something like Slime or DrScheme doing iterative development, all other editors feel just wrong.
A function call usually involves merely a couple of memory copies (often into registers, so they should not take up much time) and then a jump operation. This will be slower than a memory access, but faster than any of the other operations mentioned above, because they require communication with other hardware. The sam...
If you are on linux and have these tools: pdf2ps | ps2txt < yourarticlecollection/someresearchpaper.pdf :) Seiously, most of the time I just copy&paste from research papers and articles that interests me. They have good amount of text that show [white rivers][1] and sometimes as incomprehensible as "Lorem ...
Well, it looks as if I will be answering my own question. First, the documentation flat out lies where it reads "In any style command the first row index may be set to one of the special strings 'splitlast' or 'splitfirst' to indicate that the style should be used only for the last row of a split table, or the first...
I'd avoid using toString() on objects other than the basic types. toString() may not display anything useful. It may iterate over all the member variables and print them out. It may load something not yet loaded. Depending on what you plan to do with that string, you should consider not building it. There are typ...
Make it easier to buy than to steal. If you put mounds of copy protection then it just makes the value of owning the real deal pretty low. Use a simple activation key and *assure* customers that they can *always* get an activation key or re download the software if they ever loose they'res. Any copy protection(...
Like said above, if you are using your own connections and nothing else on the server you wont need the cals.
To answer the "what happens when all 3 exist" question, the answer is "it depends." PHP auto-fills $_REQUEST based on the request_order directive (or variables_order if request_order is absent) in PHP.INI. The default is usually "GPC" which means GET is loaded first, then POST is loaded (overwriting GET if there is ...
If the WinForms app has a proper Object model architecture defined(More like an MVC model architecture) I think it wont take much time to migrate your UI to WPF. WPF has organized its visual elements heirarchically(VisualTree) and RoutedEvents and RoutedCommands are totally new concepts in WPF. and obviously there ar...
Check out symfony, too. Free software, top-notch documentation.
What are the bigger hurdles to overcome migrating from Winforms to WPF?
|wpf|winforms|c#|
I've been developing Winforms applications in C# for a few years now and have been interested in moving future development toward WPF, mainly because of the positive things I've been hearing about it. But, I'm wondering what sort of hurdles others have had to overcome as they migrated to WPF. Was there a significant ...
|c#|windows|winforms|wpf|
Windows Licensing Question
|c#|c++|windows|linux|
No standard and portable way. Some implementations provide [itoa()](http://en.wikipedia.org/wiki/Itoa), but it's not going to be in most, and it has a somewhat crummy interface. But the code is behind the link and should let you implement your own formatter pretty easily.
Is this C++ structure initialization trick safe?
|c++|data-structures|
Instead of having to remember to initialize a simple 'C' structure, I might derive from it and zero it in the constructor like this: struct MY_STRUCT { int n1; int n2; }; class CMyStruct : public MY_STRUCT { public: CMyStruct() { memset(...
An invariant is more "conceptual" than a variable. In general, it's a property of the program state that is always true. A function or method that ensures that the invariant holds is said to maintain the invariant. For instance, a binary search tree might have the invariant that for every node, the key of the node's...
When the timer elapse, there is no current HTTP context. This is because the timer events are not related to a specific HTTP request. What you should do is use HttpServerUtility.MapPath where HTTP context is available. You can do it in one of the request pipeline events (such as Page_Load) or in a Global.asax event ...
How about rotating the pairs every week or every sprint so that if there are issues between a couple of pairs they don't feel like it has to be that way forever. I think if there is a specific time frame that you have to work with someone you do not get along with it makes it easier to "suck it up" and hopefully you w...
How about rotating the pairs every week or every sprint so that if there are issues between a couple of pairs they don't feel like it has to be that way forever. I think if there is a specific time frame that you have to work with someone you do not get along with it makes it easier to "suck it up" and hopefully you w...
|http|browser|cookies|
I have been doing some more research on this issue and it looks like the [AsyncRendering][1] property of the ReportViewer control controls the functionality that I'm looking for. When it is set to "false" it prevents the "Report is Being Generated" message from being displayed which is what the users were commenting on...
ASP.NET: How do I create radio buttons and databind them in a DetailsView?
|asp.net|c#|
I have a TemplateField in a DetailsView and its input should be one of a few choices in a lookup table. Currently it's a text field, but I want it to be a group of radio buttons, and it should work in both insert and edit mode (the correct current value should be selected in edit mode). How do I create mutually excl...
|c#|asp.net|web-user-controls|
MyISAM tables already store the row count, so "SELECT COUNT(*) FROM table" on a MyISAM table simply reads that value. It doesn't scan the table or the index(es). So, it's just as fast or faster than reading the value from a different table.
Just to be clear, the index is on the (presumably varchar or nvarchar) field in the table, correct? Not the PK?
Just to be clear, the index is on the (presumably varchar or nvarchar) field in the table, correct? Not the PK? ok, after your edit: You're doing an indexed lookup on a large (n)varchar text field. Even with the index that can be pretty slow -- you're still doing 2 big string comparisons. I can't really thing of a g...
The origin of 80-column text formatting is earlier than 80-column terminals - the IBM punch card dates back to [1928](http://www-03.ibm.com/ibm/history/history/year_1928.html)! This is reminiscent of the [(apocryphal)](http://www.snopes.com/history/american/gauge.asp) story that the US railway gauge was determined by ...
Straight from the horses mouth.... > http://msdn.microsoft.com/en-us/library/bb384632.aspx
According to one of our senior developers VS2008 features extended support for multicore compilation ( file-wise instead of project-wise I'm told ), so there might be a reasonable performance optimization for your project.
Generally source control systems merge on a line-by-line basis by default. I have found that merging Python code is no different from merging any other source code that is reasonably indented. If one programmer wraps a block of code in an `if` statement (indenting the whole block), and another programmer modifies somet...
To add to the previous answers, I would recommand also the obvious (but they should be made explicit) advices: - choose a stable state of your project to import in your repository (whatever tool you choose) - create immediately a label (or tag in SVN), once the import is done and 'checked' (like 'does it compile ?'...
My first thought is that the second version might be infinitessimally faster than the first, because no reference is pushed on the stack as an argument. However, this would be very compiler-dependant, and depends for instance on whether the compiler performs Named Return Value Optimization or not. Anyway, in case of...
Dash vs. Underscore
|language-agnostic|url|naming-conventions|
Should it be **/about_us** or **/about-us**? From usability point of view, I personally think **/about-us** is much better for end-user yet Google and most other websites (and javascript frameworks) use underscore naming pattern. Is it just matter of style? Are there any compatibility issues with using dashes?
Should it be **/about_us** or **/about-us**? From usability point of view, I personally think **/about-us** is much better for end-user yet Google and most other websites (and javascript frameworks) use underscore naming pattern. Is it just matter of style? Are there any compatibility issues with dashes?
If the function is inlined at compile time, the cost of the function becomes equivelant to 0. 0 of course being, what you would have gotten by not having a function call, ie: inlined it yourself. This of course sounds excessively obvious when I write it like that.
Image Processing, In Python?
|python|image|image-manipulation|image-processing|
I've recently come across a problem which requires at least a basic degree of image processing, can I do this in Python, and if so, with what?
Just take any decent calculator and type in "7FFFFFFF" in hex mode, then switch to decimal. 2147483647.
There is actually a wonderful [Python Imaging Library (PIL)](http://effbot.org/zone/pil-index.htm). It gives you the ability to alter existing images, including anti-aliasing capabilities, and create new images with text and such. You can also find a [decent introductory tutorial](http://effbot.org/imagingbook/introd...
Hard to answer because there are a lot of factors involved. First of all, "Simple Memory Access" isn't simple. Since at modern clock speeds, a CPU can add two numbers faster than it get a number from one side of the chip to the other (The speed of light -- It's not just a good idea, it's the LAW) So, is the func...
Create a single source-controlled DDL/SQL script for each release and **only** use it to update the databases. The diff tools can be useful but mainly for checking that you haven't made a mistake and getting out of trouble when the policies fail. Combine the DDL, SQL, and stored procedure scripts into a single script ...
How would you implement a breadcrumb helper in asp.net mvc?
|asp.net-mvc|navigation|
I know you could make a helper pretty easily given the data. So, if possible, please only submit answers that also include getting the data (eg. from the routeTable).
I know you could make a helper pretty easily given the data. So, if possible, please only submit answers that also include getting the data.
My favourite is [Open3][1] require "open3" Open3.popen3('nroff -man') { |stdin, stdout, stderr| ... } [1]: http://www.ruby-doc.org/core/classes/Open3.html
I found out that my referenced System.Web.Extensions (v3.5.sth) library did not have the same version with the reference in web.config (v.1.0.6sth). Replacing the dll (3.5) with the old version of System.Web.Extensions solved the problem.
navigator.onLine That should do what you're asking.
Look at the primary key foreign key relationshsips that have been set up as a starting place. Since a database without existing diagrams, may not have relationships set up formally, I look at the table structures and names and make my best guesses as to what might be related to what, then dig into the structures to ...
Marking value parameters 'const' is definitely a subjective thing. However I actually prefer to mark value parameters const, just like in your example. void func(const int n, const long l) { /* ... */ } The value to me is in clearly indicating that the function parameter values are never changed by the fun...
You can name the file as you see fit. From the help for MSBuild msbuild.exe /? Microsoft (R) Build Engine Version 2.0.50727.3053 [Microsoft .NET Framework, Version 2.0.50727.3053] Copyright (C) Microsoft Corporation 2005. All rights reserved. Syntax: MSBuild.exe [opt...
It sounds like you need to call DataBind in your update code.
It executes from most indented to least indented, and I believe from the bottom of the plan to the top. (So if there are two indented sections, the one farther down the page executes first, then when they meet the other executes, then the rule joining them executes.) The idea is that at each step there are 1 or 2 d...
This is slightly off topic of programming but still has to do with my programming project. I'm writing an app that uses a custom proxy server. I would like to write the server in C# since it would be easier to write and maintain, but I am concerned about the licensing cost of Windows Server + CALS vs a Linux server (...
|windows|linux|licensing|
|windows|linux|licensing|