qid
int64
4
19.1M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
236,744
<p>What single aspect of agile development should we implement first to improve our development process, and why? </p> <p>I'm in a situation that's requiring me to "tweak" my process, rather than re-engineer it, and "agile" seems to be the mantra of the day. If we can make only one change that will improve something...
[ { "answer_id": 237062, "author": "David Pokluda", "author_id": 223, "author_profile": "https://Stackoverflow.com/users/223", "pm_score": 1, "selected": false, "text": "-----> [Stress] <--o-- / --o--> [RunTests]\n [TestFirst] <--o-- / --o--> [Stress]\n" } ]
2008/10/25
[ "https://Stackoverflow.com/questions/236744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29157/" ]
236,749
<p>I have a bunch of ASP.NET web pages (that have a standard layout) that are product documentation. I want to create some sort of combination page that will pull all of the other page content in and concatenate them into one long page.</p> <p>IFrames won't work because I don't know the size of each page. I could ha...
[ { "answer_id": 236767, "author": "chakrit", "author_id": 3055, "author_profile": "https://Stackoverflow.com/users/3055", "pm_score": 0, "selected": false, "text": "Server.MapPath var actualDiskFilename = Server.MapPath(\"~/somewhere/somepage.html\");\n System.IO var virtualDir = \"~/some...
2008/10/25
[ "https://Stackoverflow.com/questions/236749", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7442/" ]
236,778
<p>I have a table named Info of this schema:</p> <pre><code>int objectId; int time; int x, y; </code></pre> <p>There is a lot of redundant data in the system - that is, <code>objectId</code> is not UNIQUE. For each <code>objectId</code> there can be multiple entries of <code>time, x, y</code>.</p> <p>I want to retri...
[ { "answer_id": 236786, "author": "Eoin Campbell", "author_id": 30155, "author_profile": "https://Stackoverflow.com/users/30155", "pm_score": 3, "selected": false, "text": "SELECT A.time, A.objectID, B.X, B.Y\nFROM\n(\n SELECT max(time) as time, objectID \n FROM table\n GROUP by obj...
2008/10/25
[ "https://Stackoverflow.com/questions/236778", "https://Stackoverflow.com", "https://Stackoverflow.com/users/338/" ]
236,792
<p>I take care of critical app in my project. It does stuff related to parsing business msgs (legacy standard), processing them and then storing some results in a DB (another apps picks that up). After more then a year of my work (I've other apps to look after as well) the app is finally stable. I've introduced strict ...
[ { "answer_id": 237077, "author": "Head Geek", "author_id": 12193, "author_profile": "https://Stackoverflow.com/users/12193", "pm_score": 0, "selected": false, "text": "CheckForRequiredLines VerifyLineOrder" }, { "answer_id": 239693, "author": "Richard Corden", "author_id"...
2008/10/25
[ "https://Stackoverflow.com/questions/236792", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3579/" ]
236,793
<p>With DWR it is possible to group together several service calls into one single HTTP request :<br> <a href="http://directwebremoting.org/dwr/browser/engine/batch" rel="noreferrer">dwr batch feature</a><br><br> This feature is very useful to reduce the latency of an ajax application. Is there a way to do something s...
[ { "answer_id": 236864, "author": "dmazzoni", "author_id": 7193, "author_profile": "https://Stackoverflow.com/users/7193", "pm_score": 1, "selected": false, "text": "FooResponse callFoo(FooRequest request);\n ArrayList<FooResponse> batchCallFoo(ArrayList<FooRequest> requests) {\n ArrayLi...
2008/10/25
[ "https://Stackoverflow.com/questions/236793", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11897/" ]
236,795
<p>I have a PHP class that creates a PNG image on the fly and sends it to browser. PHP manual says that I need to make sure that <em>imagedestroy</em> function is called at end to release the memory. Now, if I weren't using a class, I would have some code like this:</p> <pre><code>function shutdown_func() { globa...
[ { "answer_id": 236811, "author": "Henrik Paul", "author_id": 2238, "author_profile": "https://Stackoverflow.com/users/2238", "pm_score": 0, "selected": false, "text": "unset()" }, { "answer_id": 236830, "author": "Milan Babuškov", "author_id": 14690, "author_profile":...
2008/10/25
[ "https://Stackoverflow.com/questions/236795", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14690/" ]
236,801
<p>That's basically the question, is there a "right" way to implement <code>operator&lt;&lt;</code> ? Reading <a href="http://bytes.com/forum/thread170304.html" rel="noreferrer">this</a> I can see that something like:</p> <pre><code>friend bool operator&lt;&lt;(obj const&amp; lhs, obj const&amp; rhs); </code></pre> <...
[ { "answer_id": 236806, "author": "Magnus Hoff", "author_id": 2971, "author_profile": "https://Stackoverflow.com/users/2971", "pm_score": 6, "selected": false, "text": "this << ostream friend ostream" }, { "answer_id": 236813, "author": "Motti", "author_id": 3848, "aut...
2008/10/25
[ "https://Stackoverflow.com/questions/236801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/161/" ]
236,810
<p>I'm trying to extract an uploaded zip file and store its contents in the database, one entry per file. The rubyzip library has nearly no useful documentation.</p> <p>There is an assets table that has key :string (file name) and data :binary (file contents).</p> <p>I'm using the rubyzip library, and have made it a...
[ { "answer_id": 236827, "author": "Ivan", "author_id": 16957, "author_profile": "https://Stackoverflow.com/users/16957", "pm_score": 3, "selected": false, "text": "asset.data = entry.read_local_entry {|z| z.read }\n data = entry.extract \"#{RAILS_ROOT}/#{entry.name}\"\nasset.data = File.r...
2008/10/25
[ "https://Stackoverflow.com/questions/236810", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2884/" ]
236,838
<p>Are there any good books for a relatively new but not totally new *nix user to get a bit more in depth knowledge (so no "Linux for dummies")? For the most part, I'm not looking for something to read through from start to finish. Rather, I'd rather have something that I can pick up and read in chunks when I need t...
[ { "answer_id": 565605, "author": "x-way", "author_id": 68288, "author_profile": "https://Stackoverflow.com/users/68288", "pm_score": 2, "selected": false, "text": "awk awk" } ]
2008/10/25
[ "https://Stackoverflow.com/questions/236838", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2147/" ]
236,851
<p>I currently work at a company that has a lot of custom applications that are made internally. There are not currently standards for a lot of things. I would like to implement a way to record/track errors that happen in this programs (most are asp.net).</p> <p>I am currently thinking of handling this in the Global...
[ { "answer_id": 236910, "author": "balexandre", "author_id": 28004, "author_profile": "https://Stackoverflow.com/users/28004", "pm_score": 1, "selected": false, "text": "try \n{\n // production code\n}\ncatch(Exception ex)\n{\n Utilities.Mail.SendError(ex);\n}\n <%@ Application Langua...
2008/10/25
[ "https://Stackoverflow.com/questions/236851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31474/" ]
236,859
<p>Any python libs for parsing Bind zone files? Basically something that will aid in adding/removing zones and records. This needs to work even if someone modifies the zone file by hand so overwriting the zone files every time is not a solution. </p>
[ { "answer_id": 237236, "author": "Michael Gundlach", "author_id": 4105, "author_profile": "https://Stackoverflow.com/users/4105", "pm_score": 0, "selected": false, "text": "# define zone_you_care_about and line_you_wish_to_insert first, then:\nfor line in bindfile.read():\n out.write(...
2008/10/25
[ "https://Stackoverflow.com/questions/236859", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9789/" ]
236,878
<p>this is a question that when programming I always wonder: What to use when we are writing code: </p> <pre><code>var myFiles = Directory.GetFiles(fullPath); </code></pre> <p>or</p> <pre><code>string[] myFiles = Directory.GetFiles(fullPath); </code></pre> <p><strong><em>var</em></strong> is new and is a <em>Implic...
[ { "answer_id": 236886, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 5, "selected": false, "text": "Directory.GetFiles string[] FileInfo[] var Dictionary<string,List<int>>" }, { "answer_id": 236902, "author":...
2008/10/25
[ "https://Stackoverflow.com/questions/236878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28004/" ]
236,879
<p>I'm looking for a PHP library/function/class which can create <a href="http://en.wikipedia.org/wiki/Identicon" rel="nofollow noreferrer">Identicon</a>s.</p>
[ { "answer_id": 237139, "author": "Kris", "author_id": 18565, "author_profile": "https://Stackoverflow.com/users/18565", "pm_score": 4, "selected": false, "text": "class Gravatar\n{\n static public function GetGravatarUrl( $email, $size = 128, $type = 'identicon', $rating = 'pg' )\n ...
2008/10/25
[ "https://Stackoverflow.com/questions/236879", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31476/" ]
236,926
<p>I have a request for some contract work from an organization that uses <a href="http://www.neopoleon.com/home/blogs/neo/archive/2003/09/29/5458.aspx" rel="nofollow noreferrer">Excel as a database</a> and wants to do some work on the Excel data via a real database. (Yeah, I know, never mind...)</p> <p>The client has...
[ { "answer_id": 248225, "author": "CestLaGalere", "author_id": 6684, "author_profile": "https://Stackoverflow.com/users/6684", "pm_score": 2, "selected": false, "text": " Dim ConnectionString As String = \"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\" + DataFolder + \"\\;Extended Pro...
2008/10/25
[ "https://Stackoverflow.com/questions/236926", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2077/" ]
236,936
<p>I have some code that generates image of a pie chart. It's a general purpose class, so any number of slices can be given as input. Now I have problem picking good colors for the slices. Is there some algorithm that is good at that?</p> <p>Colors need to follow some rules:</p> <ul> <li>they need to look nice</li> <li...
[ { "answer_id": 5651670, "author": "Niels Bosma", "author_id": 40939, "author_profile": "https://Stackoverflow.com/users/40939", "pm_score": 6, "selected": false, "text": "baseHue int n = 12;\n\nColor baseColor = System.Drawing.ColorTranslator.FromHtml(\"#8A56E2\");\ndouble baseHue = (new...
2008/10/25
[ "https://Stackoverflow.com/questions/236936", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31476/" ]
236,972
<p>Based on this question <a href="https://stackoverflow.com/questions/19746/views-in-seperate-assemblies-in-aspnet-mvc">here</a> and using code found <a href="http://www.codeproject.com/KB/aspnet/ASP2UserControlLibrary.aspx" rel="nofollow noreferrer">here</a> I'm trying to load views that are embedded resources in a s...
[ { "answer_id": 238363, "author": "jmcd", "author_id": 2285, "author_profile": "https://Stackoverflow.com/users/2285", "pm_score": 6, "selected": true, "text": "VirtualPathProvider Global.asax Application_Start return View(\"~/Plugin/YOURDLL.dll/FULLNAME_YOUR_VIEW.aspx\");" } ]
2008/10/25
[ "https://Stackoverflow.com/questions/236972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2285/" ]
236,979
<p>I'm creating a CSS editor and am trying to create a regular expression that can get data from a CSS document. This regex works if I have one property but I can't get it to work for all properties. I'm using preg/perl syntax in PHP.</p> <h3>Regex</h3> <pre><code>(?&lt;selector&gt;[A-Za-z]+[\s]*)[\s]*{[\s]*((?&lt;pr...
[ { "answer_id": 236984, "author": "Tanktalus", "author_id": 23512, "author_profile": "https://Stackoverflow.com/users/23512", "pm_score": 5, "selected": true, "text": "/([^{])\\s*\\{\\s*([^}]*?)\\s*}/\n" }, { "answer_id": 237381, "author": "dbr", "author_id": 745, "aut...
2008/10/25
[ "https://Stackoverflow.com/questions/236979", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2025/" ]
237,006
<p>I installed SQL Server 2005 sometime ago and forgot the administrator password I set during setup. How can I connect to SQL server now?</p> <p><strong>EDIT:</strong> I think I only allowed Sql Server Authentication. Login with integrated security also does not work.</p>
[ { "answer_id": 237025, "author": "cowgod", "author_id": 6406, "author_profile": "https://Stackoverflow.com/users/6406", "pm_score": 5, "selected": false, "text": "osql -E -S .\\SQLEXPRESS\nexec sp_password @new='changeme', @loginame='sa'\ngo\nalter login sa enable\ngo\nexit\n" }, { ...
2008/10/25
[ "https://Stackoverflow.com/questions/237006", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
237,027
<p>Here's my problem: I have a virtual method defined in a .h file that I want to call in a class that inherits from the base class. Sadly though, the method in the derived class doesn't get called. Is there a better way to implement what I'm trying to do?</p> <pre><code>#ifndef ofxBASE_SND_OBJ #define ofxBASE_SND_OBJ...
[ { "answer_id": 237034, "author": "Martin York", "author_id": 14065, "author_profile": "https://Stackoverflow.com/users/14065", "pm_score": 6, "selected": true, "text": "string ofxSndObj::createFilter(ofxBaseSndObj obj)\n string ofxSndObj::createFilter(ofxBaseSndObj& obj)\n class ofxBaseS...
2008/10/25
[ "https://Stackoverflow.com/questions/237027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/66105/" ]
237,041
<p>Does anyone know what will be in .NET 4.0?</p> <p>I found <a href="https://mef.svn.codeplex.com/svn/src/ComponentModel/System/Tuple.cs" rel="nofollow noreferrer">tuples on codeplex</a>:</p> <pre><code>.... // NOTE : this is a TEMPORARY and a very minimalistic implementation of Tuple'2, // as defined in http://dev...
[ { "answer_id": 237080, "author": "huseyint", "author_id": 39, "author_profile": "https://Stackoverflow.com/users/39", "pm_score": 1, "selected": false, "text": "// Instead of this:\nobject calc = GetCalculator();\nType calcType = calc.GetType();\nobject res = calcType.InvokeMember(\"Add\...
2008/10/25
[ "https://Stackoverflow.com/questions/237041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29788/" ]
237,044
<p>I'm trying to compile code from F# to use in Silverlight. I compile with:</p> <p>--noframework --cliroot "C:\program Files\Microsoft Silverlight\2.0.31005.0" --standalone</p> <p>This generates a standalone assembly that references the SL framework. But when I try to add a reference to the generated assembly, I ge...
[ { "answer_id": 245116, "author": "MichaelGG", "author_id": 27012, "author_profile": "https://Stackoverflow.com/users/27012", "pm_score": 4, "selected": true, "text": "C:\\test\\SilverlightApplication1\\FSC(0,0): error FS0193: internal error: the module/namespace 'System' from compilation...
2008/10/25
[ "https://Stackoverflow.com/questions/237044", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27012/" ]
237,058
<p>A string will be made up of certain symbols (ax,bx,dx,c,acc for example) and numbers.</p> <p>ex: ax 5 5 dx 3 acc c ax bx</p> <p>I want to replace one or all of the symbols (randomly) with another symbol of the same set. ie, replace one of {ax,bx,dx,c,acc} with one of {ax,bx,dx,c,acc}.</p> <p>replacement example: ...
[ { "answer_id": 237097, "author": "Bill the Lizard", "author_id": 1288, "author_profile": "https://Stackoverflow.com/users/1288", "pm_score": 0, "selected": false, "text": " String text = \"ax 5 5 dx 3 acc c ax bx\";\n System.out.println(\"Original: \" + text);\n String[] tokens ...
2008/10/25
[ "https://Stackoverflow.com/questions/237058", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27677/" ]
237,061
<p>I have several strings in the rough form:</p> <pre><code>[some text] [some number] [some more text] </code></pre> <p>I want to extract the text in [some number] using the Java Regex classes.</p> <p>I know roughly what regular expression I want to use (though all suggestions are welcome). What I'm really intereste...
[ { "answer_id": 237068, "author": "Allain Lalonde", "author_id": 2443, "author_profile": "https://Stackoverflow.com/users/2443", "pm_score": 10, "selected": true, "text": "private static final Pattern p = Pattern.compile(\"^([a-zA-Z]+)([0-9]+)(.*)\");\npublic static void main(String[] arg...
2008/10/25
[ "https://Stackoverflow.com/questions/237061", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3488/" ]
237,064
<p>i am trying to compile this very simple piece of code</p> <pre><code>class myList { public: std::vector&lt;std::string&gt; vec; class Items { public: void Add(std::string str) { myList::vec.push_back(str); }; }items; }; int main() { myList newList; ne...
[ { "answer_id": 237072, "author": "richq", "author_id": 4596, "author_profile": "https://Stackoverflow.com/users/4596", "pm_score": 5, "selected": true, "text": "#include <string>\n#include <vector>\nclass myList\n{\npublic:\n std::vector<std::string> vec;\n myList(): items(this) {}...
2008/10/25
[ "https://Stackoverflow.com/questions/237064", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28954/" ]
237,069
<p>I have a report that renders data returned from a stored procedure. Using profiler I can catch the call to the stored procedure from the reporting services.</p> <p>The report fails stating the report timed out yet I can execute the stored procedure from SSMS and it returns the data back in five to six seconds.</p>...
[ { "answer_id": 4679353, "author": "Robert Don-Duncan", "author_id": 574124, "author_profile": "https://Stackoverflow.com/users/574124", "pm_score": 2, "selected": false, "text": "CREATE PROCEDURE [dbo].[usp_REPORT_ITD001]\n@StartDate DATETIME,\n@EndDate DATETIME,\n@ReportTab INT\nAS\n\n-...
2008/10/25
[ "https://Stackoverflow.com/questions/237069", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19377/" ]
237,079
<p>What's the best cross-platform way to get file creation and modification dates/times, that works on both Linux and Windows?</p>
[ { "answer_id": 237084, "author": "Bryan Oakley", "author_id": 7432, "author_profile": "https://Stackoverflow.com/users/7432", "pm_score": 10, "selected": false, "text": "os.path.getmtime os.path.getctime import os.path, time\nprint(\"last modified: %s\" % time.ctime(os.path.getmtime(file...
2008/10/25
[ "https://Stackoverflow.com/questions/237079", "https://Stackoverflow.com", "https://Stackoverflow.com/users/305/" ]
237,085
<p>It's possible to write <a href="http://en.wikipedia.org/wiki/Markdown" rel="noreferrer">Markdown</a> content with invalid syntax. Invalid means that the <a href="http://www.deveiate.org/projects/BlueCloth" rel="noreferrer">BlueCloth</a> library fails to parse the content and throws an exception. The <code>markdown</...
[ { "answer_id": 237200, "author": "Damir Zekić", "author_id": 401510, "author_profile": "https://Stackoverflow.com/users/401510", "pm_score": 4, "selected": true, "text": "to_html protected:\n\ndef validate\n bc = BlueCloth.new(your_markdown_string_attribute)\n begin\n bc.to_html\n ...
2008/10/25
[ "https://Stackoverflow.com/questions/237085", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20467/" ]
237,104
<p>What is the most concise and efficient way to find out if a JavaScript array contains a value?</p> <p>This is the only way I know to do it:</p> <pre><code>function contains(a, obj) { for (var i = 0; i &lt; a.length; i++) { if (a[i] === obj) { return true; } } return false; } <...
[ { "answer_id": 237148, "author": "cic", "author_id": 4771, "author_profile": "https://Stackoverflow.com/users/4771", "pm_score": 8, "selected": false, "text": "indexOf [1, 2, 3].indexOf(1) => 0\n[\"foo\", \"bar\", \"baz\"].indexOf(\"bar\") => 1\n[1, 2, 3].indexOf(4) => -1\n indexOf" },...
2008/10/25
[ "https://Stackoverflow.com/questions/237104", "https://Stackoverflow.com", "https://Stackoverflow.com/users/208/" ]
237,106
<p>I have a legacy DLL written in C that contains a function that returns a string, and I need to access this function from Delphi. The only info I have about the DLL is the VB declare for accessing the function:</p> <p>Public Declare Function DecryptStr Lib "strlib" (Str As String) As String </p> <p>I've tried the f...
[ { "answer_id": 237276, "author": "Mohammed Nasman", "author_id": 24462, "author_profile": "https://Stackoverflow.com/users/24462", "pm_score": 0, "selected": false, "text": "function DecryptStr(s: PChar): PChar; stdcall; external 'strlib.dll';\n" }, { "answer_id": 237690, "au...
2008/10/25
[ "https://Stackoverflow.com/questions/237106", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31510/" ]
237,107
<p>What is the simplest way to send mail using Ruby on Rails? Is there a way to send mail directly via ruby and skip all the rails models and complexity, just like php's mail() function?</p> <p>Thanks for your help.</p>
[ { "answer_id": 774314, "author": "Joe W.", "author_id": 3459, "author_profile": "https://Stackoverflow.com/users/3459", "pm_score": 4, "selected": false, "text": "require 'net/smtp'\nNet::SMTP.start('smtp.example.com', 25) do |smtp|\n smtp.send_message \"Subject: testing from ruby\", 'f...
2008/10/25
[ "https://Stackoverflow.com/questions/237107", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9776/" ]
237,112
<p>Working on a project where a sequential set of methods must be run every <code>x</code> seconds. Right now I have the methods contained within another "parent method", and just sequentially call them right after another.</p> <pre><code>class DoTheseThings() { DoThis(); NowDoThat(); NowDoThis(); Mor...
[ { "answer_id": 237122, "author": "nyxtom", "author_id": 19753, "author_profile": "https://Stackoverflow.com/users/19753", "pm_score": 0, "selected": false, "text": "lock (resource) \n{\n Dosomething(resource);\n}\n" }, { "answer_id": 237130, "author": "Ovidiu Pacurar", ...
2008/10/25
[ "https://Stackoverflow.com/questions/237112", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25300/" ]
237,124
<p>I'm doing some research work into content aggregators, and I'm curious how some of the current craigslist aggregators get data into their mashups.</p> <p>For example, www.housingmaps.com and the now closed www.chicagocrime.org</p> <p>If there is a URL that can be used for reference, that would be perfect!</p>
[ { "answer_id": 245284, "author": "cfay", "author_id": 20440, "author_profile": "https://Stackoverflow.com/users/20440", "pm_score": 4, "selected": false, "text": "//scrape category data\n$h = new http();\n$h->dir = \"../cache/\"; \n$url = \"http://craigslist.org/\";\n\nif (!$h->fetch($ur...
2008/10/25
[ "https://Stackoverflow.com/questions/237124", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24126/" ]
237,128
<p>I know that python has a <code>len()</code> function that is used to determine the size of a string, but I was wondering why it's not a method of the string object?</p>
[ { "answer_id": 237133, "author": "Alex Coventry", "author_id": 1941213, "author_profile": "https://Stackoverflow.com/users/1941213", "pm_score": 4, "selected": false, "text": "met% python -c 'import this' | grep 'only one'\nThere should be one-- and preferably only one --obvious way to d...
2008/10/25
[ "https://Stackoverflow.com/questions/237128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10708/" ]
237,131
<p>I have a <code>JPanel</code> extension that I've written and would like to be able to use it in the NetBeans designer. The component is simply adds some custom painting and continues to function as a container to be customised on each use. </p> <p>I have properties to expose in addition to the standard <code>JPan...
[ { "answer_id": 242551, "author": "Chobicus", "author_id": 1514822, "author_profile": "https://Stackoverflow.com/users/1514822", "pm_score": 3, "selected": true, "text": "@Override\npublic void paint(Graphics g) {\n super.paint(g);\n Graphics2D g2 = (Graphics2D) g;\n ...\n //d...
2008/10/25
[ "https://Stackoverflow.com/questions/237131", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1867/" ]
237,140
<p>I was re-reading Effective Java (2nd edition) item 18, <a href="http://my.safaribooksonline.com/9780137150021/ch04lev1sec6" rel="nofollow noreferrer">prefer interfaces to abstract classes</a>. In that item Josh Bloch provides an example of a skeletal implementation of the <code>Map.Entry&lt;K,V&gt;</code> interface...
[ { "answer_id": 237194, "author": "Alan", "author_id": 17205, "author_profile": "https://Stackoverflow.com/users/17205", "pm_score": 0, "selected": false, "text": "AbstractMapEntry#getKey getValue Map.Entry Map Map.Entry Map Map Map.Entry AbstractMapEntry#getKey getValue Map HashMap Concu...
2008/10/25
[ "https://Stackoverflow.com/questions/237140", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8217/" ]
237,145
<p>I have a radio button on my Windows Form. How can I determine if the CheckChanged event occurred due to a user clicking or selecting the radio button vs programatically setting the event with </p> <pre><code>this.radioButtonAdd.Checked = true; </code></pre> <p>I would like some code to take a different action depe...
[ { "answer_id": 237153, "author": "Andru Luvisi", "author_id": 5922, "author_profile": "https://Stackoverflow.com/users/5922", "pm_score": 2, "selected": false, "text": "savedFlag = modifyingProgrammatically;\nmodifyingProgrammatically = true;\nthis.radioButtonAdd.Checked = true;\nmodifin...
2008/10/25
[ "https://Stackoverflow.com/questions/237145", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1496/" ]
237,155
<p>Is there a way to accept input from more than one mouse separately? I'm interested in making a multi-user application and I thought it would be great if I could have 2 or more users holding wireless mice each interacting with the app individually with a separate mouse arrow.</p> <p>Is this something I should try to...
[ { "answer_id": 237190, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 1, "selected": false, "text": "IDirectInput8::EnumDevices() IDirectInputDevice8::Poll()" } ]
2008/10/25
[ "https://Stackoverflow.com/questions/237155", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2908/" ]
237,159
<p>I normally use the following idiom to check if a String can be converted to an integer.</p> <pre><code>public boolean isInteger( String input ) { try { Integer.parseInt( input ); return true; } catch( Exception e ) { return false; } } </code></pre> <p>Is it just me, or does ...
[ { "answer_id": 237161, "author": "Kristian", "author_id": 11429, "author_profile": "https://Stackoverflow.com/users/11429", "pm_score": 2, "selected": false, "text": "return Pattern.matches(\"-?\\\\d+\", input);\n" }, { "answer_id": 237163, "author": "Ovidiu Pacurar", "au...
2008/10/25
[ "https://Stackoverflow.com/questions/237159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1288/" ]
237,196
<p>I'm experimenting with the NavBar sample project for iPhone. When I tap on one of the rows in the table in the default view a new view slides in (so far so good). I want to remove the UINavigationBar bar at the top of the new view that slides in. How can I do this? </p> <p>EDIT: I meant "UINavigationBar". Than...
[ { "answer_id": 237202, "author": "user31517", "author_id": 31517, "author_profile": "https://Stackoverflow.com/users/31517", "pm_score": 2, "selected": false, "text": "[[UIApplication sharedApplication]setHidesStatusBar:YES];\n" }, { "answer_id": 237208, "author": "Ben Gottli...
2008/10/25
[ "https://Stackoverflow.com/questions/237196", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22471/" ]
237,201
<p>I'm trying to perform a simple LINQ query on the Columns property of a DataTable:</p> <pre><code>from c in myDataTable.Columns.AsQueryable() select c.ColumnName </code></pre> <p>However, what I get is this:</p> <blockquote> <p>Could not find an implementation of the query pattern for source type 'System.Lin...
[ { "answer_id": 237224, "author": "Dave Markle", "author_id": 24995, "author_profile": "https://Stackoverflow.com/users/24995", "pm_score": 8, "selected": true, "text": "var x = from c in dt.Columns.Cast<DataColumn>()\n select c.ColumnName;\n" }, { "answer_id": 9996173, ...
2008/10/25
[ "https://Stackoverflow.com/questions/237201", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31516/" ]
237,209
<p>Any python libs for parsing apache config files or if not python anyone aware of such thing in other languages (perl, php, java, c#)? As i'll be able to rewrite them in python.</p>
[ { "answer_id": 237215, "author": "Michael Gundlach", "author_id": 4105, "author_profile": "https://Stackoverflow.com/users/4105", "pm_score": 1, "selected": false, "text": "Package: libapache-configfile-perl\nPriority: optional\nSection: interpreters\nInstalled-Size: 124\nMaintainer: Mic...
2008/10/25
[ "https://Stackoverflow.com/questions/237209", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9789/" ]
237,218
<p>I am working on an application that uses several large canvas controls (several thousand pixels across), layered on top of each other. The canvas controls themselves are completely invisible, but each contains a number of controls, mainly images.</p> <p>My question is, is there a recommended maximum size for a can...
[ { "answer_id": 241465, "author": "David Schmitt", "author_id": 4918, "author_profile": "https://Stackoverflow.com/users/4918", "pm_score": 2, "selected": true, "text": "Canvas Canvas" } ]
2008/10/25
[ "https://Stackoverflow.com/questions/237218", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10086/" ]
237,220
<p>I'm looking for an algorithm that places tick marks on an axis, given a range to display, a width to display it in, and a function to measure a string width for a tick mark.</p> <p>For example, given that I need to display between 1e-6 and 5e-6 and a width to display in pixels, the algorithm would determine that I ...
[ { "answer_id": 42593802, "author": "Giorgio Barchiesi", "author_id": 681877, "author_profile": "https://Stackoverflow.com/users/681877", "pm_score": 1, "selected": false, "text": "protected double calculateInterval(double range) {\n double x = Math.pow(10.0, Math.floor(Math.log10(rang...
2008/10/25
[ "https://Stackoverflow.com/questions/237220", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1490/" ]
237,222
<p>This code:</p> <pre><code>public class WidgetPlatform { public Widget LeftmostWidget { get; set; } public Widget RightmostWidget { get; set; } public String GetWidgetNames() { return LeftmostWidget.Name + " " + RightmostWidget.Name; } } </code></pre> <p>doesn't contain any repetition w...
[ { "answer_id": 237248, "author": "Eoin Campbell", "author_id": 30155, "author_profile": "https://Stackoverflow.com/users/30155", "pm_score": 3, "selected": false, "text": "public class WidgetPlatform\n{\n public Widget LeftmostWidget { get; set; }\n public Widget RightmostWidget { ...
2008/10/25
[ "https://Stackoverflow.com/questions/237222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30761/" ]
237,235
<p>In my django application I am using a template to construct email body, one of the parameters is url, note there are two parametes separated by ampersand in the url.</p> <pre><code>t = loader.get_template("sometemplate") c = Context({ 'foo': 'bar', 'url': 'http://127.0.0.1/test?a=1&amp;b=2', }) print t.render...
[ { "answer_id": 237243, "author": "Jonny Buchanan", "author_id": 6760, "author_profile": "https://Stackoverflow.com/users/6760", "pm_score": 6, "selected": true, "text": "mark_safe from django.utils.safestring import mark_safe\n\nt = loader.get_template(\"sometemplate\")\nc = Context({\n ...
2008/10/26
[ "https://Stackoverflow.com/questions/237235", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26592/" ]
237,254
<p>The <a href="http://docs.jquery.com/Events/bind#typedatafn" rel="noreferrer">jQuery documentation</a> says the library has built-in support for the following events: blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select,...
[ { "answer_id": 238835, "author": "Már Örlygsson", "author_id": 16271, "author_profile": "https://Stackoverflow.com/users/16271", "pm_score": 8, "selected": true, "text": ".on() off() jQuery(document).on('paste', function(e){ alert('pasting!') });\n jQuery('p').on('foobar2000', function(e...
2008/10/26
[ "https://Stackoverflow.com/questions/237254", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11577/" ]
237,268
<p>Doing like so:</p> <p><code>Shell ("C:\Program Files\Internet Explorer\iexplore.exe -embedding http://www.websiteurl.com")</code></p> <p>Doesn't work how I need it as I essentially need it to be able to redirect and prompt a user to download a file. Any ideas?</p>
[ { "answer_id": 237271, "author": "Dave Markle", "author_id": 24995, "author_profile": "https://Stackoverflow.com/users/24995", "pm_score": 1, "selected": false, "text": "wget" }, { "answer_id": 239493, "author": "Tomalak", "author_id": 18771, "author_profile": "https:...
2008/10/26
[ "https://Stackoverflow.com/questions/237268", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
237,269
<p>I am thinking of running this custom targets to find out more about my project build status - jalopy - jdepend - cvs tagdiff report - custom task for NoUnit - generate UML diagram. ESS-Model</p> <p>What are your views?</p>
[ { "answer_id": 240701, "author": "jim", "author_id": 27628, "author_profile": "https://Stackoverflow.com/users/27628", "pm_score": 1, "selected": false, "text": "<target name=\"statsAll\">\n <!-- master file that describes where everything is -->\n <property file=\"./ant/ant-global...
2008/10/26
[ "https://Stackoverflow.com/questions/237269", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
237,275
<p>I'm constructing a method to take in an ArrayList(presumably full of objects) and then list all the fields(and their values) for each object in the ArrayList.</p> <p>Currently my code is as follows:</p> <pre><code>public static void ListArrayListMembers(ArrayList list) { foreach (Object obj in list) ...
[ { "answer_id": 237278, "author": "Dave Markle", "author_id": 24995, "author_profile": "https://Stackoverflow.com/users/24995", "pm_score": 6, "selected": true, "text": "foreach (Object obj in list) {\n Type type = obj.GetType();\n\n foreach (var f in type.GetFields().Where(f => f.I...
2008/10/26
[ "https://Stackoverflow.com/questions/237275", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2153/" ]
237,282
<p>At work, we have one of those nasty communal urinals. There is no flush handle. Rather, it has a motion sensor that sometimes triggers when you stand in front of it and sometimes doesn't. When it triggers, a tank fills, which when full is used to flush the urinal.</p> <p>In my many trips before this nastraption, I ...
[ { "answer_id": 237315, "author": "Gerald", "author_id": 19404, "author_profile": "https://Stackoverflow.com/users/19404", "pm_score": 5, "selected": true, "text": "OnUserEnter()\n{\n if (UsersDetected == 0)\n {\n FirstDetectionTime = Now();\n }\n UsersDetected++;\n Current...
2008/10/26
[ "https://Stackoverflow.com/questions/237282", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11577/" ]
237,285
<p>At my workplace, we tend to use <strong>iostream</strong>, <strong>string</strong>, <strong>vector</strong>, <strong>map</strong>, and the odd <strong>algorithm</strong> or two. We haven't actually found many situations where template techniques were a best solution to a problem.</p> <p>What I am looking for here...
[ { "answer_id": 237294, "author": "Brian R. Bondy", "author_id": 3153, "author_profile": "https://Stackoverflow.com/users/3153", "pm_score": 4, "selected": false, "text": "template <int N>\nstruct Factorial \n{\n enum { value = N * Factorial<N - 1>::value };\n};\n\ntemplate <>\nstruct ...
2008/10/26
[ "https://Stackoverflow.com/questions/237285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7734/" ]
237,289
<p>I'm looking for a way to configure the color used for line numbering (as in: <code>:set nu</code>) in Vim. The default on most platforms seems to be yellow (which is also used for some highlighted tokens). I would <em>like</em> to color the line numbers a dim gray; somewhere in the vicinity of <code>#555</code>. ...
[ { "answer_id": 237293, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 8, "selected": true, "text": "help hl-LineNr\n help 'number'\n 'number' :number :highlight LineNr ctermfg=grey\n :highlight LineNr guifg=#050505\n" },...
2008/10/26
[ "https://Stackoverflow.com/questions/237289", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9815/" ]
237,310
<p>I'm currently displaying a UIViewController like this:</p> <pre><code>[[self navigationController] presentModalViewController:modalViewController animated:YES]; </code></pre> <p>and hiding it like this:</p> <pre><code>[self.navigationController dismissModalViewControllerAnimated:YES]; </code></pre> <p>The animat...
[ { "answer_id": 237355, "author": "Ben Gottlieb", "author_id": 6694, "author_profile": "https://Stackoverflow.com/users/6694", "pm_score": 7, "selected": true, "text": "UIViewController *controller = [[[MyViewController alloc] init] autorelease];\nUIViewAnimationTransition trans = UIViewA...
2008/10/26
[ "https://Stackoverflow.com/questions/237310", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22471/" ]
237,322
<p>You'd think it would be easy, but keep reading. I can change many of the styles associated with a resizable JQuery Dialog, but not the handles. The code below isolates the problem. Why does the handle disappear entirely? There must be some logic I'm interfering with in ui.resizable.js, but I don't see it.</p> ...
[ { "answer_id": 237393, "author": "scunliffe", "author_id": 6144, "author_profile": "https://Stackoverflow.com/users/6144", "pm_score": 0, "selected": false, "text": ".ui-resizable-n{\n background-image:none;\n background-color:green;\n}\n" } ]
2008/10/26
[ "https://Stackoverflow.com/questions/237322", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9328/" ]
237,326
<p>In particular, would it be possible to have <strong>code similar to this c++ code executed at compile time in c#</strong>?</p> <pre><code>template &lt;int N&gt; struct Factorial { enum { value = N * Factorial&lt;N - 1&gt;::value }; }; template &lt;&gt; struct Factorial&lt;0&gt; { enum { value = 1 }; }; ...
[ { "answer_id": 237513, "author": "JaredPar", "author_id": 23283, "author_profile": "https://Stackoverflow.com/users/23283", "pm_score": 2, "selected": false, "text": "static string SomeFunc<T>(T value) {\n return \"Generic\";\n}\nstatic string SomeFunc(int value) {\n return \"Non-G...
2008/10/26
[ "https://Stackoverflow.com/questions/237326", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3153/" ]
237,327
<p>The UPSERT operation either updates or inserts a row in a table, depending if the table already has a row that matches the data:</p> <pre><code>if table t has a row exists that has key X: update t set mystuff... where mykey=X else insert into t mystuff... </code></pre> <p>Since Oracle doesn't have a specif...
[ { "answer_id": 237328, "author": "Mark Harrison", "author_id": 116, "author_profile": "https://Stackoverflow.com/users/116", "pm_score": 8, "selected": false, "text": "create or replace\nprocedure ups(xa number)\nas\nbegin\n merge into mergetest m using dual on (a = xa)\n when...
2008/10/26
[ "https://Stackoverflow.com/questions/237327", "https://Stackoverflow.com", "https://Stackoverflow.com/users/116/" ]
237,350
<p>I am trying to call a setTimeout from within a setInterval callback:</p> <pre><code>function callback() { //assign myVar var myVar = document.getElementById("givenID"); //... //now wait 2 secs then call some code that uses myVAr setTimeout("myVar.innerHTML = 'TEST'", 2000); } setInterval("callback()...
[ { "answer_id": 237375, "author": "Michael Gundlach", "author_id": 4105, "author_profile": "https://Stackoverflow.com/users/4105", "pm_score": 1, "selected": false, "text": "\"someFunction();\" \"alert('hi')\"" }, { "answer_id": 237387, "author": "Andrew Hedges", "author_i...
2008/10/26
[ "https://Stackoverflow.com/questions/237350", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1311500/" ]
237,367
<p>When I connect to a MySQL database using PDO, the way I need to connect is:</p> <pre><code>$pdoConnection = new PDO("mysql:host=hostname;dbname=databasename",user,password); </code></pre> <p>But, for PostgreSQL, the DSN is more standard (IMO):</p> <pre><code>$pdoConnection = new PDO("pgsql:host=hostname;dbname=da...
[ { "answer_id": 37436321, "author": "mindplay.dk", "author_id": 283851, "author_profile": "https://Stackoverflow.com/users/283851", "pm_score": 2, "selected": false, "text": "parse_str($connection_string, $params);\n\n$pdo = new PDO($params['dsn'], @$params['username'], @$params['password...
2008/10/26
[ "https://Stackoverflow.com/questions/237367", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23089/" ]
237,370
<p>In some code I've inherited, I see frequent use of <code>size_t</code> with the <code>std</code> namespace qualifier. For example:</p> <pre><code>std::size_t n = sizeof( long ); </code></pre> <p>It compiles and runs fine, of course. But it seems like bad practice to me (perhaps carried over from C?).</p> <p>Isn...
[ { "answer_id": 237395, "author": "ypnos", "author_id": 21974, "author_profile": "https://Stackoverflow.com/users/21974", "pm_score": 2, "selected": false, "text": "int main(int argc, char** argv) {\nsize_t size;\n}\n <cstdlib>" }, { "answer_id": 237882, "author": "fizzer", ...
2008/10/26
[ "https://Stackoverflow.com/questions/237370", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10559/" ]
237,377
<p>Is there a better way to do this?</p> <pre><code>string[] s = {"zero", "one", "two", "three", "four", "five"}; var x = s .Select((a,i) =&gt; new {Value = a, Index = i}) .Where(b =&gt; b.Value.StartsWith("t")) .Select(c =&gt; c.Index); </code></pre> <p>i.e. I'm looking for a more efficient or more elegant way to ...
[ { "answer_id": 237379, "author": "Mark S. Rasmussen", "author_id": 12469, "author_profile": "https://Stackoverflow.com/users/12469", "pm_score": 3, "selected": false, "text": ".Select((Value, Index) => new {Value, Index})\n" }, { "answer_id": 237451, "author": "tvanfosson", ...
2008/10/26
[ "https://Stackoverflow.com/questions/237377", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1463/" ]
237,383
<p>Is possible to insert a line break where the cursor is in Vim without entering into insert mode? Here's an example (<code>[x]</code> means cursor is on <code>x</code>):</p> <pre><code>if (some_condition) {[ ]return; } </code></pre> <p>Occasionally, I might want to enter some more code. So I'd press <kbd>i</kbd> to...
[ { "answer_id": 237436, "author": "Adam Liss", "author_id": 29157, "author_profile": "https://Stackoverflow.com/users/29157", "pm_score": 4, "selected": false, "text": ":map g i[Ctrl+V][Enter][Ctrl+V][Esc][Enter]\n :map g i^M^[\n f}i^M^[O" }, { "answer_id": 237471, "author": "...
2008/10/26
[ "https://Stackoverflow.com/questions/237383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1103052/" ]
237,408
<p>I have a local Git repository I've been developing under for a few days: it has eighteen commits so far. Tonight, I created a private Github repository I was hoping to push it to; however, when I did so, it only ended up pushing eight of the eighteen commits to Github. I deleted the Github repo and retried, with the...
[ { "answer_id": 237409, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 1, "selected": false, "text": "git fsck" }, { "answer_id": 237517, "author": "CesarB", "author_id": 28258, "author_profile": "https:...
2008/10/26
[ "https://Stackoverflow.com/questions/237408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23498/" ]
237,415
<p>I'm attempting to use LINQ to insert a record into a child table and I'm receiving a "Specified cast is not valid" error that has something to do w/ the keys involved. The stack trace is:</p> <blockquote> <p>Message: Specified cast is not valid.</p> <p>Type: System.InvalidCastException Source: System.Da...
[ { "answer_id": 237426, "author": "FlySwat", "author_id": 1965, "author_profile": "https://Stackoverflow.com/users/1965", "pm_score": 0, "selected": false, "text": "ResponseCode rc = new ResponseCode()\n {\n SurveyQuestionName = \"Q11\",\n Code = 3,\n Description = \"...
2008/10/26
[ "https://Stackoverflow.com/questions/237415", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
237,423
<p>I have written this generator code but it returns 'can't convert nil into String' when I call m.directory inside the manifest. Anyone know what had happened?</p> <pre><code>class AuthGenerator &lt; Rails::Generator::NamedBase attr_reader :user_class_name def initialize(runtime_args, runtime_options={}) @use...
[ { "answer_id": 238252, "author": "Ian Terrell", "author_id": 9269, "author_profile": "https://Stackoverflow.com/users/9269", "pm_score": 1, "selected": false, "text": "directory m.directory File.join('app/models')\n" } ]
2008/10/26
[ "https://Stackoverflow.com/questions/237423", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16371/" ]
237,425
<p>What are the coolest examples of metaprogramming that you've seen in C++?<br> What are some practical uses of metaprogramming that you've seen in C++?</p>
[ { "answer_id": 237499, "author": "JaredPar", "author_id": 23283, "author_profile": "https://Stackoverflow.com/users/23283", "pm_score": 5, "selected": false, "text": " void SomeMethod(IFoo* pFoo) {\n CFooImpl *p = (CFooImpl)pFoo;\n }\n template <typename T>\nCComPtr<T>& operat...
2008/10/26
[ "https://Stackoverflow.com/questions/237425", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3153/" ]
237,432
<p>I have a base class with a property which (the get method) I want to overwrite in the subclass. My first thought was something like:</p> <pre><code>class Foo(object): def _get_age(self): return 11 age = property(_get_age) class Bar(Foo): def _get_age(self): return 44 </code></pre> <p...
[ { "answer_id": 237461, "author": "Kozyarchuk", "author_id": 52490, "author_profile": "https://Stackoverflow.com/users/52490", "pm_score": 2, "selected": false, "text": "class HackedProperty(object):\n def __init__(self, f):\n self.f = f\n def __get__(self, inst, owner): \...
2008/10/26
[ "https://Stackoverflow.com/questions/237432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/720/" ]
237,440
<p>I have a problem whereby I want to display a view differently (a different master page), depending on where it came from, but don't know where to start...</p> <p>I have several routes which catch various different types of urls that contain different structures.</p> <p>In the code snippet below, I have a product r...
[ { "answer_id": 362423, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": "public class FriViewPage : ViewPage\n{\n public override string MasterPageFile\n {\n get\n {\n ...
2008/10/26
[ "https://Stackoverflow.com/questions/237440", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31532/" ]
237,464
<p>Many languages have a facility to check to see if an Object is of a certain type (including parent subclasses), implemented with 'is' and used like this:</p> <pre><code>if(obj is MyType) </code></pre> <p>Or slightly more tediously you can in other languages check by using the 'as' keyword to do a soft typecast and...
[ { "answer_id": 237467, "author": "nickf", "author_id": 9021, "author_profile": "https://Stackoverflow.com/users/9021", "pm_score": 5, "selected": true, "text": "if (objectReference instanceof type){\n //Your code goes here\n}\n" }, { "answer_id": 237469, "author": "Alan", ...
2008/10/26
[ "https://Stackoverflow.com/questions/237464", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
237,487
<p>I am working with a peripheral device that needs to be communicated through serial. I can send it commands using HyperTerminal, but now I need to write programs that will let me do it without HyperTerminal. Can somebody point me to a website and/or show me a sample hello world program to get me started? I have se...
[ { "answer_id": 237491, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 3, "selected": false, "text": "CreateFile() ReadFile() WriteFile() fopen() fread() fwrite()" } ]
2008/10/26
[ "https://Stackoverflow.com/questions/237487", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
237,542
<p>I'm using GCC; __FILE__ returns the current source file's entire path and name: <code>/path/to/file.cpp</code>. Is there a way to get just the file's name <code>file.cpp</code> (without its path) at compile time? Is it possible to do this in a portable way? Can template meta programming be applied to strings?</p> <...
[ { "answer_id": 237563, "author": "Andru Luvisi", "author_id": 5922, "author_profile": "https://Stackoverflow.com/users/5922", "pm_score": 3, "selected": false, "text": "#line 1 \"filename.c\"\n __FILE__ __FILE__" }, { "answer_id": 237633, "author": "1800 INFORMATION", "au...
2008/10/26
[ "https://Stackoverflow.com/questions/237542", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3175/" ]
237,553
<p>Google chrome doesn't behave the same as other browsers when encountering this nugget:</p> <pre><code>&lt;?php while (true) { echo "&lt;script type='text/javascript'&gt;\n"; echo "alert('hello');\n"; echo "&lt;/script&gt;"; flush(); sleep(5); } ?&gt; </code></pre> <p>It seems that it's waiting...
[ { "answer_id": 237616, "author": "Peter Burns", "author_id": 101, "author_profile": "https://Stackoverflow.com/users/101", "pm_score": 1, "selected": false, "text": "</script> <script>" }, { "answer_id": 796691, "author": "Community", "author_id": -1, "author_profile"...
2008/10/26
[ "https://Stackoverflow.com/questions/237553", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2443/" ]
237,561
<p>Edit: This code is fine. I found a logic bug somewhere that doesn't exist in my pseudo code. I was blaming it on my lack of Java experience.</p> <p>In the <strong>pseudo code</strong> below, I'm trying to parse the XML shown. A silly example maybe but my code was too large/specific for anyone to get any real val...
[ { "answer_id": 237596, "author": "Andru Luvisi", "author_id": 5922, "author_profile": "https://Stackoverflow.com/users/5922", "pm_score": 2, "selected": true, "text": "characters() setColor() setAge()" }, { "answer_id": 237774, "author": "Jack Leow", "author_id": 31506, ...
2008/10/26
[ "https://Stackoverflow.com/questions/237561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22917/" ]
237,585
<p>At what point would you create your own exception class vs. using java.lang.Exception? (All the time? Only if it will be used outside the package? Only if it must contain advanced logic? etc...)</p>
[ { "answer_id": 237892, "author": "alex", "author_id": 26787, "author_profile": "https://Stackoverflow.com/users/26787", "pm_score": 4, "selected": false, "text": "catch(ExistingException e) {\n if({condition}) {\n { some stuff here}\n }\n else {\n { different stuff here}\n }\n}...
2008/10/26
[ "https://Stackoverflow.com/questions/237585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30323/" ]
237,621
<p>I'm new with Objective-C, so there probably is a simple solution to this.</p> <p>I want a number to increment, but each iteration to be show on a label. (for example, it shows 1, 2, 3, 4, 5... displayed apart by an amount of time).</p> <p>I tried:</p> <pre><code>#import "testNums.h" @implementation testNums - (I...
[ { "answer_id": 237629, "author": "jtbandes", "author_id": 23649, "author_profile": "https://Stackoverflow.com/users/23649", "pm_score": 2, "selected": false, "text": "NSTimer" }, { "answer_id": 237683, "author": "Peter Hosey", "author_id": 30461, "author_profile": "ht...
2008/10/26
[ "https://Stackoverflow.com/questions/237621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31549/" ]
237,631
<p>I have two PHP files that I need to link. How can I link the files together using PHP? The effect I want is to have the user click a button, some information is proccessed on the page, and then the result is displayed in a different page, depending on the button the user clicked.Thanks</p>
[ { "answer_id": 237637, "author": "jtbandes", "author_id": 23649, "author_profile": "https://Stackoverflow.com/users/23649", "pm_score": 3, "selected": false, "text": "<form method=\"post\" action=\"other_file.php\">\n <input name=\"foo\" type=\"...\"... /> ...\n</form>\n $_POST[\"foo\...
2008/10/26
[ "https://Stackoverflow.com/questions/237631", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24391/" ]
237,675
<p>Here's what I am trying to do:</p> <p>Select text from a webpage I pulled up using my web browser control.After clicking a button while this text is still selected I would like a message box to pop-up displaying the text that was highlighted by the user. How do I get this functionality to work in my wpf application...
[ { "answer_id": 237710, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 2, "selected": false, "text": "WebBrowser WebBrowser webBook.Document.Title = \"foo\";\n .Document.ActiveElement" } ]
2008/10/26
[ "https://Stackoverflow.com/questions/237675", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
237,691
<p>I been waiting for sometime now to bring my Asp.net Preview 4 project up to snuff, totally skipping Preview 5 just because I knew I would have some issues.</p> <p>Anyhow, here is the question and dilemma.</p> <p>I have a few areas on the site which I have an ajax update type panel that renders content from a view ...
[ { "answer_id": 258943, "author": "Andrew Stanton-Nurse", "author_id": 29813, "author_profile": "https://Stackoverflow.com/users/29813", "pm_score": 1, "selected": false, "text": "<% using (this.Ajax.BeginForm(\"ReportOne\", \"Reports\", null, new AjaxOptions { UpdateTargetId = \"panel1\"...
2008/10/26
[ "https://Stackoverflow.com/questions/237691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22093/" ]
237,699
<p>So lets say I'm using Python's <a href="http://www.python.org/doc/2.5.2/lib/module-ftplib.html" rel="nofollow noreferrer">ftplib</a> to retrieve a list of log files from an FTP server. How would I parse that list of files to get just the file names (the last column) inside a list? See the link above for example outp...
[ { "answer_id": 237704, "author": "Mohit Ranka", "author_id": 2220518, "author_profile": "https://Stackoverflow.com/users/2220518", "pm_score": 0, "selected": false, "text": "file_name_list = [' '.join(each_file.split()).split()[-1] for each_file_detail in file_list_from_log]\n" }, { ...
2008/10/26
[ "https://Stackoverflow.com/questions/237699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1512/" ]
237,703
<p>In cmd.exe, I can execute the command "copy c:\hello.txt c:\hello2.txt" and it worked fine. But in my C program, I ran this piece of code and got the following error:</p> <pre><code>#include &lt;iostream&gt; using namespace std; int main() { system("copy c:\hello.txt c:\hello2.txt"); system("pause"); ...
[ { "answer_id": 237706, "author": "paxdiablo", "author_id": 14860, "author_profile": "https://Stackoverflow.com/users/14860", "pm_score": 5, "selected": true, "text": "\\ \\\\ \\t \\r \\n \\ '\\' \\\\ system(\"copy c:\\\\hello.txt c:\\\\hello2.txt\");\n FILE *fh = fopen (\"c:\\text.dat\",...
2008/10/26
[ "https://Stackoverflow.com/questions/237703", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
237,716
<p>std::next_permutation (and std::prev_permutation) permute all values in the range <code>[first, last)</code> given for a total of n! permutations (assuming that all elements are unique).</p> <p>is it possible to write a function like this:</p> <pre><code>template&lt;class Iter&gt; bool next_permutation(Iter first,...
[ { "answer_id": 237779, "author": "fizzer", "author_id": 18167, "author_profile": "https://Stackoverflow.com/users/18167", "pm_score": 3, "selected": true, "text": "for_each_permutation() next_permutation()" }, { "answer_id": 237802, "author": "David Schmitt", "author_id":...
2008/10/26
[ "https://Stackoverflow.com/questions/237716", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5963/" ]
237,725
<p>I've tried downloading the Rails package and installing it on Windows, but have no idea to make it work.</p> <p>I have had some experience with this commbination:</p> <ul> <li>PHP 4.x + 5.x (Windows)</li> <li>LIGHTTPD (Windows)</li> <li>Connecting to a Firebird Database (Windows)</li> </ul> <p>Can anybody enlight...
[ { "answer_id": 241206, "author": "Owen", "author_id": 2109, "author_profile": "https://Stackoverflow.com/users/2109", "pm_score": 4, "selected": true, "text": "ruby setup.rb gem install rails" }, { "answer_id": 1717151, "author": "Luis Lavena", "author_id": 117298, "a...
2008/10/26
[ "https://Stackoverflow.com/questions/237725", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30787/" ]
237,733
<p>I've been a bad programmer because I am doing a copy and paste. An example is that everytime i connect to a database and retrieve a recordset, I will copy the previous code and edit, copy the code that sets the datagridview and edit. I am aware of the phrase code reuse, but I have not actually used it. How can i uti...
[ { "answer_id": 237773, "author": "Colin Barrett", "author_id": 23106, "author_profile": "https://Stackoverflow.com/users/23106", "pm_score": 3, "selected": false, "text": "printf printf write //convert theInt to a string and write it out.\nchar c[24];\nitoa(theInt, c, 10);\nputs(c);\n pr...
2008/10/26
[ "https://Stackoverflow.com/questions/237733", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26087/" ]
237,745
<p>Does any one know of some kind of Comparator factory in Java, with a </p> <pre><code>public Comparator getComparatorForClass(Class clazz) {} </code></pre> <p>It would return Comparators for stuff like String, Double, Integer but would have a</p> <pre><code>public void addComparatorForClass(Class clazz, Comparator...
[ { "answer_id": 237752, "author": "ngn", "author_id": 23109, "author_profile": "https://Stackoverflow.com/users/23109", "pm_score": 4, "selected": false, "text": "factory.getComparatorForClass(x.getClass()).compare(x, y)\n Comparable x.compareTo(y)\n Comparable" }, { "answer_id": ...
2008/10/26
[ "https://Stackoverflow.com/questions/237745", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
237,757
<p>I have a php script that is executing an executable that writes to a serial port. However, everytime it runs <pre>system("c:\Untitled1.exe")</pre> it just opens up a cmd window and freezes.</p> <p>Anybody know how to fix this? Or if there is an easier way to get PHP to write to the serial port directly? (I've alrea...
[ { "answer_id": 237797, "author": "lacop", "author_id": 894, "author_profile": "https://Stackoverflow.com/users/894", "pm_score": 0, "selected": false, "text": "system() popen() fread() pclose()" } ]
2008/10/26
[ "https://Stackoverflow.com/questions/237757", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
237,763
<p>I have a CSV file that has a column that contains strings that look like integers. That is they should be dealt with as strings, but since they are numbers they appear to be imported as integers (dropping off the leading zeroes).</p> <p>Example Data:</p> <ul> <li>0000000000079</li> <li>0000999000012</li> <li>0001...
[ { "answer_id": 237823, "author": "mohammedn", "author_id": 29268, "author_profile": "https://Stackoverflow.com/users/29268", "pm_score": 2, "selected": false, "text": "string myStringValue = reader.GetString(0);\n" } ]
2008/10/26
[ "https://Stackoverflow.com/questions/237763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25719/" ]
237,804
<p><a href="http://en.wikipedia.org/wiki/C%2B%2B11" rel="noreferrer">C++11</a> introduces <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2378.pdf" rel="noreferrer">user-defined literals</a> which will allow the introduction of new literal syntax based on existing literals (<code>int</code>, <code>hex...
[ { "answer_id": 237821, "author": "Nils Pipenbrinck", "author_id": 15955, "author_profile": "https://Stackoverflow.com/users/15955", "pm_score": 5, "selected": false, "text": "double operator \"\"_deg(long double d)\n{ \n // returns radians\n return d*M_PI/180; \n}\n int operator \"...
2008/10/26
[ "https://Stackoverflow.com/questions/237804", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3848/" ]
237,807
<p>.NET's <code>SslStream</code> class does not send the <code>close_notify</code> alert before closing the connection.</p> <p>How can I send the <code>close_notify</code> alert manually?</p>
[ { "answer_id": 22626756, "author": "Neco", "author_id": 1655991, "author_profile": "https://Stackoverflow.com/users/1655991", "pm_score": 5, "selected": false, "text": "public class FixedSslStream : SslStream {\n public FixedSslStream(Stream innerStream)\n : base(innerStream) {...
2008/10/26
[ "https://Stackoverflow.com/questions/237807", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
237,816
<p>Say each row in a table has data pertaining to one particular user. The user has a password to access the system.</p> <p>How do I encrypt a column of data using InnoDB so that no one other than the user who's data it is can read the data ? I was thinking of something like using one of the MySQL encryption functions...
[ { "answer_id": 237839, "author": "Damir Zekić", "author_id": 401510, "author_profile": "https://Stackoverflow.com/users/401510", "pm_score": 3, "selected": false, "text": "INSERT INTO secure_table VALUES (\n 1,\n AES_ENCRYPT(\n 'plain text data',\n CONCAT(@application_password, @...
2008/10/26
[ "https://Stackoverflow.com/questions/237816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31574/" ]
237,843
<p>my shared hosting only allows me to create 2 virtual directories. and i want to host multiple webapps... say an asp.net mvc blog, a forum, a personal site etc... </p> <p>isnt there any other way of doing this? cant i simply just ftp the blog folder to one of my virtual directories and then access it online??</p>
[ { "answer_id": 243883, "author": "Peter", "author_id": 5496, "author_profile": "https://Stackoverflow.com/users/5496", "pm_score": 3, "selected": true, "text": "~/images/logo.gif\n /vd1/app1/images/logo.gif\n /vd1/images/logo.gif\n" } ]
2008/10/26
[ "https://Stackoverflow.com/questions/237843", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30007/" ]
237,859
<p>I have a text box in wxPython that takes the output of dictionary.items() and displays it to the user as items are added to the dictionary. However, the raw data is very ugly, looking like </p> <pre><code>[(u'BC',45) (u'CHM',25) (u'CPM',30)] </code></pre> <p>I know dictionary.items() is a list of tuples, but I can...
[ { "answer_id": 237872, "author": "derfred", "author_id": 10286, "author_profile": "https://Stackoverflow.com/users/10286", "pm_score": 0, "selected": false, "text": ">>> import pprint\n>>> pprint.pformat({ \"my key\": \"my value\"})\n\"{'my key': 'my value'}\"\n>>> \n" }, { "answ...
2008/10/26
[ "https://Stackoverflow.com/questions/237859", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18676/" ]
237,876
<p>I'm making a game and one of the methods calculates a character's base hit numbers based on skill values. The method currently calculates each value individually, since each skill can be used at short, medium, and long range.</p> <p>I originally thought I could combine the skills into a tuple and iterate over it, d...
[ { "answer_id": 237905, "author": "Vincent Ramdhanie", "author_id": 27439, "author_profile": "https://Stackoverflow.com/users/27439", "pm_score": 1, "selected": false, "text": "current_weapon * self.medium\n class Weapon\n hit = 1\n #other properties of weapon\n\nclass Rifle(Weapon)...
2008/10/26
[ "https://Stackoverflow.com/questions/237876", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18676/" ]
237,899
<p>I am using freeglut for opengl rendering...</p> <p>I need to draw an envelop looking like a cone (2D) that has to be filled with some color and some transparency applied.</p> <p>Is the freeglut toolkit equipped with such an inbuilt functionality to draw filled geometries(or some trick)? or is there some other api ...
[ { "answer_id": 237905, "author": "Vincent Ramdhanie", "author_id": 27439, "author_profile": "https://Stackoverflow.com/users/27439", "pm_score": 1, "selected": false, "text": "current_weapon * self.medium\n class Weapon\n hit = 1\n #other properties of weapon\n\nclass Rifle(Weapon)...
2008/10/26
[ "https://Stackoverflow.com/questions/237899", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30868/" ]
237,914
<p>Ok, I am trying to use Tail to monitor a log file, but I cannot get the same behavior programatically as when I manually run it through cmd prompt using the same parameters.</p> <p>When run through cmd prompt it displays the new lines <strong>instantly</strong>. Programatically though, I have to wait for about <stro...
[ { "answer_id": 237956, "author": "tovare", "author_id": 12677, "author_profile": "https://Stackoverflow.com/users/12677", "pm_score": 1, "selected": false, "text": "\n System.Console.Error\n" } ]
2008/10/26
[ "https://Stackoverflow.com/questions/237914", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1147/" ]
237,921
<p>I have a tabview controller to which I added a UIViewController to each tab. I want to have multiple UIViews inside the UIViewController.</p> <p>So in the implementation of the UIViewController class I added [self.view addSubView:uiview1] and [self.view addSubView:uiview2]. The problem is that when I run the app, i...
[ { "answer_id": 238269, "author": "Mike McMaster", "author_id": 544, "author_profile": "https://Stackoverflow.com/users/544", "pm_score": 3, "selected": true, "text": "self.view = [[[UIView alloc] initWithFrame:someFrame] autorelease];\n [self.view addSubview:uiview1];\n[self.view addSubv...
2008/10/26
[ "https://Stackoverflow.com/questions/237921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23695/" ]
237,938
<p>We have a few XML based interfaces that is quite well documented in XSD schemas. The interfaces are now going to be publicly available and we would like to create reference documentation for them.</p> <p>Is there a tool that can automatically convert XSD files into some more readable format?</p>
[ { "answer_id": 2176503, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 4, "selected": false, "text": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<?xml-stylesheet type=\"text/xsl\" href=\"xs3p.xsl\"?>\n" } ]
2008/10/26
[ "https://Stackoverflow.com/questions/237938", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1918/" ]
237,966
<p>The framework I am developing for my application relies very heavily on dynamically generated domain objects. I recently started using Spring WebFlow and now need to be able to serialize my domain objects that will be kept in flow scope. </p> <p>I have done a bit of research and figured out that I can use <code>wri...
[ { "answer_id": 238581, "author": "Miguel Ping", "author_id": 22992, "author_profile": "https://Stackoverflow.com/users/22992", "pm_score": 1, "selected": false, "text": "ApplicationContext BeanFactory ApplicationContext BeanFactory ApplicationContext" }, { "answer_id": 500568, ...
2008/10/26
[ "https://Stackoverflow.com/questions/237966", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1969/" ]
237,977
<p>This is probably one of those easy questions.. I'm trying to redirect the user after they've successfully authenticated, or return them back to the login page. But the Success page is on a different route and I can't get the redirection to work..</p> <p>Here are my routes in Globals.asax:</p> <pre><code>routes.Ma...
[ { "answer_id": 237991, "author": "liggett78", "author_id": 19762, "author_profile": "https://Stackoverflow.com/users/19762", "pm_score": 4, "selected": true, "text": "Return RedirectToRoute(\"Stuff\");\n RedirectToAction(\"Index\", \"Stuff\");\n" }, { "answer_id": 393672, "au...
2008/10/26
[ "https://Stackoverflow.com/questions/237977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5662/" ]
237,978
<p>An <a href="https://stackoverflow.com/questions/61278/quick-and-dirty-way-to-profile-your-code#231614">answer to one of my questions</a> included the following line of code:</p> <pre><code>label = std::safe_string(name); // label is a std::string </code></pre> <p>The intent seems to be a wrapper around a string li...
[ { "answer_id": 237996, "author": "Nemanja Trifunovic", "author_id": 8899, "author_profile": "https://Stackoverflow.com/users/8899", "pm_score": 2, "selected": false, "text": "std::safe_string" }, { "answer_id": 238032, "author": "Motti", "author_id": 3848, "author_pro...
2008/10/26
[ "https://Stackoverflow.com/questions/237978", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3848/" ]
237,987
<p>I'm a recent semi-convert to Eclipse after 20 years of using vi and gvim. One of the things I miss about gvim is that I could cut a bunch of different snippets of code into named buffers, and paste them at will when doing something like repeating a common idiom. For instance I'd have it so <code>"ap</code> would p...
[ { "answer_id": 238042, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 7, "selected": true, "text": "dbHandle ctrl+space" } ]
2008/10/26
[ "https://Stackoverflow.com/questions/237987", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3333/" ]
238,002
<p>How can I replace Line Breaks within a string in C#?</p>
[ { "answer_id": 238005, "author": "The.Anti.9", "author_id": 2128, "author_profile": "https://Stackoverflow.com/users/2128", "pm_score": 2, "selected": false, "text": "Line.Replace(\"\\n\", \"whatever you want to replace with\");\n" }, { "answer_id": 238014, "author": "Brian R...
2008/10/26
[ "https://Stackoverflow.com/questions/238002", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3821/" ]