instruction stringlengths 0 30k ⌀ |
|---|
Usually Flash and Flex applications are embedded on in HTML using either a combination of `object` and `embed` tags, or more commonly using JavaScript. However, if you link directly to a SWF file it will open in the browser window and without looking in the address bar you can't tell that it wasn't embedded in HTML wit... |
Usually Flash and Flex applications are embedded on in HTML using either a combination of `object` and `embed` tags, or more commonly using JavaScript. However, if you link directly to a SWF file it will open in the browser window and without looking in the address bar you can't tell that it wasn't embedded in HTML wit... |
First, don't make your collection object implement IEnumerator<>. This leads to bugs. (Consider the situation where two threads are iterating over the same collection).
Implementing an enumerator correctly turns out to be non-trivial, so C# 2.0 added special language support for doing it, based on the 'yield ret... |
Assuming you have a client named "CLIENT", a directory named "foo" (located at your project root), and you wish to ignore all .dll files in that directory tree, you can add the following lines to your workspace view to accomplish this:
<pre>
-//depot/foo/*.dll //CLIENT/foo/*.dll
-//depot/foo/.../*.dll //CLIENT/foo/.... |
@Jason: VSS is broken.
I think the most powerful method for motivating a change away from VSS is to point out how critical an asset your source code is. Taking risks with its integrity is not a wise business choice.
Add that your programmers are the creators of this asset, and that making it easier for them to b... |
The standard python `dict` isn't able to do this. There are a few third party implementations of an "ordered dictionary" (See these [two][1] [recipes][2] in the Python Cookbook). There is also a proposal ([PEP 372][3]) to add such a class to the `collections` module in the standard library.
[1]: http://code.acti... |
The standard python `dict` isn't able to do this. There are a few third party implementations of an "ordered dictionary" (See these [two][1] [recipes][2] in the Python Cookbook).
There is also a proposal ([PEP 372][3]) to add such a class to the `collections` module in the standard library. This includes links to [... |
The standard python `dict` isn't able to do this.
There is a proposal ([PEP 372][3]) to add an "ordered dictionary" (that keeps track of the order of insertion) to the `collections` module in the standard library. It includes links to [various][4] [implementations][6] [of][5] [ordered][7] [dictionaries][8] (see als... |
There is also .NET Remoting, which I found quite cool, but I guess they are obsoleting it now that they have WCF. |
You could use a HTML DTD, and the generic XML parsing libraries.
|
svn rm --force web.config
svn commit
Be careful to back up your local copy (of web.config) before doing this, since it will be deleted.
|
/<input\s+type="hidden"\s+name="([A-Za-z0-9_]+)"\s+value="([A-Za-z0-9_\-]*)"\s*/>/
>>> import re
>>> s = '<input type="hidden" name="fooId" value="12-3456789-1111111111" />'
>>> re.match('<input\s+type="hidden"\s+name="([A-Za-z0-9_]+)"\s+value="([A-Za-z0-9_\-]*)"\s*/>', s).groups()
('fooId', '... |
MFC IE embedded web browser wackiness |
|c++|mfc|internet-explorer|dialog| |
I have this modeless MFC dialog which embeds an Internet Explorer web browser control.
The control is derived straight from CWnd with ActiveX wrappers generated by Visual Studio, and I map it to the CDialog using only a "DDX_Control(pDX, IDC_EXPLORER, m_explorer);"
I have 2 problems.
Problem #1:<br/>
Being mo... |
Most recent Microsoft's stuff in IPC is Windows Communication Foundation. Actually there is nothing new in the lower level (tcp, upd, named pipes etc) But WCF simplifies IPC development greatly. |
Most recent Microsoft's stuff in IPC is [Windows Communication Foundation][1]. Actually there is nothing new in the lower level (tcp, upd, named pipes etc) But WCF simplifies IPC development greatly.
Useful resource:
- [Interprocess Communication with WCF][2] on Dr. Dobb's portal
- [WCF Communication Options... |
Storing file permissions in Subversion repository |
|windows|svn|file-permissions| |
How do you store file permissions in a repository? A few files need to be read-only to stop a third party program from trashing it but after checking out of the repository they are set to read-write.
I looked on google and found a [blog post from 2005][1] that states that Subversion doesn't store file-permissions. T... |
This is a pretty vague question, but I would say [reverse engineering][1]. How they go about that is dependent on what kind of device it is and what is available for it. In many cases the device may have a similar core chipset to another device that can be modified to work.
[1]: http://en.wikipedia.org/wiki/Reve... |
Data Encryption |
|database|security|encrypt| |
A database that stores a lot of credit card information is an inevitable part of the system we have just completed. What I want though is ultimate security of the card numbers whereby we setup a mechanism to encrypt and decrypt but of ourselves cannot decrypt any given number.
What I am after is a way to secure thi... |
This should be a great thread.
One of the biggest differences is between the CLR and JVM is the CLR"s native integration of generics.
Java instead removes the generic types and the JVM can only work with objects by autoboxing the objects it appears to be pseudo generics. |
How do you change the displayed order of ActiveScaffold "actions"? |
|ruby|ruby-on-rails|activescaffold| |
I am using ActiveScaffold in a Ruby on Rails app, and have replaced the default "actions" text in the table (ie. "edit", "delete", "show") with icons using CSS. I have also added a couple of custom actions with action_link.add ("move" and "copy").
For clarity, **I would like to have the icons displayed in a differen... |
This article says there is a major and minor max of 255.
http://msdn.microsoft.com/en-us/library/aa370859(VS.85).aspx |
I don't know if this helps, but I had the same problem with the autocomplete extender and determined that the server-side function could not be in the user control, but needed to be on the page (or in a webservice, I guess). Once I moved the function, it worked fine. |
Syntax coloring synchronization probably needs adjustment. I've found in certain contexts that I need to change it.
Syntax synchronization (":help syn-sync") controls how vim keeps track of refreshes its parse of the code for coloring, so that it can start drawing anywhere in the file.
The defaults don't always ... |
How to solve Memory Fragmentation |
|c++|windows|memory| |
We've occasionally been getting problems whereby our long-running server processes (running on Windows Server 2003) have thrown an exception due to a memory allocation failure. Our suspicion is these allocations are failing due to memory fragmentation.
Therefore, we've been looking at some alternative memory alloca... |
How do I write a python HTTP server to listen on multiple ports? |
|python| |
I'm writing a small web server in Python, using BaseHTTPServer and a custom subclass of BaseHTTPServer.BaseHTTPRequestHandler. Is it possible to make this listen on more than one port?
What I'm doing now:
class MyRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def doGET
[...]
class... |
|python|webserver| |
Windows Mobile development in Python |
|windows|python|mobile| |
What is the best way to start developing Windows Mobile Professional applications in Python? Is there a reasonable SDK including an emulator? Is it even possible without doing excessive amount of underlaying Windows API calls for UI for instance? |
|python|windows|mobile| |
There is an overhead most of the time in using modulo that are not powers of 2.
This is regardless of the processor as (AFAIK) even processors with modulus operators are a few cycles slower for divide as opposed to mask operations.
For most cases this is not an optimisation that is worth considering, and certainly ... |
Advanced directory switching in bash |
|bash| |
Detect changes in random ordered input (hash function?) |
|java|multithreading|hash| |
I'm reading lines of text that can come in any order. The problem is that the output can actually be indentical to the previous output. How can I detect this, without sorting the output first?
Is there some kind of hash function that can take identical input, but in any order, and still produce the same result? |
You do not need to make your enums global in order for them to be visible in the designer.
Clarify please:
1. if you add another value to your AutoSizeMode enum, does it still appear as a boolean?
2. If (instead) you change the name of enum, does it still appear as a boolean?
|
Go straight to W3C docs. They're a bit cryptic at times, but they're solid documentation.
For quirks, obviously sites like Quirksmode are good. But only once you've read actual W3C documentation. |
class ABC(self):
numbers = [0,1,2,3]
class DEF(ABC):
def __init__(self):
self.new_numbers = super(ABC,self).numbers
def setnums(self, numbers):
self.new_numbers = numbers
def getnums(self):
return self.new_numbers
def re... |
I find using the **define_method** command to dynamically generate methods is quite interesting and not as well known. For example:
((0..9).each do |n|
define_method "press_#{n}" do
@number = @number.to_i * 10 + n
end
end
The above code uses the 'define_method' command to ... |
I find using the **define_method** command to dynamically generate methods to be quite interesting and not as well known. For example:
((0..9).each do |n|
define_method "press_#{n}" do
@number = @number.to_i * 10 + n
end
end
The above code uses the 'define_method' command ... |
Path of least resistance:
* Have a simple web project in mind.
* Get a copy of O'Reilly Media's **Learning Ruby**
* Get a Linux box. (Fewer early Rails frustrations.)
* Get a copy of **Agile Web Development with Rails**.
* Get the version of Ruby and Rails described in that book.
* Run through that book's firs... |
Would it work to set the scroll position back to the top (element.scrollTop = 0; element.scrollLeft = 0; by heart) before replacing the content? |
To keep life simple I would normally setup a table for this, it's quite simple and will ensure that things get laid out right. If you wanted to do it similarly to how you would do it in HTML then you should layout block-container elements.
However you decide to do it I would always recommend using the [ZVON Referenc... |
Here is what I did on my Powershell script that adds all of the podcasts that I download to iTunes. It uses .Net methods to release the COM objects.
<pre><code>
[void][System.Runtime.InteropServices.Marshal]::ReleaseComObject([System.__ComObject]$LibrarySource)
[void][System.Runtime.InteropServices.Marsha... |
Here is what I did on my Powershell script that adds all of the podcasts that I download to iTunes. It uses .Net methods to release the COM objects.
<pre><code>
[void][System.Runtime.InteropServices.Marshal]::ReleaseComObject([System.__ComObject]$LibrarySource)
[void][System.Runtime.InteropServices.Marsha... |
Here is what I did on my Powershell script that adds all of the podcasts that I download to iTunes. It uses .Net methods to release the COM objects. When I wrote my iTunes script I had read a couple of articles that stated you should release your COM objects using .NET.
<pre><code>
[void][System.Runtime.Inter... |
Here is one thing that I did on my a Powershell script that adds podcasts to iTunes. I use Juice on a server to download all the podcasts that I listen to. The script uses .Net methods to release the COM objects. When I wrote my iTunes script I had read a couple of articles that stated you should release your COM obj... |
The trouble with parsing HTML is that it isn't an exact science. If it was XHTML that you were parsing, then things would be a lot easier (as you mention you could use a general XML parser). Because HTML isn't necessarily well-formed XML you will come into lots of problems trying to parse it. It almost needs to be done... |
Consider using [`svn lock`][1] to disallow others from writing to the file.
[1]: http://svnbook.red-bean.com/nightly/en/svn.advanced.locking.html |
One piece of information missing is the number of indices on the table you are deleting the data from. As SQL Server uses the Primary Key as a pointer in every index, any change to the primary index requires updating every index. Though, unless we are talking a high number, this shouldn't be an issue.
I am guessing,... |
First off, you've surely considered two-way data binding to your viewmodel, with an UpdateSourceTrigger of PropertyChanged? That way the property setter of the property you bind to will be called every time the text is changed?
If that's not enough, then I would tackle this problem using Attached Behaviours. On Juli... |
I think Tortoise svn does not yet support version tree.
So far, Clearcase explorer is the best i've come across.
![alt text][1]
[1]: http://svn.collab.net/repos/svn/developer-resources/guis/pics/ClearCase-lsvtree-1.gif |
I think Tortoise svn does [**not yet**][1] support version tree.
So far, Clearcase explorer is the best i've come across.
![alt text][2]
[1]: http://svn.haxx.se/tsvnusers/archive-2008-05/0149.shtml
[2]: http://svn.collab.net/repos/svn/developer-resources/guis/pics/ClearCase-lsvtree-1.gif |
[This explains it][1]. Summary: const must be initialized at declaration time, readonly can be initialized on the constructor (and thus have a different value depending on the constructor used).
[1]: http://en.csharp-online.net/const,_static_and_readonly |
[This explains it][1]. Summary: const must be initialized at declaration time, readonly can be initialized on the constructor (and thus have a different value depending on the constructor used).
EDIT: See Gishu's gotcha above for the subtle difference
[1]: http://en.csharp-online.net/const,_static_and_readonly |
Yes, I agree. I see mocking as sometimes painful, but often necessary, for your tests to truly become **unit** tests, i.e. only the smallest unit that you can make your test concerned with is under test. This allows you to eliminate any other factors that could potentially affect the outcome of the test. You do end up ... |
It would be helpful to know the DB server and language/platform types so we could get more specific, but I would be looking into [SHA][1].
[1]: http://en.wikipedia.org/wiki/SHA |
By the way, it doesn't have to be more work to implement the three-parameter version, as suggested in the question statement.
These are all linear functions, so you can implement something like
float LinearConvert(float in, float scale, float add, bool invert);
where the last bool indicates if you want to ... |
How Do I Load an Assembly and All of its Dependencies at Runtime in C# for Reflection? |
|c#|.net|reflection|subsonic| |
I'm writing a utility for myself, partly as an exercise in learning C# Reflection and partly because I actually want the resulting tool for my own use.
What I'm after is basically pointing the application at an assembly and choosing a given class from which to select properties that should be included in an exported... |
I know a few advanced ways, to change directories. `pushd` and `popd` (directory stack) or `cd -` (change to last directory).
But I am looking for quick way to achieve the following:
Say, I am in a rather deep dir:
/this/is/a/very/deep/directory/structure/with\ lot\ of\ nasty/names
and I want to switc... |
Check out the [URL Rewrite Module for IIS 7][1] created by Microsoft
[1]: http://iis.net/downloads/default.aspx?tabid=34&g=6&i=1691 |
I'd suspect a leak before suspecting fragmentation.
For the memory-intensive data structures, you could switch over to a re-usable storage pool mechanism. You might also be able to allocate more stuff on the stack as opposed to the heap, but in practical terms that won't make a huge difference I think.
I'd fir... |
Is help file (or user manual) dead? |
|user-interface|language-agnostic| |
Back in the days of Unix, you couldn't even [close a software][1] without reading the man page first. Then came Mac and Windows with consistent menu layout and keyboard shortcuts, but you still saw paper user manuals shipped in the shrinkwrap box, which described each and every single operation possible in the app. Aft... |
|language-agnostic|user-interface| |
Back in the days of Unix, you couldn't even [close a software][1] without reading the man page first. Then came Mac and Windows with consistent menu layout and keyboard shortcuts, but you still saw paper user manuals shipped in the shrinkwrap box, which described each and every single operation possible in the app. Aft... |
jQuery is a fine library, but also check out the [Prototype JavaScript framework][1]. It really turns JavaScript from being an occasionally awkward language into a beautiful and elegant language.
[1]: http://www.prototypejs.org/ |
Running a scheduled task in a Wordpress plug-in |
|php|wordpress| |
I'm trying to write a Wordpress plug-in that automatically posts a blog post at a certain time of day. For example, read a bunch of RSS feeds and post a daily digest of all new entries.
There are plug-ins that do something similar to what I want, but many of them rely on a cron job for the automated scheduling. I'... |
In my experience, it has expired at the end of that month. That is based on the fact that I can use it during that month, and that month is when my bank sends a new one. |
Credit card expiration dates - Inclusive or exclusive? |
|payment| |
Say you've got a credit card number with an expiration date of 05/08 - i.e. May 2008.
Does that mean the card expires on the morning of the 1st of May 2008, or the night of the 31st of May 2008? |
|e-commerce|payment| |
Have a look on one of your own credit cards. It'll have some text like `EXPIRES END` or `VALID THRU` above the date. So the card expires at the end of the given month. |
These solutions come to my mind:
- You can try to use [Dependency Walker][1] or similar program to analyze dependecies.
- Parse MSBuild files (*.csproject) to get list of dependencies
[1]: http://www.dependencywalker.com |
AssemblyVersion pretty much stays internal to .NET, while AssemblyFileVersion is what Windows sees. If you go to the properties of an assembly sitting in a directory and switch to the version tab, the AssemblyFileVersion is what you'll see up top. If you sort files by version, this is what's used by Explorer.
The As... |
Simple answer: Open IIS Manager. In navigation pane, find the .NET2 web site and right click on it. Select "Properties". Then select "ASP.NET" tab. First dropdown on that screen gives you option to select a different version of .NET.
Please be aware -- when I did this, all of the web sites on the web server sto... |
How can I display simple tooltips on icons in html? |
|html|ruby|ruby-on-rails|activescaffold|tooltip| |
I am using ActiveScaffold in a Ruby on Rails app, and to save space in the table I have replaced the default "actions" text in the table (ie. "edit", "delete", "show") with icons using CSS. I have also added a couple of custom actions with action_link.add ("move" and "copy").
For clarity, **I would like to have a to... |
Memory and disk IO can be a problem with TSVNCache, which manages Tortoise's icon overlays. You can fix it by putting your checkouts in one or two directories and making the cache process only look at those directories, rather than your entire drive.
[See this link for instructions.](http://www.paraesthesia.com/arc... |
Make sure you're compiling with Code Analysis turned on, and pay attention to the [Globalization warnings][1] that it gives you. Keep data in an invariant format ([CultureInfo.InvariantCulture][2]) until you display it to the user (then use [CultureInfo.CurrentCulture][3]).
[1]: http://msdn.microsoft.com/en-us/... |