instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
I'm looking for a way to do a substring replace on a string in LaTeX. What I'd like to do is build a command that I can call like this: \replace{File,New} and that would generate something like \textbf{File}$\rightarrow$\textbf{New} This is a simple example, but I'd like to be able to put formatting/structure in a s...
stackexchange/codereview
I have a site map of a few thoasand pages where the only different content on them is the title attribute and the content plotted out in a google map? Will google punish me for this as spam?
stackexchange/codereview
I've already got a NAnt build script that builds/runs tests/zips web project together, etc. but I'm working on a basic desktop application. How would I go about building the setup project using NAnt so I can include it with the build report on TeamCity. Edit: The setup is the basic Setup Project supplied with Visual S...
stackexchange/codereview
I have a Windows Workflow application that uses classes I've written for COM automation. I'm opening Word and Excel from my classes using COM. I'm currently implementing IDisposable in my COM helper and using Marshal.ReleaseComObject(). However, if my Workflow fails, the Dispose() method isn't being called and the Word...
stackexchange/codereview
Do C#/.NET floating point operations differ in precision between debug mode and release mode?
stackexchange/codereview
I'm using freemarker, SiteMesh and Spring framework. For the pages I use ${requestContext.getMessage()} to get the message from message.properties. But for the decorators this doesn't work. How should I do to get the internationalization working for sitemesh?
stackexchange/codereview
In short: I'm trying to figure out if I should tell a mail administrator of a friend's employer whether their mail configuration should be fixed, or if I should revise my own policy to be more liberal in what I accept, or neither. A friend was complaining of being unable to reach anything on my mailserver. I dug into ...
stackexchange/codereview
On a website if I have a form where the user can input some text and then a page which displays what the user has entered. I know to html encode the values the user has entered to prevent scripting attacks. If the form was sending emails addresses I presume I would do the same but is there any special cases for emails ...
stackexchange/codereview
The point of const-correctness is to be able to provide a view of an instance that can't be altered or deleted by the user. The compiler supports this by pointing out when you break constness from within a const function, or try to use a non-const function of a const object. So without copying the const approach, is th...
stackexchange/codereview
XAML allows you to specify an attribute value using a string that contains curly braces. Here is an example that creates a Binding instance and assigns it to the Text property of the TextBox element. <TextBox Text="{Binding ElementName=Foo, Path=Bar}"/> I want to extend XAML so that the developer could enter this as v...
stackexchange/codereview
The name of a temporary table such as #t1 can be determined using select @TableName = [Name] from tempdb.sys.tables where [Object_ID] = object_id('tempDB.dbo.#t1') How can I find the name of a table valued variable, i.e. one declared by declare @t2 as table (a int) the purpose is to be able to get meta-information ...
stackexchange/codereview
I'm looking for the total commit charge.
stackexchange/codereview
Which is generally considered "best practice" when wanting to securely transmit flat files over the wire? Asymmetric encryption seems to be a pain in that you have to manage keysets at endpoints and make sure that the same algorithm is used by all clients, where as SFTP seems to be a pain because of NAT issues with en...
stackexchange/codereview
I have a web application that is dynamically loading PDF files for viewing in the browser. Currently, it uses "innerHTML" to replace a div with the PDF Object. This works. But, is there a better way to get the ID of the element and set the "src" or "data" parameter for the Object / Embed and have it instantly load up...
stackexchange/codereview
I'm considering moving a number of small client sites to an unmanaged VPS hosting provider. I haven't decided which one yet, but my understanding is that they'll give me a base OS install (I'd prefer Debian or Ubuntu), an IP address, a root account, SSH, and that's about it. Ideally, I would like to create a complete V...
stackexchange/codereview
I'm not really asking about how programmers learn how to program. More about specific technologies. If I wanted to learn Hibernate, how do I know what I should know prior to Hibernate? Should I learn JPA before, during or after Hibernate? Is there a better solution to Hibernate? (And I'm not really looking for inf...
stackexchange/codereview
I have a simple table comments (id INT, revision INT, comment VARCHAR(140)) with some content like this: 1|1|hallo1| 1|2|hallo2| 1|3|hallo3| 2|1|hallo1| 2|2|hallo2| I'm searching for an SQL statement which will return each comment with the highest revision: 1|3|hallo3| 2|2|hallo2| I've come up with this solution: se...
stackexchange/codereview
I'm researching SVN repository browsers, and it's a tiresome task given how many are out there (I started here) The "ideal" system would Run on Linux Be easy to use, even for non-developer types Look nice (have a decent skin) Either have built-in access control, or be written in PHP so that I could hack it myself to h...
stackexchange/codereview
I'd like to view historical data for guest cpu/memory/IO usage, rather than just current usage.
stackexchange/codereview
Is there a way via System.Reflection, System.Diagnostics or other to get a reference to the actual instance that is calling a static method without passing it in to the method itself? For example, something along these lines class A { public void DoSomething() { StaticClass.ExecuteMethod(); } } cla...
stackexchange/codereview
How do I see if a certain object has been loaded, and if not, how can it be loaded, like the following? if (!isObjectLoaded(someVar)) { someVar= loadObject(); }
stackexchange/codereview
I'm writing a report view of an audit trail, and I need to display this in a .jsp. What's the "best" way to get the data from the database to the screen? We're using Spring for dependency injection, Data Access Objects, and Hibernate. I can use hibernate or straight jdbc for this report. If I load all the records into ...
stackexchange/codereview
I have a History Table in SQL Server that basically tracks an item through a process. The item has some fixed fields that don't change throughout the process, but has a few other fields including status and Id which increment as the steps of the process increase. Basically I want to retrieve the last step for each item...
stackexchange/codereview
I want to start developing for Windows Mobile Devices, as I plan to buy one next week. (pay day) So far most of my PDA experience is with Palm OS (m100, m105, Zire 71 and T3). For Palm there are a few good utilities for programming, mainly PocketC and OnboardC. These let you program and test on the road. I would use Po...
stackexchange/codereview
We have seen what appears to be GDI Object leakage when the Infralution VirtualTree control assigns Icons in the GetRowData event. The VirtualTree is contained in a control that is contained within a TabControl. Tabbing away and back to the tree results in the "GDI Objects" counter in Task Manager to continually incr...
stackexchange/codereview
I'm using the cacheCounter in CakePHP, which increments a counter for related fields. Example, I have a Person table a Source table. Person.source_id maps to a row in the Source table. Each person has one Source, and each Source has none or many Person rows. cacheCounter is working great when I change the value of a so...
stackexchange/codereview
When someone talks about a variables storage class specifier, what are they talking about? They also often talk about variable linkage in the same context, what is that?
stackexchange/codereview
I have two DateTime objects: StartDate and EndDate. I want to make sure StartDate is before EndDate. How is this done in C#?
stackexchange/codereview
How do I get a list of the active IP-addresses, MAC-addresses and NetBIOS names on the LAN? I'd like to get NetBIOS name, IP and MAC addresses for every host on the LAN, preferably not having to walk to every single PC and take note of the stuff myself. How to do that with Windows Script Host/PowerShell/whatever?
stackexchange/codereview
I'm currently using ImageMagick to determine the size of images uploaded to the website. By calling ImageMagick's "identify" on the command line it takes about 0.42 seconds to determine a 1MB JPEG's dimensions along with the fact that it's a JPEG. I find that a bit slow. Using the Imagick PHP library is even slower as ...
stackexchange/codereview
i need to fire an event (or start a workflow) when the permissions of a List-Element (ListItem) have been changed. "ItemUpdating" / "ItemUpdated" won't fire (since the ListItem itself is not updated, i suppose), so how can it be done?
stackexchange/codereview
I'd like to run a long rsync command in Cygwin by double clicking on a .sh file in Windows. It must start in the file's containing directory (e.g. /cygdrive/c/scripts/) so that relative paths work. Anyone gotten this to work? Note: I've just found here, a Cygwin package that manages Windows context menus (Bash Prompt...
stackexchange/codereview
First let me say that I really feel directionless on this question. I am using windows integrated security, and I can use vb.net to look up information about a user from AD. I also have other information about users I can look up from a MS SQL 2005 server by getting the logon identity name. What I would like to do is d...
stackexchange/codereview
Given this class class Foo { // Want to find _bar with reflection [SomeAttribute] private string _bar; public string BigBar { get { return this._bar; } } } I want to find the private item _bar that I will mark with a attribute. Is that possible? I have done this with properties wher...
stackexchange/codereview
I want to perform cascade delete for some tables in my database, but I'm interested in what happens in case there's a failure when deleting something. Will everything rollback?
stackexchange/codereview
At work we use WiX for building installation packages. We want that installation of product X would result in uninstall of the previous version of that product on that machine. I've read on several places on the Internet about a major upgrade but couldn't get it to work. Can anyone please specify the exact steps that I...
stackexchange/codereview
Is there any good alternative to ASpell? It's nice open source, but haven't been updated for a while. The performance is not too good and I am having trouble creating a custom worklist with non-alpha characters.
stackexchange/codereview
My Vista application needs to know whether the user has launched it "as administrator" (elevated) or as a standard user (non-elevated). How can I detect that at run time?
stackexchange/codereview
I'm programming an application in MFC (don't ask) and I have a CEdit box that holds a number. When that number is edited, I would like to act on the change, and then replace the caret where it was before I acted on the change - if the user was just before the "." in "35.40", I would like it to still be placed before t...
stackexchange/codereview
I am using the PHP 5 Tidy class to format html. Everything is fine except when it gets passed a style attribute, when it changes it into a class attribute. As I am only formatting the body of a document, not the head, there is no class defined in the head for the attribute to read. I have looked through all the Tidy o...
stackexchange/codereview
We are currently testing a Java Swing application for it's performance. I wonder if there is a good tool to automate this?
stackexchange/codereview
My understanding is that wxWidgets is for a number of programming languages (C++, Python, Perl, and C#/.NET) but that does not include C. Is there a similar framework for the C programming language, or is this not something that C is used for?
stackexchange/codereview
The default Python install on OS X 10.5 is 2.5.1 with a FAT 32 bit (Intel and PPC) client. I want to setup apache and mysql to run django. In the past, I have run Apache and MySQL to match this install in 32 bit mode (even stripping out the 64 bit stuff from Apache to make it work). I want to upgrade Python to 64 bit. ...
stackexchange/codereview
I am writing a Composite control, which contains a listview to display a table of items. Normally when using a ListView in Asp.NET I would define the templates in the code-forward. <asp:ListView runat="server" ID="ArticleList"> <LayoutTemplate> <div class="ContentContainer"> <div runat="server" ...
stackexchange/codereview
In what domains do each of these software architectures shine or fail? Which key requirements would prompt you to choose one over the other? Please assume that you have developers available who can do good object oriented code as well as good database development. Also, please avoid holy wars :) all three technologies ...
stackexchange/codereview
I have a SQL Insert query inside a stored proc, for inserting rows into a linked server table. Since the stored proc is getting called within a parent transaction, this Insert statement tries to use a DTC for inserting rows into the linked server. I would like to avoid DTC from getting involved. Is there any way I can ...
stackexchange/codereview
In the vxWorks RTOS, there is a shell that allows you to issue command to your embedded system. The documentation refers to kernel shell, host shell and target shell. What is the difference between the three?
stackexchange/codereview
This is my first real question of need for any of those Gridview experts out there in the .NET world. I an creating a Gridview from codebehind and I am holding a bunch of numerical data in the columns. Although, I do add the comma in the number fields from codebehind. When I load it to the Gridview, I have the sortin...
stackexchange/codereview
This question may be too product specifc but I'd like to know if anyone is exporting bug track data from HP Quality Center. HP Quality Center (QC) has an old school COM API but I'd rather use a web service or maybe even screen scraper to export the data into an excel spreadsheet. In any case, what's the best way to exp...
stackexchange/codereview
I need to match and remove all tags using a regular expression in Perl. I have the following: <\\??(?!p).+?> But this still matches with the closing </p> tag. Any hint on how to match with the closing tag as well? Note, this is being performed on xhtml.
stackexchange/codereview
I run a game and the running is done by hand, I have a few scripts that help me but essentially it's me doing the work. I am at the moment working on web app that will allow the users to input directly some of their game actions and thus save me a lot of work. The problem is that I'm one man working on a moderately siz...
stackexchange/codereview
First of all, I want to avoid a flame-war on languages. The languages to choose from are Perl, Python and Ruby . I want to mention that I'm comfortable with all of them, but the problem is that I can't focus just on one. If, for example, I see a cool Perl module, I have to try it out. If I see a nice Python app, I hav...
stackexchange/codereview
How can I create a regular expression that will grab delimited text from a string? For example, given a string like text ###token1### text text ###token2### text text I want a regex that will pull out ###token1###. Yes, I do want the delimiter as well. By adding another group, I can get both: (###(.+?)###)
stackexchange/codereview
When developing WPF UserControls, what is the best way to expose a DependencyProperty of a child control as a DependencyProperty of the UserControl? The following example shows how I would currently expose the Text property of a TextBox inside a UserControl. Surely there is a better / simpler way to accomplish this? ...
stackexchange/codereview
I have to restore a database that has been inadvertently DROPped in MySQL 5.0. From checking the backup files, I only seem to have .FRM files to hold the database data. Can anyone advise whether this is all I need to perform a database restore/import from the backup, or are there other files I should have to hand to c...
stackexchange/codereview
What are the alternative's to using the iThenticate service for content comparison?
stackexchange/codereview
I'm tearing my hair out with this one. If I start a block comment /* in VS.NET 2005+ then carriage return, Visual Studio insists that I have another asterisk *. I know there's an option to turn this off but I just can't find it. Anyone know how to turn this feature off?
stackexchange/codereview
Will I have to pay again? I have about 9 months left before renewal but my current provider doesn't offer many options / control panels. Update: thanks for everyone's help - I've finally completed this now. I had to: Ask my old registrar to "Unlock" the domain Ask my old registrar to set the admin email address of the...
stackexchange/codereview
Does a caching-nameserver usually cache the negative DNS response SERVFAIL? EDIT: To clarify the question, I can see the caching nameserver caching negative responses NXDOMAIN, NODATA. But it does not do this for SERVFAIL responses. Is this intentional?
stackexchange/codereview
What's the most efficient way to convert the output of this function from a varbinary() to a a varchar()?
stackexchange/codereview
The __doPostBack is not working in firefox 3 (have not checked 2). Everything is working great in IE 6&7 and it even works in Chrome?? It's a simple asp:LinkButton with an OnClick event <asp:LinkButton ID="DeleteAllPicturesLinkButton" Enabled="False" OnClientClick="javascript:return confirm('Are you sure you want to d...
stackexchange/codereview
I use Emacs primarily for coding Python but sometimes I use IDLE. Is there a way to change the key bindings easily in IDLE to match Emacs?
stackexchange/codereview
I want to keep logs of some things that people do in my app, in some cases so that it can be undone if needed. Is it best to store such logs in a file or a database? I'm completely at a loss as to what the pros and cons are except that it's another table to setup. Is there a third (or fourth etc) option that I'm not aw...
stackexchange/codereview
I'm using Google App Engine and Django templates. I have a table that I want to display the objects look something like: Object Result: Items = [item1,item2] Users = [{name='username',item1=3,item2=4},..] The Django template is: <table> <tr align="center"> <th>user</th> {% for item in result.items %} ...
stackexchange/codereview
I need an associative container that makes me index a certain object through a string, but that also keeps the order of insertion, so I can look for a specific object by its name or just iterate on it and retrieve objects in the same order I inserted them. I think this hybrid of linked list and hash map should do the j...
stackexchange/codereview
At my job we make & sell websites. Usually we install our .NET C# based site on a customer's server and maintain and support it remotely. However, every once in a while, for bigger development works and just to make things simpler (and faster!), we will copy the site to a local server. This is great, but has one pain -...
stackexchange/codereview
What I am trying to do is change the background colour of a table cell <td> and then when a user goes to print the page, the changes are now showing. I am currently using an unobtrusive script to run the following command on a range of cells: element.style.backgroundColor = "#f00" This works on screen in IE and FF, ho...
stackexchange/codereview
I'm writing a simple photo album app using ASP.NET Ajax. The app uses async Ajax calls to pre-load the next photo in the album, without changing the URL in the browser. The problem is that when the user clicks the back button in the browser, the app doesn't go back to the previous photo, instead, it navigates to the ho...
stackexchange/codereview
In every MVC framework I've tried (Rails, Merb, Waves, Spring, and Struts), the idea of a Request (and Response) is tied to the HTTP notion of a Request. That is, even if there is an AbstractRequest that is a superclass of Request, the AbstractRequest has things like headers, request method (GET, POST, etc.), and all ...
stackexchange/codereview
For example I have such query: Query q = sess.createQuery("from Cat cat"); List cats = q.list(); If I try to make something like this it shows the following warning Type safety: The expression of type List needs unchecked conversion to conform to List<Cat> List<Cat> cats = q.list(); Is there a way to avoid it?
stackexchange/codereview
Anyone know how to turn off code folding in visual studio 2008? Some of my colleagues love it, but I personally always want to see all the code, and never want code folded out of sight. I'd like a setting that means my copy of Visual Studio never folds #regionsor function bodies.
stackexchange/codereview
Does javascript use immutable or mutable strings? Do I need a "string builder"?
stackexchange/codereview
I want to write a little "DBQuery" function in perl so I can have one-liners which send an SQL statement and receive back and an array of hashes, i.e. a recordset. However, I'm running into an issue with Perl syntax (and probably some odd pointer/reference issue) which is preventing me from packing out the information ...
stackexchange/codereview
I would like to get up-to-date information on Google's index of a website, and it seems that results vary depending on which datacentre happens to process your search query.
stackexchange/codereview
I'm currently using the Infragistics component set for .Net 2.0, Visual Studio 2005 and C#. I have the following chunk of javascript code (text and other variables are declared elsewhere): ***alert(box[select].value); text.value(box[select].value); alert(text.value);*** 'text' is an Infragistics webTextEdit, while bo...
stackexchange/codereview
I am wondering any efficient way to hide our Silverlight code. I know there are some obfuscators available but it looks like people can hack that too. Anybody have any success on this front?
stackexchange/codereview
I have some template code that I would prefer to have stored in a CPP file instead of inline in the header. I know this can be done as long as you know which template types will be used. For example: .h file class foo { public: template <typename T> void do(const T& t); }; .cpp file template <typename T> voi...
stackexchange/codereview
I've developed a Windows service which tracks business events. It uses the Windows clock to timestamp events. However, the underlying clock can drift quite dramatically (e.g. losing a few seconds per minute), particularly when the CPUs are working hard. Our servers use the Windows Time Service to stay in sync with doma...
stackexchange/codereview
Is there a tutotial or help file, suitable for a beginner c# programmer to use.
stackexchange/codereview
I have a query that originally looks like this: select c.Id, c.Name, c.CountryCode, c.CustomerNumber, cacc.AccountNumber, ca.Line1, ca.CityName, ca.PostalCode from dbo.Customer as c left join dbo.CustomerAddress as ca on ca.CustomerId = c.Id left join dbo.CustomerAccount as cacc on cacc.CustomerId = c.Id where c.Count...
stackexchange/codereview
What kind of performance implications are there to consider when using try-catch statements in php 5? I've read some old and seemingly conflicting information on this subject on the web before. A lot of the framework I currently have to work with was created on php 4 and lacks many of the niceties of php 5. So, I don'...
stackexchange/codereview
I have a table with a "Date" column, and I would like to do a query that does the following: If the date is a Monday, Tuesday, Wednesday, or Thursday, the displayed date should be shifted up by 1 day, as in DATEADD(day, 1, [Date]) On the other hand, if it is a Friday, the displayed date should be incremented by 3 days...
stackexchange/codereview
Is there any clear documentation on the binary formats used to serialize the various MFC data structures? I've been able to view some of my own classes in a hex editor and use Java's ByteBuffer class to read them in (with automatic endianness conversions, etc). However, I am currently running into issues while trying ...
stackexchange/codereview
I know this rather goes against the idea of enums, but is it possible to extend enums in C#/Java? I mean "extend" in both the sense of adding new values to an enum, but also in the OO sense of inheriting from an existing enum. I assume it's not possible in Java, as it only got them fairly recently (Java 5?). C# see...
stackexchange/codereview
The "N+1 selects problem" is generally stated as a problem in Object-Relational mapping (ORM) discussions, and I understand that it has something to do with having to make a lot of database queries for something that seems simple in the object world. Does anybody have a more detailed explanation of the problem?
stackexchange/codereview
I want (barely computer literate) people to easily submit a large number of files (pictures) through my web application. Is there a simple, robust, free/cheap, widely used, standard tool/component (Flash or .NET - sorry no java runtime on the browser) that allows a web user to select a folder or a bunch of files on the...
stackexchange/codereview
I have a WSI installer package that I'm using to install my application. The application itself can be run by a normal user, but I have a configuration app that should only be run by a system administrator. Thus, I don't want it to appear in the Start Menu for all users, just for the administrator. Is there any way t...
stackexchange/codereview
I learned Java in college, and then I was hired by a C# shop and have used that ever since. I spent my first week realizing that the two languages were almost identical, and the next two months figuring out the little differences. For the most part, was I noticing the things that Java had that C# doesn't, and thus was ...
stackexchange/codereview
I am using the AjaxControlToolkit in VS2005, and it works fine. I do have some issues though, when I go to some pages I have, then click back, I get this JavaScript error: 'AjaxControlToolkit' is undefined I have searched MSDN forums, and google, and tried many of the solutions, but none have worked. I have tried, En...
stackexchange/codereview
I know next to nothing when it comes to the how and why of https connections. Obviously, when I'm transmitting secure data like passwords or especially credit card information, https is a critical tool. What do I need to know about it, though? What are the most common mistakes you see developers making when they imp...
stackexchange/codereview
I have an exe file generated with py2exe. In the setup.py I specify an icon to be embedded in the exe: windows=[{'script': 'my_script.py','icon_resources': [(0, 'my_icon.ico')], ... I tried loading the icon using: hinst = win32api.GetModuleHandle(None) hicon = win32gui.LoadImage(hinst, 0, win32con.IMAGE_ICON, 0, 0, wi...
stackexchange/codereview
I have a couple databases on a shared SQL Server 2005 cluster instance, that I would like performance metrics on. I have some processes that run for a very long time and suspect that code inefficiencies, rather than insufficient hardware are to blame. I would like some way to get these performance metrics so that I can...
stackexchange/codereview
I'm looking for an Access 2007 equivalent to SQL Server's COALESCE function. In SQL Server you could do something like: Person John Steve Richard SQL DECLARE @PersonList nvarchar(1024) SELECT @PersonList = COALESCE(@PersonList + ',','') + Person FROM PersonTable PRINT @PersonList Which produces: John, Steve, Richard...
stackexchange/codereview
We have an application which needs to use Direct3D. Specifically, it needs at least DirectX 9.0c version 4.09.0000.0904. While this should be present on all newer XP machines it might not be installed on older XP machines. How can I programmatically (using C++) determine if it is installed? I want to be able to give an...
stackexchange/codereview
No matter what I do sys.exit() is called by unittest, even the most trivial examples. I can't tell if my install is messed up or what is going on. IDLE 1.2.2 ==== No Subprocess ==== >>> import unittest >>> >>> class Test(unittest.TestCase): def testA(self): a = 1 self.assertEqual(...
stackexchange/codereview
I need to extract and decode barcodes and text from images. Is there any open source library available that helps to accomplish that task? If not, do you know a good commercial product?
stackexchange/codereview
When dealing with mobile clients it is very common to have multisecond delays during the transmission of HTTP requests. If you are serving pages or services out of a prefork Apache the child processes will be tied up for seconds serving a single mobile client, even if your app server logic is done in 5ms. I am looking ...
stackexchange/codereview
I have a table called OffDays, where weekends and holiday dates are kept. I have a table called LeadTime where amount of time (in days) for a product to be manufactured is stored. Finally I have a table called Order where a product and the order date is kept. Is it possible to query when a product will be finished ma...
stackexchange/codereview
I want to link to bookmark on a page (mysite.com/mypage.htm#bookmark) AND visually highlight the item that was bookmarked (maybe having a red border). Naturally, there would be multiple items bookmarked. So that if someone clicked on #bookmark2 then that other area would be highlighted). I can see how to do that wi...
stackexchange/codereview
I have heard there is a way to cheat single inheritance and implement multiple inheritance in Java. Does anyone know how to implement this(with out using interface)? Just out of curiosity ;-)
stackexchange/codereview