qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
243,494
<p>I have some legacy code that uses VBA to parse a word document and build some XML output; </p> <p>Needless to say it runs like a dog but I was interested in profiling it to see where it's breaking down and maybe if there are some options to make it faster.</p> <p>I don't want to try anything until I can start measuring my results so profiling is a must - I've done a little searching around but can't find anything that would do this job easily. There was one tool by brentwood? that requires modifying your code but it didn't work and I ran outa time.</p> <p>Anyone know anything simple that works?</p> <p>Update: The code base is about 20 or so files, each with at least 100 methods - manually adding in start/end calls for each method just isn't appropriate - especially removing them all afterwards - I was actually thinking about doing some form of REGEX to solve this issue and another to remove them all after but its just a little too intrusive but may be the only solution. I've found some nice timing code on here earlier so the timing part of it isn't an issue.</p>
[ { "answer_id": 243545, "author": "Svante Svenson", "author_id": 19707, "author_profile": "https://Stackoverflow.com/users/19707", "pm_score": 0, "selected": false, "text": "Debug.Print \"before/after foo\", Now\n" }, { "answer_id": 244103, "author": "Aardvark", "author_id...
2008/10/28
[ "https://Stackoverflow.com/questions/243494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24525/" ]
243,504
<p>How would one go about capturing users keystrokes in the SMS composer on the Symbian OS, specifically for a Nokia N73 (or any of the symbian supported devices <a href="http://en.wikipedia.org/wiki/Symbian_OS#Devices_that_have_used_the_Symbian_OS" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Symbian_OS#Devices_that_have_used_the_Symbian_OS</a>)? I'm new to symbian development and I'm trying to write an application to analyse writing styles of those who send SMSs. Any information (or push in the right direction) would be great.</p> <p>Many Thanks,</p> <p>A</p>
[ { "answer_id": 286611, "author": "KevinD", "author_id": 26497, "author_profile": "https://Stackoverflow.com/users/26497", "pm_score": 3, "selected": true, "text": "RWindowGroup::CaptureKey()" } ]
2008/10/28
[ "https://Stackoverflow.com/questions/243504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/368855/" ]
243,510
<p>Does anyone know what is wrong with this query?</p> <pre><code> SELECT DISTINCT c.CN as ClaimNumber, a.ItemDate as BillReceivedDate, c.DTN as DocTrackNumber FROM ItemData a, ItemDataPage b, KeyGroupData c WHERE a.ItemTypeNum in (112, 113, 116, 172, 189) AND a.ItemNum = b.ItemNum AND b.ItemNum = c.ItemNum ORDER BY a.DateStored DESC; </code></pre> <p>I have done T-Sql most of my career and this looks correct to me, however this query is for an Oracle database and Toad just places the cursor on the a.DateStored in the Order By section. I'm sure this is elementary for anyone doing PL/SQL.</p> <p>Thanks!</p> <p>[EDIT] For future reference, the error given by SQL*Plus was: "ORA-01791: not a SELECTed expression" </p>
[ { "answer_id": 243520, "author": "Chris Conway", "author_id": 2849, "author_profile": "https://Stackoverflow.com/users/2849", "pm_score": 2, "selected": false, "text": " SELECT DISTINCT c.CN as ClaimNumber, \na.ItemDate as BillReceivedDate, \nc.DTN as DocTrackNumber, \na.Date...
2008/10/28
[ "https://Stackoverflow.com/questions/243510", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2849/" ]
243,528
<p>We're looking at using Oracle Hierarchical queries to model potentially very large tree structures (potentially infinitely wide, and depth of 30+). My understanding is that hierarchal queries provide a method to write recursively joining SQL but they it does not provide any real performance enhancements over if you were to manually write an equivalent query... is this the case? What sort of experiences have people had, performance wise, with using oracle hierarchical queries?</p>
[ { "answer_id": 245156, "author": "dacracot", "author_id": 13930, "author_profile": "https://Stackoverflow.com/users/13930", "pm_score": 1, "selected": false, "text": "CREATE TABLE\n loopy\n (key NUMBER, key_hier number, info VARCHAR2, part NUMBER)\nPARTITION BY\n RANGE (part)\n ...
2008/10/28
[ "https://Stackoverflow.com/questions/243528", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9155/" ]
243,553
<p>How can I find out which row in a JTable the user just clicked?</p>
[ { "answer_id": 243560, "author": "Paul Tomblin", "author_id": 3333, "author_profile": "https://Stackoverflow.com/users/3333", "pm_score": 6, "selected": true, "text": "aJTable.rowAtPoint(evt.getPoint());" }, { "answer_id": 245005, "author": "oxbow_lakes", "author_id": 168...
2008/10/28
[ "https://Stackoverflow.com/questions/243553", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24028/" ]
243,554
<p>I'm currently creating a window system for XNA games from scratch. I'm developing primarily for Windows, but who knows what platforms I might support in the future. Feel free to answer if you know this for native Direct3D, since the performance semantics should be similar. If possible, consider what would change if the target platform was X-Box 360.</p> <p>I'm making good progress, but now I am unsure on how to exactly render the windows. I came up with four approaches:</p> <ul> <li><p>Just render all controls directly onto the screen. This is what I do now. Controls can be animated by blending between states as long as they are not semi-transparent. I did not find a good way to animate between an arbitrary number of states (suppose a button that is currently animating from button-up to button-down and from mouse-out to mouse-over, and then it is being disabled. It should smoothly blend from its last state to the new state. With this approach, this only works if one animation is played after the last one finished, or you'll have jumps in animation.</p></li> <li><p>Render each top-level window and all controls into a render target, and then use that to render the top-level windows with semi-transparency onto the screen. This makes semi-transparency at top-level work and is easy to manage, but doesn't change the thing with the animations.</p></li> <li><p>Render each control into a render target, which is only updated when the control becomes dirty (i.e. must animate or the text has been changed). This way, per-control semi-transparency would work.</p></li> <li><p>Like the previous, but in addition to solve the animation problem have a second render target for each control. Whenever an animation starts, swap render targets, so we have the state when the animation starts, and blend it with the destination state into the other render target. This should not add overhead over the previous approach, we just had twice as many render targets, of which in any given frame only one would be rendered to (at maximum). But here comes the problem: For this to work, I would need to have the "old" render target preserve its contents. This should work with good performance on Windows, but appears to have a serious performance impact on X-Box 360. On the other hand, the "preserve" bit is only necessary while an animation is active.</p></li> </ul> <p>And here come the actual questions. Anything that clarifies is welcome. With the performance questions, remember that this would just be the window system of a game - the game behind might use many render targets and suck up performance as well, and likely much more than the window system. Assume that we might have five top-level windows with 20-40 controls each on the screen in absolute worst-case.</p> <ul> <li>Which of these approaches, if any, would you recommend and why? Feel free, of course, to add another approach.</li> <li>Is there a performance impact when just having let's say 200 or 400 render targets available, provided that only maybe 20 of them are being rendered to each frame?</li> <li>Is the performance impact of PreserveContents really that bad on X-Box 360? How bad is it on Windows?</li> <li>The RenderTarget2D.RenderTargetUsage property can be written to. Is switching this at runtime a good idea, to enable PreserveContents only as needed?</li> <li>Would you (as a player) mind if control animations would jump in certain situations, like hovering over a button, moving the mouse out and then in again, so the "normal->hover" animation is played twice from the beginning because it is slower than you?</li> </ul>
[ { "answer_id": 1133845, "author": "Jodi", "author_id": 127081, "author_profile": "https://Stackoverflow.com/users/127081", "pm_score": 2, "selected": false, "text": "size (bits) = width x height x color data size (bits)\n" } ]
2008/10/28
[ "https://Stackoverflow.com/questions/243554", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20363/" ]
243,567
<p>The database type is PostGres 8.3.</p> <p>If I wrote: </p> <pre><code>SELECT field1, field2, field3, count(*) FROM table1 GROUP BY field1, field2, field3 having count(*) &gt; 1; </code></pre> <p>I have some rows that have a count over 1. How can I take out the duplicate (I do still want 1 row for each of them instead of +1 row... I do not want to delete them all.)</p> <p>Example:</p> <pre><code>1-2-3 1-2-3 1-2-3 2-3-4 4-5-6 </code></pre> <p>Should become :</p> <pre><code>1-2-3 2-3-4 4-5-6 </code></pre> <p><em>The only answer I found is <a href="http://www.siafoo.net/article/64" rel="noreferrer">there</a> but I am wondering if I could do it without hash column.</em></p> <p><strong>Warning</strong> I do not have a PK with an unique number so I can't use the technique of min(...). The PK is the 3 fields.</p>
[ { "answer_id": 243627, "author": "Jonathan Leffler", "author_id": 15168, "author_profile": "https://Stackoverflow.com/users/15168", "pm_score": 0, "selected": false, "text": "CREATE <temporary table> (<correct structure for table being cleaned>);\nBEGIN WORK; -- if needed\nINSERT INTO ...
2008/10/28
[ "https://Stackoverflow.com/questions/243567", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13913/" ]
243,568
<p>I found in a bug in an old C++ MFC program we have that calculates an offset (in days) for a given date from a fixed base date. We were seeing results that were off by one for some reason, and I tracked it down to where the original programmer had used the CTimeSpan.GetDays() method. According to the <a href="http://msdn.microsoft.com/en-us/library/14zezc9x.aspx" rel="nofollow noreferrer">documentation</a>:</p> <blockquote> <p>Note that Daylight Savings Time can cause GetDays to return a potentially surprising result. For example, when DST is in effect, GetDays reports the number of days between April 1 and May 1 as 29, not 30, because one day in April is shortened by an hour and therefore does not count as a complete day.</p> </blockquote> <p>My proposed fix is to use <code>(obj.GetTotalHours()+1)/24</code> instead. I think that would cover all the issues since this is a batch job that runs at about the same time every day, but I thought I'd ask the smart people here before implementing it if there might be a better way. </p> <p>This is just a side issue, but I'm also curious how this would be handled if the program could be run at any time.</p>
[ { "answer_id": 243841, "author": "Mark Ransom", "author_id": 5987, "author_profile": "https://Stackoverflow.com/users/5987", "pm_score": 3, "selected": true, "text": "CTime startDay(start.GetYear(), start.GetMonth(), start.GetDay(), 0, 0, 0);\nCTime finishDay(finish.GetYear(), finish.Get...
2008/10/28
[ "https://Stackoverflow.com/questions/243568", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3043/" ]
243,569
<p>consider this code block</p> <pre><code>public void ManageInstalledComponentsUpdate() { IUpdateView view = new UpdaterForm(); BackgroundWorker worker = new BackgroundWorker(); Update update = new Update(); worker.WorkerReportsProgress = true; worker.WorkerSupportsCancellation = true; worker.DoWork += new DoWorkEventHandler(update.DoUpdate); worker.ProgressChanged += new ProgressChangedEventHandler(view.ProgressCallback); worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(view.CompletionCallback); worker.RunWorkerAsync(); Application.Run(view as UpdaterForm); } </code></pre> <p>It all works great but I want to understand why the objects (worker,view and update) don't get garbage collected</p>
[ { "answer_id": 243600, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 4, "selected": true, "text": "using System;\nusing System.ComponentModel;\nusing System.Threading;\nusing System.Windows.Forms;\nclass Demo : Form\n...
2008/10/28
[ "https://Stackoverflow.com/questions/243569", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30324/" ]
243,572
<p>I am configure log4net to use a composite RollingFileAppender so that the current file is always named <strong>logfile.log</strong> and all subsequent files are named <strong>logfile-YYYY.MM.dd.seq.log</strong> where <strong>seq</strong> is the sequence number if a log exceeds a certain size within a single day. Unfortunately, I have had very little success in configuring such a setup. </p> <p><strong>Edit:</strong></p> <p>My current configuration is pasted below. It has been updated based on several answers which gets me close enough for my needs. This generates files of the format: <strong>logfile_YYYY.MM.dd.log.seq</strong></p> <pre><code>&lt;log4net&gt; &lt;root&gt; &lt;level value="DEBUG" /&gt; &lt;appender-ref ref="RollingFileAppender" /&gt; &lt;/root&gt; &lt;appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender"&gt; &lt;file value="logs\\logfile"/&gt; &lt;staticLogFileName value="false"/&gt; &lt;appendToFile value="true"/&gt; &lt;rollingStyle value="Composite"/&gt; &lt;datePattern value="_yyyy.MM.dd&amp;quot;.log&amp;quot;"/&gt; &lt;maxSizeRollBackups value="10"/&gt; &lt;maximumFileSize value="75KB"/&gt; &lt;layout type="log4net.Layout.PatternLayout"&gt; &lt;conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline"/&gt; &lt;/layout&gt; &lt;filter type="log4net.Filter.LevelRangeFilter"&gt; &lt;param name="LevelMin" value="DEBUG" /&gt; &lt;param name="LevelMax" value="FATAL" /&gt; &lt;/filter&gt; &lt;/appender&gt; &lt;/log4net&gt; </code></pre> <p>One interesting note, setting</p> <pre><code>&lt;staticLogFileName value="false"/&gt; </code></pre> <p>to true causes the logger to not write any files.</p>
[ { "answer_id": 243607, "author": "Leandro López", "author_id": 22695, "author_profile": "https://Stackoverflow.com/users/22695", "pm_score": 2, "selected": false, "text": "protected string GetNextOutputFileName(string fileName)\n{\n if (!m_staticLogFileName) \n {\n fileName ...
2008/10/28
[ "https://Stackoverflow.com/questions/243572", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19977/" ]
243,617
<p>I have a Java based web-application and a new requirement to allow Users to place variables into text fields that are replaced when a document or other output is produced. How have others gone about this?</p> <p>I was thinking of having a pre-defined set of variables such as :<br> <code>@BOOKING_NUMBER@</code><br> <code>@INVOICE_NUMBER@</code> </p> <p>Then when a user enters some text they can specify a variable inline (select it from a modal or similar). For example:</p> <p><em>"This is some text for Booking <code>@BOOKING_NUMBER@</code> that is needed by me"</em> </p> <p>When producing some output (eg. PDF) that uses this text, I would do a regex and find all variables and replace them with the correct value: </p> <p><em>"This is some text for Booking 10001 that is needed by me"</em> </p> <p>My initial thought was something like Freemarker but I think that is too complex for my Users and would require them to know my DataModel (eww).</p> <p>Thanks for reading!</p> <p>D.</p>
[ { "answer_id": 243781, "author": "belugabob", "author_id": 13397, "author_profile": "https://Stackoverflow.com/users/13397", "pm_score": 2, "selected": false, "text": "MessageFormat.format(\"This is some text for booking {0} that is needed by me, for use with invoice {1}\", bookingNumber...
2008/10/28
[ "https://Stackoverflow.com/questions/243617", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2955/" ]
243,644
<p>I have currently more than 100 connections in Sleep state.</p> <p>Some connection must stay in Sleep state (and don't close) because it's permanent connection but some others (with a different user name) are from some php script and I want them to timeout very fast.</p> <p>Is it possible to setup a wait_timeout per user? and if yes, How?</p>
[ { "answer_id": 244291, "author": "Gary Richardson", "author_id": 2506, "author_profile": "https://Stackoverflow.com/users/2506", "pm_score": 0, "selected": false, "text": "mysql.user" }, { "answer_id": 244744, "author": "Bill Karwin", "author_id": 20860, "author_profi...
2008/10/28
[ "https://Stackoverflow.com/questions/243644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6605/" ]
243,646
<p>I've got an <code>RSA</code> private key in <code>PEM</code> format, is there a straight forward way to read that from .NET and instantiate an <code>RSACryptoServiceProvider</code> to decrypt data encrypted with the corresponding public key?</p>
[ { "answer_id": 243685, "author": "wprl", "author_id": 17847, "author_profile": "https://Stackoverflow.com/users/17847", "pm_score": 5, "selected": false, "text": "//------- Parses binary ans.1 RSA private key; returns RSACryptoServiceProvider ---\npublic static RSACryptoServiceProvider ...
2008/10/28
[ "https://Stackoverflow.com/questions/243646", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32093/" ]
243,683
<p>How do I extract the value of a property in a PropertyCollection?</p> <p>If I drill down on the 'Properties' in the line below is visual studion I can see the value but how do I read it?</p> <pre><code>foreach (string propertyName in result.Properties.PropertyNames) { MessageBox.Show(ProperyNames[0].Value.ToString()); &lt;--Wrong! } </code></pre>
[ { "answer_id": 243703, "author": "steve", "author_id": 32103, "author_profile": "https://Stackoverflow.com/users/32103", "pm_score": -1, "selected": false, "text": "foreach (string propertyName in result.Properties.PropertyNames)\n{ MessageBox.Show(properyName.ToString()); <--Wrong!\n}\...
2008/10/28
[ "https://Stackoverflow.com/questions/243683", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
243,691
<p>[Error] WARNING. Duplicate resource(s): [Error] Type 2 (BITMAP), ID TWWDBRICHEDITMSWORD: [Error] File C:\Borland\Delphi7\ip4000vcl7\LIB\wwrichsp.RES resource kept; file C:\Borland\Delphi7\ip4000vcl7\LIB\wwrichsp.RES resource discarded. I have searched the code for same named objects, like objects. Can anyone give me a clue what else I can look for. </p>
[ { "answer_id": 243890, "author": "Lars Truijens", "author_id": 1242, "author_profile": "https://Stackoverflow.com/users/1242", "pm_score": 2, "selected": false, "text": "{$R wwrichsp.RES}\n" } ]
2008/10/28
[ "https://Stackoverflow.com/questions/243691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
243,696
<p>MathWorks currently doesn't allow you to use <code>cout</code> from a mex file when the MATLAB desktop is open because they have redirected stdout. Their current workaround is providing a function, <a href="http://www.mathworks.com/support/tech-notes/1600/1605.html" rel="nofollow noreferrer">mexPrintf, that they request you use instead</a>. After googling around a bit, I think that it's possible to extend the <code>std::stringbuf</code> class to do what I need. Here's what I have so far. Is this robust enough, or are there other methods I need to overload or a better way to do this? (Looking for portability in a general UNIX environment and the ability to use <code>std::cout</code> as normal if this code is not linked against a mex executable)</p> <pre><code>class mstream : public stringbuf { public: virtual streamsize xsputn(const char *s, std::streamsize n) { mexPrintf("*s",s,n); return basic_streambuf&lt;char, std::char_traits&lt;char&gt;&gt;::xsputn(s,n); } }; mstream mout; outbuf = cout.rdbuf(mout.rdbuf()); </code></pre>
[ { "answer_id": 244286, "author": "Max Lybbert", "author_id": 10593, "author_profile": "https://Stackoverflow.com/users/10593", "pm_score": 0, "selected": false, "text": "cout" }, { "answer_id": 244584, "author": "Shane Powell", "author_id": 23235, "author_profile": "h...
2008/10/28
[ "https://Stackoverflow.com/questions/243696", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27315/" ]
243,701
<p>I'd like to check a few queries generated by ActiveRecord, but I don't need to actually run them. Is there a way to get at the query before it returns its result?</p>
[ { "answer_id": 243934, "author": "Gene T", "author_id": 413049, "author_profile": "https://Stackoverflow.com/users/413049", "pm_score": 2, "selected": false, "text": "construct_finder_sql,\n" }, { "answer_id": 1634280, "author": "gtd", "author_id": 8376, "author_profi...
2008/10/28
[ "https://Stackoverflow.com/questions/243701", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1190/" ]
243,712
<p>Hey! I was looking at this code at <a href="http://www.gnu.org/software/m68hc11/examples/primes_8c-source.html" rel="noreferrer">http://www.gnu.org/software/m68hc11/examples/primes_8c-source.html</a></p> <p>I noticed that in some situations they used hex numbers, like in line 134:</p> <pre><code>for (j = 1; val &amp;&amp; j &lt;= 0x80; j &lt;&lt;= 1, q++) </code></pre> <p>Now why would they use the 0x80? I am not that good with hex but I found an online hex to decimal and it gave me 128 for 0x80.</p> <p>Also before line 134, on line 114 they have this:</p> <pre><code>small_n = (n &amp; 0xffff0000) == 0; </code></pre> <p>The hex to decimal gave me 4294901760 for that hex number. So here in this line they are making a bit AND and comparing the result to 0??</p> <p>Why not just use the number? Can anyone please explain and please do give examples of other situations.</p> <p>Also I have seen large lines of code where it's just hex numbers and never really understood why :(</p>
[ { "answer_id": 243727, "author": "James Curran", "author_id": 12725, "author_profile": "https://Stackoverflow.com/users/12725", "pm_score": 8, "selected": true, "text": "j" }, { "answer_id": 243729, "author": "Jimmy", "author_id": 4435, "author_profile": "https://Stac...
2008/10/28
[ "https://Stackoverflow.com/questions/243712", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8715/" ]
243,728
<p>I got dtd in file and I cant remove it. When i try to parse it in Java I get "Caused by: java.net.SocketException: Network is unreachable: connect", because its remote dtd. can I disable somehow dtd checking?</p>
[ { "answer_id": 243747, "author": "toolkit", "author_id": 3295, "author_profile": "https://Stackoverflow.com/users/3295", "pm_score": 5, "selected": true, "text": "<?xml version=\"1.0\"?>\n<!DOCTYPE foo PUBLIC \"//FOO//\" \"foo.dtd\">\n<foo>\n <bar>Value</bar>\n</foo>\n" }, { "...
2008/10/28
[ "https://Stackoverflow.com/questions/243728", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30453/" ]
243,734
<p>I am trying to compile a labview CIN using visual studio 2003.</p> <p>I have followed the tutorial located <a href="http://zone.ni.com/devzone/cda/tut/p/id/3172" rel="nofollow noreferrer">here</a> to the letter, but am getting the following error:</p> <blockquote> <p>Project : error PRJ0019: A tool returned an error code from "Performing Custom Build Step"</p> </blockquote> <p>Does anyone know what is causing this? I tried this <a href="http://detritus.blogs.com/lycangeek/2006/03/building_cins_w.html" rel="nofollow noreferrer">link</a> found at an expert's exchange <a href="http://www.experts-exchange.com/Microsoft/Development/.NET/Visual_CPP/Q_23144843.html" rel="nofollow noreferrer">question</a> but it does not seem relevant.</p> <p>Is there an easier way to build a CIN using visual studio?</p>
[ { "answer_id": 243762, "author": "Tim", "author_id": 10755, "author_profile": "https://Stackoverflow.com/users/10755", "pm_score": 0, "selected": false, "text": "\"$(CINTOOLS_DIR)\\lvsbutil\" \"$(TargetName)\" -d \"$(ProjectDir)$(OutDir)\"\n" } ]
2008/10/28
[ "https://Stackoverflow.com/questions/243734", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1555/" ]
243,750
<p>I've searched around a bit for similar questions, but other than running one command or perhaps a few command with items such as:</p> <pre><code>ssh user@host -t sudo su - </code></pre> <p>However, what if I essentially need to run a script on (let's say) 15 servers at once. Is this doable in bash? In a perfect world I need to avoid installing applications if at all possible to pull this off. For argument's sake, let's just say that I need to do the following across 10 hosts:</p> <ol> <li>Deploy a new Tomcat container</li> <li>Deploy an application in the container, and configure it</li> <li>Configure an Apache vhost</li> <li>Reload Apache</li> </ol> <p>I have a script that does all of that, but it relies on me logging into all the servers, pulling a script down from a repo, and then running it. If this isn't doable in bash, what alternatives do you suggest? Do I need a bigger hammer, such as Perl (Python might be preferred since I can guarantee Python is on all boxes in a RHEL environment thanks to yum/up2date)? If anyone can point to me to any useful information it'd be greatly appreciated, especially if it's doable in bash. I'll settle for Perl or Python, but I just don't know those as well (working on that). Thanks!</p>
[ { "answer_id": 243803, "author": "antik", "author_id": 1625, "author_profile": "https://Stackoverflow.com/users/1625", "pm_score": 3, "selected": false, "text": "man expect" }, { "answer_id": 243818, "author": "Yang Zhao", "author_id": 31095, "author_profile": "https:...
2008/10/28
[ "https://Stackoverflow.com/questions/243750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14838/" ]
243,752
<p>Is there a way to do this without iterating through the List and adding the items to the ObservableCollection?</p>
[ { "answer_id": 243766, "author": "Nescio", "author_id": 14484, "author_profile": "https://Stackoverflow.com/users/14484", "pm_score": 6, "selected": true, "text": "Dim list as new List(of string)\n...some stuff to fill the list...\nDim observable as new ObservableCollection(of string)(li...
2008/10/28
[ "https://Stackoverflow.com/questions/243752", "https://Stackoverflow.com", "https://Stackoverflow.com/users/132931/" ]
243,777
<p>do you know any not strict xpath for java? (I want it to not check dtd and schema) and it would be cool if it dont care about correct xml.</p>
[ { "answer_id": 243866, "author": "David M. Karr", "author_id": 10508, "author_profile": "https://Stackoverflow.com/users/10508", "pm_score": 0, "selected": false, "text": "/*[local-name()='foo']/*[local-name()='bar']\n" } ]
2008/10/28
[ "https://Stackoverflow.com/questions/243777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30453/" ]
243,782
<p>I'm trying to select a column from a single table (no joins) and I need the count of the number of rows, ideally before I begin retrieving the rows. I have come to two approaches that provide the information I need.</p> <p><strong>Approach 1:</strong></p> <pre><code>SELECT COUNT( my_table.my_col ) AS row_count FROM my_table WHERE my_table.foo = 'bar' </code></pre> <p>Then</p> <pre><code>SELECT my_table.my_col FROM my_table WHERE my_table.foo = 'bar' </code></pre> <p>Or <strong>Approach 2</strong></p> <pre><code>SELECT my_table.my_col, ( SELECT COUNT ( my_table.my_col ) FROM my_table WHERE my_table.foo = 'bar' ) AS row_count FROM my_table WHERE my_table.foo = 'bar' </code></pre> <p>I am doing this because my SQL driver (SQL Native Client 9.0) does not allow me to use SQLRowCount on a SELECT statement but I need to know the number of rows in my result in order to allocate an array before assigning information to it. The use of a dynamically allocated container is, unfortunately, not an option in this area of my program.</p> <p>I am concerned that the following scenario might occur:</p> <ul> <li>SELECT for count occurs</li> <li>Another instruction occurs, adding or removing a row</li> <li>SELECT for data occurs and suddenly the array is the wrong size.<br> -In the worse case, this will attempt to write data beyond the arrays limits and crash my program.</li> </ul> <p>Does Approach 2 prohibit this issue?</p> <p>Also, Will one of the two approaches be faster? If so, which?</p> <p>Finally, is there a better approach that I should consider (perhaps a way to instruct the driver to return the number of rows in a SELECT result using SQLRowCount?)</p> <p>For those that asked, I am using Native C++ with the aforementioned SQL driver (provided by Microsoft.)</p>
[ { "answer_id": 243963, "author": "JosephStyons", "author_id": 672, "author_profile": "https://Stackoverflow.com/users/672", "pm_score": 2, "selected": false, "text": "SELECT \n mt.my_row,\n (SELECT COUNT(mt2.my_row) FROM my_table mt2 WHERE mt2.foo = mt.foo) as cnt\nFROM my_table mt\nWHE...
2008/10/28
[ "https://Stackoverflow.com/questions/243782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1625/" ]
243,790
<p>I have this table in an Oracle DB which has a primary key defined on 3 of the data columns. I want to drop the primary key constraint to allow rows with duplicate data for those columns, and create a new column, 'id', to contain an auto-incrementing integer ID for these rows. I know how to create a sequence and trigger to add an auto-incrementing ID for new rows added to the table, but is it possible to write a PL/SQL statement to add unique IDs to all the rows that are already in the table?</p>
[ { "answer_id": 243838, "author": "Steve", "author_id": 15470, "author_profile": "https://Stackoverflow.com/users/15470", "pm_score": 2, "selected": false, "text": "update\ntable\nset id = rownum\n" }, { "answer_id": 244080, "author": "Tony Andrews", "author_id": 18747, ...
2008/10/28
[ "https://Stackoverflow.com/questions/243790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3101/" ]
243,794
<p>I'm using the latest version of the <a href="https://jqueryui.com/tabs/" rel="nofollow noreferrer">jQuery UI tabs</a>. I have tabs positioned toward the bottom of the page. </p> <p>Every time I click a tab, the screen jumps toward the top.</p> <p>How can I prevent this from happening?</p> <p>Please see this example:</p> <p><a href="http://5bosses.com/examples/tabs/sample_tabs.html" rel="nofollow noreferrer">http://5bosses.com/examples/tabs/sample_tabs.html</a></p>
[ { "answer_id": 243832, "author": "changelog", "author_id": 5646, "author_profile": "https://Stackoverflow.com/users/5646", "pm_score": 4, "selected": false, "text": "<a href=\"#\" onclick=\"activateTab('tab1');\">Tab 1</a>" }, { "answer_id": 244622, "author": "Edward", "a...
2008/10/28
[ "https://Stackoverflow.com/questions/243794", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31869/" ]
243,800
<p><strong>The Situation</strong></p> <p>I have an area of the screen that can be shown and hidden via JavaScript (something like "show/hide advanced search options"). Inside this area there are form elements (select, checkbox, etc). For users using assistive technology like a screen-reader (in this case JAWS), we need to link these form elements with a label or use the "title" attribute to describe the purpose of each element. I'm using the title attribute because there isn't enough space for a label, and the tooltip you get is nice for non-screen-reader users.</p> <p>The code looks something like this:</p> <pre><code>&lt;div id="placeholder" style="display:none;"&gt; &lt;select title="Month"&gt; &lt;option&gt;January&lt;/option&gt; &lt;option&gt;February&lt;/option&gt; ... &lt;/select&gt; &lt;/div&gt; </code></pre> <p><strong>The Problem</strong></p> <p>Normally, JAWS will not read hidden elements... because well, they're hidden and it knows that. However, it seems as though if the element has a title set, JAWS reads it no matter what. If I remove the title, JAWS reads nothing, but obviously this is in-accessible markup.</p> <p><strong>Possible Solutions</strong></p> <p>My first thought was to use a hidden label instead of the title, like this:</p> <pre><code>&lt;div id="placeholder" style="display:none;"&gt; &lt;label for="month" style="display:none"&gt;Month&lt;/label&gt; &lt;select id="month"&gt;...&lt;/select&gt; &lt;/div&gt; </code></pre> <p>This results in the exact same behavior, and now we lose the tool-tips for non-screen-reader users. Also we end up generating twice as much Html.</p> <p>The second option is to still use a label, put position it off the screen. That way it will be read by the screen-reader, but won't be seen by the visual user:</p> <pre><code>&lt;div id="placeholder" style="display:none;"&gt; &lt;label for="month" style="position:absolute;left:-5000px:width:1px;"&gt;Month&lt;/label&gt; &lt;select id="month"&gt;...&lt;/select&gt; &lt;/div&gt; </code></pre> <p>This actually works, but again we lose the tool-tip and still generate additional Html.</p> <p>My third possible solution is to recursively travel through the DOM in JavaScript, removing the title when the area is hidden and adding it back when the area is shown. This also works... but is pretty ugly for obvious reasons and doesn't really scale well to a more general case.</p> <p>Any other ideas anyone? Why is JAWS behaving this way?</p>
[ { "answer_id": 29660365, "author": "Noah Herron", "author_id": 2612003, "author_profile": "https://Stackoverflow.com/users/2612003", "pm_score": 0, "selected": false, "text": "<div id=\"placeholder\" style=\"display:none;\">\n <select title=\"Month\" style=\"speak:none;\">\n <option>...
2008/10/28
[ "https://Stackoverflow.com/questions/243800", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9960/" ]
243,811
<p>Looking through some code I came across the following code</p> <pre><code>trTuDocPackTypdBd.update(TrTuDocPackTypeDto.class.cast(packDto)); </code></pre> <p>and I'd like to know if casting this way has any advantages over </p> <pre><code>trTuDocPackTypdBd.update((TrTuDocPackTypeDto)packDto); </code></pre> <p>I've asked the developer responsible and he said he used it because it was new (which doesn't seem like a particularly good reason to me), but I'm intrigued when I would want to use the method.</p>
[ { "answer_id": 243835, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 2, "selected": false, "text": "T" }, { "answer_id": 243862, "author": "erickson", "author_id": 3474, "author_profile": "https://Sta...
2008/10/28
[ "https://Stackoverflow.com/questions/243811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4389/" ]
243,814
<p>I am attempting to deploy .NET 2.0 web services on IIS that has both 1.0 and 2.0 installed. This web server primarily serves a large .NET 1.0 application. </p> <p>I have copied by .NET 2.0 web service project to the server and have created a virtual directory to point to the necessary folder. </p> <p>When I set the ASP.NET version to 2.0 in IIS, The application prompts me for a username and password (when I attempt to open the site in the browser), If I set it back to 1.0, then I am not prompted for a password, but obviously get a full application error. </p> <p>I have anonymous access enabled (with a username / password) and have authenticated access checked as "Integrated Windows Authentication)</p> <p>How can I configure IIS so that I am not prompted for a password while having ASP.NET version set to 2.0?</p> <p>Thanks...</p> <p><strong>EDIT</strong> I had major connection problems and apparently created some duplicate posts...I'll delete the ones with no answers. </p>
[ { "answer_id": 243835, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 2, "selected": false, "text": "T" }, { "answer_id": 243862, "author": "erickson", "author_id": 3474, "author_profile": "https://Sta...
2008/10/28
[ "https://Stackoverflow.com/questions/243814", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1638/" ]
243,816
<p>How to validate iscontrolkeys in textbox keydown event in .net?</p>
[ { "answer_id": 243879, "author": "Russ Cam", "author_id": 1831, "author_profile": "https://Stackoverflow.com/users/1831", "pm_score": 0, "selected": false, "text": " private void textBox1_KeyDown(object sender, KeyEventArgs e)\n {\n if (e.KeyCode == Keys.ControlKey)\n ...
2008/10/28
[ "https://Stackoverflow.com/questions/243816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
243,831
<p>Is there a way to get the Unicode Block of a character in python? The <a href="http://www.python.org/doc/2.5.2/lib/module-unicodedata.html" rel="noreferrer">unicodedata</a> module doesn't seem to have what I need, and I couldn't find an external library for it.</p> <p>Basically, I need the same functionality as <a href="http://java.sun.com/javase/6/docs/api/java/lang/Character.UnicodeBlock.html#of(char)" rel="noreferrer"><code>Character.UnicodeBlock.of()</code></a> in java.</p>
[ { "answer_id": 245072, "author": "zaphod", "author_id": 13871, "author_profile": "https://Stackoverflow.com/users/13871", "pm_score": 5, "selected": true, "text": "unicodedata" }, { "answer_id": 63930824, "author": "Koterpillar", "author_id": 288201, "author_profile":...
2008/10/28
[ "https://Stackoverflow.com/questions/243831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7581/" ]
243,836
<p>Is there a library method to copy all the properties between two (already present) instances of the same class, in Python?</p> <p>I mean, something like Apache Commons' <code>PropertyUtilsBean.copyProperties()</code></p>
[ { "answer_id": 244116, "author": "Peter Hoffmann", "author_id": 720, "author_profile": "https://Stackoverflow.com/users/720", "pm_score": 7, "selected": true, "text": "__getitem__" }, { "answer_id": 244654, "author": "Peter Hosey", "author_id": 30461, "author_profile"...
2008/10/28
[ "https://Stackoverflow.com/questions/243836", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3497/" ]
243,851
<p>I'm trying to unit test a piece of code that needs a currently logged in user in the test. Using the .Net 2.0 Membership Provider, how can I programmatically log in as a user for this test?</p>
[ { "answer_id": 250787, "author": "user31934", "author_id": 31934, "author_profile": "https://Stackoverflow.com/users/31934", "pm_score": 2, "selected": false, "text": " public class TemporaryPrincipal : IDisposable {\n private readonly IPrincipal _cache;\n\n public Tempo...
2008/10/28
[ "https://Stackoverflow.com/questions/243851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16027/" ]
243,852
<p>I am attempting to deploy an ASP.NET 2.0 Web service application on an IIS server that currently serves a large .NET 1.0 web application. </p> <p>I have set up an appropriate virtual directory and have set the ASP.NET version for the virtual directory to 2.0, when I attempt to browse the site in a web-browser, I am prompted for a password. If I set the ASP.NET version down to 1.0, I am not prompted for a password, but obviously receive a full application error.</p> <p>How can I configure IIS so that I can have the .NET 2.0 version selected without requiring the password prompt?</p> <p>I have anonymous access enabled and have the "Authenticated Access" set to integrated windows authentication"</p> <p>Any help or suggestions is appreciated...</p> <p>Thanks.</p>
[ { "answer_id": 566516, "author": "Tom Anderson", "author_id": 13502, "author_profile": "https://Stackoverflow.com/users/13502", "pm_score": 0, "selected": false, "text": "c:\\windows\\microsoft.net\\framework\\v2.0.50727\\aspnet_regiis.exe -i\n" } ]
2008/10/28
[ "https://Stackoverflow.com/questions/243852", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1638/" ]
243,864
<p>I want to create a list of integers from 1 to <code>n</code>. I can do this in Python using <code>range(1, n+1)</code>, and in Haskell using: <code>take n (iterate (1+) 1)</code>.</p> <p>What is the right OCaml idiom for this?</p>
[ { "answer_id": 244078, "author": "Thedric Walker", "author_id": 26166, "author_profile": "https://Stackoverflow.com/users/26166", "pm_score": 4, "selected": false, "text": "let rec range i j = \n if i > j then [] \n else i :: range (i+1) j\n" }, { "answer_id": 244104, "auth...
2008/10/28
[ "https://Stackoverflow.com/questions/243864", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1386292/" ]
243,865
<p>I have two iterators, a <code>list</code> and an <code>itertools.count</code> object (i.e. an infinite value generator). I would like to merge these two into a resulting iterator that will alternate yield values between the two:</p> <pre><code>&gt;&gt;&gt; import itertools &gt;&gt;&gt; c = itertools.count(1) &gt;&gt;&gt; items = ['foo', 'bar'] &gt;&gt;&gt; merged = imerge(items, c) # the mythical "imerge" &gt;&gt;&gt; merged.next() 'foo' &gt;&gt;&gt; merged.next() 1 &gt;&gt;&gt; merged.next() 'bar' &gt;&gt;&gt; merged.next() 2 &gt;&gt;&gt; merged.next() Traceback (most recent call last): ... StopIteration </code></pre> <p>What is the simplest, most concise way to do this?</p>
[ { "answer_id": 243892, "author": "Claudiu", "author_id": 15055, "author_profile": "https://Stackoverflow.com/users/15055", "pm_score": 4, "selected": false, "text": "a" }, { "answer_id": 243902, "author": "Pramod", "author_id": 1386292, "author_profile": "https://Stac...
2008/10/28
[ "https://Stackoverflow.com/questions/243865", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18950/" ]
243,894
<p>Does the placement of a function have an effect on the performance of closures within scope? If so, where is the optimal place to put these functions? If not, is the implied association by closure enough reason to place a function in another place logically?</p> <p>For instance, if <strong>foo</strong> does not rely on the value of <strong>localState</strong>, does the fact that <strong>localState</strong> is accessible from <strong>foo</strong> have implications as to <strong>foo</strong>'s execution time, memory use, etc.?</p> <pre><code>(function(){ var localState; function foo(){ // code } function bar(){ // code return localState; } })(); </code></pre> <p>In other words, would this be a better choice, and if so why?</p> <pre><code>(function(){ function foo(){ // code } var localState; function bar(){ // code return localState; } })(); </code></pre> <p><a href="https://stackoverflow.com/users/27024/darius-bacon">Darius Bacon</a> has suggested <a href="https://stackoverflow.com/questions/243894/javascript-closures-and-function-placement#243942">below</a> that the two samples above are identical since <strong>localState</strong> can be accessed anywhere from within the block. However, the example below where <strong>foo</strong> is defined outside the block may be a different case. What do you think?</p> <pre><code>function foo(){ // code } (function(){ var localState; function bar(){ // code foo(); return localState; } })(); </code></pre>
[ { "answer_id": 243949, "author": "Claudiu", "author_id": 15055, "author_profile": "https://Stackoverflow.com/users/15055", "pm_score": 3, "selected": false, "text": "localState" }, { "answer_id": 246945, "author": "WPWoodJr", "author_id": 32122, "author_profile": "htt...
2008/10/28
[ "https://Stackoverflow.com/questions/243894", "https://Stackoverflow.com", "https://Stackoverflow.com/users/208/" ]
243,897
<p>I have a variable that is built in loop. Something like:</p> <pre><code>$str = ""; for($i = 0; $i &lt; 10; $i++) $str .= "something"; </code></pre> <p>If $str = "" is ommitted, I get undefined variable notice, but I thought php auto-declare a variable the first time it sees undeclared one?</p> <p>How do I do this right?</p>
[ { "answer_id": 243913, "author": "vIceBerg", "author_id": 17766, "author_profile": "https://Stackoverflow.com/users/17766", "pm_score": 5, "selected": true, "text": "$str = $str . \"something\";" }, { "answer_id": 243925, "author": "Ross", "author_id": 2025, "author_p...
2008/10/28
[ "https://Stackoverflow.com/questions/243897", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15345/" ]
243,900
<p>I've seen some code where a <em>Class</em> is imported, instead of a namespace, making all the static members/methods of that class available. Is this a feature of VB? Or do other languages do this as well?</p> <p>TestClass.vb</p> <pre><code>public class TestClass public shared function Somefunc() as Boolean return true end function end class </code></pre> <p>MainClass.vb</p> <pre><code>imports TestClass public class MainClass public sub Main() Somefunc() end sub end class </code></pre> <p>These files are in the App_Code directory. Just curious, because I've never thought of doing this before, nor have I read about it anywhere. </p>
[ { "answer_id": 246615, "author": "RS Conley", "author_id": 7890, "author_profile": "https://Stackoverflow.com/users/7890", "pm_score": 3, "selected": true, "text": "GlobalMultiUse" }, { "answer_id": 5697882, "author": "gumuruh", "author_id": 687088, "author_profile": ...
2008/10/28
[ "https://Stackoverflow.com/questions/243900", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40/" ]
243,929
<p>I have several arrays of arrays or arrays of dicts that I would like to store in my iPhone app. This lists are static and won't be modified by the app or users. Occasionally they may be displayed but more likely they'll be iterated over and compared to some input value. Would the best way to store these arrays be a CoreData/SQLite data store, in a header file, or something I'm not thinking of? I could see making a class that only has these arrays stored in them for access, but I'm not sure if that's the best route to take.</p>
[ { "answer_id": 244978, "author": "Colin Barrett", "author_id": 23106, "author_profile": "https://Stackoverflow.com/users/23106", "pm_score": 3, "selected": true, "text": "@implementation DataSource\n+ (NSArray *)someData\n{\n static NSArray *data = nil;\n if (!data) {\n data = [[NSA...
2008/10/28
[ "https://Stackoverflow.com/questions/243929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29263/" ]
243,945
<p>From wikipedia: </p> <blockquote> <p>the cross product is a binary operation on two vectors in a <strong>three-dimensional</strong> Euclidean space that results in another vector which is perpendicular to the plane containing the two input vectors.</p> </blockquote> <p>Given that the definition is only defined in three (<a href="https://en.wikipedia.org/wiki/Seven-dimensional_cross_product#Consequences_of_the_defining_properties" rel="noreferrer">or seven, one and zero</a>) dimensions, how does one calculate the cross product of two 2d vectors?</p> <p>I have seen two implementations. One returns a new vector (but only accepts a single vector), the other returns a scalar (but is a calculation between two vectors).</p> <p>Implementation 1 (returns a scalar):</p> <pre><code>float CrossProduct(const Vector2D &amp; v1, const Vector2D &amp; v2) const { return (v1.X*v2.Y) - (v1.Y*v2.X); } </code></pre> <p>Implementation 2 (returns a vector):</p> <pre><code>Vector2D CrossProduct(const Vector2D &amp; v) const { return Vector2D(v.Y, -v.X); } </code></pre> <p>Why the varying implementations? What would I use the scalar implementation for? What would I use the vector implementation for?</p> <p>The reason I ask is because I'm writing a Vector2D class myself and don't know which method to use.</p>
[ { "answer_id": 244046, "author": "Alnitak", "author_id": 6782, "author_profile": "https://Stackoverflow.com/users/6782", "pm_score": 4, "selected": false, "text": "a" }, { "answer_id": 29060469, "author": "Bill Burdick", "author_id": 1026782, "author_profile": "https:...
2008/10/28
[ "https://Stackoverflow.com/questions/243945", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18265/" ]
243,956
<p>I currently have a silverlight application which rotates through several graphs of live data. Each page has two user controls though: one for an info box at the top and another for the graph to display. I have tried to add a background image to the master page that they are displayed on so that the image is behind everything but as soon as they load, they overwrite the image with their blank canvas.</p> <p>So far attempts to make the background of the user controls transparent have had no effect.</p> <p>Any help would be greatly appreciated.</p>
[ { "answer_id": 245384, "author": "Bryant", "author_id": 10893, "author_profile": "https://Stackoverflow.com/users/10893", "pm_score": 2, "selected": false, "text": "<object data=\"data:application/x-silverlight-2,\" type=\"application/x-silverlight-2\" width=\"100%\" height=\"100%\">\n ...
2008/10/28
[ "https://Stackoverflow.com/questions/243956", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
243,962
<p>Which Eclipse package should I choose for Python development with <a href="http://www.pydev.org/" rel="nofollow noreferrer">PyDev</a>?</p> <p>Nothing on the Eclipse homepage tells me what to choose, and the PyDev documentation assumes I already have Eclipse installed. Does it matter which Eclipse package I choose?</p>
[ { "answer_id": 1215589, "author": "J. Peterson", "author_id": 105767, "author_profile": "https://Stackoverflow.com/users/105767", "pm_score": 2, "selected": false, "text": "Help > Software Updates >" } ]
2008/10/28
[ "https://Stackoverflow.com/questions/243962", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23423/" ]
243,966
<p>I need to send an email to someone and want them to be able to simply reply to the email without having to specify the email address.</p> <p>Using sp_send_dbmail sets the reply-to address as the name of the profile that it was sent from.</p> <p>Can this be changed to specify the reply-to so it looks like it came from me.</p> <p>Thanks.</p>
[ { "answer_id": 26142821, "author": "Doug_Ivison", "author_id": 1259871, "author_profile": "https://Stackoverflow.com/users/1259871", "pm_score": 2, "selected": false, "text": "sp_send_dbmail" } ]
2008/10/28
[ "https://Stackoverflow.com/questions/243966", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11989/" ]
243,967
<p>Sometimes you need to skip execution of part of a method under certain non-critical error conditions. You can use <em>exceptions</em> for that, but exceptions generally are not recommended in normal application logic, only for abnormal situations.</p> <p>So I do a trick like this:</p> <pre><code>do { bool isGood = true; .... some code if(!isGood) break; .... some more code if(!isGood) break; .... some more code } while(false); ..... some other code, which has to be executed. </code></pre> <p>I use a "fake" loop which will run once, and I can abort it by <em>break</em> or <em>continue</em>.</p> <p>Some of my colleagues did not like that, and they called it "bad practice". I personally find that approach pretty slick. But what do you think?</p>
[ { "answer_id": 243978, "author": "Paul Tomblin", "author_id": 3333, "author_profile": "https://Stackoverflow.com/users/3333", "pm_score": 5, "selected": false, "text": "bool isGood = true;\n\n .... some code\n\n if(isGood)\n {\n .... some more code\n }\n\n if(isGood)\n {\n ...
2008/10/28
[ "https://Stackoverflow.com/questions/243967", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20390/" ]
243,971
<p>What do you think of using a metric of function point to lines of code as a metric?</p> <p>It makes me think of the old game show "Name That Tune". "I can name that tune in three notes!" I can write that functionality in 0.1 klocs! Is this useful?</p> <p>It would certainly seem to promote library usage, but is that what you want?</p>
[ { "answer_id": 244298, "author": "T.E.D.", "author_id": 29639, "author_profile": "https://Stackoverflow.com/users/29639", "pm_score": 0, "selected": false, "text": "grep -c \";\" *.h *.cpp | awk -F: '/:/ {x += $2} END {print x}'\n" } ]
2008/10/28
[ "https://Stackoverflow.com/questions/243971", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13930/" ]
243,992
<p>When I create a zip Archive via <code>java.util.zip.*</code>, is there a way to split the resulting archive in multiple volumes? </p> <p>Let's say my overall archive has a <code>filesize</code> of <code>24 MB</code> and I want to split it into 3 files on a limit of 10 MB per file.<br> Is there a zip API which has this feature? Or any other nice ways to achieve this?</p> <p>Thanks Thollsten</p>
[ { "answer_id": 244025, "author": "sakana", "author_id": 28921, "author_profile": "https://Stackoverflow.com/users/28921", "pm_score": 4, "selected": true, "text": "import java.io.File;\nimport java.io.FileNotFoundException;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\n...
2008/10/28
[ "https://Stackoverflow.com/questions/243992", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9688/" ]
243,995
<p>I am trying to set the permissions of a folder and all of it's children on a vista computer. The code I have so far is this.</p> <pre><code> public static void SetPermissions(string dir) { DirectoryInfo info = new DirectoryInfo(dir); DirectorySecurity ds = info.GetAccessControl(); ds.AddAccessRule(new FileSystemAccessRule(@"BUILTIN\Users", FileSystemRights.FullControl, InheritanceFlags.ContainerInherit, PropagationFlags.None, AccessControlType.Allow)); info.SetAccessControl(ds); } </code></pre> <p>However it's not working as I would expect it to.<br> Even if I run the code as administrator it will not set the permissions.</p> <p>The folder I am working with is located in C:\ProgramData\&lt;my folder&gt; and I can manually change the rights on it just fine.</p> <p>Any one want to point me in the right direction.</p>
[ { "answer_id": 244798, "author": "Erin", "author_id": 22835, "author_profile": "https://Stackoverflow.com/users/22835", "pm_score": 4, "selected": true, "text": "public static void SetPermissions(string dir)\n {\n DirectoryInfo info = new DirectoryInfo(dir);\n ...
2008/10/28
[ "https://Stackoverflow.com/questions/243995", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22835/" ]
244,001
<p>I know that cursors are frowned upon and I try to avoid their use as much as possible, but there may be some legitimate reasons to use them. I have one and I am trying to use a pair of cursors: one for the primary table and one for the secondary table. The primary table cursor iterates through the primary table in an outer loop. the secondary table cursor iterates through the secondary table in the inner loop. The problem is, that the primary table cursor though apparently proceeding and saving the primary key column value [Fname] into a local variable @Fname, but it does not get the row for the corresponding foreign key column in the secondary table. For the secondary table it always returns the rows whose foreign key column value matches the primary key column value of the <strong>first row</strong> of the primary table. </p> <p>Following is a very simplified example for what I want to do in the real stored procedure. Names is the primary table</p> <pre><code>SET NOCOUNT ON DECLARE @Fname varchar(50) -- to hold the fname column value from outer cursor loop ,@FK_Fname varchar(50) -- to hold the fname column value from inner cursor loop ,@score int ; --prepare primary table to be iterated in the outer loop DECLARE @Names AS Table (Fname varchar(50)) INSERT @Names SELECT 'Jim' UNION SELECT 'Bob' UNION SELECT 'Sam' UNION SELECT 'Jo' --prepare secondary/detail table to be iterated in the inner loop DECLARE @Scores AS Table (Fname varchar(50), Score int) INSERT @Scores SELECT 'Jo',1 UNION SELECT 'Jo',5 UNION SELECT 'Jim',4 UNION SELECT 'Bob',10 UNION SELECT 'Bob',15 --cursor to iterate on the primary table in the outer loop DECLARE curNames CURSOR FOR SELECT Fname FROM @Names OPEN curNames FETCH NEXT FROM curNames INTO @Fname --cursor to iterate on the secondary table in the inner loop DECLARE curScores CURSOR FOR SELECT FName,Score FROM @Scores WHERE Fname = @Fname --*** NOTE: Using the primary table's column value @Fname from the outer loop WHILE @@FETCH_STATUS = 0 BEGIN PRINT 'Outer loop @Fname = ' + @Fname OPEN curScores FETCH NEXT FROM curScores INTO @FK_Fname, @Score WHILE @@FETCH_STATUS = 0 BEGIN PRINT ' FK_Fname=' + @FK_Fname + '. Score=' + STR(@Score) FETCH NEXT FROM curScores INTO @FK_Fname, @Score END CLOSE curScores FETCH NEXT FROM curNames INTO @Fname END DEALLOCATE curScores CLOSE curNames DEALLOCATE curNames </code></pre> <p>Here is what I get for the result. Please note that for the outer loop it DOES show the up-to-date Fname, but when that Fname is used as @Fname to fetch the relevant row from the secondary table for the succeeding iterations, it still get the rows that match the first row (Bob) of the primary table.</p> <pre><code>Outer loop @Fname = Bob FK_Fname=Bob. Score=10 FK_Fname=Bob. Score=15 Outer loop @Fname = Jim FK_Fname=Bob. Score=10 FK_Fname=Bob. Score=15 Outer loop @Fname = Jo FK_Fname=Bob. Score=10 FK_Fname=Bob. Score=15 Outer loop @Fname = Sam FK_Fname=Bob. Score=10 FK_Fname=Bob. Score=15 </code></pre> <p>Please let me know what am I do wrong. Thanks in advance!</p>
[ { "answer_id": 244024, "author": "Eduardo Campañó", "author_id": 12091, "author_profile": "https://Stackoverflow.com/users/12091", "pm_score": 0, "selected": false, "text": "DECLARE curScores CURSOR\nFOR \n SELECT FName,Score \n FROM @Scores \n WHERE Fname = @Fname \n" }, { ...
2008/10/28
[ "https://Stackoverflow.com/questions/244001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/262613/" ]
244,009
<p>In my Rails controller, I'm creating multiple instances of the same model class. I want to add some RSpec expectations so I can test that it is creating the correct number with the correct parameters. So, here's what I have in my spec:</p> <pre> Bandmate.should_receive(:create).with(:band_id => @band.id, :user_id => @user.id, :position_id => 1, :is_leader => true) Bandmate.should_receive(:create).with(:band_id => @band.id, :user_id => "2222", :position_id => 2) Bandmate.should_receive(:create).with(:band_id => @band.id, :user_id => "3333", :position_id => 3) Bandmate.should_receive(:create).with(:band_id => @band.id, :user_id => "4444", :position_id => 4) </pre> <p>This is causing problems because it seems that the Bandmate class can only have 1 "should_receive" expectation set on it. So, when I run the example, I get the following error:</p> <pre> Spec::Mocks::MockExpectationError in 'BandsController should create all the bandmates when created' Mock 'Class' expected :create with ({:band_id=>1014, :user_id=>999, :position_id=>1, :is_leader=>true}) but received it with ({:band_id=>1014, :user_id=>"2222", :position_id=>"2"}) </pre> <p>Those are the correct parameters for the second call to create, but RSpec is testing against the wrong parameters.</p> <p>Does anyone know how I can set up my should_receive expectations to allow multiple different calls?</p>
[ { "answer_id": 248742, "author": "James Baker", "author_id": 9365, "author_profile": "https://Stackoverflow.com/users/9365", "pm_score": 6, "selected": true, "text": ".ordered" } ]
2008/10/28
[ "https://Stackoverflow.com/questions/244009", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19964/" ]
244,018
<p>I'm using Flex 3 in the UI of a Windows app (Flash player as an embedded ActiveX control), and passing data between them with ExternalInterface (primarily into the Flex app, as opposed to out). I'm finding, though, that the performance is pretty awful, particularly with larger (i.e., custom) objects; the more EI calls we make, and the larger the custom objects as pass in, the harder things seem to drop off performance-wise.</p> <p>I'm assuming there's a good deal of overhead in serializing these objects, so I'm wondering, are there any best practices out there for using ExternalInterface in this particular way? There doesn't seem to be much out there in terms of documentation on this subject yet.</p> <p>Is it better, say, to pass a large block of XML into the player control as a string, and parse it with Flex, than to pass it as a custom object, as a rule? How should Flex apps requiring a relatively tight integration with their host apps best use ExternalInterface without sacrificing performance? Is EI performance an issue Adobe is addressing? Any implementation differences between players 9 and 10? What kinds of things should we avoid to get the most out of this feature?</p> <p>Thanks in advance!</p> <p>Chris </p>
[ { "answer_id": 248742, "author": "James Baker", "author_id": 9365, "author_profile": "https://Stackoverflow.com/users/9365", "pm_score": 6, "selected": true, "text": ".ordered" } ]
2008/10/28
[ "https://Stackoverflow.com/questions/244018", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32129/" ]
244,019
<p>I've used HttpWebRequests to post data to HTTPS websites before, and I've never had todo anything different than a regular HTTP Post.</p> <p>Does anyone know if there are any tricks involved that I missed to ensure that this is done properly?</p>
[ { "answer_id": 244089, "author": "FlySwat", "author_id": 1965, "author_profile": "https://Stackoverflow.com/users/1965", "pm_score": 2, "selected": false, "text": "System.Net.ServicePointManager.ServerCertificateValidationCallback +=\n delegate(object sender, System.Security.Cryptogra...
2008/10/28
[ "https://Stackoverflow.com/questions/244019", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1965/" ]
244,029
<p>I am trying to insert a time only value, but get the following error</p> <blockquote> <ul> <li>ex {"SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM."} System.Exception</li> </ul> </blockquote> <p>From the front end, the time is selected using the "TimeEdit" control, with the up and down arrows. The table in SQL Server has the fields set as smalldatetime. I only need to store the time. I use the following to return data to the app</p> <p>select id,CONVERT(CHAR(5),timeFrom,8)as timeFrom,CONVERT(CHAR(5),timeTo,8)as timeTo FROM dbo.Availability where id = @id and dayName = @weekday</p> <p>How do I pass time only to the table?</p> <p>Edit ~ Solution As per Euardo and Chris, my solution was to pass a datetime string instead of a time only string. I formatted my result as per <a href="http://msdn.microsoft.com/en-us/library/az4se3k1(VS.71).aspx" rel="nofollow noreferrer">Time Format</a> using "g".</p> <p>Thanks</p>
[ { "answer_id": 244041, "author": "StingyJack", "author_id": 16391, "author_profile": "https://Stackoverflow.com/users/16391", "pm_score": -1, "selected": false, "text": "SELECT (GETDATE() - (CAST(FLOOR(CAST(GETDATE() as FLOAT)) AS DateTime)))\n" } ]
2008/10/28
[ "https://Stackoverflow.com/questions/244029", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23667/" ]
244,034
<p>Wanna write a RegEx to validate a driving license. </p> <p>if it doesn't start with (US, CA, CN) then it has to be followed with XX and after that with any number of Alpha numeric letters. </p> <p>So for example if the driving license starts with GB then it has to be followed with XX GBXX12345363 However if it starts with US then we don't care what comes after it. USLA039247230</p>
[ { "answer_id": 244045, "author": "Tanktalus", "author_id": 23512, "author_profile": "https://Stackoverflow.com/users/23512", "pm_score": 0, "selected": false, "text": "/^(?:(?:US|CA|CN)\\w+|[[:alpha:]]{2}XX\\w+)$/\n" }, { "answer_id": 244094, "author": "eyelidlessness", "...
2008/10/28
[ "https://Stackoverflow.com/questions/244034", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
244,063
<p>I have a <code>&lt;button&gt;</code> with an accesskey assgined to it. The accesskey works fine as long as the button is visible, but when I set <code>display: none</code> or <code>visibility: hidden</code>, the accesskey no longer works.</p> <p>Also tried without success:</p> <ul> <li>Use a different element type: a, input (various types, even typeless).</li> <li>Assign the accesskey to a label that wraps the invisible control.</li> </ul> <p>Note, I'm not sure if this is the standard behavior, but prior to Firefox 3 the accesskey seemed to worked regardless of visibility.</p>
[ { "answer_id": 244176, "author": "Sal", "author_id": 32144, "author_profile": "https://Stackoverflow.com/users/32144", "pm_score": 2, "selected": false, "text": "display:none" }, { "answer_id": 245831, "author": "Community", "author_id": -1, "author_profile": "https:/...
2008/10/28
[ "https://Stackoverflow.com/questions/244063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14749/" ]
244,085
<p>Delphi 2009 complains with an E2283 error: [DCC Error] outputcode.pas(466): E2283 Too many local constants. Use shorter procedures</p> <p>Delphi 2007 compiles just fine. I can't find an abundance of local constants, it's a short (500 line) unit. Do you see any abundance of constants or literals I can address?</p> <pre><code>procedure TOutputCodeForm.FormCreate(Sender: TObject); var poParser : TStringStream; begin if ( IsWindowsVista() ) then begin SetVistaFonts( self ); end; poParser := TStringStream.Create( gstrSQLParser ); SQLParser := TSyntaxMemoParser.Create( self ); SQLParser.RegistryKey := '\Software\Advantage Data Architect\SQLSyntaxMemo'; SQLParser.UseRegistry := True; SQLParser.CompileFromStream( poParser ); FreeAndNil( poParser ); poParser := TStringStream.Create( gstrCPPParser ); cppParser := TSyntaxMemoParser.Create( self ); cppParser.RegistryKey := '\Software\Advantage Data Architect\SQLSyntaxMemo'; cppParser.UseRegistry := True; cppParser.CompileFromStream( poParser ); FreeAndNil( poParser ); poParser := TStringStream.Create( gstrPasParser ); pasParser := TSyntaxMemoParser.Create( self ); pasParser.RegistryKey := '\Software\Advantage Data Architect\SQLSyntaxMemo'; pasParser.Script := ExtractFilePath( Application.ExeName ) + 'pasScript.txt'; pasParser.CompileFromStream( poParser ); {* Free the stream since we are finished with it. *} FreeAndNil( poParser ); poCodeOutput := TSyntaxMemo.Create( self ); poCodeOutput.Parent := Panel1; poCodeOutput.Left := 8; poCodeOutput.Top := 8; poCodeOutput.Width := Panel1.Width - 16; poCodeOutput.Height := Panel1.Height - 16; poCodeOutput.ClipCopyFormats := [smTEXT, smRTF]; poCodeOutput.Font.Charset := ANSI_CHARSET; poCodeOutput.Font.Color := clWindowText; poCodeOutput.Font.Height := -11; poCodeOutput.Font.Name := 'Courier New'; poCodeOutput.Font.Style := []; poCodeOutput.GutterFont.Charset := DEFAULT_CHARSET; poCodeOutput.GutterFont.Color := clWindowText; poCodeOutput.GutterFont.Height := -11; poCodeOutput.GutterFont.Name := 'MS Sans Serif'; poCodeOutput.GutterFont.Style := []; poCodeOutput.HyperCursor := crDefault; poCodeOutput.IndentStep := 1; poCodeOutput.Margin := 2; poCodeOutput.Modified := False; poCodeOutput.MonoPrint := True; poCodeOutput.Options := [smoSyntaxHighlight, smoPrintWrap, smoPrintLineNos, smoPrintFilename, smoPrintDate, smoPrintPageNos, smoAutoIndent, smoTabToColumn, smoWordSelect, smoShowRMargin, smoShowGutter, smoShowWrapColumn, smoTitleAsFilename, smoProcessDroppedFiles, smoBlockOverwriteCursor, smoShowWrapGlyph, smoColumnTrack, smoUseTAB, smoSmartFill, smoOLEDragSource]; poCodeOutput.ReadOnly := False; poCodeOutput.RightMargin := 80; poCodeOutput.SaveFormat := sfTEXT; poCodeOutput.ScrollBars := ssBoth; poCodeOutput.SelLineStyle := lsCRLF; poCodeOutput.SelStart := 3; poCodeOutput.SelLength := 0; poCodeOutput.SelTextColor := clWhite; poCodeOutput.SelTextBack := clBlack; poCodeOutput.TabDefault := 4; poCodeOutput.TabOrder := 0; poCodeOutput.VisiblePropEdPages := [ppOPTIONS, ppHIGHLIGHTING, ppKEYS, ppAUTOCORRECT, ppTEMPLATES]; poCodeOutput.WrapAtColumn := 0; poCodeOutput.OnKeyDown := FormKeyDown; poCodeOutput.ActiveParser := 3; poCodeOutput.Anchors := [akLeft, akTop, akRight, akBottom]; poCodeOutput.Parser1 := pasParser; poCodeOutput.Parser2 := cppParser; poCodeOutput.Parser3 := SQLParser; SQLParser.AttachEditor( poCodeOutput ); cppParser.AttachEditor( poCodeOutput ); pasParser.AttachEditor( poCodeOutput ); poCodeOutput.Lines.AddStrings( poCode ); if ( CodeType = ctCPP ) then poCodeOutput.ActiveParser := 2 else if ( CodeType = ctPascal ) then poCodeOutput.ActiveParser := 1 else poCodeOutput.ActiveParser := 3; MainForm.AdjustFormSize( self, 0.95, 0.75 ); end; </code></pre>
[ { "answer_id": 244488, "author": "Jeremy Mullin", "author_id": 7893, "author_profile": "https://Stackoverflow.com/users/7893", "pm_score": 0, "selected": false, "text": "procedure TOutputCodeForm.FormCreate(Sender: TObject);\nbegin\n\n if ( IsWindowsVista() ) then\n begin\n Set...
2008/10/28
[ "https://Stackoverflow.com/questions/244085", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7893/" ]
244,087
<p>What are some things I can do to improve query performance of an oracle query without creating indexes?</p> <p>Here is the query I'm trying to run faster:</p> <pre><code>SELECT c.ClaimNumber, a.ItemDate, c.DTN, b.FilePath FROM items a, itempages b, keygroupdata c WHERE a.ItemType IN (112,115,189,241) AND a.ItemNum = b.ItemNum AND b.ItemNum = c.ItemNum ORDER BY a.DateStored DESC </code></pre> <p>None of these columns are indexed and each of the tables contains millions of records. Needless to say, it takes over 3 and half minutes for the query to execute. This is a third party database in a production environment and I'm not allowed to create any indexes so any performance improvements would have to be made to the query itself.</p> <p>Thanks!</p>
[ { "answer_id": 244131, "author": "Rob Booth", "author_id": 16445, "author_profile": "https://Stackoverflow.com/users/16445", "pm_score": 4, "selected": true, "text": "SELECT c.ClaimNumber, a.ItemDate, c.DTN, b.FilePath\nFROM items a\nINNER JOIN itempages b ON b.ItemNum = a.ItemNum\nINNER...
2008/10/28
[ "https://Stackoverflow.com/questions/244087", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2849/" ]
244,110
<p>Here's the code. Not much to it.</p> <pre><code>&lt;?php include(&quot;Spreadsheet/Excel/Writer.php&quot;); $xls = new Spreadsheet_Excel_Writer(); $sheet = $xls-&gt;addWorksheet('At a Glance'); $colNames = array('Foo', 'Bar'); $sheet-&gt;writeRow(0, 0, $colNames, $colHeadingFormat); for($i=1; $i&lt;=10; $i++) { $row = array( &quot;foo $i&quot;, &quot;bar $i&quot;); $sheet-&gt;writeRow($rowNumber++, 0, $row); } header (&quot;Expires: &quot; . gmdate(&quot;D,d M Y H:i:s&quot;) . &quot; GMT&quot;); header (&quot;Last-Modified: &quot; . gmdate(&quot;D,d M Y H:i:s&quot;) . &quot; GMT&quot;); header (&quot;Cache-Control: no-cache, must-revalidate&quot;); header (&quot;Pragma: no-cache&quot;); $xls-&gt;send(&quot;test.xls&quot;); $xls-&gt;close(); ?&gt; </code></pre> <p>The issue is that I get the following error when I actually open the file with Excel:</p> <pre><code>File error: data may have been lost. </code></pre> <p>Even stranger is the fact that, despite the error, the file seems fine. Any data I happen to be writing is there.</p> <p>Any ideas on how to get rid of this error?</p> <hr /> <h3>Edit</h3> <p>I've modified the code sample to better illustrate the problem. I don't think the first sample was a legit test.</p>
[ { "answer_id": 244404, "author": "Mark Biek", "author_id": 305, "author_profile": "https://Stackoverflow.com/users/305", "pm_score": 4, "selected": true, "text": "$sheet->writeRow(0, 0, $colNames, $colHeadingFormat);\n" }, { "answer_id": 258324, "author": "jmcnamara", "au...
2008/10/28
[ "https://Stackoverflow.com/questions/244110", "https://Stackoverflow.com", "https://Stackoverflow.com/users/305/" ]
244,113
<p>I'm working on a stored procedure in SQL Server 2000 with a temp table defined like this:</p> <pre>CREATE TABLE #MapTable (Category varchar(40), Code char(5))</pre> <p>After creating the table I want to insert some standard records (which will then be supplemented dynamically in the procedure). Each category (about 10) will have several codes (typically 3-5), and I'd like to express the insert operation for each category in one statement. </p> <p>Any idea how to do that? </p> <p>The best idea I've had so far is to keep a real table in the db as a template, but I'd really like to avoid that if possible. The database where this will live is a snapshot of a mainframe system, such that the entire database is blown away every night and re-created in a batch process- stored procedures are re-loaded from source control at the end of the process.</p> <p>The issue I'm trying to solve isn't so much keeping it to one statement as it is trying to avoid re-typing the category name over and over.</p>
[ { "answer_id": 244158, "author": "DJ.", "author_id": 10492, "author_profile": "https://Stackoverflow.com/users/10492", "pm_score": 0, "selected": false, "text": "CREATE TABLE #MapTable (Category varchar(40), Code char(5))\n\nINSERT INTO #MapTable \nSELECT X.Category, X.Code FROM\n(SELECT...
2008/10/28
[ "https://Stackoverflow.com/questions/244113", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3043/" ]
244,114
<p>I'm developing a poker game in C#. At the moment I'm trying to get the players hand score using <code>RegEx</code>. I search the string (composed of the cards suit and number) and look for suits or numbers to match the <code>RegEx</code>. If i get 2 matches then the player has a pair, 3 matches he has 3 of a kind. </p> <p>I have 3 classes at the moment, a Card class (with number and suit), a Deck class (that contains 52 Cards) and a Hand class that gets five cards from the shuffled deck.</p> <p>Deck class has a <code>shuffleDeck()</code>; Hand class has the functions to calculate the score (is in these functions that I am using RegEx).</p> <p>I generate the string on which I use <code>RegEx</code> by adding the 5 suits and numbers that the hand has.</p> <p>Is this a good idea or should I do it another way, if so, how?</p> <p>Thank you for your help</p> <p>PS. I am one of the unexperienced programmers that want to use a newly learned tool for everything</p>
[ { "answer_id": 4459394, "author": "Dalou", "author_id": 538032, "author_profile": "https://Stackoverflow.com/users/538032", "pm_score": 2, "selected": false, "text": "// D H S C \ncolors = [7,5,3,2]\n\n// A Q K J T 9 8 7 6 5 4 3 2 \nranks = [...
2008/10/28
[ "https://Stackoverflow.com/questions/244114", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23146/" ]
244,115
<p>Just for my own purposes, I'm trying to build a tokenizer in Java where I can define a regular grammar and have it tokenize input based on that. The StringTokenizer class is deprecated, and I've found a couple functions in Scanner that hint towards what I want to do, but no luck yet. Anyone know a good way of going about this?</p>
[ { "answer_id": 244236, "author": "Balint Pato", "author_id": 19621, "author_profile": "https://Stackoverflow.com/users/19621", "pm_score": 2, "selected": false, "text": " import java.util.Scanner;\n\n\n public class Main { \n\n public static void main(String[] args) {\n\n S...
2008/10/28
[ "https://Stackoverflow.com/questions/244115", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1370/" ]
244,119
<p>Can anoyne recommend a good library that will let me easily read/write private member fields of a class? I was looking through apache commons, but couldnt see it. I must be getting blind ?</p> <p>Edit: Asking questions on the border of legalities always give these questions of "why"? I am writing several javarebel plugins for hotswapping classes. Accessing private variables is only step 1, I might even have to replace implementations of some methods.</p>
[ { "answer_id": 244146, "author": "Ken Gentle", "author_id": 8709, "author_profile": "https://Stackoverflow.com/users/8709", "pm_score": 1, "selected": false, "text": "java.lang.reflect" }, { "answer_id": 244156, "author": "sakana", "author_id": 28921, "author_profile"...
2008/10/28
[ "https://Stackoverflow.com/questions/244119", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23691/" ]
244,152
<p>I have a site that requires Windows Authentication the application obtains the credential from the Security.Prinicipal once the user is autenticated the problem is that my credentials on my local environment are different that the ones stored in the DB and the user preferences cannot be obtain. i am doing the following workaround in order to deal with this issue.</p> <pre><code> #if DEBUG var myUser = userBL.GetSingle(@"desiredDomain\otherUserName"); #else var myUser = userBL.GetSingle(HttpApplication.User.Identity.Name); #endif Session.Add("User",myUser); </code></pre> <p>is there any other way rather than impersonating or the above mentioned workaorund to change the the value of HttpApplication.User.Identity.Name this is beacuse I have to change my code everytime I need to commit into repository or deploy the App</p>
[ { "answer_id": 244874, "author": "Robert Paulson", "author_id": 14033, "author_profile": "https://Stackoverflow.com/users/14033", "pm_score": 3, "selected": true, "text": "UPDATE Users \nSET \n UserName = REPLACE(UserName, '\\\\ProductionDomain\\', '\\\\DevDomain\\')\n" } ]
2008/10/28
[ "https://Stackoverflow.com/questions/244152", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14440/" ]
244,157
<p>I am trying to read an XML-file from another server. However the the company that's hosting me seems to have turned of the file_get_contents function from retrieving files for files from other servers (and their support is not very bright and it takes forever for them to answer). So I need a work around in some way.</p> <p>This is my current code</p> <pre><code> $url = urldecode( $object_list_url ); $xmlstr = file_get_contents ( $url ); $obj = new SimpleXMLElement ( $xmlstr, LIBXML_NOCDATA ); </code></pre>
[ { "answer_id": 244163, "author": "Ross", "author_id": 2025, "author_profile": "https://Stackoverflow.com/users/2025", "pm_score": 0, "selected": false, "text": "allow_url_fopen" }, { "answer_id": 244166, "author": "Greg", "author_id": 24181, "author_profile": "https:/...
2008/10/28
[ "https://Stackoverflow.com/questions/244157", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27943/" ]
244,164
<p>I need to resize PNG, JPEG and GIF files. How can I do this using Java?</p>
[ { "answer_id": 244177, "author": "Burkhard", "author_id": 12860, "author_profile": "https://Stackoverflow.com/users/12860", "pm_score": 8, "selected": true, "text": "BufferedImage createResizedCopy(Image originalImage, \n int scaledWidth, int scaledHeight, \n boolea...
2008/10/28
[ "https://Stackoverflow.com/questions/244164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2011/" ]
244,183
<p>I'm working on a site which contains a whole bunch of mp3s and images, and I'd like to display a loading gif while all the content loads. </p> <p>I have no idea how to achieve this, but I do have the animated gif I want to use. </p> <p>Any suggestions?</p>
[ { "answer_id": 244190, "author": "mmattax", "author_id": 1638, "author_profile": "https://Stackoverflow.com/users/1638", "pm_score": 6, "selected": true, "text": "readystatechanged" }, { "answer_id": 4100608, "author": "Mike E.", "author_id": 332044, "author_profile":...
2008/10/28
[ "https://Stackoverflow.com/questions/244183", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27171/" ]
244,184
<p>We have are relatively simple Reporting Services report that our users commonly export to Excel. I've noticed that the files produced by the Excel export seem unusually large. If I open one of these files and just click save, without making any changes, the file size reduces to about half of it's previous size. Has anyone else run into this and is there a known workaround?</p>
[ { "answer_id": 923724, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": -1, "selected": false, "text": "DataElementOutput" } ]
2008/10/28
[ "https://Stackoverflow.com/questions/244184", "https://Stackoverflow.com", "https://Stackoverflow.com/users/162/" ]
244,191
<p>For example:</p> <pre><code>public void doSomething() { final double MIN_INTEREST = 0.0; // ... } </code></pre> <p>Personally, I would rather see these substitution constants declared statically at the class level. I suppose I'm looking for an "industry viewpoint" on the matter.</p>
[ { "answer_id": 244215, "author": "sakana", "author_id": 28921, "author_profile": "https://Stackoverflow.com/users/28921", "pm_score": -1, "selected": false, "text": "public class Test {\n\n final double MIN_INTEREST = 0.0;\n\n /**\n * @param args\n */\n public static voi...
2008/10/28
[ "https://Stackoverflow.com/questions/244191", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32142/" ]
244,192
<p>I have a pattern to match with the string: string pattern = @"asc" I am checking the SQL SELECT query for right syntax, semantics, ... I need to say that in the end of the query string I can have "asc" or "desc". How can it be written in C#?</p>
[ { "answer_id": 244201, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 1, "selected": false, "text": "asc|desc\n" }, { "answer_id": 244203, "author": "bdukes", "author_id": 2688, "author_profile": "http...
2008/10/28
[ "https://Stackoverflow.com/questions/244192", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28298/" ]
244,208
<p>I'm using MySQL 5.0.45 on CentOS 5.1.</p> <p><code>SELECT DISTINCT(email) FROM newsletter</code></p> <p>Returns 217259 rows</p> <p><code>SELECT COUNT(DISTINCT(email)) FROM newsletter</code></p> <p>Returns 180698 for the count.</p> <p><code>SELECT COUNT(*) FROM (SELECT DISTINCT(email) FROM newsletter) AS foo</code></p> <p>Returns 180698 for the count.</p> <p>Shouldn't all 3 queries return the same value?</p> <p>Here is the schema of the newsletter table</p> <pre> CREATE TABLE `newsletter` ( `newsID` int(11) NOT NULL auto_increment, `email` varchar(128) NOT NULL default '', `newsletter` varchar(8) NOT NULL default '', PRIMARY KEY (`newsID`) ) ENGINE=MyISAM; </pre> <p><strong>Update:</strong> I've found that if I add a <codE>WHERE</code> clause to the first query then I get the correct results. The <codE>WHERE</code> clause is such that it will not effect the results.</p> <p><code>SELECT DISTINCT(email) FROM newsletter WHERE newsID > 0</code></p>
[ { "answer_id": 244262, "author": "Paul Tomblin", "author_id": 3333, "author_profile": "https://Stackoverflow.com/users/3333", "pm_score": 0, "selected": false, "text": "select distinct(email) from newsletter order by email;" }, { "answer_id": 244435, "author": "Maglob", "...
2008/10/28
[ "https://Stackoverflow.com/questions/244208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/796/" ]
244,219
<p>In c# (3.0 or 3.5, so we can use lambdas), is there an elegant way of sorting a list of dates in descending order? I know I can do a straight sort and then reverse the whole thing, </p> <pre><code>docs.Sort((x, y) =&gt; x.StoredDate.CompareTo(y.StoredDate)); docs.Reverse(); </code></pre> <p>but is there a lambda expression to do it one step?</p> <p>In the above example, StoredDate is a property typed as a DateTime.</p>
[ { "answer_id": 244221, "author": "jonnii", "author_id": 4590, "author_profile": "https://Stackoverflow.com/users/4590", "pm_score": 4, "selected": false, "text": "docs.Sort((x, y) => y.StoredDate.CompareTo(x.StoredDate));\n" }, { "answer_id": 244227, "author": "Tamas Czinege"...
2008/10/28
[ "https://Stackoverflow.com/questions/244219", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2849/" ]
244,222
<p>I have compression enabled within IIS7 and it works as expected on all responses except for those constructed by ASP.NET AJAX. I have a web service that provides data to the client. When the web service is called directly, it is properly compressed. However, when it is called via ASP.NET AJAX, the JSON response is not compressed.</p> <p>How can I get ASP.NET AJAX to send its JSON response with GZip compression?</p>
[ { "answer_id": 266753, "author": "stevemegson", "author_id": 25028, "author_profile": "https://Stackoverflow.com/users/25028", "pm_score": 3, "selected": false, "text": "<dynamicTypes>\n <add mimeType=\"text/*\" enabled=\"true\" />\n <add mimeType=\"message/*\" enabled=\"true\" /...
2008/10/28
[ "https://Stackoverflow.com/questions/244222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
244,243
<p>I ran into the problem that my primary key sequence is not in sync with my table rows. </p> <p>That is, when I insert a new row I get a duplicate key error because the sequence implied in the serial datatype returns a number that already exists.</p> <p>It seems to be caused by import/restores not maintaining the sequence properly.</p>
[ { "answer_id": 244265, "author": "meleyal", "author_id": 4196, "author_profile": "https://Stackoverflow.com/users/4196", "pm_score": 11, "selected": true, "text": "-- Login to psql and run the following\n\n-- What is the result?\nSELECT MAX(id) FROM your_table;\n\n-- Then run...\n-- This...
2008/10/28
[ "https://Stackoverflow.com/questions/244243", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4196/" ]
244,246
<p>I want to create an alias for a class name. The following syntax would be perfect:</p> <pre><code>public class LongClassNameOrOneThatContainsVersionsOrDomainSpecificName { ... } public class MyName = LongClassNameOrOneThatContainsVersionOrDomainSpecificName; </code></pre> <p>but it won't compile.</p> <hr /> <h2>Example</h2> <p><strong>Note</strong> This example is provided for convenience only. Don't try to solve this particular problem by suggesting changing the design of the entire system. The presence, or lack, of this example doesn't change the original question.</p> <p>Some existing code depends on the presence of a static class:</p> <pre><code>public static class ColorScheme { ... } </code></pre> <p>This color scheme is the Outlook 2003 color scheme. i want to introduce an Outlook 2007 color scheme, while retaining the Outlook 2003 color scheme:</p> <pre><code>public static class Outlook2003ColorScheme { ... } public static class Outlook2007ColorScheme { ... } </code></pre> <p>But i'm still faced with the fact that the code depends on the presence of a static class called <code>ColorScheme</code>. My first thought was to create a <code>ColorScheme</code> class that I will inherit from either <code>Outlook2003</code> or <code>Outlook2007</code>:</p> <pre><code>public static class ColorScheme : Outlook2007ColorScheme { } </code></pre> <p>but you cannot inherit from a static class.</p> <p>My next thought was to create the static <code>ColorScheme</code> class, but make <code>Outlook2003ColorScheme</code> and <code>Outlook2007ColorScheme</code> classes non-static. Then a static variable in the static <code>ColorScheme</code> class can point to either &quot;true&quot; color scheme:</p> <pre><code>public static class ColorScheme { private static CustomColorScheme = new Outlook2007ColorScheme(); ... } private class CustomColorScheme { ... } private class Outlook2008ColorScheme : CustomColorScheme { ... } private class Outlook2003ColorScheme : CustomColorScheme { ... } </code></pre> <p>but that would require me to convert a class composed entirly of readonly static Colors into overridable properties, and then my <code>ColorScheme</code> class would need to have the 30 different property getters thunk down into the contained object.</p> <p>That's just too much typing.</p> <p>So my next thought was to alias the class:</p> <pre><code>public static ColorScheme = Outlook2007ColorScheme; </code></pre> <p>But that doesn't compile.</p> <p>How can I alias a static class into another name?</p> <hr /> <p><strong>Update:</strong> Can someone please add the answer <em>&quot;You cannot do this in C#&quot;</em>, so I can mark that as the accepted answer. Anyone else wanting the answer to the same question will find this question, the accepted answer, and a number of workarounds that might, or might not, be useful.</p> <p>I just want to close this question out.</p>
[ { "answer_id": 244255, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 7, "selected": false, "text": "using" }, { "answer_id": 244259, "author": "dpurrington", "author_id": 5573, "author_profile": "h...
2008/10/28
[ "https://Stackoverflow.com/questions/244246", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12597/" ]
244,252
<p>I've been looking (without great luck) for the perfect reference card with all the basic sorting algos in C (or maybe in pseudo code). Wikipedia is a terrific source of info but this time I'm looking for something definitely more portable (pocket size if possible) and of course printable. Any suggestion would be much appreciated!</p>
[ { "answer_id": 244294, "author": "Jonathan Leffler", "author_id": 15168, "author_profile": "https://Stackoverflow.com/users/15168", "pm_score": 2, "selected": false, "text": "qsort()" }, { "answer_id": 244632, "author": "ephemient", "author_id": 20713, "author_profile...
2008/10/28
[ "https://Stackoverflow.com/questions/244252", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6992/" ]
244,264
<p>I am currently trying to learn all new features of C#3.0. I have found a very nice collection of <a href="http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx" rel="nofollow noreferrer">sample to practice LINQ</a> but I can't find something similar for Lambda.</p> <p>Do you have a place that I could practice Lambda function?</p> <h2>Update</h2> <p>LINQpad is great to learn Linq (thx for the one who suggest) and use a little bit Lambda in some expression. But I would be interesting in more specific exercise for Lambda.</p>
[ { "answer_id": 244427, "author": "cfeduke", "author_id": 5645, "author_profile": "https://Stackoverflow.com/users/5645", "pm_score": 2, "selected": false, "text": "System.Action<...>" } ]
2008/10/28
[ "https://Stackoverflow.com/questions/244264", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13913/" ]
244,276
<p>A website I'm working on (using AS2 because it's oldschool) has a larger index .swf file that loads sub-swfs using <code>loadMovie("foo1.swf", placeToShowSwf)</code>. There's <code>foo1.swf</code> through 4, which is silly because the only thing that's different between them is a single number in the address of an xml file that tells it what content to load. So I want to reduce this to one file, with a simple function that the index file calls to load the xml file, as seen here.</p> <pre><code>function setFooNum(i:Number) { fooNum = i; //my_xml = new XML(); edit: this line has since been removed and is kept for historical purposes my_xml.load("foo"+fooNum+".xml"); }; </code></pre> <p>However, for some reason, the xml file won't load. It loads properly outside the function, but that doesn't do me much good. It changes fooNum properly, but that doesn't do me any good if the wrong xml file is already loading. As far as I can tell, the code behaves as though the <code>my_xml.load("foo"+fooNum+".xml")</code> isn't there at all.</p> <p>Is this some sort of security measure I don't know about, and is there any way around it?</p> <p><strong><em>EDIT</em></strong> As several people pointed out, the <code>my_xml = new XML()</code> line was the culprit. Unfortunately, I'm now getting a new and exciting error. When <code>setFooNum(i)</code> is called immediately after the <code>loadMove()</code> in the index file, a <code>trace(fooNum)</code> inside the <code>setFooNum()</code> function prints that fooNum is set correctly, but a <code>trace(fooNum)</code> inside the <code>onLoad()</code> (which returns a success despite loading apparently nothing, btw) shows that fooNum is undefined! Also, I made a button in the index swf that calls <code>setFooNum(3)</code> (for debugging purposes), which for some reason makes it work fine. So waiting a few seconds for the file to load seems to solve the problem, but that's an incredibly ugly solution. </p> <p>So how do I wait until everything is completely loaded before calling <code>setFooNum()</code>? </p>
[ { "answer_id": 244414, "author": "Claudio", "author_id": 30122, "author_profile": "https://Stackoverflow.com/users/30122", "pm_score": 0, "selected": false, "text": "function setFooNum(i:Number) {\n fooNum = i;\n my_xml.load(\"foo\"+fooNum+\".xml\");\n};\n" }, { "answer_id"...
2008/10/28
[ "https://Stackoverflow.com/questions/244276", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32139/" ]
244,280
<p>I'm trying to implement a unit test for a function in a project that doesn't have unit tests and this function requires a System.Web.Caching.Cache object as a parameter. I've been trying to create this object by using code such as...</p> <pre><code>System.Web.Caching.Cache cache = new System.Web.Caching.Cache(); cache.Add(...); </code></pre> <p>...and then passing the 'cache' in as a parameter but the Add() function is causing a NullReferenceException. My best guess so far is that I can't create this cache object in a unit test and need to retrieve it from the HttpContext.Current.Cache which I obviously don't have access to in a unit test.</p> <p>How do you unit test a function that requires a System.Web.Caching.Cache object as a parameter?</p>
[ { "answer_id": 244331, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 4, "selected": true, "text": "public interface ICacheWrapper\n{\n ...methods to support\n}\n\npublic class CacheWrapper : ICacheWrapper\n{\n priv...
2008/10/28
[ "https://Stackoverflow.com/questions/244280", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1463/" ]
244,285
<p>I've got to get a quick and dirty configuration editor up and running. The flow goes something like this:</p> <p>configuration (POCOs on server) are serialized to XML.<br> The XML is well formed at this point. The configuration is sent to the web server in XElements.<br> On the web server, the XML (Yes, ALL OF IT) is dumped into a textarea for editing.<br> The user edits the XML directly in the webpage and clicks Submit.<br> In the response, I retrieve the altered text of the XML configuration. At this point, ALL escapes have been reverted by the process of displaying them in a webpage.<br> I attempt to load the string into an XML object (XmlElement, XElement, whatever). KABOOM.</p> <p>The problem is that serialization escapes attribute strings, but this is lost in translation along the way. </p> <p>For example, let's say I have an object that has a regex. Here's the configuration as it comes to the web server:</p> <pre><code>&lt;Configuration&gt; &lt;Validator Expression="[^&amp;lt;]" /&gt; &lt;/Configuration&gt; </code></pre> <p>So, I put this into a textarea, where it looks like this to the user:</p> <pre><code>&lt;Configuration&gt; &lt;Validator Expression="[^&lt;]" /&gt; &lt;/Configuration&gt; </code></pre> <p>So the user makes a slight modification and submits the changes back. On the web server, the response string looks like:</p> <pre><code>&lt;Configuration&gt; &lt;Validator Expression="[^&lt;]" /&gt; &lt;Validator Expression="[^&amp;]" /&gt; &lt;/Configuration&gt; </code></pre> <p>So, the user added another validator thingie, and now BOTH have attributes with illegal characters. If I try to load this into any XML object, it throws an exception because &lt; and &amp; are not valid within a text string. I CANNOT CANNOT CANNOT CANNOT use any kind of encoding function, as it encodes the entire bloody thing:</p> <p>var result = Server.HttpEncode(editedConfig);</p> <p>results in </p> <pre><code>&amp;lt;Configuration&amp;gt; &amp;lt;Validator Expression="[^&amp;lt;]" /&amp;gt; &amp;lt;Validator Expression="[^&amp;amp;]" /&amp;gt; &amp;lt;/Configuration&amp;gt; </code></pre> <p>This is NOT valid XML. If I try to load this into an XML element of any kind I will be hit by a falling anvil. I don't like falling anvils. </p> <p>SO, the question remains... Is the ONLY way I can get this string XML ready for parsing into an XML object is by using regex replaces? Is there any way to "turn off constraints" when I load? How do you get around this???</p> <hr> <p>One last response and then wiki-izing this, as I don't think there is a valid answer.</p> <p>The XML I place in the textarea IS valid, escaped XML. The process of 1) putting it in the text area 2) sending it to the client 3) displaying it to the client 4) submitting the form it's in 5) sending it back to the server and 6) retrieving the value from the form REMOVES ANY AND ALL ESCAPES. </p> <p>Let me say this again: I'M not un-escaping ANYTHING. Just displaying it in the browser does this!</p> <p>Things to mull over: Is there a way to prevent this un-escaping from happening in the first place? Is there a way to take almost-valid XML and "clean" it in a safe manner?</p> <hr> <p>This question now has a bounty on it. To collect the bounty, you demonstrate how to edit VALID XML in a browser window WITHOUT a 3rd party/open source tool that doesn't require me to use regex to escape attribute values manually, that doesn't require users to escape their attributes, and that doesn't fail when roundtripping (&amp;amp;amp;amp;amp;etc;)</p>
[ { "answer_id": 244299, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 4, "selected": true, "text": "<foo mean-attribute=\"&lt;\">\n" }, { "answer_id": 244330, "author": "mohammedn", "author_id": 29268, ...
2008/10/28
[ "https://Stackoverflow.com/questions/244285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
244,295
<p>s it possible to do the following in subsonic.</p> <p>SELECT * FROM TABLE1</p> <p>WHERE Column1 > Column2 or Column1 &lt; Colum3</p> <p>All examples that I've seen assume you now a value to pass to the where clause. I'm trying to do this without creating a view.</p> <p>Thanks</p>
[ { "answer_id": 716887, "author": "Rick Rat", "author_id": 43754, "author_profile": "https://Stackoverflow.com/users/43754", "pm_score": -1, "selected": false, "text": "Dim TableList As Generic.List(Of Database.Table1) = _\n New SubSonic.Select().From(\"Table1\"). _\n Where(\"Col1\").IsGr...
2008/10/28
[ "https://Stackoverflow.com/questions/244295", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2526/" ]
244,316
<p>I'm looking for a good reader/writer lock in C++. We have a use case of a single infrequent writer and many frequent readers and would like to optimize for this. Preferable I would like a cross-platform solution, however a Windows only one would be acceptable. </p>
[ { "answer_id": 244344, "author": "Greg Rogers", "author_id": 5963, "author_profile": "https://Stackoverflow.com/users/5963", "pm_score": 6, "selected": true, "text": "shared_lock" }, { "answer_id": 244376, "author": "ephemient", "author_id": 20713, "author_profile": "...
2008/10/28
[ "https://Stackoverflow.com/questions/244316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/852/" ]
244,329
<p>Something happened that I'm not sure should be possible. Obviously it is, because I've seen it, but I need to find the root cause &amp; I was hoping you all could help.</p> <p>We have a system that looks up latitude &amp; longitude for a zipcode. Rather than access it every time, we cache the results in a cheap in-memory HashTable cache, since the lat &amp; long of a zip code tend to change less often than we release.</p> <p>Anyway, the hash is surrounded by a class that has a "get" and "add" method that are both synchronized. We access this class as a singleton.</p> <p>I'm not claiming this is the best setup, but it's where we're at. (I plan to change to wrap the Map in a Collections.synchronizedMap() call ASAP.)</p> <p>We use this cache in a multi-threaded environment, where we thread 2 calls for 2 zips (so we can calculate the distance between the two). These sometimes happen at very nearly the same time, so its very possible that both calls access the map at the same time.</p> <p>Just recently we had an incident where two different zip codes returned the same value. Assuming that the initial values were actually different, is there any way that writing the values into the Map would cause the same value to be written for two different keys? Or, is there any way that 2 "gets" could cross wires and accidentally return the same value?</p> <p>The only other explanation I have is that the initial data was corrupt (wrong values), but it seems very unlikely.</p> <p>Any ideas would be appreciated. Thanks, Peter</p> <p>(PS: Let me know if you need more info, code, etc.)</p> <pre><code>public class InMemoryGeocodingCache implements GeocodingCache { private Map cache = new HashMap(); private static GeocodingCache instance = new InMemoryGeocodingCache(); public static GeocodingCache getInstance() { return instance; } public synchronized LatLongPair get(String zip) { return (LatLongPair) cache.get(zip); } public synchronized boolean has(String zip) { return cache.containsKey(zip); } public synchronized void add(String zip, double lat, double lon) { cache.put(zip, new LatLongPair(lat, lon)); } } public class LatLongPair { double lat; double lon; LatLongPair(double lat, double lon) { this.lat = lat; this.lon = lon; } public double getLatitude() { return this.lat; } public double getLongitude() { return this.lon; } } </code></pre>
[ { "answer_id": 244819, "author": "Vladimir Dyuzhev", "author_id": 1163802, "author_profile": "https://Stackoverflow.com/users/1163802", "pm_score": 3, "selected": false, "text": "LatLongPair llp = InMemoryGeocodingCache.getInstance().get(ZIP1);\nllp.lat = x;\nllp.lon = y;\n" }, { ...
2008/10/28
[ "https://Stackoverflow.com/questions/244329", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7773/" ]
244,340
<p>I am getting a DC for a window handle of an object in another program using win32gui.GetDC which returns an int/long. I need to blit this DC into a memory DC in python. The only thing I can't figure out how to do is get a wxDC derived object from the int/long that win32gui returns. None of the wxDC objects allow me to pass an actual DC handle to them from what I can tell. This of course keeps me from doing my blit. Is there any way to do this?</p>
[ { "answer_id": 1821168, "author": "FogleBird", "author_id": 90308, "author_profile": "https://Stackoverflow.com/users/90308", "pm_score": 2, "selected": true, "text": "window = wx.Frame(None, -1, '')\nwindow.AssociateHandle(hwnd)\ndc = wx.WindowDC(window)\n" } ]
2008/10/28
[ "https://Stackoverflow.com/questions/244340", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13036/" ]
244,345
<p>I was watching Rob Connerys webcasts on the MVCStoreFront App, and I noticed he was unit testing even the most mundane things, things like:</p> <pre><code>public Decimal DiscountPrice { get { return this.Price - this.Discount; } } </code></pre> <p>Would have a test like:</p> <pre><code>[TestMethod] public void Test_DiscountPrice { Product p = new Product(); p.Price = 100; p.Discount = 20; Assert.IsEqual(p.DiscountPrice,80); } </code></pre> <p>While, I am all for unit testing, I sometimes wonder if this form of test first development is really beneficial, for example, in a real process, you have 3-4 layers above your code (Business Request, Requirements Document, Architecture Document), where the actual defined business rule (Discount Price is Price - Discount) could be misdefined.</p> <p>If that's the situation, your unit test means nothing to you.</p> <p>Additionally, your unit test is another point of failure:</p> <pre><code>[TestMethod] public void Test_DiscountPrice { Product p = new Product(); p.Price = 100; p.Discount = 20; Assert.IsEqual(p.DiscountPrice,90); } </code></pre> <p>Now the test is flawed. Obviously in a simple test, it's no big deal, but say we were testing a complicated business rule. What do we gain here?</p> <p>Fast forward two years into the application's life, when maintenance developers are maintaining it. Now the business changes its rule, and the test breaks again, some rookie developer then fixes the test incorrectly...we now have another point of failure.</p> <p>All I see is more possible points of failure, with no real beneficial return, if the discount price is wrong, the test team will still find the issue, how did unit testing save any work?</p> <p>What am I missing here? Please teach me to love TDD, as I'm having a hard time accepting it as useful so far. I want too, because I want to stay progressive, but it just doesn't make sense to me.</p> <p>EDIT: A couple people keep mentioned that testing helps enforce the spec. It has been my experience that the spec has been wrong as well, more often than not, but maybe I'm doomed to work in an organization where the specs are written by people who shouldn't be writing specs.</p>
[ { "answer_id": 249579, "author": "philant", "author_id": 18804, "author_profile": "https://Stackoverflow.com/users/18804", "pm_score": 3, "selected": false, "text": "Assert.IsEqual(p.DiscountPrice,90);\n" } ]
2008/10/28
[ "https://Stackoverflow.com/questions/244345", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1965/" ]
244,385
<p>I'm trying to run a shell command using the backtick operators, but the fact that the child process inherits php's open file descriptors is problematic. Is there a way to keep this from happening?</p> <p>I'm running PHP 5.1.2</p>
[ { "answer_id": 32634046, "author": "Greg", "author_id": 329062, "author_profile": "https://Stackoverflow.com/users/329062", "pm_score": 0, "selected": false, "text": "$cmd_to_run = escapeshellarg('/path/to/file --args');\n`echo $cmd_to_run | /bin/at now`;\n" } ]
2008/10/28
[ "https://Stackoverflow.com/questions/244385", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4883/" ]
244,390
<p>Right now, I have </p> <pre><code>SELECT gp_id FROM gp.keywords WHERE keyword_id = 15 AND (SELECT practice_link FROM gp.practices WHERE practice_link IS NOT NULL AND id = gp_id) </code></pre> <p>This does not provide a syntax error, however for values where it should return row(s), it just returns 0 rows.</p> <p>What I'm trying to do is get the gp_id from gp.keywords where the the keywords table keyword_id column is a specific value and the practice_link is the practices table corresponds to the gp_id that I have, which is stored in the id column of that table.</p>
[ { "answer_id": 244405, "author": "SquareCog", "author_id": 15962, "author_profile": "https://Stackoverflow.com/users/15962", "pm_score": 1, "selected": false, "text": "\nselect k.gp_id \nfrom gp.keywords as k,\n gp.practices as p\nwhere\nkeyword_id=15\nand practice_link is not null\n...
2008/10/28
[ "https://Stackoverflow.com/questions/244390", "https://Stackoverflow.com", "https://Stackoverflow.com/users/572/" ]
244,392
<p>Here's the quick and skinny of my issue:</p> <pre>$("a").toggle(function() { /*function A*/ }, function() { /*function B*/ });</pre> <p>Inside <code>function A</code> a form is displayed. If the user successfully completes the form, the form is hidden again (returning to it's original state).</p> <p>Inside <code>function B</code> the same form is hidden.</p> <p>The theory behind this is that the user can choose to display the form and fill it out, or they can click again and have the form go back into hiding. </p> <p>Now my question is this: currently, if the user fills out the form successfully--and it goes into hiding--the user would have to click on the link <strong><em>twice</em></strong> before returning to the toggle state that displays the form.</p> <p>Is there anyway to programmatically reset the toggle switch to its initial state?</p>
[ { "answer_id": 244468, "author": "foxy", "author_id": 30119, "author_profile": "https://Stackoverflow.com/users/30119", "pm_score": 5, "selected": true, "text": ".toggle()" }, { "answer_id": 244599, "author": "neezer", "author_id": 32154, "author_profile": "https://St...
2008/10/28
[ "https://Stackoverflow.com/questions/244392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32154/" ]
244,408
<p>I've got two collections (generic Lists), let's call them ListA and ListB.</p> <p>In ListA I've got a few items of type A. In ListB I've got some items of type B that have the SAME ID (but not same type) as the items in ListA, plus many more. I want to remove all the items from ListB that have the same ID as the ones in ListA. What's the best way of doing this? Is Linq to objects a nice fit? What algorithm would you use?</p> <p>Example</p> <p>ListA: ItemWithID1, ItemWithID2¨</p> <p>ListB: ItemWithID1, ItemWithID2, ItemWithID3, ItemWithID4</p> <p>EDIT: I forgot to mention in my original question that ListA and ListB doesn't contain the same types. So the only way to compare them is through the .Id property. Which invalidates the answers I've gotten so far.</p>
[ { "answer_id": 244426, "author": "Elie", "author_id": 23249, "author_profile": "https://Stackoverflow.com/users/23249", "pm_score": 0, "selected": false, "text": "for (item i: LISTA) {\n removeItem(i, LISTB);\n}\n\n\nmethod removeItem(Item, List) {\n for (Item i: List) {\n i...
2008/10/28
[ "https://Stackoverflow.com/questions/244408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3397/" ]
244,431
<p>I have two assemblies with the same name in the Global Assembly cache, but with different version numbers. How do I tell my program which version to reference?</p> <p>For the record, this is a VB.Net page in an ASP.Net web site.</p>
[ { "answer_id": 244469, "author": "Ady", "author_id": 31395, "author_profile": "https://Stackoverflow.com/users/31395", "pm_score": 2, "selected": false, "text": "<add assembly=\"Foo.Bar, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A\"/>\n" }, { "answer_id": 24...
2008/10/28
[ "https://Stackoverflow.com/questions/244431", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19074/" ]
244,438
<p>Imagine I have these python lists:</p> <pre><code>keys = ['name', 'age'] values = ['Monty', 42, 'Matt', 28, 'Frank', 33] </code></pre> <p>Is there a direct or at least a simple way to produce the following list of dictionaries ?</p> <pre><code>[ {'name': 'Monty', 'age': 42}, {'name': 'Matt', 'age': 28}, {'name': 'Frank', 'age': 33} ] </code></pre>
[ { "answer_id": 244455, "author": "Cheery", "author_id": 21711, "author_profile": "https://Stackoverflow.com/users/21711", "pm_score": 2, "selected": false, "text": "def fields_from_list(keys, values):\n iterator = iter(values)\n while True:\n yield dict((key, iterator.next()...
2008/10/28
[ "https://Stackoverflow.com/questions/244438", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12388/" ]
244,445
<p>If, like me, you shiver at the site of a While (True) loop, then you too must have thought long and hard about the best way to refactor it away. I've seen several different implementations, none really better than any other, such as the timer &amp; delegate combination.</p> <p>So what's the best way you've come up with or seen to refactor the dreaded While (True) loop?</p> <p><b>Edit</b>: As some comments mentioned, my intent was for this question to be an "infinite loop" refactoring, such as running a Windows style service where the only stop conditions would be OnStop or a fatal exception.</p>
[ { "answer_id": 244459, "author": "Jon B", "author_id": 27414, "author_profile": "https://Stackoverflow.com/users/27414", "pm_score": 4, "selected": false, "text": "volatile bool m_shutdown = false;\nvoid Run()\n{\n while (!m_shutdown)\n { ... }\n}\n" }, { "answer_id": 24448...
2008/10/28
[ "https://Stackoverflow.com/questions/244445", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27498/" ]
244,452
<h1>My situation</h1> <ul> <li>Input: a set of rectangles </li> <li>each rect is comprised of 4 doubles like this: (x0,y0,x1,y1)</li> <li>they are not "rotated" at any angle, all they are "normal" rectangles that go "up/down" and "left/right" with respect to the screen</li> <li>they are randomly placed - they may be touching at the edges, overlapping , or not have any contact</li> <li>I will have several hundred rectangles</li> <li>this is implemented in C#</li> </ul> <h1>I need to find</h1> <ul> <li>The area that is formed by their overlap - all the area in the canvas that more than one rectangle "covers" (for example with two rectangles, it would be the intersection)</li> <li>I don't need the geometry of the overlap - just the area (example: 4 sq inches)</li> <li>Overlaps shouldn't be counted multiple times - so for example imagine 3 rects that have the same size and position - they are right on top of each other - this area should be counted once (not three times)</li> </ul> <h1>Example</h1> <ul> <li>The image below contains thre rectangles: A,B,C</li> <li>A and B overlap (as indicated by dashes)</li> <li>B and C overlap (as indicated by dashes)</li> <li>What I am looking for is the area where the dashes are shown</li> </ul> <p>-</p> <pre><code>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA--------------BBB AAAAAAAAAAAAAAAA--------------BBB AAAAAAAAAAAAAAAA--------------BBB AAAAAAAAAAAAAAAA--------------BBB BBBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBB BBBBBB-----------CCCCCCCC BBBBBB-----------CCCCCCCC BBBBBB-----------CCCCCCCC CCCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCCCC </code></pre>
[ { "answer_id": 244458, "author": "Toon Krijthe", "author_id": 18061, "author_profile": "https://Stackoverflow.com/users/18061", "pm_score": 0, "selected": false, "text": "int LineOverlap(int line1a, line1b, line2a, line2b) \n{\n // assume line1a <= line1b and line2a <= line2b\n if (lin...
2008/10/28
[ "https://Stackoverflow.com/questions/244452", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13477/" ]
244,482
<p>Developing a heavily XML-based Java-application, I recently encountered an interesting problem on Ubuntu Linux.</p> <p>My application, using the <a href="http://jpf.sourceforge.net/" rel="noreferrer">Java Plugin Framework</a>, appears unable to convert a <a href="http://www.dom4j.org/" rel="noreferrer">dom4j</a>-created XML document to <a href="http://xmlgraphics.apache.org/batik/" rel="noreferrer">Batik's</a> implementation of the SVG specification.</p> <p>On the console, I learn that an error occurs:</p> <pre> Exception in thread "AWT-EventQueue-0" java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "org.apache.batik.dom.svg.SVGOMDocument.createAttribute(Ljava/lang/String;)Lorg/w3c/dom/Attr;" the class loader (instance of org/java/plugin/standard/StandardPluginClassLoader) of the current class, org/apache/batik/dom/svg/SVGOMDocument, and the class loader (instance of &lt;bootloader&gt;) for interface org/w3c/dom/Document have different Class objects for the type org/w3c/dom/Attr used in the signature at org.apache.batik.dom.svg.SVGDOMImplementation.createDocument(SVGDOMImplementation.java:149) at org.dom4j.io.DOMWriter.createDomDocument(DOMWriter.java:361) at org.dom4j.io.DOMWriter.write(DOMWriter.java:138) </pre> <p>I figure that the problem is caused by a conflict between the original classloader from the JVM and the classloader deployed by the plugin framework.</p> <p>To my knowledge, it's not possible to specify a classloader for the framework to use. It might be possible to hack it, but I would prefer a less aggressive approach to solving this problem, since (for whatever reason) it only occurs on Linux systems.</p> <p>Has one of you encountered such a problem and has any idea how to fix it or at least get to the core of the issue?</p>
[ { "answer_id": 244707, "author": "matt b", "author_id": 4249, "author_profile": "https://Stackoverflow.com/users/4249", "pm_score": 5, "selected": false, "text": "parent-first" }, { "answer_id": 244727, "author": "Adam Crume", "author_id": 25498, "author_profile": "ht...
2008/10/28
[ "https://Stackoverflow.com/questions/244482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25141/" ]
244,489
<p>I have a managed dll that calls into a native library. This native library generally returns IntPtrs. These can be passed in to other methods in the native library to do things, or to tell the library to free the instance associated with the IntPtr. But only some of the instances need to freed in this way, others are managed by the library. The problem is that the documentation is not always clear about which instances must be freed and which must not.</p> <p>What I want to know is if there is a way that I can tell if my code has kept references to any of the pointers which must be freed, and so is causing memory to leak?</p>
[ { "answer_id": 244707, "author": "matt b", "author_id": 4249, "author_profile": "https://Stackoverflow.com/users/4249", "pm_score": 5, "selected": false, "text": "parent-first" }, { "answer_id": 244727, "author": "Adam Crume", "author_id": 25498, "author_profile": "ht...
2008/10/28
[ "https://Stackoverflow.com/questions/244489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
244,492
<p>Is there something like a panel that I can use in a MFC application. This is to overlay the default window in MFC (a dialog application). Then to paint the panel black and paint some random stuff on top of it. Something like a view port.</p> <p>is there a better option than this to achieve the same effect ?</p>
[ { "answer_id": 37513811, "author": "Devolus", "author_id": 2282011, "author_profile": "https://Stackoverflow.com/users/2282011", "pm_score": 0, "selected": false, "text": "CDialog" } ]
2008/10/28
[ "https://Stackoverflow.com/questions/244492", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1781/" ]
244,493
<p>I have a certain POJO which needs to be persisted on a database, current design specifies its field as a single string column, and adding additional fields to the table is not an option.</p> <p>Meaning, the objects need to be serialized in some way. So just for the basic implementation I went and designed my own serialized form of the object which meant concatenating all it's fields into one nice string, separated by a delimiter I chose. But this is rather ugly, and can cause problems, say if one of the fields contains my delimiter.</p> <p>So I tried basic Java serialization, but from a basic test I conducted, this somehow becomes a very costly operation (building a ByteArrayOutputStream, an ObjectOutputStream, and so on, same for the deserialization).</p> <p>So what are my options? What is the preferred way for serializing objects to go on a database?</p> <p><strong>Edit:</strong> this is going to be a very common operation in my project, so overhead must be kept to a minimum, and performance is crucial. Also, third-party solutions are nice, but irrelevant (and usually generate overhead which I am trying to avoid)</p>
[ { "answer_id": 244511, "author": "Jason Cohen", "author_id": 4926, "author_profile": "https://Stackoverflow.com/users/4926", "pm_score": 2, "selected": false, "text": "Properties" }, { "answer_id": 245030, "author": "oxbow_lakes", "author_id": 16853, "author_profile":...
2008/10/28
[ "https://Stackoverflow.com/questions/244493", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24545/" ]
244,506
<p>Given a list of urls, I would like to check that each url:</p> <ul> <li>Returns a 200 OK status code</li> <li>Returns a response within X amount of time</li> </ul> <p>The end goal is a system that is capable of flagging urls as potentially broken so that an administrator can review them.</p> <p>The script will be written in PHP and will most likely run on a daily basis via cron.</p> <p>The script will be processing approximately 1000 urls at a go.</p> <p>Question has two parts:</p> <ul> <li>Are there any bigtime gotchas with an operation like this, what issues have you run into?</li> <li>What is the best method for checking the status of a url in PHP considering both accuracy and performance?</li> </ul>
[ { "answer_id": 244669, "author": "Henning", "author_id": 29549, "author_profile": "https://Stackoverflow.com/users/29549", "pm_score": 5, "selected": true, "text": "function is_available($url, $timeout = 30) {\n $ch = curl_init(); // get cURL handle\n\n // set cURL options\n $op...
2008/10/28
[ "https://Stackoverflow.com/questions/244506", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3238/" ]
244,509
<p>I'm planning to make a very simple program using php and mySQL. The main page will take information and make a new row in the database with that information. However, I need a number to put in for the primary key. Unfortunately, I have no idea about the normal way to determine what umber to use. Preferably, if I delete a row, that row's key won't ever be reused.</p> <p>A preliminary search has turned up the AUTOINCREMENT keyword in mySQL. However, I'd still like to know if that will work for what I want and what the common solution to this issue is.</p>
[ { "answer_id": 244516, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 5, "selected": true, "text": "CREATE TABLE animals (\n id MEDIUMINT NOT NULL AUTO_INCREMENT,\n name CHAR(30) NOT NULL,\n PRIMARY KEY (i...
2008/10/28
[ "https://Stackoverflow.com/questions/244509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25680/" ]
244,517
<p>Where is a reliable registry key to find install location of Excel 2007?</p>
[ { "answer_id": 244580, "author": "Fionnuala", "author_id": 2548, "author_profile": "https://Stackoverflow.com/users/2548", "pm_score": 4, "selected": true, "text": "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Office\\X.0\\Common\\InstallRoot]\n" }, { "answer_id": 244734, "autho...
2008/10/28
[ "https://Stackoverflow.com/questions/244517", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16794/" ]
244,522
<p>I am writing a web application that will run in kiosk mode on a touch screen. I am currently only targeting it for running on Firefox 3. A few of the use cases I have need to visit external sites. I wish to do so with an embedded browser, which I'm tackling with the help of an <code>&lt;iframe&gt;</code>. I need back/forward buttons for the embedded home page. </p> <p>I've managed to access the history object of the iframe with</p> <pre><code>var w = document.getElementById('embeddedBrowser').contentWindow; w.history.back(); </code></pre> <p>The <code>history</code> of the embedded window is the same as that of the parent window. Therefore for a newly loaded <code>&lt;iframe&gt;</code>, this call will go back to the previous page of the system.</p> <p>Is there any way to avoid this or a more correct way of solving this?</p>
[ { "answer_id": 245084, "author": "Borgar", "author_id": 27388, "author_profile": "https://Stackoverflow.com/users/27388", "pm_score": 3, "selected": true, "text": "window.history.current" } ]
2008/10/28
[ "https://Stackoverflow.com/questions/244522", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27349/" ]