qid
int64
4
19.1M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
381,371
<p>I have a sqlite (v3) table with this column definition:</p> <pre><code>"timestamp" DATETIME DEFAULT CURRENT_TIMESTAMP </code></pre> <p>The server that this database lives on is in the CST time zone. When I insert into my table without including the timestamp column, sqlite automatically populates that field with the current timestamp in GMT, not CST.</p> <p>Is there a way to modify my insert statement to force the stored timestamp to be in CST? On the other hand, it is probably better to store it in GMT (in case the database gets moved to a different timezone, for example), so is there a way I can modify my select SQL to convert the stored timestamp to CST when I extract it from the table?</p>
[ { "answer_id": 381394, "author": "BrianH", "author_id": 40619, "author_profile": "https://Stackoverflow.com/users/40619", "pm_score": 8, "selected": true, "text": "SELECT datetime(1092941466, 'unixepoch', 'localtime');\n select datetime(timestamp, 'localtime')\n" }, { "answer_id"...
2008/12/19
[ "https://Stackoverflow.com/questions/381371", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40619/" ]
381,373
<p>I have a webservice in java that receives a list of information to be inserted or updated in a database. I don't know which one is to insert or update.</p> <p>Which one is the best approach to abtain better performance results:</p> <ol> <li><p>Iterate over the list(a object list, with the table pk on it), try to insert the entry on Database. If the insert failed, run a update</p></li> <li><p>Try to load the entry from database. if the results retrieved update, if not insert the entry.</p></li> <li><p>another option? tell me about it :)</p></li> </ol> <p>In first calls, i believe that most of the entries will be new bd entries, but there will be a saturation point that most of the entries will be to update.</p> <p>I'm talking about a DB table that could reach over 100 million entries in a mature form.</p> <p>What will be your approach? Performance is my most important goal.</p>
[ { "answer_id": 381620, "author": "chaos", "author_id": 47529, "author_profile": "https://Stackoverflow.com/users/47529", "pm_score": 1, "selected": false, "text": "INSERT INTO foo\nSET bar='baz', howmanybars=1\nON DUPLICATE KEY UPDATE howmanybars=howmanybars+1\n" }, { "answer_id"...
2008/12/19
[ "https://Stackoverflow.com/questions/381373", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28921/" ]
381,395
<p>I'm using the <code>File::Find</code> module to traverse a directory tree. Once I find a specific file, I want to stop searching. How can I do that?</p> <pre><code> find (\$processFile, $mydir); sub processFile() { if ($_ =~ /target/) { # How can I return from find here? } } </code></pre>
[ { "answer_id": 381454, "author": "innaM", "author_id": 7498, "author_profile": "https://Stackoverflow.com/users/7498", "pm_score": 4, "selected": true, "text": "eval {\n find (\\$processFile, $mydir);\n};\n\nif ( $@ ) {\n if ( $@ =~ m/^found it/ ) {\n # be happy\n }\n e...
2008/12/19
[ "https://Stackoverflow.com/questions/381395", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1094969/" ]
381,396
<p>I have several listboxes that get each of their data from a separate stored procedure. </p> <p>If the user selects an option in 1 listbox, it should filter the other listboxes. </p> <p>I have done this before by adding logic to the stored procedure, but sometimes it seems to get very long. </p> <p>Does anyone know of a better way to approach this? </p> <p>The way I have it setup now is that for each ListBox, I have an ObjectDataSource which calls a method that calls a stored proc in the database to populate the listbox.</p>
[ { "answer_id": 381411, "author": "Charles Bretana", "author_id": 32632, "author_profile": "https://Stackoverflow.com/users/32632", "pm_score": 3, "selected": true, "text": " DataView dvCities = dtCities.DefaultView; \n dvCities.RowFilter = \"State=\" + lbStates.SelectedItem;\n ...
2008/12/19
[ "https://Stackoverflow.com/questions/381396", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33690/" ]
381,401
<p>By default C# compares DateTime objects to the 100ns tick. However, my database returns DateTime values to the nearest millisecond. What's the best way to compare two DateTime objects in C# using a specified tolerance?</p> <p>Edit: I'm dealing with a truncation issue, not a rounding issue. As Joe points out below, a rounding issue would introduce new questions.</p> <p>The solution that works for me is a combination of those below.</p> <pre><code>(dateTime1 - dateTime2).Duration() &lt; TimeSpan.FromMilliseconds(1) </code></pre> <p>This returns true if the difference is less than one millisecond. The call to Duration() is important in order to get the absolute value of the difference between the two dates.</p>
[ { "answer_id": 381420, "author": "Micah", "author_id": 17744, "author_profile": "https://Stackoverflow.com/users/17744", "pm_score": 6, "selected": true, "text": "if((myDate - myOtherDate) > TimeSpan.FromSeconds(10))\n{\n //Do something here\n}\n" }, { "answer_id": 381428, ...
2008/12/19
[ "https://Stackoverflow.com/questions/381401", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19112/" ]
381,403
<p>I am using C# .Net 2.0 to write a webservices client. The server's soap implementation is tested and is pretty solid. gSoap/C++ applications had no problem reading the responses. However the .Net implementation complains "There is an error in XML document" while calling one of the methods. Similar responses recieved from the server were happily processed by the xml parser. </p> <p>Looks like to me the MSXML parser (I hope thats the one .Net is been using) is a very unforgiving parser. </p> <p>I have no control over the server. Some how I have to work around this problem. So, I was thinking of writing a SoapExtension as describe <a href="https://stackoverflow.com/questions/256234/how-do-i-get-access-to-soap-response">here</a></p> <p>So my question is, can I hook a parser before Deserialize stage and completely bypass the Deserialize stage.</p> <p>And above all, how do i instruct the SOAP stub to use my extended class ?</p>
[ { "answer_id": 381476, "author": "Kev", "author_id": 419, "author_profile": "https://Stackoverflow.com/users/419", "pm_score": 3, "selected": true, "text": "<webServices>\n <soapExtensionTypes>\n <add type=\"DebugTools.SOAP.SOAPTrace.SoapTraceExtension, DebugTools.SOAP\" \n ...
2008/12/19
[ "https://Stackoverflow.com/questions/381403", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1781/" ]
381,405
<p>I have a Div with five float divs inside:</p> <pre><code>var div=document.createElement("div"); div.className="cssDivNino"; var divFolio=document.createElement("div"); divFolio.className="cssFolio"; div.appendChild(divFolio); var divCurp=document.createElement("div"); divCurp.className="cssCurp"; div.appendChild(divCurp); var divNombre=document.createElement("div"); divNombre.className="cssNombre"; div.appendChild(divNombre); var divLocalidad=document.createElement("div"); divLocalidad.className="cssLocalidad"; div.appendChild(divLocalidad); var divClear=document.createElement("div"); divClear.className="clear"; div.appendChild(divClear); divFolio.innerHTML= someData; divCurp.innerHTML= someData; divNombre.innerHTML= someData; divLocalidad.innerHTML= someData; </code></pre> <p>This is the css:</p> <pre><code>.cssDivNino {padding: 0; margin: 0} .cssFolio {font-family:arial; font-size:10px; color:#000000; background-color:#FFFFFF; float: left; width: 7%; margin-right: 1%; padding: 0} .cssCurp {font-family:arial; font-size:10px; color:#000000; background-color:#FFFFFF; float: left; width: 17%; margin-right: 1%; padding: 0} .cssNombre {font-family:arial; font-size:10px; color:#000000; background-color:#FFFFFF; float: left; width: 36%; margin-right: 1%; padding: 0} .cssLocalidad {font-family:arial; font-size:10px; color:#000000; background-color:#FFFFFF; float: left; width: 35%; margin-right: 1%; padding: 0} .clear { clear:both; width: 0%; height: 0; padding: 0; margin: 0; border: thin; border-color:#000000} </code></pre> <p>This is how it looks in <a href="http://prueba.edomexico.gob.mx/desarrolladores_c/benjamin/apadrinalo/divIE7FF.jpg" rel="nofollow noreferrer">IE7 and Firefox</a> and in <a href="http://prueba.edomexico.gob.mx/desarrolladores_c/benjamin/apadrinalo/divIE6.jpg" rel="nofollow noreferrer">IE6</a>. Notice the extra space of the parent div under the child divs on IE6.</p> <p>I've tried to fix this with javascript:</p> <pre><code>div.style.height = divFolio.style.height; </code></pre> <p>But it doesn't work.</p>
[ { "answer_id": 381421, "author": "Kenan Banks", "author_id": 43089, "author_profile": "https://Stackoverflow.com/users/43089", "pm_score": 3, "selected": true, "text": "<table> .cssDivNino" } ]
2008/12/19
[ "https://Stackoverflow.com/questions/381405", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15039/" ]
381,408
<p>When I am editing a cell in a <code>dataGrid</code>, the changes are not applied to the <code>dataProvider</code> until I finish editing. Is there a way that I can make the changes appear in the <code>dataProvider</code> whilst editing?</p> <p>I would assume that the way of doing this would be to subclass the editor I am using, in this case <code>NumericStepper</code>, but I don't know how I would go about it.</p> <p>Is there some sort of event that I need to trigger?</p>
[ { "answer_id": 381421, "author": "Kenan Banks", "author_id": 43089, "author_profile": "https://Stackoverflow.com/users/43089", "pm_score": 3, "selected": true, "text": "<table> .cssDivNino" } ]
2008/12/19
[ "https://Stackoverflow.com/questions/381408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40397/" ]
381,414
<p>If I have a large set of continuous ranges ( e.g. [0..5], [10..20], [7..13],[-1..37] ) and can arrange those sets into any data-structure I like, <b>what's the most efficient way to test <em>which</em> sets a particular test_number belongs to?</b></p> <p>I've thought about storing the sets in a balanced binary tree based on the low number of a set ( and each node would have all the sets that have the same lowest number of their set). This would allow you to efficiently prune the number of sets based on whether the test_number you're testing against the sets is less than the lowest number of a set, and then prune that node and all the nodes to the right of that node ( which have a low number in their range which is greater than the test_number) . I think that would prune about 25% of the sets on average, but then I would need to linearly look at all the rest of the nodes in the binary tree to determine whether the test_number belonged in those sets. ( I could further optimize by sorting the lists of sets at any one node by the highest number in the set, which would allow me to do binary search within a specific list to determine which set, if any, contain the test_number. Unfortunately, most of the sets I'll be dealing with don't have overlapping set boundaries.)</p> <p>I think that this problem has been solved in graphics processing since they've figured out ways to efficiently test which polygons in their entire model contribute to a specific pixel, but I don't know the terminology of that type of algorithm.</p>
[ { "answer_id": 381442, "author": "RB.", "author_id": 15393, "author_profile": "https://Stackoverflow.com/users/15393", "pm_score": -1, "selected": false, "text": "For Each SetOfNumbers\n For Each NumberInSet\n Put SetOfNumbers into Bin(NumberInSet)\n" }, { "answer_id": 381...
2008/12/19
[ "https://Stackoverflow.com/questions/381414", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20712/" ]
381,434
<p>I`m developing an application using Spring WebFlow 2, Facelets and JSF. One of my flows does have a page that must trigger a form submit at certain events. For each different action, a different view must be presented. So, I'm trying to activate the following javascript code to perform the submission:</p> <pre><code>function myFormSubmit( eventId ) { var formAction = document.myForm.action; document.myForm.action = formAction + '&amp;_eventId=' + eventId; document.myForm.submit(); } </code></pre> <p>Unfortunatelly, this doesn't triggers the requested transition in my flow. The page doesn't change. Does anyone knows how to deal with this?</p> <p>Thanks, Alexandre</p>
[ { "answer_id": 381439, "author": "scunliffe", "author_id": 6144, "author_profile": "https://Stackoverflow.com/users/6144", "pm_score": 0, "selected": false, "text": "function myFormSubmit( eventId ) {\n var formAction = document.myForm.action;\n //document.myForm.action = formAction ...
2008/12/19
[ "https://Stackoverflow.com/questions/381434", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9025/" ]
381,443
<p>I have an ASP.Net 3.5 website running in IIS 6 on Windows Server 2003 R2. It is a relatively small internal application that probably serves less than ten users at any given time. The server has 4 Gig of memory and shows that 3+ Gig is available while the site is active.</p> <p>Just minutes after restarting the web application Performance monitor shows that there is a whopping 4,294,967,293 sessions active! I am fairly certain that this number is incorrect; at the time this reading there were only 100 requests to the website.</p> <p>Has anyone else experienced this kind odd behavior from perf mon? Any ideas on how to get an accurate reading?</p> <p>UPDATE: After running for about an hour the number of active sessions has dropped by 4. So it does seem to be responding to sessions timing out.</p>
[ { "answer_id": 2514569, "author": "Dominic Zukiewicz", "author_id": 128444, "author_profile": "https://Stackoverflow.com/users/128444", "pm_score": 1, "selected": false, "text": "/* This one is quicker as it doesn't have to do the extra calculations */\n=IF(B2>1073741824,4294967296-B2,B2...
2008/12/19
[ "https://Stackoverflow.com/questions/381443", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25121/" ]
381,445
<p>I have a client of my web based application who heavily uses the data from our system for powerpoint presentations.</p> <p>We currently allow data to export in more traditional file types...PDF, CSV, HTML, and a few others. Powerpoint doesn't seem to be really automated.</p> <p>Is there a way, on the ASP.NET server side, to automate the creation and on-demand download of a powerpoint file format for a report from a system?</p>
[ { "answer_id": 381457, "author": "Andreas Grech", "author_id": 44084, "author_profile": "https://Stackoverflow.com/users/44084", "pm_score": 3, "selected": true, "text": " Dim fs As System.IO.FileStream = _\n\n New System.IO.FileStream(\"c:\\mypath\\myfile.ppt\", _\n\n System.IO.Fil...
2008/12/19
[ "https://Stackoverflow.com/questions/381445", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24126/" ]
381,451
<p>I'm creating a WPF app and have a system tray icon with a context menu. For the menu items I want to use WPF commands but when I assign them they are always greyed out even though the (same) commands are enabled in other places.</p> <pre><code>MenuItem menuItem = new MenuItem(); menuItem.Header = "Exit"; menuItem.Command = CustomCommands.ExitApplication; Systray.AddMenuItem(menuItem); </code></pre> <p>It works fine when I assign click events and I have tried to create a CanExecute method for the command which always sets CanExecute to true, but that doesn't help either. Anyone got an idea why the menu items are disabled?</p> <hr> <p>Update: As suggested, I added a command binding to the context menu. This had the effect that it works but only after you have clicked on the menu, i.e., at first the menu items are greyed out but once you click somewhere on the menu the options become enabled.</p> <p>To solve this problem I called the following, after I added the menu items to the context menu:</p> <pre><code>CommandManager.InvalidateRequerySuggested(); </code></pre>
[ { "answer_id": 382443, "author": "Szymon Rozga", "author_id": 7583, "author_profile": "https://Stackoverflow.com/users/7583", "pm_score": 2, "selected": false, "text": "CommandManager.InvalidateQuerySuggested();" }, { "answer_id": 17013291, "author": "Mario", "author_id":...
2008/12/19
[ "https://Stackoverflow.com/questions/381451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4055/" ]
381,452
<p>I have a simple NAnt build file, which attempts to perform an update from subversion on the specified directory. An example of the test build file content is:</p> <pre><code>&lt;?xml version="1.0" ?&gt; &lt;project name="Project_name" default="update"&gt; &lt;property name="root" value="C:\Subversion\UpdateDir" overwrite="false"/&gt; &lt;property name="build.repos" value="http:/server/svnrepos" overwrite="false"/&gt; &lt;property name="build.user" value="user" overwrite="false"/&gt; &lt;property name="build.pwd" value="userpw" overwrite="false"/&gt; &lt;target name="update"&gt; &lt;!-- Update all files to latest (head) revision from the repository --&gt; &lt;svn-update destination="${root}" uri="${build.repos}" username="${build.user}" password="${build.pwd}" commandline="-r HEAD -q --no-auth-cache"/&gt; &lt;/target&gt; &lt;/project&gt; </code></pre> <p>When the build is run in TeamCity (which has been configured to execute the test build file), the build fails with an error of 1 being returned from the Collabnet subversion client 'svn.exe' file.</p> <p>The annoying thing, is that NAnt GUI can run the build file without error, so I don't see why TeamCity should fail, since I believe it to be using the same subversion client as NAnt GUI and the same MS .net framework version too.</p> <p>The error log details are as follows, and the error relates to the NAnt Contrib task 'svn-update':</p> <pre><code>[16:01:56]: svn-update [16:01:56]: [svn-update] svn: Working copy '.' locked [16:01:56]: [svn-update] svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details) [16:01:56]: C:\Subversion\ProjectBuilds\BuildFiles\Update0412.build(9,10): External Program Failed: C:\Program Files\CollabNet Subversion\svn.exe (return code was 1) [16:01:56]: NAnt output: "C:\Program Files\NAnt-Gui\bin\NAnt.exe" -buildfile:C:\Subversion\ProjectBuilds\BuildFiles\Update0412.build -extension:C:\BuildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NAntLoggers.dll -listener:JetBrains.BuildServer.NAntLoggers.NAntListener -D:teamcity.buildConfName=0412 -D:DotNetFramework1.1_Path=C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322 -D:agent.home.dir=C:\BuildAgent "-D:agent.name=TeamCity Build Agent" -D:build.number=0.0.33 -D:teamcity.dotnet.nunitlauncher2.0=C:\BuildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher2.0.exe -D:teamcity.dotnet.platform=C:\BuildAgent\plugins\dotnetPlugin\bin\JetBrains.TeamCity.PlatformProcessRunner.1.1.exe -D:DotNetFramework1.1= -D:build.number.format=0.0.{0} -D:user.language=en -D:user.country=GB -D:os.version=5.1 -D:user.timezone=Europe/London -D:file.encoding=Cp1252 -D:file.separator=\ -D:agent.work.dir=C:\BuildAgent\work "-D:teamcity.projectName=Project 0412" -D:teamcity.dotnet.nunitlauncher2.0.vsts=C:\BuildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher2.0.VSTS.exe -D:os.arch=x86 -D:DotNetFramework1.1_x86_Path=C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322 -D:DotNetFramework1.1_x86= -D:teamcity.build.tempDir=C:\BuildAgent\temp\buildTmp -D:teamcity.dotnet.coveragelauncher=C:\BuildAgent\plugins\dotnetPlugin\bin\TeamCityRunners\JetBrains.dotTrace.TeamCity.CoverageRunner.exe -D:build.vcs.number=5758 -D:teamcity.dotnet.nunitlauncher=C:\BuildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher.exe -D:build.vcs.number.1=5758 -D:user.name=SYSTEM "-D:os.name=Windows XP" -D:build.vcs.number.0412=5758 "-D:teamcity.version=4.0 (build 8080)" -D:teamcity.dotnet.nunitaddin=C:\BuildAgent\plugins\dotnetPlugin\bin\JetBrains.TeamCity.NUnitAddin-NUnit -D:teamcity.auth.password=YVscypn9BG9okr0ojOES7LgevrD8Wpfp -D:idea.build.agent.port=9092 -D:teamcity.build.checkoutDir=C:\Subversion\ProjectBuilds\0412 -D:teamcity.buildType.id=bt2 -D:teamcity.auth.userId=TeamCityBuildId=36 -D:teamcity.dotnet.nunitlauncher1.1=C:\BuildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher1.1.exe -D:user.variant= -D:teamcity.agent.cpuBenchmark=107 -D:teamcity.dotnet.nunitlauncher.msbuild.task=C:\BuildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.MSBuildLoggers.dll -D:user.home=C:\ -D:idea.build.server.build.id=36 -D:path.separator=; -D:teamcity.build.workingDir=C:\Subversion\ProjectBuilds -D:teamcity.build.properties.file=C:\BuildAgent\temp\agentTmp\teamcity.build31597.properties update NAnt 0.85 (Build 0.85.2478.0; release; 14/10/2006) Copyright (C) 2001-2006 Gerry Shaw http://nant.sourceforge.net Buildfile: file:///C:/Subversion/ProjectBuilds/BuildFiles/Update0412.build Target framework: Microsoft .NET Framework 1.1 Target(s) specified: update update: [svn-update] svn: Working copy '.' locked [svn-update] svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details) BUILD FAILED - 0 non-fatal error(s), 2 warning(s) C:\Subversion\ProjectBuilds\BuildFiles\Update0412.build(9,10): External Program Failed: C:\Program Files\CollabNet Subversion\svn.exe (return code was 1) Total time: 0.4 seconds. [16:01:56]: Process exit code: 1 </code></pre> <p>EDIT: The problem was indeed related to the SVN checkout being in a state. I fixed it by allowing TeamCity to do it's own checkout (and I probably did a clean up in the meantime as well). Looks like both James Gregory and Ruben Bartelink were correct!</p>
[ { "answer_id": 388489, "author": "James Gregory", "author_id": 27206, "author_profile": "https://Stackoverflow.com/users/27206", "pm_score": 3, "selected": true, "text": "svn cleanup" } ]
2008/12/19
[ "https://Stackoverflow.com/questions/381452", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15669/" ]
381,455
<p>I love to Extend my Assert.AreEqual to many different classes, the known one is the CollectionAssert of course, but I can think of some more such as: <a href="http://www.human-debugger.net/blog/2008/12/21/TddExtendingAssertToSupportImages.aspx" rel="noreferrer">ImageAssert</a>, XmlAssert etc..</p> <p>Did you Create your own Assert classes? and what kind of new would you like to create?</p>
[ { "answer_id": 381497, "author": "Joseph Ferris", "author_id": 15906, "author_profile": "https://Stackoverflow.com/users/15906", "pm_score": 2, "selected": false, "text": "Enforce.That(variable).IsNotNull();\nEnforce.That(variable).IsInRange(10, 20);\nEnforce.That(variable).IsTypeOf(type...
2008/12/19
[ "https://Stackoverflow.com/questions/381455", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47817/" ]
381,478
<p>I have a multi-project solution. I believe it is best practice to put all <strong>externally</strong> referenced assemblies (e.g. OSS stuff) in a folder that is on the relative path of the solution and it's component projects.</p> <p>I'd like to create a real folder called <strong>Libs</strong> within the same Windows folder that contains my .sln file and add it to source control (Team System). I can't seem to figure out how to do this from the Solution Explorer. I can only do this from the Source Control Explorer. There does not appear to be a way to add this Libs Windows folder directly to the solution itself. </p> <p>I see that you can create a "solution folder" -- but this does not correspond to a real windows folder and it apparently places the files within the top level solution folder.</p> <p>I was wondering if there was a way to add the Libs folder to the solution so that it was apparent it was there and referenced by the component projects.</p>
[ { "answer_id": 381482, "author": "Micah", "author_id": 17744, "author_profile": "https://Stackoverflow.com/users/17744", "pm_score": 2, "selected": false, "text": "Development/\n Trunk/\n Binaries/ -- Shared libraries\n Source/\n Test/ \n Docs/ -- Documen...
2008/12/19
[ "https://Stackoverflow.com/questions/381478", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7961/" ]
381,485
<p>Having fallen behind in the world of ORM and modern data access, I'm looking to move away from DataSets (<em>shudder</em>) and into a proper mapping framework.</p> <p>I've just about got my head around Linq to SQL, an I'm now looking into NHibernate with the view to using it in our next project.</p> <p>With old school sql and data sets, your sql queries obviously only return the data you want. I also understand that L2S is also clever enough to evaluate its where clauses so that it only ever returns the objects you requested. Is NHibernate the same? And is it the same with Ayende's Linq to NHibernate?</p> <p>By this i mean, if i do the equivalent of:</p> <pre><code>Select * from customers where name = "fred" </code></pre> <p>will it fetch every customer into memory, and then filter out the non-freds, or is it clever enough to only get what it needs in the first place?</p> <p>If it is intelligent, what are the caveats? Are there certains types of query which cannot be evaluated in this way? What performance issues do i need to be aware of?</p> <p>Thanks</p> <p>Andrew</p>
[ { "answer_id": 385473, "author": "Berkshire", "author_id": 24269, "author_profile": "https://Stackoverflow.com/users/24269", "pm_score": 1, "selected": false, "text": "Select cust.Address, cust.Email from customers cust where cust.Name = \"fred\"\n FetchMode CollectionFetchMode" } ]
2008/12/19
[ "https://Stackoverflow.com/questions/381485", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28543/" ]
381,487
<p>Specifically I want to know what the data structure for the imports (idata) section looks like.</p>
[ { "answer_id": 382888, "author": "Rob Kennedy", "author_id": 33732, "author_profile": "https://Stackoverflow.com/users/33732", "pm_score": 3, "selected": true, "text": "LoadImage IMAGE_DIRECTORY_ENTRY_IMPORT" } ]
2008/12/19
[ "https://Stackoverflow.com/questions/381487", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47741/" ]
381,501
<p>I discovered to have some problem to fully understand callbacks scoping when trying to learn Jquery. I would add that i have little experience with the Javascript language The code:</p> <pre><code>var globDom; // placeholder for DOM fragment // Getting xml file; jquery parses the file and give me back a DOM fragment // saveXML is the callback $.get(requestTarget, {}, saveXML); // the globDom here is UNDEFINED ! alert(globDom); // the callback function saveXML(xmlDom) { globDom = xmlDom; } </code></pre> <p>I am sure that here there is a BIG misunderstanding by me ...</p> <p>Have any suggestion?</p> <p>Thanks</p> <p>Daniel</p> <hr> <p>Ah-Ah. Very clear, I understand perfectly the error in my assumption: i forgot to take in account the time lag between the access time to the data (previous!) and the time at which content becomes available. A quite serious flaw - batch programming biased :-( The problem is clear and I can now address it properly. Many, many thanks for responding!</p>
[ { "answer_id": 381572, "author": "Jimmy", "author_id": 4435, "author_profile": "https://Stackoverflow.com/users/4435", "pm_score": 1, "selected": true, "text": "0.001 globdom = undefined;\n0.002 $.get(somerequest, callback)\n0.003 alert(globdom)\n\n.. 50 milliseconds later ..\n\n0.053 sa...
2008/12/19
[ "https://Stackoverflow.com/questions/381501", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47506/" ]
381,502
<p>I'm writing small and very <a href="http://en.wikipedia.org/wiki/DRY" rel="noreferrer">DRY</a> framework, which heavily relies on metadata. I'd like to know if there is a way to obtain method parameter names, i.e. given some method</p> <pre><code>public void a(int myIntParam, String theString) { ... } </code></pre> <p>get the strings <code>"myIntParam"</code> and <code>"theString"</code>.</p> <p>I know I could annotate parameters, but that wouldn't be nice...</p> <pre><code>public void a( @Param("myIntParam") int myIntParam, @Param("theString") String theString ) { ... } </code></pre>
[ { "answer_id": 384929, "author": "Jonny Heggheim", "author_id": 48011, "author_profile": "https://Stackoverflow.com/users/48011", "pm_score": 4, "selected": false, "text": "import com.sun.org.apache.bcel.internal.classfile.ClassParser;\nimport com.sun.org.apache.bcel.internal.classfile.J...
2008/12/19
[ "https://Stackoverflow.com/questions/381502", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1764/" ]
381,508
<p>I'm trying to write out a <code>Byte[]</code> array representing a complete file to a file.</p> <p>The original file from the client is sent via TCP and then received by a server. The received stream is read to a byte array and then sent to be processed by this class. </p> <p>This is mainly to ensure that the receiving <code>TCPClient</code> is ready for the next stream and separate the receiving end from the processing end. </p> <p>The <code>FileStream</code> class does not take a byte array as an argument or another Stream object ( which does allow you to write bytes to it).</p> <p>I'm aiming to get the processing done by a different thread from the original ( the one with the TCPClient). </p> <p>I don't know how to implement this, what should I try?</p>
[ { "answer_id": 381528, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 3, "selected": false, "text": "fs.Write(myByteArray, 0, myByteArray.Length);\n" }, { "answer_id": 381529, "author": "Kev", "author_id": 419, ...
2008/12/19
[ "https://Stackoverflow.com/questions/381508", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5648/" ]
381,517
<p>Is there a way to set the prefix on the Signature of a Signed XML Document (SignedXml class in .Net)?</p> <p>So instead of:</p> <pre><code>&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#&gt; ... &lt;/Signature&gt; </code></pre> <p>I could have the following:</p> <pre><code>&lt;ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#&gt; ... &lt;/ds:Signature&gt; </code></pre>
[ { "answer_id": 382161, "author": "Eric Rosenberger", "author_id": 41624, "author_profile": "https://Stackoverflow.com/users/41624", "pm_score": 4, "selected": true, "text": "XmlElement signature = signedXml.GetXml();\nforeach (XmlNode node in signature.SelectNodes(\n \"descendant-or-s...
2008/12/19
[ "https://Stackoverflow.com/questions/381517", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28660/" ]
381,537
<p>I am deploying ASP.NET and Web Service solutions to IIS for a <strong>development</strong> server. It looks like the last person that did this job deployed all the .pdb files too. I asked about it, and was told that they "provide better stack trace info in the logs" if they are left on the server.</p> <p>Is there any truth to this? I've always left them behind, never deploying them to anywhere other than my local machine.</p> <p>For an internal development IIS server (not production, not accessible to the outside world) is there any reason to or not to deploy the .pdb files? Is there anything bad that could happen? Do they really provide any benefit?</p>
[ { "answer_id": 382087, "author": "CodingWithSpike", "author_id": 28278, "author_profile": "https://Stackoverflow.com/users/28278", "pm_score": 5, "selected": false, "text": "using System;\nusing System.Text;\n\nnamespace PdbSpeedTest\n{\n class Program\n {\n static void Main...
2008/12/19
[ "https://Stackoverflow.com/questions/381537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28278/" ]
381,542
<p>As Joel points out in <a href="https://stackoverflow.blog/2008/12/18/podcast-34/">Stack Overflow podcast #34</a>, in <a href="https://rads.stackoverflow.com/amzn/click/com/0131103628" rel="noreferrer" rel="nofollow noreferrer">C Programming Language</a> (aka: K &amp; R), there is mention of this property of arrays in C: <code>a[5] == 5[a]</code></p> <p>Joel says that it's because of pointer arithmetic but I still don't understand. <strong>Why does <code>a[5] == 5[a]</code></strong>?</p>
[ { "answer_id": 381549, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 12, "selected": true, "text": "[] a[b] == *(a + b) a[5] *(a + 5)\n 5[a] *(5 + a)\n a a[5] a *(a + 5)" }, { "answer_id": 381551, "author": "David ...
2008/12/19
[ "https://Stackoverflow.com/questions/381542", "https://Stackoverflow.com", "https://Stackoverflow.com/users/356/" ]
381,545
<p>I have a SSRS report and using PL/SQL for the dataset creation. My report needs two tables 1 one gives detailed view.(dataset 1) 2 one below that gives a summary table (data should come from the calculations based on the data in 1 table) </p> <p>I am using a temporary table for the dataset one. </p> <p>What are the methods to get calculated result for dataset 2.</p> <p>I wrote 2 procedures for each. since first table is a temporary one i am not getting result for second dataset.</p> <p>Why can be the options.</p> <p>Can I have multiple dataset out of single procedure?</p>
[ { "answer_id": 381549, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 12, "selected": true, "text": "[] a[b] == *(a + b) a[5] *(a + 5)\n 5[a] *(5 + a)\n a a[5] a *(a + 5)" }, { "answer_id": 381551, "author": "David ...
2008/12/19
[ "https://Stackoverflow.com/questions/381545", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
381,546
<p>I'd like to write a simple detail formatter that displays <code>byte[]</code> data in the form of a <code>String</code> (using <code>String.&lt;init&gt;([B)</code> to do the dirty work).</p> <p>However, I'm not sure how to find the class name for <code>[B</code> to use when creating the formatter. Is this even possible? Or, alternatively, is there another way to view byte arrays as strings in the debugger?</p>
[ { "answer_id": 381560, "author": "Michael Borgwardt", "author_id": 16883, "author_profile": "https://Stackoverflow.com/users/16883", "pm_score": 0, "selected": false, "text": "byte[].class\n" }, { "answer_id": 381934, "author": "Jason Day", "author_id": 737, "author_p...
2008/12/19
[ "https://Stackoverflow.com/questions/381546", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23309/" ]
381,548
<p>We are working with some new Cutting Tools that can have it's hardware parameters altered through the serial port instead of just a control panel. </p> <p>When the hardware parameters are altered the hardware will take a few seconds to reconfigure itself and then signal that it is ready to be used.</p> <p>Our setup before this involved the operator clicking on a Cut Plate or Part command. The software will display a dialog allowing the operator change anything that is motion related (speed, delays, etc) as well as display what configuration the hardware should be in. After the operator verifies everything he click OK and the machine starts cutting.</p> <p>For the new Hardware we pull out the current configuration if there is a change we transmit and throw up a dialog showing what the new configuration is along with a indicator showing whether the hardware is ready. Not everything is automated through the serial port so sometime the dialog has to stay up there until the operator clicks OK. Other times it can unload itself when the hardware signals it is right.</p> <p>My problem (and question) is that doing this through the serial ports is all painfully slow. It also the first time we done this type of work. I am concerned that I missing some solution to make the whole thing more responsive. It is not an option to use an alternative to serial as we buy the cutting hardware from a third party.</p> <p>Another thing I would like to do is have the option of displaying a status dialog and leave it running without the serial communication bogging down the rest of the system. </p> <p>Tips for the Win32 API, or .NET are what I am looking for. </p>
[ { "answer_id": 381560, "author": "Michael Borgwardt", "author_id": 16883, "author_profile": "https://Stackoverflow.com/users/16883", "pm_score": 0, "selected": false, "text": "byte[].class\n" }, { "answer_id": 381934, "author": "Jason Day", "author_id": 737, "author_p...
2008/12/19
[ "https://Stackoverflow.com/questions/381548", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7890/" ]
381,552
<p>I'm wanting to keep the font size of a navigation menu the same size for all browsers. I set the font-size of the navigation menu text to a specific pixel size. In IE this works, but not in FF. </p> <p>The problem is, if a person changes their browser's font size, then it completely ruins the menu layout in FF.</p> <p>Is there a way to adjust this for FF or is there no way around it? I understand it is for accessibility, but it would otherwise mess up the design and I'd rather not use images instead of text for the navigation menu.</p> <p>Thanks!</p>
[ { "answer_id": 3371037, "author": "Kyle Cureau", "author_id": 377856, "author_profile": "https://Stackoverflow.com/users/377856", "pm_score": 0, "selected": false, "text": "updateBaseFontSize : function(fontSize,reloadBool){\n /*Format 1 is fed from the plug; format2 is th...
2008/12/19
[ "https://Stackoverflow.com/questions/381552", "https://Stackoverflow.com", "https://Stackoverflow.com/users/396/" ]
381,558
<p>I have a web application that I'm working on for work and its not very Firefox friendly (design was made 2 years before I started with the company). There are some CSS issues that I am having problems with and I can't use a CSS Reset because the page design is pretty much set in stone and it would cause more work then I need right now.</p> <p>Does any one have a list of IE's default CSS values so I can set it in a css so this thing will be more Firefox friendly?</p>
[ { "answer_id": 381619, "author": "Kristof Neirynck", "author_id": 11451, "author_profile": "https://Stackoverflow.com/users/11451", "pm_score": 1, "selected": false, "text": "* {\n box-sizing: border-box;\n -moz-box-sizing: border-box;\n -webkit-box-sizing: border-box;\n -ms-...
2008/12/19
[ "https://Stackoverflow.com/questions/381558", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20183/" ]
381,563
<p>I am using <strong>InstallShield 2009</strong> to generate an <strong>MSI</strong> for a codebase I have inherited. The code is comprised of <strong>VB6</strong>, and <strong>.NET 2.0</strong> code (C# and C++). I'm developing and installing on <strong>Windows XP SP2</strong>.</p> <p>I created the <em>InstallShield</em> project (call it <code>"MyClient.ISM"</code>) by reverse engineering it from the <em>MSI</em> provided by the previous team. Their configurations are the now the same. </p> <p>I then configured <em>InstallShield</em> to produce the <em>MSI</em>. This built, without error. However, when I try to run my <em>MSI</em> it fails with two </p> <blockquote> <p>"Error 1001 InstallUtilLib.dll: Unknown Error"</p> </blockquote> <p>dialogs and then successfully backs out the changes it has made Then I ran <code>MyClient.MSI</code> with the msiexec command. E.g. </p> <pre><code>msiexec /lvx C:\inst_server.log /i "C:\MyClient.MSI" </code></pre> <p>It seemed that the problem was due to a <code>2769 error</code>. The error locations from the log files resulting from this are below.: </p> <pre><code>DEBUG: Error 2769: Custom Action _A11801EAD1E34CFF981127F7B95C3BE5.install did not close 1 MSIHANDLEs. </code></pre> <p>This Custom Action was trying to install .NET services. So I then went to <em>InstallShield</em> and removed all custom actions (install, uninstall, commit and rollback as well as the associated SetProperty's) and built and installed again. This worked, but the services were no longer installed. I now need to install these .NET Services using an <em>InstallShield</em> method which works. </p>
[ { "answer_id": 381619, "author": "Kristof Neirynck", "author_id": 11451, "author_profile": "https://Stackoverflow.com/users/11451", "pm_score": 1, "selected": false, "text": "* {\n box-sizing: border-box;\n -moz-box-sizing: border-box;\n -webkit-box-sizing: border-box;\n -ms-...
2008/12/19
[ "https://Stackoverflow.com/questions/381563", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2455/" ]
381,568
<p>Should the representation(html, xml, json) returned by a RESTful web service be determined by the url or by the Accept HTTP header?</p>
[ { "answer_id": 398210, "author": "Shonzilla", "author_id": 31625, "author_profile": "https://Stackoverflow.com/users/31625", "pm_score": 3, "selected": false, "text": "Accept Accept" }, { "answer_id": 14322774, "author": "Andriy Drozdyuk", "author_id": 74865, "author_...
2008/12/19
[ "https://Stackoverflow.com/questions/381568", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32899/" ]
381,573
<p>I started dabbling in groovy yesterday. There's an example on the groovy website that I understand but I would like to know more about why it works the way it does. What's confusing me is <code>who[1..-1]</code>. Is this like saying <code>who[1..who.length()-1]</code>? I can't find any documentation on this syntax. Are there any good groovy tutorials out there besides what is on <a href="http://groovy.codehaus.org/" rel="nofollow noreferrer">http://groovy.codehaus.org/</a>?</p> <pre><code>class Greet { def name Greet(who) { name = who[0].toUpperCase() + who[1..-1] } def salute() { println "Hello $name!" } } g = new Greet('world') // create object g.salute() // Output "Hello World!" </code></pre>
[ { "answer_id": 381598, "author": "mipadi", "author_id": 28804, "author_profile": "https://Stackoverflow.com/users/28804", "pm_score": 4, "selected": true, "text": "-x who.length()-x" } ]
2008/12/19
[ "https://Stackoverflow.com/questions/381573", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33178/" ]
381,580
<p>In my javascript I have this</p> <pre><code> loopDeLoop: while (foo !== bar) { switch (fubar) { case reallyFubar: if (anotherFoo == anotherBar) { break loopDeLoop; } break; default: break; } } </code></pre> <p>But JSLint says... lint warning: use of label</p> <p>Here's the notes from <a href="http://www.jslint.com/lint.html" rel="nofollow noreferrer">JSLint</a> </p> <blockquote> <p>Labels<br> JavaScript allows any statement to have a label, and labels have a separate name space. JSLint is more strict.</p> <p>JSLint expects labels only on statements that interact with break: switch, while, do, and for. JSLint expects that labels will be distinct from vars and parameters.</p> </blockquote> <p>How do I construct the above to get rid of the warning?</p> <p>Thanks,<br> Greg</p>
[ { "answer_id": 381651, "author": "EndangeredMassa", "author_id": 106, "author_profile": "https://Stackoverflow.com/users/106", "pm_score": 0, "selected": false, "text": "var done = false;\nwhile (foo !== bar && !done) {\n switch (fubar) {\n case reallyFubar:\n if (an...
2008/12/19
[ "https://Stackoverflow.com/questions/381580", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4232/" ]
381,586
<p>I have a piece of Java code I can't edit which I want to debug.</p> <p>The issue is that one of my 10,000 records has a data error and is causing the application to crash.</p> <p>I can remote debug the live application and add watch which would pick up the id of the record as each is processed. The problem is when the "bad record" is processed and the method is exited the value held in the watch is lost so I don't know which record it was that causes the problem.</p> <p>Is there any way of storing/printing the value held in the watch </p> <p>Thanks</p>
[ { "answer_id": 382375, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 0, "selected": false, "text": "org.eclipse.jdt.internal.debug.ui.JavaWatchExpressionDelegate" } ]
2008/12/19
[ "https://Stackoverflow.com/questions/381586", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
381,592
<p>I'm want to parse a custom string format that is persisting an object graphs state. This is ASP.NET scenario and I wanted something easy to use on the client (JavaScript) and server (C#).</p> <p>I have a format something like </p> <pre><code>{Name1|Value1|Value2|...|ValueN}{Name2|Value1|...}{...}{NameN|...} </code></pre> <p>In this format I have 3 delimiters, <code>{</code>, <code>}</code>, and <code>|</code>. Further, because these characters are conceivable in the name/values, I defined an escape sequence using the very common <code>\</code>, such that <code>\{</code>, <code>\}</code> and <code>\|</code> are all interpreted as normal versions of themselves and of course <code>\\</code> is a backslash. All pretty standard.</p> <p>Originally I tried to use a regex to try to parse out the string representation of an object with something like this <code>(?&lt;!\\)\{(.*?)(?&lt;!\\)\}</code>. Keep in mind <code>\</code>, <code>{</code>, and <code>}</code> are all reserved in regexes. This of course will be able to parse out something like <code>{category|foo\}|bar\{}</code> correctly. However I realized it would fail with something like <code>{category|foo|bar\\}</code>. </p> <p>It only took me a minute or so to try this <code>(?&lt;!(?&lt;!\\)\\)\{(.*?)(?&lt;!(?&lt;!\\)\\)\}</code> and realize that this approach was not possible given that you'd need an infinite number of negative lookbehinds to deal with a potential infinite number of escape sequences. Of course it's unlikely that I'd ever have more than one or two levels so I could probably hard code it. However, I feel that this is a common enough problem it should have a well defined solution.</p> <p>My next approach was to try to write a defined parser where I actually scanned the input buffer and consumed each character in a forward only method. I haven't actually finished this yet but it seems overly complicated and I feel I must be missing something obvious. I mean we've had parsers as long as we've had computer languages.</p> <p>So my question would be what is the simplest, efficient and elegant way to decode an input buffer like this with possible escape sequences? </p>
[ { "answer_id": 381676, "author": "Markus Jarderot", "author_id": 22364, "author_profile": "https://Stackoverflow.com/users/22364", "pm_score": 4, "selected": true, "text": "(?<!\\\\)(?:\\\\\\\\)*\\{(.*?(?<!\\\\)(?:\\\\\\\\)*)\\}\n (?<!\\\\) \\ (?:\\\\\\\\)* \\ \\{ ( .*? | (?<!\\\\) \\ (?...
2008/12/19
[ "https://Stackoverflow.com/questions/381592", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44656/" ]
381,596
<p>I need to <code>POST</code> data to a url in the middle of a script.</p> <ol> <li>User fills out form:</li> <li>Form submits to <code>process.asp</code>: I need to <code>POST</code> data to a 3rd Party integration at this point.</li> <li><code>process.asp</code> finishes and directs user to thank you page.</li> </ol>
[ { "answer_id": 381613, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 2, "selected": false, "text": "CreateObject(\"Scripting.????\")" }, { "answer_id": 381625, "author": "Frank Krueger", "author_id": 33...
2008/12/19
[ "https://Stackoverflow.com/questions/381596", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47838/" ]
381,621
<p>In our C++ course they suggest not to use C++ arrays on new projects anymore. As far as I know Stroustroup himself suggests not to use arrays. But are there significant performance differences?</p>
[ { "answer_id": 381656, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 9, "selected": true, "text": "new std::array size // Comparison of assembly code generated for basic indexing, dereferencing, \n// and inc...
2008/12/19
[ "https://Stackoverflow.com/questions/381621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25418/" ]
381,622
<p>I have a result from an SQL query that I would like to sort alphabetical, but there are a couple of commonly used results that I would like to float to the top. Is there a simple way I can achieve this either by doing clever SQL or by sorting the (asp.net) datatable once I have it filled?</p> <p>I know the database ID of the things that I want to keep at the top ahead of time if that makes a difference.</p>
[ { "answer_id": 381628, "author": "Greg Dean", "author_id": 1200558, "author_profile": "https://Stackoverflow.com/users/1200558", "pm_score": 2, "selected": false, "text": "ORDER BY Special DESC, Name ASC\n" }, { "answer_id": 381633, "author": "EndangeredMassa", "author_id...
2008/12/19
[ "https://Stackoverflow.com/questions/381622", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5552/" ]
381,668
<p>I'm trying to create a color-picker which must dynamically generate its images and figured it would be a whole lot easier to generate SVG than a raster image. Unfortunately, I can't figure out how to represent the big, two-dimensional gradient which will form the centerpiece of the picker.</p> <p>For example, if the currently selected axes are blue and green, I need to paint a square which has the lower-left corner black, the upper-left blue, the lower-right green, and the upper-right cyan.</p> <p>If there's a way to accomplish this by overlaying two <code>linearGradient</code>-filled squares and playing with their opacity, I wasn't able to work it out. I also tried creating a gradient whose start end end colors were other gradients (hoping I was being clever), but all that got me was a "big black nothing". Google searches have thus far gotten me nowhere.</p> <p>I'd hate to resort to a stack of 256 1-pixel high gradients, both because of the increase in size and complexity and because I suspect it wouldn't resize well. Perhaps someone with a bit more working knowledge of SVG can suggest something</p>
[ { "answer_id": 59079752, "author": "Paul Wheeler", "author_id": 229247, "author_profile": "https://Stackoverflow.com/users/229247", "pm_score": 4, "selected": true, "text": "mix-blend-mode <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"256\" height=\"256\">\n <defs>\n <linearGradi...
2008/12/19
[ "https://Stackoverflow.com/questions/381668", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46387/" ]
381,685
<p>I just finished reading a book on scala. What strikes me is that every single example in the whole book was numerical in some form or another.</p> <p>Like a lot of programmers, the only math I use is from discrete and combinatorial mathematics, and usually that's not math I program in an explicit way. I'm really missing some compelling examples of functional alternatives/supplements to regular oo algorithms.</p> <p>What are some non-numerical use-cases for functional programming ?</p>
[ { "answer_id": 381822, "author": "Charlie Martin", "author_id": 35092, "author_profile": "https://Stackoverflow.com/users/35092", "pm_score": 2, "selected": false, "text": ">>> testlist\n[1, 2, 3, 5, 3, 1, 2, 1, 6]\n>>> [i for i,x in enumerate(testlist) if x == 1]\n[0, 5, 7]\n" }, { ...
2008/12/19
[ "https://Stackoverflow.com/questions/381685", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23691/" ]
381,691
<p>Well i need to make it so any user can have a foo.com/username in my site where i user a Zend framework. </p> <p>The thing is that i want foo.com/login and other controllers to keep working as they do, so i already validate that no user can be named as one of the controllers im going to use. The htaccess cant be changed or the mvc configuration wont work. So im using the Router.</p> <p>I know that if i use something like:</p> <pre><code>$routes = array(); $routes['entry'] = new Zend_Controller_Router_Route_Regex('SOME REGEX HERE', array( 'controller' =&gt; 'profile', 'action' =&gt; 'show' ), array( 'id' =&gt; "dsadsa", // maps first subpattern "(\d+)" to "id" parameter 1 =&gt; 'id' // maps first subpattern "(\d+)" to "id" parameter ) ); $router-&gt;addRoutes($routes); </code></pre> <p>i can make it so everything that matches the regex is redirected, but i dont know if theres a better way(somehow chaining 2 routers) where i dont have to actually list my controllers in a very very big OR.</p> <p>Any idea?</p>
[ { "answer_id": 381822, "author": "Charlie Martin", "author_id": 35092, "author_profile": "https://Stackoverflow.com/users/35092", "pm_score": 2, "selected": false, "text": ">>> testlist\n[1, 2, 3, 5, 3, 1, 2, 1, 6]\n>>> [i for i,x in enumerate(testlist) if x == 1]\n[0, 5, 7]\n" }, { ...
2008/12/19
[ "https://Stackoverflow.com/questions/381691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47846/" ]
381,695
<p>I'm writing a small and inadequate linear algebra library in C++ for a project (I'm sorry). I'm implementing matrices and operations using double precision numbers. I'm doing right? Should I implement a template class instead? Is there a more precise type around?</p>
[ { "answer_id": 381705, "author": "Frank Krueger", "author_id": 338, "author_profile": "https://Stackoverflow.com/users/338", "pm_score": 3, "selected": false, "text": "double" }, { "answer_id": 381714, "author": "Johannes Schaub - litb", "author_id": 34509, "author_pr...
2008/12/19
[ "https://Stackoverflow.com/questions/381695", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25418/" ]
381,718
<p>How do I check if a variable, specifically a pointer, is defined in C++? Suppose I have a class:</p> <pre><code>class MyClass { public: MyClass(); ~MyClass() { delete pointer; // if defined! } initializePointer() { pointer = new OtherClass(); } private: OtherClass* pointer; }; </code></pre>
[ { "answer_id": 381729, "author": "Nik Reiman", "author_id": 14302, "author_profile": "https://Stackoverflow.com/users/14302", "pm_score": 2, "selected": false, "text": "MyClass::MyClass() : pointer(NULL)\n{\n}\n\nMyClass::~MyClass()\n{\n if(pointer != NULL) { delete pointer; }\n}\n" ...
2008/12/19
[ "https://Stackoverflow.com/questions/381718", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25418/" ]
381,733
<p>Syntactic sugar for properties for example in C#:</p> <pre><code>private int x; public int X{ get { return x; } set { x = value; } } </code></pre> <p>or simply</p> <pre><code> public int X{ get; set; } </code></pre> <p>I am missing verbatim strings in java... @"C:\My Documents\" instead of "C:\\My Documents\\"</p> <p>Do you agree Java needs more "sugar"? Any one knows is there is sugar coming in next Java versions?</p>
[ { "answer_id": 381740, "author": "Matt Briggs", "author_id": 10771, "author_profile": "https://Stackoverflow.com/users/10771", "pm_score": 2, "selected": false, "text": "public int X { get; set; }\n" }, { "answer_id": 381784, "author": "Chris Cudmore", "author_id": 18907,...
2008/12/19
[ "https://Stackoverflow.com/questions/381733", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35323/" ]
381,734
<p>I want to perform this <em>CODE</em> equivlant in the castle xml config file.</p> <p>// Foo(string name)</p> <p>IFoo f = new Foo(StaticBarClass.Name);</p> <p><br> <br><br> <em>XML</em></p> <p>Now for the XML, I know everything (e.g. the blah) except for the stuff inside the parameter part.</p> <p>What would the parameter part look like?</p> <pre><code>&lt;component id="blah" service="blah" type="blah"&gt; &lt;parameters&gt; &lt;name&gt;StaticBarClas.Name_THAT_I_NEED_HELP_WITH&lt;/name&gt; &lt;/parameters&gt; </code></pre>
[ { "answer_id": 381740, "author": "Matt Briggs", "author_id": 10771, "author_profile": "https://Stackoverflow.com/users/10771", "pm_score": 2, "selected": false, "text": "public int X { get; set; }\n" }, { "answer_id": 381784, "author": "Chris Cudmore", "author_id": 18907,...
2008/12/19
[ "https://Stackoverflow.com/questions/381734", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
381,744
<p>Is there anyway to change the content-type of an XML document, in the XML document? </p> <p>I'm working with a really old system that passes back HTML (and we are trying to make it return XML). I'm retrieving it from XMLHttpRequest, and I noticed using netcat that it isn't passing back any content-type headers. </p> <p>When I receive the XMLHttpRequest.responseXML, the responseText exists but the responseXML is null.</p> <p>I've already checked the XML being returned to see if it is well formed and it appears to be (it's a very short document).</p>
[ { "answer_id": 381763, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 3, "selected": true, "text": "Content-Type <meta http-equiv=\"... <?xml version=\"1.0\" encoding=\"UTF-8\"?>" }, { "answer_id": 382033, "auth...
2008/12/19
[ "https://Stackoverflow.com/questions/381744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18149/" ]
381,758
<p>Is there an <em>easy</em> way to simulate Invalid Viewstate? </p>
[ { "answer_id": 387289, "author": "Macho Matt", "author_id": 1446, "author_profile": "https://Stackoverflow.com/users/1446", "pm_score": 2, "selected": false, "text": "<script language=\"javascript\">\n$(document).ready(function() {\n jQuery('input[@name=__VIEWSTATE]').val(\"this is no...
2008/12/19
[ "https://Stackoverflow.com/questions/381758", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1446/" ]
381,760
<p>My app sends lots and lots of data to SAP. To di this, it builds up an SAP table object and sends it over. I get this error somewhat regularly, but not reliably:</p> <pre><code>System exception thrown while marshaling .NET type 20081219 to RFCTYPE_BCD at SAP.Connector.Rfc.RfcMarshal.NetFieldToRfcField(Object src, RFCTYPE type, Encoding encoding, Byte[] dest, Int32 offset, Int32 len, Int32 charSize, Int32 decimals) at SAP.Connector.Rfc.RfcStructureUtil.ToRfcStructure(Object obj, Byte[] dest, Type t, Encoding encoding, Boolean isUnicode, PropertyInfo[] propinfos, RfcStructInfo structInfo) at SAP.Connector.Rfc.RfcStructureUtil.GetITabFromList(SAPConnection conn, Object list, Type t, RfcStructInfo structInfo, Int32 itab) at SAP.Connector.Rfc.RfcClient.PrepareClientParameters(Type classType, MethodInfo m, Boolean isTQRfc, Object[] MethodParamsIn, RFC_PARAMETER[]&amp; paramsIn, RFC_PARAMETER[]&amp; paramsOut, RFC_TABLE[]&amp; tables, ParameterMap[]&amp; paramMaps) at SAP.Connector.Rfc.RfcClient.RfcInvoke(SAPClient proxy, String method, Object[] methodParamsIn) at SAP.Connector.SAPClient.SAPInvoke(String method, Object[] methodParamsIn) </code></pre> <p>What's weird is that this doesn't happen every time. Also, the .NET type it complains about, &quot;20081219&quot; is the <em>data</em> I'm passing (a date)--not a type. I think the type of that field is <code>RFCTYPE.RFCTYPE_TIME</code>.</p> <p>Any suggestions on how to troubleshoot this intermittent error? Is there some kind of state I should be clearing between calls to the SAP RFCs?</p> <hr /> <p><strong>Update:</strong></p> <p>As requested, here's the code that calls SAP:</p> <pre><code>Using sapConnection As New MySapProxy(ConnectionString) sapConnection.Connection.Open() sapConnection.TheSapRfcICall(SapOpCode, Nothing, Nothing, sapTable, ResultTable) End Using </code></pre> <p>I'm thinking maybe multiple threads are using the same connection some how. Using <code>SAP.Connector.GetNewConnection</code> instead didn't change anything.</p> <hr /> <p><strong>Update:</strong></p> <p>It seems this problem occurs even when I run a single thread! What's the deal??</p> <p>Is there a way to disable the connection pool to see if that fixes it?</p> <hr /> <p><strong>Update:</strong></p> <p>@Igal Serban's answer seems to be working for me. I'll check the logs tomorrow morning and (hopefully) award the bounty! Thanks so much.</p> <hr /> <p><strong>Update:</strong></p> <p>As requested, my version of librfc32.dll is 6403.3.78.4732.</p>
[ { "answer_id": 382242, "author": "Igal Serban", "author_id": 25737, "author_profile": "https://Stackoverflow.com/users/25737", "pm_score": 2, "selected": true, "text": "MySapProxy proxy = new MySapProxy(); // do this only once.\n\n// and in you main loop:\nusing (proxy.Connection = Conne...
2008/12/19
[ "https://Stackoverflow.com/questions/381760", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29/" ]
381,761
<p>I have been hearing this term quite a lot. I have a bunch of mini questions that I would like to ask.</p> <ul> <li>Are business really ready for cloud computing?</li> <li>Do consumers have the appropriate resources to consume services from the cloud?</li> <li>Is this technology prone to more attacks?</li> <li>Some think cloud computing is just another over hyped term thats going to fizzle out. True?</li> <li>As a developer what different do I need to do?</li> </ul> <p>I am really looking forward at the responses.</p>
[ { "answer_id": 381851, "author": "Geo", "author_id": 47222, "author_profile": "https://Stackoverflow.com/users/47222", "pm_score": 0, "selected": false, "text": "* Do consumers have the appropriate resources to consume services from the cloud?\n * Is this technology prone to more attacks...
2008/12/19
[ "https://Stackoverflow.com/questions/381761", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37494/" ]
381,772
<p>I want to submit the values of a flex form to a ColdFusion cfc.</p> <p>If I have a flex form (see below) is the data in the form an object? Or do I have to create an object based on the id's in the form and then pass that new object to the coldfusion component? </p> <pre><code>&lt;mx:Form x="10" y="10" width="790" id="myFrom" defaultButton="{createReport}"&gt; &lt;mx:FormItem label="Resume Report Type:"&gt; &lt;mx:RadioButtonGroup id="showtype"/&gt; &lt;mx:HBox&gt; &lt;mx:RadioButton groupName="showtype" id="NotUpdated" value="notupdated" label="Not Updated" width="100" /&gt; &lt;mx:RadioButton groupName="showtype" id="Updated" value="updated" label="Updated" width="75" /&gt; &lt;mx:RadioButton groupName="showtype" id="All" value="all" label="All" width="75" /&gt; &lt;/mx:HBox&gt; &lt;/mx:FormItem&gt; &lt;mx:FormItem label="User Organzation:"&gt; &lt;mx:ComboBox dataProvider="{qOrganization}" labelField="UserOrganization" /&gt; &lt;/mx:FormItem&gt; &lt;mx:FormItem label="Between the following dates:"&gt; &lt;mx:HBox&gt; &lt;mx:DateField/&gt; &lt;mx:DateField left="10"/&gt; &lt;/mx:HBox&gt; &lt;/mx:FormItem&gt; &lt;mx:FormItem&gt; &lt;mx:Button label="Create Report" id="createReport"/&gt; &lt;/mx:FormItem&gt; &lt;/mx:Form&gt; </code></pre>
[ { "answer_id": 381851, "author": "Geo", "author_id": 47222, "author_profile": "https://Stackoverflow.com/users/47222", "pm_score": 0, "selected": false, "text": "* Do consumers have the appropriate resources to consume services from the cloud?\n * Is this technology prone to more attacks...
2008/12/19
[ "https://Stackoverflow.com/questions/381772", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24563/" ]
381,782
<p>How would I define an element that can either contain plain text or contain elements? Say I wanted to somehow allow for both of these cases:</p> <pre><code>&lt;xs:element name="field"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element ref="subfield" minOccurs="0" maxOccurs="unbounded" /&gt; &lt;/xs:sequence&gt; &lt;xs:attribute name="name" type="xs:string" /&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;xs:element name="field" type="xs:string" /&gt; </code></pre> <p>... so that both these elements would be valid:</p> <pre><code>&lt;field name="test_field_0"&gt; &lt;subfield&gt;Some text.&lt;/subfield&gt; &lt;/field&gt; &lt;field name="test_field_1"&gt;Some more text.&lt;/field&gt; </code></pre>
[ { "answer_id": 381839, "author": "David Norman", "author_id": 34502, "author_profile": "https://Stackoverflow.com/users/34502", "pm_score": 6, "selected": true, "text": "<xs:element name=\"field\">\n <xs:complexType mixed=\"true\">\n <xs:sequence>\n <xs:element r...
2008/12/19
[ "https://Stackoverflow.com/questions/381782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5291/" ]
381,793
<p>My problem is the following. I have a method which simply takes an XML excerpt and an XPath. It then should create me an array of objects for that XML excerpt. Meaning if I get passed the following XML:</p> <pre><code>&lt;user&gt; &lt;name&gt;Bob&lt;/name&gt; &lt;age&gt;50&lt;/age&gt; &lt;/user&gt; </code></pre> <p>My method will instantiate an instance of the class User and use key-value-coding to set the instance variables. It's rather straight forward. The only problem is I come from mostly a scripting background and trying to see if it's possible to pass the method a class name. Right now it's doing a User class, later it might be a Cars class, and then a Home class. What's the best way to instantiate objects from this method of different type while keeping the code as abstract as possible?</p>
[ { "answer_id": 381862, "author": "codelogic", "author_id": 43427, "author_profile": "https://Stackoverflow.com/users/43427", "pm_score": 7, "selected": true, "text": "id obj = [[NSClassFromString(@\"MySpecialClass\") alloc] init];\n" }, { "answer_id": 381916, "author": "Natha...
2008/12/19
[ "https://Stackoverflow.com/questions/381793", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40882/" ]
381,795
<p>Not that I'm trying to prevent 'View Source' or anything silly like that, but I'm making some custom context menus for certain elements.</p> <p>EDIT: response to answers: I've tried this:</p> <pre><code>&lt;a id="moo" href=''&gt; &lt;/a&gt; &lt;script type="text/javascript"&gt; var moo = document.getElementById('moo'); function handler(event) { event = event || window.event; if (event.stopPropagation) event.stopPropagation(); event.cancelBubble = true; return false; } moo.innerHTML = 'right-click here'; moo.onclick = handler; moo.onmousedown = handler; moo.onmouseup = handler; &lt;/script&gt; </code></pre>
[ { "answer_id": 381848, "author": "Kenan Banks", "author_id": 43089, "author_profile": "https://Stackoverflow.com/users/43089", "pm_score": 8, "selected": true, "text": "onContextMenu event.button" }, { "answer_id": 16987577, "author": "Omar Wagih", "author_id": 1312519, ...
2008/12/19
[ "https://Stackoverflow.com/questions/381795", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4435/" ]
381,831
<p>When I new a WCF service in my solution, can I do the following, have a constructor with parameter to pass in? If yes, how, when and where does the runtime fill in my required IBusinessLogic object?</p> <pre><code>[ServiceContract] public interface IServiceContract { [OperationContract] ... } public class MyService : IServiceContract { IBusinessLogic _businessLogic; public ServiceLayer(IBusinessLogic businessLogic) { _businessLogic = businessLogic; } ... } </code></pre>
[ { "answer_id": 33014658, "author": "HuBeZa", "author_id": 133665, "author_profile": "https://Stackoverflow.com/users/133665", "pm_score": 2, "selected": false, "text": "var host = new ServiceHost(typeof(MyService), baseAddress);\nvar instanceProvider = new InstanceProviderBehavior<T>(() ...
2008/12/19
[ "https://Stackoverflow.com/questions/381831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32240/" ]
381,859
<p>I have an <code>ItemsControl</code> that is data bound to a list of <code>decimal</code>s. I need to add one extra control to the <code>ItemsControl</code> (an option to specify the number manually). Is there a way to do this in XAML? I know I can manually add the item in the code behind, but I'm trying to understand WPF a little better and want to see if there is a declarative way to do it.</p> <p>Note that modifying the list I'm binding to so that it includes the extra button (possibly by changing to a list of <code>string</code>s instead of <code>decimal</code>s) isn't a good alternative because I want to attach a command to that last button.</p> <p>Also, adding an extra button after the <code>ItemsControl</code> isn't a good option either, because my control uses a <code>UniformGrid</code> and I want my extra control in that same grid.</p> <p>Here is my XAML:</p> <pre><code>&lt;ItemsControl ItemsSource="{Binding PossibleAmounts}"&gt; &lt;ItemsControl.ItemsPanel&gt; &lt;ItemsPanelTemplate&gt; &lt;UniformGrid Name="ButtonsGrid"&gt; &lt;/UniformGrid&gt; &lt;/ItemsPanelTemplate&gt; &lt;/ItemsControl.ItemsPanel&gt; &lt;ItemsControl.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;Button&gt; &lt;TextBlock Text="{Binding StringFormat='\{0:C\}'}"/&gt; &lt;/Button&gt; &lt;/DataTemplate&gt; &lt;/ItemsControl.ItemTemplate&gt; &lt;/ItemsControl&gt; </code></pre> <p>Basically, I want one more button in the UniformGrid.</p>
[ { "answer_id": 382093, "author": "Robert Macnee", "author_id": 19273, "author_profile": "https://Stackoverflow.com/users/19273", "pm_score": 6, "selected": true, "text": "<Grid xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n xmlns:sys=\"clr-namespace:System;ass...
2008/12/19
[ "https://Stackoverflow.com/questions/381859", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9323/" ]
381,864
<p>As a beginner/intermediate developer one problem I run into as my projects get bigger and more abstracted away as i use more OOP principles I have a problem with naming things. Like when i have multiple projects or class libraries I don't know what to name them. I see things from xxx.Core to xxx.Main or have even seen xxx.BLL and xxx.DAL. While looking through others i have seen xxx.Services and xxx.Data for their library and namespaces.</p> <p>Then once that is solved is what do i cal DTO's? In that realm i have seen xxx.DTO, xxx.Entities, xxx.Props.</p> <p>What are some good guidelines to naming libraries, methods, interfaces, etc... while coding so that more and more people will understand things when they come to pick up the project after me.</p>
[ { "answer_id": 404308, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "Library\n - Net code\n - DBA code\n - Controller manager code\n - Factories\nApplication\n - Forms\n - Controllers\n - Models\...
2008/12/19
[ "https://Stackoverflow.com/questions/381864", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23571/" ]
381,889
<p>Here is my SQLCommand object:</p> <pre><code>oCommand.CommandText = "INSERT INTO hits (id,client_id,client_ip,page,vars) VALUES _ (@@IDENTITY,@client_id,@ip,@page,@vars)" oCommand.Parameters.Count = 4 &gt;&gt; oCommand.Parameters.Item(0).ParameterName = "@client_id" &gt;&gt; oCommand.Parameters.Item(0).Value = "123456" &gt;&gt; oCommand.Parameters.Item(1).ParameterName = "@ip" &gt;&gt; oCommand.Parameters.Item(1).Value = "127.0.0.1" &gt;&gt; oCommand.Parameters.Item(2).ParameterName = "@page" &gt;&gt; oCommand.Parameters.Item(2).Value = "default.aspx" &gt;&gt; oCommand.Parameters.Item(3).ParameterName = "@vars" &gt;&gt; oCommand.Parameters.Item(3).Value = Nothing </code></pre> <p>This is the error I get:</p> <p>"<code>The parameterized query '(@ip nvarchar(9),@client_id nvarchar(4000),@page nvarchar(12),@v' expects the parameter '@client_id', which was not supplied.</code>"</p> <p>And here are the functions:</p> <pre><code>Public Shared Function insertIntoHitTable(ByVal oData As gsTrack) As Boolean Dim oObj As New List(Of Object()) oObj.Add(New Object() {"@client_id", cV(oData.ClientID)}) oObj.Add(New Object() {"@ip", cV(oData.IP)}) oObj.Add(New Object() {"@page", cV(oData.Page)}) oObj.Add(New Object() {"@vars", oData.Vars}) Dim oCommand As SqlCommand = InsertIntoHitTableSQL(oObj) oCommand.Connection.Open() oCommand.ExecuteNonQuery() oCommand.Connection.Close() End Function Public Shared Function createSQLCommand(ByVal oCmdTxt As String, ByVal oParams As List(Of Object())) As SqlCommand Dim oCommand As SqlCommand = Nothing Dim oBuilder As New StringBuilder Dim oParam As SqlParameter oCommand = New SqlCommand(oCmdTxt, New SqlConnection(csString)) Try For i As Integer = 0 To oParams.Count - 1 oParam = New SqlParameter oParam.ParameterName = oParams(i)(0) oParam.Value = oParams(i)(1) oCommand.Parameters.Add(oParam) oParam = Nothing Next Return oCommand Catch ex As Exception Return Nothing End Try End Function </code></pre> <p>Any pointers on how to resolve this parametrized query error? thanks!</p> <h2>EDIT</h2> <p>I should note that cV() just a scrubbing function, it checks to see if the passed variable is nothing.</p>
[ { "answer_id": 381911, "author": "Dillie-O", "author_id": 71, "author_profile": "https://Stackoverflow.com/users/71", "pm_score": 2, "selected": false, "text": "oCommand = New SqlCommand(\"INSERT INTO hits (id,client_id,client_ip,page,vars) VALUES (@@IDENTITY,@client_id,@ip,@page,@vars)\...
2008/12/19
[ "https://Stackoverflow.com/questions/381889", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25515/" ]
381,890
<p>I am doing some work on a web site that has a secure area which is available to users only after they have logged in. In this area there is a page with links to pdf documents which can be downloaded. The physical documents are outside of the web site's root directory. The links to the pdf documents look something like this:</p> <p>index.php?page=secure-area/download&amp;file=protected.pdf</p> <p>Which executes the following (note: I know this is the way to force a download rather than open the file <em>inside</em> the browser):</p> <pre><code>// check security, get filename from request, prefix document download directory and check for file existance then... header('Content-Type: application/pdf'); header('Content-Disposition: attachment; filename="' . basename($file) . '"'); header('Content-Transfer-Encoding: binary'); header('Content-Length: ' . filesize($file)); header('Connection: Close'); set_time_limit(0); readfile($file); </code></pre> <p>This works well but in Firefox 3 and Internet Explorer 7 (I haven't tested with any other browser) won't open this file inside the browser, they both show the download dialog box (as expected). If I select Open rather than Save, the document is downloaded and Adobe Reader is started outside of the browser to render the document.</p> <p><strong>The problem I have is downloading the file inside the browser and having the correct default file name if saved.</strong></p> <p>I would like the document to open in the browser. One way of doing this is using the header "Content-Disposition: inline;" but this means that I can't specify a filename (because is seems to be ignored by the browser). The problem with doing that is when I save the document, the default name is that of the URL, not the filename of the pdf document:</p> <pre><code>http___example.com_index.php_page=secure_area_download&amp;file=protected.pdf </code></pre> <p>How can I get Firefox and Internet Explorer to open the document inside the browser and provide the correct default filename to save?</p>
[ { "answer_id": 381939, "author": "Samuel", "author_id": 32465, "author_profile": "https://Stackoverflow.com/users/32465", "pm_score": 1, "selected": false, "text": "Content-Disposition: inline;\n" }, { "answer_id": 390553, "author": "Stacey Richards", "author_id": 1142, ...
2008/12/19
[ "https://Stackoverflow.com/questions/381890", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1142/" ]
381,918
<p>After two years of C#, my VB.NET is a bit rusty. I have two Lists. Let's call them originalList and targetList. Here is my C# code:</p> <pre><code>for(int i = 0; i&lt;originalList.Count; i++) { bool isMatch = false; foreach (string t in targetList) { if(String.Compare(originalList[i], t, true) == 0) { isMatch = true; break; } } if(isMatch) { originalList.RemoveAt(i); i--; } } </code></pre> <p>And my VB.NET code is this:</p> <pre><code>Dim i as Integer For i = 0 To originalList.Count - 1 Dim isMatch as boolean = false For Each t As String In targetList If String.compare(originalList(i), t, true) = 0 Then isMatch = true Exit For End If Next If isMatch Then originalList.RemoveAt(i) i -= 1 End If Next </code></pre> <p>But I got an index-out-of-range error with my VB.NET code. Where did I get it wrong?</p>
[ { "answer_id": 381949, "author": "Michael Haren", "author_id": 29, "author_profile": "https://Stackoverflow.com/users/29", "pm_score": 2, "selected": false, "text": "dim i as integer = 0\nWhile i < originalList.Count\n dim isMatch as boolean = false\n for each t as string in target...
2008/12/19
[ "https://Stackoverflow.com/questions/381918", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28647/" ]
381,920
<p>I'm looking for a way to redirect output in a groovy script to stderr:</p> <pre><code>catch(Exception e) { println "Want this to go to stderr" } </code></pre>
[ { "answer_id": 381941, "author": "Dan Vinton", "author_id": 21849, "author_profile": "https://Stackoverflow.com/users/21849", "pm_score": 4, "selected": false, "text": "System.err.println \"goes to stderr\"\n" }, { "answer_id": 382206, "author": "codeLes", "author_id": 30...
2008/12/19
[ "https://Stackoverflow.com/questions/381920", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14481/" ]
381,947
<p>As the title says: Is there a difference between $str == '' and strlen($str) == 0 in PHP? Is there any real speed difference and is one better to use than the other?</p>
[ { "answer_id": 381960, "author": "Paige Ruten", "author_id": 813, "author_profile": "https://Stackoverflow.com/users/813", "pm_score": 1, "selected": false, "text": "if (empty($str)) {\n ...\n}\n\nif (!$str) {\n ...\n}\n" }, { "answer_id": 381975, "author": "Vilx-", ...
2008/12/19
[ "https://Stackoverflow.com/questions/381947", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5441/" ]
381,954
<p>We've recently implemented Amazon S3 in our site which led us to change the way we handled images. We used to call a controller /fotos.php that would read the file from disk, record some statistics, set headers and return the contents of the file as image/jpeg.</p> <p>All went OK until S3. Fotos.php now does a 302 redirect to the resource in Amazon and all is nice and working, but you can't save a image in Firefox because it sets its file type as .htm. I found this discussion on the matter, and it seems like a bug in Firefox:</p> <p><a href="https://bugs.launchpad.net/ubuntu/+source/firefox-3.0/+bug/207670" rel="nofollow noreferrer">https://bugs.launchpad.net/ubuntu/+source/firefox-3.0/+bug/207670</a></p> <p>Here is a URL exhibiting the problem (try to save the big image):</p> <p><a href="http://www.viajeros.com/fotos/el-gran-lago-de-atitlan-y-sus-volcanes/132968" rel="nofollow noreferrer">http://www.viajeros.com/fotos/el-gran-lago-de-atitlan-y-sus-volcanes/132968</a></p> <p>Internet Explorer 6 at least tries to save it as Untitled.BMP.</p> <p>Here is the snippet of code we use in fotos.php:</p> <pre> $archivo = $fotos->ObtenerPathFotoAmazon( $url, null ); if (empty($_GET['nocache'])) { header('HTTP/1.0 302 Found'); header("Expires: ".gmdate("D, d M Y H:i:s", time()+315360000)." GMT"); header("Cache-Control: max-age=315360000"); } else { header('HTTP/1.0 307 Temporary Redirect'); } header('Location: ' . AWS_BUCKET_URL . $archivo); die; </pre> <p>Do you know a workaround for this?</p> <p>EDIT: We are using CloudFront as well.</p>
[ { "answer_id": 382115, "author": "Eineki", "author_id": 29125, "author_profile": "https://Stackoverflow.com/users/29125", "pm_score": 3, "selected": true, "text": "header('Content-Type: image/jpeg'); header('Content-Type: image/png'); $archivo = $fotos->ObtenerPathFotoAmazon( $url, null ...
2008/12/19
[ "https://Stackoverflow.com/questions/381954", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26481/" ]
381,973
<p>I'm working on an application that displays some child windows which can either be closed by the user or are automatically closed. While debugging some exceptions that were being thrown, I discovered I was trying to call methods like <code>Hide()</code> on a window that had already been closed; this particular branch of code was common to both cases and I hadn't noticed this.</p> <p>One of my first ideas was to look for a property on <code>Window</code> that would indicate the window had been closed. I can't seem to find one. In WinForms, I'd look to the <em>IsDisposed</em> property for a somewhat reliable indicator that the form had been closed (it won't reliably work for a dialog but I'm not working with dialogs.) I don't see anything equivalent on <code>Window</code>. The documentation for <code>Window.Close()</code> doesn't seem to indicate any properties that are changed by the method. Am I missing something obvious, or is the only method to know if a window's been closed to handle the <code>Closed</code> event? That seems kind of a harsh requirement for a simple task.</p>
[ { "answer_id": 8409736, "author": "Simon_Weaver", "author_id": 16940, "author_profile": "https://Stackoverflow.com/users/16940", "pm_score": 3, "selected": false, "text": "OfType<Window>()" }, { "answer_id": 32766135, "author": "Adrian Rus", "author_id": 497423, "auth...
2008/12/19
[ "https://Stackoverflow.com/questions/381973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2547/" ]
381,976
<p>I have the following sub:</p> <pre><code> Private Sub Watcher_Changed(ByVal sender As System.Object, ByVal e As FileSystemEventArgs) If Path.GetExtension(e.Name) = ".p2p" Then Exit Sub Else Try ' multiple change events can be thrown. Check that file hasn't already been moved. While Not File.Exists(e.FullPath) Exit Try End While ' throw further processing to a BackGroundWorker ChangedFullPath = e.FullPath ChangedFileName = e.Name FileMover = New BackgroundWorker AddHandler FileMover.DoWork, New DoWorkEventHandler(AddressOf ProcessFile) FileMover.RunWorkerAsync() Catch ex As Exception MessageBox.Show(ex.Message) End Try End If End Sub </code></pre> <p>I'm still getting multiple changed-file notifications when a file is being uploaded by FTP. </p> <p>I want to modify the Try so it also throws out the change notification if it has happened within the past (time) -- let's say 3 seconds. It ought to be trivial, but for some reason it isn't coming to me today, and my mind isn't wrapping itself around the answers I'm finding on Google.</p> <p>Thanks, Scott</p>
[ { "answer_id": 912557, "author": "Matt Palmerlee", "author_id": 112741, "author_profile": "https://Stackoverflow.com/users/112741", "pm_score": 1, "selected": false, "text": "private void fsw_Created(object sender, FileSystemEventArgs e)\n{\n if (File.Exists(e.FullPath))\n {\n /...
2008/12/19
[ "https://Stackoverflow.com/questions/381976", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
381,980
<p>I am writing a web app using Castle ActiveRecord, and I keep getting this exception whenever I try to access a lazy loaded list of related objects. Here is my code:</p> <pre><code> using(new SessionScope()) { foreach (var field in eventObj.RegistrationFields) { //Do something with the field here... } } </code></pre> <p>The RegistrationFields property looks like this:</p> <pre><code> [HasMany(Inverse = true, Lazy = true)] public IList&lt;EventRegistrationField&gt; RegistrationFields { get; set; } </code></pre> <p>The exception happens when the "eventObj.RegistrationFields" is accessed for the foreach loop. I also made sure to set the isweb="true" attribute in my activeRecord config settings. Does anyone know why this would happen? Here is my config:</p> <pre><code>&lt;connectionStrings&gt; &lt;add name="main" connectionString="Data Source=localhost\SQLEXPRESS;Initial Catalog=EventScheduler;Integrated Security=SSPI"/&gt; &lt;/connectionStrings&gt; &lt;activerecord isWeb="true"&gt; &lt;config&gt; &lt;add key="hibernate.connection.driver_class" value="NHibernate.Driver.SqlClientDriver"/&gt; &lt;add key="hibernate.dialect" value="NHibernate.Dialect.MsSql2005Dialect"/&gt; &lt;add key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider"/&gt; &lt;add key="hibernate.connection.connection_string_name" value="main"/&gt; &lt;/config&gt; &lt;/activerecord&gt; </code></pre>
[ { "answer_id": 386106, "author": "Neil Hewitt", "author_id": 22178, "author_profile": "https://Stackoverflow.com/users/22178", "pm_score": 4, "selected": true, "text": "RegistrationFields eventObj eventObj RegistrationFields new SessionScope() eventObj new SessionScope() Dispose()" } ]
2008/12/19
[ "https://Stackoverflow.com/questions/381980", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14101/" ]
381,983
<p>What's the best way retrieve complex queries from a REST service?</p> <p>Suppose I want to get X collections, apply filters and equations to each one, combine the collections using some other operation and return one result, everything in one request.</p> <p>It is just too complex (and big) to put everything in the querystring since I could combine more than 300 collections (plus the operators and filters to each one).</p> <p>I thought about using POST to send a XML object describing the query to something like:</p> <pre><code>http://mydomain/collections/complexQuery </code></pre> <p>It would return an unique ID and then I could use GET to retrieve the complexQuery result:</p> <pre><code>http://mydomain/collections/complexQuery/{queryId} </code></pre> <p><strong>Jason S:</strong></p> <p>That's the idea. The POST will take an XML representation of the query, with the "where" parameters already (they can be too many). The query will be executed only when the GET arrives. I could let the query object available just for some time and delete it later.</p> <p>Is this a good solution? Am I still RESTful doing this?</p>
[ { "answer_id": 381990, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 2, "selected": false, "text": "POST 201 Created Location 200 OK" }, { "answer_id": 453601, "author": "LiorH", "author_id": 52954, "...
2008/12/19
[ "https://Stackoverflow.com/questions/381983", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22693/" ]
381,988
<p>I have been spoiled by either using sql server to store data, or using xml files.</p> <p>What are common techniques for storing data in flat files other than xml and CSV.</p> <p>I know many times when I open files that data is all jumbled up, which means it is encoded right? </p> <p>Are there any common techniques that I could read about somewhere?</p>
[ { "answer_id": 382002, "author": "Michael Haren", "author_id": 29, "author_profile": "https://Stackoverflow.com/users/29", "pm_score": 2, "selected": false, "text": "invoice: 34843\ndate : 2001-01-23\nbill-to: &id001\n given : Chris\n family : Dumars\n address:\n lines...
2008/12/19
[ "https://Stackoverflow.com/questions/381988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39677/" ]
382,000
<p>After watching: <a href="http://www.youtube.com/watch?v=4F72VULWFvc" rel="noreferrer">The Clean Code Talks -- Inheritance, Polymorphism, &amp; Testing</a></p> <p>I checked my code and noticed a few switch statements can be refactored into polymorphism, but I also noticed I only used switch statements with enums. Does this mean enums are "evil" in OO-design and should be eliminated with polymorphism?</p>
[ { "answer_id": 382022, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 4, "selected": false, "text": "switch" }, { "answer_id": 382075, "author": "recursive", "author_id": 44743, "author_profile": "h...
2008/12/19
[ "https://Stackoverflow.com/questions/382000", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21838/" ]
382,006
<p>I'm creating a WPF application where several ListView selections are made in a row (similar to the iTunes browser). The problem is that the default inactive selection color is too light. (see below) <img src="https://i.stack.imgur.com/hwctc.jpg" alt="Default inactive selection color (too light)"></p> <p>How can I change this color so my inactive listview looks like this? (see below) <img src="https://i.stack.imgur.com/aORZ9.jpg" alt="Inactive and active selection colors the same"></p> <h2>Solution</h2> <p>Override the default SystemColor with a <code>Style</code> like so:</p> <pre><code>&lt;Style TargetType="ListViewItem"&gt; &lt;Style.Resources&gt; &lt;SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="{x:Static SystemColors.HighlightColor}"/&gt; &lt;/Style.Resources&gt; &lt;/Style&gt; </code></pre>
[ { "answer_id": 382162, "author": "Kent Boogaart", "author_id": 5380, "author_profile": "https://Stackoverflow.com/users/5380", "pm_score": 7, "selected": true, "text": "ListBox ControlBrush <ListBox>\n <ListBox.Resources>\n <SolidColorBrush x:Key=\"{x:Static SystemColors.Contro...
2008/12/19
[ "https://Stackoverflow.com/questions/382006", "https://Stackoverflow.com", "https://Stackoverflow.com/users/317/" ]
382,009
<p>In my .net windows service, when my timer elapses and my main method is called, is it best practice to put the timer in sleep mode?</p> <p>This is in case my main method runs for too long, and the timer elapses before the previous calls main method finishes its execution.</p>
[ { "answer_id": 382162, "author": "Kent Boogaart", "author_id": 5380, "author_profile": "https://Stackoverflow.com/users/5380", "pm_score": 7, "selected": true, "text": "ListBox ControlBrush <ListBox>\n <ListBox.Resources>\n <SolidColorBrush x:Key=\"{x:Static SystemColors.Contro...
2008/12/19
[ "https://Stackoverflow.com/questions/382009", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39677/" ]
382,051
<p>I'm trying to find documentation on how I can override a property name in Objective-C with @synthesize. If I have an instance variable name of 'foo', I want to write it's accessor as 'bar'. </p> <p>Doing something such as</p> <pre><code>@synthesize foo = bar; </code></pre> <p>gives a compile-time error.</p>
[ { "answer_id": 382082, "author": "JamesSugrue", "author_id": 1075, "author_profile": "https://Stackoverflow.com/users/1075", "pm_score": 3, "selected": true, "text": "@synthesize firstName, lastName, age = yearsOld;\n" }, { "answer_id": 382465, "author": "Kelan", "author_...
2008/12/19
[ "https://Stackoverflow.com/questions/382051", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40882/" ]
382,100
<p>We are planning to build a dynamic data import tool. Basically taking information on one end in a specified format (access, excel, csv) and upload it into an web service. </p> <p><strong>The situation is that we do not know the export field names, so the application will need to be able to see the wsdl definition and map to the valid entries in the other end.</strong></p> <p>In the import section we can define most of the fields, but usually they have a few that are custom. Which I see no problem with that. </p> <p>I just wonder if there is a design pattern that will fit this type of application or help with the development of it.</p>
[ { "answer_id": 944781, "author": "Erik Engheim", "author_id": 66634, "author_profile": "https://Stackoverflow.com/users/66634", "pm_score": 2, "selected": false, "text": "// In this example file format describes a house (complex data object)\nAbstractReader reader = factory.createReader(...
2008/12/19
[ "https://Stackoverflow.com/questions/382100", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47222/" ]
382,101
<p>How do you manage your php codes? Do you prefer functioning within one php file or including larger blocks of "raw code"?</p> <p>Edit: In fact, my code is pretty nasty, as I don't use any namespaces and classes - only functions and including. I shall look the classes up ^^. </p>
[ { "answer_id": 382144, "author": "Nick Van Brunt", "author_id": 30470, "author_profile": "https://Stackoverflow.com/users/30470", "pm_score": 0, "selected": false, "text": "case 'widgetlist':\n $widgets = $DAO->getWidgets(); //get some query\n include('view/showWidgets.php'); //assum...
2008/12/19
[ "https://Stackoverflow.com/questions/382101", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21209/" ]
382,107
<p>I'm studying Juval Lowy's excellent Programming WCF Services and I've just created a really simple in-proc component using his InProcFactory class that comes along with his ServiceModelEx library.</p> <p>Why would you do this instead of using just regular classes in your project? Using his method requires referencing his library and creating an interface.</p> <p>I can think of a couple of advantages:</p> <ul> <li>If you do this consistently you'll reduce coupling considerably. </li> <li>Once you've written your in-proc components they're ready to be used out-of-proc or remotely without change.</li> </ul> <p>Are there more advantages in doing this? </p> <p>Do you write code with in-proc WCF components? </p> <p>Should all classes be components? </p> <p>Can you go totally overboard with the whole decoupling thing?</p> <p>Do the disadvantages of componentizing all your classes outweigh the advantages? Vice versa?</p>
[ { "answer_id": 382144, "author": "Nick Van Brunt", "author_id": 30470, "author_profile": "https://Stackoverflow.com/users/30470", "pm_score": 0, "selected": false, "text": "case 'widgetlist':\n $widgets = $DAO->getWidgets(); //get some query\n include('view/showWidgets.php'); //assum...
2008/12/19
[ "https://Stackoverflow.com/questions/382107", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1572436/" ]
382,108
<p>How to script a constraint on a field in a table, for an acceptable range of values is between 0 and 100?</p>
[ { "answer_id": 382116, "author": "Mark Brackett", "author_id": 2199, "author_profile": "https://Stackoverflow.com/users/2199", "pm_score": 6, "selected": true, "text": "ALTER TABLE Table\nADD CONSTRAINT CK_Table_Column_Range CHECK (\n Column >= 0 AND Column <= 100 --Inclusive\n)\n" }...
2008/12/19
[ "https://Stackoverflow.com/questions/382108", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1446/" ]
382,110
<p>Can someone point me to an article (or discuss here) that explains how an add-on/extension can read what a user has completed in a form in a browser so you can present data to them based on the search parameters?</p> <p>An example would be the Sidestep extension that opens a sidebar when a user searches on an airline/travel site and presents them a Sidestep meta search based on the parameters used on the original airline/travel site.</p>
[ { "answer_id": 382116, "author": "Mark Brackett", "author_id": 2199, "author_profile": "https://Stackoverflow.com/users/2199", "pm_score": 6, "selected": true, "text": "ALTER TABLE Table\nADD CONSTRAINT CK_Table_Column_Range CHECK (\n Column >= 0 AND Column <= 100 --Inclusive\n)\n" }...
2008/12/19
[ "https://Stackoverflow.com/questions/382110", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47880/" ]
382,113
<p>I am conducting some throughput testing. My application has to</p> <ol> <li>read from JMS</li> <li>do some processing</li> <li>write to JMS</li> </ol> <p>My goal here is to simulate #2, 'some processing'. That is, introduce a delay and occupy the CPU for a given time (e.g. 500ms) before forwarding the event.</p> <p>The naive approach would be to <code>Thread.sleep(500)</code>. This would introduce the right delay in execution, but would not exercise the CPU.</p> <p>Calculating Fibonacci numbers is one option. <strong>Has anyone used any interesting techniques just to keep CPU(s) busy for a given time?</strong></p> <p>Ideal characteristics would be:</p> <ul> <li>Performs a variety of instructions, rather than (for example) just spinning on a loop</li> <li>Not something the HotSpot VM is going to optimise away to nothing</li> <li>Has an easy way to adjust the processing period up or down (time to complete will clearly vary given the hardware)</li> </ul>
[ { "answer_id": 382164, "author": "cliff.meyers", "author_id": 41754, "author_profile": "https://Stackoverflow.com/users/41754", "pm_score": 2, "selected": false, "text": "Collections.shuffle() Collections.sort()" }, { "answer_id": 382212, "author": "Michael Myers", "autho...
2008/12/19
[ "https://Stackoverflow.com/questions/382113", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44437/" ]
382,150
<p>I want to pass some parameters to my MVC UserControl like ShowTitle(bool) and the ViewData.Model.Row . How I define my usercontrol and pass them to it? Tanx</p>
[ { "answer_id": 382205, "author": "liggett78", "author_id": 19762, "author_profile": "https://Stackoverflow.com/users/19762", "pm_score": 1, "selected": false, "text": "public partial class MyUserControl : System.Web.Mvc.ViewUserControl<MyUserControlViewData> {\n}\n\npublic class MyUserCo...
2008/12/19
[ "https://Stackoverflow.com/questions/382150", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46110/" ]
382,152
<p>I'm trying to control the coordinates of where my program opens a new window because currently they're opening ontop of each other. Does anyone have a working example of how to do this?</p>
[ { "answer_id": 382168, "author": "JosephStyons", "author_id": 672, "author_profile": "https://Stackoverflow.com/users/672", "pm_score": 3, "selected": false, "text": "procedure TForm1.Button1Click(Sender: TObject);\nvar\n frm : TForm;\nbegin\n frm := TForm.Create(Self);\n frm.Left := ...
2008/12/19
[ "https://Stackoverflow.com/questions/382152", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
382,155
<p>In Unix the <code>^</code> allows you to repeat a command with some text substituted for new text. For example:</p> <pre><code>csh% grep "stuff" file1 &gt;&gt; Results grep "stuff" file1 csh% ^file1^file2^ grep "stuff" file2 csh% </code></pre> <p>Is there a Vim equivalent? There are a lot of times I find myself editing minor things on the command line over and over again.</p>
[ { "answer_id": 382195, "author": "palehorse", "author_id": 312, "author_profile": "https://Stackoverflow.com/users/312", "pm_score": 3, "selected": false, "text": "hello" }, { "answer_id": 382223, "author": "rampion", "author_id": 9859, "author_profile": "https://Stac...
2008/12/19
[ "https://Stackoverflow.com/questions/382155", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23829/" ]
382,166
<p>In a C++ project that uses smart pointers, such as <code>boost::shared_ptr</code>, what is a good design philosophy regarding use of "<strong><code>this</code></strong>"?</p> <p>Consider that:</p> <ul> <li><p>It's dangerous to store the raw pointer contained in any smart pointer for later use. You've given up control of object deletion and trust the smart pointer to do it at the right time.</p></li> <li><p>Non-static class members intrinsically use a <strong><code>this</code></strong> pointer. It's a raw pointer and that can't be changed.</p></li> </ul> <p>If I ever store <code>this</code> in another variable or pass it to another function which could potentially store it for later or bind it in a callback, I'm creating bugs that are introduced when anyone decides to make a shared pointer to my class.</p> <p><strong>Given that, when is it ever appropriate for me to explicitly use a <code>this</code> pointer?</strong> Are there design paradigms that can prevent bugs related to this?</p>
[ { "answer_id": 382177, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 5, "selected": true, "text": "boost::enable_shared_from_this this" }, { "answer_id": 382178, "author": "Nemanja Trifunovic", ...
2008/12/19
[ "https://Stackoverflow.com/questions/382166", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16287/" ]
382,171
<p>I have a form on an HTML page with multiple submit buttons that perform different actions. However, when the user is typing a value into a text input and hit enters, the browsers generally act as though the next submit button sequentially was activated. I want a particular action to occur, so one solution I found was to put in invisible submit buttons into the HTML directly after the text inputs in question, like this:</p> <pre><code>&lt;input type="text" name="something" value="blah"/&gt; &lt;input type=submit name="desired" value="Save Earth" style="display: none"/&gt; ... &lt;input type=submit name="something_else" value="Destroy Earth" /&gt; ... &lt;input id="foobar" type=submit name="desired" value="Save Earth" /&gt; </code></pre> <p>This works like a charm in most browsers, except that it doesn't in webkit browsers like Safari and Chrome. For some reason they skip over the invisible submit button. I've been trying to figure out how to intercept the enter key press and activate the proper submission using Javascript, but I haven't been able to get it to work. Intercepting the keydown and setting focus on the proper submit does not work. </p> <p>Is there any way using Javascript or otherwise to select which submit button will be used when the user hits the enter key in a text input on an HTML form?</p> <p><em>Edit: To clarify, the form can't require Javascript to "work" fundamentally. I don't care if the enter key submission is undesireable without Javascript on webkit browsers, but I can't remove or change the order of the submit buttons.</em></p> <p><strike>This is what I tried, it doesn't change the submission behavior in webkit browsers.</strike><br> What worked is to change the <em>focus()</em> in the following code to <em>click()</em>.</p> <pre><code>document.onkeypress = processKey; function processKey(e) { if (null == e) e = window.event ; if (e.keyCode == 13) { document.getElementById("foobar").click(); // previously: focus() } } </code></pre> <p><strong>EDIT: FINAL SOLUTION:</strong></p> <p>Works with every browser and only intercepts the enter key when needed:</p> <p>HTML:</p> <pre><code>&lt;input type="text" name="something" value="blah" onkeydown="return processKey(event)" /&gt; &lt;input type=submit name="desired" value="Save Earth" style="display: none"/&gt; ... &lt;input type=submit name="something_else" value="Destroy Earth" /&gt; ... &lt;input id="foobar" type=submit name="desired" value="Save Earth" /&gt; </code></pre> <p>Javascript:</p> <pre><code>function processKey(e) { if (null == e) e = window.event ; if (e.keyCode == 13) { document.getElementById("foobar").click(); return false; } } </code></pre>
[ { "answer_id": 382179, "author": "cLFlaVA", "author_id": 45109, "author_profile": "https://Stackoverflow.com/users/45109", "pm_score": 4, "selected": true, "text": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional...
2008/12/19
[ "https://Stackoverflow.com/questions/382171", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1892/" ]
382,173
<p>The two methods <code>Thread.Suspend()</code> and <code>Thread.Resume()</code> are obsolete since .NET 2.0. Why? What are other alternatives and any examples?</p>
[ { "answer_id": 753286, "author": "Darcy Casselman", "author_id": 5062, "author_profile": "https://Stackoverflow.com/users/5062", "pm_score": 5, "selected": false, "text": "private Thread myThread;\n\nprivate void WorkerThread() \n{\n myThread = Thread.CurrentThread;\n while (true)\...
2008/12/19
[ "https://Stackoverflow.com/questions/382173", "https://Stackoverflow.com", "https://Stackoverflow.com/users/62776/" ]
382,174
<p>Within the Netbeans 6.5's Tools -> Options -> Fonts &amp; Colors -> Syntax dialog, you have the ability to change the look and feel of the Netbeans text editor. When you select a language, you are presented with a preview of your font/color scheme. However, when I preview Java, there are far more options for syntax changes than are being displayed in that preview window. If I were able to view a more robust piece of code, I'd be able to see the immediate effect of more of the options.</p> <p>How can I supply a preview document to view my font/color changes?</p> <p>UPDATE:</p> <p>After looking into this some more, I've been able to narrow down the problem a bit. From what I can tell, everything in Netbeans is considered a plugin. The GUI editor is a plugin, and even the text editor is a plugin. This means that what ever piece of Netbeans that actually analyzes Java code and does syntax highlights is also a plugin (since Java is just one of many languages Netbeans highlights, it makes sense this is a plugin).</p> <p>I think fromvega is on the right track with his suggestion. The tutorial for creating a manifest file editing plugin pointed me in the right direction. The tutorial eludes to a file used as a sample document used for font/color previews. It tells you how to create one inside this new plugin project. (Located in "Registering the Options in the NetBeans System Filesystem", part 4. About 4/5 of the way down the page.)</p> <p>My next line of thought was to look for the Java syntax editing mode plugin and find this file and update it with a richer example file. I looked in the installation directory and came up empty, but I found what looks like the appropriate files within my user settings directory. There is a config directory with a lot of subfolders within my user directory (Windows: C:\Documents and Settings\saterus.netbeans\config). </p> <p>I've been poking around inside this directory a bit, but have only found the xml files the manifest tutorial talks about. I have been unable to find the extensionless sample file for the Java plugin that I believe should be there.</p> <p>Since I've hit a brick wall for the moment, I thought I'd toss it back to the SO community and see if you guys might make the last leap and find the solution. </p>
[ { "answer_id": 2201353, "author": "Roja Buck", "author_id": 217244, "author_profile": "https://Stackoverflow.com/users/217244", "pm_score": 2, "selected": false, "text": "grep -lr \"some part of the current sample code\" /path/to/netbeans\n" } ]
2008/12/19
[ "https://Stackoverflow.com/questions/382174", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34235/" ]
382,176
<p>I am working on a project that needs to use a database driven MVC scheme where the route to the controllers and views are controlled through a single database table. However, I haven't been able to find any tutorials that demonstrate this with a current version of the framework (they all appear to have been written several versions ago) and I was wondering if anyone has done something like this with a more recent version of the framework or if anyone knows of blogs or tutorials that discuss how to accomplish this in a simple manner.</p> <p>The basic idea is that there will be a sitePage table that will contain pageName, controller, module and view fields. When the request is processed I need to query the database for the given pageName and determine the appropriate controller, module and view and then pass this into the necessary Zend class to continue with the normal routing and processing of the request.</p> <p>Thanks in advance.</p>
[ { "answer_id": 382298, "author": "lbrandao", "author_id": 47883, "author_profile": "https://Stackoverflow.com/users/47883", "pm_score": 2, "selected": false, "text": "preDispatch() preDispatch() Zend_Controller_Request_Abstract::setDispatched(false)" }, { "answer_id": 382319, ...
2008/12/19
[ "https://Stackoverflow.com/questions/382176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20178/" ]
382,186
<p>Is there a way, given a set of values <code>(x,f(x))</code>, to find the polynomial of a given degree that best fits the data? </p> <p>I know <a href="http://en.wikipedia.org/wiki/Polynomial_interpolation" rel="noreferrer">polynomial interpolation</a>, which is for finding a polynomial of degree <code>n</code> given <code>n+1</code> data points, but here there are a large number of values and we want to find a low-degree polynomial (find best linear fit, best quadratic, best cubic, etc.). It might be related to <a href="http://en.wikipedia.org/wiki/Least_squares" rel="noreferrer">least squares</a>...</p> <p>More generally, I would like to know the answer when we have a multivariate function -- points like <code>(x,y,f(x,y))</code>, say -- and want to find the best polynomial (<code>p(x,y)</code>) of a given degree in the variables. (Specifically a polynomial, not splines or Fourier series.) </p> <p>Both theory and code/libraries (preferably in Python, but any language is okay) would be useful.</p>
[ { "answer_id": 382274, "author": "jfs", "author_id": 4279, "author_profile": "https://Stackoverflow.com/users/4279", "pm_score": 3, "selected": false, "text": "import numpy\n\nx = numpy.arange(10)\ny = x**2\n\ncoeffs = numpy.polyfit(x, y, deg=2)\npoly = numpy.poly1d(coeffs)\nprint poly\n...
2008/12/19
[ "https://Stackoverflow.com/questions/382186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4958/" ]
382,197
<p>I am getting this error on a remote server, but the same code executes fine locally. Please refrain from saying it sucks, or giving me your rant on dynamic sql, I didn't write it, just trying to figure out why it's throwing an exception. The highlighted error is line 56.</p> <pre><code>Protected Sub drpDateRange_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles drpRange.SelectedIndexChanged Dim sql As String = "SELECT postedDate, inspectionType FROM tInspectionRequest WHERE source_lookupID = 'IRS_WEB' " If _franchiseID &gt; 0 Then sql &amp;= " and franchiseeID = " &amp; _franchiseID.ToString Dim db As New Database Dim ds As DataSet = db.selectQuery(sql) Dim dv As New DataView(ds.Tables(0)) dv.RowFilter = "inspectionType='Buyer' AND postedDate &gt;= #" &amp; DateTime.Now.AddDays(-1) &amp; "#" lblB1.Text = dv.Count End Sub </code></pre> <p>Here is the exception, it seems like DateTime.Now.AddDays(-1) is failing being cast as a datetime? Regardless if it's a casting issue / date to string error, it's strange it fails only on the remote server, and not locally.</p> <p>String was not recognized as a valid DateTime. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.</p> <p>Exception Details: System.FormatException: String was not recognized as a valid DateTime.</p> <p>Source Error:</p> <p><code>Line 55: Dim dsInspectionHistory As DataSet = objDB.selectQuery(sqlInspectionHistory)</code></p> <p><code>Line 56: Dim dvInspectionHistory As New DataView(dsInspectionHistory.Tables(0))</code></p> <p><code>Line 57: dvInspectionHistory.RowFilter = "inspectionType='Buyer' AND postedDate &gt;= #" &amp; DateTime.Now.AddDays(-1).ToString &amp; "#"</code></p> <p><code>Line 58: lblB1.Text = dvInspectionHistory.Count</code></p> <p><code>Line 59: dvInspectionHistory.RowFilter = "inspectionType='Seller' AND postedDate &gt;= #" &amp; DateTime.Now.AddDays(-1) &amp; "#"</code></p> <p>[FormatException: String was not recognized as a valid DateTime.] System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) +2291962 System.DateTime.Parse(String s, IFormatProvider provider) +26 System.Data.ConstNode..ctor(DataTable table, ValueType type, Object constant, Boolean fParseQuotes) +485 System.Data.ExpressionParser.Parse() +830 System.Data.DataExpression..ctor(DataTable table, String expression, Type type) +124 System.Data.DataView.set_RowFilter(String value) +161 controls_inspectionRequestChart.drpRange_SelectedIndexChanged(Object sender, EventArgs e) in xxxx controls_inspectionRequestChart.Page_Load(Object sender, EventArgs e) in xxxx System.Web.UI.Control.OnPreRender(EventArgs e) +2117788 System.Web.UI.Control.PreRenderRecursiveInternal() +86 System.Web.UI.Control.PreRenderRecursiveInternal() +170 System.Web.UI.Control.PreRenderRecursiveInternal() +170 System.Web.UI.Control.PreRenderRecursiveInternal() +170 System.Web.UI.Control.PreRenderRecursiveInternal() +170 System.Web.UI.Control.PreRenderRecursiveInternal() +170 System.Web.UI.Control.PreRenderRecursiveInternal() +170 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2041</p>
[ { "answer_id": 382219, "author": "Christopher Edwards", "author_id": 29411, "author_profile": "https://Stackoverflow.com/users/29411", "pm_score": 4, "selected": true, "text": "dv.RowFilter = \"inspectionType='Buyer' AND postedDate >= #\" & DateTime.Now.AddDays(-1).ToString(\"MMM dd yyyy...
2008/12/19
[ "https://Stackoverflow.com/questions/382197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26/" ]
382,207
<p>I have tables A and B. Items of table B might exist also in table A, and I want to delete those items. What would the SQL statements to do this look like?</p>
[ { "answer_id": 382216, "author": "HLGEM", "author_id": 9034, "author_profile": "https://Stackoverflow.com/users/9034", "pm_score": 0, "selected": false, "text": "delete a\n--select a.*\nfrom tablea a\njoin tableb b on a.someid = b.someid\n" }, { "answer_id": 382217, "author":...
2008/12/19
[ "https://Stackoverflow.com/questions/382207", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
382,234
<p>I have an integer field in a ClientDataSet and I need to compare to some values, something like this:</p> <p>I can use const</p> <pre><code>const mvValue1 = 1; mvValue2 = 2; if ClientDataSet_Field.AsInteger = mvValue1 then </code></pre> <p>or enums</p> <pre><code>TMyValues = (mvValue1 = 1, mvValue2 = 2); if ClientDataSet_Field.AsInteger = Integer(mvValue1) then </code></pre> <p>or class const</p> <pre><code>TMyValue = class const Value1 = 1; Value2 = 2; end; if ClientDataSet_Field.AsInteger = TMyValues.Value1 then </code></pre> <p>I like the class const approach but it seems that is not the delphi way, So I want to know what do you think</p>
[ { "answer_id": 382277, "author": "X-Ray", "author_id": 14031, "author_profile": "https://Stackoverflow.com/users/14031", "pm_score": 1, "selected": false, "text": "TMyType=class\nprivate const // d2007 & later i think\n iMaxItems=1; // d2007 & later i think\nprivate type // d20...
2008/12/19
[ "https://Stackoverflow.com/questions/382234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24293/" ]
382,256
<p>In Crystal reports, you can define default values for the report parameters.</p> <p>For example, I might have a date range and set a default start of 12/01/2008 and a default end of 12/31/2008.</p> <p>Is it possible to modify these defaults at runtime? For example:</p> <p>1 - Default to the first and last days of the current month?</p> <p>2 - Default to the first and last days of a proprietary company fiscal calendar? (i.e., look it up in a database)</p> <p>3 - First &amp; Last days of the current year?</p> <p>You get the point. Is this possible? I'd even be open to a solution that involved running an external application to reach into the reports and modify them, if anyone knows how to do that.</p> <p>Edit:</p> <p>To answer the question posed by Philippe Grondier, most of these reports are run from inside an application. I was hoping for something simpler than manipulating the crystal object at runtime; I have my hands full right now with figuring out other parts of that API. I might take a look in the future, though.</p>
[ { "answer_id": 382492, "author": "Philippe Grondier", "author_id": 11436, "author_profile": "https://Stackoverflow.com/users/11436", "pm_score": 3, "selected": true, "text": "If m_rapport.ParameterFields.Count > 0 Then\n For i = 1 To m_rapport.ParameterFields.Count\n If m_rappo...
2008/12/19
[ "https://Stackoverflow.com/questions/382256", "https://Stackoverflow.com", "https://Stackoverflow.com/users/672/" ]
382,263
<p>We have 5mb of typical text (just plain words). We have 1000 words/phrases to use as terms to search for in this text. </p> <p>What's the most efficient way to do this in .NET (ideally C#)?</p> <p>Our ideas include regex's (a single one, lots of them) plus even the String.Contains stuff.</p> <p>The input is a 2mb to 5mb text string - all text. Multiple hits are good, as in each term (of the 1000) that matches then we do want to know about it. Performance in terms of entire time to execute, don't care about footprint. Current algorithm gives about 60 seconds+ using naive string.contains. We don't want 'cat' to provide a match with 'category' or even 'cats' (i.e. entire term word must hit, no stemming).</p> <p>We expect a &lt;5% hit ratio in the text. The results would ideally just be the terms that matched (dont need position or frequency just yet). We get a new 2-5mb string every 10 seconds, so can't assume we can index the input. The 1000 terms are dynamic, although have a change rate of about 1 change an hour.</p>
[ { "answer_id": 382329, "author": "Vilx-", "author_id": 41360, "author_profile": "https://Stackoverflow.com/users/41360", "pm_score": 0, "selected": false, "text": "class Word\n{\n string Word;\n List<int> Positions;\n}\n List<Word>" }, { "answer_id": 382451, "author": "...
2008/12/19
[ "https://Stackoverflow.com/questions/382263", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47892/" ]
382,272
<p>I'm using the CPoint class from MFC. There is no explicitly defined assignment operator or copy constructor (AFAIK). Yet, this works:<br></p> <pre> CPoint p1(1, 2), p2; p2 = p1; // p2 now is equal to p1 </pre> <p>I'm assuming this is working automagically because of a compiler generated assignment operator. Correct?</p> <p>If so, can I be confident that this isn't doing anything unexpected? In this case CPoint is so simple I think all is well, but in general this is something that worries me a bit. Is it better form to do:</p> <pre> p2.SetPoint(p1.x, p2.x); </pre> <p>-cr</p>
[ { "answer_id": 382284, "author": "Yuliy", "author_id": 47527, "author_profile": "https://Stackoverflow.com/users/47527", "pm_score": 1, "selected": false, "text": "CPoint" }, { "answer_id": 382347, "author": "Charlie Martin", "author_id": 35092, "author_profile": "htt...
2008/12/19
[ "https://Stackoverflow.com/questions/382272", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47154/" ]
382,301
<p>I've set up a number of accordions on a page using the jquery accordion plugin so I can implement expand all and collapse all functionality.</p> <p>Each ID element is it's own accordion and the code below works to close them all no matter which ones are already open:</p> <pre><code>$("#contact, #address, #email, #sales, #equipment, #notes, #marketingdata") .accordion("activate", -1) ; </code></pre> <p>My problem is with the expand all. When I have them all expand with this code:</p> <pre><code>$("#contact, #address, #email, #sales, #equipment, #notes, #marketingdata") .accordion("activate", 0) ; </code></pre> <p>Some will contract and some will expand based on whether or not they are previously open.</p> <p>My idea to correct this was to collapse them all and then expand them all when the expand all was clicked. This code however won't execute properly:</p> <pre><code>$("#contact, #address, #email, #sales, #equipment, #notes, #marketingdata") .accordion("activate", -1) ; $("#contact, #address, #email, #sales, #equipment, #notes, #marketingdata") .accordion("activate", 0) ; </code></pre> <p>It will only hit the second command and not close them all first. Any suggestions?</p>
[ { "answer_id": 382828, "author": "nickf", "author_id": 9021, "author_profile": "https://Stackoverflow.com/users/9021", "pm_score": 6, "selected": true, "text": "filter() $(\"#contact, #address, #email, #sales, #equipment, #notes, #marketingdata\")\n .filter(\":not(:has(.selected))\")\...
2008/12/19
[ "https://Stackoverflow.com/questions/382301", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47895/" ]
382,307
<p>What is it about this source code that causes it to actually generate a table in IE instead of just doing nothing.</p> <pre><code> function generateATable() { tableContainer = document.getElementById("tableDiv"); var tableElement = document.createElement("table"); // Append the Table Element to the table // container. tableContainer.appendChild(tableElement); // IE Requires a TBODY when dynamically generating // tables. (I thought this was it but apparently it isn't) var tbodyElement = document.createElement("tbody"); // First we'll append the tbody. tableElement.appendChild(tbodyElement); var trElement1 = document.createElement("tr"); // Next we'll append the first trElement to the // tbody. tbodyElement.appendChild(trElement1); var aaCell = trElement1.insertCell(-1); var abCell = trElement1.insertCell(0); var textNodeAA = document.createTextNode("AA"); var textNodeAB = document.createTextNode("AB"); aaCell.appendChild(textNodeAA); abCell.appendChild(textNodeAB); tbodyElement.appendChild(trElement1); var baCell = trElement1.cells[0].cloneNode(false); var bbCell = trElement1.cells[1].cloneNode(false); var textNodeBA = document.createTextNode("BA"); var textNodeBB = document.createTextNode("BB"); trElement2 = trElement1.cloneNode(false); tbodyElement.appendChild(trElement2); baCell.appendChild(textNodeBA); bbCell.appendChild(textNodeBB); trElement2.appendChild(baCell); trElement2.appendChild(bbCell); tableElement.style.border="4px solid black"; } </code></pre> <hr> <p>My apologies...it's a problem with something else...the data that was creating the table wasn't filling in, votes back up for everyone...sorry!...</p>
[ { "answer_id": 382313, "author": "Yuliy", "author_id": 47527, "author_profile": "https://Stackoverflow.com/users/47527", "pm_score": 3, "selected": false, "text": " tableContainer = document.getElementById(\"tableDiv\");\n var tableElement = document...
2008/12/19
[ "https://Stackoverflow.com/questions/382307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18149/" ]
382,309
<p>I am trying to create a column in a table that's a foreign key, but in MySQL that's more difficult than it should be. It would require me to go back and make certain changes to an already-in-use table. So I wonder, <strong>how necessary is it for MySQL to be sure that a certain value is appropriate? Couldn't I just do that with a language like PHP, which I'm using to access this database <em>anyway</em>?</strong></p> <p>Similarly with NOT NULL. If I only access this database with PHP, couldn't I simply have PHP ensure that no null value is entered?</p> <p><strong>Why should I use MySQL to do enforce these constraints, when I could just do it with PHP?</strong></p> <hr> <p>I realize that NOT NULL is a very stupid part to neglect for the above reasons. But MySQL doesn't enforce foreign keys without a serious degree of monkeying around.</p> <p>In your opinion, would it still be bad to use the "fake" foreign keys, and simply check if the values to be entered are matched in other tables, with PHP?</p>
[ { "answer_id": 385619, "author": "staticsan", "author_id": 28832, "author_profile": "https://Stackoverflow.com/users/28832", "pm_score": 0, "selected": false, "text": "innodb_flush_log_at_tx_commit" } ]
2008/12/19
[ "https://Stackoverflow.com/questions/382309", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1615/" ]
382,317
<p>I have an application that starts a Swing gui using java web start. The user has 4 versions of java 1.6 installed (1.6.0.3, 1.6.0.5, 1.6.0.7. 1.6.0.11) </p> <p>Webstart is selecting java version 1.6.0.11 but JAVA_HOME is set to java version 1.6.0.3. Could this cause any potential problems for webstart? </p> <ul> <li>rich</li> </ul>
[ { "answer_id": 383287, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 3, "selected": true, "text": "C:\\Documents and Settings\\[User]\\Application Data\\Sun\\Java\\Deployment\\deployment.properties\n(for Windows XP)\n\nC:\\User...
2008/12/19
[ "https://Stackoverflow.com/questions/382317", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47508/" ]
382,336
<p>Does anyone know of a good example on how to set up log4net to use the system.data.sqlite provider? </p> <p>I've been playing around with it lately and I thought I had it all working. It makes a successful connection to the database and "writes" it out. However, when I look at the table data, it never actually commits the log.</p>
[ { "answer_id": 1369405, "author": "Pieter Breed", "author_id": 24172, "author_profile": "https://Stackoverflow.com/users/24172", "pm_score": 4, "selected": false, "text": "<Reference Include=\"log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitect...
2008/12/19
[ "https://Stackoverflow.com/questions/382336", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
382,344
<p>I have a service that I am rewriting to use threading. I understand that state from one thread should not be accessed by another, but I'm a little confused by what constitutes 'state'. Does that mean <em>any</em> field/property/method outside of the method scope?</p> <p>Specifically, my service looks something like this:</p> <pre><code>public class MyService { private IRepository&lt;MyClass&gt; repository; private ILogger log; ... public void MyMethod() { ... var t = new Thread(MyMethodAsync); t.Start(someState); } //Is this OK??? public void MyMethodAsync(object state) { var someState = (MyState)state; log.Log("Starting"); var someData = repository.GetSomeData(someState.Property); //process data log.Log("Done"); } //Or should I be doing this: public void MyMethodAsync2(object state) { var someState = (MyState)state; lock(log){ log.Log("Starting"); } lock(repository){ var someData = repository.GetSomeData(someState.Property);} //process data lock(log){ log.Log("Done"); } } } </code></pre>
[ { "answer_id": 382393, "author": "BenAlabaster", "author_id": 40650, "author_profile": "https://Stackoverflow.com/users/40650", "pm_score": 3, "selected": true, "text": "SyncLock MyQueue\n If MyQueue.Length = 0 Then\n PauseFlag.Reset\n End If\nEnd SyncLock\n" } ]
2008/12/19
[ "https://Stackoverflow.com/questions/382344", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47225/" ]
382,358
<p>Lets say that I have a header user control in a master page, and want to change a property of the user control depending on what content page is loaded inside of the master page. How might I go about this?</p> <p>Thanks!</p>
[ { "answer_id": 382398, "author": "Shawn", "author_id": 26, "author_profile": "https://Stackoverflow.com/users/26", "pm_score": 5, "selected": true, "text": "Page.Master.FindControl('controlID') <%@ MasterType VirtualPath=\"\"> <%@ MasterType TypeName=\"\"%> VirtualPath TypeName" }, {...
2008/12/19
[ "https://Stackoverflow.com/questions/382358", "https://Stackoverflow.com", "https://Stackoverflow.com/users/396/" ]
382,361
<p>I am working on a project currently where there are SQL strings in the code that are around 3000 lines.</p> <p>The project is a java project, but this question could probably apply for any language.</p> <p>Anyway, this is the first time I have ever seen something this bad. The code base is legacy, so we can suddenly migrate to Hibernate or something like that.</p> <p>How do you handle very large SQL strings like that?</p> <p>I know its bad, but I don't know exactly what is the best thing to suggest for a solution.</p>
[ { "answer_id": 382380, "author": "stalepretzel", "author_id": 1615, "author_profile": "https://Stackoverflow.com/users/1615", "pm_score": 1, "selected": false, "text": "$query = \"SELECT * FROM table WHERE \";\n$query .= \"condition < 5 AND \";\n$query .= \"condition2 > 10 AND \";\n $que...
2008/12/19
[ "https://Stackoverflow.com/questions/382361", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45365/" ]