instruction stringlengths 0 30k ⌀ |
|---|
Does putting it in double quotes work?
$myText = "$myVar"; |
You can always create a method named .ToString($in) that returns
$in . '';
|
Using Xming X Window Server over a VPN |
|xming|vpn|unix|hardware| |
I have the Xming X Window Server installed on a laptop running Windows XP to connect to some UNIX development servers.
It works fine when I connect directly to the company network in the office. However, it does not work when I connect to the network remotely over a VPN.
When I start Xming when connected remotel... |
|unix|hardware|opensource|vpn|xming| |
|open-source|unix|hardware|vpn|xming| |
Since you are using only ASP.NET 2.0 I would recommend [AjaxPro][1] will which create the .ashx file. All you have to do is to pull the AjaxPro.dll into your web site. I developed an entire application with [AjaxPro][1] and found it worked very well. It uses serialization to pass objects back and forth.
This is j... |
With Lucene: Why do I get a Too Many Clauses error if I do a prefix search? |
|exception|lucene| |
I've had an app doing prefix searches for a while. Recently the index size was increased and it turned out that some prefixes were too darned numerous for lucene to handle. It kept throwing me a [Too Many Clauses][1] error, which was very frustrating as I kept looking at my JARs and confirming that none of the include... |
@roo
> I was really hoping that is was possible, and that I just hadn't found it yet. Your example just made me realise that that is exactly what we are trying to do - only allow access to files in the context of our program and so preserve the IP.
>I guess I have to accept that there is no truly secure way to stor... |
Who says you have to *create* all the images on the server with each request? Maybe you could have a static list of images or pull them from flickr. I like the "click on the kitten" captcha idea. <http://www.thepcspy.com/kittenauth> |
@Chris
> Oh, but with trusted computing, you can use memory curtaining! :-P</devils-advocate>
But then you have to actually be willing to pay for a computer someone else owns. :p |
is there a "try to lock, skip if timed out" operation in C# ? |
|c#|multithreading| |
<p>I need to try to lock on an object, and if its already locked just continue (after time out, or without it).</p>
<p>the C# lock statement is blocking.</p> |
Visual Studio refactoring: Remove method |
|visual-studio|refactoring|methods| |
Is there any Visual Studio Add-In that can do the remove method refactoring?
Suppose you have the following method:
Result DoSomething(parameters)
{
return ComputeResult(parameters);
}
Or the variant where Result is void.
The purpose of the refactoring is to replace all the ... |
> Who says you have to create all the images on the server with each request? Maybe you could have a static list of images or pull them from flickr. I like the "click on the kitten" captcha idea. http://www.thepcspy.com/kittenauth
If you pull from a static list of images, it becomes trivial to circumvent the captcha... |
I think you need to separate data services from web UI. When providing data services, a RESTful system is entirely appropriate, including the use of verbs that browsers can't support (like PUT and DELETE).
When describing a UI, I think most people confuse "RESTful" with "nice, predictable URLs". I wouldn't be all th... |
Perhaps you should pre-process the files, so each record is in a separate file (or at least that each file is a mmap-able size).
Also could you do all of the processing steps for each record, before moving onto the next one? Maybe that would avoid some of the IO overhead? |
Man, this is a good one. I've tried doing a bunch of things on these two pages. Have you tried just leaving the CSS out altogether and trying both pages then? I used Firebug to remove the CSS from the header on both pages, and the input still worked on one and not on the other - but, I'm inclined to believe that Fir... |
It'd be _really_ helpful to know what language we're talking about here. I'm sure I could give you some really great tips for doing this in PowerBuilder or Cobol, but that might not really be what you're after! If you're talking Java however, then you could use a shut down hook - works great for me. |
There's another reason: FxCop catches instances of anybody throwing 'Exception' and flags it, but throwing instances of 'NotImplementedException' is acceptable.
I actually like the default behavior, because it does have this differentiation. NotImplementedException is not a temporary exception to be thrown while you... |
If you're using writing a .NET application, you might consider using ClickOnce. If you need quite a bit of customization, you might look elsewhere.
We have an external process that performs updating for us. When it finds an update, it downloads it to a secondary folder and then waits for the main application to exi... |
Something like:
Dim myArray(10) as String
Would give you an array of 10 String references (each pointing to Nothing).
If you're not sure of the size at declaration time, you can declare a String array like this:
Dim myArray() as String
And then you can point it at a properly-sized array of String... |
Most application servers provide a JMX interface, so you could invoke that. |
I would select ID column(s) the set of rows that you want to keep into a temp table or table variable. Then delete all the rows that do not exist in the temp table. The syntax mentioned by another user:
DELETE FROM Table WHERE ID NOT IN (SELECT TOP 10 ID FROM Table
Has a potential problem. The "SELECT TOP ... |
I would select ID column(s) the set of rows that you want to keep into a temp table or table variable. Then delete all the rows that do not exist in the temp table. The syntax mentioned by another user:
DELETE FROM Table WHERE ID NOT IN (SELECT TOP 10 ID FROM Table
This syntax should work, based what you li... |
I would select ID column(s) the set of rows that you want to keep into a temp table or table variable. Then delete all the rows that do not exist in the temp table. The syntax mentioned by another user:
DELETE FROM Table WHERE ID NOT IN (SELECT TOP 10 ID FROM Table
Has a potential problem. The "SELECT TOP ... |
It should be w3wp.exe
EDIT: In line with Darren's comment, you should also check the "Show processes from all users" in Task Manager if that is where you are looking for the process. |
At one time, I remember seeing the MSDN library state to use CStr() because it was faster. I do not know if this is true though. |
Many algorithms are expressed more easily if you can jump across two loops (or a loop containing a switch statement). Don't feel bad about it. On the other hand, it may indicate an overly complex solution. So stand back and look at the problem.
Some people prefer a "single entry, single exit" approach to all loops. ... |
make sure you have show all processes checked (in vs) |
Something like:
Dim myArray(9) as String
Would give you an array of 10 String references (each pointing to Nothing).
If you're not sure of the size at declaration time, you can declare a String array like this:
Dim myArray() as String
And then you can point it at a properly-sized array of Strings... |
Something like:
Dim myArray(9) as String
Would give you an array of 10 String references (each pointing to Nothing).
If you're not sure of the size at declaration time, you can declare a String array like this:
Dim myArray() as String
And then you can point it at a properly-sized array of Strings... |
Redirect from domain name to a dotted quad hosted box |
|php|hosting|dns| |
I have a php server that is running my domain name. For testing purposes I am running an asp.net on a dotted quad IP. I am hoping to link them together via either php or some kind of dns/htaccess voodoo.
So if I go to www.mydomain.com/test it redirects (but keeps the url of (www.mydomain.com/test) in the main bar... |
It is worth noting that a lot of tools like Nant run on mono 'out of the box', i.e.
mono nant.exe
works |
@Chirs
I think you need to clarify shell vs host(emulator). To me it sounds like you need another interface to your existing shell that better supports copy and paste, not another shell that supports more/different features.
I second Pat's suggestion of Console2, it is a very good application and OSS to boot. |
How do you move a file in SVN? |
|svn|tortoisesvn| |
I'm using TortoiseSVN against the SourceForge SVN repository. I'd like to move a file from one folder to another in order to maintain its revision history. Is this possible? If so, how do you do it?
(My current strategy has been to copy the file into the new folder and check it in and then delete the file from the c... |
Another thing to consider is that most of the "major" apps I've been using (FileZilla, Paint.NET, etc.), are having the updaters uninstall the previous version of the app and then doing a fresh install of the new version of the application.
I understand this won't work for really large applications, but this does s... |
this site will do it for you:
[ajaxload][1]
and on OS X it's called the "Beachball" and I like to add "Of Death".
[1]: http://www.ajaxload.info/ |
Javascript spinning wait hourglass-type thing |
|jquery|javascript| |
I'd like to indicate to the user of a web app that a long-running task is being performed. On Once upon a time, this concept would have been communicated to the user by displaying an hourglass. Nowadays, it seems to be an animated spinning circle. (e.g., when you are loading a new tab in Firefox, or booting in Mac OS X... |
|javascript|jquery| |
I'd like to indicate to the user of a web app that a long-running task is being performed. On Once upon a time, this concept would have been communicated to the user by displaying an hourglass. Nowadays, it seems to be an animated spinning circle. (e.g., when you are loading a new tab in Firefox, or booting in Mac OS X... |
I assume you meant something to indicate background activity during an Ajax call.
I tend to have a CSS class which sets the background image to a little animated GIF, with appropriate padding and positioning (remember to turn background-repeat off), and then add and remove that class using a couple of JavaScript hel... |
I like Embedded Systems. Even if you don't program for embedded systems, the software articles are excellent. http://www.embedded.com/ |
No, it is not possible. |
It looks like you can [download the symbols][1], though not available for browsing.
[1]: http://geekswithblogs.net/sdorman/archive/2007/05/23/Debugging-in-Visual-Studio-2005-with-a-Symbol-Server.aspx |
There are two methods - you can used Visual Studio Tools for Office (VSTO):
<http://blogs.msdn.com/pstubbs/archive/2004/12/31/344964.aspx>
or you can use COM:
<http://blogs.msdn.com/eric_carter/archive/2004/12/01/273127.aspx>
I'm not sure if the VSTO method would work in older versions of Excel, but the COM... |
To delete something without saving it in a register, you can use the "black hole register":
"_d
Of course you could also use any of the other registers that don't hold anything you are interested in.
|
document.location = "http://url_submitting_to.com?query_string_param=" + window.location; |
C++ Comma Operator |
|c++| |
How does the comma operator work in C++?
For instance, if I do:
a = b, c;
Does a end up equaling b, or c?
(Yes, I know this is easy to test - just documenting on here for someone to find the answer quickly.) |
|c++|duplicate| |
|c++| |
How does the comma operator work in C++?
For instance, if I do:
a = b, c;
Does a end up equaling b or c?
(Yes, I know this is easy to test - just documenting on here for someone to find the answer quickly.)
**Update:** This question has exposed a nuance when using the comma operator. Just to doc... |
What is the best strategy for code chunks and macros in vim? |
|vim|vi| |
As I develop more with vim, I find myself wanting to copy in blocks of useful code, similar to "templates" in Eclipse.
I was thinking of making a separate file for each code chunk and just reading them in with
<code>:r code-fornext</code><br/>
but that just seems kind of primitive. Googling around I find vim macr... |
As I develop more with vim, I find myself wanting to copy in blocks of useful code, similar to "templates" in Eclipse.
I was thinking of making a separate file for each code chunk and just reading them in with
:r code-fornext
but that just seems kind of primitive. Googling around I find vim macros mention... |
Further to labels being like goto's: Use them sparingly, and only when they make your code more understandable **and** faster,
e.g., If you are in big loops six levels deep and you encounter a condition that makes the rest of the loop pointless to complete, there's no sense in having 6 extra trap doors in your cond... |
These are just scattered thoughts on organization for projects being worked on mostly with the Flash IDE.
First, I highly recommend using source control, like Subversion, CVS, or Git.
Organization of filesystem folder structure is subjective, but I generally have a "src" folder for all my source FLAs and AS clas... |
When should one use a project reference opposed to a binary reference? |
|coding-style|standards| |
My company has a common code library which consists of many class libary projects along with supporting test projects. Each class library project outputs a single binary, e.g. Company.Common.Serialization.dll. Since we own the compiled, tested binaries as well as the source code, there's debate as to whether our consum... |
in JQuery:
$('#SubmitButtonID').click(function() { this.disabled = true; });
|
Subversion has native support for moving files.
svn move SOURCE DESTINATION
See the online help (svn help move) for more information. |
i think in the svn browser in tortoisesvn you can just drag it from one place to another. |
If I'm not wrong starting from version 1.5 SVN can track moved files\folders. In TortoiseSVN use can move file via drag&drop. |
May also be called, "rename" by tortoise, but svn move, is the command in the barebones svn client. |
If you are using Oracle you would **Select for update** on the rows you are locking.
here is an example
SELECT address1 , city, country
FROM location
FOR UPDATE;
|
I also had trouble activating and bringing a window to the foreground. Here is the code that eventually worked for me. I'm not sure if it will solve your problem.
Basically, call ShowWindow() then SetForegroundWindow().
// Sets the window to be foreground
[DllImport("User32")]
private static extern ... |
I dont think there are any such conventions out there.
The only way you can do it is perhaps use BEGIN/END blocks, if the resources are to be used over the whole file.
The general approach I take is to put related tests in one code block and then initialize the variables/resource etc there. You can perhaps keep a... |
I dont think there are any such conventions out there.
The only way you can do it is perhaps use BEGIN/END blocks, if the resources are to be used over the whole file.
The general approach I take is to put related tests in one code block and then initialize the variables/resource etc there. You can perhaps keep a... |
Singletons are more flexible, which can be useful in cases where you want the Instance method to return different concrete subclasses of the Singleton's type based on some context. |
When to use singleton pattern versus static class |
|design-patterns| |
Name the design considerations in deciding between use of a [singleton][1] versus a static class. In doing this, you're kind of forced to contrast the two, so whatever contrasts you can come up with are also useful in showing your thought process! Also, every interviewer likes to see illustrative examples. :)
[1]:... |
When should I use the singleton pattern instead of a static class? |
When should you use the singleton pattern instead of a static class? |
|design-patterns| |
Use GET when you want the URL to reflect the state of the page. This is useful for viewing dynamically generated pages, such as those seen here. A POST should be used in a form to submit data, like when I click the "Post Your Answer" button. It also produces a cleaner URL since it doesn't generate a parameter string af... |
Use GET if you don't mind the request being repeated (That is it doesn't change state).
Use POST if the operation does change the system's state. |
Is code written in Vista 64 compatible on 32 bit os? |
|64-bit|compatibility|development-environment| |
We are getting new dev machines and moving up to Vista 64 Ultimate to take advantage of our 8gb ram. Our manager wants us to do all dev in 32bit virtual machines to make sure there will be no problems with our code moving into production.
Is there anyway to guarantee the resultant programs will work on 32bit os's... |
We are getting new dev machines and moving up to Vista 64 Ultimate to take advantage of our 8gb ram. Our manager wants us to do all dev in 32bit virtual machines to make sure there will be no problems with our code moving into production.
Is there anyway to guarantee the resultant programs will work on 32bit os's... |
We are getting new dev machines and moving up to Vista 64 Ultimate to take advantage of our 8gb ram. Our manager wants us to do all dev in 32bit virtual machines to make sure there will be no problems with our code moving into production.
Is there anyway to guarantee the resultant programs will work on 32bit os's... |
I like OpenID, but I'd still go with the email address, unless your user community is very technically savvy. It's still much easier for most people to understand and remember. |
My team keeps separate versions of the config files for each environment (web.config.dev, web.config.test, web.config.prod). Our deployment scripts copy out the correct version, renaming it to web.config. This way, we have full version control on the config files for each environment, can easily perform a diff, etc. |