instruction stringlengths 0 30k ⌀ |
|---|
|html|browser| |
It seems to be a common design pattern in .NET code. Here is a citation from [Framework design guidelines][1]
> Consider providing method Close(), in addition to the Dispose(), if close is standard terminology in the area. When doing so, it is important that you make the Close implementation identical to Dispose ..... |
The Adobe example "works" in Firefox 3.0.1 in the sense that the background is transparent. However, in Firefox 3.0.1 and Safari 3.1.2 you must click the play button twice to see the animation. |
Looks like you're right. Bummer. No MouseOver event.
One of the fallbacks that always works with .NET, though, is P/Invoke. Someone already took the time to do this for the .NET CF TextBox. I found this on CodeProject:
[http://www.codeproject.com/KB/cs/TextBox_subclassing.aspx][1]
Hope this helps
[1]: http:... |
You can do this in two lines in python with
allSums = set(a+b for a in X for b in X)
allSums = sorted(allSums)
The cost of this is n^2 (maybe an extra log factor for the set?) for the iteration and s * log(s) for the sorting where s is the size of the set.
The size of the set could be as big as n*(n-... |
Hmm there might be a substantial difference between WPF en Silverlight on this point..
I seem to have no trouble what so even compiling and running this sample in a WPF window:
<code>
<Slider Width="400" Height="20">
<Slider.Template>
<ControlTemplate>
<Border Na... |
How can I split an XML document into thirds (or, even better, n pieces)? |
|xml| |
I would like to use a language that I am familiar with - Java, C#, Ruby, PHP, C/C++, although examples in any language or pseudocode are more than welcome.
What is the best way of splitting a large XML document into smaller sections that are still valid XML? For my purposes, I need to split them into roughly thirds ... |
When I searched for TextMate alternative for Linux, I ended up using [Geany][1]. It's not as powerfull, but still nice to work with. Great replacement for Kate.
[1]: http://geany.uvena.de/ |
Those are two of the things that are used by search engines. The exact weight of each changes frequently, they are generally regarded; however, as being fairly important.
One thing to note, care should be taken when entering values. The more relevant the keywords and description are to the textual content of the s... |
sp_depends is not reliable see: [Do you depend on sp_depends (no pun intended)][1]
[1]: http://sqlblog.com/blogs/denis_gobo/archive/2008/05/06/6653.aspx |
The brackets are required if you use keywords or special chars in the column names. You could name a column [First Name] (with a space)--but then you'd need to use brackets everywhere.
The newer tools add them everywhere just in case or for consistency. |
The brackets are required if you use keywords or special chars in the column names. You could name a column [First Name] (with a space)--but then you'd need to use brackets every time you referred to that column.
The newer tools add them everywhere just in case or for consistency. |
When I see Hungarian discussion, I'm glad to see people thinking hard about how to make their code clearer, and how to mistakes more visible. That's exactly what we should all be doing!
But don't forget that you have some powerful tools at your disposal besides naming.
**Extract Method** If your methods are ge... |
[This article](http://searchengineland.com/070905-194221.php) has some info on it.
A quick summary is:
Google and Microsoft: No
Yahoo and Ask: Yes |
All those of you that mentioned Alt Tab and Ctrl Tab missed out the shift versions too
CTRL-SHIFT-TAB - move one tab back
ALT-SHIFT-TAB - move one window back in task switcher
|
This is extremely messy to write from scratch. Have you considered a 3rd party tool like
[Red-Gate SQL Dependency Tracker][1]?
[1]: http://www.red-gate.com/products/SQL_Dependency_Tracker/index.htm "Red-Gate SQL Dependency Tracker" |
The value of a will be equal to b, since the comma operator has a lower precedence the assignment operator. |
If you don't know the length of the list, then you will have to traverse it complete to ensure random picks. The method I've used in this case is the one described by Tom Hawtin ([54070](http://stackoverflow.com/questions/54059/efficiently-selecting-a-set-of-random-elements-from-a-linked-list#54070)). While traversing ... |
100% more.
(so about 4 people) |
Java doesn't need closures, an Object oriented language can do everything a closure does using intermediate objects to store state or do actions (in Java's case inner classes).
But closures are desirable as a feature because they greatly simplify the code and increase readability and as a consequence the maintainabil... |
Besides the fact that cache locality matters (as On Freund said), one other things Microsoft does is to profile their application and find out which code paths are executed during the first few seconds of startup. After that they feed this data back to the compiler and ask it to put the parts which are executed during ... |
What's the best way to get the fractional part of a float in PHP? |
|php| |
Simple one: How would you find the fractional part of a floating point number in PHP? For example, if I have the value 1.25, I want to return 0.25. |
Many of the responses so far seem to boil down to two options:
1. user education, and
2. forcing adoption (lots of sites changing to openid from in-house auth.)
Is that all we can do? What about distributed tools to make it easy for casual users to do openid delegation? (Say, something integrated with OS X ... |
Internet Explorer shows what they call a "friendly HTTP error message" when the response is 4xx or 5xx. This option can be turned off by the user in IE's Tools.Options.Advanced[Browsing] dialog.
Sending a 200 for an error page is generally bad practice. One alternative would be to have a valid "Error" page that's _... |
You can quote the entire path as in windows or you can escape the spaces like in:
/foo\ folder\ with\ space/foo.sh -help
Both ways will work! |
You can either quote it like Windows, or escape the slashes with backslashes:
"/foo folder with space/foo" --help
/foo\ folder\ with\ space/foo --help |
$x = $x - floor($x) |
My PHP skills are lacking but you could minus the result of a floor from the original number |
The GET (and HEAD) method should never be used to do anything that has side-effects. A side-effect might be updating the state of a web application, or it might be charging your credit card. If an action has side-effects another method (POST) should be used instead.
So, a user (or their browser) shouldn't be held ac... |
Browser Sync accross many machines |
|firefox|browsers|synchronization| |
Everyone remembers google browser sync right? I thought it was great. Unfortunately Google decided not to upgrade the service to Firefox 3.0. Mozilla is developing a replacement for google browser sync which will be a part of the Weave project. I have tried using Weave and found it to be very very slow or totally inope... |
|firefox|browser|synchronization| |
How to get PNG transparency working in browsers that don't natively support it? |
|png|transparency|browsers| |
Our (beloved) designer keeps creating PNG files with transparent backgrounds for use in our applications. I'd like to make sure that this feature of the PNG works in "older" browsers as well. What's the best solution? |
|browsers|png|transparency| |
Our (beloved) designer keeps creating PNG files with transparent backgrounds for use in our applications. I'd like to make sure that this feature of the PNG works in "older" browsers as well. What's the best solution?
*edits below*
@mabwi & @syd - Whether or not I agree about the use of a PNG is not the point. Th... |
|browser|png|transparency| |
GUI Automation testing - Window handle questions |
|gui-automation|guid-testing|windowhandle| |
Our company is currently writing a GUI automation testing tool for compact framework applications. We ahve initially searched many tools but none of them was right for us.
By using the tool you can record test-cases and group them together to test-suites. For every test-suite there is generated an application, whic... |
Let's take this a bit at a time:
> I want to create an allocator which
> provides memory with the following
> attributes:
That's fair enough.
> * cannot be paged to disk.
That's going to be hard. As far as I am aware, you cannot disable Virtual Paging as it is handled by the OS. If there is a way, the... |
You can also try using data validation if users commit data before you use it. Doing that I found was fairly simple and cleaner than fiddling about with keys.
Otherwise, you could always disable Paste too! |
> The advantage of this approach is that, for most people, **the CAPTCHA won't ever be visible!**
I like this idea, is there not any way we can just hook into the rep system? I mean, anyone with say +100 rep is likely to be a human. So if they have rep, you need not even bother doing ANYTHING in terms of CAPTCHA.
... |
You can't really protect against memory access. You can probably prevent paging if you are running as an admin or as the system, but you cannot prevent the admin or system from reading your memory. Even if you could somehow completely block other processes from reading your memory (which you can't), another process c... |
What about a [honeypot captcha][1]?
[1]: http://haacked.com/archive/2007/09/11/honeypot-captcha.aspx |
What do you think will be the level of usage of Silverlight 1 year from now? |
|silverlight| |
There is a lot of buzz about Microsoft Silverlight, especially after the Olympics. Also H264 will be supported in a future version. Where do you think Silverlight will be 1 year from now? |
|silverlight| |
Best tool to monitor network connection bandwidth |
|windows|networking| |
I'm looking for a very simple tool to monitor the bandwidth of all my applications.
No need for extra features like traffic spying, I'm just interested by bandwidth.
I already know Wireshark (which is great), but what I'm looking for is more something like TcpView (great tool from Sysinternals) with current bandwi... |
Considering NBC has already dropped Silverlight and are using Flash again for NFL telecasts, I don't see a healthy future for Microsoft's platform.
Do they even have any other partners using it? I know WWE was one of their partners but they barely use it on their own website.
EDIT - not sure if it's true or not ... |
I think that as long as the [Moonlight][1] project is successful that we'll see Silverlight become significant competition for Flash.
Silverlight is still in its infancy - 1.0 had next to nothing in it. Version 2 is in beta now, and that adds lots of common user controls that developers need to write applications... |
Are C++ Reads and Writes of an int atomic |
|c++|multithreading|synchronization| |
I have two threads, one updating an int and one reading it. This value is a statistic where the order of the read and write is irrelevant.
My question is, do I need to synchronize access to this multi-byte value anyway? Or, put another way, can part of the write be complete and get interrupted, and then the read h... |
A year from now, the number of people with the runtime installed will still be a fairly small minority. I suspect that choosing Silverlight will still be a barrier to people using your stuff for a long while to come. |
This certainly sounds possible. With a combination of jQuery.append and jQuery.fadeIn and fadeOut you should be able to create a nice little tabbed control.
See the JQuery UI/Tabs for a simple way to create a set of tabs based on a `<ul>` element and a set of `<div>'s`: <http://docs.jquery.com/UI/Tabs> |
Not knowing the actual details, my guess is that it makes an attempt to join like you might join relative URIs. For example:
join('/some/abs/path', '../other') = '/some/abs/other'
This means that when you join a path with a preceding slash, you are actually joining one base to another, in which case the secon... |
you could always search through the syscomments table....that might take a while though... |
Good Ways to Use Source Control and an IDE for Plugin Code? |
|ide|plugin-development| |
What are good ways of dealing with the issues surrounding plugin code that interacts with outside system?
To give a concrete and representative example, suppose I would like to use Subversion and Eclipse to develop plugins for WordPress. The main code body of WordPress is installed on the webserver, and the plugin c... |
Yes, take a look at the "6.4 Packages" section in <http://docs.python.org/tut/node8.html>:
Basically, you can place a bunch of files into a directory and add an "__init__.py" file to the directory. If the directory is in your PYTHONPATH or sys.path, you can do "import directoryname" to import everything in the dire... |
Yes, take a look at the "6.4 Packages" section in <http://docs.python.org/tut/node8.html>:
Basically, you can place a bunch of files into a directory and add an __init_\_.py file to the directory. If the directory is in your PYTHONPATH or sys.path, you can do "import directoryname" to import everything in the direc... |
Handle signals in the Java Virtual Machine |
The easiest method is to create a "tags" table.
Target_Type -- in case you are tagging multiple tables
Target -- The key to the record being tagged
Tag -- The text of a tag
Querying the data would be something like
Select distinct target from tags
where tag in ([your list of tags to search for here]... |
The easiest method is to create a "tags" table.
Target_Type -- in case you are tagging multiple tables
Target -- The key to the record being tagged
Tag -- The text of a tag
Querying the data would be something like
Select distinct target from tags
where tag in ([your list of tags to search for here]... |
Shell scripting input redirection oddities |
|shell|bash|dash-shell| |
Can anyone explain this behavior?
Running:
#!/bin/sh
echo "hello world" | read var1 var2
echo $var1
echo $var2
results in nothing being ouput, while:
#!/bin/sh
echo "hello world" > test.file
read var1 var2 < test.file
echo $var1
echo $var2
produces the expected ou... |
|linux|bash|shell|dash-shell| |
|linux|bash|shell|ksh|dash-shell| |
What is the point of the finally block? |
|finally| |
Syntax aside, what is the difference between
try {
}
catch() {
}
finally {
x = 3;
}
and
try {
}
catch() {
}
x = 3;
|
|exception| |
|exception|design-patterns| |
Syntax aside, what is the difference between
try {
}
catch() {
}
finally {
x = 3;
}
and
try {
}
catch() {
}
x = 3;
edit: in .NET 2.0? |
|.net|exception|design-patterns| |
Since spaces are used to separate command line arguments, they have to be escaped from the shell. This can be done with either a backslash (\) or quotes:
"/path/with/spaces in it/to/a/file"
somecommand -spaced\ option
somecommand "-spaced option"
somecommand '-spaced option'
This is assuming y... |
Well of course you can always extract the top-level elements (whether this is the granularity you want is up to you). In C#, you'd use the XmlDocument class. For example, if your XML file looked something like this:
<Document>
<Piece>
Some text
</Piece>
<Piece>
Some other... |
I work in a database support team with three DBA's and our considered options are:
1. Any naming standard is better than no standard.
2. There is no "one true" standard, we all have our preferences
3. If there is standard already in place, use it. Don't create another standard or muddy the existing standards.
W... |
I work in a database support team with three DBA's and our considered options are:
1. Any naming standard is better than no standard.
2. There is no "one true" standard, we all have our preferences
3. If there is standard already in place, use it. Don't create another standard or muddy the existing standards.
W... |
|java|process|jvm|posix|signals| |
Is it possible to handle POSIX signals within the Java Virtual Machine?
At least [SIGINT][1] and [SIGKILL][2] should be quite platform independent.
[1]: http://en.wikipedia.org/wiki/SIGINT_(POSIX)
[2]: http://en.wikipedia.org/wiki/SIGKILL |
|java|process|jvm|posix|signals| |
XPATHS and Default Namespaces |
|c#|xml|namespace|xpath| |
What is the story behind XPATH and support for namespaces? Did XPATH as a specification precede namespaces? If I have a document where elements have been given a default namespace:
>> <foo xmlns="uri" />
It appears as though some of the XPATH processor libraries won't recognize //foo because of the namespace... |
|c#|xml|namespaces|xpath| |
How to resolve symlinks in a shell script |
|shell|script|symlink| |