instruction stringlengths 0 30k ⌀ |
|---|
Assuming you're joining on columns with no duplicates, which is by far the most common case:
- An inner join of A and B gives the result of A intersect B, i.e. the inner part of a venn diagram intersection.
- An outer join of A and B gives the results of A union B, i.e. the outer parts of a venn diagram union.
... |
Don't get too caught up on trying to optimize string operations in PHP. Doing a concatenation vs. interpolation is meaningless (in real world performance) if your database queries are poorly written or you aren't using any kind of caching scheme. Write your string operations in such a way that debugging your code later... |
Don't get too caught up on trying to optimize string operations in PHP. Concatenation vs. interpolation is meaningless (in real world performance) if your database queries are poorly written or you aren't using any kind of caching scheme. Write your string operations in such a way that debugging your code later will be... |
Why don't you create rights & profiles to manage wich pages a user can see?
I usually create a user class which implements the IPrincipal security interface. On every request to your application, you check the rights of a particular user and output the SiteMap's nodes allowed for this user.
|
Most of the digital libraries uses RSS/ATOM to display their search/results, data update, according to the [OAI-PMH protocol](http://www.openarchives.org/OAI/openarchivesprotocol.html) |
there are many examples. Here are a couple.
SharePoint provides RSS feeds from its lists.
Many faceted navigation products allow you to get an RSS feed based on a selected filter. For example, you can navigate to view 24" LCD Monitors on newegg.com and then get an RSS feed of that view. |
[Mantis](http://www.mantisbt.org/) bug tracker includes RSS feeds although I wish they were more configurable. Also we use [MediaWiki](http://www.mediawiki.org/wiki/MediaWiki) for documentation which has all sorts of RSS Feeds including a per page watch, and recent changes. |
Visual Assist X by Whole Tomato software is not free, but it's absolutely worth the money if you use Visual Studio for C++.
http://www.wholetomato.com/ |
I was hoping for something a little more automatic. VS will create a new .suo file every time the project is saved. So I would have to delete that file every time I open the project. I also don't want to have to remember to close all the files before closing VS.
Other IDEs that I have used have similar functionali... |
One of the fastest ways is to use python with a gui binding like pyQt, PyFLTK, tkinter, wxPython or even via pygame which uses SDL.
Its easy fast and platform independent.
Also the management of the packages is unbeatable.
See:
* http://wiki.python.org/moin/PyQt
* http://www.fltk.org/
* (tkinter is default ... |
Modulus operation with negatives values - weird thing ?? |
|python|modulo| |
Can you please tell me how much is (-2) % 5 ?
According to my pyhton interpreter is 3, but do you have a wise explanation for this ?
I've read that in some languages the result can be machine-dependent, but I'm not sure though.
Thanks for your help. |
|python|math|modulo| |
The result depends on the language. Python returns the sign of the divisor, where for example c# returns the sign of the dividend (ie. -2 % 5 returns -2 in c#). |
TFS - Branching for experimental development: Solution fails to load |
|tfs|version-control| |
*Disclaimer: I'm stuck on TFS and I hate it.*
My source control structure looks like this:
- /dev
- /releases
- /branches
- /experimental-upgrade
I branched from dev to experimental-upgrade and didn't touch it. I then did some more work in dev and merged to experimental-upgrade. Somehow TFS comp... |
|version-control|tfs| |
*Disclaimer: I'm stuck on TFS and I hate it.*
My source control structure looks like this:
- /dev
- /releases
- /branches
- /experimental-upgrade
I branched from dev to experimental-upgrade and didn't touch it. I then did some more work in dev and merged to experimental-upgrade. Somehow TFS comp... |
I would be wary of automatically upcasing all whitespace-preceded-words in scenarios where I would run the risk of attracting the fury of nitpickers.
I would at least consider implementing a dictionary for exception cases like articles and conjunctions. Behold:
> "Beauty and the Beast"
And when it comes to pr... |
The most popular (==standard?) way of determining the time zone I've seen around is simply *asking the user ximself.* If your website requires subscription, this could be saved in the users' profile data. For anon users, the dates could be displayed as UTC or GMT or some such.
I'm not trying to be a smart-alec. It's... |
mbUnit is worth alook, it has a set of features comparable to NUnit, it has its own GUI, or can be integrated into VS if you have Resharper. I would also recommend Rhino Mocks if you are doing any sort of TDD. |
Have you tried changing the target CPU to x86 instead of "Any CPU" in the advanced compiler options? I know that this solves some problems with other OLEDB providers by forcing the use of the 32-bit version. |
ASP, need to use SFTP |
|asp|sftp|ftp| |
This is ASP classic, not .Net. We have to get a way to SFTP into a server to upload and download a couple of files, kicked off by a user.
What have other people used to do SFTP in ASP classic? Not necessarily opposed to purchasing a control.
Thanks for any help! |
|asp|sftp| |
There are several ways to do this. Common methods use recursion, memoization, or dynamic programming. The basic idea is that you produce a list of all strings of length 1, then in each iteration, for all strings in the list, add that string concatenated with each character in the string individually.
Some pseudocode... |
There are several ways to do this. Common methods use recursion, memoization, or dynamic programming. The basic idea is that you produce a list of all strings of length 1, then in each iteration, for all strings produced in the last iteration, add that string concatenated with each character in the string individually.... |
This is what I use to read from a Magtek card reader:
//Open file on the device
deviceHandle =
CreateFile (deviceDetail->DevicePath,
GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, 0, NULL);
Try those options and see if you can at least read from the d... |
It should not be used in event handlers (though most browsers work defensively, and will no punish you). I would also argue that it should not be used in the href attribute of an anchor. If a browser supports javascript, it will use the properly defined event handler. If a browser does not, a javascript: link will a... |
It should not be used in event handlers (though most browsers work defensively, and will not punish you). I would also argue that it should not be used in the href attribute of an anchor. If a browser supports javascript, it will use the properly defined event handler. If a browser does not, a javascript: link will ... |
As always, <http://www.csszengarden.com/>. Note that the images aren't public domain. |
Anything, but I would learn a modern system like git or subversion myself. My first VCS was RCS, but I got the basics down. |
Well, if you are just wanting to learn on your own, I would say you should go with something free, like subversion. If you are a company who has never used source control before, then it really depends on your needs. |
[Recursive Descent Parsing](http://en.wikipedia.org/wiki/Recursive_descent_parser) - I remember being very impressed how such simple code could do something so seemingly complex. |
TFS Linking Backlog items |
|tfs| |
In TFS whats the easiest way of linking a backlog item to a large number of other backlog items, without doing them one at a time? |
In TFS whats the easiest way of linking a backlog item to a large number of other backlog items, without doing them one at a time?
I do not have access to the underlying database so am unable to write a query to do it. |
This is just a natural for Google. This way they can control how well their apps work in a container on & off line. Expect more tools, potentially GUI designer type tools and an IDE for use with their cloud offerings as well as a mobile version of this for Android. It's most likely a lead in to Visual Google.
If ... |
I think the whole purpose or at least the emphasis of the release, as Kamiel said, is to provide better javascript performance. So many of Google's services rely on *heavy* javascript usage that this is a smart move by them. This should be good for everyone as IE and Firefox work to compete against Google every browser... |
If encryption/decryption is performed on the server, there is no way you can make sure that the cleartext is not dumped somewhere in some log file or the like.
You need to do the encryption/decryption inside the browser using JavaScript/Java/ActiveX or whatever. As a user, you need to trust the client-side of the we... |
If you're performing a lot of procedures (no return values), you can simplify your benchmarking code by stuffing it in a utility class like this...
public delegate void Proc();
public static class With
{
public static Int64 Benchmark(Proc action)
{
Stopwatch watch = Stopw... |
How to address semantic issues with tag-based web sites? |
|stackoverflow|tags|del.icio.us| |
Tag-based web sites often suffer from the delicacy of language such as synonyms, homonyms, etc. For programmers looking for information, say on SO, concrete examples are:
- Subversion or SVN (or svn, with case-sensitive tags)
- .NET or Mono
- [Will add more]
The problem is that we *do* want to preserver o... |
That is because technically .NET 3.5 is an extension of the 2.0 framework. The quickest way is to include an assembly from .NET 3.5 and see if it breaks.
System.Web.Extensions
Is a good assembly that is only included in version 3.5. Also it seems that you are using ASP.NET to run this check, this really l... |
I've accepted Fredriks answer as it appears to solve the problem with the least amount of effort however the Request object doesn't appear to conatin the ResolveUrl method.
This can be accessed through the Page object or an Image control object:
myImage.ImageUrl = Page.ResolveUrl(photoURL);
myImage.ImageUr... |
Perhaps try [ctypes ][1]instead of SWIG. If it has been included as a part of Python 2.5, then it must be good :-)
[1]: http://python.net/crew/theller/ctypes/ |
In my experience, there are two easy ways to call into C code from Python code. There are other approaches, all of which are more annoying and/or verbose.
The first and easiest is to compile a bunch of C code as a separate shared library and then call functions in that library using ctypes. Unfortunately, passing ... |
With our internal [TRAC][1] server, I'm subscribed to the timeline view for each project that I work on. It's great for keeping track of checkins and bug tickets. This is pretty exclusive to a developer position though.
I also am subscribed to the recent changes for our installation of [MediaWiki][2] that we use for... |
@Blair Conrad: You could also implement your glob/reduce using sum, like so:
files = sum([glob.glob(f) for f in args], [])
This is less verbose than either of your two examples, is perfectly Pythonic, and is still only one line of code.
So to answer the original question, I personally try to avoid using re... |
Visual Studio Setup Project - Per User Registry Settings |
|visual-studio|registry|installation| |
I'm trying to maintain a Setup Project in Visual Studio 2003 (yes, it's a legacy application). The problem we have at the moment is that we need to write registry entries to HKCU for every user on the computer. They need to be in the HKCU rather than HKLM because they are the default user settings, and do change per us... |
The magic all seems to be in
visitortime.getTimezoneOffset()
That's cool, I didn't know about that. Does it work in IE, etc?
From there you should be able to use JS to ajax, set cookies, whatever. I'd probably go the cookie route myself.
You'll need to allow the user to change it though. We tried to use ... |
I'm partway to my solution with this entry on MSDN (don't know how I couldn't find it before).
User/Machine Hive
Subkeys and values entered under this hive will be installed under the HKEY_CURRENT_USER hive when a user chooses "Just Me" or the HKEY_USERS hive or when a user chooses "Everyone" during installation.
... |
First: Yes, this is something that belongs in the Application for the exact reson you specified: What happens after new user profiles are created? Sure, if you're using a domain it's possible to have some stuff put in the registry on creation, but this is not really a use case. The Application should check if there are... |
I'd suggest you try Subversion, for example with the [1-click SVN installer][1]. Try searching SO for "Subversion", and you'll find loads of questions with answers that point to good tutorials.
Good luck!
[1]: http://svn1clicksetup.tigris.org/ |
My first exposure was CVS with WinCVS as a client. it was horrid. Next was Subversion, with TortoiseSVN and Eclipse's integration. It was intuitive, and heavenly. I think that using CVS with TortoiseCVS and Eclipse's would be nice as well, though I prefer the way SVN handles revisioning. The entire repository is ve... |
Never. Ever. If you have variable shadowing, your naming conventions are on crack. I mean, really, no distinguishing naming for member variables? *Facepalm* |
To expand on Konrad's comment:
> As a consequence, a purely functional program always yields the same value for an input, and the order of evaluation is not well-defined;
Because of this, functional code is generally easier to parallelize. Since there are (generally) no side effects of the functions, and they (g... |
There are a few core concepts that I think are important to learn:
1. Check-ins/check-outs (obviously)
2. Local versions vs. server versions
3. Merging your changes back into a file that contains changes from
others.
4. Branching (what it is, when/why to use it)
5. Merging changes from a branch back in... |
I think it would be good to store somewhere all possible primes smaller then n and just iterate through them to find the biggest divisior. You can get primes from [prime-numbers.org][1].
Of course I assume that your number isn't too big :)
[1]: http://www.prime-numbers.org/ |
Silverlight programmer's don't know what they're missing out on, when it comes to Flex. Silverlight lacks the component model and event triggering capabilites that Flex has. Using XNA, and C#, a friend of mine has to jump through all kinds of hoops to get his Silverlight application to work. Then, it has to be hande... |
MVP the View is in charge.
The View, in most cases, creates it's Presenter. The Presenter will interact with the model and manipulate the View through an interface. The View will sometimes interact with the Presenter, usually through some interface. This comes down to implementation, do you want the View to call m... |
You could also look at a migrations solution like Migrator.net. These allow you to specify your database schema in C# code, and roll your database version up and down using MSBuild. |
If by fastest you mean fastest to type in the code, here's the [golfscript](http://www.golfscript.com/golfscript/examples.html) solution:
;''6666,-2%{2+.2/@*\/10.3??2*+}*`1000<~\; |
After having this problem for weeks on Vista 64, I found a post by Dave Bouwman just today, and it fixed this problem.
<http://blog.davebouwman.net/2008/08/05/TroubleRunningMbUnitTestsWithTestDrivennetOnVista64.aspx> |
We don't store the database schema, we store the changes to the database. What we do is store the schema changes so that we build a change script for any version of the database and apply it to our customer's databases. I wrote an database utility app that gets distributed with our main application that can read that... |
You can try Emacs with ruby-mode, [Rinari](http://rinari.rubyforge.org/) (for Rails) and [yasnippet](http://code.google.com/p/yasnippet/) which provides automatic snippets like Textmate. |
You should take a look at [Git][1] instead of SVN. It's a <acronym title="Distributed Version Control System">DVCS</acronym> that's blazing-fast and very powerful. It's not as user-friendly as SVN, but it's improving in that regard, and it's not *that* hard to learn.
[1]: http://git-scm.com |
Unhandled Exception Handler in .NET 1.1 |
|.net|.net1.1|exception|c#| |
I'm maintaining a .NET 1.1 application, and one of the things I've been tasked with is making sure the user doesn't see any unfriendly error notifications.
I've added handlers to Application.ThreadException and AppDomain.CurrentDomain.UnhandledException, which do get called. My problem is that the standard CLR is st... |
Web App - Dashboard Type GUI - Interface |
|c#|asp.net|javascript|user-interface| |
I'm looking to create a dashboard type gui for a web application. I'm looking for the user to be able to drag and drop different elements (probably either image buttons, anchor tags, or maybe just divs) to different (defined) places and be able to save their setup (in a cookie or on the server). I'm working with c# i... |
@komradekatz, your solution below from MSDN for convenience for others looking into this. I do not like this solution because it uses the user agent to determine the version. This is not viable for what I need (I am writing a class library that needs to know whether .NET 3.5 is installed). I also question how reliable ... |
We use nginx and FastCGI for all of our Django deployments. This is mostly because we usually deploy over at Slicehost, and don't want to donate all of our memory to Apache. I guess this would be our "use case".
As for the remarks about the documentation being mostly in Russian -- I've found most of the informatio... |
The "Message" term can refer to sending a message to an object, which is supported in some programming languages and not others.
If the object supports the message, then it will execute some code. Otherwise it will just ignore it. This is a more dynamic approach than an explicit function/method call where the object... |
How do You Build a Date or Calendar Object From a String in Java? |
|java|dates| |
I have a string representation of a date that I need to create an object from. I've looked through Date and Calendar API but haven't found anything that can do this other than creating my own ugly parse method. I know there must be a way, does anyone know of a solution? |
Is it possible that the newest version has not yet been ported to Win32 yet? Since this particular gem does have bindings to compiled code, it would require a platform-specific gem. If I force installation of version 1.2.3 rather than the current 1.2.4, the platform-specific version does install, but when I allow gem t... |
Pros and Cons of different approaches to web programming in Python |
|python|html|cgi| |
I'd like to do some server-side scripting using Python. But I'm kind of lost with the number of ways to do that.
It starts with the do-it-yourself CGI approach and it seems to end with some pretty robust frameworks that would basically do all the job themselves. And a huge lot of stuff in between, like [web.py](http... |
|python|html|cgi|wsgi|frameworks| |
|python|html|frameworks|cgi|wsgi| |
I'd like to do some server-side scripting using Python. But I'm kind of lost with the number of ways to do that.
It starts with the do-it-yourself CGI approach and it seems to end with some pretty robust frameworks that would basically do all the job themselves. And a huge lot of stuff in between, like [web.py](http... |
The [IntelliJ][1] IDE (Java, Scala, Ruby,...) has a [Locate Duplicate...][2] tool. Usefull indeed !
[1]: http://www.jetbrains.com/idea/index.html
[2]: http://www.jetbrains.com/idea/features/code_duplicate.html |
I ran into this situation recently when I attempted (in InnoDB tables) to make a foreign key reference to a column that had a different data type.
[MySQL 5.1 Documentation][1]
[1]: http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html |
You could always try doing a `ulimit -n 2048`. This will only reset the limit for your current shell and the number you specify must not exceed the hard limit
Each operating system has a different hard limit setup in a configuration file. For instance, the hard open file limit on Solaris can be set on boot from /e... |
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(
function(){
$( '#switches li' ).mouseover(
function(){
$( "#slides div" ).hide();
$( '#switches li' ).css( 'font-we... |
Project->Properties->Configuration Properties->C/C++->Output Files
There you should see an option for Assembler Output.
John.
|
1. Open the Properties page for a project
2. Select the `Configuration Properties -> C/C++ -> Output Files` branch
3. Change the Assembler Output option to something other than `No Listing`
4. Make sure ASM List Location is set to a valid path or sub-path
5. Build. |
There's no such thing as a “good hash function” for universal hashes (ed. yes, I know there's such a thing as “universal hashing” but that's not what I meant). Depending on the context different criteria determine the quality of a hash. Two people already mentioned SHA. This is a cryptographic hash and it isn't at all ... |