instruction stringlengths 0 30k ⌀ |
|---|
Singletons are a hotly debated design pattern, so I am interested in what the Stackoverflow community thought about them.
Please provide reasons for your opinions, not just "Singletons are for lazy programmers!"
Here is a fairly good article on the issue, all though it is against the use of Singletons:
[scientif... |
|language-agnostic|design-patterns|singleton| |
The main thing is that VisualSVN uses TortoiseSVN for nearly all of its UI. So you only really have to set up one client (preferred diff viewer, etc), and you can take advantage of things like the same "Previous messages" button on the Commit dialog, whether your committing from Explorer or Visual Studio. |
You'll pretty much have to roll your own Close button, but you can hide the window chrome completely using the WindowStyle attribute, like this:
<Window WindowStyle="None">
That will still have a resize border. If you want to make the window non-resizable then add ResizeMode="NoResize" to the declaration. |
Check out Eric Sink's [Twelve days of WPF 3D][1].
[1]: http://www.ericsink.com/wpf3d/index.html |
Link to samba shares in html |
|samba|smb|html| |
*First off if you're unaware, samba or smb == Windows file sharing, \\\computer\share etc.*
I have a bunch of different files on a bunch of different computers. It's mostly media and there is quite a bit of it. I'm looking into various ways of consolidating this into something more manageable.
Currently there are... |
*First off if you're unaware, samba or smb == Windows file sharing, \\\computer\share etc.*
I have a bunch of different files on a bunch of different computers. It's mostly media and there is quite a bit of it. I'm looking into various ways of consolidating this into something more manageable.
Currently there are... |
|html|samba|smb| |
*First off if you're unaware, samba or smb == Windows file sharing, \\\computer\share etc.*
I have a bunch of different files on a bunch of different computers. It's mostly media and there is quite a bit of it. I'm looking into various ways of consolidating this into something more manageable.
Currently there are... |
If you can run scripts, it might be as simple as runing the CACLS command on the VM. Perhaps just have your deployment script read in a config and run the appropriate CACLs commands. |
How to determine if user selected a file for file upload? |
|javascript|html|upload| |
If I have a
`<input id="uploadFile" type="file" />`
tag, and a submit button, how do I determine, in IE6 (and above) if a file has been selected by the user.
In FF, I just do:
`var selected = document.getElementById("uploadBox").files.length > 0;`
But that doesn't work in IE. |
It decreased one of my pages from 2MB payload, to 200k, just by eliminating the viewstate and making it bearable programatically to work with the submitted output.
The size alone, even though the processing was the same will create vast improvements in connections per second and speed of the requests. |
How to get started with PowerShell? |
|powershell| |
I played with one of the early beta's of Powershell V1, but haven't used it since it went "gold". What is the best way to get started using Powershell? Which version of Powershell should I be using (V1.0 vs 2.0 CTP's)? What are you using Powershell for? Are there any tools that make using Powershell easier (i.e. develo... |
|scripting|powershell| |
> String length may vary, but let's say 10 characters for now.
In that case, in order to guarantee uniqueness you'd have to use some sort of big integer representation. I doubt that doing comparisons on big integers would be substantially faster than doing string comparisons in the first place. I'll second what ot... |
In the Network Connections on the host PC, you might try repairing the connections that are created by VMWare. Something like "VMWare Network Adapter VMnet1"
I'm assuming that the network connections (to a LAN/Internet) are working on the host computer. If not, I'd start by fixing the host first. |
You need multi-processing or multi-threading. You aren't specific on the details of the server, so I can't give you advice on what to do exactly. fork and exec as Matt suggested can be a solution, but really: what kind of protocol/server are we talking about? |
> Blockquote If your app needs a lot of CPU to operate normally, however, most of the .NET profilers on the market won't be able to handle it.
> Blockquote
I have used a trial version of RedGate Ant's profiler on an optimizing algorithm that normally uses up to 100% CPU on a single core machines and though slow it... |
(In this example, I am assuming port 2222 will go to your internal host. $externalip and $internalip are the ip addresses or hostnames of the visible and internal machine, respectively.)
You have a couple of options, depending on how permanent you want the proxying to be:
- Some sort of TCP proxy. On Linux, th... |
Displaying version of underlying software in footer of web app? |
|web-application|versioning|assemblies| |
I am thinking about providing the version of say, the database schema, and the dlls for business logic in the footer of my web application.
Is this advised?
Are there any pitfalls, or pointers of how to do this best?
Usability concerns?
**I already have a version scheme, for both schema and dlls, used in my... |
|web-applications|versioning|assemblies| |
File Access Strategy in a Multi-Threaded Environment (Web App) |
|caching|file-io|files|multithreading|web-application| |
I have a file which is an XML representation of some data that is taken from a Web service and cached locally within a Web Application. The idea being is that this data is _very_ static, but just _might_ change. So I have set it up to cache to a file, and stuck a monitor against it to check if it has been deleted. Once... |
|asp.net|multithreading|web-application|caching|file-io| |
I have a file which is an XML representation of some data that is taken from a Web service and cached locally within a Web Application. The idea being is that this data is _very_ static, but just _might_ change. So I have set it up to cache to a file, and stuck a monitor against it to check if it has been deleted. Once... |
|asp.net|multithreading|web-applications|caching|file-io| |
Build a Basic Python Iterator |
Try [SetConsoleTitle](http://msdn.microsoft.com/en-us/library/ms686050.aspx). |
If you look back at your old code and say, "What was I thinking! This is rubbish, I write code much better now!" then you have developed as a programmer.
If the sites are fairly temporary (i.e. you build it quickly, it gets used for a specific purpose and amount of time and then it is effectively closed) then bangin... |
Not sure if you're looking for hardware solutions to automate yourself, or external services. However, I've used BT's [Web21C][1] pretty extensively.
They have an excellent .Net API and a host of functionality. Their pricing is the best in the UK, but might fall down with US SMS, which is obviously cheaper - there a... |
How can I overwrite the same portion of the console in a Windows native C++ console app, without using a 3rd Party library? |
|c++|console|windows| |
I have a console app that needs to display the state of items, but rather than having text scroll by like mad I'd rather see the current status keep showing up on the same line. For the sake of example:
> `Running... nn% complete`
should be the output, where 'nn' is the current percentage complete, updated perio... |
*First off if you're unaware, samba or smb == Windows file sharing, \\\computer\share etc.*
I have a bunch of different files on a bunch of different computers. It's mostly media and there is quite a bit of it. I'm looking into various ways of consolidating this into something more manageable.
Currently there are... |
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300" WindowStyle="None" ResizeMode="NoResize">
<Button HorizontalAlignment="Right... |
Try Supervise, which is what qmail uses to keep track of it's services/startup applications:
<http://cr.yp.to/daemontools/supervise.html>
|
WPF is a new technology that will supersede Windows Forms.
WPF stands for Windows Presentation Foundation
Here are some useful topics on SO:
1. [What WPF books would you recommend][1]
2. [What real world WPF applications are out there][2]
From my practice I can say that WPF is a truly amazing technology howe... |
WPF is a new technology that will supersede Windows Forms.
WPF stands for Windows Presentation Foundation
Here are some useful topics on SO:
1. [What WPF books would you recommend][1]
2. [What real world WPF applications are out there][2]
From my practice I can say that WPF is a truly amazing technology howe... |
I know you said you prefer the command line, but for others who are interested in this, [TinyCA][1] is a very easy to use GUI CA software. I have used this both in Linux, and also in OSX.
[1]: http://tinyca.sm-zone.net/ "TinyCA" |
i dont think the linq you wrote would compile, it'd have to be
public string branchName (string branchId)
{
//branchList populated in the constructor
branch_summary bs = (from b in branchList where b.id == branchId select b).FirstOrDefault();
return branch_summary == null ? null ... |
Some more information on the F9 keyboard shortcuts for calculation in Excel
- F9 Recalculates all worksheets in all open workbooks
- Shift+F9 Recalculates the active worksheet
- Ctrl+Alt+F9 Recalculates all worksheets in all open workbooks (Full recalculation)
- Shift+Ctrl+Al... |
How do I publish a Asp.net web application using MSBuild? |
|asp.net-mvc|msbuild|nant|publish| |
I am trying to publish an Asp.net MVC web application locally using the NAnt and MSBuild. This is what I am using for my NAnt target;
<target name="publish-artifacts-to-build">
<msbuild project="my-solution.sln" target="Publish">
<property name="Configuration" value="debug" />
<pro... |
Well, what is dojo.js doing at line 319? |
The "Publish" target you are trying to invoke is for "OneClick" deployment, not for publishing a website... This is why you are getting the seemingly bizarre message.
You would want to use the AspNetCompiler task, rather than the MSBuild task. See <http://msdn2.microsoft.com/en-us/library/ms164291.aspx> for more in... |
Where you import dojo.js:
<script type="text/javascript" src="/dojotoolkit/dojo/dojo.js" djConfig="parseOnLoad: true"/>
It should be:
<script type="text/javascript" src="/dojotoolkit/dojo/dojo.js" djConfig="parseOnLoad:true"></script>
Have fun with dojo, it's can do some cool stuff.
Brian Gianf... |
Best way to compress HTML, CSS & JS with mod_deflate and mod_gzip disabled |
|php|html|apache|compression| |
I have a few sites on a shared host that is running Apache 2. I would like to compress the HTML, CSS and Javascript that is delivered to the browser. The host has disabled mod_deflate and mod_gzip, so these options are out. I do have PHP 5 at my disposal, though, so I could use the gzip component of that.
I am curre... |
Not all profilers cost (extra) money. For .Net, I'm successfully using an old build of NProf (currently abandoned but it still works for me) for profiling my ASP.Net applications. For SQL Server, the query profiler is part of the package. There's also the CLF Profiler from MS but I've never been able to get it to wo... |
How are you loading them into the database? Is this with your own code to read the Excel files? You can [read the Excel files using ADO/ADO.NET with the right connection string][1]. Then you could read the data using a query that would weed out the dupes.
[1]: http://stackoverflow.com/questions/15828/reading-ex... |
@vitule
I'll have to look into that and get back to you. The problem on my end seems to be that there is code running in a different class, in a different feature, being controlled by a different thread, all of which are trying to access the same record.
I am trying to avoid using a fixed delay. With any thread... |
System.Drawing is built on top of GDI+. It's just a wrapper.
[http://msdn.microsoft.com/en-us/library/system.drawing.aspx][1]
[1]: http://msdn.microsoft.com/en-us/library/system.drawing.aspx |
Is there an open source SQL Server DB compare tool? |
|sql-server| |
I'm working on an open source project that uses SQL Server 2005 as the data store. We need a DB compare tool to generate diff scripts to be able to upgrade a DB from one version to another.
Is there an open source or free SQL Server DB diff tool out there that generates a convert script? |
Have you tried putting a [WindowsFormsHost][1] control on a WPF window/control? That will allow WPF to render a WinForms control.
[1]: http://msdn.microsoft.com/en-us/library/system.windows.forms.integration.windowsformshost.aspx |
Yes, you can use Hadoop on a local filesystem by using file URIs instead of hdfs URIs in various places. I think a lot of the examples that come with Hadoop do this.
This is probably fine if you just want to learn how Hadoop works and the basic map-reduce paradigm, but you will need multiple machines and a distribu... |
WPF is a new technology that will supersede Windows Forms.
WPF stands for Windows Presentation Foundation
Here are some useful topics on SO:
1. [What WPF books would you recommend][1]
2. [What real world WPF applications are out there][2]
From my practice I can say that WPF is a truly amazing technology howe... |
To make the links work cross platform you could look at the User Agent either in a CGI script or in JavaScript and update your URLs appropriately.
Alternatively, if you want to consolidate SMB shares you could try using [Microsoft DFS][1] (which also works with Samba).
You set up a DFS root and tell it about all ... |
To make the links work cross platform you could look at the User Agent either in a CGI script or in JavaScript and update your URLs appropriately.
Alternatively, if you want to consolidate SMB shares you could try using <a href="http://en.wikipedia.org/wiki/Distributed_File_System_(Microsoft)">Microsoft DFS</a> (whi... |
Do you want to know if you can home-roll something or are you looking for an app you can get off the shelf?
I'm not a Windows guy, but I think Microsoft's MOM/SCOM solution will probably let you view the event log over a web UI - probably really heavy and expensive if that's all you need though.
A quick google fo... |
Check out the Windows Management Performance counters.
If you look in your Administrative Tools and find "Performance Counters", you will be able to dig through there and find detailed metrics on what is happening on each message queue. This can also work for remote servers.
Should you wish to create some sort of... |
|c++|windows|console| |
I have a console app that needs to display the state of items, but rather than having text scroll by like mad I'd rather see the current status keep showing up on the same lines. For the sake of example:
> `Running... nn% complete`
`Buffer size: bbbb bytes`
should be the output, where 'nn' is the current per... |
Visual studio 2005 closes slowly |
|visual-studio| |
I experience that on several different machines, with plugins, without plugins, with VB.net or c# solutions of many different sizes, closing the solution in VS 2005 generally takes significantly more time than actually building the solution.
This has always been the case for me since I started using visual studio 2... |
You can use [SetConsoleCursorPosition](http://msdn.microsoft.com/en-us/library/ms686025.aspx). You'll need to call [GetStdHandle](http://msdn.microsoft.com/en-us/library/ms683231.aspx) to get a handle to the output buffer. |
In case the Joseph's suggestion does not give you enough flexibility, have a look at the Console API: http://msdn.microsoft.com/en-us/library/ms682073(VS.85).aspx. |
I've found that closing all the open documents before you close the solution helps speed it up. Or maybe it's just a perception thing, but it *seems* faster :) |
> What on earth is visual studio doing
> when you have actually told it to shut
> down?
You can use [Process Monitor][1] from sysinternals. It maybe because of some plugins. Try resetting your Visual Studio settings (**Tools->Import and Export Settings->Reset All Settings**).
[1]: http://technet.microsoft.c... |
In Ubuntu, you can install [Firestarter][1] and then use it's [Forward Service][2] feature to forward the SSH traffic from a non standard port on your machine with external access to port 22 on the machine inside your network.
[1]: https://help.ubuntu.com/8.04/keeping-safe/C/firewall.html "Set up a firewall"
... |
In Ubuntu, you can install [Firestarter][1] and then use it's [Forward Service][2] feature to forward the SSH traffic from a non standard port on your machine with external access to port 22 on the machine inside your network.
On OS X you can edit the [/etc/nat/natd.plist][3] file to enable port fowarding.
[1... |
|python|object|iterator| |
How would one create an iterative function (or iterator object) in python? |
|python|object|iterator| |
How do you unit test web apps hosted remotely? |
|tdd|unit-testing|web-application| |
I'm familiar with TDD and use it in both my workplace and my home-brewed web applications. However, every time I have used TDD in a web application, I have had the luxury of having full access to the web server. That means that I can update the server then run my unit tests directly from the server. My question is, ... |
|tdd|unittesting|web-application| |
|unit-testing|tdd|web-application| |
|unit-testing|web-applications|tdd| |
Top tips for secure web applications |
|security|web-application| |
I am looking for easy steps that are simple and effective in making a web application more secure.
What are your top tips for secure web applications, and what kind of attack will they stop? |
|security|web-applications| |
How do I implement OpenID in my web application? |
|c#|java|python|stackoverflow|openid| |
Does Stackoverflow create a new OpenID when a user registers with an email address (i.e. does not provide an existing OpenID)? How do you do that? Do you have code examples in C#? Java? Python? |