instruction_seed stringlengths 1 35.8k | _source stringclasses 1
value |
|---|---|
Is it possible to test the use of a given layout using RSpec with Rails, for example I'd like a matcher that does the following:
response.should use_layout('my_layout_name')
I found a use_layout matcher when Googling but it doesn't work as neither the response or controller seem to have a layout property that matcher ... | stackexchange/codereview |
I need to run JET templates on a EMF model metadata - i.e. the model itself (not data) is input to my JET template.
More practically - I want generate non java code, based on EMF templates.
How I do it?
Thank you
| stackexchange/codereview |
Mending a bug in our SAP BW web application, I need to call two javascript functions from the web framework library upon page load. The problem is that each of these functions reloads the page as a side-effect. In addition, I don't have access to modify these functions.
Any great ideas on how to execute a piece of code... | stackexchange/codereview |
The following two C# code snippets produce different results (assuming the variable level is used both before and after the recursive call). Why?
public DoStuff(int level)
{
// ...
DoStuff(level++);
// ...
}
,
public DoStuff(int level)
{
// ...
DoStuff(level+1);
// ...
}
After reading some of the response... | stackexchange/codereview |
How can I use XPath to select an XML-node based on its content?
If I e.g. have the following xml and I want to select the <author>-node that contains Ritchie to get the author's full name:
<books>
<book isbn='0131103628'>
<title>The C Programming Language</title>
<authors>
<author>Ritch... | stackexchange/codereview |
This is a shameless information gathering exercise for my own book.
One of the talks I give in the community is an introduction to web site vulnerabilities. Usually during the talk I can see at least two members of the audience go very pale; and this is basic stuff, Cross Site Scripting, SQL Injection, Information Leak... | stackexchange/codereview |
I have a CometProcessor implementation that is effectively doing a Multicast to a potentially large number of clients. When an event occurs that needs propagated to to all the clients, the CometProcessor will need to loop through the list of clients writing out the response. If writing responses block then there is t... | stackexchange/codereview |
I am a big fan of the light colors on a dark background color scheme for programming - which is unfortunately not what Quest's Toad comes with by default.
I notice that it is possible to export and import settings under the language management window, and I know that Toad has a large level of community involvement. ... | stackexchange/codereview |
Within an XSLT document, is it possible to loop over a set of files in the current directory?
I have a situation where I have a directory full of xml files that need some analysis done to generate a report. I have my stylesheet operating on a single document fine, but I'd like to extend that without going to another t... | stackexchange/codereview |
Is there such a thing as an x86 assembler that I can call through C#? I want to be able to pass x86 instructions as a string and get a byte array back. If one doesn't exist, how can I make my own?
To be clear - I don't want to call assembly code from C# - I just want to be able to assemble code from instructions and ge... | stackexchange/codereview |
I have an ASP.Net GridView control that I need to remain a fixed size whether there are 0 records or n records in the grid. The header and the footer should remain in the same position regardless of the amount of data in the grid. Obviously, I need to implement paging for larger datasets but how would I achieve this ... | stackexchange/codereview |
I've heard many times that all programming is really a subset of math. Some suggest that OO, at its roots, is mathematically based, but I don't get the connection, aside from some obvious examples:
using induction to prove a recursive algorithm,
formal correctness proofs,
functional languages,
lambda calculus,
asympto... | stackexchange/codereview |
Is there any good reason to use C strings in C++ nowadays? My textbook uses them in examples at some points, and I really feel like it would be easier just to use a std::string.
| stackexchange/codereview |
Using .Net what limitations (if any) are there in using the XmlSerializer?
For example, can you serialize Images to XML?
| stackexchange/codereview |
I converted VS2006 vc++ project to VS2008. When compiling I get the above error. How do i fix it? am I missing this exe ?
| stackexchange/codereview |
When you use the WebBrowser control in .NET you can "embed" an instance of IE in your application, essentially making your own IE-based Web Browser.
Does anyone know how to make any new windows created (like when the user selects "Open in New Window" from the context menu) open up in another Window of Your Web Browser ... | stackexchange/codereview |
I need to find/create an application that will create employee web usage reports from HTTP proxy logs. Does anyone know of a good product that will do this?
@Joe Liversedge - Good point. I don't have to worry about this, however, as I am the only person in my company with the know-how to pull off an SSH tunnel.
| stackexchange/codereview |
I am trying to display a live word count in the vim statusline. I do this by setting my status line in my .vimrc and inserting a function into it. The idea of this function is to return the number of words in the current buffer. This number is then displayed on the status line. This should work nicely as the statusline... | stackexchange/codereview |
We have been using Scrum for around 9 months and it has largely been successful. However our burndown charts rarely look like the 'model' charts, instead resembling more of a terrifying rollercoaster ride with some vomit inducing climbs and drops.
To try and combat this we are spending more time before the sprint proto... | stackexchange/codereview |
I know how to do a HEAD request with httplib, but I have to use mechanize for this site.
Essentially, what I need to do is grab a value from the header (filename) without actually downloading the file.
Any suggestions how I could accomplish this?
| stackexchange/codereview |
With the new caching options in Rails 2.1 i get nice entires in my log along the lines of
Cached fragment hit: views/homepage (0.16549)
However they are logged at the :debug level, which is the same level as the SQL output. I want to be able to disable the SQL output, and still see the cache info. How can I do this
| stackexchange/codereview |
I am building an MFC application for both XP and Vista. I have Visual Studio 2008 installed on the XP machine but I need to debug the application on Vista. How can I do that? Do I really have to install Visual Studio on a Vista machine?
When using remote debugging I assume that all executable and library files must be ... | stackexchange/codereview |
I have a computer A with two directory trees. The first directory contains the original mod dates that span back several years. The second directory is a copy of the first with a few additional files. There is a second computer be which contains a directory tree which is the same as the second directory on computer ... | stackexchange/codereview |
When modelling an architecture in UML component diagrams, how do you show various attributes of connectors simultaneously? Like
business object information flow (A->B, B->A, A<->B)
request/response direction
synchronous/asynchronous behaviour
I am aware of other diagram types like sequence diagrams. However, having ... | stackexchange/codereview |
I'm writing an application to start and monitor other applications in C#. I'm using the System.Diagnostics.Process class to start applications and then monitor the applications using the Process.Responding property to poll the state of the application every 100 milisecs. I use Process.CloseMainWindow to stop the applic... | stackexchange/codereview |
Is it possible to pass a reference to a function to another function in F#? Specifically, I'd like to pass lambda functions like
foo(fun x -> x ** 3)
More specifically, I need to know how I would refer to the passed function in a function that I wrote myself.
| stackexchange/codereview |
Part of the install for an app I am responsible for, compiles some C code libraries. This is done in a console using GNU Make.
So, as part of the install, a console window pops open, you see the make file output wiz by as it compiles and links, when finished the console window closes and the installer continues.
All go... | stackexchange/codereview |
At work, we have a windows server 2003 with IIS and Subversion installed. We use it to publish and test locally
our ASP.NET websites. Every programmer has Tortoise installed on his PC and can update/commit content to the server. Hosting the repositories is working fine.
But the files kept in those repositories needs t... | stackexchange/codereview |
What is a good command line tool to create screenshots of websites on Linux? I need to automatically generate screenshots of websites without human interaction. The only tool that I found was khtml2png, but I wonder if there are others that aren't based on khtml (i.e. have good JavaScript support, ...).
| stackexchange/codereview |
CSS Attribute selectors allow the selection of elements based on attribute values. Unfortunately, I've not used them in years (mainly because they're not supported by all modern browsers). However, I remember distinctly that I was able to use them to adorn all external links with an icon, by using a code similar to the... | stackexchange/codereview |
I know this is not directly a programming question, but people on stackoverflow seems to be able to answer any question.
I have a server running Centos 5.2 64 bit. Pretty powerful dual core 2 server with 4GB memory. It mostly serves static files, flash and pictures. When I use lighttpd it easily serves over 80 MB/se... | stackexchange/codereview |
How do I view the grants (access rights) for a given user in MySQL?
| stackexchange/codereview |
I have a REST Java server implemented with Jersey running on Jetty. It seems that certain browsers (IE7) internally caches all requests made to the server.
What I would like to do is to send a certain HTTP header in the response from the REST server indicating the browser that it shouldn't cache that response, and so ... | stackexchange/codereview |
I've been using NUnit for a few years. I've tried MBUnit for a short while as well as Zenebug and XUnit but I keep coming back to NUnit.
What is your favorite/most used Unit test Framework? Can you explain why you're using it?
| stackexchange/codereview |
My project is currently using a svn repository which gains several hundred new revisions per day.
The repository resides on a Win2k3-server and is served through Apache/mod_dav_svn.
I now fear that over time the performance will degrade due to too many revisions.
Is this fear reasonable?
We are already planning to up... | stackexchange/codereview |
Can a firefox XPCOM component read and write page content across multiple pages?
Scenario:
A bunch of local HTML and javascript files. A "Main.html" file opens a window "pluginWindow", and creates a plugin using:
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var obj = Components.classes[ci... | stackexchange/codereview |
Is there an easier way to step through the code than to start the service through the Windows Service Control Manager and then attaching the debugger to the thread? It's kind of cumbersome and I'm wondering if there is a more straightforward approach.
| stackexchange/codereview |
Context: The environment is .Net 3.0 + WPF land, the DB is abstracted well out into the distance and the solution would need to work for Office 2000 and up I guess..
The need is to get a customized report for which the user would like to have certain application windows/boxes (e.g. a trend graph) displayed in Word. Th... | stackexchange/codereview |
Most text editors have a navigation pane that lets you see all the files you currently have open. Or a pane that lets you browse a file directory.
How do I do this in Emacs?
| stackexchange/codereview |
These days, i came across a problem with Team System Unit Testing. I found that the automatically created accessor class ignores generic constraints - at least in the following case:
Assume you have the following class:
namespace MyLibrary
{
public class MyClass
{
public Nullable<T> MyMethod<T>(string s) where T : ... | stackexchange/codereview |
How to tell using T-SQL whether a SQL server database has the TRUSTWORTHY property set to on or off
| stackexchange/codereview |
We have had SharePoint where I work for a little while now, but we've not done a lot with it. We have an intranet with hundreds of ASP/ASP.Net applications and I'm wondering what kind of things can be done to integrate with SharePoint to make a more seamless environment? We put documentation and production move request... | stackexchange/codereview |
I want to write a function that takes an array of letters as an argument and a number of those letters to select.
Say you provide an array of 8 letters and want to select 3 letters from that. Then you should get:
8! / ((8 - 3)! * 3!) = 56
Arrays (or words) in return consisting of 3 letters each.
| stackexchange/codereview |
I'm using VS2008 to debug an application that starts a new process. I believe that the spawned process is suffering (and handling) some kind of CLR exception during its start-up, but it is not being caught by turning on CLR Exception Notification in Debug -> Exceptions. Any suggestions on how I can see where the except... | stackexchange/codereview |
I am trying to deploy our eRCP (embedded Rich Client Platform) application on a Windows CE5 Professional device. While the eRCP demo applications work fine on the J9 VM upon starting our application I get the following exception:
!ENTRY org.eclipse.osgi 4 0 2008-09-24 11:01:15.088
!MESSAGE An error occurred while autom... | stackexchange/codereview |
I'm a newbie in C# bu I'm experienced Delphi developer.
In Delphi I can use same code for MenuItem and ToolButton using TAction.OnExecute event and I can disable/enable MenuItem and ToolButton together using TAction.OnUpdate event.
Is there a similar way to do this in C# without using external libraries? Or more - How ... | stackexchange/codereview |
I have been looking at XML and HTML libraries on rubyforge for a simple way to pull data out of a web page. For example if I want to parse a user page on stackoverflow how can I get the data into a usable format?
Say I want to parse my own user page for my current reputation score and badge listing. I tried to conver... | stackexchange/codereview |
From what I understand, the crystals on PCs are notorious for clock skew. If clocks are always skewing, what is the best way to synchronize clocks between machines, with millisecond accuracy and precision? From what I've found, NTP and PTP are possible solutions, but I was wondering if anyone else has had any experienc... | stackexchange/codereview |
My company is in education industry and we use XML to store course content. We also store some course related information (mostly metainfo) in relational database. Right now we are in the process of switching from our proprietary XML Schema to DocBook 5. Along with the switch we want to move course related information ... | stackexchange/codereview |
Suppose I have a stored procedure that manages its own transaction
CREATE PROCEDURE theProc
AS
BEGIN
BEGIN TRANSACTION
-- do some stuff
IF @ThereIsAProblem
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
END
If I call this proc from an existing transaction, the proc can ROLLBACK the external transaction.... | stackexchange/codereview |
I need to find out what ports are attached to which processes on a Unix machine (HP Itanium). Unfortunately, lsof is not installed and I have no way of installing it.
Does anyone know an alternative method? A fairly lengthy Googling session hasn't turned up anything.
| stackexchange/codereview |
Specifically I have a PHP command-line script that at a certain point requires input from the user. I would like to be able to execute an external editor (such as vi), and wait for the editor to finish execution before resuming the script.
My basic idea was to use a temporary file to do the editing in, and to retrieve ... | stackexchange/codereview |
I am doing a Web Deployment of my website and I have the merge assemblies property set to true.
For some reason I get the following error.
aspnet_merge : error occurred:
An error occurred when merging assemblies: The relative virtual path 'Global.asax' is not allowed here.
It seems to have something to do with the ... | stackexchange/codereview |
I am trying to write a regular expression to strip all HTML with the exception of links (the <a href and </a> tags respectively. It does not have to be 100% secure (I am not worried about injection attacks or anything as I am parsing content that has already been approved and published into a SWF movie).
The original "... | stackexchange/codereview |
I want to maintain a list of global messages that will be displayed to all users of a web app. I want each user to be able to mark these messages as read individually. I've created 2 tables; messages (id, body) and messages_read (user_id, message_id).
Can you provide an sql statement that selects the unread messages fo... | stackexchange/codereview |
Here is the situation: I have 2 pages.
What I want is to have a number of text links(<a href="">) on page 1 all directing to page 2, but I want each link to send a different value.
On page 2 I want to show that value like this:
Hello you clicked {value}
Another point to take into account is that I can't use any php ... | stackexchange/codereview |
I'm starting to learn Python and I've come across generator functions, those that have a yield statement in them. I want to know what types of problems that these functions are really good at solving.
| stackexchange/codereview |
I'm curious about keeping source code around reliably and securely for several years. From my research/experience:
Optical media, such as burned DVD-R's lose bits of data over time. After a couple years, I don't get all the files off that I put on them. Read errors, etc.
Hard drives are mechanical and subject to failu... | stackexchange/codereview |
I have a dropdownlist with the autopostback set to true. I want the
user to confirm if they really want to change the value,
which on post back fires a server side event (selectedindexchanged).
I have tried adding an onchange attribute "return confirm('Please click OK to change. Otherwise click CANCEL?';") but it will ... | stackexchange/codereview |
ASP.NET 2.0 web application, how to implement shortcut key combination of CTRL + Letter, preferably through JavaScript, to make web application ergonomically better? How to capture multiple-key keyboard events through JavaScript?
| stackexchange/codereview |
Is there a way to make psycopg and postgres deal with errors without having to reestablish the connection, like MySQLdb? The commented version of the below works with MySQLdb, the comments make it work with Psycopg2:
results = {'felicitas': 3, 'volumes': 8, 'acillevs': 1, 'mosaics': 13, 'perat\xe9': 1, 'representative... | stackexchange/codereview |
I am looking for details of the VTable structure, order and contents, and the location of the vtable pointers within objects.
Ideally, this will cover single inheritance, multiple inheritance, and virtual inheritance.
References to external documentation would also be appreciated
Documentation of GCC 4.0x class layout ... | stackexchange/codereview |
In the WCF application that I am working on, I need to access the generated source of a particular webpage (after all the AJAX calls on the page are made).
I have tried using System.Net.WebRequest but it just brings me back the original source of the page. Is there a way to execute a page and then get the source?
Else,... | stackexchange/codereview |
I need to allow other Python applications to register callback functions for events in my application. These need to have priorities associated with them (so a callback with a priority of 10 runs before a callback with a priority of 1) and callback functions need to be able to signal errors to the dispatcher.
These ar... | stackexchange/codereview |
Why does the following method hang?
public void pipe(Reader in, Writer out) {
CharBuffer buf = CharBuffer.allocate(DEFAULT_BUFFER_SIZE);
while( in.read(buf) >= 0 ) {
out.append(buf.flip());
}
}
| stackexchange/codereview |
I can't find a reference to it but I remember reading that it wasn't a good idea to call virtual (polymorphic) methods within a destructor or the Dispose() method of IDisposable.
Is this true and if so can someone explain why?
| stackexchange/codereview |
I've seen a lot of commonality in regex capabilities of different regex-enabled tools/languages (e.g. perl, sed, java, vim, etc), but I've also many differences.
Is there a standard subset of regex capabilities that all regex-enabled tools/languages will support? How do regex capabilities vary between tools/languages?
| stackexchange/codereview |
I'm using the following in the web page but can't get a response from the server while it's processing
<script type="text/javascript">
<!--
function updateProgress() {
//alert('Hello');
new Ajax.Request('/fmfiles/progress_monitor', {
parameters: 'authenticity_token=' + encodeURIComponent(AUTH_TO... | stackexchange/codereview |
I have a stored procedure in SQL 2005. The Stored Procedure is actually creating temporary tables in the beginning of SP and deleting it in the end. I am now debugging the SP in VS 2005. In between the SP i would want to know the contents into the temporary table. Can anybody help in in viewing the contents of the temp... | stackexchange/codereview |
My friends and I are starting a game like Pokemon and we wanted to know how will we add monsters to the game? We're using VisualBasic because my friend's brother said it would be easier.
So far we can put pictures of the monsters on the screen and you can click to attack and stuff.
Right now when we want to add a mons... | stackexchange/codereview |
Which is the best mocking library for C# 3.0/ ASP.NET MVC? Why?
| stackexchange/codereview |
Expanding this question on how I learnt to pass from problem description to code Two people mentioned TDD.
Would it be good for a starter to get into TDD ( and avoid bad habits in the future ? ) Or would it be too complex for a stage when understand what a programming language is?
| stackexchange/codereview |
How do you render primitives as wireframes in OpenGL?
| stackexchange/codereview |
I was wondering if there was a way to use "find_by_sql" within a named_scope. I'd like to treat custom sql as named_scope so I can chain it to my existing named_scopes. It would also be good for optimizing a sql snippet I use frequently.
| stackexchange/codereview |
When java was young, people were excited about writing applets. They were cool and popular, for a little while. Now, I never see them anymore. Instead we have flash, javascript, and a plethora of other web app-building technologies.
Why don't sites use java applets anymore?
I'm also curious: historically, why do you... | stackexchange/codereview |
We have a 3D viewer that uses OpenGL, but our clients sometimes complain about it "not working". We suspect that most of these issues stem from them trying to use, what is in effect a modern 3d real-time game, on a business laptop computer.
How can we, in the Windows MSI installer we use, check for support for OpenGL?
... | stackexchange/codereview |
In JavaScript, the "this" operator can refer to different things under different scenarios.
Typically in a method within a JavaScript "object", it refers to the current object.
But when used as a callback, it becomes a reference to the calling object.
I have found that this causes problems in code, because if you use ... | stackexchange/codereview |
Is there some way to do multi-threading in JavaScript?
| stackexchange/codereview |
I got embroiled in a discussion about DOM implementation quirks yesterday, with gave rise to an interesting question regarding Text.splitText and Element.normalise behaviours, and how they should behave.
In DOM Level 1 Core, Text.splitText is defined as...
Breaks this Text node into two Text nodes at the specified off... | stackexchange/codereview |
I've run into a problem where I make changes to a few JavaScript files that are referenced in an HTML file, but the browser doesn't see the changes. It holds onto the copy cached in the browser, even though the web server has a newer version.
Not until I force the browser to clear the cache do I see the changes.
Is thi... | stackexchange/codereview |
I have a CakePHP application that in some moment will show a view with product media (pictures or videos) I want to know if, there is someway to include another view that threats the video or threats the pictures, depending on a flag. I want to use those "small views" to several other purposes, so It should be "like" a... | stackexchange/codereview |
I have a WPF app with many list based controls in a window, which all are bound to different CollectionViews.
At the window level is there a way to get the current selected item for the currently in focus list based control? I know I can do this with some fairly trivial code by looking for the in focus element but doe... | stackexchange/codereview |
How do I do a diff of two strings or arrays in Ruby?
| stackexchange/codereview |
We require all requests for downloads to have a valid login (non-http) and we generate transaction tickets for each download. If you were to go to one of the download links and attempt to "replay" the transaction, we use HTTP codes to forward you to get a new transaction ticket. This works fine for a majority of users.... | stackexchange/codereview |
Is there a way to know and output the stack size needed by a function at compile time in C ?
Here is what I would like to know :
Let's take some function :
void foo(int a) {
char c[5];
char * s;
//do something
return;
}
When compiling this function, I would like to know how much stack space it will con... | stackexchange/codereview |
I've heard people referring to this table and was not sure what it was about.
| stackexchange/codereview |
How do you apply stroke (outline around text) to a textblock in xaml in WPF?
| stackexchange/codereview |
I've got a stored procedure in my database, that looks like this
ALTER PROCEDURE [dbo].[GetCountingAnalysisResults]
@RespondentFilters varchar
AS
BEGIN
@RespondentFilters = '''8ec94bed-fed6-4627-8d45-21619331d82a, 114c61f2-8935-4755-b4e9-4a598a51cc7f'''
DECLARE @SQL nvarchar(600)
SET @SQL =
'SELECT *
FR... | stackexchange/codereview |
I'd sort of like to use SQLite from within C#.Net, but I can't seem to find an appropriate library. Is there one? An official one? Are there other ways to use SQLite than with a wrapper?
| stackexchange/codereview |
I have an XML file that's the output from a database. I'm using the Java SAX parser to parse the XML and output it in a different format. The XML contains some invalid characters and the parser is throwing errors like 'Invalid Unicode character (0x5)'
Is there a good way to strip all these characters out besides pre-... | stackexchange/codereview |
I'm wanting to execute a program and as it runs read in it's output and pipe out the output into a zipped file. The output of the program can be quite large so the idea is to not hold too much in memory - just to send it to the zip as I get it.
| stackexchange/codereview |
I'd like to get a feel for what people are using for IoC containers. I've read some good things about Castle Windsor, but I know a lot of people use StructureMap, Unity, Ninject, etc.
What are some of the differences amongst those mentioned (and any I neglected). Strengths? Weaknesses? Better fit (like StructureMap is... | stackexchange/codereview |
I am developing a web app that will be hit frequently by mobile browsers. I am wondering if there is a way to get enough information from the browser request to lookup position data (triangulation or GPS) Not from the request directly, of course. A colleague suggested there some carriers supply a unique identifier in t... | stackexchange/codereview |
Any free alternative to Robohelp? Prefer open source
Need some sort of online help authoring tool for an open source project.
| stackexchange/codereview |
We have an application where users enter prices all day. These prices are recorded in a table with a timestamp and then used for producing charts of how the price has moved. Every now and then, the user enters a price wrongly (e.g. puts in a zero too many or too few) which somewhat ruins the chart (you get big spikes).... | stackexchange/codereview |
I'm writing a small tool in C# which will need to send and receive data to/from a website using POST and json formatting. I've never done anything like this before in C# (or any language really) so I'm struggling to find some useful information to get me started.
I've found some information on the WebRequest class in ... | stackexchange/codereview |
Is there something like InstallShield that I can use for free?
| stackexchange/codereview |
I just got Delphi 2009 and have previously read some articles about modifications that might be necessary because of the switch to Unicode strings.
Mostly, it is mentioned that sizeof(char) is not guaranteed to be 1 anymore.
But why would this be interesting regarding string manipulation?
For example, if I use an AnsiS... | stackexchange/codereview |
I have a problem where a Web Application needs to (after interaction from the user via Javascript)
1) open a Windows Forms Application
2) send a parameter to the app (e.g. an ID)
Correspondingly, the Windows Forms Application should be able to
1) send parameters back to the Web Application (updating the URL is... | stackexchange/codereview |
Do you know any easy or simple way to make a map object (from the STL library) persistent (i.e. write it to a file) so that you can recover its state later when the program in run later ??
Thanks for your help
| stackexchange/codereview |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.