instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
I have in Word ‘hello’ and when I paste it I get 018hello 019 so the apostrophes turn into these strange characters. The type of web application should not matter as the behaviour is different depending on the workstation I use. I checked with Notepad, Excel and Wordpad and this issue does not occur, only for Word. It ...
stackexchange/codereview
There are a couple of questions similar to this on stack overflow but not quite the same. I want to open, or create, a local group on a win xp computer and add members to it, domain, local and well known accounts. I also want to check whether a user is already a member so that I don't add the same account twice, and p...
stackexchange/codereview
I wonder if there is a way to create a Custom List in Sharepoint, but specify that each user may only create one item in the list. I am thinking of two approaches: Develop a ListReceiver that checks if the user already created an item. Problem: I did not see a way to enable a Feature on a specific list (the idea is th...
stackexchange/codereview
I am writing a program in Python that will act as a server and accept data from a client, is it a good idea to impose a hard limit as to the amount of data, if so why? More info: So certain chat programs limit the amount of text one can send per send (i.e. per time user presses send) so the question comes down to is th...
stackexchange/codereview
I'm trying to write a small script to change the current directory to my project directory: #!/bin/bash cd /home/tree/projects/java I saved this file as proj, added execute permission with chmod, and copied it to /usr/bin. When I call it by: proj, it does nothing. What am I doing wrong?
stackexchange/codereview
I have been using CPPUnit as a unit testing framework and am now trying to use it in an automated build and package system. However a problem holding me back is that if a crash occurs during the running of the unit tests, e.g. a null pointer dereferencing, it halts the remainder of the automation. Is there any way for...
stackexchange/codereview
I have put together the following mootools script window.addEvent('domready', function() { var shouts = "timed.php"; var log = $('log_res'); function updateData (url,target) { new Ajax(url,{ method: 'get', update: $(target), onComplete: function() { log.removeC...
stackexchange/codereview
What is the best datatype to use for storing moderate amounts of text in SQL Server (2005)? For example, imagine a table, storing information on downloads available on a website. I want a title for the download which is brief, say varchar(20). A path, say varchar(255) then I want to store some user friendly text about ...
stackexchange/codereview
37 Signal's Getting Real convinced me that wireframing and writing functional specification documents are middleman steps unnecessary for building web applications and dynamic websites. Is the overhead for these steps worth its weight? Is prototyping in HTML/CSS or even PhotoShop documents (so designers can work on th...
stackexchange/codereview
I'm rebuilding a site with a lot of incoming links, and the URL structure is completely changing. I'm using the stock mod_rewrite solution to redirect all old links to new pages. However, as I'm sure a few links will slip through the net, I've built a small script that runs on my custom 404 page, to log the incoming vi...
stackexchange/codereview
I'm trying to design an application to hold academic reference information. The problem is that each different type of reference (eg. journal articles, books, newspaper articles etc) requires different information. For example a journal reference requires both a journal title and an article title, and also a page numb...
stackexchange/codereview
What is the best technique for catching ALL exceptions thrown within JavaScript? Obviously, the best technique is to use try...catch. But with ansynchronous callbacks and so forth, that can get tricky. I know IE and Gecko browsers support window.onerror, but what about Opera and Safari? Here are a bunch of test-cases ...
stackexchange/codereview
I'm pretty sure one would do this using the os.plock(op) function, but I have no idea how. Also, if there's a better way, I'd be grateful to find out. Code snippets are very welcome.
stackexchange/codereview
Trying to write a PowerShell cmdlet that will mute the sound at start, unless already muted, and un-mute it at the end (only if it wasn't muted to begin with). Couldn't find any PoweShell or WMI object I could use. I was toying with using Win32 functions like auxGetVolume or auxSetVolume, but couldn't quite get it to w...
stackexchange/codereview
I would like to create an HTML table with row colors changing based on position and content. But instead of alternating every row, I'd like to be able to group rows together, so that I can have some XML like this: <itemlist> <item group="0">Conent...blah blah</item> <item group="0">Content...who cares</item> ...
stackexchange/codereview
I seem to remember being able to print out (or locate) the specific switches that each -O<num> option turns on. Can you remind? Thanks!
stackexchange/codereview
Creating an XPathDocument with referenced DTD sometimes throws a web exception. Why?
stackexchange/codereview
I would like to change the "Row Source" values in an Access table through code. This way I can filter what a user can choose in a column's combo box.
stackexchange/codereview
I'm writing an app where 3rd party vendors can write plugin DLLs and drop them into the web app's bin directory. I want the ability for these plugins to be able to register their own HttpModules if necessary. Is there anyway that I can add or remove HttpModules from and to the pipeline at runtime without having a corr...
stackexchange/codereview
I would like to know if it is possible to determine if a function parameter with a default value was passed in Python. For example, how does dict.pop work? >>> {}.pop('test') Traceback (most recent call last): File "<stdin>", line 1, in <module> KeyError: 'pop(): dictionary is empty' >>> {}.pop('test',None) >>> {}.po...
stackexchange/codereview
I continually get these errors when I try to update tables based on another table. I end up rewriting the query, change the order of joins, change some groupings and then it eventually works, but I just don't quite get it. What is a 'multi-part identifier'? When is a 'multi-part identifier' not able to be bound? What i...
stackexchange/codereview
I have a mission-critical real-time data application that uses a TCP connection between the client and server. In some cases, the connection periodically dies (SocketException). No problem - just reconnect and move on. However, the customers aren't thrilled with these intermittent drops in connectivity. I'd like to kno...
stackexchange/codereview
I am still very new to Ruby (reading through the Pickaxe and spending most of my time in irb), and now that I know it's possible to patch classes in Ruby, I'm wondering when it's acceptable to do so, specifically whether it's acceptable to patch Ruby's base classes. For example: I answered another Ruby question here wh...
stackexchange/codereview
I have never clearly understood the usage of MAXDOP. I do know that it makes the query faster and that it is the last item that I can use for Query Optimization. However, my question is, when and where it is best suited to use in a query?
stackexchange/codereview
I need to extract all the emails that show up as autocomplete entries in Outlook 2007. I mostly need to create a list of all the email addresses which I have sent emails to in the past and dump them into excel. Should I be connecting to Outlook through COM somehow? Thanks.
stackexchange/codereview
What are some good algorithms for automatically labeling text with the city / region or origin? That is, if a blog is about New York, how can I tell programatically. Are there packages / papers that claim to do this with any degree of certainty? I have looked at some tfidf based approaches, proper noun intersectio...
stackexchange/codereview
Are there any tools that can help find race conditions when testing multi-threaded .net code? I'm looking for something with similar capabilities to IBM's ConTest tool for Java.
stackexchange/codereview
I have been recommended "Resource Tuner console" but it's a little out of my price range. I'm looking for something that could be launched from a nant build script and told to stamp an exe with an additional property as described in my previous question.
stackexchange/codereview
We have a C# service that is deployed to a remote customer system. The application writes a substantial amount of "diagnostic" information to the console (i.e. Console.WriteLine()). The service isn't "doing what it should." How can we capture the console output from the service in another application? A WinForm vers...
stackexchange/codereview
In MySQL, how do I get a list of all foreign key constraints pointing to a particular table? a particular column? This is the same thing as this Oracle question, but for MySQL.
stackexchange/codereview
I'm using tortoise svn in Windows. How can I branch in SVN and have it branch my svn:external folders as well?
stackexchange/codereview
I've been working on a SharePoint project and I have gone the route of loading User Controls through a custom web part. I have several web controls where I need to dynamically generate hyperlinks (in a loop from a database) that will call certain functions of the User Control when clicked. When I'm building my own ASP....
stackexchange/codereview
Does anybody know how to call the import data built-in dialog excel from a macro (vba)? I've tried Application.Dialogs.Item(...).Show but I can´t find the right dialog. Please help. Thanks in advance.
stackexchange/codereview
I do more and more exercise with Lambda but I do not figure out why sometime example use .AsQueryable(); that use the IQueryable and sometime it omit the .AsQueryable(); and use the IEnumerable. I have read the MSDN but I do no see how "executing an expression tree" is an advantage over not. Anyone can explain it to me...
stackexchange/codereview
I'd like to read an arbitrary PDF on my iPod Touch (or iPhone) with a reasonable font size. Some PDFs are already formatted with narrow columns and wide margins. Once I zoom the document to "remove" the margins, the text is easy to read. Most documents have one very wide column of text. When I zoom in enough to make ...
stackexchange/codereview
I have just installed PostgreSQL 8.3.4 on Mac OS X 10.5 (using ports), but I cannot figure out how to enable PL/Python. When I run the CREATE LANGUAGE plpythonu I get the following errors: ERROR: could not access file "$libdir/plpython": No such file or directory STATEMENT: CREATE LANGUAGE plpythonu; psql:<stdin>:18:...
stackexchange/codereview
I have a wysiwyg editor in my back end, and it is tripping up the first regular expression I wrote. This is in PHP4, using preg_replace(). I'm capturing the URI and linked text. @<a\shref=\"http[s]?://([^\"]*)\"[]>(.*)<\/a>@siU The client wanted all external links to open in a new window, so that's the expression I wa...
stackexchange/codereview
I have a c# form (let's call it MainForm) with a number of custom controls on it. I'd like to have the MainForm.OnClick() method fire anytime someone clicks on the form regardless of whether the click happened on the form or if the click was on one of the custom controls. I'm looking for behavior similar to the KeyPrev...
stackexchange/codereview
I am trying to design a 4-bit adder subtracter in verilog. This is only the second thing I have ever written in verilog, and I don't know all the correct syntax yet. This is the module I have so far: module Question3(carryin, X, Y, Z, S, carryout, overflow); parameter n = 4; input carryin, Z; input [n-1:0]X...
stackexchange/codereview
Has anyone noticed that if you retrieve HTML from the clipboard, it gets the encoding wrong and injects weird characters? For example, executing a command like this: string s = (string) Clipboard.GetData(DataFormats.Html) Results in stuff like: <FONT size=-2>  <A href="/advanced_search?hl=en">Advanced Search</A><BR...
stackexchange/codereview
In a Delphi Form, I would like to replace one visual component with another. Example: I want to replace a Panel component with an ElPanel from a 3rd party package. I would like all identical properties and events of the first component to be transferred to the new one, and all the components that belong to the first c...
stackexchange/codereview
I am just getting into ibatis with SqlMap for the first time and I have run into a problem. I have figured out how to insert, delete, update, and select single records. Now however I am trying to write a select statement that will bring back more than a single record and I am getting mapping errors. How do I specify...
stackexchange/codereview
Wikipedia provides a number of citations used in the sciences, however does one stand out in computer science and software engineering related documents? My initial guess is to the IEEE format, as they have a number of conferences and publications related to both fields, but I couldn't find anything definite.
stackexchange/codereview
What is the best method for applying drop shadows? I'm working on a site right now where we have a good deal of them, however, I've been fighting to find the best method to do it. The site is pretty animation heavy so shadows need to work well with this. I tried a jQuery shadow pulgin. The shadows looked good and we...
stackexchange/codereview
I have a picture that I need to resize to a specific dimension and then move one of the corner to a place higher than before so the image is not rectangular anymore but some kind of polygon. Is there a library that could help me with this kind of image manipulation or does someone knows the name of this operation? This...
stackexchange/codereview
I have a series of text that contains mixed numbers (ie: a whole part and a fractional part). The problem is that the text is full of human-coded sloppiness: The whole part may or may not exist (ex: "10") The fractional part may or may not exist (ex: "1/3") The two parts may be separated by spaces and/or a hyphens (ex...
stackexchange/codereview
I'd like to show an image in an iPhone app, but the image I'm using is too big. I'd like to scale it to fit the iPhone screen, I can't find any class to handle it.
stackexchange/codereview
Are there plugins for trac that enable cookie based authentication instead of http authentication, and allow keeping the site private for unknown users? We want to allow customers outside the office to log in, add and look at the tickets on their projects, but not the projects for our other clients. Non techie users ar...
stackexchange/codereview
I had an unusual problem yesterday where I was suddenly unable to insert records into a table with an identity column. A simple insert like this: INSERT INTO MyTable (Column1, Column2) VALUES ('text', 236764) Started throwing a primary key constraint violation. I ran DBCC CHECKIDENT on the table, and realized that SQL...
stackexchange/codereview
I've got a UserControl that contains an UpdatePanel. When I put that on a page, it throws the following error: Cannot unregister UpdatePanel with ID 'ReviewContentUpdatePanel' since it was not registered with the ScriptManager. This might occur if the UpdatePanel was removed from the control tree and later ...
stackexchange/codereview
Why can't I create a class in VB.NET that inherits System.IO.Directory? According to Lutz Roeder, it is not declared as NotInheritable! I want to create a utility class that adds functionality to the Directory class. For instance, I want to add a Directory.Move function. Please advise and I will send you a six pack. ...
stackexchange/codereview
Am I allowed to place <noscript> in the <head>?
stackexchange/codereview
How do you change the CLASSPATH of a Java process from within the Java process? Before you ask me "Why would you want to do that?" I'll explain it shortly. When you have a Clojure REPL running it is common to need more jars in your CLASSPATH to load a Clojure source file, and I'd like to do it without having to rest...
stackexchange/codereview
I am developing an application that needs to use regini (because of legacy reasons) to insert something into the registry. I have been trying to do this in such a way the the user of the application is not aware of this. I have written the following code: System.Diagnostics.ProcessStartInfo pi = new ProcessStartInfo();...
stackexchange/codereview
We are using Linq To SQL with our own data context logic that executes the one linq query across multiple databases. When we get the results back, we need the database for each of the rows. So... I want to have a property on my class that will return the database name (SQL Server, so DB_NAME()). How can I do this in Li...
stackexchange/codereview
I have the following intentionally trivial function: void ReplaceSome(ref string text) { StringBuilder sb = new StringBuilder(text); sb[5] = 'a'; text = sb.ToString(); } It appears to be inefficient to convert this to a StringBuilder to index into and replace some of the characters only to copy it back to ...
stackexchange/codereview
I'm fairly new to Castle Windsor and am looking into the in's and out's of the logging facility. It seems fairly impressive but the only thing i can't work out is where Windsor sets the Logger property on my classes. As in the following code will set Logger to the nullLogger if the class hasn't been setup yet but when ...
stackexchange/codereview
Is there any way I can detect when my page has been set as the user's homepage in their browser? I'm most interested in something in javascript, but I'd be happy to hear about other approaches as well. Edit: I'm not looking for anything sneaky. I'm wondering if there is anything that is explicitly allowed through the ...
stackexchange/codereview
Modern RDBMS's have support for XML column types and functionality for dealing with XML in stored procedures. Historically I would always have mapped hierarchical data (whether of OO objects or XML) to relational tables. Given the widespread database support for XML should I change my ways?
stackexchange/codereview
I have been having some problems trying to get my PHP running. When I try and run any scripts they appear in the source and do not run properly. This is the htaccess file: # Use PHP5 as default AddHandler application/x-httpd-php5 .php AddType x-mapp-php5 .php AddHandler x-mapp-php5 .php Could this be the error?
stackexchange/codereview
I would like to create a report designer that has the same functionality and ease of use as the Visual Studio IDE. The ability to drag controls onto a form, select various subsets of those controls, align left, evenly space, etc. The only tools I have ever encountered are really bad. Crystal Reports, the MS Access r...
stackexchange/codereview
What's a simple/easy way to access the system clock using Java, so that I can calculate the elapsed time of an event?
stackexchange/codereview
In an UML component diagram, how does one tag or identify a component as a database, so that it's easily recognizable? In the old days there was the cylinder symbol for showing database but that's not part of the UML. Same goes for an application server for instance, how would that be shown? Are stereotypes applicable ...
stackexchange/codereview
How many bytes would an int contain and how many would a long contain in C++? Please provide some information about the 32-bit and the 64-bit computers, and the differences.
stackexchange/codereview
I've seen some examples of C++ using template template parameters (that is templates which take templates as parameters) to do policy-based class design. What other uses does this technique have?
stackexchange/codereview
If I have the following string: string s = "abcdefghab"; Then how do I get a string (or char[]) that has just the characters that are repeated in the original string using C# and LINQ. In my example I want to end up with "ab". Although not necessary, I was trying to do this in a single line of LINQ and had so far come...
stackexchange/codereview
According this MSDN article HttpApplication.EndRequest can be used to close or dispose of resources. However this event is not fired/called in my application. We are attaching the handler in Page_Load the following way: HttpContext.Current.ApplicationInstance.EndRequest += ApplicationInstance_EndRequest; The only way ...
stackexchange/codereview
I have Virtual PC 2007. I am writing a C# program that will run on the Host and Virtual. It needs to communicate both ways. What is the best way to do this? Can it be done in a way that does not require changing Virtual settings? (the OSs will be XP, Vista, Server 2000 / 2003)
stackexchange/codereview
Is it possible to write a program that interacts with a running instance of Flash? In recent versions of Java, there is a notion of "attaching" your own process to a running JVM. By writing some somewhat ugly code using Reflection and the like, you can dig around, grab a reference to an object, print the value of a var...
stackexchange/codereview
[This question is related to but not the same as this one.] My compiler warns about implicitly converting or casting certain types to bool whereas explicit conversions do not produce a warning: long t = 0; bool b = false; b = t; // performance warning: forcing long to bool b = (bool)t; /...
stackexchange/codereview
Say I have a class that's meant to perform a single function. After performing the function, it can be destroyed. Is there any reason to prefer one of these approaches? // Initialize arguments in constructor MyClass myObject = new MyClass(arg1, arg2, arg3); myObject.myMethod(); // Pass arguments to method MyClass myOb...
stackexchange/codereview
Whats the benefit of: public string User {get; set;} over public string User; Since you can't access the private member in the first case, how is it any different that just making your property public?
stackexchange/codereview
I have a query that has a list of base values and a list of language values. Each value has a key that matches to the other. The base values are stored in one table and the language values in another. My problem is that I need to get all matching base values removed from the QUERY except for one. Then, I export tha...
stackexchange/codereview
I am developing some client side Javascript that is using some JSON web services on a different domain. I have read that some browsers do not allow cross-domain scripting and that I should create a proxy on my local server to serve the data. Can someone please point me to a simple example of how to do this in ASP.Net?...
stackexchange/codereview
I'm looking for an abstract base class or master page solution that will prevent anyone from doing XSRF using both a token and ttl. Can anyone point me in the right direction? Edit: The ideal solution will leverage the cookie that the default membership provider sends down to the client.
stackexchange/codereview
I've make an application in PHP that uses DOMDocument() in PHP 5. The problem is that my server uses PHP 4 and DOM object is not recognized. What can I do? Can I download any kind of software and put it in my server and use include? Which one? Thanks a lot.
stackexchange/codereview
When my application opens too many windows the taskbar groups them into one button. Each window has its own icon, but the grouping icon is the default "unknown"-kind icon. How can I set the grouping icon?
stackexchange/codereview
Is there an HTML color wheel that I can throw in my site that will return a value of the color when a user clicks on it? would make one myself but don't want to "re-invent the wheel" HILARIOUS(punny?)
stackexchange/codereview
Anyone got an idea how to get from an Xserver the list of all open windows?
stackexchange/codereview
I have two PHP scripts, both using the same session by calling session_name('MySessID'). When the first script calls the second script using curl, the second script hangs when session_start() is called. Why would this happend?
stackexchange/codereview
How to send array in Httpservice in Adobe Flex3
stackexchange/codereview
UPDATE: Thanks to everyone for the responses. I didn't realize document.write() was deprecated. Add a another notch to the learning column. I'll be taking the advice posted here, but leave the original question so that the answers given make sense in context of the original question. I'm in the process of coding some ...
stackexchange/codereview
I have a web application at work that is similar to a ticket working system. Some users enter new issues. Other workers choose and resolve issues. All of the data is maintained in MS SQL server 2005. The users working to resolve issues go to a page where they can view open issues. Because up to twenty people can be loo...
stackexchange/codereview
If this is possible, please provide a sample query or two so I can see how it would work. Both tables will be in the same database. Thanks!
stackexchange/codereview
On the latest Ubuntu, I have a functioning PHP 5.2.4 installation. I want to use a remote Oracle server from PHP using OCI. I've downloaded the "Instant Client Package - Basic Lite" (Link). I've unzipped the package containing the OCI libraries to a dir but I have no idea how to tell PHP that I want to use these libra...
stackexchange/codereview
I feel that using GetEnumerator() and casting IEnumerator.Current is expensive. Any better suggestions? I'm open to using a different data structure if it offers similiar capabilities with better performance. After thought: Would a generic stack be a better idea so that the cast isn't necessary?
stackexchange/codereview
Magento shopping cart is built on the Zend Framework in PHP. This is the first time I've dealt with the Zend framework and I'm having the following difficulty... I'm creating a custom module that will allow users to upload images whenever they purchase products. I can overload the addAction() method whenever a user at...
stackexchange/codereview
Let's assume we're talking about the recently released Beta version. Specifically I'm interested in a step-by-step tutorial or similar, and I'd be thrilled with information addressing how to do so on CrystalTech.
stackexchange/codereview
How do i take a HTML site that currently has no doctype declaration and make it W3C compliant?
stackexchange/codereview
I am currently building a web site and I just implemented SqlCacheDependency using LinqToSQL like so. public IQueryable<VictoryList> GetVictoryList() { string cacheKey = HttpContext.Current.User.Identity.Name + "victoryCacheKey"; IQueryable<VictoryList> cachednews = (IQueryable<Vic...
stackexchange/codereview
I am having trouble deploying an ASP.NET MVC app to IIS7. I have an MVC project created with ASP.NET MVC Beta 1. It consists of nothing more than the default template unmodified. The app runs just fine within VS2008, but when I publish it to a local IIS7 website (http://localhost), I get the following server error: ...
stackexchange/codereview
Is there a simple Model Checker tool. I am planning to implement a model checker tool which will analyze the code for some of the predefined properties.
stackexchange/codereview
A very often scenario of unit test is as follows: public void SetUp() { this.callLog = new StringBuilder(); } public void TestBuzzBar() { var bar = new Bar(new MockFoo(callLog)); bar.Buzz(17); Assert.AreEqual("MockFoo.Init(17) MockFoo.PrepareStuff MockFoo.DoTheJob ", callLog.ToString()); } ... with MockFoo im...
stackexchange/codereview
This is a simple one. I want to replace a sub-string with another sub-string on client-side using Javascript. Original string is 'original READ ONLY' I want to replace the 'READ ONLY' with 'READ WRITE' Any quick answer please? Possibly with a javascript code snippet...
stackexchange/codereview
I began an iPhone project the other day with a silly development code name, and now I want to change the name of the project since it's nearly finished. How can I do this?
stackexchange/codereview
Sorting has been studied for decades, so surely the sorting algorithms provide by any programming platform (java, .NET, etc.) must be good by now, right? Is there any reason to override something like System.Collections.SortedList?
stackexchange/codereview
This is an accident and I don't think there's a solution. But I'm asking anyways. I introduced SVN to our webshop and I set all the dev pc's htdocs as part of the repository. (my first mistake) Now, one of my coworkers are working on a project and didn't commit their code to svn (second mistake). His reasoning was that...
stackexchange/codereview
Big problem. I'm not sure what it was that I did, but it seems that I can no longer debug into functions. It happens in no particular place, just all throughout the code. I set a breakpoint, and then try to "step over" in order to go to the next like of code. Now, the debugger seems to interpret that as "continue". ...
stackexchange/codereview
I have an application where I have a main.m that returns NSApplicationMain(argc, (const char **) argv);. I want to run code on -applicationDidFinishLaunching:, but I just dont see how to do it. Can anyone help or have an example? Thanks! -Jason
stackexchange/codereview
I'm running PHP on Windows/IIS. My session variables don't seem to be preserved from page-to-page. This code… //echos out the session variables in a nice format for inspection echo "<p><pre>"; print_r($_SESSION); echo "</pre></p>"; …outputs blank values, like this… Array ( [s_firstvar] => ...
stackexchange/codereview