instruction stringlengths 0 30k ⌀ |
|---|
|wpf| |
I've done some WPF programing and one thing I never got was the command pattern. Every example seems to be for built in ones, edit, cut, paste. Anyone have an example or suggestion of best practice for custom commands? |
I believe you need to add a section with
<Directory "/home/other_files">
(options)
</Directory>
to your server configuration before apache will be able to serve anything from it. For an example, my DocumentRoot is /var/www but there is this section in the default available site:
Alias /do... |
Flags allow you to use bitmasking inside your enumeration. This allows you to combine enumeration values, while retaining which ones are specified.
<pre><Code>
[Flags]
public enum DashboardItemPresentationProperties : long
{
None = 0,
HideCollapse = 1,
HideDelete = 2,
HideEdit = 4,
HideOpenInNewW... |
It's a fairly simple process. Take a function, bind one of its arguments and return a new function. For example:
let concatStrings left right = left + right
let makeCommandPrompt= appendString "c:\> "
Now by currying the simple concatStrings function, you can easily add a DOS style command prompt to the ... |
Is the number of extra bytes you need equal to the number of lines in the file? I ask because perhaps its possible that somehow carriage-returns are being introduced but not counted.
|
We recently went through this in my organization. Although it is not the best solution, and hitting the right session across multiple browser windows is rough, we put a countdown timer on our page, included a button that just went back and hit the server to restart the session, and also provided the user with a JavaSc... |
I've always had the most success using PDFs to accomplish this. I can't think of a more universally acceptable format that does what you are trying to do. Rather than looking for another format, perhaps it would be better to try to understand how to overcome the problems that you are experiencing with Acrobat on the ... |
If you are using a SQL browsing tool like TOAD or TORA it will help you with ORA errors by highlightling or pointing moving the cursor to where you made your error.
Copy and paste your SQL in to one of these tools to help. You may also find the analyse info available useful too. |
Have the browser ping the server via Ajax periodically to keep the session alive. Most sites do something useful in this ping, like save a draft of the user's submission. |
How are you getting the number of bytes? .. By looking at the size of the file on the filesystem?
You can use "-s" to get the size of the file.
Or, if you want to do more, you may use [File::Stat](http://search.cpan.org/~rgarcia/perl-5.10.0/lib/File/stat.pm) |
I think by 'cleanly' you mean like with a 300 redirect. Config for a lot of servers & languages [here][1].
[1]: http://www.somacon.com/p145.php |
DELETE FROM Table WHERE ID NOT IN (SELECT TOP 10 ID FROM Table)? |
DELETE FROM Table WHERE ID NOT IN (SELECT TOP 10 ID FROM Table)?
Edit: Chris brings up a good performance hit since the TOP 10 query would be run for each row. If this is a one time thing, then it may not be as big of a deal, but if it is a common thing, then I'd look closer at it. |
In your accepted answer you should add parenthesis around the 'b' in the macro expansion (I don't have enough points yet to edit other's content):
#define BOOL_STR(b) ((b)?"true":"false")
This is a [defensive programming][1] technique that protects against hidden order-of-operations errors; i.e., how does thi... |
If you decide to use macros (or are using C on a future project) you should add parenthesis around the 'b' in the macro expansion (I don't have enough points yet to edit other people's content):
#define BOOL_STR(b) ((b)?"true":"false")
This is a [defensive programming][1] technique that protects against hidde... |
One way to differentiate is that "business logic" is something the customer would care about and that could be explained to a customer without referring to computer-specific words. |
Specifically in Visual Studio go to "Tools-Options" then Select "Source Control-visual Studio Team Founation Server" and check the "Show deleted items in the Source Control explorer".
Having done that - you can then right click a folder and say "Undelete" |
How do you get double-underscores to display in markdown? |
|markdown| |
In python, there are some special variables and filenames that are surrounded by double-underscores. For example, there is the
__file__
variable. I am only able to get them to show up correctly inside of a code block. What do I need to enter to get double underscores in regular text without having them in... |
[According to MSDN][1]:
> [The `Project`] statement contains the
> unique project GUID and the project
> type GUID. This information is used by
> the environment to find the project
> file or files belonging to the
> solution, and the VSPackage required
> for each project. The project GUID is
> passed to IVs... |
Neither GUID is the same GUID as from AssemblyInfo.cs (that is the GUID for the assembly itself, not tied to Visual Studio but the end product of the build).
So, for a typical line in the sln file (open the .sln in notepad or editor-of-choice if you wish to see this):
Project("{FAE04EC0-301F-11D3-BF4B-00C04F7... |
I wound up writing a .net c# UI to deal with the xml data. Using xsl for display and an xml schema helped display the xml nicely and maintain it's integrity.
edit: Also c# contains the xmldocument class that simplefies reading/writing the data. |
Yes your insight is correct.
This is called [dynamic programming][1]. It is usually a common memory runtime trade-off.
In the case of fibo, you don't even need to cache everything :
[edit]
The author of the question seems to be looking for a general method to cache rather than a method to compute Fibonacci. S... |
The IRC Specification is laid out in RFC 1459
http://www.irchelp.org/irchelp/rfc/rfc.html |
I used a [much less complicated version recently][1] with [jQuery][2]:
<script src="scripts/jquery.js" type="text/javascript"></script>
<script type="text/javascript">//<![CDATA[
var js = ["scripts/jquery.dimensions.js", "scripts/shadedborder.js", "scripts/jqmodal.js", "scripts/main.js"];
var ... |
Is It Possible To Raise An Event When A File Becomes Accessible? |
Flex MVC Frameworks |
|apache-flex|model-view-controller|framework| |
I'm currently using and enjoying using the Flex MVC framework [PureMVC][1]. I have heard some good things about Cairngorm, which is supported by Adobe and has first-to-market momentum. And there is a new player called Mate, which has a good deal of buzz.
Has anyone tried two or three of these frameworks and formed... |
|apache-flex|model-view-controller|frameworks| |
Esacping XML tag contents |
|.net|xml|framework|escaping|encode| |
I have a simple CAML query like
<Where><Eq><Field="FieldName"><Value Type="Text">Value text</Value></Field></Eq></Where>
And I have a variable to substitute for "Value text". What's the best way to validate/escape the text that is substituted here in the .NET framework?
I've done a quick web search on this p... |
I have a simple CAML query like
<Where><Eq><Field="FieldName"><Value Type="Text">Value text</Value></Field></Eq></Where>
And I have a variable to substitute for "Value text". What's the best way to validate/escape the text that is substituted here in the .NET framework?
I've done a quick web search on this p... |
Escaping XML tag contents |
|.net|xml|frameworks|escaping|encode| |
ASP.NET MVC and Spring.NET |
|asp.net-mvc|framework|spring.net| |
Starting a new project and would like to use one of the MVC framworks. [ASP.NET MVC][1] is still in preview but [Spring.net][2] is in production and has a history with Java. I'd like to know the general lowdown between the two.
Current questions..
What are the major feature differences?
What about deployment... |
|asp.net-mvc|frameworks|spring.net| |
Conventions for Perl Test::More module |
I have an asp.net page with an asp:button that is not visible. I cant turn it visible with javascript because its not rendered to the page. What are my alternatives to solve this?
Thanks in advance,
Artur |
If you wait until the page is loaded, and then set the button's display to none, that should work. Then you can make it visible at a later point. |
I would like a recommendation for a book on Eclipse's Rich Client Platform (RCP). |
|java|eclipse|rcp|myeclipse| |
I have read through several reviews on Amazon and some books seem outdated. I am currently using MyEclipse 6.5 which is using Eclipse 3.3. I'm interested in hearing from people that have experience learning RCP and what reference material they used to get started. Thanks in advance. Bruce |
Here's my strategy (I use JUnit, but I'm sure there's a way to do the equivalent in PHP):
I have a method that runs before all of the Unit Tests for a specific DAO class. It puts the dev database into a known state (adds all test data, etc.). As I run tests, I keep track of any data added to the known state. This da... |
First of all its a matter of casing...
Change Part_Track to PART_Track which will fix your binding error..
But I do not think that this is what you are trying to do..
You could use a Grid instead of a canvas, and the Thumb will size automatically. Canvas does not really have a height, for it does not really ca... |
First of all its a matter of casing...
Change <pre><code>Part_Track</code></pre> to <pre><code>PART_Track</code></pre> which will fix your binding error..
But I do not think that this is what you are trying to do..
You could use a Grid instead of a canvas, and the Thumb will size automatically. Canvas does not... |
If you need to manipulate it on the client side, you can't use the Visible property on the server side. Instead, set its display style to "none". |
If you need to manipulate it on the client side, you can't use the Visible property on the server side. Instead, set its CSS display style to "none". For example:
<asp:Label runat="server" id="Label1" style="display: none;" />
Then, you could make it visible on the client side with:
document.getEleme... |
`__`file`__`
It works! Put backticks around the underscores.
Like this:
`__`file`__` |
What Adam said. You could also add some logic to detect maximum amplitude values over a period of time and only flag those, but the essence is to determine if/when the signal hits the maximum amplitude.
MSN |
You can also put a backslash before the final underscore
__file_\_
gives you
__file_\_
|
Whether you want a perfect hashfunction (different value for each object that evaluates to equal) or just a pretty good one is always a performance tradeoff, it takes normally time to compute a good hashfunction and if your dataset is smallish you're better of with a fast function. The most important (as your second po... |
Best way to implement 1:1 asynchronous callbacks/events in ActionScript 3 / Flex? |
|actionscript-3|apache-flex|asynchronous| |
I've been utilizing the [command pattern][1] in my Flex projects, with asynchronous callback routes required between:
- whoever instantiated a given command object and the command object,
- the command object and the "data access" object (i.e. someone who handles the remote procedure calls over the network to the... |
|c#|.net|file-io| |
In C# I can use the FileSystemWatcher object to watch for a specific file and raise an event when it is created, modified, etc.
The problem I have with this class is that it raises the event the moment the file becomes created, even if the process which created the file is still in the process of writing. I have fou... |
@Jeff
> Relative to straight procedural programming, the first fundamental tenet of OOP is the notion of information hiding and encapsulation. This idea leads to the notion of the class that seperates the interface from implementation.
Which has the more hidden implementation: C++'s iostreams, or C's FILE*s?
I t... |
OOP *has* reduced costs, and increased efficiency.
When I made the jump from classic ASP/VBScript to C# I noticed a HUGE increase in productivity thanks to OOP.
|
>I found this gem on Wikipedia. Sounds intimidating.
It's actually not.
Telnet onto an IRC Server and witness the simplicity of the protocol first hand. The hardest part is the handshake, after that its very simple.
|
Not sure if there is a way of an event actually being raised by the standard class, but I eas experiencing similar problems on some recent work I was doing.
In short, I was trying to write to a file that was locked at the time. I ended up wrapping the write method up so it would automatically try the write again in ... |
What's the point of OOP? |
|language-agnostic|oop| |
As far as I can tell, in spite of the countless millions or billions spent on OOP education, languages, and tools, OOP has not improved developer productivity or software reliability, nor has it reduced development costs. Few people use OOP in any rigorous sense (few people adhere to or understand principles such as LS... |
We use [NUnit][1] and [MBUnit][2] here. We use [TestDriven.NET][3] to run the unit tests from within Visual Studio. We use the excellent, highly recommended [RhinoMocks][4] as a mock framework.
[1]: www.nunit.org
[2]: http://mbunit.com
[3]: http://testdriven.net
[4]: http://www.ayende.com/projects/rhino... |
Use a 3 step process:
1. Generate a script from the working database
2. Create a new database from that script
3. Create a backup of the new database |
Using SQLite with Visual Studio 2008 and Silverlight |
|.net|silverlight|sqlite| |
Any one know decent way to reference a SQLite database using the above mentioned tools? I tried using ODBC (the SQLite driver) but while the connection is good, I get no data returned. Like I can't see any tables in Data Connection (VS 2008). Is there a better way?
*Edit: corrected typos* |
Sun itself recommends staying away from StringTokenizer and using the String.spilt method instead.
You'll also want to look at the Pattern class. |
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\WINDOWS\Temp\phpA30E.tmp' to './people.xml' in E:\inetpub\vhosts\mywebsite.com\httpdocs\dump\upload.php on line 3
is the important line it says you can't put the file where you want it and this normally means a permissions problem
che... |
As it's Windows, there is no real 777. If you're using [chmod][1], check the Windows-related comments.
Check that the IIS Account can access (read, write, modify) these two folders:
E:\inetpub\vhosts\mywebsite.com\httpdocs\dump\
C:\WINDOWS\Temp\
[1]: http://fr2.php.net/manual/en/function.chmod.php |
PHP Error - Uploading a file |
|iis|windows|php|upload| |
I'm trying to write some php to upload a file to a folder on my webserver. Here's what I have:
<?php
if ( !empty($_FILES['file']['tmp_name']) ) {
move_uploaded_file($_FILES['file']['tmp_name'], './' . $_FILES['file']['name']);
header('Location: http://www.mywebsite.com/dump/');
exit;
... |
Best way to implement 1:1 asynchronous callbacks/events in ActionScript 3 / Flex / AIR? |
|apache-flex|actionscript-3|air|asynchronous| |
As far as I know LINQ to SQL does lazy loading by default. And even if it doesn't, I'm pretty sure the MS guys used some kind of [identity map][1] to ensure every record is loaded only once per DataContext.
Did you experience it getting stuck in a loop in practice?
[1]: http://en.wikipedia.org/wiki/Identity_map |
In the designer, select a property on an entity in the diagram, and in the _Code Generation_ section in the properties window, set **Delay Loaded** to _True_ .
See [this blog post](http://www.davidhayden.com/blog/dave/archive/2007/08/05/LINQToSQLLazyLoadingPropertiesSpecifyingPreFetchWhenNeededPerformance.aspx). |
My guess would be that you have to do it as an administrator...try either disabling UAC, or using gacutil.exe to add your assembly. |
Komrade,
stsadm.blogspot.com may be the answer again, you can list all the site collections and then using the command that edward posted to remove the site templates. That might help make things a bit quicker!
Although, you should only have to do it once per site collection, all subsites (as far as I remember) ... |
Use [runas][1] command to run [gacutil][2] as a user with local admin rights to register the dll to GAC.
[1]: http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr06/hey0428.mspx
[2]: http://msdn.microsoft.com/en-us/library/ex0ss12c(VS.80).aspx |
It really all depends on how many text messages you intend to send and how critical it is that the message arrives on time (and, actually arrives).
SMS Aggregators
---------------
For larger volume and good reliability, you will want to go with an SMS aggregator. These aggregators have web service API's (or SMP... |
The problem with the second way is the way Strings are handled in Java:
- `"0"` is converted into a constant String object at compile time.
- Each time this code is called, `s` is constructed as a new String object, and `javac` converts that code to `String s = new StringBuilder().append(integerObj.toString()).... |
Lisp list iteration |
|lisp|list|iteration| |
I have a function that gets x(a value) and xs(a list) and removes all values that are bigger than x from the list. Well it doesn't work, can you tell me why?
(defun biggerElems(x xs)
(let ((xst))
(dolist (elem xs)
(if (> x elem)
(setf xst (remove elem xs))))
... |
You might try [NDepend][1]. The great [Scott Hanselman discusses it more here.][2] Tons of visual dependency formats too.
[1]: http://www.ndepend.com/
[2]: http://www.hanselman.com/blog/ExitingTheZoneOfPainStaticAnalysisWithNDepend.aspx |
You might try [NDepend][1]. The great [Scott Hanselman discusses it more here.][2] Tons of visual dependency formats too. It sounds like its only for .NET though.
[1]: http://www.ndepend.com/
[2]: http://www.hanselman.com/blog/ExitingTheZoneOfPainStaticAnalysisWithNDepend.aspx |
As long as people can get at the executable - which, unless you want to run the game on a locked kiosk, is always the case - there's no perfectly secure way of doing this.
The music and movie industries spent tens of millions on DRM that got cracked by home hobbyists in days/weeks. If they can't protect *their* stu... |
I would be very hesitant to place the WebBrowser control between your software and the flv, because you will lose all control of the flv and will not get any meaningful notifications about its status. The lack of tight integration will lead to a very poor user experience. The blog post [here][1] has instructions on emb... |
We have two projects in our solution that are built completely out of generated code. Basically, we run the code generator .exe as a post-build step for another project and along with generating the code, it automates the active instance of visual studio to make sure that the generated project is in the solution, that... |
Reading all the answers reminded me that I actually never looked into solving this using a Firefox add-on. I soon found [Update Scanner][1] and I think it look really promising!
[1]: https://addons.mozilla.org/en-US/firefox/addon/3362 |
Make sure the Visible property is set to true or the control won't render to the page. Then you can use script to manipulate it. |
What is the value-binding syntax in xaml? |