qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
70,779
<p>I need to be able to quickly convert an image (inside a rails controller) so that the hosting company using managing our application can quickly test at any time to ensure that rmagick is not only successfully installed, but can be called throgh the rails stiack, what is the quickest clean code I can use to do this?</p>
[ { "answer_id": 70952, "author": "Asaf Bartov", "author_id": 7483, "author_profile": "https://Stackoverflow.com/users/7483", "pm_score": 0, "selected": false, "text": "require 'RMagick'\ninclude Magick\nimg = ImageList.new('myfile.jpg')\nimg.crop(0,0,10,10) # or whatever\nimg.write('mycro...
2008/09/16
[ "https://Stackoverflow.com/questions/70779", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7473/" ]
70,782
<p>How to get a file's creation date or file size, for example this Hello.jpg at <a href="http://www.mywebsite.com/now/Hello.jpg(note" rel="nofollow noreferrer">http://www.mywebsite.com/now/Hello.jpg(note</a>: This URL does not exist)? The purpose of this question is to make my application re-download the files from the any website when it has detected that the website has an updated version of the files and the files in my local folder are out of date. Any ideas?</p>
[ { "answer_id": 70803, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 4, "selected": true, "text": "$ telnet www.google.com 80\nTrying 216.239.59.103...\nConnected to www.l.google.com.\nEscape character is '^]'.\nHEAD ...
2008/09/16
[ "https://Stackoverflow.com/questions/70782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
70,785
<p>We want to try Ext JS on new project. Is there any well-known best practice for integrating Ext JS with server side Java (Spring/Hibernate/JS) application? Is DWR a good choice for that?</p>
[ { "answer_id": 75007, "author": "noah", "author_id": 12034, "author_profile": "https://Stackoverflow.com/users/12034", "pm_score": 1, "selected": false, "text": "var MyProxy = function(fn) {\n this.fn = fn;\n};\nExt.extend( MyProxy, Ext.data.DataProxy, {\n load: function(params,reader,...
2008/09/16
[ "https://Stackoverflow.com/questions/70785", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7292/" ]
70,797
<p>How do I have a Python script that a) can accept user input and how do I make it b) read in arguments if run from the command line?</p>
[ { "answer_id": 70814, "author": "lbz", "author_id": 11530, "author_profile": "https://Stackoverflow.com/users/11530", "pm_score": 9, "selected": false, "text": "var = raw_input(\"Please enter something: \")\nprint \"you entered\", var\n" }, { "answer_id": 70818, "author": "Da...
2008/09/16
[ "https://Stackoverflow.com/questions/70797", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1384652/" ]
70,842
<p>How should I run another program from within my <code>C</code> program? I need to be able to write data into <code>STDIN</code> of the launched program (and maybe read from it's <code>STDOUT</code>)</p> <p>I am not sure if this is a standard C function. I need the solution that should work under Linux.</p>
[ { "answer_id": 70848, "author": "freespace", "author_id": 8297, "author_profile": "https://Stackoverflow.com/users/8297", "pm_score": 5, "selected": true, "text": "popen" }, { "answer_id": 70857, "author": "Vhaerun", "author_id": 11234, "author_profile": "https://Stac...
2008/09/16
[ "https://Stackoverflow.com/questions/70842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6974/" ]
70,850
<p>What advantage, if any, is provided by formatting C code as follows:</p> <pre><code>while(lock_file(lockdir)==0) { count++; if(count==20) { fprintf(stderr,"Can't lock dir %s\n",lockdir); exit(1); } sleep(3); } if(rmdir(serverdir)!=0) { switch(errno) { case EEXIST: fprintf(stderr,"Server dir %s not empty\n",serverdir); break; default: fprintf(stderr,"Can't delete dir %s\n",serverdir); } exit(1); } unlock_file(lockdir); </code></pre> <p>versus something more typical such as</p> <pre><code>while(lock_file(lockdir)==0) { count++; if(count==20) { fprintf(stderr,"Can't lock dir %s\n",lockdir); exit(1); } sleep(3); } if(rmdir(serverdir)!=0) { switch(errno) { case EEXIST: fprintf(stderr,"Server dir %s not empty\n",serverdir); break; default: fprintf(stderr,"Can't delete dir %s\n",serverdir); } exit(1); } unlock_file(lockdir); </code></pre> <p>I just find the top version difficult to read and to get the indenting level correct for statements outside of a long block, especially for longs blocks containing several nested blocks.</p> <p>Only advantage I can see is just to be different and leave your fingerprints on code that you've written.</p> <p>I notice vim formatting would have to be hand-rolled to handle the top case.</p>
[ { "answer_id": 70923, "author": "Ben", "author_id": 11522, "author_profile": "https://Stackoverflow.com/users/11522", "pm_score": 2, "selected": false, "text": "if (x == 0) \n{\n if (y == 2)\n {\n if (z == 3)\n {\n do_something (x);\n }\n }\n}\n" }, { "answer_id...
2008/09/16
[ "https://Stackoverflow.com/questions/70850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2974/" ]
70,855
<p>Is there a realistic way of implementing a multi-threaded model in PHP whether truly, or just simulating it. Some time back it was suggested that you could force the operating system to load another instance of the PHP executable and handle other simultaneous processes.</p> <p>The problem with this is that when the PHP code finished executing the PHP instance remains in memory because there is no way to kill it from within PHP. So if you are simulating several threads you can imagine whats going to happen. So I am still looking for a way multi-threading can be done or simulated effectively from within PHP. Any ideas?</p>
[ { "answer_id": 72605, "author": "Adam Hopkinson", "author_id": 12280, "author_profile": "https://Stackoverflow.com/users/12280", "pm_score": 4, "selected": false, "text": "exec(\"/path/to/php -f '/path/to/file.php' | '/path/to/output.txt'\");\n" }, { "answer_id": 1079624, "au...
2008/09/16
[ "https://Stackoverflow.com/questions/70855", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11190/" ]
70,880
<p>Say I have the following C++:</p> <pre><code>char *p = new char[cb]; SOME_STRUCT *pSS = (SOME_STRUCT *) p; delete pSS; </code></pre> <p>Is this safe according to the C++ standard? Do I need to cast back to a <code>char*</code> and then use <code>delete[]</code>? I know it'll work in most C++ compilers, because it's plain-ordinary-data, with no destructors. Is it guaranteed to be safe?</p>
[ { "answer_id": 70904, "author": "Daniel James", "author_id": 2434, "author_profile": "https://Stackoverflow.com/users/2434", "pm_score": 3, "selected": false, "text": "operator delete[]" }, { "answer_id": 70905, "author": "thudbang", "author_id": 11661, "author_profil...
2008/09/16
[ "https://Stackoverflow.com/questions/70880", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8446/" ]
70,947
<p>I have a workbook with 20 different pivot tables. Is there any easy way to find all the pivot tables and refresh them in VBA?</p>
[ { "answer_id": 70976, "author": "GSerg", "author_id": 11683, "author_profile": "https://Stackoverflow.com/users/11683", "pm_score": 9, "selected": true, "text": "ThisWorkbook.RefreshAll\n" }, { "answer_id": 71002, "author": "LohanJ", "author_id": 11286, "author_profil...
2008/09/16
[ "https://Stackoverflow.com/questions/70947", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8418/" ]
70,956
<p>Is there a good way to exclude certain pages from using a HTTP module?</p> <p>I have an application that uses a custom HTTP module to validate a session. The HTTPModule is set up like this in web config:</p> <pre><code>&lt;system.web&gt; &lt;!-- ... --&gt; &lt;httpModules&gt; &lt;add name="SessionValidationModule" type="SessionValidationModule, SomeNamespace" /&gt; &lt;/httpModules&gt; &lt;/system.web&gt; </code></pre> <p>To exclude the module from the page, I tried doing this (without success):</p> <pre><code>&lt;location path="ToBeExcluded"&gt; &lt;system.web&gt; &lt;!-- ... --&gt; &lt;httpModules&gt; &lt;remove name="SessionValidationModule" /&gt; &lt;/httpModules&gt; &lt;/system.web&gt; &lt;/location&gt; </code></pre> <p>Any thoughts?</p>
[ { "answer_id": 71790, "author": "Crob", "author_id": 2460, "author_profile": "https://Stackoverflow.com/users/2460", "pm_score": 5, "selected": true, "text": "<add verb=\"*\" path=\"/validate/*.aspx\" type=\"Handler,Assembly\"/>\n" }, { "answer_id": 18411217, "author": "Mr. P...
2008/09/16
[ "https://Stackoverflow.com/questions/70956", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6308/" ]
70,964
<p>Originally I am looking for a solution in Actionscript. The point of this question is the algorithm, which detects the exact Minute, when a clock has to switch the Daylight Saving Time. </p> <p>So for example between the 25th and the 31th of October we have to check, if the actual date is a sunday, it is before or after 2 o'clock...</p>
[ { "answer_id": 154765, "author": "Benno Richters", "author_id": 3565, "author_profile": "https://Stackoverflow.com/users/3565", "pm_score": 2, "selected": false, "text": "inDaylightTime" }, { "answer_id": 50499119, "author": "Basil Bourque", "author_id": 642706, "auth...
2008/09/16
[ "https://Stackoverflow.com/questions/70964", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
70,992
<p>Relating to my <a href="https://stackoverflow.com/questions/48733/javahibernate-jpa-designing-the-server-data-reload">earlier question</a>, I want to ensure all the child objects are loaded as I have a multiple threads that may need to access the data (and thus avoid lazy loading exceptions). I understand the way to do this is to use the "fetch" keyword in the query (EJB QL). Like this:</p> <pre><code>select distinct o from Order o left join fetch o.orderLines </code></pre> <p>Assuming a model with an <code>Order</code> class which has a set of <code>OrderLines</code> in it.</p> <p>My question is that the "distinct" keyword seems to be needed as otherwise I seem to get back an <code>Order</code> for each <code>OrderLine</code>. Am I doing the right thing?</p> <p>Perhaps more importantly, is there a way to pull in all child objects, no matter how deep? We have around 10-15 classes and for the server we will need everything loaded... I was avoiding using <code>FetchType.EAGER</code> as that meant its always eager and in particular the web front end loads everything - but perhaps that is the way to go - is that what you do? I seem to remember us trying this before and then getting really slow webpages - but perhaps that means we should be using a second-level cache?</p>
[ { "answer_id": 74284, "author": "ncgz", "author_id": 12905, "author_profile": "https://Stackoverflow.com/users/12905", "pm_score": -1, "selected": false, "text": " <filter>\n <filter-name>hibernateFilter</filter-name>\n <filter-class> org.springframework.orm.hibernate3....
2008/09/16
[ "https://Stackoverflow.com/questions/70992", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48310/" ]
70,993
<p>We all know the various ways of testing OO systems. However, it looks like I'll be going to do a project where I'll be dealing with PLC ladder logic (don't ask :/), and I was wondering if there's a good way of testing the validity of the system.</p> <p>The only way I see so far is simply constructing a huge table with all known states of the system and which output states that generates. This would do for simple 'if input A is on, turn output B on' cases. I don't think this will work for more complicated constructions though.</p>
[ { "answer_id": 71105, "author": "jbdavid", "author_id": 6314, "author_profile": "https://Stackoverflow.com/users/6314", "pm_score": 4, "selected": true, "text": "|---|R15|---+---|/R16|---------(R18)--------|\n| |\n|---|R12|---+\n" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/70993", "https://Stackoverflow.com", "https://Stackoverflow.com/users/909/" ]
71,000
<p>I'm trying to create a Zip file from .Net that can be read from Java code.</p> <p>I've used SharpZipLib to create the Zip file but also if the file generated is valid according to the CheckZip function of the #ZipLib library and can be successfully uncompressed via WinZip or WinRar I always get an error when trying to uncompress it using the Java.Utils.Zip class in Java.</p> <p>Problem seems to be in the wrong header written by SharpZipLib, I've also posted a question on the SharpDevelop forum but with no results (see <a href="http://community.sharpdevelop.net/forums/t/8272.aspx" rel="nofollow noreferrer">http://community.sharpdevelop.net/forums/t/8272.aspx</a> for info) but with no result.</p> <p>Has someone a code sample of compressing a Zip file with .Net and de-compressing it with the Java.Utils.Zip class?</p> <p>Regards Massimo</p>
[ { "answer_id": 71072, "author": "Panos", "author_id": 8049, "author_profile": "https://Stackoverflow.com/users/8049", "pm_score": 4, "selected": true, "text": "using (ZipFile zipFile = new ZipFile())\n{\n zipFile.AddDirectory(sourceFolderPath);\n zipFile.Save(archiveFolderName);\n}\n" ...
2008/09/16
[ "https://Stackoverflow.com/questions/71000", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11673/" ]
71,022
<p>How do you return 1 value per row of the max of several columns:</p> <p><strong>TableName</strong></p> <pre><code>[Number, Date1, Date2, Date3, Cost] </code></pre> <p>I need to return something like this:</p> <pre><code>[Number, Most_Recent_Date, Cost] </code></pre> <p>Query?</p>
[ { "answer_id": 71045, "author": "Lasse V. Karlsen", "author_id": 267, "author_profile": "https://Stackoverflow.com/users/267", "pm_score": 9, "selected": true, "text": "SELECT\n CASE\n WHEN Date1 >= Date2 AND Date1 >= Date3 THEN Date1\n WHEN Date2 >= Date1 AND Date2 >= D...
2008/09/16
[ "https://Stackoverflow.com/questions/71022", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11703/" ]
71,030
<p>I'm aware I can add maven repositories for fetching dependencies in ~/.m2/settings.xml. But is it possible to add a repository using command line, something like:</p> <pre><code>mvn install -Dmaven.repository=http://example.com/maven2 </code></pre> <p>The reason I want to do this is because I'm using a continuous integration tool where I have full control over the command line options it uses to call maven, but managing the settings.xml for the user that runs the integration tool is a bit of a hassle.</p>
[ { "answer_id": 71132, "author": "Jorge Ferreira", "author_id": 6508, "author_profile": "https://Stackoverflow.com/users/6508", "pm_score": 3, "selected": false, "text": " <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n xmln...
2008/09/16
[ "https://Stackoverflow.com/questions/71030", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1113/" ]
71,069
<p>Maven spews out far too many lines of output to my taste (I like the Unix way: no news is good news).</p> <p>I want to get rid of all <code>[INFO]</code> lines, but I couldn't find any mention of an argument or config settings that controls the verbosity of Maven.</p> <p>Is there no LOG4J-like way to set the log level?</p>
[ { "answer_id": 71086, "author": "Jorge Ferreira", "author_id": 6508, "author_profile": "https://Stackoverflow.com/users/6508", "pm_score": 8, "selected": true, "text": "-q" }, { "answer_id": 40535065, "author": "Stanislav", "author_id": 2213164, "author_profile": "htt...
2008/09/16
[ "https://Stackoverflow.com/questions/71069", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7483/" ]
71,074
<p>I can make Firefox not display the ugly dotted focus outlines on <b>links</b> with this:</p> <pre class="lang-css prettyprint-override"><code>a:focus { outline: none; } </code></pre> <p>But how can I do this for <code>&lt;button&gt;</code> tags as well? When I do this:</p> <pre class="lang-css prettyprint-override"><code>button:focus { outline: none; } </code></pre> <p>the buttons still have the dotted focus outline when I click on them.</p> <p>(and yes, I know this is a usability issue, but I would like to provide my own focus hints which are appropriate to the design instead of ugly grey dots)</p>
[ { "answer_id": 71251, "author": "Vitaly Sharovatov", "author_id": 6647, "author_profile": "https://Stackoverflow.com/users/6647", "pm_score": 3, "selected": false, "text": "browser.display.focus_ring_width" }, { "answer_id": 71260, "author": "AlexWilson", "author_id": 224...
2008/09/16
[ "https://Stackoverflow.com/questions/71074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4639/" ]
71,077
<p>I want to compress some files (into the <a href="http://en.wikipedia.org/wiki/ZIP_%28file_format%29" rel="nofollow noreferrer">ZIP</a> format) and encrypt them if possible using C#. Is there some way to do this?</p> <p>Can encryption be done as a part of the compression itself?</p>
[ { "answer_id": 71099, "author": "Skizz", "author_id": 1898, "author_profile": "https://Stackoverflow.com/users/1898", "pm_score": 5, "selected": true, "text": "System.IO.Compression" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/71077", "https://Stackoverflow.com", "https://Stackoverflow.com/users/184/" ]
71,108
<p>Under what circumstances might you want to use multiple indirection (that is, a chain of pointers as in <code>Foo **</code>) in C++?</p>
[ { "answer_id": 71143, "author": "aku", "author_id": 1196, "author_profile": "https://Stackoverflow.com/users/1196", "pm_score": 3, "selected": false, "text": "void test(int ** var)\n{\n ...\n}\n\nint *foo = ...\ntest(&foo);\n" }, { "answer_id": 71154, "author": "Carl Seleborg...
2008/09/16
[ "https://Stackoverflow.com/questions/71108", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11575/" ]
71,151
<p>Using the Python Documentation I found the <a href="http://docs.python.org/lib/module-HTMLParser.html" rel="noreferrer">HTML parser</a> but I have no idea which library to import to use it, how do I find this out (bearing in mind it doesn't say on the page).</p>
[ { "answer_id": 71161, "author": "1077", "author_id": 10776, "author_profile": "https://Stackoverflow.com/users/10776", "pm_score": 5, "selected": true, "text": "import HTMLParser\n" }, { "answer_id": 71174, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profi...
2008/09/16
[ "https://Stackoverflow.com/questions/71151", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1384652/" ]
71,180
<p>How can I find the last row that contains data in a specific column and on a specific sheet?</p>
[ { "answer_id": 71197, "author": "Galwegian", "author_id": 3201, "author_profile": "https://Stackoverflow.com/users/3201", "pm_score": -1, "selected": false, "text": "Function LastRow(rng As Range) As Long\n Dim iRowN As Long\n Dim iRowI As Long\n Dim iColN As Integer\n Dim iC...
2008/09/16
[ "https://Stackoverflow.com/questions/71180", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8418/" ]
71,201
<p>I'm developing a web service whose methods will be called from a "dynamic banner" that will show a sort of queue of messages read from a sql server table.</p> <p>The banner will have a heavy pressure in the home pages of high traffic sites; every time the banner will be loaded, it will call my web service, in order to obtain the new queue of messages.</p> <p>Now: I don't want that all this traffic drives queries to the database every time the banner is loaded, so I'm thinking to use the asp.net cache (i.e. HttpRuntime.Cache[cacheKey]) to limit database accesses; I will try to have a cache refresh every minute or so.</p> <p>Obviously I'll try have the messages as little as possible, to limit traffic.</p> <p>But maybe there are other ways to deal with such a scenario; for example I could write the last version of the queue on the file system, and have the web service access that file; or something mixing the two approaches...</p> <p>The solution is c# web service, asp.net 3.5, sql server 2000. </p> <p>Any hint? Other approaches? </p> <p>Thanks</p> <p>Andrea</p>
[ { "answer_id": 404798, "author": "Sklivvz", "author_id": 7028, "author_profile": "https://Stackoverflow.com/users/7028", "pm_score": 0, "selected": false, "text": " [Cached]\n public class MyTime : ContextBoundObject\n {\n [CachedMethod(1)]\n public DateTim...
2008/09/16
[ "https://Stackoverflow.com/questions/71201", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1178/" ]
71,223
<p>I'm currently writing a TYPO3 extension which is configured with a list of <code>tt_content</code> UID's. These point to content elements of type "text" and i want to render them by my extension.</p> <p>Because of TYPO3s special way of transforming the text you enter in the rich text editing when it enters the database, and again transforming it when it is rendered to the frontend, i can not just output the database contents of the <code>bodytext</code> field.</p> <p>I want to render these texts as they would usually get rendered by TYPO3. How do I do that? </p>
[ { "answer_id": 71272, "author": "Jan Hančič", "author_id": 185527, "author_profile": "https://Stackoverflow.com/users/185527", "pm_score": 4, "selected": true, "text": "$output .= $this->pi_RTEcssText( $contentFromDb );" }, { "answer_id": 2592788, "author": "cweiske", "au...
2008/09/16
[ "https://Stackoverflow.com/questions/71223", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4186/" ]
71,226
<p>I am using a .NET Windows Forms DataGridView and I need to edit a DataBound column (that binds on a boolean DataTable column). For this I specify the cell template like this:</p> <p>DataGridViewColumn column = new DataGridViewColumn(new DataGridViewCheckBoxCell());</p> <p>You see that I need a CheckBox cell template.</p> <p>The problem I face is that this column is constantly readonly/disabled, as if it would be of TextBox type. It doesn't show a checkbox at all.</p> <p>Any thoughts on how to work with editable checkbox columns for DataGridView?</p> <p>Update: For windows forms, please.</p> <p>Thanks.</p>
[ { "answer_id": 71252, "author": "Biri", "author_id": 968, "author_profile": "https://Stackoverflow.com/users/968", "pm_score": 0, "selected": false, "text": "<asp:TemplateField HeaderText=\"Whatever\" SortExpression=\"fieldname\" ItemStyle-HorizontalAlign=\"Center\">\n <ItemTemplate>\...
2008/09/16
[ "https://Stackoverflow.com/questions/71226", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2130892/" ]
71,248
<p>I would like to debug an embedded system containing gdb remotely using some kind of gui (ie like ddd). The embedded system does not have the sources or build symbols. However my local x windows box has. However the execution must happen on the embedded system. How can I from my development box drive gdb remotely with some gui ? </p> <p>leds and jtag are not an option. </p>
[ { "answer_id": 4675868, "author": "FractalSpace", "author_id": 175169, "author_profile": "https://Stackoverflow.com/users/175169", "pm_score": 2, "selected": false, "text": "target> gdbserver localhost:1234 <application>\n" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/71248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
71,254
<p>When viewing someone else's webpage containing an applet, how can I force Internet Explorer 6.0 to use a a particular JRE when I have several installed?</p>
[ { "answer_id": 71329, "author": "BrezzaP", "author_id": 11766, "author_profile": "https://Stackoverflow.com/users/11766", "pm_score": 2, "selected": false, "text": "<OBJECT \n classid=\"clsid:8AD9C840-044E-11D1-B3E9-00805F499D93\"\n width=\"200\" height=\"200\">\n <PARAM name=\"code\"...
2008/09/16
[ "https://Stackoverflow.com/questions/71254", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
71,257
<p>How do I suspend a whole process (like the Process Explorer does when I click Suspend) in C#.</p> <p>I'm starting the Process with Process.Start, and on a certain event, I want to suspend the process to be able to do some investigation on a "snapshot" of it.</p>
[ { "answer_id": 71457, "author": "Magnus Johansson", "author_id": 3584, "author_profile": "https://Stackoverflow.com/users/3584", "pm_score": 6, "selected": true, "text": " [Flags]\n public enum ThreadAccess : int\n {\n TERMINATE = (0x0001),\n SUSPEND_RESUME = (0x0002),\n ...
2008/09/16
[ "https://Stackoverflow.com/questions/71257", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9632/" ]
71,273
<p>Working with software day-to-day usually means you have to juggle project work, meetings, calls and other interrupts.</p> <p>What single technique, trick, or tool do you find most useful in managing your time?</p> <p>How do you stay focused?</p> <p>What is your single biggest distraction from your work?</p>
[ { "answer_id": 71443, "author": "Johan", "author_id": 11347, "author_profile": "https://Stackoverflow.com/users/11347", "pm_score": 2, "selected": false, "text": "C:\\windows\\system32\\cmd.exe /C \"start /B msg jpretori /W /V \"15-minute check\"\"" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/71273", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11613/" ]
71,306
<p>The single timing column in the weblog naturally includes client transmission timing. For anamoly analysis, I want to differentiate pages that took excessive construction time from requests that simply had a slow client.</p> <p>For buffered pages, I've looked at the ASP.NET page lifecycle model and do not see where I can tap in and codewise measure just the page-processing time before the page is flushed to the client.</p> <p>I probably should have mentioned that my goal is production monitoring (not test or dev). In addition, the intent is to annotate the weblogs with this measurement for later analysis. Current we liberally annotate the weblogs with Response.AppendToLog(). I believe the desire to use Response.AppendToLog() somewhat limits my potential logpoints as for instance, the response-object is not viable in Application_EndRequest.</p> <p>Any insight would be appreciated.</p>
[ { "answer_id": 71632, "author": "Timothy Khouri", "author_id": 11917, "author_profile": "https://Stackoverflow.com/users/11917", "pm_score": 2, "selected": false, "text": "<%=DateTime.Now.Subtract(HttpContext.Current.Timestamp).TotalSeconds %>" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/71306", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11791/" ]
71,309
<p>for example this code</p> <pre><code>var html = "&lt;p&gt;This text is &lt;a href=#&gt; good&lt;/a&gt;&lt;/p&gt;"; var newNode = Builder.node('div',{className: 'test'},[html]); $('placeholder').update(newNode); </code></pre> <p>casues the p and a tags to be shown, how do I prevent them from being escaped?</p>
[ { "answer_id": 71371, "author": "Leo Lännenmäki", "author_id": 2451, "author_profile": "https://Stackoverflow.com/users/2451", "pm_score": 3, "selected": true, "text": "var a = Builder.node('div').update(\"<a href='#'>foo</a>\")\n" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/71309", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6892/" ]
71,323
<p>I'm trying to replace each <code>,</code> in the current file by a new line:</p> <pre><code>:%s/,/\n/g </code></pre> <p>But it inserts what looks like a <code>^@</code> instead of an actual newline. The file is not in DOS mode or anything.</p> <p>What should I do?</p> <p>If you are curious, like me, check the question <em><a href="https://stackoverflow.com/questions/71417/why-is-r-a-newline-for-vim">Why is \r a newline for Vim?</a></em> as well.</p>
[ { "answer_id": 71334, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 13, "selected": true, "text": "\\r" }, { "answer_id": 71342, "author": "Lasar", "author_id": 9438, "author_profile": "https://Sta...
2008/09/16
[ "https://Stackoverflow.com/questions/71323", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5190/" ]
71,328
<p>I have PHP configured so that magic quotes are on and register globals are off.</p> <p>I do my best to always call htmlentities() for anything I am outputing that is derived from user input.</p> <p>I also occasionally seach my database for common things used in xss attached such as...</p> <pre><code>&lt;script </code></pre> <p>What else should I be doing and how can I make sure that the things I am trying to do are <strong>always</strong> done.</p>
[ { "answer_id": 71358, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 2, "selected": false, "text": "Referer" }, { "answer_id": 71444, "author": "Michał Niedźwiedzki", "author_id": 2169, "author_prof...
2008/09/16
[ "https://Stackoverflow.com/questions/71328", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4012/" ]
71,365
<p>Presently, we've got several main projects each in their own repository. We will have to version-control up to a dozen additional projects. VisualSVN recommends to create 1 respository for our company and then vc all projects inside that. </p> <blockquote> <p>It's a good practice to create one repository for the entire company or department and store all your projects in this repository. Creating separate repository for each project is not a good idea because in that case you will not be able to perform Subversion operations like copy, diff and merge cross-project. <a href="http://www.visualsvn.com/support/topic/00017/" rel="nofollow noreferrer" title="Visualsvn.com">VisualSvn.com</a></p> </blockquote> <p>Currently we're using post-commit hooks to update the testing server with the latest commit and do other project specific actions (such as emailing certain people for one project but not for others) depending on which project has been committed.</p> <p>As post-commit runs for the whole repository, is this still possible in such a situation? How would I go about decerning which project has changes? filter folder structure?</p>
[ { "answer_id": 71543, "author": "Bruno De Fraine", "author_id": 6918, "author_profile": "https://Stackoverflow.com/users/6918", "pm_score": 1, "selected": false, "text": "post-commit" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/71365", "https://Stackoverflow.com", "https://Stackoverflow.com/users/997/" ]
71,374
<p>We need to optimize the text rendering for a C# <a href="http://en.wikipedia.org/wiki/Windows_Forms" rel="noreferrer">Windows Forms</a> application displaying a large number of small strings in an irregular grid. At any time there can be well over 5000 cells visible that update 4 times per second. The font family and size is consistent across the cells, though the color may vary from cell to cell, as will bold/italic/plain.</p> <p>I've seen conflicting information on the web about <code>TextRenderer.DrawText</code> vs. <code>Graphics.DrawString</code> being the fastest/best, which reduces to a <a href="http://en.wikipedia.org/wiki/Graphics_Device_Interface" rel="noreferrer">GDI</a> vs. <a href="http://en.wikipedia.org/wiki/Graphics_Device_Interface#GDI.2B" rel="noreferrer">GDI+</a> comparison at the <a href="http://en.wikipedia.org/wiki/Windows_API" rel="noreferrer">Win32</a> level. </p> <p>I've also seen radically different results on Windows XP vs. Windows Vista, but my main target is Windows XP. Articles promising great advances under <a href="http://en.wikipedia.org/wiki/.NET_Framework_3.0#.NET_Framework_3.0" rel="noreferrer">WinFX</a> and <a href="http://en.wikipedia.org/wiki/DirectX#DirectX_10" rel="noreferrer">DirectX 10</a> aren't helpful here :-)</p> <p>What's the best approach here? I'm not afraid of introducing a small C++/CLI layer and optimizing device context handling to squeeze out more performance, but I'd like some definitive advice about which direction to take.</p> <p>EDIT: Thanks for the initial responses. I'll be trying a combination of background bitmap rendering and sticking with the GDI equivalent calls.</p>
[ { "answer_id": 64655977, "author": "Chungalin", "author_id": 2989229, "author_profile": "https://Stackoverflow.com/users/2989229", "pm_score": 0, "selected": false, "text": "ExtTextOut" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/71374", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6996/" ]
71,413
<p>Given a table of votes (users vote for a choice, and must supply an email address):</p> <pre><code>votes -- id: int choice: int timestamp: timestamp ip: varchar email: varchar </code></pre> <p>What's the best way to count "unique" votes (a user being a unique combination of email + ip) given the constraint they may only vote <em>twice</em> per hour?</p> <p>It's possible to count the number of hours between first and last vote and determine the maximum number of allowed votes for that timeframe, but that allows users to compress all their votes into say, a single hour-long window, and still have them counted.</p> <p>I realize anonymous online voting is inherently flawed, but I'm not sure how to do this with SQL. Should I be using an external script or whatever instead? (For each choice, for each email+ip pair, get a vote, calculate the next +1h timestamp, count/discard/tally votes, move on to the next hour, etc...)</p>
[ { "answer_id": 71430, "author": "Galwegian", "author_id": 3201, "author_profile": "https://Stackoverflow.com/users/3201", "pm_score": 2, "selected": false, "text": "select email, ip, count(choice)\nfrom votes\ngroup by email, ip, datepart(hour, timestamp)\n" }, { "answer_id": 714...
2008/09/16
[ "https://Stackoverflow.com/questions/71413", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
71,416
<p>I'm trying to do something like the following:</p> <pre><code>enum E; void Foo(E e); enum E {A, B, C}; </code></pre> <p>which the compiler rejects. I've had a quick look on Google and the consensus seems to be "you can't do it", but I can't understand why. Can anyone explain?</p> <p>Clarification 2: I'm doing this as I have private methods in a class that take said enum, and I do not want the enum's values exposed - so, for example, I do not want anyone to know that E is defined as</p> <pre><code>enum E { FUNCTIONALITY_NORMAL, FUNCTIONALITY_RESTRICTED, FUNCTIONALITY_FOR_PROJECT_X } </code></pre> <p>as project X is not something I want my users to know about.</p> <p>So, I wanted to forward declare the enum so I could put the private methods in the header file, declare the enum internally in the cpp, and distribute the built library file and header to people.</p> <p>As for the compiler - it's GCC.</p>
[ { "answer_id": 71961, "author": "Laurie Cheers", "author_id": 12066, "author_profile": "https://Stackoverflow.com/users/12066", "pm_score": 3, "selected": false, "text": "typedef unsigned long E;\n\nvoid Foo(E e);\n" }, { "answer_id": 72599, "author": "KJAWolf", "author_i...
2008/09/16
[ "https://Stackoverflow.com/questions/71416", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11437/" ]
71,417
<p>From question <em><a href="https://stackoverflow.com/questions/71323/how-to-replace-a-character-for-a-newline-in-vim">How to replace a character for a newline in Vim?</a></em>. You have to use \r when replacing text for a newline, like this</p> <pre><code>:%s/%/\r/g </code></pre> <p>But when replacing end of lines and newlines for a character, you can do it like:</p> <pre><code>:%s/\n/%/g </code></pre> <p>What section of the manual documents these behaviors, and what's the reasoning behind them?</p>
[ { "answer_id": 71531, "author": "Aristotle Pagaltzis", "author_id": 9410, "author_profile": "https://Stackoverflow.com/users/9410", "pm_score": 6, "selected": false, "text": ":help NL-used-for-Nul" }, { "answer_id": 73438, "author": "pjz", "author_id": 8002, "author_p...
2008/09/16
[ "https://Stackoverflow.com/questions/71417", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5190/" ]
71,419
<p>I've heard many programmers, particularly Delphi programmers scorn the use of 'with'. </p> <p>I thought it made programs run faster (only one reference to parent object) and that it was easier to read the code if used sensibly (less than a dozen lines of code and no nesting).</p> <p>Here's an example:</p> <pre><code>procedure TBitmap32.FillRectS(const ARect: TRect; Value: TColor32); begin with ARect do FillRectS(Left, Top, Right, Bottom, Value); end; </code></pre> <p>I like using <code>with</code>. What's wrong with me?</p>
[ { "answer_id": 71470, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 4, "selected": false, "text": "." }, { "answer_id": 71471, "author": "Lars Truijens", "author_id": 1242, "author_profile": "https...
2008/09/16
[ "https://Stackoverflow.com/questions/71419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11781/" ]
71,423
<p>I want to disable the selection of certain rows in a datagridview.</p> <p>It must be possible to remove the select property for one or more datagridview rows in a datagridview shown in a winform. The goal is that the user can't select certain rows. (depending on a condition)</p> <p>Thankx,</p>
[ { "answer_id": 71665, "author": "szevvy", "author_id": 11437, "author_profile": "https://Stackoverflow.com/users/11437", "pm_score": 5, "selected": true, "text": "public class MyDataGridView : DataGridView\n{\n protected override void SetSelectedRowCore(int rowIndex, bool selected)\n ...
2008/09/16
[ "https://Stackoverflow.com/questions/71423", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4392/" ]
71,440
<p>I have a UserControl in my Asp.net project that has a public property. I do not want this property to show up in the Visual Studio Property Window when a user highlights an instance of the UserControl in the IDE. What attribute (or other method) should I use to prevent it from showing up?</p> <pre><code>class MyControl : System.Web.UI.UserControl { // Attribute to prevent property from showing in VS Property Window? public bool SampleProperty { get; set; } // other stuff } </code></pre>
[ { "answer_id": 71454, "author": "Phil Wright", "author_id": 6276, "author_profile": "https://Stackoverflow.com/users/6276", "pm_score": 5, "selected": true, "text": "using System.ComponentModel;\n\n[Browsable(false)]\npublic bool SampleProperty { get; set; }\n" }, { "answer_id": ...
2008/09/16
[ "https://Stackoverflow.com/questions/71440", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51/" ]
71,468
<p>Does anybody know of a tool to test OCSP responses? Preferably, something that can be used from a Windows Command-line and/or can be included (easily) in a Java/python program </p>
[ { "answer_id": 72957, "author": "JJarava", "author_id": 12344, "author_profile": "https://Stackoverflow.com/users/12344", "pm_score": 3, "selected": true, "text": "openssl ocsp -whatever\n" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/71468", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
71,469
<p>Let's assume we've got the following Java code:</p> <pre><code>public class Maintainer { private Map&lt;Enum, List&lt;Listener&gt;&gt; map; public Maintainer() { this.map = new java.util.ConcurrentHashMap&lt;Enum, List&lt;Listener&gt;&gt;(); } public void addListener( Listener listener, Enum eventType ) { List&lt;Listener&gt; listeners; if( ( listeners = map.get( eventType ) ) == null ) { listeners = new java.util.concurrent.CopyOnWriteArrayList&lt;Listener&gt;(); map.put( eventType, listeners ); } listeners.add( listener ); } } </code></pre> <p>This code snippet is nothing but a bit improved listener pattern where each listener is telling what type of event it is interested in, and the provided method maintains a concurrent map of these relationships.</p> <p>Initially, I wanted this method to be called via my own annotation framework, but bumped into a brick wall of various annotation limitations (e.g. you can't have <em>java.lang.Enum</em> as annotation param, also there's a set of various classloader issues) therefore decided to use Spring.</p> <p>Could anyone tell me how do I Spring_ify_ this? What I want to achive is:<br> 1. Define <em>Maintainer</em> class as a Spring bean.<br> 2. Make it so that all sorts of listeners would be able to register themselves to <em>Maintainer</em> via XML by using <em>addListener</em> method. Spring doc nor Google are very generous in examples.</p> <p>Is there a way to achieve this easily?</p>
[ { "answer_id": 73129, "author": "Alexandre Victoor", "author_id": 11897, "author_profile": "https://Stackoverflow.com/users/11897", "pm_score": 0, "selected": false, "text": "public @interface MyAnnotation {\n MyEnum value();\n}\n" }, { "answer_id": 75192, "author": "flick...
2008/09/16
[ "https://Stackoverflow.com/questions/71469", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7345/" ]
71,475
<p>I have created a namespace extension that is rooted under Desktop. The main purpose of the extension is to provide a virtual list of ZIP files that represent a list of configurable directories. When the user clicks one of the those items the contents of the related directory are zipped in place and the resulting ZIP file is stored in a cache folder.</p> <p>All this works well aside a minor issue. If we go to Windows Explorer, open the extension and double click an item the opened file is the one from the cache. [CORRECT]</p> <p>If on the other hand we open it by an Open Dialog the opened file is one from a Temporary Internet files directory. [INCORRECT]</p> <p>What do I have to change for the Open Dialog (when used for example trough notepad.exe) to open the file from the cache folder and not from Temporary Internet files. I have tried to send allways the qualified file name in IShellFolder::GetDisplayNameOf but without any luck.</p>
[ { "answer_id": 73129, "author": "Alexandre Victoor", "author_id": 11897, "author_profile": "https://Stackoverflow.com/users/11897", "pm_score": 0, "selected": false, "text": "public @interface MyAnnotation {\n MyEnum value();\n}\n" }, { "answer_id": 75192, "author": "flick...
2008/09/16
[ "https://Stackoverflow.com/questions/71475", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6508/" ]
71,478
<p>Is it possible in <code>PHP (as it is in C++)</code> to declare a <code>class method</code> OUTSIDE the <code>class definition?</code></p>
[ { "answer_id": 71545, "author": "Michał Niedźwiedzki", "author_id": 2169, "author_profile": "https://Stackoverflow.com/users/2169", "pm_score": 3, "selected": false, "text": "__call" }, { "answer_id": 71551, "author": "Paul Dixon", "author_id": 6521, "author_profile":...
2008/09/16
[ "https://Stackoverflow.com/questions/71478", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
71,488
<p>I've currently got a set of reports with a number of common functions sitting in code blocks within the .rdl files. This obviously presents a maintainability issue and I as wondering if anyone knew a way for these different reports to share a library of common code?</p> <p>Ideally I'd like to have a .Net Assembly attached to my Reporting Services project, which all of my reports can access and call functions from. This would save the headache of trying to update and redeploy about 100 reports every time a change needs to be made to a common function.</p> <p>Any suggestions?</p>
[ { "answer_id": 1546774, "author": "Daver", "author_id": 68095, "author_profile": "https://Stackoverflow.com/users/68095", "pm_score": 2, "selected": false, "text": "<CodeGroup class=\"UnionCodeGroup\"\n version=\"1\"\n PermissionSetName=\"FullTrust\"\n Name=\"MyCodeGroup\"\n Desc...
2008/09/16
[ "https://Stackoverflow.com/questions/71488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4019/" ]
71,491
<p>I'm planning to write a simple J2SE application to aggregate information from multiple web sources.</p> <p>The most difficult part, I think, is extraction of meaningful information from web pages, if it isn't available as RSS or Atom feeds. For example, I might want to extract a list of questions from stackoverflow, but I absolutely don't need that huge tag cloud or navbar.</p> <p>What technique/library would you advice?</p> <p><strong>Updates/Remarks</strong></p> <ul> <li>Speed doesn't matter — as long as it can parse about 5MB of HTML in less than 10 minutes.</li> <li>It sould be really simple.</li> </ul>
[ { "answer_id": 71577, "author": "Vhaerun", "author_id": 11234, "author_profile": "https://Stackoverflow.com/users/11234", "pm_score": 0, "selected": false, "text": "GET /file.html HTTP/1.0\nHost: site.com\n<ENTER>\n<ENTER>\n" }, { "answer_id": 71690, "author": "Joe Liversedge...
2008/09/16
[ "https://Stackoverflow.com/questions/71491", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1764/" ]
71,518
<p>I just tried FxCop. It does detect unused private methods, but not unused public. Is there a custom rule that I can download, plug-in that will detect public methods that aren't called from within the same assembly?</p>
[ { "answer_id": 71730, "author": "Keith", "author_id": 905, "author_profile": "https://Stackoverflow.com/users/905", "pm_score": 3, "selected": false, "text": "public" }, { "answer_id": 71929, "author": "user7116", "author_id": 7116, "author_profile": "https://Stackove...
2008/09/16
[ "https://Stackoverflow.com/questions/71518", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9328/" ]
71,534
<p>I hope I haven't painted myself into a corner. I've gotten what seems to be most of the way through implementing a Makefile and I can't get the last bit to work. I hope someone here can suggest a technique to do what I'm trying to do.</p> <p>I have what I'll call "bills of materials" in version controlled files in a source repository and I build something like:</p> <pre><code>make VER=x </code></pre> <p>I want my Makefile to use $(VER) as a tag to retrieve a BOM from the repository, generate a dependency file to include in the Makefile, rescan including that dependency, and then build the product. </p> <p>More generally, my Makefile may have several targets -- A, B, C, etc. -- and I can build different versions of each so I might do:</p> <pre><code>make A VER=x make B VER=y make C VER=z </code></pre> <p>and the dependency file includes information about all three targets.</p> <p>However, creating the dependency file is somewhat expensive so if I do:</p> <pre><code>make A VER=x ...make source (not BOM) changes... make A VER=x </code></pre> <p>I'd really like the Makefile to not regenerate the dependency. And just to make things as complicated as possible, I might do:</p> <pre><code>make A VER=x .. change version x of A's BOM and check it in make A VER=x </code></pre> <p>so I need to regenerate the dependency on the second build.</p> <p>The check out messes up the timestamps used to regenerate the dependencies so I think I need a way for the dependency file to depend not on the BOM but on some indication that the BOM changed.</p> <p>What I've come to is making the BOM checkout happen in a .PHONY target (so it always gets checked out) and keeping track of the contents of the last checkout in a ".sig" file (if the signature file is missing or the contents are different than the signature of the new file, then the BOM changed), and having the dependency generation depend on the signatures). At the top of my Makefile, I have some setup:</p> <pre><code>BOMS = $(addsuffix .bom,$(MAKECMDGOALS) SIGS = $(subst .bom,.sig,$(BOMS)) DEP = include.d -include $(DEP) </code></pre> <p>And it seems I always need to do:</p> <pre><code>.PHONY: $(BOMS) $(BOMS): ...checkout TAG=$(VER) $@ </code></pre> <p>But, as noted above, if i do just that, and continue:</p> <pre><code>$(DEP) : $(BOMS) ... recreate dependency </code></pre> <p>Then the dependency gets updated every time I invoke make. So I try:</p> <pre><code>$(DEP) : $(SIGS) ... recreate dependency </code></pre> <p>and</p> <pre><code>$(BOMS): ...checkout TAG=$(VER) $@ ...if $(subst .bom,.sig,$@) doesn't exist ... create signature file ...else ... if new signature is different from file contents ... update signature file ... endif ...endif </code></pre> <p>But the dependency generation doesn't get tripped when the signature changes. I think it's because because $(SIGS) isn't a target, so make doesn't notice when the $(BOMS) rule updates a signature.</p> <p>I tried creating a .sig:.bom rule and managing the timestamps of the checked out BOM with touch but that didn't work.</p> <p>Someone suggested something like:</p> <pre><code>$(DEP) : $(SIGS) ... recreate dependency $(BOMS) : $(SIGS) ...checkout TAG=$(VER) $@ $(SIGS) : ...if $(subst .bom,.sig,$(BOMS)) doesn't exist ... create it ...else ... if new signature is different from file contents ... update signature file ... endif ...endif </code></pre> <p>but how can the BOM depend on the SIG when the SIG is created from the BOM? As I read that it says, "create the SIG from the BOM and if the SIG is newer than the BOM then checkout the BOM". How do I bootstrap that process? Where does the first BOM come from?</p>
[ { "answer_id": 71623, "author": "mbyrne215", "author_id": 5241, "author_profile": "https://Stackoverflow.com/users/5241", "pm_score": 0, "selected": false, "text": "$(DEP) : $(SIGS)\n ... recreate dependency\n$(BOMS) : $(SIGS)\n ...checkout TAG=$(VER) $@\n$(SIGS) :\n ...if $(sub...
2008/09/16
[ "https://Stackoverflow.com/questions/71534", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7685/" ]
71,561
<p>In a web interface, I've got a text field. When user enters text and accepts with enter, application performs an action.</p> <p>I wanted to test the behavior with Selenium. Unfortunately, invoking 'keypress' with chr(13) insert representation of the character into the field.</p> <p>Is there a way other then submitting the form? I'd like to mimic intended user interaction, without any shortcuts...</p>
[ { "answer_id": 71902, "author": "noah", "author_id": 12034, "author_profile": "https://Stackoverflow.com/users/12034", "pm_score": 4, "selected": true, "text": "selenium.keyDown(id, \"\\\\13\");\n" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/71561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9622/" ]
71,565
<p>If I have the following:</p> <pre><code>Public Class Product Public Id As Integer Public Name As String Public AvailableColours As List(Of Colour) Public AvailableSizes As List(Of Size) End Class </code></pre> <p>and I want to get a list of products from the database and display them on a page along with their available sizes and colours, should I </p> <ol> <li>have one method (GetProducts()) which makes use of a single view that joins the relevant tables, that then loops through each row and creates the objects as required? Or…</li> <li>have several methods which are responsible only for creating one object each? eg. GetProducts(), GetAvailableColoursForProduct(id), etc</li> </ol> <p>I'm currently doing a) but as I add other other properties (multiple images, optional tassels, etc) the code is getting very messy (having to check that this isn't the same product as the previous row, has this colour already been added, etc) so I'm tempted to go with b) however, this will really ramp up the number of round trips to the database.</p>
[ { "answer_id": 71624, "author": "Bob Dizzle", "author_id": 9581, "author_profile": "https://Stackoverflow.com/users/9581", "pm_score": 0, "selected": false, "text": "Public static function Load(Id as integer) as Product\n\nProduct.Load(Id)\n" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/71565", "https://Stackoverflow.com", "https://Stackoverflow.com/users/984/" ]
71,578
<p>I have a database in ISO-8859-2 format, but I need to create XML in UTF-8. This means that I must encode the database before prinitng in UTF-8. I know very little about ASP.Net, so I'm hoping someone can help.</p> <p>In PHP I would do something like this:</p> <pre><code>db_connect(); mysql_query("SET NAMES 'UTF8'"); mysql_query("SET character_set_client='UTF8'"); </code></pre> <p>This is my ASP.Net code for database connection:</p> <pre><code> 'CONNECTION TO DATABASE dim dbconn,sql,dbcomm dbconn=New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" &amp; _ "Data Source=" &amp; Server.MapPath("../baze/test.mdb")) dbconn.Open() sql="SELECT * FROM nekretnine, tipovinekretnina WHERE nekretnine.idtipnekretnine = tipovinekretnina.idtipnekretnine ORDER BY nekretnine.idnekretnine" dbcomm=New OleDbCommand(sql,dbconn) dbread=dbcomm.ExecuteReader() while dbread.Read() </code></pre> <p>Where and how do I encode to UTF-8?</p>
[ { "answer_id": 71640, "author": "Omer van Kloeten", "author_id": 4979, "author_profile": "https://Stackoverflow.com/users/4979", "pm_score": 3, "selected": true, "text": "str" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/71578", "https://Stackoverflow.com", "https://Stackoverflow.com/users/205368/" ]
71,585
<p>Since generics were introduced, Class is parametrized, so that List.class produces Class&lt;List>. This is clear.</p> <p>What I am not able to figure out is how to get a instance of Class of type which is parametrized itself, i.e. Class&lt;List&lt;String>>. Like in this snippet:</p> <pre><code>public class GenTest { static &lt;T&gt; T instantiate(Class&lt;T&gt; clazz) throws Exception { return clazz.newInstance(); } public static void main(String[] args) throws Exception { // Is there a way to avoid waring on the line below // without using @SuppressWarnings("unchecked")? // ArrayList.class is Class&lt;ArrayList&gt;, but I would like to // pass in Class&lt;ArrayList&lt;String&gt;&gt; ArrayList&lt;String&gt; l = GenTest.instantiate(ArrayList.class); } } </code></pre> <p>I run into variations of this problem quite often and I still don't know, if I just miss something, or if there is really no better way. Thanks for suggestions.</p>
[ { "answer_id": 71795, "author": "Dan Dyer", "author_id": 5171, "author_profile": "https://Stackoverflow.com/users/5171", "pm_score": 1, "selected": false, "text": "public class GenTest\n{\n private static <E> List<E> createList()\n {\n return new ArrayList<E>();\n }\n\n ...
2008/09/16
[ "https://Stackoverflow.com/questions/71585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7135/" ]
71,590
<p>With this code I can show an animated gif while the server script is running:</p> <pre><code>function calculateTotals() { $('#results').load('getResults.php', null, showStatusFinished); showLoadStatus(); } function showLoadStatus() { $('#status').html(''); } function showStatusFinished() { $('#status').html('Finished.'); } </code></pre> <p>However, I would like to display a status of how far along the script is, e.g. "Processing line 342 of 20000..." and have it count up until it is finished.</p> <p>How can I do that? I can make a server-script which constantly contains the updated information but where do I put the command to read this, say, every second?</p>
[ { "answer_id": 165872, "author": "matdumsa", "author_id": 1775, "author_profile": "https://Stackoverflow.com/users/1775", "pm_score": 3, "selected": true, "text": "function getStatus() {\n $.getJSON(\"/status.php\",{\"session\":0, \"requestID\":12345}, \n function(data) { //data is...
2008/09/16
[ "https://Stackoverflow.com/questions/71590", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4639/" ]
71,608
<p>How do you set up your .NET development tree? I use a structure like this:</p> <pre><code>-projectname --config (where I put the configuration files) --doc (where I put all the document concerning the project: e-mails, documentation) --tools (all the tools I use: Nunit, Moq) --lib (all the libraries used by the solution: ninject or autofac) --src ---app (sourcefiles) ---test (unittests) solutionfile.sln build.csproj </code></pre> <p>The sign "-" marks directories.</p> <p>I think it's very important to have a good structure on this stuff. You should be able to get the source code from the source control system and then build the solution without opening Visual Studio or installing any third party libraries. </p> <p>Any thoughts on this?</p>
[ { "answer_id": 71738, "author": "Curro", "author_id": 10688, "author_profile": "https://Stackoverflow.com/users/10688", "pm_score": 0, "selected": false, "text": "\nsolutionfile.sln\n-src\n--projectname\n---config\n---doc\n---source files (structure representing namespaces)\n-test\n--tes...
2008/09/16
[ "https://Stackoverflow.com/questions/71608", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4093/" ]
71,625
<p>I have just found a static nested interface in our code-base.</p> <pre><code>class Foo { public static interface Bar { /* snip */ } /* snip */ } </code></pre> <p>I have never seen this before. The original developer is out of reach. Therefore I have to ask SO:</p> <p>What are the semantics behind a static interface? What would change, if I remove the <code>static</code>? Why would anyone do this?</p>
[ { "answer_id": 71654, "author": "Clinton Dreisbach", "author_id": 6262, "author_profile": "https://Stackoverflow.com/users/6262", "pm_score": 3, "selected": false, "text": "Foo.Bar" }, { "answer_id": 71708, "author": "Skizz", "author_id": 1898, "author_profile": "http...
2008/09/16
[ "https://Stackoverflow.com/questions/71625", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1870/" ]
71,643
<p>Currently I monitoring a particular file with a simple shell one-liner:</p> <pre><code>filesize=$(ls -lah somefile | awk '{print $5}') </code></pre> <p>I'm aware that Perl has some nice modules to deal with Excel files so the idea is to, let's say, run that check daily, perhaps with cron, and write the result on a spreadsheet for further statistical use.</p>
[ { "answer_id": 71668, "author": "Aristotle Pagaltzis", "author_id": 9410, "author_profile": "https://Stackoverflow.com/users/9410", "pm_score": 3, "selected": false, "text": "-s" }, { "answer_id": 72229, "author": "Michael Cramer", "author_id": 1496728, "author_profil...
2008/09/16
[ "https://Stackoverflow.com/questions/71643", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6992/" ]
71,647
<p>I have an ASP.Net 2.0 application in which the Session_Start event is not firing in my Global.asax file. Can anyone tell why this is happening and how I can get it working?</p> <p>The application worked fine on my Windows XP development machine, but stopped working when deployed to the server (Win Server 2003/IIS 6/ASP.Net 2.0). </p> <p>I'm not sure if this is relevant, but the server also hosts a SharePoint installation (WSS 3.0) which I know does change some settings at the default web site level.</p>
[ { "answer_id": 192433, "author": "craigmoliver", "author_id": 12252, "author_profile": "https://Stackoverflow.com/users/12252", "pm_score": 1, "selected": false, "text": "<session />" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/71647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1052/" ]
71,692
<p>I'm building small web site in Java (Spring MVC with JSP views) and am trying to find best solution for making and including few reusable modules (like "latest news" "upcoming events"...).</p> <p>So the question is: Portlets, tiles or some other technology?</p>
[ { "answer_id": 71807, "author": "jodonnell", "author_id": 4223, "author_profile": "https://Stackoverflow.com/users/4223", "pm_score": 1, "selected": false, "text": "public class MyApplication implements EntryPoint, HistoryListener\n{\n static final String INIT_STATE = \"status\";\n\n ...
2008/09/16
[ "https://Stackoverflow.com/questions/71692", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11890/" ]
71,694
<p>Is there an api to bring the vista side bar to the front (Win+Space) programatically and to do the reverse (send it to the back ground).</p>
[ { "answer_id": 71785, "author": "Cory", "author_id": 11870, "author_profile": "https://Stackoverflow.com/users/11870", "pm_score": 1, "selected": false, "text": "SetWindowPos(sidebarHandle, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NORESIZE);\n" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/71694", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11930/" ]
71,720
<p>I've been using OpenGL for years, but after trying to use D3D for the first time, I wasted a significant amount of time trying figure out how to make my scene lights stay fixed in the world rather than fixed on my objects.</p> <p>In OpenGL light positions get transformed just like everything else with the MODELVIEW matrix, so to get lights fixed in space, you set up your MODELVIEW the way you want for the lights, and call glLightPosition then set it up for your geometry and make geometry calls. In D3D that doesn't help.</p> <p>(Comment -- I eventually figured out the answer to this one, but I couldn't find anything helpful on the web or in the MSDN. It would have saved me a few hours of head scratching if I could have found this answer then.)</p>
[ { "answer_id": 71802, "author": "Baxissimo", "author_id": 9631, "author_profile": "https://Stackoverflow.com/users/9631", "pm_score": 2, "selected": false, "text": "MODELVIEW" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/71720", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9631/" ]
71,740
<p>in our application we have a Java applet running inside a .NET browser control. It is a know issue from Sun that running an applet this way may crash the control.</p> <p>Has anyone come across the same problem and solved it?</p> <p>Atm we are running the applet in a Webbrowser but we need to run it in a browser control.</p> <p>Thx for any help.</p>
[ { "answer_id": 72084, "author": "Mike", "author_id": 1115144, "author_profile": "https://Stackoverflow.com/users/1115144", "pm_score": 0, "selected": false, "text": "Here is a link - http://msdn.microsoft.com/en-us/library/aa290083(VS.71).aspx\n" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/71740", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11946/" ]
71,756
<p>If I remove all the ' characters from a SQL query, is there some other way to do a SQL injection attack on the database?</p> <p>How can it be done? Can anyone give me examples?</p>
[ { "answer_id": 71780, "author": "Bob Dizzle", "author_id": 9581, "author_profile": "https://Stackoverflow.com/users/9581", "pm_score": 2, "selected": false, "text": "5; drop table employees; --" }, { "answer_id": 71782, "author": "Leigh Caldwell", "author_id": 3267, ...
2008/09/16
[ "https://Stackoverflow.com/questions/71756", "https://Stackoverflow.com", "https://Stackoverflow.com/users/184/" ]
71,766
<p>In Delphi, I want to be able to create an private object that's associated with a class, and access it from all instances of that class. In Java, I'd use:</p> <pre><code>public class MyObject { private static final MySharedObject mySharedObjectInstance = new MySharedObject(); } </code></pre> <p>Or, if MySharedObject needed more complicated initialization, in Java I could instantiate and initialize it in a static initializer block.</p> <p>(You might have guessed... I know my Java but I'm rather new to Delphi...)</p> <p>Anyway, I don't want to instantiate a new MySharedObject each time I create an instance of MyObject, but I do want a MySharedObject to be accessible from each instance of MyObject. (It's actually logging that has spurred me to try to figure this out - I'm using Log4D and I want to store a TLogLogger as a class variable for each class that has logging functionality.)</p> <p>What's the neatest way to do something like this in Delphi?</p>
[ { "answer_id": 71811, "author": "CL.", "author_id": 11654, "author_profile": "https://Stackoverflow.com/users/11654", "pm_score": 0, "selected": false, "text": "implementation" }, { "answer_id": 71841, "author": "squadette", "author_id": 7754, "author_profile": "https...
2008/09/16
[ "https://Stackoverflow.com/questions/71766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11961/" ]
71,775
<p>I have to read data from some files and insert the data into different tables in a database. Is Unix shell script powerful enough to do the job?</p> <p>Is it easy to do the job in shell script or should I go about doing this in Java?</p>
[ { "answer_id": 71789, "author": "Josti", "author_id": 11231, "author_profile": "https://Stackoverflow.com/users/11231", "pm_score": 0, "selected": false, "text": "echo \"INSERT INTO foo (b,a,r) VALUES (1,2,3);\" | \n mysql -u user -psecret -h host database\n" }, { "answer_id":...
2008/09/16
[ "https://Stackoverflow.com/questions/71775", "https://Stackoverflow.com", "https://Stackoverflow.com/users/184/" ]
71,776
<p>I have 16,000 jpg's from a webcan screeb grabber that I let run for a year pointing into the back year. I want to find a way to grab every 4th image so that I can then put them into another directory so I can later turn them into a movie. Is there a simple bash script or other way under linux that I can do this.</p> <p>They are named like so......</p> <p>frame-44558.jpg</p> <p>frame-44559.jpg</p> <p>frame-44560.jpg</p> <p>frame-44561.jpg</p> <p>Thanks from a newb needing help.</p> <hr> <p>Seems to have worked. Couple of errors in my origonal post. There were actually 280,000 images and the naming was. /home/baldy/Desktop/webcamimages/webcam_2007-05-29_163405.jpg /home/baldy/Desktop/webcamimages/webcam_2007-05-29_163505.jpg /home/baldy/Desktop/webcamimages/webcam_2007-05-29_163605.jpg</p> <p>I ran. cp $(ls | awk '{nr++; if (nr % 10 == 0) print $0}') ../newdirectory/</p> <p>Which appears to have copied the images. 70-900 per day from the looks of it.</p> <p>Now I'm running mencoder mf://*.jpg -mf w=640:h=480:fps=30:type=jpg -ovc lavc -lavcopts vcodec=msmpeg4v2 -nosound -o ../output-msmpeg4v2.avi</p> <p>I'll let you know how the movie works out.</p> <p>UPDATE: Movie did not work. Only has images from 2007 in it even though the directory has 2008 as well. webcam_2008-02-17_101403.jpg webcam_2008-03-27_192205.jpg webcam_2008-02-17_102403.jpg webcam_2008-03-27_193205.jpg webcam_2008-02-17_103403.jpg webcam_2008-03-27_194205.jpg webcam_2008-02-17_104403.jpg webcam_2008-03-27_195205.jpg</p> <p>How can I modify my mencoder line so that it uses all the images?</p>
[ { "answer_id": 71798, "author": "Pat", "author_id": 238, "author_profile": "https://Stackoverflow.com/users/238", "pm_score": 1, "selected": false, "text": "ls -1 /path/to/files/ | perl -e 'while (<STDIN>) {($seq)=/(\\d*)\\.jpg$/; print $_ if $seq && $seq % 4 ==0}'\n" }, { "answe...
2008/09/16
[ "https://Stackoverflow.com/questions/71776", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11950/" ]
71,788
<p>I'm writing an Emacs major mode for an APL dialect I use at work. I've gotten basic font locking to work, and after setting comment-start and comment-start-skip, comment/uncomment region and fill paragraph also work.</p> <p>However, comment blocks often contain javadoc style comments and i would like fill-paragraph to avoid glueing together lines starting with such commands.</p> <p>If I have this (\ instead of javadoc @):</p> <pre><code># This is a comment that is long and should be wrapped. # \arg Description of argument # \ret Description of return value </code></pre> <p>M-q gives me:</p> <pre><code># This is a comment that is long and # should be wrapped. \arg Description # of argument \ret Description of # return value </code></pre> <p>But I want:</p> <pre><code># This is a comment that is long and # should be wrapped. # \arg Description of argument # \ret Description of return value </code></pre> <p>I've tried setting up paragraph-start and paragraph-separate to appropriate values, but fill-paragraph still doesn't work inside a comment block. If I remove the comment markers, M-q works as I want to, so the regexp I use for paragraph-start seems to work.</p> <p>Do I have to write a custom fill-paragraph for my major mode? cc-mode has one that handles cases like this, but it's really complex, I'd like to avoid it if possible. </p>
[ { "answer_id": 72637, "author": "Allen", "author_id": 6043, "author_profile": "https://Stackoverflow.com/users/6043", "pm_score": 1, "selected": false, "text": "fill-paragraph-function" }, { "answer_id": 145431, "author": "Joakim Hårsman", "author_id": 11978, "author_...
2008/09/16
[ "https://Stackoverflow.com/questions/71788", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11978/" ]
71,817
<p>The problem: I have a class which contains a template method <code>execute</code> which calls another method <code>_execute</code>. Subclasses are supposed to overwrite <code>_execute</code> to implement some specific functionality. This functionality should be documented in the docstring of <code>_execute</code>. Advanced users can create their own subclasses to extend the library. However, another user dealing with such a subclass should only use <code>execute</code>, so he won't see the correct docstring if he uses <code>help(execute)</code>.</p> <p>Therefore it would be nice to modify the base class in such a way that in a subclass the docstring of <code>execute</code> is automatically replaced with that of <code>_execute</code>. Any ideas how this might be done?</p> <p>I was thinking of metaclasses to do this, to make this completely transparent to the user.</p>
[ { "answer_id": 72126, "author": "John Montgomery", "author_id": 5868, "author_profile": "https://Stackoverflow.com/users/5868", "pm_score": 0, "selected": false, "text": "__doc__" }, { "answer_id": 72192, "author": "dF.", "author_id": 3002, "author_profile": "https://...
2008/09/16
[ "https://Stackoverflow.com/questions/71817", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11992/" ]
71,820
<p>I need a function called <code>SizeOfPipe()</code> which should return the size of a pipe - I only want to know how much data is in the pipe and not actually read data off the pipe itself. </p> <p>I thought the following code would work:</p> <pre><code>fseek (pPipe, 0 , SEEK_END); *pBytes = ftell (pPipe); rewind (pPipe); </code></pre> <p>but <code>fseek()</code> doesn't work on file descriptors. Another option would be to read the pipe then write the data back but would like to avoid this if possible. Any suggestions?</p>
[ { "answer_id": 71925, "author": "CL.", "author_id": 11654, "author_profile": "https://Stackoverflow.com/users/11654", "pm_score": 3, "selected": false, "text": "st_size" }, { "answer_id": 77381, "author": "MSN", "author_id": 6210, "author_profile": "https://Stackoverf...
2008/09/16
[ "https://Stackoverflow.com/questions/71820", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
71,838
<p>Does anyone know if the Infragistics UltraGrid control provides functionality similar to that of DataGridView.HitTestInfo?</p>
[ { "answer_id": 72466, "author": "Andrew", "author_id": 5662, "author_profile": "https://Stackoverflow.com/users/5662", "pm_score": 0, "selected": false, "text": ".MousePosition" }, { "answer_id": 72687, "author": "Ryan Spears", "author_id": 11948, "author_profile": "h...
2008/09/16
[ "https://Stackoverflow.com/questions/71838", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11948/" ]
71,853
<p>I'm using an Xml field in my Sql Server database table. I'm trying to search a word using the XQuery <strong>contains</strong> method but it seems to search <strong>only</strong> in case sensitive mode. The lower method isn't implemented on Sql Server XQuery implementation also. ¿Is there a simple solution to this problem?</p>
[ { "answer_id": 74594, "author": "JWHEAT", "author_id": 7079, "author_profile": "https://Stackoverflow.com/users/7079", "pm_score": 3, "selected": true, "text": "DECLARE @x xml = N'abcDEF!@4';\nSELECT @x.value('fn:upper-case(/text()[1])', 'nvarchar(10)');\n" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/71853", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
71,864
<p>I want to delete all but the 4 newest directories in my parent directory. How would you do this in Bash?</p>
[ { "answer_id": 71891, "author": "Leigh Caldwell", "author_id": 3267, "author_profile": "https://Stackoverflow.com/users/3267", "pm_score": 4, "selected": true, "text": "ls -atrd */ | head --lines=-4 | xargs rm -rf\n" }, { "answer_id": 71972, "author": "mana", "author_id":...
2008/09/16
[ "https://Stackoverflow.com/questions/71864", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12015/" ]
71,899
<p>I'm trying to write a simple audio player for a website, and am using the EMBED... tag to embed the audio and setting HIDDEN="true" and using various javascript commands to control the audio playback. It works fine for realplayer and mplayer but the quicktime plugin doesn't respond to javascript if the hidden bit is set - is there any workaround for this?</p>
[ { "answer_id": 72107, "author": "p4bl0", "author_id": 12043, "author_profile": "https://Stackoverflow.com/users/12043", "pm_score": 2, "selected": false, "text": "object" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/71899", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
71,913
<p>Here is a sample from Kernighan &amp; Ritchie's "The C Programming Language":</p> <pre><code>int getline(char s[], int lim) { int c, i = 0; while (--lim &gt; 0; &amp;&amp; (c=getchar()) !=EOF &amp;&amp; c !='\n') { s[i++] = c; } if (c =='\n') { s[i++] = c; } s[i] = '\0'; return i; } </code></pre> <p>Why do we should check if <code>c != '\n'</code>, despite we use <code>s[i++] = c</code> after that?</p>
[ { "answer_id": 71988, "author": "aku", "author_id": 1196, "author_profile": "https://Stackoverflow.com/users/1196", "pm_score": 0, "selected": false, "text": "int getline(char s[], int lim)\n{\n int c, i;\n i=0;\n /* While staying withing limit and there is a char in stdin and it's...
2008/09/16
[ "https://Stackoverflow.com/questions/71913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11972/" ]
71,920
<p>How to implement a website with a recommendation system similar to stackoverflow/digg/reddit? I.e., users submit content and the website needs to calculate some sort of "hotness" according to how popular the item is. The flow is as follows:</p> <ul> <li>Users submit content</li> <li>Other users view and vote on the content (assume 90% of the users only views content and 10% actively votes up or down on content)</li> <li>New content is continuously submitted</li> </ul> <p>How do I implement an algorithm that calculates the "hotness" of a submitted item, preferably in real-time? Are there any best-practices or design patterns?</p> <p>I would assume that the algorithm takes the following into consideration:</p> <ul> <li>When an item was submitted</li> <li>When each vote was cast</li> <li>When the item was viewed</li> </ul> <p>E.g. an item that gets a constant trickle of votes would stay somewhat "hot" constantly while an item that receives a burst of votes when it is first submitted will jump to the top of the "hotness"-list but then fall down as the votes stop coming in.</p> <p>(I am using a MySQL+PHP but I am interested in general design patterns).</p>
[ { "answer_id": 13159442, "author": "Chris Broski", "author_id": 468111, "author_profile": "https://Stackoverflow.com/users/468111", "pm_score": 1, "selected": false, "text": "SELECT id, title\nFROM videos\nORDER BY \n LOG10(ABS(cached_votes_total) + 1) * SIGN(cached_votes_total) \n ...
2008/09/16
[ "https://Stackoverflow.com/questions/71920", "https://Stackoverflow.com", "https://Stackoverflow.com/users/103373/" ]
71,932
<p>I'm missing the boat on something here, kids. This keeps rearing its head and I don't know what's going on with it, so I hope my homeys here can help.</p> <p>When working in Silverlight, when I create bindings in my c# code, they never hold up when the application is running. The declarative bindings from my xaml seem ok, but I'm doing something wrong when I create my bindings in C#. I'm hoping that there is something blindingly obvious I'm missing. Here's a typical binding that gets crushed:</p> <pre><code>TextBlock tb = new TextBlock(); Binding b = new Binding("FontSize"); b.Source = this; tb.SetBinding(TextBlock.FontSizeProperty, b); </code></pre>
[ { "answer_id": 72129, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 3, "selected": false, "text": "TextBlock tb = new TextBlock();\nBinding b = new Binding(\"FontSize\");\nb.Source = this;\ntb.SetBinding(TextBlock.FontSizeProp...
2008/09/16
[ "https://Stackoverflow.com/questions/71932", "https://Stackoverflow.com", "https://Stackoverflow.com/users/93/" ]
71,944
<p>I am using <code>&lt;input type="file" id="fileUpload" runat="server"&gt;</code> to upload a file in an ASP.NET application. I would like to limit the file type of the upload (example: limit to .xls or .xlsx file extensions). </p> <p>Both JavaScript or server-side validation are OK (as long as the server side validation would take place before the files are being uploaded - there could be some very large files uploaded, so any validation needs to take place before the actual files are uploaded).</p>
[ { "answer_id": 72013, "author": "staktrace", "author_id": 12050, "author_profile": "https://Stackoverflow.com/users/12050", "pm_score": 3, "selected": false, "text": "<form onsubmit=\"if (document.getElementById('fileUpload').value.match(/xls$/) || document.getElementById('fileUpload').v...
2008/09/16
[ "https://Stackoverflow.com/questions/71944", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51/" ]
71,959
<p>I have my own class inside the file "Particles.h" and the class's implementation is inside "Particles.cpp"</p> <p>I want the file "Load.h" to recognize my classes inside there, so I've added the line</p> <pre><code>#include "Particles.h" </code></pre> <p>and the file doesn't recognize it and in the past everything was OK (I haven't made any changes inside that class).</p> <p>What should I do?</p>
[ { "answer_id": 72021, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "Stone *stone[48];\n" }, { "answer_id": 72109, "author": "CariElf", "author_id": 12117, "author_profile": "h...
2008/09/16
[ "https://Stackoverflow.com/questions/71959", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
71,971
<p>My web application generates pdf files and either e-mails or faxes them to our customers. Somehow IIS6 is keeping hold of the file and blocking any other requests for it claiming the old '..the process cannot access the file 'xxx.pdf' because it is being used by another process.'</p> <p>When I recycle the application pool all is ok. Does anybody know why this is happening and how can I stop it.</p> <p>Thanks</p>
[ { "answer_id": 72093, "author": "massimogentilini", "author_id": 11673, "author_profile": "https://Stackoverflow.com/users/11673", "pm_score": 0, "selected": false, "text": "byte[] asciiBytes = getPdf(...);\ntry{\nBinaryWriter bw = new BinaryWriter(File.Create(filename));\nbw.Write(pdfBy...
2008/09/16
[ "https://Stackoverflow.com/questions/71971", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11707/" ]
71,979
<p>I just came across the proposed <a href="http://web.archive.org/web/20171008232044/http://dancinghacker.com:80/code/dataflow/dataflow/introduction/dataflow.html" rel="nofollow noreferrer">Boost::Dataflow</a> library. It seems like an interesting approach and I was wondering if there are other such alternative frameworks for C++, and if there are any related design patterns. I have not ruled out Boost::Dataflow, I am just looking into any available alternatives so I can understand the domain and my options better (or roll my own if necessary).</p>
[ { "answer_id": 13454268, "author": "Alexei Kaigorodov", "author_id": 1206301, "author_profile": "https://Stackoverflow.com/users/1206301", "pm_score": 2, "selected": false, "text": "tbb::flow" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/71979", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
71,980
<p>I have a BSTR object that I would like to convert to copy to a wchar__t object. The tricky thing is the length of the BSTR object could be anywhere from a few kilobytes to a few hundred kilobytes. Is there an efficient way of copying the data across? I know I could just declare a wchar_t array and alway allocate the maximum possible data it would ever need to hold. However, this would mean allocating hundreds of kilobytes of data for something that potentially might only require a few kilobytes. Any suggestions?</p>
[ { "answer_id": 72760, "author": "Mike Dimmick", "author_id": 6970, "author_profile": "https://Stackoverflow.com/users/6970", "pm_score": 2, "selected": false, "text": "BSTR" }, { "answer_id": 72866, "author": "Nemanja Trifunovic", "author_id": 8899, "author_profile": ...
2008/09/16
[ "https://Stackoverflow.com/questions/71980", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
71,985
<p>How can I copy a line 10 times easily in Emacs? I can't find a copy-line shortcut or function. I can use C-aC-spcC-eM-w to laboriously copy the line but how can I then paste it more than once?</p> <p>Any ideas before I go and write my own functions.</p>
[ { "answer_id": 72181, "author": "ShreevatsaR", "author_id": 4958, "author_profile": "https://Stackoverflow.com/users/4958", "pm_score": 5, "selected": true, "text": "kill-ring-save" }, { "answer_id": 73678, "author": "cjm", "author_id": 8355, "author_profile": "https:...
2008/09/16
[ "https://Stackoverflow.com/questions/71985", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9831/" ]
72,010
<p>Given the following example, why do I have to explicitly use the statement <code>b-&gt;A::DoSomething()</code> rather than just <code>b-&gt;DoSomething()</code>?</p> <p>Shouldn't the compiler's overload resolution figure out which method I'm talking about?</p> <p>I'm using Microsoft VS 2005. (Note: using virtual doesn't help in this case.)</p> <pre><code>class A { public: int DoSomething() {return 0;}; }; class B : public A { public: int DoSomething(int x) {return 1;}; }; int main() { B* b = new B(); b-&gt;A::DoSomething(); //Why this? //b-&gt;DoSomething(); //Why not this? (Gives compiler error.) delete b; return 0; } </code></pre>
[ { "answer_id": 72075, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 6, "selected": true, "text": "B::DoSomething" }, { "answer_id": 72076, "author": "Pieter", "author_id": 5822, "author_profile": "...
2008/09/16
[ "https://Stackoverflow.com/questions/72010", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12083/" ]
72,036
<p>What is the best way to implement mutliple Default Buttons on a ASP.NET Webform?</p> <p>I have what I think is a pretty standard page. There is a login area with user/pass field and a login button. Then elsewhere on the same page there is a single search field with a search button.</p>
[ { "answer_id": 72095, "author": "jansokoly", "author_id": 12111, "author_profile": "https://Stackoverflow.com/users/12111", "pm_score": 4, "selected": true, "text": "asp:Panel" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/72036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3747/" ]
72,048
<p>I admit I know enough about COM and IE architecture only to be dangerous. I have a working C# .NET ActiveX control similar to this:</p> <pre><code>using System; using System.Runtime.InteropServices; using BrowseUI; using mshtml; using SHDocVw; using Microsoft.Win32; namespace CTI { public interface CTIActiveXInterface { [DispId(1)] string GetMsg(); } [ComVisible(true), ClassInterface(ClassInterfaceType.AutoDual)] public class CTIActiveX : CTIActiveXInterface { /*** Where can I get a reference to SHDocVw.WebBrowser? *****/ SHDocVw.WebBrowser browser; public string GetMsg() { return "foo"; } } } </code></pre> <p>I registered and created a type library using regasm:</p> <pre><code>regasm CTIActiveX.dll /tlb:CTIActiveXNet.dll /codebase </code></pre> <p>And can successfully instantiate this in javascript:</p> <pre><code>var CTIAX = new ActiveXObject("CTI.CTIActiveX"); alert(CTIAX.GetMsg()); </code></pre> <p>How can I get a reference to the client site (browser window) within CTIActiveX? I have done this in a BHO by implementing IObjectWithSite, but I don't think this is the correct approach for an ActiveX control. If I implement any interface (I mean COM interface like IObjectWithSite) on CTIActiveX when I try to instantiate in Javascript I get an error that the object does not support automation.</p>
[ { "answer_id": 75086, "author": "jlew", "author_id": 7450, "author_profile": "https://Stackoverflow.com/users/7450", "pm_score": 2, "selected": false, "text": "IHtmlDocument2 Document { set; }\n" }, { "answer_id": 75982, "author": "Community", "author_id": -1, "author...
2008/09/16
[ "https://Stackoverflow.com/questions/72048", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
72,057
<p>I would like to have a Guile script, which implements functions, which output test result messages according to the TAP protocol.</p>
[ { "answer_id": 21836368, "author": "Yawar", "author_id": 20371, "author_profile": "https://Stackoverflow.com/users/20371", "pm_score": 2, "selected": false, "text": "spec" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/72057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11886/" ]
72,070
<p>I'm executing stored procedures using SET FMTONLY ON, in order to emulate what our code generator does. However, it seems that the results are cached when executed like this, as I'm still getting a <em>Conversion failed</em> error from a proc that I have just dropped! This happens even when I execute the proc without SET FMTONLY ON.</p> <p>Can anyone please tell me what's going on here?</p>
[ { "answer_id": 232380, "author": "Rick", "author_id": 14138, "author_profile": "https://Stackoverflow.com/users/14138", "pm_score": 2, "selected": true, "text": "SET FMTONLY ON" }, { "answer_id": 1145031, "author": "Community", "author_id": -1, "author_profile": "http...
2008/09/16
[ "https://Stackoverflow.com/questions/72070", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8741/" ]
72,090
<p>I'm trying to modify my GreaseMonkey script from firing on window.onload to window.DOMContentLoaded, but this event never fires.</p> <p>I'm using FireFox 2.0.0.16 / GreaseMonkey 0.8.20080609</p> <p><a href="https://stackoverflow.com/questions/59205/enhancing-stackoverflow-user-experience">This</a> is the full script that I'm trying to modify, changing:</p> <pre><code>window.addEventListener ("load", doStuff, false); </code></pre> <p>to</p> <pre><code>window.addEventListener ("DOMContentLoaded", doStuff, false); </code></pre>
[ { "answer_id": 72245, "author": "Sam Hasler", "author_id": 2541, "author_profile": "https://Stackoverflow.com/users/2541", "pm_score": 6, "selected": true, "text": "window.addEventListener (\"load\", function() {" }, { "answer_id": 72314, "author": "PabloG", "author_id": ...
2008/09/16
[ "https://Stackoverflow.com/questions/72090", "https://Stackoverflow.com", "https://Stackoverflow.com/users/394/" ]
72,098
<p>When using MediaWiki's markup language, the only thing that I hate is creating numbered lists. The only way I know to create a list is to do something like this:</p> <pre><code>#Item1 #Item2 </code></pre> <p>However, if I want to add spaces or some other text between those lines, the numbering gets lost. For example, the following will create text that has two number one items:</p> <pre><code>#Item1 Somestuff #Item2 </code></pre> <p>Is there any way around this, or should I just use bullet points instead? I noticed just now that the stackoverflow system does not allow numbering like this, you have to do it all manually.</p>
[ { "answer_id": 72140, "author": "finnw", "author_id": 12048, "author_profile": "https://Stackoverflow.com/users/12048", "pm_score": 5, "selected": false, "text": "#Item1\n#:Somestuff\n#Item2\n" }, { "answer_id": 630617, "author": "Adrian Archer", "author_id": 65284, "...
2008/09/16
[ "https://Stackoverflow.com/questions/72098", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
72,103
<p>I'm using a winforms webbrowser control to display some content in a windows forms app. I'm using the DocumentText property to write the generated HTML. That part is working spectacularly. Now I want to use some images in the markup. (I also would prefer to use linked CSS and JavaScript, however, that can be worked around by just embedding it.)</p> <p>I have been googling over the course of several days and can't seem to find an answer to the title question. </p> <p>I tried using a relative reference: the app exe is in the bin\debug. The images live in the "Images" directory at the root of the project. I've set the images to be copied to the output directory on compile, so they end up in bin\debug\Images*. So I then use a reference like this "Images..." thinking it will be relative to the exe. However, when I look at the image properties in the embedded browser window, I see the image URL to be "about:blankImages/*". Everything seems to be relative to "about:blank" when HTML is written to the control. Lacking a location context, I can't figure out what to use for a relative file resource reference.</p> <p>I poked around the properties of the control to see if there is a way to set something to fix this. I created a blank html page, and pointed the browser at it using the "Navigate()" method, using the full local path to the file. This worked fine with the browser reporting the local "file:///..." path to the blank page. Then I again wrote to the browser, this time using Document.Write(). Again, the browser now reports "about:blank" as the URL.</p> <p>Short of writing the dynamic HTML results to a real file, is there no other way to reference a file resource?</p> <p>I am going to try one last thing: constructing absolute file paths to the images and writing those to the HTML. My HTML is being generated using an XSL transform of a serialized object's XML so I'll need to play with some XSL parameters which will take a little extra time as I'm not that familiar with them.</p>
[ { "answer_id": 72339, "author": "Ken Wootton", "author_id": 7357, "author_profile": "https://Stackoverflow.com/users/7357", "pm_score": 4, "selected": true, "text": "public class HtmlFormatter\n{\n /// <summary>\n /// Indicator that this is a URI referencing the local\n /// file...
2008/09/16
[ "https://Stackoverflow.com/questions/72103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5496/" ]
72,116
<p>I understand about race conditions and how with multiple threads accessing the same variable, updates made by one can be ignored and overwritten by others, but what if each thread is writing the same value (not different values) to the same variable; can even this cause problems? Could this code:</p> <p>GlobalVar.property = 11;</p> <p>(assuming that property will never be assigned anything other than 11), cause problems if multiple threads execute it at the same time?</p>
[ { "answer_id": 72571, "author": "Torne", "author_id": 12345, "author_profile": "https://Stackoverflow.com/users/12345", "pm_score": 3, "selected": false, "text": "int x = 0, y = 0;\n\n//thread A does:\nx = 1;\ny = 2;\nif (y == 2)\n print(x);\n\n//thread B does, at the same time:\nif (...
2008/09/16
[ "https://Stackoverflow.com/questions/72116", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
72,121
<p>Let me use the following example to explain my question:</p> <pre class="lang-csharp prettyprint-override"><code>public string ExampleFunction(string Variable) { return something; } string WhatIsMyName = &quot;Hello World&quot;; string Hello = ExampleFunction(WhatIsMyName); </code></pre> <p>When I pass the variable <code>WhatIsMyName</code> to the <code>ExampleFunction</code>, I want to be able to get a string of the <em>original</em> variable's name. Perhaps something like:</p> <pre class="lang-csharp prettyprint-override"><code>Variable.OriginalName.ToString() // == &quot;WhatIsMyName&quot; </code></pre> <p>Is there any way to do this?</p>
[ { "answer_id": 72139, "author": "Gishu", "author_id": 1695, "author_profile": "https://Stackoverflow.com/users/1695", "pm_score": -1, "selected": true, "text": "NamedParameter" }, { "answer_id": 72145, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "...
2008/09/16
[ "https://Stackoverflow.com/questions/72121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/383/" ]
72,125
<p>Lets say that you have websites www.xyz.com and www.abc.com.</p> <p>Lets say that a user goes to www.abc.com and they get authenticated through the normal ASP .NET membership provider. </p> <p>Then, from that site, they get sent to (redirection, linked, whatever works) site www.xyz.com, and the intent of site www.abc.com was to pass that user to the other site as the status of isAuthenticated, so that the site www.xyz.com does not ask for the credentials of said user again.</p> <p>What would be needed for this to work? I have some constraints on this though, the user databases are completely separate, it is not internal to an organization, in all regards, it is like passing from stackoverflow.com to google as authenticated, it is that separate in nature. A link to a relevant article will suffice.</p>
[ { "answer_id": 72517, "author": "Adam Pope", "author_id": 12226, "author_profile": "https://Stackoverflow.com/users/12226", "pm_score": 2, "selected": false, "text": "<authentication mode=\"Forms\">\n <forms name=\".ASPXAUTH\" loginUrl=\"~/Login.aspx\" path=\"/\" \n p...
2008/09/16
[ "https://Stackoverflow.com/questions/72125", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7952/" ]
72,128
<p>Using C++ (and Qt), I need to process a big amount of 3D coordinates.</p> <p>Specifically, when I receive a 3D coordinate (made of 3 doubles), I need to check in a list if this coordinate has already been processed. If not, then I process it and add it to the list (or container).</p> <p>The amount of coordinates can become very big, so I need to store the processed coordinates in a container which will ensure that checking if a 3D coordinate is already contained in the container is fast.</p> <p>I was thinking of using a map of a map of a map, storing the x coordinate, then the y coordinate then the z coordinate, but this makes it quite tedious to use, so I'm actually hoping there is a much better way to do it that I cannot think of.</p>
[ { "answer_id": 72227, "author": "zweiterlinde", "author_id": 6592, "author_profile": "https://Stackoverflow.com/users/6592", "pm_score": 0, "selected": false, "text": "map<map<map<>>>" }, { "answer_id": 72350, "author": "Roel", "author_id": 11449, "author_profile": "h...
2008/09/16
[ "https://Stackoverflow.com/questions/72128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2796/" ]
72,151
<p>I'm using OLEDB provider for ADO.Net connecting to an Oracle database. In my loop, I am doing an insert:</p> <pre><code>insert into ps_tl_compleave_tbl values('2626899', 0, TO_DATE('01/01/2002', 'MM/DD/YYYY'), 'LTKN', 'LTKN', '52', TO_DATE('01/01/2002', 'MM/DD/YYYY'), 16.000000, 24.000)insert into ps_tl_compleave_tbl values('4327142', 0, TO_DATE('03/23/2002', 'MM/DD/YYYY'), 'LTKN', 'LTKN', '51', TO_DATE('03/23/2002', 'MM/DD/YYYY'), 0.000000, 0.000) </code></pre> <p>The first insert succeeds but the second one gives an error:</p> <pre><code>ORA-00933: SQL command not properly ended </code></pre> <p>What am I doing wrong?</p>
[ { "answer_id": 72170, "author": "ShoeLace", "author_id": 3825, "author_profile": "https://Stackoverflow.com/users/3825", "pm_score": 2, "selected": false, "text": "BEGIN\n insert (...) into (...);\n insert (...) into (...);\nEND;\n" }, { "answer_id": 72179, "author"...
2008/09/16
[ "https://Stackoverflow.com/questions/72151", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10589/" ]
72,153
<p>How can I construct a MSBuild ItemGroup to exclude .svn directories and all files within (recursively). I've got:</p> <pre><code>&lt;ItemGroup&gt; &lt;LibraryFiles Include="$(LibrariesReleaseDir)\**\*.*" Exclude=".svn" /&gt; &lt;/ItemGroup&gt; </code></pre> <p>At the moment, but this does not exclude anything!</p>
[ { "answer_id": 72536, "author": "Kieran Benton", "author_id": 5777, "author_profile": "https://Stackoverflow.com/users/5777", "pm_score": 7, "selected": true, "text": "<ItemGroup>\n <LibraryFiles Include=\"$(LibrariesReleaseDir)\\**\\*.*\" \n Exclude=\"$(LibrariesRe...
2008/09/16
[ "https://Stackoverflow.com/questions/72153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5777/" ]
72,167
<p>How do I find out which sound files the user has configured in the control panel?</p> <p>Example: I want to play the sound for "Device connected".</p> <p>Which API can be used to query the control panel sound settings?</p> <p>I see that there are some custom entries made by third party programs in the control panel dialog, so there has to be a way for these programs to communicate with the global sound settings.</p> <p>Edit: Thank you. I did not know that PlaySound also just played appropriate sound file when specifying the name of the registry entry.</p> <p>To play the "Device Conntected" sound:</p> <pre><code>::PlaySound( TEXT("DeviceConnect"), NULL, SND_ALIAS|SND_ASYNC ); </code></pre>
[ { "answer_id": 72250, "author": "titanae", "author_id": 2387, "author_profile": "https://Stackoverflow.com/users/2387", "pm_score": 5, "selected": true, "text": "PlaySound" }, { "answer_id": 72488, "author": "Nidonocu", "author_id": 483, "author_profile": "https://Sta...
2008/09/16
[ "https://Stackoverflow.com/questions/72167", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1810/" ]
72,176
<p>While there are 100 ways to solve the conversion problem, I am focusing on performance.</p> <p>Give that the string only contains binary data, what is the fastest method, in terms of performance, of converting that data to a byte[] (not char[]) under C#?</p> <p>Clarification: This is not ASCII data, rather binary data that happens to be in a string.</p>
[ { "answer_id": 72500, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 0, "selected": false, "text": "byte[]" }, { "answer_id": 72822, "author": "Davy Landman", "author_id": 11098, "author_profile": "...
2008/09/16
[ "https://Stackoverflow.com/questions/72176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12113/" ]
72,198
<p>This seemed like an easy thing to do. I just wanted to pop up a text window and display two columns of data -- a description on the left side and a corresponding value displayed on the right side. I haven't worked with Forms much so I just grabbed the first control that seemed appropriate, a TextBox. I thought using tabs would be an easy way to create the second column, but I discovered things just don't work that well.</p> <p>There seems to be two problems with the way I tried to do this (see below). First, I read on numerous websites that the MeasureString function isn't very precise due to how complex fonts are, with kerning issues and all. The second is that I have no idea what the TextBox control is using as its StringFormat underneath.</p> <p>Anyway, the result is that I invariably end up with items in the right column that are off by a tab. I suppose I could roll my own text window and do everything myself, but gee, isn't there a simple way to do this?</p> <pre><code> TextBox textBox = new TextBox(); textBox.Font = new Font("Calibri", 11); textBox.Dock = DockStyle.Fill; textBox.Multiline = true; textBox.WordWrap = false; textBox.ScrollBars = ScrollBars.Vertical; Form form = new Form(); form.Text = "Recipe"; form.Size = new Size(400, 600); form.FormBorderStyle = FormBorderStyle.Sizable; form.StartPosition = FormStartPosition.CenterScreen; form.Controls.Add(textBox); Graphics g = form.CreateGraphics(); float targetWidth = 230; foreach (PropertyInfo property in properties) { string text = String.Format("{0}:\t", Description); while (g.MeasureString(text,textBox.Font).Width &lt; targetWidth) text += "\t"; textBox.AppendText(text + value.ToString() + "\n"); } g.Dispose(); form.ShowDialog(); </code></pre>
[ { "answer_id": 72283, "author": "Matt Dawdy", "author_id": 232, "author_profile": "https://Stackoverflow.com/users/232", "pm_score": 1, "selected": true, "text": "Private Declare Function SendMessage _\n Lib \"user32\" Alias \"SendMessageA\" _\n (ByVal handle As IntPtr, ByVal wMsg As I...
2008/09/16
[ "https://Stackoverflow.com/questions/72198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12058/" ]
72,204
<p>Has anyone used <a href="http://www.ayende.com/Blog/archive/2007/09/03/Rhino-Igloo-ndash-MVC-Framework-for-Web-Forms.aspx" rel="nofollow noreferrer">Rhino igloo</a> in a non-trivial project? I am curious if it's worth, what are its drawbacks, does it enhance testability a lot, is it easy to use. How would you compare it to a pure MVC framework (ASP.NET MVC)? Please share the experience.</p>
[ { "answer_id": 72283, "author": "Matt Dawdy", "author_id": 232, "author_profile": "https://Stackoverflow.com/users/232", "pm_score": 1, "selected": true, "text": "Private Declare Function SendMessage _\n Lib \"user32\" Alias \"SendMessageA\" _\n (ByVal handle As IntPtr, ByVal wMsg As I...
2008/09/16
[ "https://Stackoverflow.com/questions/72204", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1801/" ]