instruction
stringlengths
0
30k
You're making it too complicated. This is the reason the cascade exists. Simply provide your element selectors and class your color: h1 { color: #000; } .a-theme-color { color: #333; } Then apply it to the elements in the HTML, overriding when you need to use your theme colors. ...
Here's what I've got so far, I wanted to give this a little more time before accepting an answer. DECLARE @IDs TABLE ( ID int , DateBetween int ) DECLARE @OID int SET @OID = 6150 -- Grab the revisions, calc the datediff, and insert into temp table var. ...
Mirroring perforce with SVK?
|svn|perforce|svk|
Anyone know of a way to use SVK with perforce? The docs [seem to imply][1] it used to be possible, but some [mailing list messages][2] claim that is no longer the case? [1]: http://svk.bestpractical.com/view/MirrorVCP [2]: http://lists.bestpractical.com/pipermail/svk-devel/2007-February/000604.html
The bind method really isn't for the repeater, it's more for the formview or gridview, where you are editing just one item in the list not every item in the list. On both you click a edit button which then gives you the bound controls (bound using bind) and then hit the save link which auto saves the item back in...
win-M to minimise all. Useful for quick trips to the desktop.
How to setup GIT bare HTTP-available repository on IIS-machine
|version-control|git|iis-7|dvcs|
server already runs IIS to serve 80 and 443 port over TCP. I want to make centralized "push/pull" GIT repository available to all my team members over the Internet. So I should use HTTP or HTTPS. But I cannot use Apache because of IIS already hooking up listening sockets on 80 and 443 ports! Is there any way to...
build your site, then use a mirroring tool like [wget][1] or [lwp-mirror][2] to grab a static copy [1]: http://www.gnu.org/software/wget/ [2]: http://search.cpan.org/~gaas/libwww-perl-5.814/bin/lwp-mirror
Download Debugging tools for Windows: [http://www.microsoft.com/whdc/DevTools/Debugging/default.mspx][1] Debugging Tools for Windows has has a script (ADPLUS) that allows you to create dumps when a process CRASHES: [http://support.microsoft.com/kb/286350][2] The command should be something like (if you are usin...
I run into this from time to time on different notebooks, and I have found the simplest is a low-tech, non software solution - create an ethernet loopback connecter. You can do it in 2 minutes with an old network cable, just cut the end off and join the send and receive pair just above the RJ45 connector. (obviously yo...
My answer will relate to Java, as that is what I know. Interfaces describe behavior, and not implementation. Additionally, static fields are tied to the classes, and not instances. If you declared the following: interface A { abstract static NAME } class B { NAME = "HELP" } class C { NAME = "PRINT" } ...
System.gc() is implemented by the VM, and what it does is implementation specific. The implementer could simply return and do nothing, for instance. As for when to issue a manual collect, the only time when you may want to do this is when you abandon a large collection containing loads of smaller collections--a Map...
Don't forget readability when sending a link, not just in search engines. If you email someone the first link they can look at the URL and get a general idea of what it is about. The second one gives no indication of the content of that page before they click.
"Phantom" directories in an SVN repository
|svn|
I've somehow managed to get an SVN repository into a bad state. I've moved a directory and now I can't commit it in its new location. As far as `svn status` is concerned, the directory is unknown (the name of the directory is `type`). <pre> $ svn status ? type </pre> When I try to add the directory, the ...
I've somehow managed to get an SVN repository into a bad state. I've moved a directory and now I can't commit it in its new location. As far as `svn status` is concerned, the directory is unknown (the name of the directory is `type`). <pre> $ svn status ? type </pre> When I try to add the directory, the ...
I've somehow managed to get an SVN repository into a bad state. I've moved a directory and now I can't commit it in its new location. As far as `svn status` is concerned, the directory is unknown (the name of the directory is `type`). <pre> $ svn status ? type </pre> When I try to add the directory, the ...
server already runs IIS to serve 80 and 443 port over TCP. I want to make centralized "push/pull" GIT repository available to all my team members over the Internet. So I should use HTTP or HTTPS. But I cannot use Apache because of IIS already hooking up listening sockets on 80 and 443 ports! Is there any way to...
It appears Miguel De Icaza was stalking me: http://tirania.org/blog/archive/2008/Sep-08.html
How do I dynamically create a Video object in AS2 and add it to a MovieClip?
|flash|video|actionscript-2|
I need to dynamically create a Video object in ActionScript 2 and add it to a movie clip. In AS3 I just do this: var videoViewComp:UIComponent; // created elsewhere videoView = new Video(); videoView.width = 400; videoView.height = 400; this.videoViewComp.addChild(videoView); Unfort...
I have no idea if this is the answer, but one reason might be with the cost of locating the next element. Iterating through a map is inherently "slow".
See http://www.sgi.com/tech/stl/Map.html > Map has the important property that > inserting a new element into a map > does not invalidate iterators that > point to existing elements. Erasing an > element from a map also does not > invalidate any iterators, except, of > course, for iterators that ...
$path = trim($base . '/' . $uf); That could be causing it. I'm assuming $base is some sort of root folder you are searching, so if $uf is something like '', '.', or '../' that could return true. We would have to see what values you are using in your foreach to know anything further.
$path = trim($base . '/' . $uf); That could be causing it. I'm assuming $base is some sort of root folder you are searching, so if $uf is something like '', '.', or '../' that could return true. We would have to see what values you are using in your foreach to know anything further. [EDIT] Doing some more ...
The inconsistency is due to use. `vector` is a sequence having an ordering over the elements. While it's true that the elements in a `map` are also ordered according to some comparison criterion, this ordering is non-evident from the structure. There is no efficient way to get from one element to the next (efficient = ...
System.gc() is implemented by the VM, and what it does is implementation specific. The implementer could simply return and do nothing, for instance. As for when to issue a manual collect, the only time when you may want to do this is when you abandon a large collection containing loads of smaller collections--a Map...
or you can use BASE tag in you HEAD section of page. All you links then are relative to location entered in "base" tag, and you don't have to use "../../" and "~" stuff. Except links in CSS files (background url,etc), where links are relative to location of css file.
One way to do this is to create the site in PHP as normal, and have a script actually grab the webpages (through HTTP - you can use wget or write another php script that just uses file() with URLs) and save them to the public website locations when you are "done". Then you can just run the script again when you decide...
Namespaces in C#
|c#|
I'm using an ASP.NET MVC project and everytime I add a class to a folder it makes really long namespaces. Example: Project = Tully.Saps.Data Folder = DataAccess/Interfaces Namespace = Tully.Saps.Data.DataAccess.Interfaces Folder = DataAccess/MbNetRepositories Namespace = Tully.Saps.Data.DataAccess.MbNetRepo...
Decorating a parent class method
|python|oop|
Not sure if what I want to accomplish is even possible, but I'd like to make a child class have a method of the parent class be a 'classmethod' even though the method in the parent class is not. Essentiall I'm trying to accomplish the following: class foo(Object): def meth1(self,val): self...
Forech depends on the fact that the collection will not change. If you want to iterate over a collection that can change, use the normal for construct and be prepared to nondeterministic behavior. Locking might be a better idea, depending on what you're doing.
Fail fast finally clause in Java
|java|exception|fault-tolerance|
Is there a way to detect, from within the finally clause, that an exception is in the process of being thrown? ie: <pre><code> try { // code that may or may not throw an exception } finally { SomeCleanupFunctionThatThrows(); // if currently executing an exception, exit the program, // otherw...
In C, `goto` only works within the scope of the current function, which tends to localise any potential bugs. `setjmp` and `longjmp` are far more dangerous, being non-local, complicated and implementation-dependent. In practice however, they're too obscure and uncommon to cause many problems. I believe that the dang...
How to make your website look the same on Linux
|linux|css|
I have a fairly standards compliant XHTML+CSS site that looks great on all browsers on PC and Mac. The other day I saw it on FF3 on Linux and the letter spacing was slightly larger, throwing everything out of whack and causing unwanted wrapping and clipping of text. The CSS in question has font-size: 11px; ...
If you emailed someone a link wouldn't it make more sense to include a description by actually writing out a description rather than making the other person parse to the URL where the description exists, and try-to-read-a-bunch-of-hyphenated-words-stuck-together.
Using yield to iterate over a datareader might not close the connection?
|.net-2.0|yield|
Here is a sample code to retrieve data from a database using the yield keyword that I found in a few place while googling around : public IEnumerable<object> ExecuteSelect(string commandText) { using (IDbConnection connection = CreateConnection()) { using (IDbCommand cmd = Cr...
A solution in C/C++: void swap(char* str, int i, int j){ char t = str[i]; str[i] = str[j]; str[j] = t; } void reverse_words(char* str){ int l = strlen(str); //Reverse string for(int i=0; i<l/2; i++){ swap(str, i, l-i-1); } ...
Here's a simple algorithm: 1. Determine if the string begins with a <code>'"'</code> character 2. Split the string into an array delimited by the <code>'"'</code> character. 3. Mark the quoted commas with a placeholder <code>#COMMA#</code> * If the input starts with a <code>'"'</code>, mark those items in the a...
Here's a simple algorithm: 1. Determine if the string begins with a <code>'"'</code> character 2. Split the string into an array delimited by the <code>'"'</code> character. 3. Mark the quoted commas with a placeholder <code>#COMMA#</code> * If the input starts with a <code>'"'</code>, mark those items in the a...
Typically, integer values are signed, unless you explicitly need an unsigned value. It's just the way they are used. I may not agree with that choice, but that's just the way it is. For the time being, with todays typical memory constraints, if your array or similar data structure needs an UInt32 length, you should ...
Unsigned int's aren't CLS compliant and would therefore restrict usage of the property to those languages that do implement a UInt. For example VB.NET has no notion of UInt16/UInt32/UInt64 See here: [http://msdn.microsoft.com/en-us/library/hfa3fa08(VS.71).aspx][1] [1]: http://msdn.microsoft.com/en-us/libra...
Win+D to show the desktop and then Win+D to bring all the windows back again.
I ran into this many moons ago as well. However, not to discount @Longhorn213s explanation, but we had the exact opposite behavior. We received the error in development and testing, but not production where obviously the load was much greater. We ended up tolerating the issue in development as it was sporadic and di...
i'd suggest just doing the count first. a count(primary key) is a very efficient query.
Take a look at [XmlPreProcess][1]. We use it for producing different config files for our testing and live deployment packages. We execute it from a nant script as part of a continuous build but, since it's a console app, I see no reason why you coudn't add a call in your project's post-build event instead [1]: ...
Don't forget [Scott Guthrie's blog][1]. Latest news on MVC. The "official" site is two releases behind. [1]: http://weblogs.asp.net/scottgu/
I doubt that it will be a problem for your users to wait for the backend to return ten rows. (You can make it up to them by being good at specifying image dimensions, make the webserver negotiate compressed data transfers when possible, etc.) I don't think that it will be very useful for you to do a count(*) initial...
A more Ruby-style rewrite of [Hal's Ruby version][1]: class String def palindrome? (test = gsub(/[^A-Za-z]/, '').downcase) == test.reverse end end Now you can call `palindrome?` on any string. [1]: http://stackoverflow.com/questions/52002/how-to-check-if-the-given-string-is-pa...
Most image file formats have unique bytes at the start. The unix `file` command looks at the start of the file to see what type of data it contains. See the Wikipedia article on [Magic numbers in files][1] and [magicdb.org](http://magicdb.org/). [1]: http://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_num...
[Concrete Mathematics][1] covers all the major topics. [1]: http://www-cs-faculty.stanford.edu/~knuth/gkp.html
Using the error handler to catch cases when the key does not exists in the Collection can make debugging with "break on all errors" option quite annoying. To avoid unwanted errors I quite often create a class which has the stored objects in a Collection and all keys in a Dictionary. Dictionary has exists(key) -function...
A solution in C/C++: void swap(char* str, int i, int j){ char t = str[i]; str[i] = str[j]; str[j] = t; } void reverse_string(char* str, int length){ for(int i=0; i<length/2; i++){ swap(str, i, length-i-1); } } void reverse_words(char...
I find the easiest way to solve font sizing problems between browsers is to simply leave room for error. Make divs slightly larger or fonts slightly smaller so that platform variation doesn't change wrapping or clipping considerably.
JUnit for database code
|java|database|unit-testing|junit|
I've been trying to implement unit testing and currently have some code that does the following: 1. query external database, loading into a feed table 2. query a view, which is a delta of my feed and data tables, updating data table to match feed table my unit testing strategy is this: ...
Have you tried it in FF3 on windows? Personally, I find a good CSS Reset goes a long way in making your page look the same in all browsers.
Ideally, the "slug" should be the only identifier needed. In practice, on dynamic sites such as this, you either have to have a unique numerical identifier or start appending/incrementing numbers to the "slug" like [Digg][1] does. [1]: http://digg.com/health/When_sex_becomes_an_addiction_3
That's not supported at the moment unless you use some script to produce the CSS based on some variables defined by you. It seems, though, that at least some people from the browser world are [working on it][1]. So, if it really becomes a standard sometime in the future, then we'll have to wait until it is implemen...
Connection will be closed automatically since you're using it inside "using" block.
Unsigned int isn't CLS compliant and would therefore restrict usage of the property to those languages that do implement a UInt. Update: See here: Framework 1.1 [http://msdn.microsoft.com/en-us/library/hfa3fa08(VS.71).aspx][1] Framework 2.0 [http://msdn.microsoft.com/en-us/library/hfa3fa08(VS.80).aspx...
Why are unsigned int's not CLS compliant
|c#|.net|
Why are unsigned int's not CLS compliant. I start to think type-specification is just for performance, and not for correctness.
I just couldn't resist to see if I could make it work in a Python one-liner: arr = [i.replace("|", ",") for i in re.sub('"([^"]*)\,([^"]*)"',"\g<1>|\g<2>", x).split(",")] Returns ['a', 'string, with', 'various', 'values, and some', 'quoted'] <p>It works by first replacing the ',' inside quotes to another sep...
I just couldn't resist to see if I could make it work in a Python one-liner: arr = [i.replace("|", ",") for i in re.sub('"([^"]*)\,([^"]*)"',"\g<1>|\g<2>", str_to_test).split(",")] Returns ['a', 'string, with', 'various', 'values, and some', 'quoted'] <p>It works by first replacing the ',' inside quotes to a...
ActiveMQ works well with C# using the Spring.NET integrations and NMS. A post with some links to get you started in that direction [is here][1]. Also consider using MSMQ (The System.Messaging namespace) or a .NET based asynchronous messaging solution, with [some options here][2]. [1]: http://hsidev.wordpress.com...
ActiveMQ works well with C# using the Spring.NET integrations and NMS. A post with some links to get you started in that direction [is here][1]. Also consider using MSMQ (The System.Messaging namespace) or a .NET based asynchronous messaging solution, with [some options here][2]. [1]: http://thefreakparade.com/2...
If you don't want to use the DLR you can [use Boo (which has an interpreter)][1] or you could consider [the Script.NET (S#) project on CodePlex][2]. With the Boo solution you can choose between compiled scripts or using the interpreter, and Boo makes a nice scripting language, has a flexible syntax and an extensible la...
Just as a side question and following up on my 'ego trip' comment: why would you take anything on the web to be 'true'? IME printed submissions, while not necessarily accurate, tend to be slightly less, erm... exaggerated than web submissions. Do those responding\viewing ever hire? I wouldn't google for a candidate....
Search and normalization can be at odds with each other. So probably first thing would be to get some kind of "view" that shows all the fields that can be searched as a single row with a single key getting you the resume. then you can throw something like [Lucene][1] in front of that to give you a full text index of th...
I've found the following books very useful: [Windows Presentation Foundation Unleashed - Adam Nathan][1]<br /> You mention you already have this book, however I wanted to give my opinion on it. It is a great book for the newcomer - it is printed in full color which is a great help for visualizing both xaml and conc...
I'm guessing that the dialog you created is modal, which would mean that it is running its own event loop. No events posted to the general guiThread will be processed until all modal event loops are exited. Alternately, if you need the dialog to both be modal and know about the event, you could post the event direc...
When I've needed this in the past, I've created subclasses of the components I wanted to add "auto-clearing" functionality too. eg: public class AutoClearingTextField extends JTextField { final FocusListener AUTO_CLEARING_LISTENER = new FocusListener(){ @Override public void focusL...
Things like animation and gradient color definitions can really only be done effectively in Blend. Blend is also often extremely useful for generating some non-trivial custom visual elements, just so that you can view the generated Xaml and import a CLEANER version into your production code. Unfortunately, the point-a...
A List Apart has a pretty [comprehensive article on sizing fonts in CSS][1]. Their conclusion is to use "`ems`" to size text, since it generally gives the most consistent sizing across browsers. They make no direct mention of different OSes, but you should try using ems. It might solve your problem. [1]: http://...
Reading from a socket in C#
|c#|sockets|
I am trying to read ASCII text response from a tcp open streaming socket This is what I have come up with so far. I want to know what is the best way to do this that includes error handling. Should I also be checking the SocketError after the Receive call in the do loop? IPEndPoint ep = new IPEndPoint(IPAddr...
[DbUnit][1] will meet your needs. One thing to watch out for is that they have switched to using SLF4J as their logging facade instead of JCL. You can configure SLF4J to forward the logging to JCL but be warned if you are using Maven DbUnit sucks in their Nop log provider by default so you will have to use an exclusion...
SQL to add column with default value - Access 2003
2 Queries: <pre><code>SELECT * FROM Items WHERE column LIKE '%foo%' AND column LIKE '%bar%';<br/> SELECT * FROM Items WHERE (column LIKE '%foo%' AND column NOT LIKE '%bar%') OR (column NOT LIKE '%foo%' AND LIKE '%bar%')</code></pre> (No XOR in SQL)
Setting environment variables for Phusion Passenger applications
|ruby|ruby-on-rails|passenger|env|