qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
12,611
<p>I have to create something similiar to Google Calendar, so I created an events table that contains all the events for a user.</p> <p>The hard part is handling re-occurring events, the row in the events table has an event_type field that tells you what kind of event it is, since an event can be for a single date only, OR a re-occuring event every x days.</p> <p><strong>The main design challenge is handling re-occurring events.</strong></p> <p>When a user views the calendar, using the month's view, how can I display all the events for the given month? The query is going to be tricky, so I thought it would be easier to create another table and create a row for each and every event, including the re-occuring events.</p> <p>What do you guys think?</p>
[ { "answer_id": 12993, "author": "eplawless", "author_id": 1370, "author_profile": "https://Stackoverflow.com/users/1370", "pm_score": 2, "selected": false, "text": "SELECT * FROM events WHERE id = 3 OR parentid = 3\n" }, { "answer_id": 23653, "author": "Matt S.", "author_...
2008/08/15
[ "https://Stackoverflow.com/questions/12611", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1368/" ]
12,613
<p>I've been using Emacs's sql interactive mode to talk to the MySQL db server and gotten to enjoy it. A developer has set up another db on a new non-default port number but I don't know how to access it using sql-mysql.</p> <p>How do I specify a port number when I'm trying to connect to a database?</p> <p>It would be even better if Emacs can prompt me for a port number and just use the default if I don't specify. Any chances of that?</p>
[ { "answer_id": 12628, "author": "Marcel Levy", "author_id": 676, "author_profile": "https://Stackoverflow.com/users/676", "pm_score": 3, "selected": false, "text": "(setq sql-mysql-options (list \"-P <port number>\"))\n" }, { "answer_id": 12658, "author": "Jon Ericson", "...
2008/08/15
[ "https://Stackoverflow.com/questions/12613", "https://Stackoverflow.com", "https://Stackoverflow.com/users/680/" ]
12,633
<p>I'm trying to parse an INI file using C++. Any tips on what is the best way to achieve this? Should I use the Windows API tools for INI file processing (with which I am totally unfamiliar), an open-source solution or attempt to parse it manually?</p>
[ { "answer_id": 1964505, "author": "Mike", "author_id": 124476, "author_profile": "https://Stackoverflow.com/users/124476", "pm_score": 3, "selected": false, "text": "#include \"SimpleIni\\SimpleIni.h\" \nCSimpleIniA ini;\nini.SetUnicode();\nini.LoadFile(FileName);\nconst char * pVal =...
2008/08/15
[ "https://Stackoverflow.com/questions/12633", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1467/" ]
12,638
<p>So basically I'm building an app for my company and it NEEDS to be built using MS Access and it needs to be built on SQL Server.</p> <p>I've drawn up most of the plans but am having a hard time figuring out a way to handle the auditing system.</p> <p>Since it is being used internally only and you won't even be able to touch the db from outside the building we are not using a login system as the program will only be used once a user has already logged in to our internal network via Active Directory. Knowing this, we're using <a href="https://stackoverflow.com/questions/9052/is-there-a-way-for-ms-access-to-grab-the-current-active-directory-user">a system to detect automatically the name of the Active Directory user</a> and with their permissions in one of the DB tables, deciding what they can or cannot do.</p> <p>So the actual audit table will have 3 columns (this design may change but for this question it doesn't matter); who (Active Directory User), when (time of addition/deletion/edit), what (what was changed)</p> <p>My question is how should I be handling this. Ideally I know I should be using a trigger so that it is impossible for the database to be updated without an audit being logged, however I don't know how I could grab the Active Directory User that way. An alternate would be to code it directly into the Access source so that whenever something changes I run an INSERT statement. Obviously that is flawed because if something happens to Access or the database is touched by something else then it will not log the audit.</p> <p>Any advice, examples or articles that may help me would be greatly appreciated!</p>
[ { "answer_id": 12650, "author": "Jay Mooney", "author_id": 733, "author_profile": "https://Stackoverflow.com/users/733", "pm_score": 2, "selected": false, "text": "\nselect user_name(),suser_sname()\n" }, { "answer_id": 12653, "author": "SQLMenace", "author_id": 740, ...
2008/08/15
[ "https://Stackoverflow.com/questions/12638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/428190/" ]
12,642
<p>I am trying to upload a file or stream of data to our web server and I cant find a decent way of doing this. I have tried both <code>WebClient</code> and <code>WebRequest</code> both have their problems. </p> <p><strong>WebClient</strong><br> Nice and easy but you do not get any notification that the asynchronous upload has completed, and the <code>UploadProgressChanged</code> event doesnt get called back with anything useful. The alternative is to convert your binary data to a string and use <code>UploadStringASync</code> because then at least you get a <code>UploadStringCompleted</code>, problem is you need a lot of ram for big files as its encoding all the data and uploading it in one go.</p> <p><strong>HttpWebRequest</strong><br> Bit more complicated but still does what is needed, problem I am getting is that even though it is called on a background thread (supposedly), it still seems to be blocking my UI and the whole browser until the upload has completed which doesnt seem quite right.</p> <p>Normal .net does have some appropriate <code>WebClient</code> methods for <a href="http://msdn.microsoft.com/en-us/library/system.net.webclient.onuploaddatacompleted.aspx" rel="nofollow noreferrer">OnUploadDataCompleted</a> and progress but these arent available in Silverlight .net ... big omission I think!</p> <p>Does anyone have any solutions, I need to upload multiple binary files preferrably with a progress but I need to perform some actions when the files have completed their upload.</p> <p>Look forward to some help with this.</p>
[ { "answer_id": 12691, "author": "Brian Leahy", "author_id": 580, "author_profile": "https://Stackoverflow.com/users/580", "pm_score": 2, "selected": true, "text": " public void DoIt(){\nthis.IsUploading = True; \n\n WebRequest postRequest = WebRequest.Create(new Uri(ServiceURL)...
2008/08/15
[ "https://Stackoverflow.com/questions/12642", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1478/" ]
12,647
<p>Is there a simple way in Perl that will allow me to determine if a given variable is numeric? Something along the lines of:</p> <pre><code>if (is_number($x)) { ... } </code></pre> <p>would be ideal. A technique that won't throw warnings when the <code>-w</code> switch is being used is certainly preferred.</p>
[ { "answer_id": 12654, "author": "farmerchris", "author_id": 1317, "author_profile": "https://Stackoverflow.com/users/1317", "pm_score": 2, "selected": false, "text": "sub isnumber \n{\n shift =~ /^-?\\d+\\.?\\d*$/;\n}\n" }, { "answer_id": 12667, "author": "andrewrk", "...
2008/08/15
[ "https://Stackoverflow.com/questions/12647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/872/" ]
12,656
<p>In a project that I'm about to wrap up, I've written and implemented an object-relational mapping solution for PHP. Before the doubters and dreamers cry out "how on earth?", relax -- I haven't found a way to make late static binding work -- I'm just working around it in the best way that I possibly can.</p> <p>Anyway, I'm not currently using prepared statements for querying, because I couldn't come up with a way to pass a variable number of arguments to the <code>bind_params()</code> or <code>bind_result()</code> methods. </p> <p>Why do I need to support a variable number of arguments, you ask? Because the superclass of my models (think of my solution as a hacked-up PHP ActiveRecord wannabe) is where the querying is defined, and so the find() method, for example, doesn't know how many parameters it would need to bind.</p> <p>Now, I've already thought of building an argument list and passing a string to eval(), but I don't like that solution very much -- I'd rather just implement my own security checks and pass on statements.</p> <p>Does anyone have any suggestions (or success stories) about how to get this done? If you can help me solve this first problem, perhaps we can tackle binding the result set (something I suspect will be more difficult, or at least more resource-intensive if it involves an initial query to determine table structure).</p>
[ { "answer_id": 13092, "author": "John Downey", "author_id": 200, "author_profile": "https://Stackoverflow.com/users/200", "pm_score": 5, "selected": true, "text": "call_user_func_array" }, { "answer_id": 80352, "author": "Steven Oxley", "author_id": 3831, "author_prof...
2008/08/15
[ "https://Stackoverflow.com/questions/12656", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1344/" ]
12,661
<p>What's the most efficient way to resize large images in PHP?</p> <p>I'm currently using the <a href="http://en.wikipedia.org/wiki/GD_Graphics_Library" rel="noreferrer">GD</a> function imagecopyresampled to take high resolution images, and cleanly resize them down to a size for web viewing (roughly 700 pixels wide by 700 pixels tall).</p> <p>This works great on small (under 2 MB) photos and the entire resize operation takes less than a second on the server. However, the site will eventually service photographers who may be uploading images up to 10 MB in size (or images up to 5000x4000 pixels in size).</p> <p>Doing this kind of resize operation with large images tends to increase the memory usage by a very large margin (larger images can spike the memory usage for the script past 80 MB). Is there any way to make this resize operation more efficient? Should I be using an alternate image library such as <a href="http://en.wikipedia.org/wiki/ImageMagick" rel="noreferrer">ImageMagick</a>?</p> <p>Right now, the resize code looks something like this</p> <pre><code>function makeThumbnail($sourcefile, $endfile, $thumbwidth, $thumbheight, $quality) { // Takes the sourcefile (path/to/image.jpg) and makes a thumbnail from it // and places it at endfile (path/to/thumb.jpg). // Load image and get image size. $img = imagecreatefromjpeg($sourcefile); $width = imagesx( $img ); $height = imagesy( $img ); if ($width &gt; $height) { $newwidth = $thumbwidth; $divisor = $width / $thumbwidth; $newheight = floor( $height / $divisor); } else { $newheight = $thumbheight; $divisor = $height / $thumbheight; $newwidth = floor( $width / $divisor ); } // Create a new temporary image. $tmpimg = imagecreatetruecolor( $newwidth, $newheight ); // Copy and resize old image into new image. imagecopyresampled( $tmpimg, $img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height ); // Save thumbnail into a file. imagejpeg( $tmpimg, $endfile, $quality); // release the memory imagedestroy($tmpimg); imagedestroy($img); </code></pre>
[ { "answer_id": 12805, "author": "Kevin", "author_id": 40, "author_profile": "https://Stackoverflow.com/users/40", "pm_score": 5, "selected": false, "text": "<?\nfunction fastimagecopyresampled (&$dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h, $qual...
2008/08/15
[ "https://Stackoverflow.com/questions/12661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1477/" ]
12,671
<p>I'm fairly new to ASP.NET and trying to learn how things are done. I come from a C# background so the code-behind portion is easy, but thinking like a web developer is unfamiliar.</p> <p>I have an aspx page that contains a grid of checkboxes. I have a button that is coded via a Button_Click event to collect a list of which rows are checked and create a session variable out of that list. The same button is referenced (via TargetControlID) by my ascx page's ModalPopupExtender which controls the panel on the ascx page.</p> <p>When the button is clicked, the modal popup opens but the Button_Click event is never fired, so the modal doesn't get its session data.</p> <p>Since the two pages are separate, I can't call the ModalPopupExtender from the aspx.cs code, I can't reach the list of checkboxes from the ascx.cs code, and I don't see a way to populate my session variable and then programmatically activate some other hidden button or control which will then open my modal popup.</p> <p>Any thoughts?</p>
[ { "answer_id": 14735, "author": "Erick B", "author_id": 1373, "author_profile": "https://Stackoverflow.com/users/1373", "pm_score": 1, "selected": false, "text": "<uc1:ChildPage ID=\"MyModalPage\" runat=\"server\" />\n" } ]
2008/08/15
[ "https://Stackoverflow.com/questions/12671", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1373/" ]
12,702
<p>I have a WCF service from which I want to return a DataTable. I know that this is often a highly-debated topic, as far as whether or not returning DataTables is a good practice. Let's put that aside for a moment.</p> <p>When I create a DataTable from scratch, as below, there are no problems whatsoever. The table is created, populated, and returned to the client, and all is well:</p> <pre><code>[DataContract] public DataTable GetTbl() { DataTable tbl = new DataTable("testTbl"); for(int i=0;i&lt;100;i++) { tbl.Columns.Add(i); tbl.Rows.Add(new string[]{"testValue"}); } return tbl; } </code></pre> <p>However, as soon as I go out and hit the database to create the table, as below, I get a CommunicationException "The underlying connection was closed: The connection was closed unexpectedly."</p> <pre><code>[DataContract] public DataTable GetTbl() { DataTable tbl = new DataTable("testTbl"); //Populate table with SQL query return tbl; } </code></pre> <p>The table is being populated correctly on the server side. It is significantly smaller than the test table that I looped through and returned, and the query is small and fast - there is no issue here with timeouts or large data transfer. The same exact functions and DataContracts/ServiceContracts/BehaviorContracts are being used.</p> <p>Why would the way that the table is being populated have any bearing on the table returning successfully?</p>
[ { "answer_id": 12712, "author": "Darren Kopp", "author_id": 77, "author_profile": "https://Stackoverflow.com/users/77", "pm_score": 2, "selected": false, "text": "[ServiceContract]\npublic interface ITableProvider\n{\n [OperationContract]\n DataTable GetTbl();\n}\n\n\n[OperationBeh...
2008/08/15
[ "https://Stackoverflow.com/questions/12702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/940/" ]
12,706
<p>I'm coming from a Rails background and doing some work on a ASP.NET project (not ASP MVC). Newbie question: what's the easiest way to make a custom editor for a table of records?</p> <p>For example: I have a bunch of data rows and want to change the "category" field on each -- maybe a dropdown, maybe a link, maybe the user types it in.</p> <p>In Rails, I'd iterate over the rows to build a table, and would have a form for each row. The form would have an input box or dropdown, and submit the data to a controller like "/item/edit/15?category=foo" where 15 was the itemID and the new category was "foo".</p> <p>I'm new to the ASP.NET model and am not sure of the "right" way to do this -- just the simplest way to get back the new data &amp; save it off. Would I make a custom control and append it to each row? Any help appreciated.</p>
[ { "answer_id": 12873, "author": "Kalid", "author_id": 109, "author_profile": "https://Stackoverflow.com/users/109", "pm_score": 0, "selected": false, "text": "<asp:DataGrid ID=\"GridView1\" runat=\"server\" AutoGenerateColumns=\"False\">\n <Columns>\n <asp:BoundColumn DataField...
2008/08/15
[ "https://Stackoverflow.com/questions/12706", "https://Stackoverflow.com", "https://Stackoverflow.com/users/109/" ]
12,716
<p>In C++ program, I am trying to #import TLB of .NET out-of-proc server.</p> <p>I get errors like:</p> <blockquote> <p>z:\server.tlh(111) : error C2146: syntax error : missing ';' before identifier 'GetType'</p> <p>z:\server.tlh(111) : error C2501: '_TypePtr' : missing storage-class or type specifiers</p> <p>z:\server.tli(74) : error C2143: syntax error : missing ';' before 'tag::id'</p> <p>z:\server.tli(74) : error C2433: '_TypePtr' : 'inline' not permitted on data declarations</p> <p>z:\server.tli(74) : error C2501: '_TypePtr' : missing storage-class or type specifiers</p> <p>z:\server.tli(74) : fatal error C1004: unexpected end of file found</p> </blockquote> <p>The TLH looks like:</p> <pre><code>_bstr_t GetToString(); VARIANT_BOOL Equals (const _variant_t &amp; obj); long GetHashCode(); _TypePtr GetType(); long Open(); </code></pre> <p>I am not really interested in the having the base object .NET object methods like GetType(), Equals(), etc. But GetType() seems to be causing problems.</p> <p>Some google research indicates I could <code>#import mscorlib.tlb</code> (or put it in path), but I can't get that to compile either.</p> <p>Any tips?</p>
[ { "answer_id": 12751, "author": "jm.", "author_id": 814, "author_profile": "https://Stackoverflow.com/users/814", "pm_score": 2, "selected": true, "text": "#import \"server.tlb\" no_namespace named_guids\n" }, { "answer_id": 758927, "author": "Community", "author_id": -1,...
2008/08/15
[ "https://Stackoverflow.com/questions/12716", "https://Stackoverflow.com", "https://Stackoverflow.com/users/814/" ]
12,794
<p>I'm trying to use <code>jQuery</code> to format code blocks, specifically to add a <code>&lt;pre&gt;</code> tag inside the <code>&lt;code&gt;</code> tag:</p> <pre><code>$(document).ready(function() { $("code").wrapInner("&lt;pre&gt;&lt;/pre&gt;"); }); </code></pre> <p>Firefox applies the formatting correctly, but IE puts the entire code block on one line. If I add an alert </p> <pre><code>alert($("code").html()); </code></pre> <p>I see that IE has inserted some additional text into the pre tag:</p> <pre><code>&lt;PRE jQuery1218834632572="null"&gt; </code></pre> <p>If I reload the page, the number following jQuery changes.</p> <p>If I use <code>wrap()</code> instead of <code>wrapInner()</code>, to wrap the <code>&lt;pre&gt;</code> outside the <code>&lt;code&gt;</code> tag, both IE and Firefox handle it correctly. But shouldn't <code>&lt;pre&gt;</code> work <em>inside</em> <code>&lt;code&gt;</code> as well?</p> <p>I'd prefer to use <code>wrapInner()</code> because I can then add a CSS class to the <code>&lt;pre&gt;</code> tag to handle all formatting, but if I use <code>wrap()</code>, I have to put page formatting CSS in the <code>&lt;pre&gt;</code> tag and text/font formatting in the <code>&lt;code&gt;</code> tag, or Firefox and IE both choke. Not a huge deal, but I'd like to keep it as simple as possible.</p> <p>Has anyone else encountered this? Am I missing something?</p>
[ { "answer_id": 12804, "author": "Pat", "author_id": 238, "author_profile": "https://Stackoverflow.com/users/238", "pm_score": 1, "selected": false, "text": "$(\"code\").wrapInner(document.createElement(\"pre\"));\n" }, { "answer_id": 12983, "author": "markpasc", "author_i...
2008/08/15
[ "https://Stackoverflow.com/questions/12794", "https://Stackoverflow.com", "https://Stackoverflow.com/users/311/" ]
12,836
<p>We have our own ORM we use here, and provide strongly typed wrappers for all of our db tables. We also allow weakly typed ad-hoc SQL to be executed, but these queries still go through the same class for getting values out of a data reader.</p> <p>In tweaking that class to work with Oracle, we've come across an interesting question. Is it better to use DBNull.Value, or null? Are there any benefits to using DBNull.Value? It seems more "correct" to use null, since we've separated ourselves from the DB world, but there are implications (you can't just blindly <code>ToString()</code> when a value is null for example) so its definitely something we need to make a conscious decision about.</p>
[ { "answer_id": 12854, "author": "John Smithers", "author_id": 1069, "author_profile": "https://Stackoverflow.com/users/1069", "pm_score": 1, "selected": false, "text": "DBNull" }, { "answer_id": 12935, "author": "Dan Herbert", "author_id": 392, "author_profile": "http...
2008/08/15
[ "https://Stackoverflow.com/questions/12836", "https://Stackoverflow.com", "https://Stackoverflow.com/users/489/" ]
12,843
<p>I have two separate mercurial repositories. At this point it makes sense that they "become one" because I want to work on the two projects simultaneously.</p> <p>I'd really like the two projects to each be a subdirectory in the new repository.</p> <ol> <li>How do I merge the two projects?</li> <li>Is this a good idea, or should I keep them separate?</li> </ol> <p>It seems I ought to be able to push from one repository to the other... Maybe this is really straight forward?</p>
[ { "answer_id": 18175, "author": "nlucaroni", "author_id": 157, "author_profile": "https://Stackoverflow.com/users/157", "pm_score": 2, "selected": false, "text": "transplant" }, { "answer_id": 20591, "author": "jm.", "author_id": 814, "author_profile": "https://Stacko...
2008/08/15
[ "https://Stackoverflow.com/questions/12843", "https://Stackoverflow.com", "https://Stackoverflow.com/users/814/" ]
12,855
<p>I have a query where I am searching against a string:</p> <pre><code>SELECT county FROM city WHERE UPPER(name) = 'SAN FRANCISCO'; </code></pre> <p>Now, this works fine, but it doesn't scale well, and I need to optimize it. I have <a href="http://www.ibm.com/developerworks/db2/library/techarticle/0203adamache/0203adamache.html" rel="nofollow noreferrer">found an option</a> along the lines of creating a generated view, or something like that, but I was hoping for a simpler solution using an index.</p> <p>We are using DB2, and I really want to use an <a href="http://ibmsystemsmag.blogs.com/db2utor/2007/11/db2-9-index-wit.html" rel="nofollow noreferrer">expression in an index</a>, but this option seems to only be available on z/OS, however we are running Linux. I tried the expression index anyways:</p> <pre><code>CREATE INDEX city_upper_name_idx ON city UPPER(name) ALLOW REVERSE SCANS; </code></pre> <p>But of course, it chokes on the UPPER(name).</p> <p>Is there another way I can create an index or something similar in this manner such that I don't have to restructure my existing queries to use a new generated view, or alter my existing columns, or any other such intrusive change?</p> <p>EDIT: I'm open to hearing solutions for other databases... it might carry over to DB2...</p>
[ { "answer_id": 12886, "author": "nsanders", "author_id": 1244, "author_profile": "https://Stackoverflow.com/users/1244", "pm_score": 3, "selected": false, "text": "hash = [compute hash key for 'SAN FRANCISCO']\n\nSELECT county \nFROM city \nWHERE cityHash = hash \n AND UPPER(name) = 'SA...
2008/08/15
[ "https://Stackoverflow.com/questions/12855", "https://Stackoverflow.com", "https://Stackoverflow.com/users/122/" ]
12,865
<p>Got a bluescreen in windows while cloning a mercurial repository.</p> <p>After reboot, I now get this message for almost all hg commands:</p> <pre> c:\src\>hg commit waiting for lock on repository c:\src\McVrsServer held by '\x00\x00\x00\x00\x00\ x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' interrupted! </pre> <p>Google is no help.</p> <p>Any tips?</p>
[ { "answer_id": 12879, "author": "jm.", "author_id": 814, "author_profile": "https://Stackoverflow.com/users/814", "pm_score": 10, "selected": true, "text": ".hg/wlock" }, { "answer_id": 2960524, "author": "Tiago Matos", "author_id": 356772, "author_profile": "https://...
2008/08/15
[ "https://Stackoverflow.com/questions/12865", "https://Stackoverflow.com", "https://Stackoverflow.com/users/814/" ]
12,870
<p>This is a nasty one for me... I'm a PHP guy working in Java on a JSP project. I know how to do what I'm attempting through too much code and a complete lack of finesse. </p> <p>I'd prefer to do it right. Here is the situation:</p> <p>I'm writing a small display to show customers what days they can water their lawns based on their watering group (ABCDE) and what time of year it is. Our seasons look like this: Summer (5-1 to 8-31) Spring (3-1 to 4-30) Fall (9-1 to 10-31) Winter (11-1 to 2-28) </p> <p>An example might be:</p> <p>If I'm in group A, here would be my allowed times: Winter: Mondays only Spring: Tues, Thurs, Sat Summer: Any Day Fall: Tues, Thurs, Sat</p> <p>If I was writing this in PHP I would use arrays like this:</p> <pre><code>//M=Monday,t=Tuesday,T=Thursday.... etc $schedule["A"]["Winter"]='M'; $schedule["A"]["Spring"]='tTS'; $schedule["A"]["Summer"]='Any'; $schedule["A"]["Fall"]='tTS'; $schedule["B"]["Winter"]='t'; </code></pre> <p>I COULD make the days arrays (array("Tuesday","Thursday","Saturday")) etc, but it is not necessary for what I'm really trying to accomplish.</p> <p>I will also need to setup arrays to determine what season I'm in:</p> <pre><code>$seasons["Summer"]["start"]=0501; $seasons["Summer"]["end"]=0801; </code></pre> <p>Can anyone suggest a really cool way to do this? I will have today's date and the group letter. I will need to get out of my function a day (M) or a series of days (tTS), (Any).</p>
[ { "answer_id": 12878, "author": "Mike Stone", "author_id": 122, "author_profile": "https://Stackoverflow.com/users/122", "pm_score": 5, "selected": true, "text": "Hashtable<String, Hashtable<String, String>> schedule\n = new Hashtable<String, Hashtable<String, String>>();\nschedule.pu...
2008/08/15
[ "https://Stackoverflow.com/questions/12870", "https://Stackoverflow.com", "https://Stackoverflow.com/users/172/" ]
12,890
<p>I have a large database of normalized order data that is becoming very slow to query for reporting. Many of the queries that I use in reports join five or six tables and are having to examine tens or hundreds of thousands of lines.</p> <p>There are lots of queries and most have been optimized as much as possible to reduce server load and increase speed. I think it's time to start keeping a copy of the data in a denormalized format.</p> <p>Any ideas on an approach? Should I start with a couple of my worst queries and go from there?</p>
[ { "answer_id": 12950, "author": "Eric Z Beard", "author_id": 1219, "author_profile": "https://Stackoverflow.com/users/1219", "pm_score": 5, "selected": true, "text": "select a.name, b.address from tbla a \njoin tblb b on b.fk_a_id = a.id where a.id=1\n" } ]
2008/08/15
[ "https://Stackoverflow.com/questions/12890", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1430/" ]
12,896
<p>I'm looking for good/working/simple to use PHP code for parsing raw email into parts.</p> <p>I've written a couple of brute force solutions, but every time, one small change/header/space/something comes along and my whole parser fails and the project falls apart.</p> <p>And before I get pointed at PEAR/PECL, I need actual code. My host has some screwy config or something, I can never seem to get the .so's to build right. If I do get the .so made, some difference in path/environment/php.ini doesn't always make it available (apache vs cron vs CLI).</p> <p>Oh, and one last thing, I'm parsing the raw email text, NOT POP3, and NOT IMAP. It's being piped into the PHP script via a .qmail email redirect.</p> <p>I'm not expecting SOF to write it for me, I'm looking for some tips/starting points on doing it &quot;right&quot;. This is one of those &quot;wheel&quot; problems that I know has already been solved.</p>
[ { "answer_id": 12965, "author": "jj33", "author_id": 430, "author_profile": "https://Stackoverflow.com/users/430", "pm_score": 6, "selected": true, "text": "HEADERS\\n\n\\n\nBODY\n" }, { "answer_id": 5954640, "author": "Carter Cole", "author_id": 180434, "author_profi...
2008/08/15
[ "https://Stackoverflow.com/questions/12896", "https://Stackoverflow.com", "https://Stackoverflow.com/users/314/" ]
12,905
<p>I'm experimenting with creating an add-in for Infopath 2007. The documentation is very skimpy. What I'm trying to determine is what kind of actions an add-in can take while designing a form. Most of the discussion and samples are for when the user is filling out the form. Can I, for example, add a new field to the form in the designer? Add a new item to the schema? Move a form field on the design surface? It doesn't appear so, but I can't find anything definitive.</p>
[ { "answer_id": 12965, "author": "jj33", "author_id": 430, "author_profile": "https://Stackoverflow.com/users/430", "pm_score": 6, "selected": true, "text": "HEADERS\\n\n\\n\nBODY\n" }, { "answer_id": 5954640, "author": "Carter Cole", "author_id": 180434, "author_profi...
2008/08/16
[ "https://Stackoverflow.com/questions/12905", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9/" ]
12,906
<p>I need to know how much space occupies all the databases inside an SQL Server 2000. I did some research but could not found any script to help me out.</p>
[ { "answer_id": 12915, "author": "Jon Galloway", "author_id": 5, "author_profile": "https://Stackoverflow.com/users/5", "pm_score": 4, "selected": true, "text": "USE master;\nGO\n\nIF OBJECT_ID('dbo.sp_SDS', 'P') IS NOT NULL\n DROP PROCEDURE dbo.sp_SDS;\nGO\n\nCREATE PROCEDURE dbo.sp_SDS...
2008/08/16
[ "https://Stackoverflow.com/questions/12906", "https://Stackoverflow.com", "https://Stackoverflow.com/users/296/" ]
12,927
<p>I am calling a vendor's Java API, and on some servers it appears that the JVM goes into a low priority polling loop after logging into the API (CPU at 100% usage). The same app on other servers does not exhibit this behavior. This happens on WebSphere and Tomcat. The environment is tricky to set up so it is difficult to try to do something like profiling within Eclipse.</p> <p>Is there a way to profile (or some other method of inspecting) an existing Java app running in Tomcat to find out what methods are being executed while it's in this spinwait kind of state? The app is only executing one method when it gets in this state (vendor's method). Vendor can't replicate the behavior (of course).</p> <hr> <p>Update: </p> <p>Using JConsole I was able to determine who was running and what they were doing. It took me a few hours to then figure out why it was doing it. The problem ended up being that the vendor's API jar that was being used did not match exactly to the the database configuration that it was using. It was defaulting to having tracing and performance monitoring enabled on the servers that had the slight mis-match in configuration. I used a different jar and all is well.</p> <p>So thanks, Joshua, for your answer. JConsole was extremely easy to setup and use to monitor an existing application. </p> <p>@Cringe - I did some experimenting with some of the options you suggested. I had some problems with getting JProfiler set up, it looks good (but pricey). Going forward I went ahead and added the Eclipse Profiler plugin and I'll be looking over the different open source profilers to compare functionality.</p>
[ { "answer_id": 24082, "author": "Marcel", "author_id": 2554, "author_profile": "https://Stackoverflow.com/users/2554", "pm_score": 2, "selected": false, "text": "kill -3 <process id>" } ]
2008/08/16
[ "https://Stackoverflow.com/questions/12927", "https://Stackoverflow.com", "https://Stackoverflow.com/users/791/" ]
12,936
<p>Does anybody have experience working with PHP accelerators such as <a href="http://turck-mmcache.sourceforge.net/" rel="noreferrer">MMCache</a> or <a href="http://www.zend.com/en/" rel="noreferrer">Zend Accelerator</a>? I'd like to know if using either of these makes PHP comparable to <em>faster</em> web-technologies. Also, are there trade offs for using these?</p>
[ { "answer_id": 31990, "author": "John Douthat", "author_id": 2774, "author_profile": "https://Stackoverflow.com/users/2774", "pm_score": 1, "selected": false, "text": "yum install php-devel httpd-devel php-pear\npecl install apc \necho \"extension=apc.so\" > /etc/php.d/apc.ini\n# if you'...
2008/08/16
[ "https://Stackoverflow.com/questions/12936", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40/" ]
12,982
<p>It's 2008, and I'm still torn on this one. So I'm developing a web method that needs a complex type passed into it and returned from it. The two options I'm toying with are:</p> <ol> <li><p>Pass and return <em>actual</em> business objects with both data and behavior. When wsdl.exe is run, it will automatically create proxy classes that contain just the data portion, and these will be automatically converted to and from my real business objects on the server side. On the client side, they will only get to use the dumb proxy type, and they will have to map them into some real business objects as they see fit. A big drawback here is that if I "own" both the server and client side, and I want to use the same set of real business objects, I can run into certain headaches with name conflicts, etc. (Since the real objects and the proxies are named the same.)</p></li> <li><p>Forget trying to pass "real" business objects. Instead, just create simple DataTransfer objects which I will map back and forth to my real business objects manually. They still get copied to new proxy objects by wsdl.exe anyway, but at least I'm not tricking myself into thinking that web services can natively handle objects with business logic in them.</p></li> </ol> <p>By the way - Does anyone know how to tell wsdl.exe to <em>not</em> make a copy of the object? Shouldn't we be able to just tell it, "Hey, use this existing type right over here. Don't copy it!"</p> <p>Anyway, I've kinda settled on #2 for now, but I'm curious what you all think. I have a feeling there are <em>way</em> better ways to do this in general, and I may not even be totally accurate on all my points, so please let me know what your experiences have been.</p> <p><strong>Update</strong>: I just found out that VS 2008 has an option to reuse existing types when adding a "Service Reference", rather than creating brand new identical type in the proxy file. Sweet.</p>
[ { "answer_id": 12990, "author": "Darren Kopp", "author_id": 77, "author_profile": "https://Stackoverflow.com/users/77", "pm_score": 2, "selected": false, "text": "public class TransferObject\n{\n public string Type { get; set; }\n public byte[] Data { get; set; }\n}\n" } ]
2008/08/16
[ "https://Stackoverflow.com/questions/12982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1436/" ]
13,000
<p>I want to define something like this in <em>php</em>:</p> <pre><code>$EL = "\n&lt;br /&gt;\n"; </code></pre> <p>and then use that variable as an "endline" marker all over my site, like this:</p> <pre><code>echo "Blah blah blah{$EL}"; </code></pre> <p>How do I define $EL once (in only 1 file), include it on every page on my site, and <em>not</em> have to reference it using the (strangely backwards) <code>global $EL;</code> statement in every page function?</p>
[ { "answer_id": 13003, "author": "Paige Ruten", "author_id": 813, "author_profile": "https://Stackoverflow.com/users/813", "pm_score": 4, "selected": true, "text": " include 'header.php';\n" }, { "answer_id": 13008, "author": "UnkwnTech", "author_id": 115, "author_prof...
2008/08/16
[ "https://Stackoverflow.com/questions/13000", "https://Stackoverflow.com", "https://Stackoverflow.com/users/103/" ]
13,021
<p>I've frequently encountered sites that put all of their JavaScript inside a <code>namespace</code> structure along the lines of:</p> <pre><code>namespaces = { com : { example: { example.com's data} } </code></pre> <p>However, setting this up safely with respect to other namespaced frameworks seems to require a relatively hefty amount of code (defined as > 2 lines). I was wondering whether anyone knows of a concise way to do this? Furthermore, whether there's a relatively standard/consistent way to structure it? For example, is the <code>com</code> namespace directly attached to the global object, or is it attached through a namespace object?</p> <p>[Edit: whoops, obviously <code>{com = { ... } }</code> wouldn't accomplish anything close to what I intended, thanks to Shog9 for pointing that out.] </p>
[ { "answer_id": 13193, "author": "Shog9", "author_id": 811, "author_profile": "https://Stackoverflow.com/users/811", "pm_score": 5, "selected": true, "text": "var namespaces = { com: { example: { /* example.com's data */ } } }\n" }, { "answer_id": 13583, "author": "Polsonby", ...
2008/08/16
[ "https://Stackoverflow.com/questions/13021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/784/" ]
13,049
<p>What's the difference between struct and class in .NET?</p>
[ { "answer_id": 13053, "author": "Keith", "author_id": 905, "author_profile": "https://Stackoverflow.com/users/905", "pm_score": 6, "selected": false, "text": "struct MyStruct \n{\n string MyProperty { get; set; }\n}\n\nvoid ChangeMyStruct(MyStruct input) \n{ \n input.MyProperty = \"...
2008/08/16
[ "https://Stackoverflow.com/questions/13049", "https://Stackoverflow.com", "https://Stackoverflow.com/users/905/" ]
13,055
<p>I'm looking for a clear, concise and accurate answer. </p> <p>Ideally as the actual answer, although links to good explanations welcome.</p>
[ { "answer_id": 13056, "author": "Justin Standard", "author_id": 92, "author_profile": "https://Stackoverflow.com/users/92", "pm_score": 6, "selected": false, "text": "int" }, { "answer_id": 13057, "author": "Keith", "author_id": 905, "author_profile": "https://Stackov...
2008/08/16
[ "https://Stackoverflow.com/questions/13055", "https://Stackoverflow.com", "https://Stackoverflow.com/users/905/" ]
13,060
<p>I'm looking for a clear, concise and accurate answer. </p> <p>Ideally as the actual answer, although links to good explanations welcome.</p> <p>This also applies to VB.Net, but the keywords are different - <code>ByRef</code> and <code>ByVal</code>.</p>
[ { "answer_id": 13061, "author": "Keith", "author_id": 905, "author_profile": "https://Stackoverflow.com/users/905", "pm_score": 2, "selected": false, "text": "out" }, { "answer_id": 13100, "author": "Zooba", "author_id": 891, "author_profile": "https://Stackoverflow.c...
2008/08/16
[ "https://Stackoverflow.com/questions/13060", "https://Stackoverflow.com", "https://Stackoverflow.com/users/905/" ]
13,109
<p>In php, I often need to map a variable using an array ... but I can not seem to be able to do this in a one liner. c.f. example:</p> <pre><code>// the following results in an error: echo array('a','b','c')[$key]; // this works, using an unnecessary variable: $variable = array('a','b','c'); echo $variable[$key]; </code></pre> <p>This is a minor problem, but it keeps bugging every once in a while ... I don't like the fact, that I use a variable for nothing ;)</p>
[ { "answer_id": 13113, "author": "onnodb", "author_id": 1037, "author_profile": "https://Stackoverflow.com/users/1037", "pm_score": 5, "selected": true, "text": "$variable = array('a','b','c');\necho $variable[$key];\nunset($variable);\n" }, { "answer_id": 31942, "author": "Jo...
2008/08/16
[ "https://Stackoverflow.com/questions/13109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1532/" ]
13,128
<p>I'm tired of adding ten link libraries into my project, or requiring eight of them to use my own. I'd like to take existing libraries like libpng.a, libz.a, libjpeg.a, and combine them into one single .a library. Is that possible? How about combining .lib libraries?</p>
[ { "answer_id": 13206, "author": "Judge Maygarden", "author_id": 1491, "author_profile": "https://Stackoverflow.com/users/1491", "pm_score": 5, "selected": false, "text": "ar x <library name>\n" }, { "answer_id": 22041, "author": "Greg Whitfield", "author_id": 2102, "a...
2008/08/16
[ "https://Stackoverflow.com/questions/13128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1536/" ]
13,170
<p>From time to time I get a System.Threading.ThreadStateException when attempting to restart a thread. The code in question is as follows:</p> <pre><code>// Make sure the thread is done stopping while (this.mThread.ThreadState == ThreadState.Running) { Thread.Sleep(0); } // Respawn a thread if the current one is stopped or doesn't exist if (this.mThread == null || this.mThread.ThreadState == ThreadState.Stopped) { this.mThread = new Thread(new ParameterizedThreadStart(Monitor)); } // Start the thread if (check) { this.mThread.Start(60000); } else { this.mThread.Start(0); } </code></pre> <p>So two questions - is this the correct way of doing things, and it is, is there a way to prevent the error from occurring?</p>
[ { "answer_id": 13207, "author": "Brad Wilson", "author_id": 1554, "author_profile": "https://Stackoverflow.com/users/1554", "pm_score": 1, "selected": false, "text": "if (this.mThread == null || this.mThread.ThreadState != ThreadState.Suspended)" }, { "answer_id": 13214, "aut...
2008/08/16
[ "https://Stackoverflow.com/questions/13170", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1185/" ]
13,204
<p>I have a cron job on an Ubuntu Hardy VPS that only half works and I can't work out why. The job is a Ruby script that uses mysqldump to back up a MySQL database used by a Rails application, which is then gzipped and uploaded to a remote server using SFTP.</p> <p>The gzip file is created and copied successfully but it's always zero bytes. Yet if I run the cron command directly from the command line it works perfectly.</p> <p>This is the cron job:</p> <pre><code>PATH=/usr/bin 10 3 * * * ruby /home/deploy/bin/datadump.rb </code></pre> <p>This is datadump.rb:</p> <pre><code>#!/usr/bin/ruby require 'yaml' require 'logger' require 'rubygems' require 'net/ssh' require 'net/sftp' APP = '/home/deploy/apps/myapp/current' LOGFILE = '/home/deploy/log/data.log' TIMESTAMP = '%Y%m%d-%H%M' TABLES = 'table1 table2' log = Logger.new(LOGFILE, 5, 10 * 1024) dump = "myapp-#{Time.now.strftime(TIMESTAMP)}.sql.gz" ftpconfig = YAML::load(open('/home/deploy/apps/myapp/shared/config/sftp.yml')) config = YAML::load(open(APP + '/config/database.yml'))['production'] cmd = "mysqldump -u #{config['username']} -p#{config['password']} -h #{config['host']} --add-drop-table --add-locks --extended-insert --lock-tables #{config['database']} #{TABLES} | gzip -cf9 &gt; #{dump}" log.info 'Getting ready to create a backup' `#{cmd}` # Strongspace log.info 'Backup created, starting the transfer to Strongspace' Net::SSH.start(ftpconfig['strongspace']['host'], ftpconfig['strongspace']['username'], ftpconfig['strongspace']['password']) do |ssh| ssh.sftp.connect do |sftp| sftp.open_handle("#{ftpconfig['strongspace']['dir']}/#{dump}", 'w') do |handle| sftp.write(handle, open("#{dump}").read) end end end log.info 'Finished transferring backup to Strongspace' log.info 'Removing local file' cmd = "rm -f #{dump}" log.debug "Executing: #{cmd}" `#{cmd}` log.info 'Local file removed' </code></pre> <p>I've checked and double-checked all the paths and they're correct. Both <strong>sftp.yml</strong> (SFTP credentials) and <strong>database.yml</strong> (MySQL credentials) are owned by the executing user (deploy) with read-only permissions for that user (chmod 400). I'm using the 1.1.x versions of net-ssh and net-sftp. I know they're not the latest, but they're what I'm familiar with at the moment.</p> <p>What could be causing the cron job to fail?</p>
[ { "answer_id": 13232, "author": "T Percival", "author_id": 954, "author_profile": "https://Stackoverflow.com/users/954", "pm_score": 2, "selected": false, "text": "PATH" }, { "answer_id": 214503, "author": "tardate", "author_id": 6329, "author_profile": "https://Stack...
2008/08/16
[ "https://Stackoverflow.com/questions/13204", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1450/" ]
13,213
<p>I see often (rewritten) URLs without ID in it, like on some wordpress installations. What is the best way of achieve this?</p> <p>Example: site.com/product/some-product-name/</p> <p>Maybe to keep an array of page names and IDs in cache, to avoid DB query on every page request? How to avoid conflicts, and what are other issues on using urls without IDs?</p>
[ { "answer_id": 89901, "author": "Devin Reams", "author_id": 16248, "author_profile": "https://Stackoverflow.com/users/16248", "pm_score": 1, "selected": false, "text": "RewriteRule ^([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$ /index.php?year=$1&monthnum=$2&day=$3 [QSA,L]\n" } ]
2008/08/16
[ "https://Stackoverflow.com/questions/13213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1407/" ]
13,224
<p>I've included a mobile web form in my asp.net project, I thought that it could/should be seen just for my mobile users but I realize that it can also be seen from any browser, I don't see problem there cause I could diff the access using HttpBrowserCapabilities.IsMobileDevice=true and transferring to the appropiate aspx page, but it results that when I access to the web form from my mobile device it is identified as IsMobileDevice = false and sends me to another page.</p> <p>How could it be possible that?</p> <p>The mobile device runs Pocket PC 2003.</p>
[ { "answer_id": 14182, "author": "Pat Hermens", "author_id": 1677, "author_profile": "https://Stackoverflow.com/users/1677", "pm_score": 2, "selected": false, "text": "HttpContext.Current.Request.Headers(\"User-Agent\")" } ]
2008/08/16
[ "https://Stackoverflow.com/questions/13224", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1130097/" ]
13,225
<p>I've recently inherited a internationalized and text-heavy Struts 1.1 web application. Many of the JSP files look like:</p> <pre class="lang-jsp prettyprint-override"><code>&lt;p&gt; &lt;bean:message key="alert" /&gt; &lt;/p&gt; </code></pre> <p>and the properties files look like:</p> <pre><code>messages.properties alert=Please update your &lt;a href="/address.do"&gt;address&lt;/a&gt; and &lt;a href="/contact.do"&gt;contact information&lt;/a&gt;. </code></pre> <p>with the appropriate translations in N other languages (messages_fr.properties, etc).</p> <p>Problems:</p> <ol> <li><em><strong>DRY violation</strong></em> - I have N references to my Struts action URLs instead of 1, which makes refactoring action URLs error-prone.</li> <li><em><strong>Mixed concerns</strong></em> - My application's markup is now in more than just my JSP files, making it difficult for a web specialist to tweak the markup (using CSS, etc).</li> <li><em><strong>Post-translation markup</strong></em> - Anytime I receive newly-translated text, I must decide what to surround with the <code>&lt;a&gt;...&lt;/a&gt;</code> markup. Easy for English but less so for unfamiliar languages.</li> </ol> <p>I've considered adding placeholders in the messages file, like:</p> <pre><code>alert=Please update your {0} and {1}. </code></pre> <p>but then the words "address" and "contact information" would somehow need to be localized, wrapped with markup, and passed to my message tag - and I can't see an easy way to do it.</p> <p>What can I do to improve this?</p>
[ { "answer_id": 13239, "author": "McDowell", "author_id": 304, "author_profile": "https://Stackoverflow.com/users/304", "pm_score": 0, "selected": false, "text": "#\nalert=Please update your {0}address{1} and {2}contact information{3}.\n" }, { "answer_id": 13359, "author": "Mc...
2008/08/16
[ "https://Stackoverflow.com/questions/13225", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1557/" ]
13,343
<p>I've been thinking about software estimation lately, and I have a bunch of questions around time spent coding. I'm curious to hear from people who have had at least a couple years of experience developing software.</p> <p>When you have to estimate the amount of time you'll spend working on something, how many hours of the day do you spend coding? What occupies the other non-coding hours?</p> <p>Do you find you spend more or less hours than your teammates coding? Do you feel like you're getting more or less work done than they are?</p> <p>What are your work conditions like? Private office, shared office, team room? Coding alone or as a pair? How has your working condition changed the amount of time you spend coding each day? If you can work from home, does that help or hurt your productivity?</p> <p>What development methodology do you use? Waterfall? Agile? Has changing from one methodology to another had an impact on your coding hours per day?</p> <p>Most importantly: Are you happy with your productivity? If not, what single change would you make that would have the most impact on it?</p>
[ { "answer_id": 9800326, "author": "Coral Doe", "author_id": 1252063, "author_profile": "https://Stackoverflow.com/users/1252063", "pm_score": 1, "selected": false, "text": "formality" } ]
2008/08/16
[ "https://Stackoverflow.com/questions/13343", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1554/" ]
13,345
<p>I've always wanted a way to make a socket connection to a server and allow the server to manipulate the page DOM. For example, this could be used in a stock quotes page, so the server can push new quotes as they become available. </p> <p>I know this is a classic limitation (feature?) of HTTP's request/response protocol, but I think this could be implemented as a Firefox plugin (cross-browser compatibility is not important for my application). Java/Flash solutions are not acceptable, because (as far as i know) they live in a box and can't interact with the DOM. </p> <p>Can anyone confirm whether this is within the ability of a Firefox plugin? Has someone already created this or something similar? </p>
[ { "answer_id": 12466445, "author": "Beachhouse", "author_id": 783004, "author_profile": "https://Stackoverflow.com/users/783004", "pm_score": 1, "selected": false, "text": "socket_send(\"This was sent via the socket\\n\\n\");" } ]
2008/08/16
[ "https://Stackoverflow.com/questions/13345", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
13,362
<p>I've got a div that uses overflow:auto to keep the contents inside the div as it is resized and dragged around the page. I'm using some ajax to retrieve lines of text from the server, then append them to the end of the div, so the content is growing downwards. Every time this happens, I'd like to use JS to scroll the div to the bottom so the most recently added content is visible, similar to the way a chat room or command line console would work.</p> <p>So far I've been using this snippet to do it (I'm also using jQuery, hence the $() function):</p> <pre><code>$("#thediv").scrollTop = $("#thediv").scrollHeight; </code></pre> <p>However it's been giving me inconsistent results. Sometimes it works, sometimes not, and it completely ceases to work if the user ever resizes the div or moves the scroll bar manually.</p> <p>The target browser is Firefox 3, and it's being deployed in a controlled environment so it doesn't need to work in IE at all.</p> <p>Any ideas guys? This one's got me stumped. Thanks!</p>
[ { "answer_id": 13365, "author": "Shog9", "author_id": 811, "author_profile": "https://Stackoverflow.com/users/811", "pm_score": 7, "selected": true, "text": "scrollHeight" }, { "answer_id": 14494, "author": "Vincent Robert", "author_id": 268, "author_profile": "https:...
2008/08/16
[ "https://Stackoverflow.com/questions/13362", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1384/" ]
13,396
<p>I love list comprehensions in Python, because they concisely represent a transformation of a list.</p> <p>However, in other languages, I frequently find myself writing something along the lines of:</p> <pre><code>foreach (int x in intArray) if (x &gt; 3) //generic condition on x x++ //do other processing </code></pre> <p>This example is in C#, where I'm under the impression LINQ can help with this, but is there some common programming construct which can replace this slightly less-than-elegant solution? Perhaps a data structure I'm not considering?</p>
[ { "answer_id": 13403, "author": "James A. Rosen", "author_id": 1190, "author_profile": "https://Stackoverflow.com/users/1190", "pm_score": 0, "selected": false, "text": "intArray.select { |x| x > 3 }.each do |x|\n # do other processing\nend\n" }, { "answer_id": 13405, "autho...
2008/08/16
[ "https://Stackoverflow.com/questions/13396", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1266/" ]
13,434
<p>How can I get programmatic access to the call stack?</p>
[ { "answer_id": 13439, "author": "James Avery", "author_id": 537, "author_profile": "https://Stackoverflow.com/users/537", "pm_score": 3, "selected": false, "text": "StackTrace" }, { "answer_id": 13621, "author": "Scott Dorman", "author_id": 1559, "author_profile": "ht...
2008/08/17
[ "https://Stackoverflow.com/questions/13434", "https://Stackoverflow.com", "https://Stackoverflow.com/users/100/" ]
13,454
<p>I wrote a piece of code to convert PHP's striplashes into valid Python [backslash] escapes:</p> <pre><code>cleaned = stringwithslashes cleaned = cleaned.replace('\\n', '\n') cleaned = cleaned.replace('\\r', '\n') cleaned = cleaned.replace('\\', '') </code></pre> <p>How can I condense it? </p>
[ { "answer_id": 13456, "author": "Brad Wilson", "author_id": 1554, "author_profile": "https://Stackoverflow.com/users/1554", "pm_score": 0, "selected": false, "text": "cleaned = stringwithslashes.replace(\"\\\\n\",\"\\n\").replace(\"\\\\r\",\"\\n\").replace(\"\\\\\",\"\")\n" }, { ...
2008/08/17
[ "https://Stackoverflow.com/questions/13454", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
13,470
<p>I was reading <a href="https://stackoverflow.com/questions/6173/regular-expression-for-parsing-links-from-a-webpage">this question</a> about how to parse URLs out of web pages and had a question about the <a href="https://stackoverflow.com/questions/6173/regular-expression-for-parsing-links-from-a-webpage#6183">accepted answer</a> which offered this solution:</p> <pre class="lang-none prettyprint-override"><code>((mailto\:|(news|(ht|f)tp(s?))\://){1}\S+) </code></pre> <p>The solution was offered by <a href="https://stackoverflow.com/users/350/csmba">csmba</a> and he credited it to <a href="http://regexlib.com/Search.aspx?k=URL" rel="nofollow noreferrer">regexlib.com</a>. Whew. Credits done.</p> <p>I think this is a fairly naive regular expression but it's a fine starting point for building something better. But, my question is this:</p> <p>What is the point of <code>{1}</code>? It means "exactly one of the previous grouping", right? Isn't that the default behavior of a grouping in a regular expression? Would the expression be changed in any way if the <code>{1}</code> were removed?</p> <p>If I saw this from a coworker I would point out his or her error but as I write this the response is rated at a 6 and the expression on regexlib.com is rated a 4 of 5. So maybe I'm missing something?</p>
[ { "answer_id": 13483, "author": "jj33", "author_id": 430, "author_profile": "https://Stackoverflow.com/users/430", "pm_score": 2, "selected": false, "text": "tibook 0 /home/jj33/swap > cat text\nText this is http://example.com text this is\nText this is http://http://example.com text thi...
2008/08/17
[ "https://Stackoverflow.com/questions/13470", "https://Stackoverflow.com", "https://Stackoverflow.com/users/430/" ]
13,473
<p>I would like to sort an array in ascending order using <code>C/C++</code>. The outcome is an array containing element indexes. Each index is corespondent to the element location in the sorted array.</p> <p><strong>Example</strong></p> <pre><code>Input: 1, 3, 4, 9, 6 Output: 1, 2, 3, 5, 4 </code></pre> <p><strong>Edit:</strong> I am using shell sort procedure. The duplicate value indexes are arbitrarily chosen based on which duplicate values are first in the original array.</p> <h3>Update:</h3> <p>Despite my best efforts, I haven't been able to implement a sorting algorithm for an array of pointers. The current example won't compile.</p> <p>Could someone please tell me what's wrong?</p> <p>I'd very much appreciate some help!</p> <pre><code>void SortArray(int ** pArray, int ArrayLength) { int i, j, flag = 1; // set flag to 1 to begin initial pass int * temp; // holding variable orig with no * for (i = 1; (i &lt;= ArrayLength) &amp;&amp; flag; i++) { flag = 0; for (j = 0; j &lt; (ArrayLength - 1); j++) { if (*pArray[j + 1] &gt; *pArray[j]) // ascending order simply changes to &lt; { &amp;temp = &amp;pArray[j]; // swap elements &amp;pArray[j] = &amp;pArray[j + 1]; //the problem lies somewhere in here &amp;pArray[j + 1] = &amp;temp; flag = 1; // indicates that a swap occurred. } } } }; </code></pre>
[ { "answer_id": 13477, "author": "Patrick", "author_id": 429, "author_profile": "https://Stackoverflow.com/users/429", "pm_score": 0, "selected": false, "text": "newArray = sorted(oldArray)\nblankArray = [0] * len(oldArray)\nfor i in xrange(len(newArray)):\n dex = oldArray.index(newArray...
2008/08/17
[ "https://Stackoverflow.com/questions/13473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/522/" ]
13,537
<p>I've heard of the idea of bootstrapping a language, that is, writing a compiler/interpreter for the language in itself. I was wondering how this could be accomplished and looked around a bit, and saw someone say that it could only be done by either</p> <ul> <li>writing an initial compiler in a different language.</li> <li>hand-coding an initial compiler in Assembly, which seems like a special case of the first</li> </ul> <p>To me, neither of these seem to actually be <em>bootstrapping</em> a language in the sense that they both require outside support. Is there a way to actually write a compiler in its own language?</p>
[ { "answer_id": 29983650, "author": "Basile Starynkevitch", "author_id": 841108, "author_profile": "https://Stackoverflow.com/users/841108", "pm_score": 1, "selected": false, "text": "*/*.{ml,mli}" } ]
2008/08/17
[ "https://Stackoverflow.com/questions/13537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1266/" ]
13,540
<p>I've written a stored proc that will do an update if a record exists, otherwise it will do an insert. It looks something like this:</p> <pre><code>update myTable set Col1=@col1, Col2=@col2 where ID=@ID if @@rowcount = 0 insert into myTable (Col1, Col2) values (@col1, @col2) </code></pre> <p>My logic behind writing it in this way is that the update will perform an implicit select using the where clause and if that returns 0 then the insert will take place.</p> <p>The alternative to doing it this way would be to do a select and then based on the number of rows returned either do an update or insert. This I considered inefficient because if you are to do an update it will cause 2 selects (the first explicit select call and the second implicit in the where of the update). If the proc were to do an insert then there'd be no difference in efficiency.</p> <p>Is my logic sound here? Is this how you would combine an insert and update into a stored proc?</p>
[ { "answer_id": 25318, "author": "Dima Malenko", "author_id": 2586, "author_profile": "https://Stackoverflow.com/users/2586", "pm_score": 3, "selected": false, "text": "BEGIN TRANSACTION Upsert\nupdate myTable set Col1=@col1, Col2=@col2 where ID=@ID\nif @@rowcount = 0\ninsert into myTable...
2008/08/17
[ "https://Stackoverflow.com/questions/13540", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1463/" ]
13,569
<p>In our place we're split between using mysqli and PDO for stuff like prepared statements and transaction support. Some projects use one, some the other. There is little realistic likelihood of us ever moving to another RDBMS.</p> <p>I prefer PDO for the single reason that it allows named parameters for prepared statements, and as far as I am aware mysqli does not.</p> <p>Are there any other pros and cons to choosing one over the other as a standard as we consolidate our projects to use just one approach?</p>
[ { "answer_id": 49787, "author": "Brian Warshaw", "author_id": 1344, "author_profile": "https://Stackoverflow.com/users/1344", "pm_score": 5, "selected": false, "text": "call_user_func_array()" }, { "answer_id": 127319, "author": "Unlabeled Meat", "author_id": 20291, "...
2008/08/17
[ "https://Stackoverflow.com/questions/13569", "https://Stackoverflow.com", "https://Stackoverflow.com/users/137/" ]
13,578
<p>The need arose, in our product, to determine how long the current user has been logged on to Windows (specifically, Vista). It seems there is no straight forward API function for this and I couldn't find anything relevant with WMI (although I'm no expert with WMI, so I might have missed something).</p> <p>Any ideas?</p>
[ { "answer_id": 13600, "author": "Nickolay", "author_id": 1026, "author_profile": "https://Stackoverflow.com/users/1026", "pm_score": 3, "selected": true, "text": "strComputer = \".\"\nSet objWMIService = GetObject(\"winmgmts:\" _\n & \"{impersonationLevel=impersonate}!\\\\\" _\n & ...
2008/08/17
[ "https://Stackoverflow.com/questions/13578", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1596/" ]
13,599
<p>Does anyone know how to transform a enum value to a human readable value?</p> <p>For example:</p> <blockquote> <p>ThisIsValueA should be "This is Value A".</p> </blockquote>
[ { "answer_id": 13611, "author": "Adam Haile", "author_id": 194, "author_profile": "https://Stackoverflow.com/users/194", "pm_score": 2, "selected": false, "text": "using System;\nusing System.Reflection;\nnamespace FunWithEnum\n{\n enum Coolness : byte\n {\n [Description(\"N...
2008/08/17
[ "https://Stackoverflow.com/questions/13599", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1154/" ]
13,615
<p>I need to validate an integer to know if is a valid enum value.</p> <p>What is the best way to do this in C#?</p>
[ { "answer_id": 13635, "author": "Jon Limjap", "author_id": 372, "author_profile": "https://Stackoverflow.com/users/372", "pm_score": 3, "selected": false, "text": "Enum.IsDefined" }, { "answer_id": 13651, "author": "Mike Polen", "author_id": 212, "author_profile": "ht...
2008/08/17
[ "https://Stackoverflow.com/questions/13615", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1154/" ]
13,620
<p>(assume php5) consider</p> <pre><code>&lt;?php $foo = 'some words'; //case 1 print "these are $foo"; //case 2 print "these are {$foo}"; //case 3 print 'these are ' . $foo; ?&gt; </code></pre> <p>Is there much of a difference between 1 and 2?</p> <p>If not, what about between 1/2 and 3?</p>
[ { "answer_id": 13665, "author": "Adam Wright", "author_id": 1200, "author_profile": "https://Stackoverflow.com/users/1200", "pm_score": 7, "selected": true, "text": "function timeFunc($function, $runs)\n{\n $times = array();\n\n for ($i = 0; $i < $runs; $i++)\n {\n $time = microtim...
2008/08/17
[ "https://Stackoverflow.com/questions/13620", "https://Stackoverflow.com", "https://Stackoverflow.com/users/314/" ]
13,678
<p>I am part of a high school robotics team, and there is some debate about which language to use to program our robot. We are choosing between C (or maybe C++) and LabVIEW. There are pros for each language.</p> <p>C(++):</p> <ul> <li>Widely used</li> <li>Good preparation for the future (most programming positions require text-based programmers.)</li> <li>We can expand upon our C codebase from last year</li> <li>Allows us to better understand what our robot is doing.</li> </ul> <p>LabVIEW</p> <ul> <li>Easier to visualize program flow (blocks and wires, instead of lines of code)</li> <li>Easier to teach (Supposedly...)</li> <li>"The future of programming is graphical." (Think so?)</li> <li>Closer to the Robolab background that some new members may have.</li> <li>Don't need to intimately know what's going on. Simply tell the module to find the red ball, don't need to know how.</li> </ul> <p>This is a very difficult decision for us, and we've been debating for a while. Based on those pros for each language, and on the experience you've got, <strong>what do you think the better option is?</strong> Keep in mind that we aren't necessarily going for pure efficiency. We also hope to prepare our programmers for a future in programming.</p> <p>Also:</p> <ul> <li><strong>Do you think that graphical languages such as LabVEIW are the future of programming?</strong></li> <li><strong>Is a graphical language easier to learn than a textual language?</strong> I think that they should be about equally challenging to learn.</li> <li>Seeing as we are partailly rooted in helping people learn, <strong>how much should we rely on prewritten modules, and how much should we try to write on our own?</strong> ("Good programmers write good code, great programmers copy great code." But isn't it worth being a good programmer, first?)</li> </ul> <p>Thanks for the advice!</p> <hr> <p>Edit: I'd like to emphasize this question more: The team captain thinks that LabVIEW is better for its ease of learning and teaching. <strong>Is that true?</strong> I think that C could be taught just as easily, and beginner-level tasks would still be around with C. I'd really like to hear your opinions. <strong>Is there any reason that typing while{} should be any more difficult than creating a "while box?"</strong> <strong>Isn't it just as intuitive that program flows line by line, only modified by ifs and loops, as it is intuitive that the program flows through the wire, only modified by ifs and loops!?</strong></p> <p>Thanks again!</p> <hr> <p>Edit: I just realized that this falls under the topic of "language debate." I hope it's okay, because it's about what's best for a specific branch of programming, with certain goals. If it's not... I'm sorry...</p>
[ { "answer_id": 13746, "author": "Brendan", "author_id": 199, "author_profile": "https://Stackoverflow.com/users/199", "pm_score": 6, "selected": true, "text": "y = x*x + x + 1" }, { "answer_id": 352310, "author": "dbr", "author_id": 745, "author_profile": "https://Sta...
2008/08/17
[ "https://Stackoverflow.com/questions/13678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1615/" ]
13,698
<p>I've seen it mentioned in many blogs around the net, but I believe it shoud be discussed here. What can we do when we have an MVC framework (I am interested in ZEND) in PHP but our host does not provide mod_rewrite? Are there any "short-cuts"? Can we transfer control in any way (so that a mapping may occur between pages)? Any ideas? Thank you :-)</p>
[ { "answer_id": 13777, "author": "Theo", "author_id": 1109, "author_profile": "https://Stackoverflow.com/users/1109", "pm_score": 3, "selected": true, "text": "mod_rewrite" } ]
2008/08/17
[ "https://Stackoverflow.com/questions/13698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1622/" ]
13,725
<p><code>NSInteger</code>/<code>NSUInteger</code> are Cocoa-defined replacements for the regular built-in types.</p> <p>Is there any benefit to using the NS* types over the built-ins? Which do you prefer and why? Are <code>NSInteger</code> and <code>int</code> the same width on 32-bit / 64-bit platforms?</p>
[ { "answer_id": 13730, "author": "Sören Kuklau", "author_id": 1600, "author_profile": "https://Stackoverflow.com/users/1600", "pm_score": 4, "selected": false, "text": "#if __LP64__ || NS_BUILD_32_LIKE_64\ntypedef long NSInteger;\ntypedef unsigned long NSUInteger;\n#else\ntypedef int NSIn...
2008/08/17
[ "https://Stackoverflow.com/questions/13725", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1043/" ]
13,751
<p>How can I permanently enable line numbers in IntelliJ IDEA?</p>
[ { "answer_id": 27353549, "author": "MaxM", "author_id": 1518458, "author_profile": "https://Stackoverflow.com/users/1518458", "pm_score": 3, "selected": false, "text": "Editor -> General -> Appearance" }, { "answer_id": 34649002, "author": "mpontillo", "author_id": 77939,...
2008/08/17
[ "https://Stackoverflow.com/questions/13751", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
13,753
<p>I'm missing something here:</p> <pre><code>$objSearcher = New-Object System.DirectoryServices.DirectorySearcher $objSearcher.SearchRoot = New-Object System.DirectoryServices.DirectoryEntry $objSearcher.Filter = ("(objectclass=computer)") $computers = $objSearcher.findall() </code></pre> <p>So the question is why do the two following outputs differ?</p> <pre><code>$computers | %{ "Server name in quotes $_.properties.name" "Server name not in quotes " + $_.properties.name } PS&gt; $computers[0] | %{"$_.properties.name"; $_.properties.name} System.DirectoryServices.SearchResult.properties.name GORILLA </code></pre>
[ { "answer_id": 13878, "author": "slipsec", "author_id": 1635, "author_profile": "https://Stackoverflow.com/users/1635", "pm_score": 0, "selected": false, "text": "PS C:\\> $computers[0] | %{ \"$_.properties.name\"; \"$($_.properties.name)\" }\nSystem.DirectoryServices.SearchResult.proper...
2008/08/17
[ "https://Stackoverflow.com/questions/13753", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1635/" ]
13,763
<p>Is there a function like <code>document.getElementById("FirstDiv").clear()</code>?</p>
[ { "answer_id": 13769, "author": "eplawless", "author_id": 1370, "author_profile": "https://Stackoverflow.com/users/1370", "pm_score": 6, "selected": false, "text": "var mydiv = document.getElementById('FirstDiv');\nwhile(mydiv.firstChild) {\n mydiv.removeChild(mydiv.firstChild);\n}\n" ...
2008/08/17
[ "https://Stackoverflow.com/questions/13763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/184/" ]
13,786
<p>Are we supposed to find workarounds in our web applications so that they will work in every situation? Is it time to do away with IE6 programming?</p>
[ { "answer_id": 2863045, "author": "alemani", "author_id": 291181, "author_profile": "https://Stackoverflow.com/users/291181", "pm_score": 1, "selected": false, "text": "http://browsershots.org/\n" } ]
2008/08/17
[ "https://Stackoverflow.com/questions/13786", "https://Stackoverflow.com", "https://Stackoverflow.com/users/184/" ]
13,791
<p>I am trying to implement string unescaping with Python regex and backreferences, and it doesn't seem to want to work very well. I'm sure it's something I'm doing wrong but I can't figure out what...</p> <pre><code>&gt;&gt;&gt; import re &gt;&gt;&gt; mystring = r"This is \n a test \r" &gt;&gt;&gt; p = re.compile( "\\\\(\\S)" ) &gt;&gt;&gt; p.sub( "\\1", mystring ) 'This is n a test r' &gt;&gt;&gt; p.sub( "\\\\\\1", mystring ) 'This is \\n a test \\r' &gt;&gt;&gt; p.sub( "\\\\1", mystring ) 'This is \\1 a test \\1' </code></pre> <p>I'd like to replace \\[char] with \[char], but backreferences in Python don't appear to follow the same rules they do in every other implementation I've ever used. Could someone shed some light?</p>
[ { "answer_id": 13844, "author": "Anders Eurenius", "author_id": 1421, "author_profile": "https://Stackoverflow.com/users/1421", "pm_score": 2, "selected": false, "text": "\"\\\\n\" == r\"\\n\"\n\n>>> import re\n>>> mystring = r\"This is \\\\n a test \\\\r\"\n>>> p = re.compile( r\"[\\\\]...
2008/08/17
[ "https://Stackoverflow.com/questions/13791", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1370/" ]
13,832
<p>I have taken over the development of a web application that is targeted at the .net 1.0 framework and is written in C# and Visual Basic. </p> <p>I decided that the first thing we need to do is refine the build process, I wrote build files for the C# projects, but am having tons of problems creating a build file for Visual Basic. </p> <p>Admittedly, I do not personally know VB, but it seems like I have to hardcode all the imports and references in my build file to get anything to work...certainly not the best way to be doing things...</p> <p>For any example: if I do not include the namespace System in the build file I will get several errors of common Unkown Types e.g: Guid</p> <p>does NAnt typically require this for VB code or is does the VB code need a possible NAnt-freindly refactoring?</p> <p>Does anybody have VB NAnt tips?</p>
[ { "answer_id": 32391, "author": "RobertTheGrey", "author_id": 1107, "author_profile": "https://Stackoverflow.com/users/1107", "pm_score": 1, "selected": false, "text": "<target name=\"WinBuild\">\n <exec program=\"msbuild.exe\"\n basedir=\"${DotNetPath}\"\n workingdir=\"${...
2008/08/17
[ "https://Stackoverflow.com/questions/13832", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1638/" ]
13,851
<p>I am having trouble with IE7. I have a header, which is an IMG. Under it I have a div that represents a menu, they have to be attached to each other without space in between. Both are 1000px width. In Opera and FireFox the header and the menu are neatly attached to each other. However, in IE7, there is a small space between the menu DIV and the IMG. I have tried explicitly defining padding and margin on the IMG, however it does not work. I have had this problem before, so it seems to be a IE7 quirk.</p> <p>My HTML Code:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="middle"&gt; &lt;img id="ctl00_headerHolder_headerImage" src="pictures/headers/header_home.jpg" style="border-width:0px;" /&gt; &lt;div id="ctl00_menuPanel" class="menu"&gt; &lt;a id="ctl00_home" href="Default.aspx" style="color:#FFCC33;"&gt;Home&lt;/a&gt; | &lt;a id="ctl00_leden" href="Leden.aspx"&gt;Leden&lt;/a&gt; | &lt;a id="ctl00_agenda" href="Agenda.aspx"&gt;Agenda&lt;/a&gt; | &lt;a id="ctl00_fotos" href="Fotos.aspx"&gt;Foto's&lt;/a&gt; | &lt;a id="ctl00_geschiedenis" href="Geschiedenis.aspx"&gt;Geschiedenis&lt;/a&gt; | &lt;a id="ctl00_gastenboek" href="Gastenboek.aspx"&gt;Gastenboek&lt;/a&gt; &lt;/div&gt; &lt;/div&gt;</code></pre> </div> </div> </p>
[ { "answer_id": 13855, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "img {\npadding: 0px;\nmargin: 0px;\ndisplay: block;\n}\n" }, { "answer_id": 14183, "author": "Akira", "author_i...
2008/08/17
[ "https://Stackoverflow.com/questions/13851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
13,857
<p>I've been reading a lot about closures and I think I understand them, but without clouding the picture for myself and others, I am hoping someone can explain closures as succinctly and clearly as possible. I'm looking for a simple explanation that might help me understand where and why I would want to use them.</p>
[ { "answer_id": 13875, "author": "Anders Eurenius", "author_id": 1421, "author_profile": "https://Stackoverflow.com/users/1421", "pm_score": 6, "selected": false, "text": ">>> def makeConstantAdder(x):\n... constant = x\n... def adder(y):\n... return y + constant\n... ...
2008/08/17
[ "https://Stackoverflow.com/questions/13857", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1649/" ]
13,863
<p>I have been trying to find an easy way to parse a search query and convert it to an SQL query for my DB. </p> <p>I have found two solutions:</p> <ol> <li><em><a href="https://lucene.apache.org/" rel="nofollow noreferrer">Lucene</a></em>: Powerful Java-based search engine, contains a query parser but it isn't very configurable and I could find a way to easily hack/adapt it to create SQL queries.</li> <li><em><a href="http://www.antlr.org/" rel="nofollow noreferrer">ANTLR</a></em>: A veteran text lexer-parser. Used for building anything from compilers to sky scrapers. ANTLR is highly configurable but everyone touching the code from now on will have to learn a new language...</li> </ol> <p>Any other ideas?</p>
[ { "answer_id": 154639, "author": "Mr. Shiny and New 安宇", "author_id": 7867, "author_profile": "https://Stackoverflow.com/users/7867", "pm_score": 1, "selected": false, "text": "new AndExp(new FieldContainsExp(\"NAME\", \"Harry\"), new FieldContainsExp(\"NAME\", \"Potter\")\n" }, { ...
2008/08/17
[ "https://Stackoverflow.com/questions/13863", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1651/" ]
13,927
<p>When I've registered an object <strong>foo</strong> to receive KVO notifications from another object <strong>bar</strong> (using addObserver:...), if I then deallocate <strong>foo</strong> do I need to send a <code>removeObserver:forKeyPath:</code> message to <strong>bar</strong> in -dealloc?</p>
[ { "answer_id": 14054, "author": "Chris Hanson", "author_id": 714, "author_profile": "https://Stackoverflow.com/users/714", "pm_score": 6, "selected": true, "text": "-removeObserver:forKeyPath:" }, { "answer_id": 65336, "author": "Community", "author_id": -1, "author_p...
2008/08/17
[ "https://Stackoverflow.com/questions/13927", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1512/" ]
13,938
<p><img src="https://i.stack.imgur.com/DibJS.jpg" alt="Visual Studio folder structure"></p> <p>I need some advice as to how I easily can separate test runs for unit tests and integration test in Visual Studio. Often, or always, I structure the solution as presented in the above picture: separate projects for unit tests and integration tests. The unit tests is run very frequently while the integration tests naturally is run when the context is correctly aligned.</p> <p>My goal is to somehow be able configure which tests (or test folders) to run when I use a keyboard shortcut. The tests should preferably be run by a graphical test runner (ReSharpers). So for example</p> <ul> <li>Alt+1 runs the tests in project BLL.Test, </li> <li>Alt+2 runs the tests in project DAL.Tests, </li> <li>Alt+3 runs them both (i.e. all the tests in the [Tests] folder, and</li> <li>Alt+4 runs the tests in folder [Tests.Integration].</li> </ul> <p>TestDriven.net have an option of running just the test in the selected folder or project by right-clicking it and select Run Test(s). Being able to do this, but via a keyboard command and with a graphical test runner would be awesome.</p> <p><img src="https://i.stack.imgur.com/NYnmJ.jpg" alt="TestDriven.net test run output"></p> <p>Currently I use VS2008, ReSharper 4 and nUnit. But advice for a setup in the general is of course also appreciated.</p>
[ { "answer_id": 13969, "author": "andynil", "author_id": 446, "author_profile": "https://Stackoverflow.com/users/446", "pm_score": 3, "selected": true, "text": "Sub TemporaryMacro()\n DTE.Windows.Item(Constants.vsWindowKindSolutionExplorer).Activate\n DTE.ActiveWindow.Object.GetItem...
2008/08/17
[ "https://Stackoverflow.com/questions/13938", "https://Stackoverflow.com", "https://Stackoverflow.com/users/446/" ]
13,941
<p>I'd like to have a python program alert me when it has completed its task by making a beep noise. Currently, I use <code>import os</code> and then use a command line speech program to say &quot;Process complete&quot;. I much rather it be a simple &quot;bell.&quot;</p> <p>I know that there's a function that can be used in <em>Cocoa</em> apps, <code>NSBeep</code>, but I don't think that has much anything to do with this.</p> <p>I've also tried</p> <pre class="lang-py prettyprint-override"><code>print(\a) </code></pre> <p>but that didn't work.</p> <p>I'm using a Mac, if you couldn't tell by my <em>Cocoa</em> comment, so that may help.</p>
[ { "answer_id": 13949, "author": "gbc", "author_id": 1667, "author_profile": "https://Stackoverflow.com/users/1667", "pm_score": 7, "selected": true, "text": "import sys\nsys.stdout.write('\\a')\nsys.stdout.flush()\n" }, { "answer_id": 13959, "author": "markpasc", "author_...
2008/08/17
[ "https://Stackoverflow.com/questions/13941", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1615/" ]
13,963
<p>I want to parse a config file sorta thing, like so:</p> <pre><code>[KEY:Value] [SUBKEY:SubValue] </code></pre> <p>Now I started with a <code>StreamReader</code>, converting lines into character arrays, when I figured there's gotta be a better way. So I ask you, humble reader, to help me.</p> <p>One restriction is that it has to work in a Linux/Mono environment (1.2.6 to be exact). I don't have the latest 2.0 release (of Mono), so try to restrict language features to C# 2.0 or C# 1.0.</p>
[ { "answer_id": 13975, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "public string check()\n {\n ArrayList tags = getTags();\n\n\n int stackSize = tags.Count;\n\n Stack sta...
2008/08/17
[ "https://Stackoverflow.com/questions/13963", "https://Stackoverflow.com", "https://Stackoverflow.com/users/61/" ]
13,981
<p>I understand that the <code>Ruby 1.8 AST</code> is traversed at runtime using a big switch statement, and many things like calling a method in a class or parent module involve the interpreter looking up and down the tree as it goes. Is there a straightforward way of accessing this <code>AST</code> in a <code>Ruby C</code> extension? Does it involve the Ruby extension API, or necessitate hacking the internal data structures directly?</p>
[ { "answer_id": 14498, "author": "maetl", "author_id": 14446, "author_profile": "https://Stackoverflow.com/users/14446", "pm_score": 0, "selected": false, "text": "ParseTree" } ]
2008/08/17
[ "https://Stackoverflow.com/questions/13981", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14446/" ]
14,008
<p>I've been looking for some good genetic programming examples for C#. Anyone knows of good online/book resources? Wonder if there is a C# library out there for Evolutionary/Genetic programming?</p>
[ { "answer_id": 24674105, "author": "giacomelli", "author_id": 956886, "author_profile": "https://Stackoverflow.com/users/956886", "pm_score": 2, "selected": false, "text": "var selection = new EliteSelection();\nvar crossover = new OrderedCrossover();\nvar mutation = new ReverseSequenceM...
2008/08/17
[ "https://Stackoverflow.com/questions/14008", "https://Stackoverflow.com", "https://Stackoverflow.com/users/877/" ]
14,029
<p>I have a ListView control, and I'm trying to figure out the easiest/best way to disallow changing the selected row(s), without <em>hiding</em> the selected row(s).</p> <p>I know there's a <code>HideSelection</code> property, but that only works when the <code>ListView</code> is still enabled (but not focused). I need the selection to be viewable even when the ListView is disabled.</p> <p>How can I implement this?</p>
[ { "answer_id": 1090706, "author": "Mugunth", "author_id": 90165, "author_profile": "https://Stackoverflow.com/users/90165", "pm_score": 0, "selected": false, "text": " private void listViewABC_SelectedIndexChanged(object sender, EventArgs e)\n {\n listViewABC.SelectedItems.C...
2008/08/17
[ "https://Stackoverflow.com/questions/14029", "https://Stackoverflow.com", "https://Stackoverflow.com/users/369/" ]
14,031
<p>In the past I've never been a fan of using triggers on database tables. To me they always represented some "magic" that was going to happen on the database side, far far away from the control of my application code. I also wanted to limit the amount of work the DB had to do, as it's generally a shared resource and I always assumed triggers could get to be expensive in high load scenarios.</p> <p>That said, I have found a couple of instances where triggers have made sense to use (at least in my opinion they made sense). Recently though, I found myself in a situation where I sometimes might need to "bypass" the trigger. I felt really guilty about having to look for ways to do this, and I still think that a better database design would alleviate the need for this bypassing. Unfortunately this DB is used by mulitple applications, some of which are maintained by a very uncooperative development team who would scream about schema changes, so I was stuck.</p> <p>What's the general consesus out there about triggers? Love em? Hate em? Think they serve a purpose in some scenarios? Do think that having a need to bypass a trigger means that you're "doing it wrong"?</p>
[ { "answer_id": 15093, "author": "jinsungy", "author_id": 1316, "author_profile": "https://Stackoverflow.com/users/1316", "pm_score": 0, "selected": false, "text": "UPDATE tblUsers\nSET Age = 11\nWHERE State = 'NY'\n" } ]
2008/08/18
[ "https://Stackoverflow.com/questions/14031", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1680/" ]
14,061
<p>I've created an "attached behaviour" in my WPF application which lets me handle the Enter keypress and move to the next control. I call it EnterKeyTraversal.IsEnabled, and you can see the code on my blog <a href="http://www.madprops.org/blog/enter-to-tab-as-an-attached-property/" rel="noreferrer">here</a>.</p> <p>My main concern now is that I may have a memory leak, since I'm handling the PreviewKeyDown event on UIElements and never explicitly "unhook" the event.</p> <p>What's the best approach to prevent this leak (if indeed there is one)? Should I keep a list of the elements I'm managing, and unhook the PreviewKeyDown event in the Application.Exit event? Has anyone had success with attached behaviours in their own WPF applications and come up with an elegant memory-management solution?</p>
[ { "answer_id": 6169737, "author": "John Fenton", "author_id": 613519, "author_profile": "https://Stackoverflow.com/users/613519", "pm_score": 3, "selected": false, "text": "ue.PreviewKeyDown += ue_PreviewKeyDown;\n" }, { "answer_id": 28239309, "author": "Daniel Bişar", "a...
2008/08/18
[ "https://Stackoverflow.com/questions/14061", "https://Stackoverflow.com", "https://Stackoverflow.com/users/615/" ]
14,118
<p>I'm writing my first Perl app -- an AOL Instant Messenger bot that talks to an Arduino microcontroller, which in turn controls a servo that will push the power button on our sysadmin's server, which freezes randomly every 28 hours or so. </p> <p>I've gotten all the hard stuff done, I'm just trying to add one last bit of code to break the main loop and log out of AIM when the user types 'quit'.</p> <p>The problem is, if I try to read from STDIN in the main program loop, it blocks the process until input is entered, essentially rendering the bot inactive. I've tried testing for EOF before reading, but no dice... EOF just always returns false.</p> <p>Here's below is some sample code I'm working with:</p> <pre><code>while(1) { $oscar-&gt;do_one_loop(); # Poll to see if any arduino data is coming in over serial port my $char = $port-&gt;lookfor(); # If we get data from arduino, then print it if ($char) { print "" . $char ; } # reading STDIN blocks until input is received... AAARG! my $a = &lt;STDIN&gt;; print $a; if($a eq "exit" || $a eq "quit" || $a eq 'c' || $a eq 'q') {last;} } print "Signing off... "; $oscar-&gt;signoff(); print "Done\n"; print "Closing serial port... "; $port-&gt;close() || warn "close failed"; print "Done\n"; </code></pre>
[ { "answer_id": 14124, "author": "jj33", "author_id": 430, "author_profile": "https://Stackoverflow.com/users/430", "pm_score": 5, "selected": true, "text": "select()" }, { "answer_id": 54816600, "author": "Gus Schlachter", "author_id": 3935928, "author_profile": "http...
2008/08/18
[ "https://Stackoverflow.com/questions/14118", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
14,138
<p>I installed the wxWidgets source code, compiled it and am linking the libraries thus obtained with my application code. Now I need to use OpenGL in my wxWidgets application. How do I enable this?</p>
[ { "answer_id": 35975, "author": "Jason Weathered", "author_id": 3736, "author_profile": "https://Stackoverflow.com/users/3736", "pm_score": 2, "selected": false, "text": "configure" }, { "answer_id": 72787, "author": "Baxissimo", "author_id": 9631, "author_profile": "...
2008/08/18
[ "https://Stackoverflow.com/questions/14138", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1630/" ]
14,165
<p>I'm seeing strange errors when my C++ code has min() or max() calls. I'm using Visual C++ compilers.</p>
[ { "answer_id": 14169, "author": "Ashwin Nanjappa", "author_id": 1630, "author_profile": "https://Stackoverflow.com/users/1630", "pm_score": 5, "selected": true, "text": "#define NOMINMAX\n#include <windows.h>\n" }, { "answer_id": 14177, "author": "Pat Notz", "author_id": ...
2008/08/18
[ "https://Stackoverflow.com/questions/14165", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1630/" ]
14,209
<p><code>System.Data.SqlClient.SqlException: Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.</code></p> <p>Anybody ever get this error and/or have any idea on it's cause and/or solution?</p> <p><a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=125227&amp;SiteID=1" rel="nofollow noreferrer">This link may have relevant information.</a></p> <p><strong>Update</strong></p> <p>The connection string is <code>=.\SQLEXPRESS;AttachDbFilename=C:\temp\HelloWorldTest.mdf;Integrated Security=True</code></p> <p>The suggested <code>User Instance=false</code> worked.</p>
[ { "answer_id": 1086442, "author": "Roboblob", "author_id": 125718, "author_profile": "https://Stackoverflow.com/users/125718", "pm_score": 4, "selected": false, "text": "exec sp_configure 'user instances enabled', 1.\nGO\nReconfigure\n" }, { "answer_id": 33201997, "author": "...
2008/08/18
[ "https://Stackoverflow.com/questions/14209", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1659/" ]
14,247
<p>I've only done a bit of Flex development thus far, but I've preferred the approach of creating controls programmatically over mxml files, because (and <em>please</em>, correct me if I'm wrong!) I've gathered that you can't have it both ways -- that is to say, have the class functionality in a separate ActionScript class file but have the contained elements declared in mxml.</p> <p>There doesn't seem to be much of a difference productivity-wise, but doing data binding programmatically seems somewhat less than trivial. I took a look at how the mxml compiler transforms the data binding expressions. The result is a bunch of generated callbacks and a lot more lines than in the mxml representation. So here's the question: <strong>is there a way to do data binding programmatically that doesn't involve a world of hurt?</strong></p>
[ { "answer_id": 14261, "author": "Theo", "author_id": 1109, "author_profile": "https://Stackoverflow.com/users/1109", "pm_score": 6, "selected": true, "text": "BindingUtils" }, { "answer_id": 36010, "author": "Nick Higgs", "author_id": 3187, "author_profile": "https://...
2008/08/18
[ "https://Stackoverflow.com/questions/14247", "https://Stackoverflow.com", "https://Stackoverflow.com/users/266/" ]
14,264
<p>What are the basic steps to compile an OpenGL application using <em>GLUT (OpenGL Utility Toolkit)</em> under Visual C++ Express Edition?</p>
[ { "answer_id": 112729, "author": "Baxissimo", "author_id": 9631, "author_profile": "https://Stackoverflow.com/users/9631", "pm_score": 3, "selected": false, "text": "exit()" } ]
2008/08/18
[ "https://Stackoverflow.com/questions/14264", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1630/" ]
14,278
<p>I'd like to provide some way of creating dynamically loadable plugins in my software. Typical way to do this is using the <a href="http://msdn.microsoft.com/en-us/library/ms684175(VS.85).aspx" rel="noreferrer">LoadLibrary</a> WinAPI function to load a dll and calling <a href="http://msdn.microsoft.com/en-us/library/ms683212(VS.85).aspx" rel="noreferrer">GetProcAddress</a> to get an pointer to a function inside that dll.</p> <p>My question is how do I dynamically load a plugin in C#/.Net application?</p>
[ { "answer_id": 14282, "author": "Zooba", "author_id": 891, "author_profile": "https://Stackoverflow.com/users/891", "pm_score": 5, "selected": true, "text": "Base" }, { "answer_id": 14286, "author": "Biri", "author_id": 968, "author_profile": "https://Stackoverflow.co...
2008/08/18
[ "https://Stackoverflow.com/questions/14278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1534/" ]
14,281
<p>I have over a million text files compressed into 40 zip files. I also have a list of about 500 model names of phones. I want to find out the number of times a particular model was mentioned in the text files. </p> <p>Is there any python module which can do a regex match on the files without unzipping it. Is there a simple way to solve this problem without unzipping?</p>
[ { "answer_id": 14320, "author": "Mark Harrison", "author_id": 116, "author_profile": "https://Stackoverflow.com/users/116", "pm_score": 4, "selected": true, "text": "#!/usr/bin/python\n\nimport zipfile\nf = zipfile.ZipFile('myfile.zip')\n\nfor subfile in f.namelist():\n print subfile\...
2008/08/18
[ "https://Stackoverflow.com/questions/14281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1448/" ]
14,287
<p>In my C/C++ program, I'm using <a href="http://opencvlibrary.sourceforge.net/" rel="noreferrer">OpenCV</a> to capture images from my webcam. The camera (<a href="http://en.wikipedia.org/wiki/Quickcam" rel="noreferrer">Logitech QuickCam IM</a>) can capture at resolutions <strong>320x240</strong>, <strong>640x480</strong> and <strong>1280x960</strong>. But, for some strange reason, OpenCV gives me images of resolution <strong>320x240</strong> only. Calls to change the resolution using <strong>cvSetCaptureProperty()</strong> with other resolution values just don't work. How do I capture images with the other resolutions possible with my webcam?</p>
[ { "answer_id": 14290, "author": "Ashwin Nanjappa", "author_id": 1630, "author_profile": "https://Stackoverflow.com/users/1630", "pm_score": 5, "selected": true, "text": "#define CV_CAP_PROP_DIALOG_DISPLAY 8\n#define CV_CAP_PROP_DIALOG_FORMAT 9\n#define CV_CAP_PROP_DIALOG_SOURCE 10\n#defi...
2008/08/18
[ "https://Stackoverflow.com/questions/14287", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1630/" ]
14,300
<p>For example; with the old command prompt it would be:</p> <pre><code>cmd.exe /k mybatchfile.bat </code></pre>
[ { "answer_id": 14313, "author": "Matt Hamilton", "author_id": 615, "author_profile": "https://Stackoverflow.com/users/615", "pm_score": 6, "selected": true, "text": "powershell -?\n" }, { "answer_id": 5346936, "author": "john", "author_id": 665321, "author_profile": "...
2008/08/18
[ "https://Stackoverflow.com/questions/14300", "https://Stackoverflow.com", "https://Stackoverflow.com/users/887/" ]
14,308
<p>I'm currently working at a small web development company, we mostly do campaign sites and other promotional stuff. For our first year we've been using a "server" for sharing project files, a plain windows machine with a network share. But this isn't exactly future proof. </p> <p>SVN is great for code (it's what we use now), but I want to have the comfort of versioning (or atleast some form of syncing) for all or most of our files. </p> <p><em>What I essentially want is something that does what subversion does for code, but for our documents/psd/pdf files.</em> </p> <p>I realize subversion handles binary files too, but I feel it might be a bit overkill for our purposes. It doesn't necessarily need all the bells and whistles of a full version control system, but something that that removes the need for incremental naming (Notes_1.23.doc) and lessens the chance of overwriting something by mistake. </p> <p>It also needs to be multiplatform, handle large files (100 mb+) and be usable by somewhat non technical people. </p>
[ { "answer_id": 14429, "author": "dbr", "author_id": 745, "author_profile": "https://Stackoverflow.com/users/745", "pm_score": 1, "selected": false, "text": "vcs checkout blah -r 234" } ]
2008/08/18
[ "https://Stackoverflow.com/questions/14308", "https://Stackoverflow.com", "https://Stackoverflow.com/users/914/" ]
14,330
<p>How do I convert the RGB values of a pixel to a single monochrome value?</p>
[ { "answer_id": 14331, "author": "Ashwin Nanjappa", "author_id": 1630, "author_profile": "https://Stackoverflow.com/users/1630", "pm_score": 6, "selected": true, "text": "mono = (0.2125 * color.r) + (0.7154 * color.g) + (0.0721 * color.b);\n" }, { "answer_id": 14339, "author":...
2008/08/18
[ "https://Stackoverflow.com/questions/14330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1630/" ]
14,344
<p>Is it possible to compile and run OpenGL programs from under Cygwin? If yes, how?</p>
[ { "answer_id": 68074857, "author": "Adriana", "author_id": 6908795, "author_profile": "https://Stackoverflow.com/users/6908795", "pm_score": 1, "selected": false, "text": "C:\\Program Files(x86)\\Microsoft Visual Studio\\2019\\Community\\SDK\\ScopeCPPSDK\\vc15\\lib\\SDK\\lib\\opengl32.li...
2008/08/18
[ "https://Stackoverflow.com/questions/14344", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1630/" ]
14,350
<p>I have a Flex swf hosted at <a href="http://www.a.com/a.swf" rel="nofollow noreferrer">http://www.a.com/a.swf</a>. I have a flash code on another doamin that tries loading the SWF:</p> <pre><code>_loader = new Loader(); var req:URLRequest = new URLRequest("http://services.nuconomy.com/n.swf"); _loader.contentLoaderInfo.addEventListener(Event.COMPLETE,onLoaderFinish); _loader.load(req); </code></pre> <p>On the onLoaderFinish event I try to load classes from the remote SWF and create them:</p> <pre><code>_loader.contentLoaderInfo.applicationDomain.getDefinition("someClassName") as Class </code></pre> <p>When this code runs I get the following exception</p> <pre><code>SecurityError: Error #2119: Security sandbox violation: caller http://localhost.service:1234/flashTest/Main.swf cannot access LoaderInfo.applicationDomain owned by http://www.b.com/b.swf. at flash.display::LoaderInfo/get applicationDomain() at NuconomyLoader/onLoaderFinish() </code></pre> <p>Is there any way to get this code working?</p>
[ { "answer_id": 14409, "author": "grapefrukt", "author_id": 914, "author_profile": "https://Stackoverflow.com/users/914", "pm_score": 2, "selected": false, "text": "<?xml version=\"1.0\"?>\n<!-- http://www.foo.com/crossdomain.xml -->\n<cross-domain-policy>\n <allow-access-from domain=\"w...
2008/08/18
[ "https://Stackoverflow.com/questions/14350", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1228206/" ]
14,359
<p>What recommendations can you give for a system which must do the following:</p> <p>Load Plugins (and eventually execute them) but have 2 methods of loading these plugins:</p> <ul> <li>Load only authorized plugins (developed by the owner of the software) </li> <li>Load all plugins</li> </ul> <p>And we need to be reasonably secure that the authorized plugins are the real deal (unmodified). However all plugins must be in seperate assemblies. I've been looking at using strong named assemblies for the plugins, with the public key stored in the loader application, but to me this seems too easy to modify the public key within the loader application (if the user was so inclined) regardless of any obfuscation of the loader application. Any more secure ideas?</p>
[ { "answer_id": 14409, "author": "grapefrukt", "author_id": 914, "author_profile": "https://Stackoverflow.com/users/914", "pm_score": 2, "selected": false, "text": "<?xml version=\"1.0\"?>\n<!-- http://www.foo.com/crossdomain.xml -->\n<cross-domain-policy>\n <allow-access-from domain=\"w...
2008/08/18
[ "https://Stackoverflow.com/questions/14359", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1111/" ]
14,373
<p>I am converting from existing CVS repository to SVN repository. CVS repository has few brances and I'd like to rename branches while converting.</p> <p>Wanted conversion is like this:</p> <pre><code>CVS branch SVN branch HEAD -&gt; branches/branchX branchA -&gt; trunk branchB -&gt; branches/branchB branchC -&gt; branches/branchC </code></pre> <p>That is, CVS HEAD becomes a normal branch and CVS branchA becomes SVN trunk.</p> <p>Both CVS and SVN repositories will be on same linux machine.</p> <p>How could this be done? </p> <p>Also conversion where CVS branchA becomes SVN trunk and all other CVS branches are ignored might be enough.</p>
[ { "answer_id": 211627, "author": "mhagger", "author_id": 24478, "author_profile": "https://Stackoverflow.com/users/24478", "pm_score": 1, "selected": false, "text": "--symbol-hints=symbol-hints.txt" } ]
2008/08/18
[ "https://Stackoverflow.com/questions/14373", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1431/" ]
14,375
<p>I'm using repository pattern with LINQ, have IRepository.DeleteOnSubmit(T Entity). It works fine, but when my entity class has interface, like this: </p> <pre><code>public interface IEntity { int ID {get;set;} } public partial class MyEntity: IEntity { public int ID { get { return this.IDfield; } set { this.IDfield=value; } } } </code></pre> <p>and then trying to delete some entity like this: </p> <pre><code>IEntity ie=repository.GetByID(1); repoitory.DeleteOnSubmit(ie); </code></pre> <p>throws<br> The member 'IEntity.ID' has no supported translation to SQL. </p> <p>fetching data from DB works, but delete and insert doesn't. How to use interface against DataContext?</p> <hr> <p>Here it is:<br> Exception message: The member 'MMRI.DAL.ITag.idContent' has no supported translation to SQL. </p> <p>Code: </p> <pre><code>var d = repContent.GetAll().Where(x =&gt; x.idContent.Equals(idContent)); foreach (var tagConnect in d) &lt;- error line { repContet.DeleteOnSubmit(tagConnect); </code></pre> <p>(it gets all tags from DB, and deletes them)</p> <p>And stack trace: </p> <pre><code>[NotSupportedException: The member 'MMRI.DAL.ITag.idContent' has no supported translation to SQL.] System.Data.Linq.SqlClient.Visitor.VisitMember(SqlMember m) +621763 System.Data.Linq.SqlClient.SqlVisitor.Visit(SqlNode node) +541 System.Data.Linq.SqlClient.SqlVisitor.VisitExpression(SqlExpression exp) +8 System.Data.Linq.SqlClient.SqlVisitor.VisitBinaryOperator(SqlBinary bo) +18 System.Data.Linq.SqlClient.Visitor.VisitBinaryOperator(SqlBinary bo) +18 System.Data.Linq.SqlClient.SqlVisitor.Visit(SqlNode node) +196 System.Data.Linq.SqlClient.SqlVisitor.VisitExpression(SqlExpression exp) +8 System.Data.Linq.SqlClient.SqlVisitor.VisitSelectCore(SqlSelect select) +46 System.Data.Linq.SqlClient.Visitor.VisitSelect(SqlSelect select) +20 System.Data.Linq.SqlClient.SqlVisitor.Visit(SqlNode node) +1024 System.Data.Linq.SqlClient.SqlProvider.BuildQuery( ... </code></pre> <p>When I try do decorate partial class:</p> <pre><code>[Column(Storage = "_idEvent", DbType = "Int NOT NULL", IsPrimaryKey = true)] public int idContent { get { return this.idEvent; } set { this.idEvent=value; } } </code></pre> <p>it throws error "Invalid column name 'idContent'."</p>
[ { "answer_id": 14381, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 0, "selected": false, "text": "using System.Data.Linq.Mapping;\n\npublic partial class MyEntity: IEntity \n { [Column(Storage=\"IDfield\", DbType=\"i...
2008/08/18
[ "https://Stackoverflow.com/questions/14375", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1407/" ]
14,378
<p>I want to use the mouse scrollwheel in my OpenGL GLUT program to zoom in and out of a scene? How do I do that?</p>
[ { "answer_id": 14379, "author": "Ashwin Nanjappa", "author_id": 1630, "author_profile": "https://Stackoverflow.com/users/1630", "pm_score": 6, "selected": true, "text": "void mouseWheel(int, int, int, int);\n" }, { "answer_id": 7885789, "author": "BentFX", "author_id": 71...
2008/08/18
[ "https://Stackoverflow.com/questions/14378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1630/" ]
14,386
<p>With the <em>Visual Studio 2005 C++ compiler</em>, I get the following warning when my code uses the <code>fopen()</code> and such calls:</p> <pre class="lang-none prettyprint-override"><code>1&gt;foo.cpp(5) : warning C4996: 'fopen' was declared deprecated 1&gt; c:\program files\microsoft visual studio 8\vc\include\stdio.h(234) : see declaration of 'fopen' 1&gt; Message: 'This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.' </code></pre> <p>How do I prevent this?</p>
[ { "answer_id": 14387, "author": "Ashwin Nanjappa", "author_id": 1630, "author_profile": "https://Stackoverflow.com/users/1630", "pm_score": 8, "selected": true, "text": "#define _CRT_SECURE_NO_DEPRECATE\n#include <stdio.h>\n" }, { "answer_id": 14506, "author": "John Sibly", ...
2008/08/18
[ "https://Stackoverflow.com/questions/14386", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1630/" ]
14,389
<p>I have a script that parses the filenames of TV episodes (show.name.s01e02.avi for example), grabs the episode name (from the www.thetvdb.com API) and automatically renames them into something nicer (Show Name - [01x02].avi)</p> <p>The script works fine, that is until you try and use it on files that have Unicode show-names (something I never really thought about, since all the files I have are English, so mostly pretty-much all fall within <code>[a-zA-Z0-9'\-]</code>)</p> <p>How can I allow the regular expressions to match accented characters and the likes? Currently the regex's config section looks like..</p> <pre><code>config['valid_filename_chars'] = """0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@£$%^&amp;*()_+=-[]{}"'.,&lt;&gt;`~? """ config['valid_filename_chars_regex'] = re.escape(config['valid_filename_chars']) config['name_parse'] = [ # foo_[s01]_[e01] re.compile('''^([%s]+?)[ \._\-]\[[Ss]([0-9]+?)\]_\[[Ee]([0-9]+?)\]?[^\\/]*$'''% (config['valid_filename_chars_regex'])), # foo.1x09* re.compile('''^([%s]+?)[ \._\-]\[?([0-9]+)x([0-9]+)[^\\/]*$''' % (config['valid_filename_chars_regex'])), # foo.s01.e01, foo.s01_e01 re.compile('''^([%s]+?)[ \._\-][Ss]([0-9]+)[\.\- ]?[Ee]([0-9]+)[^\\/]*$''' % (config['valid_filename_chars_regex'])), # foo.103* re.compile('''^([%s]+)[ \._\-]([0-9]{1})([0-9]{2})[\._ -][^\\/]*$''' % (config['valid_filename_chars_regex'])), # foo.0103* re.compile('''^([%s]+)[ \._\-]([0-9]{2})([0-9]{2,3})[\._ -][^\\/]*$''' % (config['valid_filename_chars_regex'])), ] </code></pre>
[ { "answer_id": 14391, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 5, "selected": true, "text": "[\\u0000-\\uFFFF]" } ]
2008/08/18
[ "https://Stackoverflow.com/questions/14389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/745/" ]
14,395
<p>For my own project at home, I'm using the rather excellent managed subversion hosting from <a href="http://cvsdude.com/" rel="nofollow noreferrer">CVSDude</a>. As it's only me working on the code right now, I'm not using CruiseControl.net, however I expect this will change in the next couple of months and will want a full build process to kick off upon check-in.</p> <p>Has anyone managed to get CruiseControl.net working with CVSDude? My collegue Mike has this <a href="http://mikehadlow.blogspot.com/2008/01/more-on-source-repository-hosting-what.html" rel="nofollow noreferrer">blog post</a> where someone from CVSDude said: </p> <blockquote> <p>"Your can use our post-commit call back facility to call a URL on your server, which passes variables relating to the last checkin (variables detailed in our specification). Your CGI script will these variables and perform whatever tasks are required i.e. updating Cruise Control, etc."</p> </blockquote> <p>Sounds lovely. But has anyone <em>actually done it</em> with cruisecontrol?</p>
[ { "answer_id": 14391, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 5, "selected": true, "text": "[\\u0000-\\uFFFF]" } ]
2008/08/18
[ "https://Stackoverflow.com/questions/14395", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1122/" ]
14,397
<p>Currently we have a project with a standard subversion repository layout of:</p> <p>./trunk<br> ./branches<br> ./tags</p> <p>However, as we're moving down the road of OSGi and a modular project, we've ended up with:</p> <p>./trunk/bundle/main<br> ./trunk/bundle/modulea<br> ./trunk/bundle/moduleb ./tags/bundle/main-1.0.0<br> ./tags/bundle/main-1.0.1<br> ./tags/bundle/modulea-1.0.0</p> <p>The 'build' is still quite monolithic in that it builds all modules in sequence, though I'm starting to wonder if we should refactor the build/repository to something more like:</p> <p>./bundle/main/trunk<br> ./bundle/main/tags/main-1.0.0<br> ./bundle/main/tags/main-1.0.1<br> ./bundle/modulea/trunk<br> ./bundle/modulea/tags/modulea-1.0.0 </p> <p>In this pattern I would imagine each module building itself, and storing its binary in a repository (maven, ivy, or another path of the subversion repository itself).</p> <p>Are there guidelines or 'best-practices' over project layouts once one goes modular?</p>
[ { "answer_id": 14441, "author": "Sören Kuklau", "author_id": 1600, "author_profile": "https://Stackoverflow.com/users/1600", "pm_score": 4, "selected": true, "text": "/bundle/<project>/(trunk|tags|branches)" } ]
2008/08/18
[ "https://Stackoverflow.com/questions/14397", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1720/" ]
14,402
<p>In my simple OpenGL program I get the following error about exit redefinition:</p> <pre><code>1&gt;c:\program files\microsoft visual studio 8\vc\include\stdlib.h(406) : error C2381: 'exit' : redefinition; __declspec(noreturn) differs 1&gt; c:\program files\microsoft visual studio 8\vc\platformsdk\include\gl\glut.h(146) : see declaration of 'exit' </code></pre> <p>I'm using Nate Robins' <a href="http://www.xmission.com/~nate/glut.html" rel="noreferrer">GLUT for Win32</a> and get this error with Visual Studio 2005 or Visual C++ 2005 (Express Edition). What is the cause of this error and how do I fix it?</p>
[ { "answer_id": 14403, "author": "Ashwin Nanjappa", "author_id": 1630, "author_profile": "https://Stackoverflow.com/users/1630", "pm_score": 7, "selected": true, "text": "#include <stdlib.h>\n#include <GL/glut.h>\n" } ]
2008/08/18
[ "https://Stackoverflow.com/questions/14402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1630/" ]
14,413
<p>I want to use the functions exposed under the OpenGL extensions. I'm on Windows, how do I do this?</p>
[ { "answer_id": 14414, "author": "Ashwin Nanjappa", "author_id": 1630, "author_profile": "https://Stackoverflow.com/users/1630", "pm_score": 5, "selected": true, "text": "glGenFramebuffersEXT()\nglBindFramebufferEXT()\nglFramebufferTexture2DEXT()\nglCheckFramebufferStatusEXT()\nglDeleteFr...
2008/08/18
[ "https://Stackoverflow.com/questions/14413", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1630/" ]
14,422
<p>For example, <a href="http://developer.apple.com/cocoa/pyobjc.html" rel="nofollow noreferrer">http://developer.apple.com/cocoa/pyobjc.html</a> is still for OS X 10.4 Tiger, not 10.5 Leopard.. And that's the official Apple documentation for it..</p> <p>The official PyObjC page is equally bad, <a href="http://pyobjc.sourceforge.net/" rel="nofollow noreferrer">http://pyobjc.sourceforge.net/</a></p> <p>It's so bad it's baffling.. I'm considering learning Ruby primarily because the RubyCocoa stuff is so much better documented, and there's lots of decent tutorials (<a href="http://www.rubycocoa.com/" rel="nofollow noreferrer">http://www.rubycocoa.com/</a> for example), and because of the Shoes GUI toolkit..</p> <p>Even <a href="http://66.163.168.225/babelfish/translate_url_content?lp=ja_en&amp;url=http%3A%2F%2Fblog.monospace.jp%2F2007%2F11%2F05%2Fxcode3_cocoa_python%2F&amp;fr=avbbf-us&amp;.intl=us" rel="nofollow noreferrer">this badly-auto-translated Japanese tutorial</a> is more useful than the rest of the documentation I could find..</p> <p>All I want to do is create fairly simple Python applications with Cocoa GUI's..<br> Can anyone shed light on the horrible documentation, or point me at some tutorials that don't just give you huge blocks of code and assume you know what <code>NSThread.detachNewThreadSelector_toTarget_withObject_("queryController", self, None)</code> does..?</p>
[ { "answer_id": 14479, "author": "Sören Kuklau", "author_id": 1600, "author_profile": "https://Stackoverflow.com/users/1600", "pm_score": 3, "selected": false, "text": "NSThread.detachNewThreadSelector_toTarget_withObject_(\"queryController\", self, None)\n" }, { "answer_id": 1213...
2008/08/18
[ "https://Stackoverflow.com/questions/14422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/745/" ]
14,451
<p>What is the best way to make a delphi application (delphi 2007 for win32 here) go completely full screen, removing the application border and covering windows task bar ?</p> <p>I am looking for something similar to what IE does when you hit F11.</p> <p>I wish this to be a run time option for the user not a design time decision by my good self.</p> <p>As Mentioned in the accepted answer </p> <pre><code>BorderStyle := bsNone; </code></pre> <p>was part of the way to do it. Strangely I kept getting a <code>E2010 Incompatible types: 'TFormBorderStyle' and 'TBackGroundSymbol'</code> error when using that line (another type had <code>bsNone</code> defined).</p> <p>To overcome this I had to use : </p> <pre><code>BorderStyle := Forms.bsNone; </code></pre>
[ { "answer_id": 14458, "author": "JosephStyons", "author_id": 672, "author_profile": "https://Stackoverflow.com/users/672", "pm_score": 2, "selected": false, "text": "procedure TForm1.FormCreate(Sender: TObject) ;\nbegin\n //maximize the window\n WindowState := wsMaximized;\n //hide...
2008/08/18
[ "https://Stackoverflow.com/questions/14451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1724/" ]
14,453
<p>I'm needing to access Excel workbooks from .Net. I know all about the different ways of doing it (I've written them up in a <a href="http://blog.functionalfun.net/2008/06/reading-and-writing-excel-files-with.html" rel="noreferrer" title="Reading and Writing Excel files in .Net">blog post</a>), and I know that using a native .Net component is going to be the fastest. But the question is, which of the components wins? Has anybody benchmarked them? I've been using Syncfusion XlsIO, but that's very slow for some key operations (like deleting rows in a workbook containing thousands of Named ranges).</p>
[ { "answer_id": 47135283, "author": "CAD bloke", "author_id": 492, "author_profile": "https://Stackoverflow.com/users/492", "pm_score": 0, "selected": false, "text": "headerStyle.BeginUpdate();\nworkbook.SetPaletteColor(8, System.Drawing.Color.FromArgb(255, 174, 33));\nheaderStyle.Color =...
2008/08/18
[ "https://Stackoverflow.com/questions/14453", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1727/" ]