instruction
stringlengths
0
30k
The ASP.NET Sitemap feature is built for that and works well in a lot of cases. If you get in a spot where you want your [Menu to look different from your Sitemap, here are some workarounds][1]. If you have a dynamic site structure, you can [create a custom sitemap provider][2]. You might get to the point where it's...
How should I handle a situation where I need to store several unrelated types but provide specific types on demand?
|.net|generics|
I'm working on an editor for files that are used by an important internal testing tool we use. The tool itself is large, complicated, and refactoring or rewriting would take more resources than we are able to devote to it for the forseeable future, so my hands are tied when it comes to large modifications. I must use...
There's no "process explorer" kind of tool for Firefox; but there's http://developer.mozilla.org/en/docs/Venkman with profiling mode, which you could use to see the time spent by chrome (meaning non-content, that is not web-page) scripts. From what I've read about it, DTrace might also be useful for this sort of thi...
I don't know that there is a property to control this (can't find one on MSDN), but I'd think you could just iterate through the Controls property of the LoginView and hide that panel/label/whatever.
How do you open a file in C++?
|c++|file|io|
I want to open a file for reading, the C++ way. I need to be able to do it for text files, which would involve some sort of read line function, and a way to do it for binary files, which would provide a way to read raw data into a char* buffer.
There are three ways to do this, depending on your needs. You could use the old-school C way and call fopen/fread/fclose, or you could use the C++ fstream facilities (ifstream/ofstream), or if you're using MFC, use the CFile class, which provides functions to accomplish actual file operations. All of these are suita...
There will be no performance hit, both statements are perfectly equal. HTH
Note that the != operator is not standard SQL. If you want your code to be portable (that is, if you care), use <> instead.
If it's only two users, then Access should do just fine if you put the .mdb on a shared drive. Have you tried it first rather than just assume it will be a problem. I believe the recommended max concurrent users for Access is 5 but on occasion I've pushed it past this and never come unstuck. On the other hand...
These 3 will get the same exact execution plan declare @id varchar(40) select @id = '172-32-1176' select * from authors where au_id <> @id select * from authors where au_id != @id select * from authors where not(au_id = @id) It will also depend on the selectivity of the index itself of course. I alwa...
This will just allow you a little more flexibility in your web server setup. Using safe_mode_gid, you should be able to run individual PHP/httpd processes for each user on your system, but give each process the ability to read some shared files as long as they are all run as the same group (GID) and the shared files a...
Best css generator lanugage?
|css|maintainability|
Reusing values in css (particularly colors) has always been a problem for me when it comes to maintaining that css. What are the best tools for creating variables, or generally improving maintainability with css?
You can quote if you like, or you can escape the spaces with a preceding \\, but most UNIX paths (Mac OS X aside) don't have spaces in them. /Applications/Image\ Capture/Contents/MacOS/Image\ Capture "/Applications/Image Capture/Contents/MacOS/Image Capture" /Applications/"Image Capture"/Contents/M...
You can quote if you like, or you can escape the spaces with a preceding \\, but most UNIX paths (Mac OS X aside) don't have spaces in them. /Applications/Image\ Capture.app/Contents/MacOS/Image\ Capture "/Applications/Image Capture.app/Contents/MacOS/Image Capture" /Applications/"Image Capture.app...
You can quote if you like, or you can escape the spaces with a preceding \\, but most UNIX paths (Mac OS X aside) don't have spaces in them. /Applications/Image\ Capture.app/Contents/MacOS/Image\ Capture "/Applications/Image Capture.app/Contents/MacOS/Image Capture" /Applications/"Image Capture.app...
Do you have the &lt;machinekey&gt; node on both servers set to the same value? You can override the machine.config file in web.config to set this. This needs to match otherwise you can get strange situations like this.
I would probably make a batch file, something like this (untested): dir /b /S *.cs > allcsfiles.txt svn add --targets allcsfiles.txt I believe svn won't mind you trying to add files which are already versioned.. Anyway, that's probably about as automatic as you will easily get.
I'm not sure exactly what you are trying to accomplish. Telnet is usually thought of as a character-at-a-time protocol, so when you say "incoming messages" do you mean each character is a message? Or the entire user's session is a message? I'll make some assumtions. You have users logging in via telnet and you wa...
I needed to pass id and password to a cmd (or bat) file at the time of running rather than hardcoding them into the file. Here's how I do it. echo off fake-command /u %1 /p %2 Here's what the command line looks like: test.cmd admin P@55w0rd > test-log.txt The %1 applies to the first paramete...
How do you change the default homepage in a Grails application?
|grails|
What is the configuration setting for modifying the default homepage in a Grails application to no longer be appName/index.gsp? Of course you can set that page to be a redirect but there must be a better way.
A good [blog post here][1] but basically prefix local temp tables with # and global temp with ## - eg CREATE TABLE #localtemp [1]: http://techahead.wordpress.com/2007/09/27/sql-temporary-tables/
I ran into this same issue a while back and found that if I created a simple abstract base class for data access that allowed me to inject a connection and transaction, I could unit test my sprocs to see if they did the work in SQL that I asked them to do and then rollback so none of the test data is left in the db. ...
I ran into this same issue a while back and found that if I created a simple abstract base class for data access that allowed me to inject a connection and transaction, I could unit test my sprocs to see if they did the work in SQL that I asked them to do and then rollback so none of the test data is left in the db. ...
Many issues can cause that error. It's usually a Response.Write call, but anything that modifies the response can cause it. We probably won't be able to help you unless you post some pertinent code-behind.
You can watch the graph you created using GraphEdit, a tool from the DirectShow SDK. In GraphEdit, select File->Connect to remote Graph... In order to find your graph in the list, you have to register it in the running object table: void AddToRot( IUnknown *pUnkGraph, DWORD *pdwRegister ) { IMo...
Does it make any difference if you put non-breaking spaces immediately before and after the anchor element? <p> ... &nbsp;<a ... >Link text</a>&nbsp; ... </p> Admittedly a workaround at best but it might buy you some time to research a real solution.
Look at [http://www.yammer.com][1] for a corporate version of twitter. [1]: http://www.yammer.com
Is there a need to destroy char * = "string" or char * = new char[6]
|c++|c|memory|
I assume when I do **char* = "string"** its the same thing as **char* = new char[6]**. I believe these strings are created on the heap instead of the stack. So do I need to destroy them or free their memory when I'm done using them or do they get destroyed by themselves.
Apache XML-RPC Exception Handling
|exception|xml-rpc|
What is the easiest way to extract the original exception from an exception returned via Apache's implementation of XML-RPC?
What about confidentiality and information security? I'm certain a company run IM service would be a better alternative. I've viewed Twitter and similar services to be used as marketing tools to engage customers and prospects.
Why are SQL aggregate functions so much slower than Python and Java (or Poor Man's OLAP)
|sql|optimization|aggregate|olap|python|
I need a real DBA's opinion here: Using Postgres 8.3 I've built a table with 350,000 rows (responses to a survey): CREATE TABLE tuples (id integer primary key, a integer, b integer, c integer, d integer); \copy tuples from 'responses.csv' delimiter as ',' On my Macbook Pro it takes about 200 ms to e...
What are the differences between htmlspecialchars and htmlentities. When should I use one or the other?
How to encrypt email addresses using JQuery
|jquery|email|
Is there a way to use JQuery to cloak or encrypt email addresses on an HTML page without changing the syntax in the HREF?
After some research, I think I'll go with the **ISO 7064 Mod 97,10** formula. It seems pretty solid as it is used to validate IBAN (International Bank Account Number). The formula is very simple: - Take a number : `123456` - Apply the folowing formula to obtain the 2 digits checksum : `mod(98 - mod(number * 100...
Are you referring to the concept of a free database to distribute with an application, or an Access-like "single file, no installation" database? As in, things like SQL Server Express Edition require things like runtimes to be installed, databases to be created and mounted, entries on people's Start menus that they ...
Referencing Embedded resources from other resources in c#
|c#|asp.net|javascript|
In my web application I include all of my JavaScripts as js files that are embedded resources in the assembly, and add them to the page using `ClientScriptManager.GetWebResourceUrl()`. However, in some of my js files, I have references to other static assets like image urls. I would like to make those assembly resource...
From the PHP documentation for [htmlentities][1]: >This function is identical to htmlspecialchars() in all ways, except with htmlentities(), all characters which have HTML character entity equivalents are translated into these entities. From the PHP documentation for [htmlspecialchars][2]: >Certain characters hav...
|oracle|content-management|ucm|
What I normally do in this case is to have a single thread that is responsible for putting the data into the database, and have all auxiliary threads report to that thread, which then queues up the data, and writes it either serially, or in batches (depending on the requirements, and how much database activity I'm will...
The only significant pitfall to long cache times occurs when you want to update that data. To be safe, you have to assume that it will take up to a week for the new version to become available. Intermediate hosts such as a ISP level proxy servers often do cache aggressively so this delay will happen. If there are la...
Long-term Static Page Caching
|caching|asp.net|c#|static|
I maintain several client sites that have no dynamic data whatsoever, everything is static asp.net with c#. Are there any pitfalls to caching the entire page for extreme periods of time, like a week?
|c#|asp.net|caching|static|
I maintain several client sites that have no dynamic data whatsoever, everything is static asp.net with c#. Are there any pitfalls to caching the entire page for extreme periods of time, like a week? Kibbee, We use a couple controls on the sites (ad rotator, some of the ajax extensions) on the sites. They could ...
Another "it depends". However, I can also think of a very common scenario where static just won't work. If you have a web site that gets a decent amount of traffic, and you have a static database layer with a shared connection, you could be in trouble. In ASP.Net, there is _one_ instance of your application created ...
|reporting|exchange-server|scripting|
Namespace/solution structure
|namespace|
I apologize for asking such a generalized question, but it's something that can prove challenging for me. My team is about to embark on a large project that will hopefully drag together all of the random one-off codebases that have evolved through the years. Given that this project will cover standardizing logical enti...
|namespaces|
How do you spawn another process in C?
|c|api|process|
How do you run an external program and pass it command line parameters using C? If you have to use operating system API, include a solution for Windows, Mac, and Linux.
|c|api|process|
How do you properly use namespaces in C++?
|c++|qt|namespace|
I come from a Java background, where packages are used, not namespaces. I'm used to putting classes that work together to form a complete object into packages, and then reusing them later from that package. But now I'm working in C++. How do you use namespaces in C++? Do you create a single namespace for the entire ...
|c++|qt|namespaces|
Of Ways to Count the Limitless Primes
|prime|primes|language-agnostic|
Recently I've been cobbling together a little library of prime checks. **"Why?"** you ask? **"Well, just because."** I respond. I've implemented a couple and have seen the post on the [the most efficient way to find the first 10000](http://stackoverflow.com/questions/622/most-efficient-code-for-the-first-10000-pri...
The accepted answer wasn't quite correct, but it pointed in the right direction. There is a hotfix for VS2k5 SP1 described in KB article 947315 that addresses this issue.
Also be careful with double-quotes -- on the Unix shell this expands variables. Some are obvious (like `$foo` and `\t`) but some are not (like `!foo`). For safety, use single-quotes!
#line and jump to line
|text-editor|preprocessor|
Do any editors honer C #line directives with regards to goto line features? *Context:* I'm working on a code generator and need to jump to a line of the output but the line is specified relative to the the #line directive I'm adding. I can drop them but then finding the input line is even a worse pain
Do any editors honer C #line directives with regards to goto line features? *Context:* I'm working on a code generator and need to jump to a line of the output but the line is specified relative to the the #line directives I'm adding. I can drop them but then finding the input line is even a worse pain
How to push data to variety of different client types in near real time?
|push|
We need is to push sports data to a number of different client types such as ajax/javascript, flash, .NET and Mac/iPhone. Data updates need to only be near-real time with delays of several seconds being acceptable. How to best accomplish this?
See the answers to the following questions * [Create a variable in .CSS file for use within that .CSS file][1] * [Avoiding repeated constants in CSS][2] [1]: http://stackoverflow.com/questions/47487/create-a-variable-in-css-file-for-use-within-that-css-file [2]: http://stackoverflow.com/questions/30170/a...
I think the Apple guidelines sum it up nicely. If you're writing a control that will be used in multiple applications and is completely generic, then creating a custom object is a good idea. You'll be able to visualize the look and set properties directly from Interface Builder. If your control is limited to one ...
Can't you just force them to allocate all their memory on the stack? This way it would be garanteed to be freed after the function exits.
The first example is not valid XML, the declaration has to be the first thing in a XML document. But besides that, comments can go anywhere else. Correcting your first example: <?xml version="1.0" encoding="UTF-8"?> <!-- Queries used: ... --> <dataset> </dataset>
A better solution than attempting to log mallocs might be to sandbox the functions when you call them—give them access to a fixed segment of memory and then free that segment when the function is done running. Unconfined, incompetent memory usage can be just as damaging as malicious code.
The main thing that I've seen with regards to complaints about Active Record is that when you create a model around a table, and you select several instances of the model, you're basically doing a "select * from ...". This is fine for editing a record or displaying a record, but if you want to, say, display a list of t...
Because of budget constraints I think it will have to beta-tester's approch,i tried following the guide and cant seem to get it working. Before I spend time getting it to work, I just confrim, Replicating between SqlServer 2005 and Compact Edition is something that can be done?
You'll want to familiarize yourself with [repository hooks][1], particularly the [post-commit hook][2] [1]: http://svnbook.red-bean.com/en/1.4/svn-book.html#svn.ref.reposhooks "The Subversion Book: Repository hooks" [2]: http://www.petefreitag.com/item/244.cfm "Using Subversion hooks to send out build emails"
No you cannot get the MAC address in JavaScript, mainly because the MAC address uniquely identifies the running computer so it would be a security vulnerability. Now if all you need is a unique identifier, I suggest you create one yourself using some cryptographic algorithm and store it in a cookie. If you really...
You use the [post-commit hooks][1]. Here's a guide: [http://builddeploy.blogspot.com/2008/01/implementing-subversion-post-commit.html][2] Here's a sample script that sends an email after each commit: [commit-email.rb][3] [1]: http://svnbook.red-bean.com/en/1.4/svn.reposadmin.create.html#svn.reposadmin.create...
I would also take a look at [Passenger][1]. It's a lot easier to get going than the traditional solution of Apache/nginx + Mongrel. [1]: http://modrails.com/