instruction stringlengths 0 30k ⌀ |
|---|
Restating what others have said, you just need to call window.print() in javascript. That and build a separate css for print. |
The event viewer shows HRESULT 0xc0000005 "Reading or writing to an inaccessible memory location." (STATUS_ACCESS_VIOLATION)
See my edit above for more details; reproing this takes a while so I can't get a fresh crash dump for WinDBG for a little while. |
Variable interpolation is only performed on "strings", not 'strings' (note the quotes). i.e.
<?php
$foo = "bar";
print '$foo';
print "$foo";
?>
prints $foobar. Change your quotes, and all should be well. |
<a href="http://www.westnet.com/~gsmith/content/linux-pdflush.htm">Here</a> is some information about tuning pdflush for write-heavy operations.
|
I think I may have spent 5%-10% of my time in Reflector at some point -- when I was first leaning .Net. These days is probably less than 1/2 hour a month. But then I don't use many 3rd party libraries.
Source code / documentation, it's harder to say. (yeah, like open source code HAS documentation....) One would ... |
The easiest solution would be to to replace all the tags, whether they are closed or not and let <code>.innerHTML</code> work out if they are matched or not it will much more resilient that way..
var tagreg = /\[(\/?)(b|u|i|s|center|code)]/ig
div.innerHTML="[b][i]helloworld[/b]".replace(tagreg, "<$1$2>") //... |
The trick is to define the project as a sequence of versions. Your initial design is for version 2.0, but, the intended first release is version 1.0. All new ideas (features) are welcomed but since, due to scheduling, version 1.0 is frozen, the new ideas have to go into version 2.0.
Of course as soon as versio... |
I'm sorry. The solution you give works, but I found out that it breaks when paginating with Take(N). The complete method I'm using is the following:
public IList<Post> GetPosts(int page, int records)
{
var options = new DataLoadOptions();
options.LoadWith<Post>(p => p.PostTags);
o... |
|security| |
How do I get an attribute value when using an XSLT with unknown namespaceI am currently having to use the local-name() function in my XLST to get the element values. However I need to get an attribute from one such element and I don't know how to do |
|xml|xslt|namespaces| |
I am currently having to use the local-name() function in my XLST to get the element values. However I need to get an attribute from one such element and I don't know how to do this when the namespaces are annoymous (hence need for local-name() function).
Here is a sample of the xml:
<?xml version='1.0' encod... |
How do I get an attribute value when using an XSLT with unknown namespace? |
How do I get an attribute value when using XSLT with unknown namespace? |
I am currently having to use the local-name() function in my XLST to get the element values. However I need to get an attribute from one such element and I don't know how to do this when the namespaces are unknown (hence need for local-name() function).
Here is a sample of the xml:
<?xml version='1.0' encodin... |
I am receiving a 3rd party feed of which I cannot be certain of the namespace so I am currently having to use the local-name() function in my XLST to get the element values. However I need to get an attribute from one such element and I don't know how to do this when the namespaces are unknown (hence need for local-nam... |
A bit of quality time with Google led me to a CodeProject article called "<a href="http://www.codeproject.com/KB/audio-video/soundalerts.aspx" title="CodeProject - Creating Your Own Sound Alerts">Creating Your Own Sound Alerts</a>". It seems the secret sauce is all underneath the `HKEY_CURRENT_USER\AppEvents... |
An abstract method or property (both can be virtual or abstract) can only be declared in an abstract class and cannot have a body, i.e. you can't implement it in your abstract class.
A virtual method or property must have a body, i.e. you must provide an implementation (even if the body is empty).
If someone want... |
When running commands, sometimes I'll want to run a command with the previous ones arguments. To do that, you can use this shortcut:
$ mkdir /tmp/new
$ cd !!:*
Occasionally, in lieu of using find, I'll break-out a one-line loop if I need to run a bunch of commands on a list of files.
for file i... |
When running commands, sometimes I'll want to run a command with the previous ones arguments. To do that, you can use this shortcut:
$ mkdir /tmp/new
$ cd !!:*
Occasionally, in lieu of using find, I'll break-out a one-line loop if I need to run a bunch of commands on a list of files.
for file i... |
I've faced similar problem and tried to use Levenstein distance first, but it did not work well for me. I came up with an algorithm that gives you "similarity" value between two strings (higher value means more similar strings, "1" for identical strings). This value is not very meaningful by itself (if not "1", always ... |
Before jumping in a making 70 models, please consider this question to help you decide:
Would each of your tables be considered an "object" for example a "cars" table or are some of the tables holding only relationship information, all foreign key columns for example?
In Rails only the "object" tables become mode... |
And individuals shouldn't be using TFS?? That's like saying source control is only for groups and not individuals.
If they had an express edition of TFS, then they'd probably get more people using it and paying for their company to use it. |
No, from memory anything Team Foundation based costs a few times more than the professional versions. That's where Microsoft really makes its money. |
If you're using a Browser control, there may be a property in it to change the background color to Transparent or to use Alpha channel layering. I'm not entirely sure how effective this would be, but it's worth a try.
Another thing to consider would be to create a small parser for the web page's HTML you're trying t... |
The answer is that "it depends". First of all, on the kind of environment you are releasing into. Is it "hello, world" type of website on a shared host somewhere, or a google.com with half a mil servers? Is there typically one user per day, or more like couple million? Are you publishing HTML/CSS/JPG, or is there a big... |
We have had luck with this: [http://msdn.microsoft.com/en-us/library/bb472424.aspx][1]
[1]: http://msdn.microsoft.com/en-us/library/bb472424.aspx |
A Ruby implementation to consider is Ruleby (http://ruleby.org/wiki/Ruleby) |
For "STL compatible" sorted vector see A. Alexandrescu's AssocVector from [Loki][1].
[1]: http://loki-lib.sourceforge.net/ |
Because Microsoft is p[ositioning TFS][1] to compete with software like [ClearCase][2]. Releasing a free edition would undermine that positioning.
[1]: http://www.ericsink.com/entries/vsts_pricing.html
[2]: http://en.wikipedia.org/wiki/Clearcase |
ASP.NET 2.0: Skin files only work when placed at the root theme folder? |
|files|themes|skin|app-themes| |
I have found that skin files only work if they are placed at the root theme folder in the App_Themes folder.
For example, if you have 2 themes in the App_Themes folder, you cannot add another sub folder to the theme folder and place a seperate skin file in that subfolder.
It's not much of a limitation, but it w... |
Here's a method that will concatenate 2 arrays of type T
T[] concat(T[] A, T[] B) {
T[] C= new T[A.length+B.length];
System.arraycopy(A, 0, C, 0, A.length);
System.arraycopy(B, 0, C, A.length, B.length);
return C;
}
(source: [Sun Forum][1] )
[1]: http://forums.su... |
Schaum's Outline of Programming with C++ by John R Hubbard.
This was the first programming book I read, when I started out with C++. It was gifted to me by someone who saw my interest in programming. The book is very good for beginners - it started from the elementary concepts, went up to templates and vectors. The ... |
If you're open to Maven, try the flex-compiler-mojo plugin:
http://code.google.com/p/flex-mojos/
Christiaan |
Consider developing the app in Silverlight and having either of the bellow 2 methods to make the same Silverlight App running in Desktop too. I admit that both of these are just silly tricks but it helps if your app doesnt have much layer dependancies.
1) [http://jobijoy.blogspot.com/2008/09/desklighter-handy-tool-f... |
What is the location of OpenOffice.org templates in Linux? |
|linux|debian|openoffice.org| |
I'd like to install some presentation templates, but don't know where to put them...
Thanks a lot |
I'm assuming that as you own TFS you'll be using it for version control. In that case I would lean towards Team Foundation Build. That said, I pretty much agree with [Nick][1].
I wrote the [CruiseControl.NET integration for TFS][2]. It works fine and gives you the same build capabilities that you are used to. To ... |
I'm sorry. The solution you give works, but I found out that it breaks when paginating with Take(N). The complete method I'm using is the following:
public IList<Post> GetPosts(int page, int records)
{
var options = new DataLoadOptions();
options.LoadWith<Post>(p => p.PostTags);
o... |
How to Update to Revision using Subclipse SVN plugin? |
|eclipse|svn|subclipse| |
In subclipse, the Team > Update menu option performs an "svn update -r HEAD".
I want to run "svn update -r [revision number]" but can't find a menu option which will let me update to anything besides the HEAD revision. |
I've been working on a business app in silverlight for the past couple of months, so I'm biased more towards that direction. These are my problems with 2 beta 2, I have no idea if they will be solved with the final version.
1. Printing. Some kind, any kind, I don't care, as long as I have some control over it. A b... |
I believe SVN Won't touch binary files, and chances are if you embedded a $REV$ string in it something would break.
I know nothing about "Office Macros" either, but it would probably be preferable to
1. Have a text file with that revision string.
2. Have an office macro copy the previous revision string ... |
FWIW, a timeout in seconds value should probably be a configuration setting (read in from a properties file or through injection as in Spring) and not a constant. |
I would recommend that you write your parser by hand, in which case having significant whitespace should not present any real problems.
The main problem with using a parser generator is that it is difficult to get good error recovery in the parser. If you plan on implementing an IDE for your language, then having go... |
You will definitely have better performance if you move your deleted data to another table like Jim said, as well as having record of when it was deleted, why, and by whom.
Adding where `deleted`=0 to all your queries will slow them down significantly, and hinder the usage of any of indexes you may have on the table... |
You will definitely have better performance if you move your deleted data to another table like Jim said, as well as having record of when it was deleted, why, and by whom.
Adding <code>where `deleted`=0</code> to all your queries will slow them down significantly, and hinder the usage of any of indexes you may have... |
^R reverse search. Hit ^R, type a fragment of a previous command you want to match, and hit ^R until you find the one you want. Then I don't have to remember recently used commands that are still in my history. Not exclusively bash, but also: ^E for end of line, ^A for beginning of line, ^U and ^K to delete before and ... |
Thanks very much for your response, it was very useful to us.
We sent off our issue to Oracle and got the following back
============
This is a known issue discussed in
Note:417092.1
Database Connections Are Left Open By Oracle Objects for OLE (OO4O)
Your question:
"Does 10g client interface allow the ASP... |
You can use Trigger.EnterAction to start an animation when a property is changed.
<Trigger Property="IsBusy" Value="true">
<Trigger.EnterActions>
<BeginStoryboard x:Name="BeginBusy" Storyboard="{StaticResource MyStoryboard}" />
</Trigger.EnterActions>
<Trigger.ExitActions>... |
I haven't tried this on a Windows box (I will be tonight, thanks) but the similar thing on Linux (noatime option when mounting the drive) sped things up **considerably**.
I can't think of any uses where the last access time would be useful other than for auditing purposes and, even then, does Windows store the user ... |
How to get the file path from HTML input form in Firefox 3 |
|html|firefox3| |
We have simple HTML form with `<input type="file">`, like shown below:
<form><label for="attachment">Attachment:</label> <input type="file"
name="attachment" id="attachment"><input type="submit"></form>
In IE7 (and probably all famous browsers, including old Firefox 2), if we submit a file like '//server... |
I think StringBuilder is the most efficient way to append text in .net. To be more efficient you can specify the initial size of the StringBuilder when you create it. |
Erlang Multicast |
|networking|multicast|erlang| |
How do you use gen_udp in Erlang to do multicasting? I know its in the code, there is just no documentation behind it. |
[Aptana Studio][1] provides JavaScript debugging for Firefox and IE
[1]: http://www.aptana.com/studio |
Should be something along these lines:
function setValue(inVal){
var dl = document.getElementById('leaveCode');
var el =0;
for (i=0; i<dl.options.length(); i++){
if (dl.options[i].value == inVal){el=inVal;}
}
dl.selectedIndex = el;
} |
Best way to differentiate MVC Controllers based on HTTP headers |
|asp.net-mvc|routes|asp.net|.net| |
## Problem ##
My current project requires me to do different things based on different HTTP request headers for nearly every action.
Currently, I have one massive Controller, and every action method has an ActionName attribute (so that I can have multiple versions of the same action that takes the same parameters... |
|.net|asp.net|asp.net-mvc|routes| |
## Problem ##
My current project requires me to do different things based on different HTTP request headers for nearly every action.
Currently, I have one massive Controller (all for the same resource type), and every action method has an ActionName attribute (so that I can have multiple versions of the same acti... |
What are the best practices for moving between version control systems? |
|cvs|perforce|version-control| |
There are about 200 projects in cvs and at least 100 projects in vss. Some are inactive code in maintenance mode. Some are legacy apps. Some are old apps no longer in use. About 10% are in active development. The plan is to move everything to perforce my end of year 2009.
Has anyone done a large migration like this?... |
Use sqlcmd instead of osql if it's a 2005 database |
Outlook appointments are just e-mails with special header information. There's some information in [this tutorial][1] on the required parts. I sent a few meeting invites from my Outlook to my Gmail account and took a look at the raw headers there - you can figure most of the protocol out from that.
The [iCalendar s... |
I wrote some example C code for someone else a while back that shows how to do this. Here it is for you:
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
void error(char *s);
char *data = "Some input data\n";
main()
{
int in[2], out[2], n, pid;
char bu... |
> t's good to separate content from layout
But this is a fallacious argument; Cliche Thinking
It's a fallacious argument because HTML tables are layout! The content is the _data_ in the table, the presentation is the table itself. This is why separating CSS from HTML can be very difficult at times. A pile of n... |
Track down where packets are being blocked/droped |
|networking|tcp| |
When I was in China my company's website was blocked for about 24 hours.
I assume it was the "Great Chinese Firewall" but I was wondering if there is anyway that I can find out exactly where a packet or TCP/IP connection gets blocked.
I was able to verify that it wasn't being blocked at our end(I used the local h... |
When I was in China my company's website was blocked for about 24 hours.
I assume it was the "Great Chinese Firewall" but I was wondering if there is anyway that I can find out exactly where a packet or TCP/IP connection gets blocked.
I was able to verify that it wasn't being blocked at our end(I used the local h... |
[cdb][1] if the data does not change.
/Allan
[1]: http://cr.yp.to/cdb.html |
Multiple Cases in Switch: |
|c#|switch-statement| |
I believe I've seen this somewhere, but I don't recall if it was a different language, or if I just can't remember the syntax well.
Is there a way to fall through multiple case statements without stating case value: repeatedly?
I know this works:
Switch (value)
{
case 1:
case 2:
... |
[SimpleXML][1] seems to do a good job for me.
[1]: http://us2.php.net/simplexml |
There's a windows app called CheckWeb. Its no longer developed, but it works well, and the code is open (C++ I believe).
You just give it a url, and it will crawl your site (and external links if you choose), reporting any errors, image / page "weight" etc.
[http://www.algonet.se/~hubbabub/how-to/checkweben.html... |
If you're more interested in hand Coding your HTML, it might be worth looking at the [ASP.NET MVC project][1]. You get a little more control over things than standard WebForms.
As an aside, plugging data access code in the Page_Load is never a good idea. It ties your presentation too much to your data code. Have a ... |
How to concatenate two arrays in Java? |
|arrays|concatenation|java|append|addition| |
I need to concatenate to String arrays in Java.
void f(String[] first, String[] second) {
String[] both = ???
}
What is the easiest way to do this? |
|java|arrays|concatenation|addition|append| |
I need to concatenate two String arrays in Java.
void f(String[] first, String[] second) {
String[] both = ???
}
What is the easiest way to do this? |
string.TrimStart(',') will remove the comma, however you will have trouble with a split operation due to the space after the comma.
Best to join just on the single comma or use
> Split(", ".ToCharArray(),StringSplitOptions.RemoveEmptyEntries); |
There is a [Wikipedia article](http://en.wikipedia.org/wiki/Future_(programming\)) about futures, in short its a way to use a value that is not yet known. The value can be then calculated on demand (lazy evaluation) and, optionally, concurrently with the main calculation.
C++ example follows.
----------
Sa... |
Well from my point of view the superior distribution mechanism is to use something like [ClickOnce][1], or [WebStart][2] technology. You just deploy the version to the server and it gets automatically to the clients when the version is released.
Also the Eclipse RCP platform contains UpdateManager that does what WebS... |
You don't. `xsl:text` can only contain text nodes and `<strong>` is an element node, not a string that starts with less-than character; XSLT is about creating node trees, not markup. So, you have to do
<xsl:text>I am some text, and I want to be </xsl:text>
<strong>bold<strong>
<xsl:text> </xsl:text> |
Choose Tools > Options > OpenOffice.org > Paths and select the Templates line. There you can click "edit" and see the paths that it uses to search for templates. |
I use the NetBeans C++ plugin and it's superb. I come from a Visual Studio background and the Netbeans project management is very similar. I tried KDevelop but found it a little flaky (this was 12 months ago, so it is probably better now).
I also struggled with dependencies using KDevelop - i.e. where a program re... |
How do you use gen_udp in Erlang to do multicasting? I know its in the code, there is just no documentation behind it. Sending out data is obvious and simple. I was wondering on how to add memberships. |
|networking|erlang|multicast| |