instruction stringlengths 0 30k ⌀ |
|---|
> I think you need to drop the "~/" and replace it with just "/", I believe / is the root
**STOP RIGHT THERE!** :-) unless you want to hardcode your web app so that it can only be installed at the root of a web site.
"/~" ***is*** the correct thing to use, but the reason that your original code didn't work as ... |
Personally I prefer the join syntax as its makes it clearer that the tables are joined and how they are joined. Try compare larger SQL queries where you selecting from 8 different tables and you have lots of filtering in the where. By using join syntax you separate out the parts where the tables are joined, to the part... |
In our model (which is fairly specific to business process applications) the design artefacts include:
- a domain data model, with comments on each entity and attribute
- a properties file listing all the modify and create triggers on each entity, calculated attributes, validators and other business logic
- ... |
I found a pair of [blog][1] [postings][2] that appear to cover this topic.
[1]: http://blogs.msdn.com/astebner/archive/2004/11/10/255346.aspx
[2]: http://blogs.msdn.com/astebner/archive/2007/06/12/3260076.aspx
|
My current solution is to create an exact searcher and a prefix searcher, both sorted by reverse population, and then copy out all my hits starting from the exact hits, moving to the prefix hits. It makes paging my results slightly more annoying than I think it should be.
Also I used a hash to eliminate duplicates ... |
My current solution is to create an exact searcher and a prefix searcher, both sorted by reverse population, and then copy out all my hits starting from the exact hits, moving to the prefix hits. It makes paging my results slightly more annoying than I think it should be.
Also I used a hash to eliminate duplicates ... |
Well, for one I'd say a main advantage is that F# compiles against the .NET platform which makes it easy to deploy on windows. I've seen examples which explained using F# combined with ASP.NET to build web applications ;-)
On the other hand, Haskell has been around for waaaaay longer, so I think the group of people ... |
> Bigger C++ projects I've seen hardly used more than one namespace (e.g. boost library).
Actually boost uses tons of namespaces, typically every part of boost has its own namespace for the inner workings and then may put only the public interface in the top-level namespace boost.
Personally I think that the larg... |
> Bigger C++ projects I've seen hardly used more than one namespace (e.g. boost library).
Actually boost uses tons of namespaces, typically every part of boost has its own namespace for the inner workings and then may put only the public interface in the top-level namespace boost.
Personally I think that the larg... |
How do you set, clear and toggle a single bit in C? |
|c++|c|bit-manipulation| |
How to set, clear and toggle a bit in C? |
It's a little bit difficult to see the value of duck typing until you've used it for a little while. Once you get used to it, you'll realize how much of a load off your mind it is to not have to deal with interfaces or having to worry about exactly what type something is. |
You can try the following tool to make things more sane:
http://www.bdsoft.com/tools/stlfilt.html |
Some compilers give better messages than others. What compiler are you using? Having said that, they are all pretty bad. C++0X will fix most of this problem (see [concepts][1]), but the standard won't be released until 2009, and broad support will probably be even later than that :-(
[1]: http://en.wikipedia.org... |
**Setting a bit**
Use the bitwise OR operator (|) to set a bit.
number |= 1 << x;
That will set bit x.
**Clearing a bit**
Use the bitwise AND operator (&) to clear a bit.
number &= ~(1 << x);
That will clear bit x. You must invert the bit string with the bitwise NOT operator (~), then AND... |
Often time I need to add a control to a dialog after the dialog has been generated via dialog template and CreateDialogIndirect. In these cases the tab order is set by the dialog template and there is no obvious way to change the tab order by including a newly created control. |
Something like [`hg transplant`][1]? That's what we use on our dev and prod branches.
[1]: http://www.selenic.com/mercurial/wiki/index.cgi/TransplantExtension |
Something else you can do is EagerLoading. In Linq2SQL you can use LoadOptions : [More on LoadOptions][1]
[1]: http://oakleafblog.blogspot.com/2007/08/linq-to-sql-query-execution-with.html
One VERY weird thing about L2S is that you can set LoadOptions only before the first query is sent to the Database. |
I recently discovered that you can use SetWindowPos to accomplish this. Determine which control after which you want to insert the new control in the tab order then use SetWindowPos like this:
SetWindowPos(hNewControl, hOldControl, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
This changes the z-order of controls whi... |
With `ldd` you can get the libraries that tools use. To rank the usage of libraries for a set of tool you can use something like the following command.
ldd /bin/* /usr/bin/* ... | sed -e '/^[^\t]/ d; s/^\t\(.* => \)\?\([^ ]*\) (.*/\2/g' | sort | uniq -c
(Here `sed` strips all lines that do not start with a ta... |
Programmatic Caching is one area which immediately comes to my mind. It is a great feature which needs to be used carefully. Since it is shared across requests, you have to put locks around it before updating it. |
Programmatic Caching is one area which immediately comes to my mind. It is a great feature which needs to be used carefully. Since it is shared across requests, you have to put locks around it before updating it.
Another place I would check is any code accessing filesystem like writing to log files. If one request h... |
[JetBrains dottrace profiler][1] is the best. I wouldn't work without it. It is hard to find a tool that is free and performs well in this arena. Dottrace is hands down the best profiler I have used for .Net.
[1]: http://www.jetbrains.com/profiler/ |
Dynamic linq:Creating an extension method that produces JSON result |
|c#|linq|json| |
I'm stuck trying to create a dynamic linq extension method that returns a string in JSON format - I'm using System.Linq.Dynamic and Newtonsoft.Json and I can't get the Linq.Dynamic to parse the "cell=new object[]" part. Perhaps too complex? Any ideas? :
static void Main(string[] args)
{
... |
Short answer: no. Such a function was considered and explicitly rejected for version 2 of the XPath spec (see the non-normative[Illustrative User-written Functions section](http://www.w3.org/TR/xpath-functions/#examples)). |
Short answer: no. Such a function was considered and explicitly rejected for version 2 of the XPath spec (see the non-normative [Illustrative User-written Functions section](http://www.w3.org/TR/xpath-functions/#examples)). |
cx_Oracle: how do I get the ORA-xxxxx error number? |
|python|oracle-database|cx-oracle| |
In a try/except block, how do I extract the Oracle error number? |
According to the [URL specification][1], the square brackets are not valid URL characters.
Here's the relevant snippets:
> The "national" and "punctuation" characters do not appear in any
productions and therefore may not appear in URLs.
national { | } | vline | [ | ] | \ | ^ | ~
punct... |
try:
cursor.execute("select 1 / 0 from dual")
except cx_Oracle.DatabaseError, exc:
error, = exc
print "Code:", error.code
print "Message:", error.message
This results in the following output:
Code: 1476
Message: ORA-01476: divisor is equal to zero |
Any browser or web-enabled software that accepts URLs and is not throwing an exception when special characters are introduced is almost guaranteed to be encoding the special characters behind the scenes. Curly brackets, square brackets, spaces, etc all have special encoded ways of representing them so as not to produce... |
A deadlock is a state of a system in which no single process/thread is capable of executing an action. As mentioned by others, a deadlock is typically the result of a situation where each process/thread wishes to acquire a lock to a resource that is already locked by another (or even the same) process/thread.
There ... |
Can I run rubygems in ironruby? |
|ironruby| |
Is it currently possible with pre release of ironruby to run rubygems? It seems as if I have to set an environment variable to find them? |
if you set ENV['GEM_PATH'] correctly before using rubygems, then gems will work *sometimes* under IronRuby. I'm actually looking at fixing this right now.
Also, this kind of question is probably better suited for the [IronRuby mailing list][1] than it is for StackOverflow.
[1]: http://rubyforge.org/mail/?gro... |
> Performance wise, they are exactly the same (at least in SQL Server) but be aware that they are deprecating this join syntax and it's not supported by sql server2005 out of the box.
I think you are thinking of the deprecated \*= and =\* operators vs. "outer join".
I have just now tested the two formats given, a... |
A monad is a thing used to encapsulate objects that have changing state. It is most often encountered in languages that otherwise do not allow you to have modifiable state (e.g., Haskell).
An example would be for file IO.
You would be able to use a monad for file IO to isolate the changing state nature to just th... |
If you're dynamically generating your page though, this probably won't make sense. If you're in PHP, you can pick the inode and file size of the main script, but the modify time won't tell you if your data has changed. Unless you have a good caching process or just generate static pages, etags aren't helpful. If you do... |
If you're dynamically generating your page though, this probably won't make sense. If you're in PHP, you can pick the inode and file size of the main script, but the modify time won't tell you if your data has changed. Unless you have a good caching process or just generate static pages, etags aren't helpful. If you do... |
On some databases (notably Oracle) the order of the joins can make a huge difference to query performance (if there are more than two tables). On one application, we had literally two orders of magnitude difference in some cases. Using the inner join syntax gives you control over this - if you use the right hints synta... |
It's a shame that some people perceive Stripes as a framework for which "there really just isn't much support or information for it." In reality, the Stripes community is **very** supportive - have a look at the [mailing list](http://news.gmane.org/gmane.comp.java.stripes.user) and you'll see how friendly and responsiv... |
I have virtually no knowledge of C#, but I suspect that either switch was simply taken as it occurs in other languages without thinking about making it more general or the developer decided that extending it was not worth it.
Strictly speaking you are absolutely right that there is no reason to put these restriction... |
I have virtually no knowledge of C#, but I suspect that either switch was simply taken as it occurs in other languages without thinking about making it more general or the developer decided that extending it was not worth it.
Strictly speaking you are absolutely right that there is no reason to put these restriction... |
I have virtually no knowledge of C#, but I suspect that either switch was simply taken as it occurs in other languages without thinking about making it more general or the developer decided that extending it was not worth it.
Strictly speaking you are absolutely right that there is no reason to put these restriction... |
Mr. Bunny's Big Cup O' Java |
Maybe you're looking for something like [Kigg - Building a Digg Clone with ASP.NET MVC][1].
Or maybe Jeff and the team are willing to provide you the souce code for SO... :P
[1]: http://dotnetslackers.com/articles/aspnet/KiggBuildingADiggCloneWithASPNETMVC1.aspx |
Detach an entity from JPA/EJB3 persistence context |
|java|jpa|ejb-3.0| |
What would be the easiest way to detach a specific JPA Entity Bean that was acquired through an EntityManager. Alternatively, could I have a query return detached objects in the first place so they would essentially act as 'read only'?
The reason why I want to do this is becuase I want to modify the data within the ... |
Can you provide a code sample?
More likely than not you'll just need to escape your HTML entities using [encodeuri](http://www.w3schools.com/jsref/jsref_encodeURI.asp) or something like that. |
What about the [MVC Membership application][1] that Troy Goode wrote. I'm not sure what Preview he wrote it in but it could be worth a look.
Also, if you want to go right from the beginning, scott gu has a [great series of posts on MVC][2]
Edit: he has an [updated version][3] as well
[1]: http://www.square... |
What about the [MVC Membership application][1] that Troy Goode wrote. I'm not sure what Preview he wrote it in but it could be worth a look.
Also, if you want to go right from the beginning, scott gu has a [great series of posts on MVC][2]
Finally, I haven't personally taken a look at this code, but I noticed the... |
[Rob Conery's MVC Storefront project][1] is a good from-the-ground-up step-by-step series on how to put up an ASP.NET MVC site.
[1]: http://blog.wekeroad.com/mvc-storefront/ |
[CodeCampServer][1] - Built with ASP.NET MVC, pretty light and small project. No cruft at all.
@lomaxx - Just FYI, most of what Troy Goode wrote is now part of [ASP.NET MVC as of Preview 4][2].
[1]: http://code.google.com/p/codecampserver/
[2]: http://weblogs.asp.net/scottgu/archive/2008/07/14/asp-net-mvc... |
Modeling Geographic Locations in an Relational Database. |
|sql|database-design| |
I am designing a contact management system and have come across an interesting issue regarding modeling geographic locations in a consistent way. I would like to be able to record locations associated with a particular person (mailing address(es) for work, school, home, etc.) My thought is to create a table of locales ... |
Does Java need closures? |
|java|closures| |
I've been reading a lot lately about the next release of Java possibly supporting closures. I feel like I have a pretty firm grasp on what closures are, but I can't think of a solid example of how they would make an Object-Oriented language "better". Can anyone give me a specific use-case where a closure would be nee... |
I think the best solution would be to get everyone to use the version control system directly. If you are on a Windows platform, TortoiseSVN would be my recommendation.
If using TortoiseSVN directly is too difficult, I have had good experiences with setting up a Samba file share where all project documents are stor... |
Sounds like a good approach to me. The one thing that I'm not clear on when reading you post is what "parents of themselves" means - if this is to indicate that the locale does not have a parent, you're better off using null than the ID of itself. |
In Oracle:
select round((sysdate - cu.last_updated) * 24) || ' hours ago'
from customers cu |
In Oracle:
select
CC.MOD_DATETIME,
'Last modified ' ||
case when (sysdate - cc.mod_datetime) < 1
then round((sysdate - CC.MOD_DATETIME)*24) || ' hours ago'
when (sysdate - CC.MOD_DATETIME) between 1 and 7
then round(sysdate-CC.MOD_DATETIME) || ' days ago'
... |
@lomaxx: Just to clarify, I'm pretty certain that both above syntax are supported by SQL Serv 2005. The syntax below is NOT supported however
select a.*, b.*
from table a, table b
where a.id *= b.id;
Specifically, the outer join (*=) is not supported. |
[Expert .NET 2.0 IL Assembler by Serge Lidin][1]
There was a 1.1 version of the same book, but I haven't seen anything for the latest .NET release. It's an excellent book. I used it to write an OCR component in MSIL, as a learning project.
[1]: http://www.amazon.com/Expert-NET-2-0-IL-Assembler/dp/159059646... |
[Expert .NET 2.0 IL Assembler by Serge Lidin][1]
There was a 1.1 version of the same book, but I haven't seen anything for the latest .NET release. It's an excellent book. I used it to write an OCR component in MSIL, as a learning project.
[Edit] @Curt is right, 3.0 and 3.5 are just extensions to 2.0, I hadn't... |
Sorry for the down vote, but I wanted to try to make sure you came back to this question, because the array you created by _Dim s(0) As String_ **IS NOT EMPTY**
In VB.Net, the subscript you use in the array is index of the last element. That means you have an array that already has one element.
You should try us... |
Sorry for the down vote, but I wanted to try to make sure you came back to this question, because the array you created by _Dim s(0) As String_ **IS NOT EMPTY**
In VB.Net, the subscript you use in the array is index of the last element. That means you have an array that already has one element.
You should try us... |
We had an interesting issue come up at a company I previously worked at where we used friend to decent affect. I worked in our framework department we created a basic engine level system over our custom OS. Internally we had a class structure:
Game
/ \
TwoPlayer SinglePlayer
... |
The .h files should be used to define the prototypes for your functions. This is necessary so you can include the prototypes that you need in your C-file without declaring every function that you need all in one file.
For instance, when you #include <stdio.h>, this provides the prototypes for printf and other IO f... |
The .h files should be used to define the prototypes for your functions. This is necessary so you can include the prototypes that you need in your C-file without declaring every function that you need all in one file.
For instance, when you `#include <stdio.h>`, this provides the prototypes for printf and other IO... |
It's been ages since I've played the reading google's tea leafs game, but there are a few reasons your SEO expert might be saying this
1. Three or four years back there was a bit of conventional wisdom floating around that the search engine algorithms would give more weight to search terms that happened sooner in th... |
Are you certain that `currentPage` is an integer? Try something like:
var currentPage = 5;
jQuery('li').eq(currentPage);
as a simple sanity check. If that works, you should try casting to `Integer`. |
How to Stop NTFS volume auto-mounting on OS X |
|macos|hardware| |
I'm a bit newbieish when it comes to the deeper parts of OSX configuration and am having to put up with a fairly irritating niggle which while I can put up with it, I know under Windows I could have sorted in minutes.
Basically, I have an external disk with two volumes:
One is an HFS+ volume which I use for Time... |
|macos|hardware| |
I'm a bit newbieish when it comes to the deeper parts of OSX configuration and am having to put up with a fairly irritating niggle which while I can put up with it, I know under Windows I could have sorted in minutes.
Basically, I have an external disk with two volumes:
One is an HFS+ volume which I use for Time... |
What kind of problems are state machines good for? |
When creating dynamic controls ... I only populate them on the initial load. Afterwords I recreate the controls on postback in the page load event, and the viewstate seems to handle the repopulating of the values with no problems. |
I'll cite some passages from [Implementation Patterns][1] by Kent Beck:
##Simple Superclass Name
> "[...] The names should be short and punchy.
> However, to make the names precise
> sometimes seems to require several
> words. A way out of this dilemma is
> picking a strong metaphor for the
> computation. Wi... |
If he is interested than I wouldn't worry about focusing on games or whatnot. I'd just grab that beginners 'teach yourself x' book you were about to throw and give it him and let him struggle through it. Maybe talk about it after and then do another and another. After then I'd pair program with him so he could learn ho... |
The most obvious thing would be a pseudo-replacement for all those classes that just have a single method called run() or actionPerformed() or something like that. So instead of creating a Thread with a Runnable embedded, you'd use a closure instead. Not more powerful than what we've got now, but much more convenient... |
IPC in .Net can be achieved using:
- **WCF**, using named pipers (current .Net 3.0 and above way of doing things)
- **Remoting**, (Which I believe is no longer being actively developed)
- **Sockets** using a custom protocol (harder) |
IPC in .Net can be achieved using:
- **WCF**, using named pipers (current .Net 3.0 and above way of doing things)
- **Remoting**, (Which I believe is no longer being actively developed)
- **Sockets** using a custom protocol (harder)
**Code example**
- The WCF class **NetNamedPipeBinding** can be used... |
IPC in .Net can be achieved using:
- **WCF**, using named pipes **requires .Net 3.0** and above.
- **Remoting**, (Which I believe is no longer being actively developed)
- **Sockets** using a custom protocol (harder)
**Code example**
- The WCF class **NetNamedPipeBinding** can be used for interprocess... |
IPC in .Net can be achieved using:
# WCF
using named pipes **requires .Net 3.0** and above.
##Code example
- The WCF class **NetNamedPipeBinding** can be used for interprocess communication on the same machine. The MSDN documentaion for this class includes a code sample covering this scenario <http://msdn... |
There is nothing wrong with static typing if you are using Haskell, which has an incredible static type system. However, if you are using languages like Java and C++ that have terribly crippling type systems, duck typing is definitely an improvement.
Imagine trying to use something so simple as "map" in Java (and n... |
Don't listen to every people telling you that namespaces are just name-spaces.
They are important because they are considered by the compiler to apply the interface principle. Basically, it can be explained by an example:
namespace ns {
class A
{
}
void print(A a)
{
}... |
I've read in a few places that Google's spiders only index the first 100KB of a page. 20KB of JS at the top of your page would mean 20KB of content later on that Google wouldn't see, etc.
Mind you, I have no idea if this fact is still true, but when combine it with the rest of the superstition/rumors/outright quacke... |
I've read in a few places that Google's spiders only index the first 100KB of a page. 20KB of JS at the top of your page would mean 20KB of content later on that Google wouldn't see, etc.
Mind you, I have no idea if this fact is still true, but when combine it with the rest of the superstition/rumors/outright quacke... |
I'm on that mailing list - to save you the digging, someone asked this a few weeks ago, and [this was the answer](http://rubyforge.org/pipermail/ironruby-core/2008-August/002688.html)
The answer (at this point) is no, you can't, but it doesn't seem like it'll be too far away.
PS: listen to curt. He's on the core ... |
The solution is to use the OpenDesktop API call. Basically it just attempts to switch the the default desktop which will fail if it's locked.
Note1: the following function loads the relevant dlls and functions dynamically so that apps will still run on Windows 9.x :)
Note2: DESKTOP& #95;SWITCHDESKTOP should read ... |
How do you index into a var in LINQ? |