instruction stringlengths 0 30k ⌀ |
|---|
[Min-height fast hack][1] works for me (also works for width)
[1]: http://www.dustindiaz.com/min-height-fast-hack/ |
Materialized views are disk based and update periodically base upon the query definition.
Views are virtual only and run the query definition each time they are accessed. |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<newBooks>
<xsl:for-each select="books/book">
<newBook>... |
If you're looking for a free tool there is plenty of implementations for the popular Cron tool for Windows, for example [CRONw](http://cronw.sourceforge.net/). It's pretty easy to configure and maintain. You could easily write add custom WSH scripts to send your emails and add log entries.
If you're going commercial... |
Best bet would be to grab the default active network connection, ensure it is an internet connection (ping google.com or similar) and then ask it what type of device it is. You should be able to determine from that what connection the user has.
I'm fairly confident this is possible, but not sure how to go about it t... |
symbian application as background process |
|java|symbian| |
is it possible to create java application that will
work as background process on symbian smartphones? |
Assemblies can coexist in the GAC (Global Assembly Cache) even if they have the same name given that the version is different. This is how .NET Framework shipped assemblies work.
Adding version numbers to the name of the Assembly just defeats the whole purpose of the assembly ecosystem and is cumbersome IMHO. To kno... |
Assemblies can coexist in the GAC (Global Assembly Cache) even if they have the same name given that the version is different. This is how .NET Framework shipped assemblies work. A requirement that must be meet in order for an assembly to be able to be GAC registered is to be signed.
Adding version numbers to the na... |
Changing your print statement to:
System.out.print((char)buf.get());
Seems to help. |
If it's not in the dictionary, probably not. |
[http://xoax.net/comp/cpp/console/Lesson0.php][1]
Any use?
[1]: http://xoax.net/comp/cpp/console/Lesson0.php |
To delve into theprise's answer, for the construction of the automaton, O(2^m) is the worst case, though it really depends on the form of the regular expression (for a very simple one that matches a word, it's in O(m), using for example the [Knuth-Morris-Pratt algorithm][1]).
[1]: http://en.wikipedia.org/wiki/Kn... |
The problem is almost certainly the select. Is there anyway you could extract all the text at once then iterate over internal variables? |
I would add another rule here:
- Don't new/delete an object when an automatic object will do just fine.
We have found that programmers who are new to C++, or programmers coming over from languages like Java, seem to learn about new and then obsessively use it whenever they want to create any object, regardless ... |
Some people say that a smaller IDE is better for learning. Take a look at [Code::Blocks](http://www.codeblocks.org/). It's generally true that beginning C in an IDE is hard because not many books explain enough to control the IDE. Perhaps starting in a console and a basic text editor with syntax highlighting would be b... |
Some people say that a smaller IDE is better for learning. Take a look at [Code::Blocks](http://www.codeblocks.org/). It's generally true that beginning C in an IDE is hard because not many books explain enough to control the IDE. Perhaps starting in a console and a basic text editor with syntax highlighting would be b... |
The [stopwatch][1] functionality would be better (higher precision). I'd also recommend just downloading one of the popular profilers, though ([DotTrace][2] and [ANTS][3] are the ones I've used the most... the free trial for DotTrace is fully functional and doesn't nag like some of the others).
[1]: http://cplu... |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Dashboard Example</title>
<style type="text/css">
body, html { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; }
iframe { border: none; }
<... |
If "/" is not accessible it means that there is no "index.html", "index.jsp" or whatever is defined in the welcome-files list of the web.xml
Also no Servlet-Mapping for the context ROOT directory is present.
Check the web.xml for Servlet-Mappings or try to figure out the name of the jsp/html /... file being in the co... |
Not sure if this is the optimal solution:
foreach($submission_info as $info){
if($info['field_name'] == 'loanOfficer'){ //check the field name
$content = $info['content']; //store the desired value
continue; //this will stop the loop after the desired item is found
}
}
Nex... |
As Joel says, you can't meaningfully 'sleep' (i.e. relinquish your scheduled CPU) for such short periods. If you want to delay for some short time, then you need to spin, repeatedly checking a suitably high-resolution timer (e.g. the 'performance timer') and hoping that something of high priority doesn't pre-empt you ... |
Use the high resolution timers available in winmm.lib. See [this][1] for an example.
[1]: http://www.codeguru.com/cpp/w-p/system/timers/article.php/c5759/ |
IMHO the major problem with MSSQL has been for a long time now no multi-version read consistancy. Fortunately this has been corrected since SQL2005 with the snapshot isolation level.
If your looking for a good RDBMS for a small project requring minimal knowledge for maintenance SQL Express is a good pick. SQL Expr... |
The best thing is to start by adding logging statements. Generally I would recommend only around the shared resources that are deadlocking but also adding them in general might point to situations or areas of code you weren't expecting. The much publicized stackoverflow.com database issue actually turned out to be log4... |
How can a nested if not stall? Actually if a and b are both variables and not expressions with side effects, they can be loaded in parallel by a good compiler. There's no benefit to using more ifs except increasing your line count. Really, this would be the worst kind of second guessing a compiler.
It's called sh... |
You might want to take a look at this product: http://www.spreadsheetgear.com/products/spreadsheetgear.net.aspx
It's all managed code and direct .NET libraries. No InterOp headaches. I haven't used it myself, but I've heard very good things from people in the finance world. |
Try [Skitch](http://www.skitch.com/). It seems to be one of the best kept secrets for simple drawing and image manipulation on the Mac. I heard about it recently on TMO Geek Gab podcast. |
Short circuit evaluation is translated into branches in assembly language in the same way if statements are (branches are basically a goto), which means it is not going to be any slower than if statements.
Branches don't typically stall the pipeline, but the processor will guess whether the branch is taken or not, a... |
A useful short circuit I use is something like this:
if (a != null && a.equals(somevalue)) {
... do something.
}
This is, in my opinion very readable, and functions quite well. Generally, I try too avoid to much nesting because it leads to ugly code.
All my opinion though. |
CVS Checkout to a directory |
|cvs|tortoisecvs|checkout| |
How do i check out a specific directory from CVS and omit the tree leading up to that directory?
EX.
Id like to checkout to this directory
C:/WebHost/MyWebApp/www
My CVS Project directory structure is
MyWebApp/Trunk/www
How do i omit the Trunk and MyWebApp directories?
|
Most languages do short-circuit evaluation of boolean expressions. I have always heard it referred to as short-circuit evaluation.
The example in the question is a pretty simplistic example that doesn't really provide much of a performance benefit. The performance benefit comes when the expressions are complex t... |
|exception|wcf|silverlight| |
I have a Silverlight 2 application that is consuming a WCF service. As such, it uses asynchronous callbacks for all the calls to the methods of the service. If the service is not running, or it crashes, or the network goes down, etc before or during one of these calls, an exception is generated as you would expect. ... |
Have you considered looking into having the GPU do this work? If you can load the strings into GPU memory and have it process them all you may find a good algorithm that will run significantly faster than your processor.
Alternately, do it in an FPGA - There are FPGA PCI-E boards that you can use to make arbitrary ... |
A compiler doesn't have to tell you that you're calling a function with the wrong number of parameters/wrong parameter types if the function prototype isn't available. |
I'm not sure what those specific terms mean, so I'll take a stab at defining what they are before I continue:
- Black box reuse is using a class/function/code unmodified in a different project
- White box reuse is taking a class/function/code from one project and modifying it to suit the needs of another projec... |
buf.getChar() is expecting 2 bytes per character but you are only storing 1. Use:
System.out.print((char) buf.get());
|
I think you can look at :
http://www.visualcron.com/ |
test attribute in JSTL <c:if> tag |
|jsp|java|jstl| |
I saw some code like the following in a JSP
<c:if test="<%=request.isUserInRole(RoleEnum.USER.getCode())%>">
<li>user</li>
</c:if>
My confusion is over the "=" that appears in the value of the `test` attribute. My understanding was that anything included within `<%= %>` is printed to the output, bu... |
|java|jsp|jstl| |
I saw some code like the following in a JSP
<c:if test="<%=request.isUserInRole(RoleEnum.USER.getCode())%>">
<li>user</li>
</c:if>
My confusion is over the "=" that appears in the value of the `test` attribute. My understanding was that anything included within `<%= %>` is printed to the output, bu... |
Here's what i've been living by --
It depends on what your are planning to use the DLL's for. I categorize them in 2 main groups.
1) dead-end Assemblies. These are EXE's/DLL's you really aren't planning on referencing from anywhere. Just weakly name these and make sure you have the version numbers you release ... |
Assuming twos complement arithmetic:
inline bool same_sign(int x, int y) {
return (x^y) < 0;
}
Not assuming twos complement arithmetic:
inline bool same_sign(int x, int y) {
return x<0? y<0 : y>=0;
}
Using multiplication is a bad idea because it is vulnerable to overflow.
|
Assuming twos complement arithmetic:
inline bool same_sign(int x, int y) {
return (x^y) >= 0;
}
Not assuming twos complement arithmetic:
inline bool same_sign(int x, int y) {
bool x_is_negative = x < 0;
return y<0? x_is_negative : !x_is_negative;
}
Using multiplication... |
Assuming twos complement arithmetic (http://en.wikipedia.org/wiki/Two_complement):
inline bool same_sign(int x, int y) {
return (x^y) >= 0;
}
This can take as little as two instructions and less than 1ns on a modern processor with optimization.
Not assuming twos complement arithmetic:
inli... |
Assuming twos complement arithmetic (http://en.wikipedia.org/wiki/Two_complement):
inline bool same_sign(int x, int y) {
return (x^y) >= 0;
}
This can take as little as two instructions and less than 1ns on a modern processor with optimization.
Not assuming twos complement arithmetic:
in... |
easiest would be a backup and restore or detach and attach
or script out all the tables and BCP out the data then BCP in the data on the new server
or use DTS/SSIS to do this |
The for-each loop in java uses the underlying iterator mechanism. So it's identical to the following:
Iterator<String> iterator = someList.iterator();
while (iterator.hasNext()) {
String item = iterator.next();
System.out.println(item);
} |
You could use the following, which reports the timezone offset from GMT in minutes:
new Date().getTimezoneOffset(); |
What are you waiting for that requires such precision? In general if you **need** to specify that level of precision (e.g. because of a dependency on some external hardware) you are on the wrong platform and should look at a real time OS.
Otherwise you should be considering if there is an event you can synchronize ... |
You might have answered your own question when you used the word strategy (i.e. the Strategy Design Pattern).
Possibly you could:
- Create a project class that knows nothing about conversions but accepts a strategy object.
- Create a hierarchy of classes to model each possible conversion strategy.
- Use ... |
I don't know anything about pipelining, but short-circuit evaluation is a common feature of many languages (and that's also the name I know it by). In C, && and the other operators define a [sequence point](http://en.wikipedia.org/wiki/Sequence_point) just like the ; operator does, so I don't see how short-circuit eval... |
It's perfectly reasonable to push the view and controller classes that your application uses out into a separate framework — embedded in your application wrapper — for which you also produce an Interface Builder plug-in.
Among other reasons, classes that are commonly used in your application can then be configured a... |
It appears that PropertyValues refers to the number of PropertyValues that have been set. The default values you specify aren't considered set and won't be stored to the user config if you sall Save().
Console.WriteLine(Settings.Default.PropertyValues.Count.ToString());
Console.ReadLine();
Settings.De... |
Get Flex app's position on a web page? |
|html|apache-flex| |
Is it possible to get the x,y coordinates of a Flex app within an HTML page? I know you can use ExternalInterface.ObjecID to get the "id attribute of the object tag in Internet Explorer, or the name attribute of the embed tag in Netscape" but I can't seem to get past that step. It seems like it should be possible to ... |
First, your friend is wrong. Short-circuit evaluation (aka minimal evaluation) is available in most languages and is better than nested ifs for parallel languages (in which case the first of the conditions that returns will cause execution to continue)
In any case, even in a straightforward non-parallel language I d... |
What we did was to write a small layer around I/O completion ports, ReadFile, and GetQueuedCompletion status in C++/CLI, and then call back into C# when the operation completed. We chose this route over BeginRead and the c# async operation pattern to provide more control over the buffers used to read from the file (or... |
Does LINQ-to-SQL Support Composable Queries? |
YAML will do it perfectly as described above. For an example, in one of my Ruby scripts I have a YAML file like:
migration:
customer: Example Customer
test: false
sources:
- name: Use the Source
engine: Foo
- name: Sourcey
engine: Bar
which I then us... |
How do I have a socket accept connections only from the localhost (in Java)? |
|sockets|serversocket|localhost|loopback| |
I have a java app (not running in any application container) which listens on a ServerSocket for connections. I would like it to only accept connections which come from localhost. Currently, after a connection is accepted, it checks the peer IP and rejects it if it is not the loopback address, but I know that peer IP... |
|java|sockets|localhost|loopback|serversocket| |
What sort of file I/O are you doing? If it's text, look into using a FileSystemObject. |
DabbleDB I think is (was?) one. They may have moved off Squeak but I am sure they used it at one point. |
Peer IP addresses cannot be spoofed in this manner, have you nothing to fear from using the technique of inspecting the peer and deciding to drop the connection during establishment.
However: binding to 127.0.0.1 should work, and cause the operating system to tell the connecting host that there is nothing listening ... |
They came from java, and they were introduced because java (and C#) do not allow multiple inheritance.
For example, in C++, you could have a class named Dog that inherited from Animal and Mammal.
Multiple inheritance is very tricky, so interfaces were derived to simplify it. A C# class can only inherit from one b... |
They came from java, and they were introduced because java (and C#) do not allow multiple inheritance.
For example, in C++, you could have a class named Dog that inherited from Animal and Mammal.
In C#, you would have a class named Animal, and use an interface (IMammal). The I naming notation is historical from j... |
Accessing a resource file from a filesystem plugin on SymbianOS |
|symbian| |
I cannot use the Resource File API from within a file system plugin due to a PlatSec issue:
*PlatSec* ERROR - Capability check failed - Can't load filesystemplugin.PXT because it links to bafl.dll which has the following capabilities missing: TCB
My understanding of the issue is that:
File system plugins ... |
A view uses a query to pull data from the underlying tables.
A materialized view is a table on disk that contains the result set of a query.
Materialized views are primarily used to increase application performance when it isn't feasible or desirable to use a standard view with indexes applied to it. The downsid... |
Try:
<xsl:value-of select="count(preceding-sibling::*) + 1" />
**Edit** - had a brain freeze there, position() is more straightforward! |
For regression testing of our applications I use a free tool called AutoHotKey <http://www.autohotkey.com/>. It is simple, batch configurable, and can work for virtually any application you have. Not exactly designed for black box testing, but a good free tool to add to your toolbox.
While there are a few good comme... |
I looked up that it is alright to answer my own post, so here it is.
It turns out that you will have to scrape the friends list which is not legal in facebook terms of use. So we will not be doing this for our sites. Here are a few articles that show what happens when you don't play by the rules. Plaxo tested th... |
I normally URL-encode (with %xx) the filenames, and it seems to work in all browsers. You might want to do some tests anyway. |
My understanding of the situation was that because you couldn't access the Bin directory cross site, you'd need to develop an api or web service. Your best bet is to have a local copy of the dll on each server. |
Personally, if possible, I would prefer to handle this on the server side and work up a message to the user there. This works very well in a scenario where you only want to display a message to the user telling them what happened (validation message, essentially).
However, if you want to perform an action based on w... |
> Should I be throwing the errors in the
> ashx, or should I be returning a
> status code as part of the data
> returned by the call to
> userCreation.ashx, then using this to
> decide what action to take? How do you
> handle these situations?
Personally, if possible, I would prefer to handle this on the serve... |
Use the System.Diagnostics.Stopwatch class.
Stopwatch sw = new Stopwatch();
sw.Start();
// Do some code.
sw.Stop();
// sw.ElapsedMilliseconds = the time your "do some code" took.
|
I'm darned if I can find a reference at the moment, but I'm 99% sure that you *are* always supposed to be able to take the address of an argument, and it's up to the compiler to finesse the details of calling conventions, register usage, etc.
Indeed, I would have thought it to be such a common requirement that it's ... |
Setting your default to read uncommitted is not a good idea. Your will undoubtedly introduce inconsistencies and end up with a problem that is worse than what you have now. Snapshot isolation might work well, but it is a drastic change to the way Sql Server works and puts a *huge* load on tempdb.
Here is what you ... |
Setting your default to read uncommitted is not a good idea. Your will undoubtedly introduce inconsistencies and end up with a problem that is worse than what you have now. Snapshot isolation might work well, but it is a drastic change to the way Sql Server works and puts a *huge* load on tempdb.
Here is what you ... |
|c++|c|linker|link-performance| |
While incremental linking addresses much of the time spent linking, even for very large projects, I find the incremental linker in MSVS to be pretty haphazard. (I'm currently using 2003 atm, would love to hear if 2005/8 addressed any of this.) My list of known triggers include:
- changing anything external to the ... |
I like to have a read-only interface. Then the builder/controller/whatever can reference the object directly, but when you expose this object to the outside you show only the interface. |
I would definitely choose the Bezier for that purpose, and in particular I will implement the piecewise cubic Bezier - it is truly easy to implement and grasp and it is widely used by 3D Studio max and Photoshop.
Here is a good source for it:
http://local.wasp.uwa.edu.au/~pbourke/surfaces_curves/bezier/cubicbezier.... |
I would definitely choose the Bezier for that purpose, and in particular I will implement the piecewise cubic Bezier - it is truly easy to implement and grasp and it is widely used by 3D Studio max and Photoshop.
Here is a good source for it:
http://local.wasp.uwa.edu.au/~pbourke/surfaces_curves/bezier/cubicbezier.... |
Reinventing the wheel here. Using squares.
OK, you don't have exceptions in PHP 4. Welcome in the year 1982, take a look at C.
You can have error codes. Consider negative values, they seem more intuitive, so you would just have to check if (createUser() > 0).
You can have an error log if you want, with error m... |
They came from java, and they were introduced because java (and C#) do not allow multiple inheritance.
For example, in C++, you could have a class named Dog that inherited from Animal and Mammal.
In C#, you would have a base class named Animal, and use an interface (IMammal). The I naming notation is historical f... |
They came from java, and they were introduced because java (and C#) do not allow multiple inheritance.
**EDIT:** I'm receiving some downmods because people using COM interfaces in C++ disagree with the above statement. Regardless, the concept of an interface came from java, C++ COM interfaces were virtual classes, j... |
If you're asking if it's possible to use sprocs in SSRS reports that you create, then yes. Just call the sproc in the query for your DataSet like you would normaly. |