qid
int64
4
19.1M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
401,771
<p>I'm working with a MySQL database that has some data imported from <a href="http://en.wikipedia.org/wiki/Microsoft_Excel" rel="noreferrer">Excel</a>. The data contains non-<a href="http://en.wikipedia.org/wiki/ASCII" rel="noreferrer">ASCII</a> characters (em dashes, etc.) as well as hidden carriage returns or line feeds. Is there a way to find these records using MySQL?</p>
[ { "answer_id": 401819, "author": "Chad Birch", "author_id": 41665, "author_profile": "https://Stackoverflow.com/users/41665", "pm_score": 7, "selected": true, "text": "SELECT * FROM tableName WHERE columnToCheck NOT REGEXP '[A-Za-z0-9]';\n SELECT * FROM tableName WHERE columnToCheck NOT ...
2008/12/30
[ "https://Stackoverflow.com/questions/401771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47166/" ]
401,783
<p>Given the following Java code for generating a binary file:</p> <pre><code>DataOutputStream out = new DataOutputStream(new FileOutputStream("foo.dat")); out.writeInt(1234); out.writeShort(30000); out.writeFloat(256.384f); </code></pre> <p>I'm using the following Objective-C code and manage to parse the int and the short values:</p> <pre><code>NSString *path = [[NSBundle mainBundle] pathForResource:@"foo" ofType:@"dat"]; NSFileHandle *file = [NSFileHandle fileHandleForReadingAtPath:path]; unsigned long intValue; memcpy(&amp;intValue, [[file readDataOfLength:4] bytes], 4); intValue = NSSwapBigLongToHost(intValue); unsigned short shortValue; memcpy(&amp;shortValue, [[file readDataOfLength:2] bytes], 2); shortValue = NSSwapBigShortToHost(shortValue); </code></pre> <p>My problem for now is with the float value: any clues on how to parse it?</p>
[ { "answer_id": 401846, "author": "Derek Ledbetter", "author_id": 25653, "author_profile": "https://Stackoverflow.com/users/25653", "pm_score": 4, "selected": true, "text": "<Foundation/Foundation.h> NSSwappedFloat bigEndianFloat;\nmemcpy(&bigEndianFloat, [[file readDataOfLength:4] bytes]...
2008/12/30
[ "https://Stackoverflow.com/questions/401783", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50335/" ]
401,787
<p>How to scale the y-axis with <a href="http://matplotlib.sourceforge.net/" rel="nofollow noreferrer">Matplotlib</a>? I don't want to change the y-limit, I just want to extend the physical space.</p> <pre><code>^ ^ | | | | +----&gt; | Before +----&gt; After </code></pre>
[ { "answer_id": 401823, "author": "Autoplectic", "author_id": 49994, "author_profile": "https://Stackoverflow.com/users/49994", "pm_score": 4, "selected": true, "text": "from pylab import *\nx = linspace(0, 10*pi, 2**10)\ny = sin(x)\nfigure(figsize=(5, 10))\nplot(x, y)\nshow()\n figsize=(...
2008/12/30
[ "https://Stackoverflow.com/questions/401787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2007483/" ]
401,812
<p>What is the proper way to cast from an 'OLE_HANDLE' to an 'HICON' for an x64 target build?</p> <p>In particular with a normal C-Style cast, I get this warning when compiling with an x64 config:</p> <p>warning C4312: 'type cast' : conversion from 'OLE_HANDLE' to 'HICON' of greater size</p> <p>Here is the offending code:</p> <pre><code>imgList.Add((HICON)ohIcon); </code></pre> <p><strong>The above code works fine for me, but I want to get rid of the warning when building for x64.</strong> </p>
[ { "answer_id": 401857, "author": "chaos", "author_id": 47529, "author_profile": "https://Stackoverflow.com/users/47529", "pm_score": 0, "selected": false, "text": "HICON hSomeIcon = (HICON) hSomeOLEHandle;\n" } ]
2008/12/30
[ "https://Stackoverflow.com/questions/401812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3153/" ]
401,816
<p>How can I make a Click-once deployed app run a startup?</p> <p>The best option I found by searching was to set the Publisher on the app to Startup, so the Start menu shortcut would be placed in the Startup folder, but that seems like a huge hack and I would like there to be a Start menu icon people can find.</p> <p>What options do I have?</p>
[ { "answer_id": 8695121, "author": "Don Scott", "author_id": 1086521, "author_profile": "https://Stackoverflow.com/users/1086521", "pm_score": 6, "selected": true, "text": "// The path to the key where Windows looks for startup applications\nRegistryKey rkApp = Registry.CurrentUser.OpenSu...
2008/12/30
[ "https://Stackoverflow.com/questions/401816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/100/" ]
401,820
<p>Is it possible not to use web service for ASP.net ajax instead call code-behind function to fetch data?</p> <p>any example or link is much appericate.</p>
[ { "answer_id": 8695121, "author": "Don Scott", "author_id": 1086521, "author_profile": "https://Stackoverflow.com/users/1086521", "pm_score": 6, "selected": true, "text": "// The path to the key where Windows looks for startup applications\nRegistryKey rkApp = Registry.CurrentUser.OpenSu...
2008/12/30
[ "https://Stackoverflow.com/questions/401820", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28647/" ]
401,834
<p>Arising out of <a href="https://stackoverflow.com/questions/401467/how-to-reduce-the-size-of-an-sqlite3-database-for-iphone">this</a> question, I'm looking for an elegant (ruby) way to compute the word signature suggested in <a href="https://stackoverflow.com/questions/401467/how-to-reduce-the-size-of-an-sqlite3-database-for-iphone#401518">this</a> answer.</p> <p>The idea suggested is to sort the letters in the word, and also run length encode repeated letters. So, for example "mississippi" first becomes "iiiimppssss", and then could be further shortened by encoding as "4impp4s".</p> <p>I'm relatively new to ruby and though I could hack something together, I'm sure this is a one liner for somebody with more experience of ruby. I'd be interested to see people's approaches and improve my ruby knowledge.</p> <p><em>edit: to clarify, performance of computing the signature doesn't much matter for my application. I'm looking to compute the signature so I can store it with each word in a large database of words (450K words), then query for words which have the same signature (i.e. all anagrams of a given word, that are actual english words). Hence the focus on space. The 'elegant' part is just to satisfy my curiosity.</em></p>
[ { "answer_id": 401848, "author": "Robert Simmons", "author_id": 18951, "author_profile": "https://Stackoverflow.com/users/18951", "pm_score": 4, "selected": true, "text": "s = \"mississippi\"\ns.split('').sort.join.gsub(/(.)\\1{2,}/) { |s| s.length.to_s + s[0,1] } \n" }, { "answe...
2008/12/30
[ "https://Stackoverflow.com/questions/401834", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42404/" ]
401,847
<p>How can I tell whether a circle and a rectangle intersect in 2D Euclidean space? (i.e. classic 2D geometry)</p>
[ { "answer_id": 401859, "author": "ForYourOwnGood", "author_id": 48728, "author_profile": "https://Stackoverflow.com/users/48728", "pm_score": -1, "selected": false, "text": "if sqrt((rectangleRight.x - circleCenter.x)^2 +\n (rectangleBottom.y - circleCenter.y)^2) < radius\n// then...
2008/12/30
[ "https://Stackoverflow.com/questions/401847", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1088/" ]
401,851
<p>I'm working with a group of other programmers on an open source project built using C++ and Qt.</p> <p>Now, we need a naming convention for widgets (and other variables generally) to use it as a standard in all of our code so that, the code gets better readability and we get better coordination between programmers.</p> <p>Any advice?</p> <p>EDIT: Am not talking about naming new classes,</p> <p>instead I am talking about naming instances of Qt Widgets, let's say I have a text edit for user name, should I name it txtEdtUsrNm?</p> <p>And in that case, how am I supposed to choose derivations?</p>
[ { "answer_id": 404244, "author": "Michael Bishop", "author_id": 45114, "author_profile": "https://Stackoverflow.com/users/45114", "pm_score": 5, "selected": true, "text": "QTextEdit * userNameEdit = new QTextEdit(this);\n QListView * userListView;\n" }, { "answer_id": 1160492, ...
2008/12/30
[ "https://Stackoverflow.com/questions/401851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49217/" ]
401,856
<p>It's generally accepted that copy and paste programming is a bad idea, but what is the best way to handle a situation where you have two functions or blocks of code that really <strong>do</strong> need to be different in just a few ways make generalizing them extremely messy? </p> <p>What if the code is substantially the same, except for a few minor variations, but those few minor variations aren't in things that are easy to factor out through either adding a parameter, template methods, or something like that?</p> <p>More generally, have you ever encountered a situation where you would admit that a little copy-and-paste coding was truly justified.</p>
[ { "answer_id": 401873, "author": "Norman Ramsey", "author_id": 41661, "author_profile": "https://Stackoverflow.com/users/41661", "pm_score": 1, "selected": false, "text": "#define RETPOS(E) do { if ((E) > 0) then return; } while(0)\n" }, { "answer_id": 401880, "author": "Loga...
2008/12/30
[ "https://Stackoverflow.com/questions/401856", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23903/" ]
401,905
<p>I'm trying to capture the id of an element that will be randomly generated. I can successfully capture the value of my element id like this...</p> <pre><code>| storeAttribute | //div[1]@id | variableName | </code></pre> <p>Now my variable will be something like...</p> <pre><code>divElement-12345 </code></pre> <p>I want to remove 'divElement-' so that the variable I am left with is '12345' so that I can use it later to select the 'form-12345' element associated with it...something like this:</p> <pre><code>| type | //tr[@id='form-${variableName}']/td/form/fieldset/p[1]/input | Type this | </code></pre> <p>How might I be able to accomplish this?</p>
[ { "answer_id": 615573, "author": "s_hewitt", "author_id": 74309, "author_profile": "https://Stackoverflow.com/users/74309", "pm_score": 3, "selected": true, "text": "storeAttribute | //div[1]@id | divID\nstoreEval | '${divID}'.replace(\"div...
2008/12/31
[ "https://Stackoverflow.com/questions/401905", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48523/" ]
401,908
<p>I've run into an odd problem and I'm not sure how to fix it. I have several classes that are all PHP implementations of JSON objects. Here' an illustration of the issue</p> <pre><code>class A { protected $a; public function __construct() { $this-&gt;a = array( new B, new B ); } public function __toString() { return json_encode( $this-&gt;a ); } } class B { protected $b = array( 'foo' =&gt; 'bar' ); public function __toString() { return json_encode( $this-&gt;b ); } } $a = new A(); echo $a; </code></pre> <p>The output from this is</p> <pre><code>[{},{}] </code></pre> <p>When the <em>desired</em> output is</p> <pre><code>[{"foo":"bar"},{"foo":"bar"}] </code></pre> <p>The problem is that I was relying on the __toString() hook to do my work for me. But it can't, because the serialize that json_encode() uses won't call __toString(). When it encounters a nested object it simply serializes public properties only.</p> <p>So, the question then become this: Is there a way I can develop a managed interface to JSON classes that both lets me use setters and getters for properties, but also allows me to get the JSON serialization behavior I desire?</p> <p>If that's not clear, here's an example of an implementation that <em>won't</em> work, since the __set() hook is only called for the initial assignment</p> <pre><code>class a { public function __set( $prop, $value ) { echo __METHOD__, PHP_EOL; $this-&gt;$prop = $value; } public function __toString() { return json_encode( $this ); } } $a = new a; $a-&gt;foo = 'bar'; $a-&gt;foo = 'baz'; echo $a; </code></pre> <p>I suppose I could also do something like this</p> <pre><code>class a { public $foo; public function setFoo( $value ) { $this-&gt;foo = $value; } public function __toString() { return json_encode( $this ); } } $a = new a; $a-&gt;setFoo( 'bar' ); echo $a; </code></pre> <p>But then I would have to rely on the diligence of the other developers to use the setters - I can't force adherence programmtically with this solution.</p> <p><strong>---> EDIT &lt;---</strong></p> <p>Now with a test of Rob Elsner's response</p> <pre><code>&lt;?php class a implements IteratorAggregate { public $foo = 'bar'; protected $bar = 'baz'; public function getIterator() { echo __METHOD__; } } echo json_encode( new a ); </code></pre> <p>When you execute this, you can see that the getIterator() method isn't ever invoked.</p>
[ { "answer_id": 402051, "author": "pablasso", "author_id": 19329, "author_profile": "https://Stackoverflow.com/users/19329", "pm_score": 0, "selected": false, "text": "[{\"b\":{\"foo\":\"bar\"}},{\"b\":{\"foo\":\"bar\"}}]\n [{\"foo\":\"bar\"},{\"foo\":\"bar\"}]\n class B\n{\n protected...
2008/12/31
[ "https://Stackoverflow.com/questions/401908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8815/" ]
401,910
<p>Im a little confused over how to use the .NET Trace and Debug classes.</p> <p>Why would you bother using Trace instead of Debug?</p> <pre><code>Trace.TraceError() Trace.TraceInformation() Trace.Assert() Debug.WriteLine() Debug.Assert() </code></pre> <p>Also, I understand that Debug statements are ignored when your in Release config mode, but If trace statements apply all the time, how does this affect performance?</p>
[ { "answer_id": 402706, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 4, "selected": true, "text": "Debug.WriteLine DEBUG Trace.WriteLine Trace Debug" } ]
2008/12/31
[ "https://Stackoverflow.com/questions/401910", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17211/" ]
401,915
<p>What is the best way to find all the system fonts a user has available so they can be displayed in a dropdown selection box? </p> <p>I would also like to distinguish between Unicode and non-Unicode fonts.</p> <p>I am using Delphi 2009 which is fully Unicode enabled, and would like a Delphi solution.</p>
[ { "answer_id": 401975, "author": "Tim Jarvis", "author_id": 10387, "author_profile": "https://Stackoverflow.com/users/10387", "pm_score": 3, "selected": false, "text": "Listbox1.Items.AddStrings(Screen.Fonts);\n" }, { "answer_id": 412265, "author": "Rob Kennedy", "author_...
2008/12/31
[ "https://Stackoverflow.com/questions/401915", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30176/" ]
401,919
<p>The code base I'm currently working on is littered with hard-coded values.</p> <p>I view all hard coded values as a code smell and I try to eliminate them where possible...however there are some cases that I am unsure about.</p> <p>Here are two examples that I can think of that make me wonder what the best practice is:</p> <pre><code>1. MyTextBox.Text = someCondition ? "Yes" : "No" 2. double myPercentage = myValue / 100; </code></pre> <p>In the first case, is the best thing to do to create a class that allows me to do MyHelper.Yes and MyHelper.No or perhaps something similar in a config file (though it isn't likely to change and who knows if there might ever be a case where its usage would be case sensitive).</p> <p>In the second case, finding a percentage by dividing by 100 isn't likely to ever change unless the laws of mathematics change...but I still wonder if there is a better way.</p> <p>Can anyone suggest an appropriate way to deal with this sort of hard coding? And can anyone think of any places where hard coding is an acceptable practice?</p>
[ { "answer_id": 401926, "author": "Colen", "author_id": 13500, "author_profile": "https://Stackoverflow.com/users/13500", "pm_score": 2, "selected": false, "text": "double getpercentage(double myValue)\n{\n return(myValue / 100);\n}\n double myPercentage = getpercentage(myValue);\n" }...
2008/12/31
[ "https://Stackoverflow.com/questions/401919", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39532/" ]
401,928
<p>In Visual Studio &amp; other IDEs, you can easily auto format your code with a keyboard shortcut, through the menu, or automatically as you type.</p> <p>I was wondering if there is yet a way to enable this standard feature in SQL Server Management Studio?</p> <p>I'm working with some large-ish stored procs that are a mangled mess of poorly formatted SQL and it'd be nice if I could just go "Select All -> Format SQL"</p>
[ { "answer_id": 7197517, "author": "Tao", "author_id": 74296, "author_profile": "https://Stackoverflow.com/users/74296", "pm_score": 8, "selected": false, "text": "MERGE OUTPUT" }, { "answer_id": 73336865, "author": "S Nash", "author_id": 2387085, "author_profile": "ht...
2008/12/31
[ "https://Stackoverflow.com/questions/401928", "https://Stackoverflow.com", "https://Stackoverflow.com/users/493/" ]
401,935
<p>I have IQueryable list of objects of type T which I want to transform into objects of type K</p> <pre><code>List&lt;K&gt; tranformedList = originalList.Select(x =&gt; transform(x)).ToList(); </code></pre> <p>the transform function returns null if it cannot tranform the objects.If I want to filter out null elements can I call</p> <pre><code>List&lt;K&gt; tranformedList = originalList.Select(x =&gt; transform(x)) .Where(y =&gt; y != default(K)) .ToList(); </code></pre> <p>or is there any other way of filtering out null elements when calling Select in LINQ ? </p>
[ { "answer_id": 401957, "author": "Nathan W", "author_id": 6335, "author_profile": "https://Stackoverflow.com/users/6335", "pm_score": 8, "selected": true, "text": "List<K> tranformedList = originalList.Select(x => tranform(x))\n .Where(y => y != null) //Ch...
2008/12/31
[ "https://Stackoverflow.com/questions/401935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28034/" ]
401,941
<p>What is the worst SQL query you've ever seen? What made it bad?</p>
[ { "answer_id": 401946, "author": "Doug T.", "author_id": 8123, "author_profile": "https://Stackoverflow.com/users/8123", "pm_score": 5, "selected": false, "text": "WHERE name = ROBERT'); DROP TABLE students;--\n" }, { "answer_id": 401949, "author": "Sean Bright", "author_...
2008/12/31
[ "https://Stackoverflow.com/questions/401941", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50276/" ]
401,945
<p>I am a .NET dev learning Java. As a result, I understand all the fundamentals of programming like loops, variables, functions, etc. My biggest bottleneck is that I don't know my way around Java's packages like I do with .NET's.</p> <p>This is the reason for this thread - where do I find the following functionality in Java?:</p> <p>System.Diagnostics - where can I use things like stopwatch, programmatic breakpoints and loggers?</p> <p>Is there a Java equivalent of .NET performance counters?</p> <p>What are weak keys in Java? I just came across a collection which uses weak keys in Java so am asking here. :)</p> <p>Thanks</p>
[ { "answer_id": 401954, "author": "OscarRyz", "author_id": 20654, "author_profile": "https://Stackoverflow.com/users/20654", "pm_score": 0, "selected": false, "text": "import java.util.loggin.Logger;\n\n...\n\nLogger logger = Logger.getLogger( this.getClass().getName() );\n\nlogger.fine( ...
2008/12/31
[ "https://Stackoverflow.com/questions/401945", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32484/" ]
401,971
<p>I'm using a mac and looking to batch convert a large amount of eps files and create jpg previews of each. I'm looking for preferably a command-line utility, or some type of workflow to easily batch a large number of files. </p> <p>Thanks for any ideas or input</p>
[ { "answer_id": 402007, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 3, "selected": false, "text": "convert convert file.eps -resize 25% preview.jpg # create jpg thumbnail at 25% size\n" }, { "answer_id": 40...
2008/12/31
[ "https://Stackoverflow.com/questions/401971", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49684/" ]
401,996
<p>Thanks for reading this.</p> <p>I have markup similar to what is below. Using the line-height works when there is only one line of text, but the comments data will frequently be multi-line. What is the best way to get the label and the data vertically centered?</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;style&gt; body {margin:0; padding:0; font-size:12px; font-family:Verdana; text-align:center;} body {text-align: -moz-center; } /* For Firefox */ .record {width:760px; text-align:left; } .label {float:left; width:125px; line-height:75px;} .data {float:left; margin-left:10px; line-height:75px;} .clear {clear:left;} &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="record"&gt; &lt;div class="label"&gt;Subject:&lt;/div&gt; &lt;div class="data"&gt;This is the subject&lt;/div&gt; &lt;span class="clear"&gt;&lt;/span&gt; &lt;div class="label"&gt;Status:&lt;/div&gt; &lt;div class="data"&gt;This is the status&lt;/div&gt; &lt;span class="clear"&gt;&lt;/span&gt; &lt;div class="label"&gt;Comments:&lt;/div&gt; &lt;div class="data"&gt;These are the comments&lt;/div&gt; &lt;span class="clear"&gt;&lt;/span&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
[ { "answer_id": 402000, "author": "Sophie Alpert", "author_id": 49485, "author_profile": "https://Stackoverflow.com/users/49485", "pm_score": 1, "selected": false, "text": "<table>" } ]
2008/12/31
[ "https://Stackoverflow.com/questions/401996", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2755/" ]
402,022
<p>I'm working on an application that runs on Windows Mobile 6 that needs to be able to retrieve all items from an item table that contain a given string (provided by the end user) within the item's description field. The problem is that there are approximately 170,000 items in the table. Since I need to return all items that contain the string anywhere within the description I'm forced to use a LIKE %string%, which eliminates any chance to use the index. The data and table structure are originally based on a Progress database, which has a wonderful contains operator on any word-indexed fields. This is not the case on our mobile application, since it uses SQL Server Compact 3.5.</p> <p>Basically, my DAL runs the query and retrieves an SqlCeDataReader and then uses an ItemFactory to create a List object that contains only the matched items. This obviously lets us keep our domain/business objects separate from the data access layer.</p> <p>Fine and dandy, except for the 8m and 42s that it takes to retrieve items when I search for all items that contain something like "golf" in the description. Obviously this is not an acceptable time frame for the end user.</p> <p>My first attempt was to instead retrieve all items back from the database using SELECT * FROM Item" (with an order by clause on one of the main indexed fields). At this point I ran an IndexOf check as I ran through the SqlCeDataReader and had the ItemFactory only add items to the List object if they contained the requested description text. This improved the speed down to 1m 46s. Not too shabby, but still too slow.</p> <p>I then tried another approach that showed promise... almost... While the application starts up, I tried creating a List that contained all item objects within the database (takes about 2 minutes to run the query and populate the entire list, but at least it's only once as the app is initializing... still... ugh). Once the list is complete, I can easily run queries on that list doing things such as the following (I hope my syntax is right... I'm not at work right now and I don't have Visual Studio on the pc I'm sitting at):</p> <pre><code>List&lt;Item&gt; specificItems = AllItems.FindAll(i =&gt; i.Description.IndexOf(searchString, StringComparison.OrdinalIgnoreCase) &gt;= 0); </code></pre> <p>This approach knocked it down to 21s. Very nice (still slow though in the grand scheme of things). However, the problem is that the memory usage is way too great if I load all the items from the database. I had to actually cut off the last 20,000 items (so the 21s time frame probably would have been more like 25s) during the initial load, because an OutOfMemoryException was being thrown. According to the memory manager on the emulator, I still had about 20 MB of free RAM, but I've heard that a process can only have 32 MB or RAM associated to it (not sure if that's true for WM 6, but it appears so).</p> <p>To make sure it wasn't because I was using a List object to hold all the items (which I was instantiating with the needed capacity in its constructor to avoid dynamic resizing), which I've also read may cause extra memory usage when it implicity calls EnsureCapacity, I tried using an Item[] array (sized ahead of time). This still had the memory issue and the size difference was negligible.</p> <p>Ok enough rambling. I know I'm likely going to have to some how limit the records returned from the database by the datareader (through some indexed search on a different type of field) and then will likely use indexOf on that smaller subset of items to get maximum performance (thus skipping the Like operator all together). This will cause the end user to have to enter more than just a description search though (perhaps item hierarchy information to limit which type of items to search within).</p> <p>Any ideas? Am I going about this the wrong way?</p> <p>Thanks for listening (sorry this post is long, I'm kind of thinking out loud).</p> <p>Oh I should add (just in summary) what I'm using:</p> <ul> <li>Windows Mobile 6 </li> <li>Sql Server Compact Edition 3.5</li> <li>C# 3.5</li> </ul> <p>UPDATE: While the Bloom Filter approach mentioned below seemed interesting, I could not fulfill one requirement (which I didn't really specify above). I can't really match words that are contained inside other words (e.g. "club" would not return "clubs"). Due to this, I was forced to use a different approach altogether (Kent Fredric... thanks for pointing this out). I've marked Kent's answer as the correct one, since his approach was the one that filled the most requirements (Mitch, your's had a similar issue as the Bloom filter suggested by Jaunder). However, I have gone a different approach (for now...) than his way as well.</p> <p>What I've done is pulled all item objects into memory, with only item numbers and descriptions (which keeps it under the memory limitations, however it still does cause a longer initialization than I like... multithreading and loading that information behind the scenes while the application is running can take care of that I guess). To perform the searches I've written my own contains routine. The routine is written in unmanaged c# code that uses two pointers and a couple of loops to run through the description and the required matching text. If it finds a match anywhere in the description, it adds the item number to an array. Once all items have been searched, a new query goes back to the database and grabs only the matching item numbers (which is very fast due to the index on an integer field). Then those items are created in a List with all information (not just the item number and description). The whole operation takes approximately 5 - 10 seconds (depending on the description), which is good enough for now.</p> <p>I'll still look into further optimizing this (might be able to track how many characters the search term is... if there are less characters remaining on the item description than the required text, the loop could continue straight to the next item).</p> <p>Any suggestions are still welcome. For now I have marked Kent's answer as "the most correct" for my question.</p> <p>Props to Dolch for helping me write the contains routine.</p>
[ { "answer_id": 402033, "author": "Mitch Wheat", "author_id": 16076, "author_profile": "https://Stackoverflow.com/users/16076", "pm_score": 3, "selected": false, "text": "CREATE TABLE WordItemOccurance\n(\n [Word] varchar(50) not null,\n\n ItemId int not null\n constraint FK_...
2008/12/31
[ "https://Stackoverflow.com/questions/402022", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9732/" ]
402,065
<p>it seems I have run into a problem with Internet Explorer 7. I have an html page that has links to files on another server. The server I am linking to checks the referrer of the request and if the referrer is valid, it allows access to the resource. It works fine in firefox 2 and 3 (as the server my html page is located on is a valid referer) but in internet explorer it doesn't work, the other server denies me the resource(generates an http 403 error). I was doing some searching and stumbled on this <a href="http://support.microsoft.com/kb/178066" rel="noreferrer">http://support.microsoft.com/kb/178066</a> and I have tried the html page in both https and http and same thing for the server I am connecting to but I get nothing Internet explorer. what can I do to work around this?</p> <p>thank you</p>
[ { "answer_id": 402108, "author": "scunliffe", "author_id": 6144, "author_profile": "https://Stackoverflow.com/users/6144", "pm_score": 4, "selected": false, "text": "e.g. document.location.href = 'myNewPage.html'; //FAILS to pass referer in IE\n" }, { "answer_id": 934129, "au...
2008/12/31
[ "https://Stackoverflow.com/questions/402065", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50369/" ]
402,077
<p>A coworker asked me to look at indexing on some tables because his query was running very long. Over an hour.</p> <pre><code>select count(1) from databaseA.dbo.table1 inner join databaseA.dbo.table2 on (table1.key = table2.key) inner join databaseB.dbo.table3 on (table1.key = table3.key) </code></pre> <p>Note the different databases. This was being run from DatabaseB</p> <p>Tables 1 and 2 were over 2 million records long. Table3 had a dozen records or so.</p> <p>I looked at the query plan and the optimizer decided to do nested-loop index seeks into tables 1 and 2 with Table3 as the driving table!</p> <p>My first assumption was that statistics were seriously messed up on Tables1 &amp; 2 but before updating statistics I tried adding a join hint thusly:</p> <pre><code>select count(1) from databaseA.dbo.table1 inner HASH join databaseA.dbo.table2 on (table1.key = table2.key) inner join databaseB.dbo.table3 on (table1.key = table3.key) </code></pre> <p>Results returned in 15 seconds.</p> <p>Since I was short on time, I passed the results back to him but I'm worried that this might result in problems down the road.</p> <p>Should I revisit the statistics issue and resolve the problem that way? Could the bad query plan have resulted from the join being from a separate databases?</p> <p>Can anyone offer me some ideas based on your experience?</p>
[ { "answer_id": 465645, "author": "edosoft", "author_id": 6399, "author_profile": "https://Stackoverflow.com/users/6399", "pm_score": 1, "selected": false, "text": "EXEC master.dbo.sp_serveroption \n @server=N'databaseA', \n @optname=N'collation compatible', \n @optvalue=N'true'\...
2008/12/31
[ "https://Stackoverflow.com/questions/402077", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12424/" ]
402,086
<p>I'm new to LaTeX and I must say that I am really struggling with it. I discovered the \newcommand command that is kind of like a function/method in regular programming languages. You can give it arguments and everything.</p> <p>I was wondering though, can I somehow iterate in LaTeX? Basically, what I would like to do is create a table with N+1 columns where the first row just contains a blank cell and then the numbers 1, 2, ..., N in the other columns. I only want to give N as an argument to this 'function' (newcommand).</p> <p>Here is an example of something that might look like what I'm looking for (although obviously this won't work):</p> <pre>\newcommand{\mytable}[2]{ \begin{tabular}{l|*{#1}{c|}} % table with first argument+1 columns for(int i = 1; i &lt;= #1; i++) "& i" % 'output' numbers in different columns \\\hline letters & #2 % second argument should contain actual content for row \\\hline \end{tabular} }</pre> <p>Call it with:</p> <pre>\mytable{3}{a & b & c}</pre> <p>Output should be:</p> <pre> | 1 | 2 | 3 | --------+---+---+---+ letters | a | b | c | --------+---+---+---+</pre> <p>Does anyone know if something like this is possible?</p> <p>Thanks!</p>
[ { "answer_id": 402102, "author": "Chuah", "author_id": 50370, "author_profile": "https://Stackoverflow.com/users/50370", "pm_score": 2, "selected": false, "text": "\\loop \\repeat multido" }, { "answer_id": 402202, "author": "jason", "author_id": 45914, "author_profil...
2008/12/31
[ "https://Stackoverflow.com/questions/402086", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48648/" ]
402,094
<p>I have a DropDownList and a TextBox on a Page. When the user chooses the "other" option in the DropDownList I want to display a TextBox just to the right of it. I do not want to use the traditional PostBack technique. I want this interaction to be client side.</p> <p>I am aware that I can get a get a reference to the DOM element and set its style to "display:none" or "display:". What I am looking for is something that is built into the ASP.NET framework for handling something like this. I mean, in jQuery this is as simple as <code>$('controlID').hide</code>. Is there a Control Extender that can do this? Is jQuery part of the ASP.NET framework yet?</p>
[ { "answer_id": 402104, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 3, "selected": true, "text": "other <script type=\"text/javascript\" src=\"...pathtoscript../jquery.1.2.6.js\"></script>\n<script type=\"text/javascri...
2008/12/31
[ "https://Stackoverflow.com/questions/402094", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30887/" ]
402,119
<p>When running a query like "insert into table " how do we handle the commit size? I.e. are all records from anotherTable inserted in a single transaction OR is there a way to set a commit size?</p> <p><s> Thanks very much ~Sri</s> <s> PS: I am a first timer here, and this site looks very good! </s></p>
[ { "answer_id": 402165, "author": "Bill Karwin", "author_id": 20860, "author_profile": "https://Stackoverflow.com/users/20860", "pm_score": 0, "selected": false, "text": "TOP N INSERT INTO thisTable\n SELECT TOP 100 * FROM anotherTable;\n" }, { "answer_id": 436911, "author": ...
2008/12/31
[ "https://Stackoverflow.com/questions/402119", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
402,159
<p>I messed up on my SVN repository and now need to revert the entire repository from revision 28 to 24 and don't want to deal with diffs or conflicts. Is there a quick and simple way to do this? I've been able to revert back single files before fine with the merge command - but in this instance it wants to add all of the files back into the repository from revision 28 when all I really want to do is delete them.</p> <p>I am using the command line on a linux box (bash).</p> <p>Thanks</p> <p><strong>EDIT</strong></p> <p>Thanks for all of the help! I fixed it by:</p> <pre><code>svnadmin create /svnroot/&lt;repo&gt;.fixed svnadmin dump -r 1:24 /svnroot/&lt;repo&gt; --incremental &gt; dump.svn svnadmin load /svnroot/&lt;repo&gt;.fixed &lt; dump.svn </code></pre> <p>Then putting the old repo in a backup location and moving the repo.fixed to repo.</p> <p>Thanks again!</p>
[ { "answer_id": 402172, "author": "nickf", "author_id": 9021, "author_profile": "https://Stackoverflow.com/users/9021", "pm_score": 2, "selected": false, "text": "svn co path/to/my/repo -r 24\n" }, { "answer_id": 402228, "author": "Kent Fredric", "author_id": 15614, "a...
2008/12/31
[ "https://Stackoverflow.com/questions/402159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
402,200
<p>Supposing I'm setting a background image for a web page in CSS like this:</p> <pre><code>body { font-size: 62.5%; /* Resets 1em to 10px */ font-family: Verdana, Arial, Sans-Serif; background-color: #9D5922; color: #000; margin-left: auto; margin-right: auto; margin: 0; padding: 0; background: url(images/desk.gif) repeat bottom left; } </code></pre> <p>Is there any way to layer a second image on top of the desk.gif within the body element itself, or is the only way to create a separate class and use the z axis?</p> <p>Sorry, it's a simpleminded question, but I've been trying to figure this out and though I haven't been able to make it work, I also haven't found a clear slapdown of the idea anywhere online... so, is there a way, or is this just a no can do?</p> <p>Thanks!</p>
[ { "answer_id": 402293, "author": "Andy Ford", "author_id": 17252, "author_profile": "https://Stackoverflow.com/users/17252", "pm_score": 0, "selected": false, "text": "html {\nbackground: url(images/whatever.gif);\n}\n" }, { "answer_id": 411705, "author": "scronide", "aut...
2008/12/31
[ "https://Stackoverflow.com/questions/402200", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
402,215
<p>In using PHP's DOM classes (DOMNode, DOMEElement, etc) I have noticed that they possess truly readonly properties. For example, I can read the $nodeName property of a DOMNode, but I cannot write to it (if I do PHP throws a fatal error).</p> <p>How can I create readonly properties of my own in PHP?</p>
[ { "answer_id": 402227, "author": "too much php", "author_id": 28835, "author_profile": "https://Stackoverflow.com/users/28835", "pm_score": 7, "selected": true, "text": "class Example {\n private $__readOnly = 'hello world';\n function __get($name) {\n if($name === 'readOnly...
2008/12/31
[ "https://Stackoverflow.com/questions/402215", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42523/" ]
402,217
<p>I need to store some data in a Django model. These data are not equal to all instances of the model.</p> <p>At first I thought about subclassing the model, but I’m trying to keep the application flexible. If I use subclasses, I’ll need to create a whole class each time I need a new kind of object, and that’s no good. I’ll also end up with a lot of subclasses only to store a pair of extra fields.</p> <p>I really feel that a dictionary would be the best approach, but there’s nothing in the Django documentation about storing a dictionary in a Django model (or I can’t find it).</p> <p>Any clues?</p>
[ { "answer_id": 402248, "author": "Ned Batchelder", "author_id": 14343, "author_profile": "https://Stackoverflow.com/users/14343", "pm_score": 4, "selected": false, "text": "repr eval safe_eval create update views if isinstance(request.data, dict) == False:\n req_data = request.data.di...
2008/12/31
[ "https://Stackoverflow.com/questions/402217", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34479/" ]
402,231
<p>which is best for a string type global variable in one aspx page?</p>
[ { "answer_id": 402256, "author": "Abram Simon", "author_id": 46204, "author_profile": "https://Stackoverflow.com/users/46204", "pm_score": 1, "selected": false, "text": "String.IsNullOrEmpty()" }, { "answer_id": 402715, "author": "Marc Gravell", "author_id": 23354, "a...
2008/12/31
[ "https://Stackoverflow.com/questions/402231", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50383/" ]
402,247
<p>I have been programming in Java since 2004, mostly enterprise and web applications. But I have never used <em>short</em> or <em>byte</em>, other than a toy program just to know how these types work. Even in a <em>for loop</em> of 100 times, we usually go with <em>int</em>. And I don't remember if I have ever came across any code which made use of <em>byte</em> or <em>short</em>, other than some public APIs and frameworks.</p> <p>Yes I know, you can use a <em>short</em> or <em>byte</em> to save memory in large arrays, in situations where the memory savings actually matters. Does anyone care to practice that? Or its just something in the books.</p> <p><strong>[Edited]</strong></p> <p>Using <em>byte</em> arrays for network programming and socket communication is a quite common usage. Thanks, Darren, to point that out. Now how about <em>short</em>? Ryan, gave an excellent example. Thanks, Ryan.</p>
[ { "answer_id": 402381, "author": "Alan Moore", "author_id": 20938, "author_profile": "https://Stackoverflow.com/users/20938", "pm_score": 2, "selected": false, "text": "byte short byte short int int byte short" }, { "answer_id": 402542, "author": "asalamon74", "author_id"...
2008/12/31
[ "https://Stackoverflow.com/questions/402247", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42769/" ]
402,250
<p>I'm using an iframe to display content that has links. When the user clicks around in the iFrame and hits "back," it goes back in the iFrame. This behavior is OK. However, once they're back to the first page of the iFrame and they hit "back" again, the entire window is taken back to the previous page. This is unwanted.</p> <p>To prevent this behavior, I've put a fake "back" button within the iFrame. (In most cases this is bad UI, in this case, it works well). I'd like this fake back button to only go back if the previous page is the iFrame's page -- not the entire page. <strong>When they hit the fake back button in the iFrame, it should only move that iFrame back, nothing else.</strong> Is there a way to do this? Does an iFrame get its own history object?</p> <p>Something that might be of benefit: the domain of the iFrame and the main window can be assumed to be distinct. So, if it's possible to read the "global" history object, I can check to see if the previous page was mine by checking to see if the domain is mine. If the domain is not mine, the fake back button will be hidden or not do anything.</p> <p>Help greatly appreciated, and happy holidays!</p>
[ { "answer_id": 10593070, "author": "Bryan", "author_id": 55124, "author_profile": "https://Stackoverflow.com/users/55124", "pm_score": 2, "selected": false, "text": "document.location.href = document.referrer;\n" } ]
2008/12/31
[ "https://Stackoverflow.com/questions/402250", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43005/" ]
402,283
<p>I am not able to understand the differences between <code>std::string</code> and <code>std::wstring</code>. I know <code>wstring</code> supports wide characters such as Unicode characters. I have got the following questions:</p> <ol> <li>When should I use <code>std::wstring</code> over <code>std::string</code>?</li> <li>Can <code>std::string</code> hold the entire ASCII character set, including the special characters?</li> <li>Is <code>std::wstring</code> supported by all popular C++ compilers?</li> <li>What is exactly a "<em>wide character</em>"?</li> </ol>
[ { "answer_id": 402813, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 5, "selected": false, "text": "wide std::string utf-8 str.size() Glib::ustring utf-32 s.size()" }, { "answer_id": 402918, "aut...
2008/12/31
[ "https://Stackoverflow.com/questions/402283", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
402,299
<p>I'm relatively new to ASP.NET and was wondering if anyone could shed some light on when I should use relative references (e.g. ../images/banner_tinga.jpg) versus the tilde (e.g. ~/images/banner_tinga.jpg). Depending on the situation you can accomplish the same goal using either. What are the pros and cons of each mechanism? One argument for the relative reference seems to be Visual Studio's design time dislike for resources referenced by the tilde. Whenever I reference a css file that why it indicates it can not be found.</p> <p>Regards, javacavaj</p>
[ { "answer_id": 402491, "author": "Cyril Gupta", "author_id": 33052, "author_profile": "https://Stackoverflow.com/users/33052", "pm_score": 3, "selected": true, "text": "<img src=\"~/images/myimage.png\" runat=\"server\">\n <img src=\"~/images/myimage.png\" runat=\"server\" EnableViewStat...
2008/12/31
[ "https://Stackoverflow.com/questions/402299", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21410/" ]
402,302
<p>Here's the .jsp code:</p> <pre><code>&lt;table&gt; &lt;s:iterator value="allAgents"&gt; &lt;tr&gt; &lt;td&gt;&lt;s:property value="firstName" /&gt;&lt;/td&gt; &lt;td&gt;&lt;s:property value="middleName" /&gt;&lt;/td&gt; &lt;td&gt;&lt;s:property value="lastName" /&gt;&lt;/td&gt; &lt;td&gt;&lt;s:checkbox name="ss"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/s:iterator&gt; &lt;/table&gt; </code></pre> <p>When rendered, the checkbox would occupy a whole row below the 'names', centered. Here's the generated html for what's supposed to be a single row:</p> <pre><code>&lt;tr&gt; &lt;td&gt;first&lt;/td&gt; &lt;td&gt;middle&lt;/td&gt; &lt;td&gt;last&lt;/td&gt; &lt;td&gt; &lt;tr&gt; &lt;td valign="top" align="right"&gt;&lt;/td&gt; &lt;td valign="top" align="left"&gt;&lt;input type="checkbox" name="ss" value="true" id="agent_ss" /&gt; &lt;input type="hidden" name="__checkbox_ss" value="true" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/td&gt; &lt;/tr&gt; </code></pre> <p>Is it me or struts? TIA.</p>
[ { "answer_id": 495743, "author": "kazanaki", "author_id": 60593, "author_profile": "https://Stackoverflow.com/users/60593", "pm_score": 0, "selected": false, "text": "s:checkbox <td> <td>" } ]
2008/12/31
[ "https://Stackoverflow.com/questions/402302", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15187/" ]
402,307
<p>I was wondering what the best way to model a relationship where an object is associated with exactly n objects of another class. I want to extend the has_one relationship to a specific value of n. </p> <p>For example, a TopFiveMoviesList would belong to user and have exactly five movies. I would imagine that the underlying sql table would have fields like movie_id_1, movie_id_2, ... movie_id_5. </p> <p>I know I could do a has_many relationship and limit the number of children at the model level, but I'd rather not have an intermediary table. </p>
[ { "answer_id": 404279, "author": "cpm", "author_id": 3674, "author_profile": "https://Stackoverflow.com/users/3674", "pm_score": 2, "selected": true, "text": "User.movie[1-5]_id movie1_id movie_id_1 class User < ActiveRecord::Base\n TOP_N_MOVIES = 5\n (1..TOP_N_MOVIES).each { |n| belo...
2008/12/31
[ "https://Stackoverflow.com/questions/402307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1227001/" ]
402,313
<p>I recently upgraded a Web Application Project (as well as some dependent projects) from .net 2.0 to .net 3.5 using the built in conversion tool. Everything works well such as using MS AJAX 3.5 vs. the external MS AJAX libraries in 2.0.</p> <p>My problem occurs when I tried using the new Lambda Expression syntax. The compiler will not recognize Lambda Expressions as valid syntax. The target frame work version is set to 3.5 in all projects in the solution.I was also able to successfully use Lambda Expressions in a Library Project in the same solution.</p> <p>The is the code that is giving me the error. Nothing too special.</p> <pre><code>ObjectFactory.Initialize(x =&gt; { x.ForRequestedType&lt;IUnitIdSequencingService&gt;().TheDefaultIsConcreteType&lt;UnitIdSequencingService&gt;(); x.ForRequestedType&lt;IGadgetDAO&gt;().TheDefault.Is.OfConcreteType&lt;GadgetDAO&gt;().WithCtorArg("instance").EqualToAppSetting("OSHAInspectionManager"); }); </code></pre> <p>The specific errors I am getting are:</p> <pre><code>Error 102 Invalid expression term '&gt;' D:\projects\bohlco\pmr\PMR\Web\App_Code\Bootstrapper.cs 13 41 D:\...\Web\ </code></pre> <p>Any help would be greatly appreciated. I have been searching Google with little luck</p>
[ { "answer_id": 402400, "author": "justin.m.chase", "author_id": 12958, "author_profile": "https://Stackoverflow.com/users/12958", "pm_score": 0, "selected": false, "text": "ObjectFactory.Initialize((Action<T>)(x => // where T is the typeof x\n{\n // ...\n}));\n" }, { "answer_i...
2008/12/31
[ "https://Stackoverflow.com/questions/402313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22264/" ]
402,314
<p>In a way following on from <a href="https://stackoverflow.com/questions/158534/reading-a-windows-dmp-file">reading a windows *.dmp file</a></p> <p>Having received a dump file from random customer, running the debug session to see the crash, you often find it is in a MS or other third party library. The next issue is that you may not have knowledge of the PC setup to such an extent that you can ensure you have the actually modules available. </p> <p>For instance I'm currently stuck trying to get symbols to load for ntdll.dll (5.01.2600.5512). In MSVC 2005 the path column in the modules list window shows a * before the fully pathed file name, and refuses to load symbols I have downloaded for XP/SP1/SP1a/SP2/SP3.</p> <p>I have the symbol server setup to download from the internet and store in a local cache which seems to have been working fine for modules that I do have on my PC. Using GUI equivelant to the method </p> <pre> Set _NT_SYMBOL_PATH=srv*d:\SymbolCache*\\server1\Third-Party-PDB;srv*d:\SymbolCache*\\server2\Windows\Symbols*http://msdl.microsoft.com/download/symbols </pre> <p>Perhaps I have the wrong symbols, but as new ones are not downloading where do I go to next? Do I have to contact the customer and ask what SP they have installed, and any other patches? Do I have to install that machine and then run up the debugger with the dmp file to get the symbols I need?</p>
[ { "answer_id": 403511, "author": "MSN", "author_id": 6210, "author_profile": "https://Stackoverflow.com/users/6210", "pm_score": 1, "selected": true, "text": "_NT_SYMBOL_PATH" }, { "answer_id": 414972, "author": "bk1e", "author_id": 8090, "author_profile": "https://St...
2008/12/31
[ "https://Stackoverflow.com/questions/402314", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37558/" ]
402,330
<pre><code>java -classpath ../classes;../jar;. parserTester </code></pre> <p>How can i get the functionality in the above command programmatically? Like, is it possible to run as:</p> <pre><code>java parserTester </code></pre> <p>and get the same result? I tried using URLClassLoader but it modifies the classpath and does not add to it.</p> <p>Thanx!</p> <hr> <p>Thanks for the response Milhous. But that is what i am trying to do.. How is it possible to get the jar into the classpath first? I tried using a custom classloader too :(</p> <p>That works.. But sorry that i need to run it only as: java parserTester I would like to know if such a thing is possible???</p> <p>It needs to be so bcoz i have parserTester.java and .class in a separate folder. I need to retain the file structure. The parserTester makes use of a jar in a separate jar folder.</p>
[ { "answer_id": 402335, "author": "Milhous", "author_id": 17712, "author_profile": "https://Stackoverflow.com/users/17712", "pm_score": 0, "selected": false, "text": "java -cp *.jar:. myClass\n export CLASSPATH=./lib/tool.jar:.\njava myClass\n java -jar file.jar\n" }, { "answer_id...
2008/12/31
[ "https://Stackoverflow.com/questions/402330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
402,337
<p>Has anyone been able to succesfully use the IE CSS hack #IEroot? I stumbled upon it from <a href="http://www.positioniseverything.net/articles/cc-plus.html" rel="nofollow noreferrer">this article</a> but it doesn't seem to work for me.</p> <p>I'm trying to fix/hack the inline styling bug to produce li inline blocks</p> <pre><code>#featured li { margin:0px; padding:0px; width:317px; height:310px; display:inline-block; border-left:1px #bdbdbd solid; } #IEroot #featured li { display:inline; } </code></pre> <p>Any help would be greatly apperciated, thanks.</p>
[ { "answer_id": 402360, "author": "Wouter van Nifterick", "author_id": 38813, "author_profile": "https://Stackoverflow.com/users/38813", "pm_score": -1, "selected": false, "text": "/* >>>>>>> BUTT-UGLY BROWSER HACK! FIX ME!!!!! <<<<<<<< */\n#IEroot #featured li {\n display:inline;\n}\n...
2008/12/31
[ "https://Stackoverflow.com/questions/402337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48266/" ]
402,339
<p>How do I get justified text with UTTextField. It does have an textAlignment property. But the UITextAlignment constant only has left, right, and center justification.</p> <p>What I am seeking is the Justified text common in word processing app with text flush with both left and right edges. This is a read only text field.</p> <p>I have seen it in few iPhone apps. So it seems I am missing something. </p>
[ { "answer_id": 402360, "author": "Wouter van Nifterick", "author_id": 38813, "author_profile": "https://Stackoverflow.com/users/38813", "pm_score": -1, "selected": false, "text": "/* >>>>>>> BUTT-UGLY BROWSER HACK! FIX ME!!!!! <<<<<<<< */\n#IEroot #featured li {\n display:inline;\n}\n...
2008/12/31
[ "https://Stackoverflow.com/questions/402339", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
402,341
<p>I'd like to write a function in Javascript along the lines of:</p> <pre><code>in_subnet(ip, network, slash) { ... } in_subnet('1.2.3.4', '1.2.0.0', 16) # True, since it's in 1.2.0.0/16 in_subnet('1.2.3.4', '1.2.0.0', 24) # False, since it's not in 1.2.0.0/24 </code></pre> <p>Should I write it from scratch, or are there some good libraries I could use? Or is the entire function already written and in the public domain?</p>
[ { "answer_id": 402363, "author": "Artelius", "author_id": 31945, "author_profile": "https://Stackoverflow.com/users/31945", "pm_score": 2, "selected": false, "text": "addr_one = ip_addr_to_integer(ip);\naddr_two = ip_addr_to_integer(network);\nmask = ((1 << (32-slash)) - 1) ^ 0xFFFFFFFF;...
2008/12/31
[ "https://Stackoverflow.com/questions/402341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
402,348
<p>I need to set/get the cookies stored at <code>first.example</code> while browsing <code>second.example</code>, I have full access of <code>first.example</code> but I only have JavaScript access (can manipulate the DOM as I want) on <code>second.example</code>.</p> <p>My first approach was to create an iframe on <code>second.example</code> (with JS) that loaded a page like <code>first.example/doAjax?setCookie=xxx</code> and that did an AJAX call to say <code>first.example/setCookie?cookieData=xxx</code> which would set the cookie on <code>first.example</code> with the data we passed around.</p> <p>That pretty much worked fine for setting the cookie on <code>first.example</code> from <code>second.example</code> - for getting a cookie I basically followed the same procedure, created the iframe that loaded <code>first.example/doAjax?getCookie</code> and that would do an AJAX call to say <code>first.example/getCookie</code> which would read the cookie info on <code>first.example</code> and return it as a JSON object.</p> <p>The problem is that I'm unable to bring that JSON cookie object back to <code>second.example</code> so I can read it, well maybe I could just bring it when the AJAX call is complete using &quot;window.top&quot; but there's timing issues because its not relative to when the iframe has been loaded. I hope I am clear and was wondering if there's an easier solution rather than this crazy iframe-&gt;ajax crap, also seems like this won't even work for getting cookies in SAFARI.</p>
[ { "answer_id": 402354, "author": "Ryan Doherty", "author_id": 956, "author_profile": "https://Stackoverflow.com/users/956", "pm_score": 4, "selected": true, "text": " <script type=\"text/javascript\">\n var newfile=document.createElement('script');\n newfile.setAttribute(\"type\",\"t...
2008/12/31
[ "https://Stackoverflow.com/questions/402348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50394/" ]
402,355
<p>I am trying to connect to a remote MySQL database using Visual C# 2008 Express Edition. Is there a way to connect using the editor, or do I have to code the connection manually? The editor has a clear and easy-to-follow wizard for connecting to Microsoft SQL Server and Access databases, but I don't see an easy way to add a remote MySQL datasource. I tried searching the help, but couldn't find anything useful.</p> <p>Has anyone done this using the editor? Or can point me in a useful direction?</p>
[ { "answer_id": 671882, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing MySql.Data.MySqlClient;\nnames...
2008/12/31
[ "https://Stackoverflow.com/questions/402355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23249/" ]
402,359
<p>Can you simply delete the directory from your python installation, or are there any lingering files that you must delete?</p>
[ { "answer_id": 402444, "author": "cdleary", "author_id": 3594, "author_profile": "https://Stackoverflow.com/users/3594", "pm_score": 7, "selected": true, "text": "install easy_install" }, { "answer_id": 928621, "author": "offby1", "author_id": 20146, "author_profile":...
2008/12/31
[ "https://Stackoverflow.com/questions/402359", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16584/" ]
402,364
<p>My idea of program:</p> <p>I have a dictionary:</p> <pre><code>options = { 'string' : select_fun(function pointer), 'float' : select_fun(function pointer), 'double' : select_fun(function pointer) } </code></pre> <p>whatever type comes single function <code>select_fun(function pointer)</code> gets called. Inside <code>select_fun(function pointer)</code>,I will have diff functions for float, double and so on.</p> <p>Depending on function pointers, specified function will get called.</p> <p>I don't know whether my programming knowledge is good or bad, still I need help.</p>
[ { "answer_id": 402369, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 4, "selected": false, "text": "def plus_1(x):\n return x + 1\n\ndef minus_1(x):\n return x - 1\n\nfunc_map = {'+' : plus_1, '-' : minus_1}\n\...
2008/12/31
[ "https://Stackoverflow.com/questions/402364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46646/" ]
402,375
<p>What is the best way to delete a table referenced by a foreign keys?</p>
[ { "answer_id": 402394, "author": "paxdiablo", "author_id": 14860, "author_profile": "https://Stackoverflow.com/users/14860", "pm_score": 1, "selected": false, "text": "ALTER TABLE <table_name> DROP FOREIGN KEY <foreignkey_name>\n" } ]
2008/12/31
[ "https://Stackoverflow.com/questions/402375", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47957/" ]
402,377
<p>I wish to have long and short forms of command line options invoked using my shell script.</p> <p>I know that <code>getopts</code> can be used, but like in Perl, I have not been able to do the same with shell.</p> <p>Any ideas on how this can be done, so that I can use options like:</p> <pre><code>./shell.sh --copyfile abc.pl /tmp/ ./shell.sh -c abc.pl /tmp/ </code></pre> <p>In the above, both the commands mean the same thing to my shell, but using <code>getopts</code>, I have not been able to implement these?</p>
[ { "answer_id": 402410, "author": "Bill Karwin", "author_id": 20860, "author_profile": "https://Stackoverflow.com/users/20860", "pm_score": 9, "selected": true, "text": "getopts getopt getopt getopt(3) getopt(1) getopts case getopts" }, { "answer_id": 402412, "author": "Nietzc...
2008/12/31
[ "https://Stackoverflow.com/questions/402377", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35416/" ]
402,391
<p>I need to be able to write a function that shows repeated words from a string and return a list of strings in order of its occurrence and ignore non-letters</p> <p>e.g at hugs prompt</p> <pre><code>repetitions :: String -&gt; [String] repetitions &gt; "My bag is is action packed packed." output&gt; ["is","packed"] repetitions &gt; "My name name name is Sean ." output&gt; ["name","name"] repetitions &gt; "Ade is into into technical drawing drawing ." output&gt; ["into","drawing"] </code></pre>
[ { "answer_id": 402409, "author": "Apocalisp", "author_id": 3434, "author_profile": "https://Stackoverflow.com/users/3434", "pm_score": 4, "selected": true, "text": "words filter Data.Char.isAlphaNum (x, y) x x y repetitions s = map fst . filter (uncurry (==)) . zip l $ tail l\n where l ...
2008/12/31
[ "https://Stackoverflow.com/questions/402391", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50409/" ]
402,403
<p>I'm trying to develop a firefox extension that inserts additional HTTP header fields into outgoing HTTP requests (to interface with an apache extension i'm concurrently developing).</p> <p>While I understand the individual components of an extension and understand the basic tutorials that are presented on the web, I'm finding it difficult going from the "Hello World" tutorial extensions, into developing a full blown extension.</p> <p>The sample code I am wanting to adapt for my purposes is presented at the bottom of <a href="https://developer.mozilla.org/En/Setting_HTTP_request_headers" rel="noreferrer">Setting HTTP request headers</a>.</p> <p>I am wondering, where in the extension hierarchy should this code be placed and how is such code called/constructed/activated, will it run automatically when the extension is initialised?</p> <p><br/><br/> Thanks in advance.</p>
[ { "answer_id": 445414, "author": "Nickolay", "author_id": 1026, "author_profile": "https://Stackoverflow.com/users/1026", "pm_score": 0, "selected": false, "text": "components/<some name>.js components var myModule = { catMgr.addCategoryEntry(\"app-startup\", this.myName, this.myProgID, ...
2008/12/31
[ "https://Stackoverflow.com/questions/402403", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42050/" ]
402,432
<p>I am trying to return an array Data Member from one smaller 2D Array Object, and trying to insert the array into a larger 2D array object. But when attempting this, I came into two problems.</p> <p>First problem is that I want to return the name of the 2D array, but I do not know how to properly syntax to return 2D Array name.</p> <p>This is what my 2D Array data member looks like</p> <pre> private: int pieceArray[4][4]; // 2D Smaller Array </pre> <p>and I want to return this array into a function, but this one causes a compiler error:</p> <pre> int Piece::returnPiece() { return pieceArray; //not vaild // return the 2D array name } </pre> <p>I tired using this return type and it worked:</p> <pre> int Piece::returnPiece() { return pieceArray[4][4]; } </pre> <p>But I am unsure if this is what I want, as I want to return the array and all of it's content.</p> <p>The other problem is the InsertArray() function, where I would put the returnPiece() function in the InsertArray()'s argument.</p> <p>The problem with the InsertArray() is the argument, heres the code for it:</p> <pre> void Grid::InsertArray( int arr[4][4] ) //Compiler accepts, but does not work { for(int i = 0; i &lt x_ROWS ; ++i) { for (int j = 0; j &lt y_COLUMNS ; ++j) { squares[i][j] = arr[i][j]; } } } </pre> <p>The problem with this is that it does not accept my returnPiece(), and if i remove the "[4][4]", my compiler does not accept.</p> <p>Mostly all these are syntax errors, but how do I solve these problems?</p> <ol> <li>Returning the whole pieceArray in returnPiece()</li> <li>The correct syntax for the argument in InsertArray()</li> <li>The argument of InsertArray() accepting the returnPiece()</li> </ol> <p>These 3 are the major problems that I need help with, and had the same problem when I attempt to use the pointer pointer method. Does anyone know how to solve these 3 problems?</p>
[ { "answer_id": 402456, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 3, "selected": true, "text": "// Piece::returnPiece is a function taking no arguments and returning a pointer to a\n// 4x4 array of integers\nint (...
2008/12/31
[ "https://Stackoverflow.com/questions/402432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
402,448
<p>I have a Div Tag which contains 4 child Div Tags</p> <pre> <code> &lt;Div id="Parent"> &lt;div id="childOne">ChildOne &lt/div> &lt;div id="childOne">ChildTwo &lt/div> &lt;div id="childOne">ChildThree &lt/div> &lt;div id="childOne">ChildFour &lt/div> &lt/Div> </code> </pre> <p>Now I would like to access these Child Div's using up and Down Arrow Keys through Javascript The above div is show on click of a TextBox.I want that the user can choose any of the child div and its selected value appears in the TextBox. I have acheived the end result by attachinh onClick event to each childDiv.</p>
[ { "answer_id": 402655, "author": "meouw", "author_id": 12161, "author_profile": "https://Stackoverflow.com/users/12161", "pm_score": 3, "selected": false, "text": "<style>div.active{ background: red }</style>\n\n<input type=\"text\" id=\"tb\">\n\n<div id=\"Parent\">\n <div id=\"child...
2008/12/31
[ "https://Stackoverflow.com/questions/402448", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
402,455
<p>I need to find basic WYSIWYG HTML editor component for C++Builder 5 to let users to create some simple text that I will paste into existing HTML page template. Just a simple support to create links, add images, use headers/bold/italic.</p>
[ { "answer_id": 402482, "author": "Wouter van Nifterick", "author_id": 38813, "author_profile": "https://Stackoverflow.com/users/38813", "pm_score": 4, "selected": true, "text": "// Delphi code..\n(WebBrowser1.Document as IHTMLDocument2).designMode := 'on';\n (WebBrowser.Document as IHTML...
2008/12/31
[ "https://Stackoverflow.com/questions/402455", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44715/" ]
402,474
<p>I'm a student of web development (and college), so my apologies if this comes off sounding naive and offensive, I certainly don't mean it that way. My experience has been with PHP and with a smallish project on the horizon (a glorified shift calendar) I hoped to learn one of the higher level frameworks to ease the code burden. So far, I looked at CakePHP Symfony Django and Rails.</p> <p>With PHP, the URLs mapped very simply to the files, and it "just worked". It was quick for the server, and intuitive. But with all of these frameworks, there is this inclination to "pretty up" the URLs by making them map to different functions and route the parameters to different variables in different files. </p> <p>"The Rails Way" book that I'm reading admits that this is dog slow and is the cause of most performance pains on largish projects. My question is "why have it in the first place?"? Is there a specific point in the url-maps-to-a-file paradigm (or mod_rewrite to a single file) that necessitates regexes and complicated routing schemes? Am I missing out on something by not using them?</p> <p>Thanks in advance!</p>
[ { "answer_id": 402494, "author": "kender", "author_id": 4172, "author_profile": "https://Stackoverflow.com/users/4172", "pm_score": 4, "selected": true, "text": "mod_rewrite http://www.example.com/ / / mod_rewrite" }, { "answer_id": 402497, "author": "Sophie Alpert", "aut...
2008/12/31
[ "https://Stackoverflow.com/questions/402474", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13257/" ]
402,481
<p>I have a web page where it will input an excel/CSV file from the user and read the data from it and import to DB.While inserting each record.I just want to show the details about the record being inserted to the user.(Ex : Client Details of A is adding...)</p>
[ { "answer_id": 402501, "author": "Michael Bray", "author_id": 50356, "author_profile": "https://Stackoverflow.com/users/50356", "pm_score": 3, "selected": true, "text": "<%@ Page Language=\"C#\" AutoEventWireup=\"true\" CodeBehind=\"Default.aspx.cs\" Inherits=\"WebApplication1._Default\"...
2008/12/31
[ "https://Stackoverflow.com/questions/402481", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40521/" ]
402,483
<p>I currently have a unittest.TestCase that looks like..</p> <pre><code>class test_appletrailer(unittest.TestCase): def setup(self): self.all_trailers = Trailers(res = "720", verbose = True) def test_has_trailers(self): self.failUnless(len(self.all_trailers) &gt; 1) # ..more tests.. </code></pre> <p>This works fine, but the <code>Trailers()</code> call takes about 2 seconds to run.. Given that <code>setUp()</code> is called before each test is run, the tests now take almost 10 seconds to run (with only 3 test functions)</p> <p>What is the correct way of caching the <code>self.all_trailers</code> variable between tests?</p> <p>Removing the setUp function, and doing..</p> <pre><code>class test_appletrailer(unittest.TestCase): all_trailers = Trailers(res = "720", verbose = True) </code></pre> <p>..works, but then it claims "Ran 3 tests in 0.000s" which is incorrect.. The only other way I could think of is to have a cache_trailers global variable (which works correctly, but is rather horrible):</p> <pre><code>cache_trailers = None class test_appletrailer(unittest.TestCase): def setUp(self): global cache_trailers if cache_trailers is None: cache_trailers = self.all_trailers = all_trailers = Trailers(res = "720", verbose = True) else: self.all_trailers = cache_trailers </code></pre>
[ { "answer_id": 402492, "author": "cdleary", "author_id": 3594, "author_profile": "https://Stackoverflow.com/users/3594", "pm_score": 5, "selected": true, "text": "class test_appletrailer(unittest.TestCase):\n\n all_trailers = None\n\n def setup(self):\n # Only initialize all...
2008/12/31
[ "https://Stackoverflow.com/questions/402483", "https://Stackoverflow.com", "https://Stackoverflow.com/users/745/" ]
402,503
<p>I have developed code with Ajax and jQuery. I have got a response from my.php, and I have tried to extract the values of the response. Here the code (HTML):</p> <h3>My.php</h3> <pre><code>?php echo '&lt;div id=&quot;title&quot;&gt;My Title &lt;/div&gt;'; echo '&lt;div id=&quot;message&quot;&gt; My message &lt;/div&gt;'; ?&gt; </code></pre> <p>I try to extract the title and message so my code is below.</p> <pre><code> &lt;head&gt; &lt;script type=&quot;text/javascript&quot; src=&quot;js/jquery-1.2.6.js&quot;&gt;&lt;/script&gt; &lt;script type=&quot;text/javascript&quot;&gt; $(document).ready(function() { alert(&quot;OK&quot;); $.ajax({ type:&quot;POST&quot;, url: &quot;my.php&quot;, cache:false , success: function(data){ $(&quot;#response&quot;).html(data); var $response = $(data); var oneval = $response.find('#title').text(); var subval = $response.find('#message').text(); alert(oneval); } }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id=&quot;response&quot;&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>...</p> <p>The problem is when I tried to alert, it is not working. What is wrong with this logic? Should I use another function to extract the title and message?</p>
[ { "answer_id": 402509, "author": "Michael Bray", "author_id": 50356, "author_profile": "https://Stackoverflow.com/users/50356", "pm_score": -1, "selected": false, "text": "var oneval = $(\"#response #title\").text();\nvar subval = $(\"#response #message\").text();\n" }, { "answer...
2008/12/31
[ "https://Stackoverflow.com/questions/402503", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44984/" ]
402,504
<p>How do I see the type of a variable? (e.g. unsigned 32 bit)</p>
[ { "answer_id": 402507, "author": "Srikanth", "author_id": 7205, "author_profile": "https://Stackoverflow.com/users/7205", "pm_score": 9, "selected": false, "text": "type() >>> v = 10\n>>> type(v)\n<type 'int'>\n >>> v = 100000000000000\n>>> type(v)\n<type 'long'>\n >>> v = -10\n>>> type(...
2008/12/31
[ "https://Stackoverflow.com/questions/402504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46646/" ]
402,514
<p>I was reading some Java recently and came across something (an idiom?) new to me: in the program, classes with multiple constructors would also always include a blank constructor. For example: </p> <pre><code>public class Genotype { private boolean bits[]; private int rating; private int length; private Random random; public Genotype() { // &lt;= THIS is the bandit, this one right here random = new Random(); } /* creates a Random genetoype */ public Genotype(int length, Random r) { random = r; this.length = length; bits = new boolean[length]; for(int i=0;i&lt;length;i++) { bits[i] =random.nextBoolean(); } } /* copy constructor */ public Genotype(Genotype g,Random r) { random = r; bits = new boolean[g.length]; rating = g.rating; length = g.length; for(int i=0;i&lt;length;i++) { bits[i] = g.bits[i]; } } } </code></pre> <p>The first constructor doesn't seem to be a "real" constructor, it seems as though in every case one of the other constructors will be used. So why is that constructor defined at all?</p>
[ { "answer_id": 402716, "author": "alepuzio", "author_id": 45745, "author_profile": "https://Stackoverflow.com/users/45745", "pm_score": 0, "selected": false, "text": "MyObejct myObject=null\ntry{...\n}catch(Exception e){\n log.error(myObject);//maybe print null. information?\n}\n MyOb...
2008/12/31
[ "https://Stackoverflow.com/questions/402514", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29182/" ]
402,517
<p>Double.TryParse returns a value, and I don't need a value. I need to be able to tell if a string is numeric and just return a bool.</p> <p>is there a way to do this? </p>
[ { "answer_id": 402525, "author": "Mitch Wheat", "author_id": 16076, "author_profile": "https://Stackoverflow.com/users/16076", "pm_score": 3, "selected": false, "text": "Microsoft.VisualBasic Information.IsNumeric(). using Microsoft.VisualBasic;\n\n...\n\nif (Information.IsNumeric(\"1233...
2008/12/31
[ "https://Stackoverflow.com/questions/402517", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4140/" ]
402,522
<p>I use SVN as the source control system, and I wonder how to compare directories while ignoring any metadata differences. Is there a way to tell <code>svn diff</code> to compare only the actual content and ignore any metadata? </p> <p>I mean metadata like SVN properties, etc. that don't affect the file content. Assume file X has an additional property in branch B compared to trunk T. Unfortunately it will show up in 'svn diff T B' even though the actual content of file X is the same.</p> <p>I look for something like this:</p> <pre><code>svn diff https://example.org/tags/v1 https://example.org/tags/v2 -x -ignore-metadata --summarize </code></pre> <p><strong>Update:</strong> I partially solved this by diff'ing directly on the filesystem instead of using the SVN tools. See my own answer below...</p>
[ { "answer_id": 515031, "author": "Joe Watkins", "author_id": 11928, "author_profile": "https://Stackoverflow.com/users/11928", "pm_score": 4, "selected": false, "text": "--summarize M URL -- indicates content change\n M URL -- property change\nMM URL -- content and property change\n"...
2008/12/31
[ "https://Stackoverflow.com/questions/402522", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50430/" ]
402,536
<p>I'm in the process of porting some ANSI C++ code to C#... and this is killing me right now.</p> <p>Both tests have <code>value = 6844268</code>.</p> <p>Test code:</p> <pre><code>value &gt;&gt; 12 value &amp; 0x00000FFF </code></pre> <p>C++ returns 18273 and 29497, whereas C# returns 1670 and 3948. I've tried every possible combination of types in C# (int, uint, long, ulong, Int64...), but no go :(</p> <p>Original value in C++ is unsigned int. Anyone have any ideas?</p> <p>EDIT: Argh, I messed up my debugging. Was looking at array[value] instead of value. My bad.</p>
[ { "answer_id": 402545, "author": "Lasse V. Karlsen", "author_id": 267, "author_profile": "https://Stackoverflow.com/users/267", "pm_score": 4, "selected": true, "text": ">> 6844268 = 11010000110111101101100\n>> 12 = 11010000110.111101101100\nresult = 1101000011...
2008/12/31
[ "https://Stackoverflow.com/questions/402536", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40164/" ]
402,538
<p>I see a lot of code like this:</p> <pre><code>function Base() {} function Sub() {} Sub.prototype = new Base(); </code></pre> <p>However, if you do:</p> <pre><code>s = new Sub(); print(s.constructor == Sub); </code></pre> <p>This is false. This seems confusing to me, since s's constructor is, indeed, Sub. Is it conventional/better to do this?</p> <pre><code>function Base() {} function Sub() {} Sub.prototype = new Base(); Sub.prototype.constructor = Sub; </code></pre> <p>or does it not really matter?</p>
[ { "answer_id": 402768, "author": "AnthonyWJones", "author_id": 17516, "author_profile": "https://Stackoverflow.com/users/17516", "pm_score": 2, "selected": false, "text": "instanceof print(s instanceof Sub);\n isPrototypeOf print(Sub.prototype.isPrototypeOf(s));\n" }, { "answer_i...
2008/12/31
[ "https://Stackoverflow.com/questions/402538", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15055/" ]
402,541
<p>How can I have that functionality in my game through which the players can change their hairstyle, look, style of clothes, etc., and so whenever they wear a different item of clothing their avatar is updated with it.</p> <p>Should I:</p> <ul> <li><p>Have my designer create all possible combinations of armor, hairstyles, and faces as sprites (this could be a lot of work).</p></li> <li><p>When the player chooses what they should look like during their introduction to the game, my code would automatically create this sprite, and all possible combinations of headgear/armor with that sprite. Then each time they select some different armor, the sprite for that armor/look combination is loaded.</p></li> <li><p>Is it possible to have a character's sprite divided into components, like face, shirt, jeans, shoes, and have the pixel dimensions of each of these. Then whenever the player changes his helmet, for example, we use the pixel dimensions to put the helmet image in place of where its face image would normally be. (I'm using Java to build this game)</p></li> <li><p>Is this not possible in 2D and I should use 3D for this?</p></li> <li>Any other method?</li> </ul> <p>Please advise. </p>
[ { "answer_id": 402554, "author": "mstrobl", "author_id": 25965, "author_profile": "https://Stackoverflow.com/users/25965", "pm_score": 2, "selected": true, "text": "// \n// @param dependant_textures is a vector of textures where \n// texture n+1 depends on texture n. \n// @param combimed...
2008/12/31
[ "https://Stackoverflow.com/questions/402541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49153/" ]
402,598
<p>I am working on project in Linux which involves 1) Static Lib in C++ 2) GUI developed in C++/QT which uses static lib.</p> <p>Now both the lib and gui are build from command prompt using makefiles.</p> <p>I am trying to debug both like when I hit one button, call should go from GUI to lib.</p> <p>Is it possible to do like this in Linux with eclipse? I can easily follow same debugging procedure in Windows using Visual studio and attaching lib to GUI but I cannot find any good way to do here with eclipse.</p> <p>I have tried many IDEs/debuggers like Anjuta Code Blocks. DDD,Kdbg but none is working properly.</p> <p>I am not sure that if I am wrong or is it much complex to debug?</p> <p>Can some one suggest one proper way to debug ?</p>
[ { "answer_id": 402613, "author": "CB Bailey", "author_id": 19563, "author_profile": "https://Stackoverflow.com/users/19563", "pm_score": 1, "selected": false, "text": "-g" } ]
2008/12/31
[ "https://Stackoverflow.com/questions/402598", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33411/" ]
402,605
<p>In an ASP.NET MVC view I'd like to include a link of the form:</p> <pre><code>&lt;a href="blah"&gt;Link text &lt;span&gt;with further descriptive text&lt;/span&gt;&lt;/a&gt; </code></pre> <p>Trying to include the <code>&lt;span&gt;</code> element in the <code>linkText</code> field of a call to <code>Html.ActionLink()</code> ends up with it being encoded (as would be expected).</p> <p>Are there any recommended ways of achieving this?</p>
[ { "answer_id": 402782, "author": "Casper", "author_id": 18729, "author_profile": "https://Stackoverflow.com/users/18729", "pm_score": 7, "selected": true, "text": "<a href=\"<% =Url.Action(\"Action\", \"Controller\")%>\">link text <span>with further blablah</span></a>\n <a href=\"<% =Htm...
2008/12/31
[ "https://Stackoverflow.com/questions/402605", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50136/" ]
402,615
<p>This is a idea for a security. Our employees shall have access to some commands on a linux server but not all. They shall e.g. have the possibility to access a log file (<code>less logfile</code>) or start different commands (<code>shutdown.sh</code> / <code>run.sh</code>).</p> <p>Background information:</p> <p>All employees access the server with the same user name: Our product runs with "normal" user permissions, no "installation" is needed. Just unzip it in your user dir and run it. We manage several servers where our application is "installed". On every machine there is a user <code>johndoe</code>. Our employees sometimes need access to the application on command line to access and check log files or to restart the application by hand. Only some people shall have full command line access.</p> <p>We are using ppk authentication on the server.</p> <p>It would be great if employee1 can only access the logfile and employee2 can also do X etc...</p> <p><strong>Solution:</strong> As a solution I'll use the <code>command</code> option as stated in the <em>accepted</em> answer. I'll make my own little shell script that will be the only file that can be executed for <em>some</em> employees. The script will offer several commands that can be executed, but no others. I'll use the following parameters in <code>authorized_keys</code> from as stated <a href="http://www.linuxjournal.com/article/8257" rel="noreferrer">here</a>:</p> <pre><code>command="/bin/myscript.sh",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-dss AAAAB3....o9M9qz4xqGCqGXoJw= user@host </code></pre> <p>This is enough security for us. Thanks, community!</p>
[ { "answer_id": 12993743, "author": "Kaz", "author_id": 1250772, "author_profile": "https://Stackoverflow.com/users/1250772", "pm_score": 5, "selected": false, "text": "ssh rsh ssh /etc/passwd ssh user@host ssh user@host command arg ... foo my arguments are: webserver:~# ssh foo@localhost...
2008/12/31
[ "https://Stackoverflow.com/questions/402615", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2554/" ]
402,616
<p>Given this field:</p> <pre><code>char lookup_ext[8192] = {0}; // Gets filled later </code></pre> <p>And this statement:</p> <pre><code>unsigned short *slt = (unsigned short*) lookup_ext; </code></pre> <p>What happens behind the scenes?</p> <p>lookup_ext[1669] returns 67 = 0100 0011 (C), lookup_ext[1670] returns 78 = 0100 1110 (N) and lookup_ext[1671] returns 68 = 0100 0100 (D); yet slt[1670] returns 18273 = 0100 0111 0110 0001. </p> <p>I'm trying to port this to C#, so besides an easy way out of this, I'm also wondering what really happens here. Been a while since I used C++ regularly.</p> <p>Thanks!</p>
[ { "answer_id": 402623, "author": "CB Bailey", "author_id": 19563, "author_profile": "https://Stackoverflow.com/users/19563", "pm_score": 4, "selected": true, "text": "slt sizeof(unsigned short) slt[1670] lookup_ext[1670] sizeof(unsigned short) lookup_ext[3340] lookup_ext[3341]" }, { ...
2008/12/31
[ "https://Stackoverflow.com/questions/402616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40164/" ]
402,630
<p>Is it possible to implement batching of multiple stored procedure calls (doing updates/deletes) in ADO.NET without resorting to DataAdapters?</p>
[ { "answer_id": 402634, "author": "Michael Bray", "author_id": 50356, "author_profile": "https://Stackoverflow.com/users/50356", "pm_score": 1, "selected": false, "text": "UPDATE dbo.QuotePricedLineItem\nSET fkQuoteVendorLineSet = NULL\nFROM dbo.QuotePricedLineItem qpli\nINNER JOIN dbo.Qu...
2008/12/31
[ "https://Stackoverflow.com/questions/402630", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
402,648
<p>I actually have two questions regarding the same problem but I think it is better to separate them since I don't think they are related.</p> <p>Background: I am writing a Windows Mobile software in VB.NET which among its tasks needs to connect to a mail-server for sending and retrieving e-mails. As a result, I also need a Mime-parser (for decoding and encoding) the e-mails in order to get the attachments. First I thought, I would write a small "hack" to handle this issue (using ordinary string-parsing) but then I saw a project, written in C#, <a href="http://www.codeproject.com/KB/cs/MIME_De_Encode_in_C_.aspx?fid=209566&amp;df=90&amp;mpp=25&amp;noise=3&amp;sort=Position&amp;view=Quick&amp;select=1202157" rel="nofollow noreferrer">at CodeProject</a> which I thought I would implement into my solution. I don't know much about C# so I simply made a class-library out of the classes and used it in my VB.NET-project. This library works very nicely when I am targeting the Net Framework on normal windows-computers however when I was going to make the same library targeting the Compact Net Framework, I ran into troubles. This is natural since the Compact Net Framework has more limits but I actually didn't get that many errors - only two although repeated in various places in the code.</p> <p>One of the errors is the one cited in the subject of this question i.e. "No overload for method 'GetString' takes '1' arguments". As mentioned above, I don't know much about C# so I converted the class with the error online into VB-NET but still I don't understand much.. Here is the function which gives above indicated error:</p> <pre><code>public virtual string DecodeToString(string s) { byte[] b = DecodeToBytes(s); if(m_charset != null) { //ERROR ON THIS LINE return System.Text.Encoding.GetEncoding(m_charset).GetString(b); } else { m_charset = System.Text.Encoding.Default.BodyName; //ERROR ON THIS LINE return System.Text.Encoding.Default.GetString(b); } } </code></pre> <p>If the complete source-code is needed for this class, then I can post it in another message in this thread or you can find it by downloading the code at the web-site mentioned above and by having a look at the class named MimeCode.cs.</p> <p>Anyone who can help me out? Can I rewrite above function somehow to overcome this problem?</p> <p>I thank you in advance for your help.</p> <p>Kind regards and a Happy New Year to all of you.</p> <p>Rgds, moster67</p>
[ { "answer_id": 402661, "author": "Michael Bray", "author_id": 50356, "author_profile": "https://Stackoverflow.com/users/50356", "pm_score": 4, "selected": true, "text": "...GetString(b, 0, b.Length);\n" }, { "answer_id": 403205, "author": "moster67", "author_id": 45402, ...
2008/12/31
[ "https://Stackoverflow.com/questions/402648", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45402/" ]
402,658
<p>I have a table with each cell containing a label and a text field. Problem is that when i go to edit the last row, keyboard hides the lower portion of the table, and i can't see what is being typed. How can i move my interface above the keyboard so i see what is being typed?</p> <p>Thanks, Mustafa</p>
[ { "answer_id": 403164, "author": "Ben Gottlieb", "author_id": 6694, "author_profile": "https://Stackoverflow.com/users/6694", "pm_score": 4, "selected": true, "text": "UIKeyboardDidShowNotification UIKeyboardWillHideNotification" }, { "answer_id": 404718, "author": "Mustafa",...
2008/12/31
[ "https://Stackoverflow.com/questions/402658", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49739/" ]
402,674
<p>I'm trying to generate random permutations of an 80-character fixed string in C. Much to my dismay, the system I'm working on lacks strfry(). What's the best way for me to generate a random permutation of this string? Since this will be looped over approx. 100,000 times, performance is an issue.</p>
[ { "answer_id": 402676, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 5, "selected": true, "text": "char *\nstrfry (char *string)\n{\n static int init;\n static struct random_data rdata;\n size_t len, i;\n\n if (!i...
2008/12/31
[ "https://Stackoverflow.com/questions/402674", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50023/" ]
402,679
<p>I’ve run into a limitation in the cURL bindings for PHP. It appears there is no easy way to send the same multiple values for the same key for postfields. Most of the workarounds I have come across for this have involved creating the URL encoded post fields by hand tag=foo&amp;tag=bar&amp;tag=baz) instead of using the associative array version of CURLOPT_POSTFIELDS.</p> <p>It seems like a pretty common thing to need to support so I feel like I must have missed something. Is this really the only way to handle multiple values for the same key?</p> <p>While this workaround might be considered workable (if not really annoying), my main problem is that I need to be able to do multiple values for the same key and also support file upload. As far as I can tell, file upload more or less requires to use the associate arravy version of CURLOPT_POSTFIELDS. So I feel like I am stuck.</p> <p>I have <a href="http://curl.haxx.se/mail/curlphp-2008-12/0009.html" rel="noreferrer">posted</a> about this problem in more detail on the cURL PHP mailing list in the hopes that someone there has some ideas about this.</p> <p>Suggestions or hints on where I can look for more information on this are greatly appreciated!</p>
[ { "answer_id": 402743, "author": "Paul Dixon", "author_id": 6521, "author_profile": "https://Stackoverflow.com/users/6521", "pm_score": 2, "selected": false, "text": "tag[] tag tag=foo&tag=bar&tag=baz\n tag[]=foo&tag[]=bar&tag[]=baz\n tag%5B%5D=foo&tag%5B%5D=bar&tag%5B%5D=baz\n" }, {...
2008/12/31
[ "https://Stackoverflow.com/questions/402679", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50453/" ]
402,683
<p>I get a jar file url at runtime as:</p> <pre><code>jar:file:///C:/proj/parser/jar/parser.jar!/test.xml </code></pre> <p>How can this be converted to a valid path as:</p> <pre><code>C:/proj/parser/jar/parser.jar. </code></pre> <p>I have already tried using <code>File(URI)</code>, <code>getPath()</code>, <code>getFile()</code> in vain.</p>
[ { "answer_id": 402753, "author": "toolkit", "author_id": 3295, "author_profile": "https://Stackoverflow.com/users/3295", "pm_score": 2, "selected": false, "text": "import static org.junit.Assert.assertEquals;\n\nimport java.net.URL;\n\nimport org.junit.Test;\n\npublic class UrlTest {\n\n...
2008/12/31
[ "https://Stackoverflow.com/questions/402683", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
402,685
<p>I am building a website, one section of which will display public notices from a different website. (The notices are public, no copyright violation) What I need to do is to automatically update my site whenever there is a new notice on the target site. I am using Joomla as my CMS. Any ideas?</p> <p>Update - Unfortunately no RSS feed :(</p> <p>Thanks and Regards, Nand</p>
[ { "answer_id": 559203, "author": "privateace", "author_id": 66572, "author_profile": "https://Stackoverflow.com/users/66572", "pm_score": 0, "selected": false, "text": "<?php\n$handle = fopen(\"http://www.example.com/\", \"r\");\n?>\n <div class=\"post\" id=\"post-16283\">\n <div clas...
2008/12/31
[ "https://Stackoverflow.com/questions/402685", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
402,736
<p>I see that Button object has a IsMouseOVer property.</p> <p>But how do create an effect for the mouse over of a grid or other element that does not have IsMouseOver??</p> <p>Thanks Malcolm</p> <p>Edit: i figured it out. I was using the wrong method for setting the trigger.</p>
[ { "answer_id": 5395241, "author": "Frinavale", "author_id": 140420, "author_profile": "https://Stackoverflow.com/users/140420", "pm_score": 6, "selected": false, "text": "<Grid>\n <Grid.ColumnDefinitions>\n <ColumnDefinition Width=\"25\" />\n <ColumnDefinition />\n </Grid.ColumnD...
2008/12/31
[ "https://Stackoverflow.com/questions/402736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40568/" ]
402,763
<p>Advance New Year Wishes to All.</p> <p>I have an error log file with the contents in a pattern parameter, result and stderr (stderr can be in multiple lines).</p> <pre><code>$cat error_log &lt;parameter&gt;:test_tot_count &lt;result&gt;:1 &lt;stderr&gt;:Expected "test_tot_count=2" and the actual value is 3 test_tot_count = 3 &lt;parameter&gt;:test_one_count &lt;result&gt;:0 &lt;stderr&gt;:Expected "test_one_count=2" and the actual value is 0 test_one_count = 0 &lt;parameter&gt;:test_two_count &lt;result&gt;:4 &lt;stderr&gt;:Expected "test_two_count=2" and the actual value is 4 test_two_count = 4 ... </code></pre> <p>I need to write a function in Perl to store each parameters, result and stderr in an array or hash table.</p> <p>This is our own internally defined structure. I wrote the Perl function like this. Is there a better way of doing this using regular expression itself?</p> <pre><code>my $err_msg = ""; while (&lt;ERR_LOG&gt;) { if (/&lt;parameter&gt;:/) { s/&lt;parameter&gt;://; push @parameter, $_; } elsif (/&lt;result&gt;:/) { s/&lt;result&gt;://; push @result, $_; } elsif (/&lt;stderr&gt;:/) { if (length($err_msg) &gt; 0) { push @stderr, $err_msg; } s/&lt;stderr&gt;://; $err_msg = $_; } else { $err_msg .= $_; } } if (length($err_msg) &gt; 0) { push @stderr, $err_msg; } </code></pre>
[ { "answer_id": 402794, "author": "PEZ", "author_id": 44639, "author_profile": "https://Stackoverflow.com/users/44639", "pm_score": 1, "selected": false, "text": "if (/^<parameter>:/)\n if (/^<parameter>:(.*)/s)\n{\n push @parameter, $1;\n}\n" }, { "answer_id": 402902, "autho...
2008/12/31
[ "https://Stackoverflow.com/questions/402763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18657/" ]
402,785
<p>we've got a list of search-result mappings, e.g. a simple url mapping might look like</p> <p>"stackoverflow" -> "www.stackoverflow.com" "joel" -> "www.joelonsoftware.com"</p> <p>so searching for the exact phrases is working fine. </p> <p>Now we're looking for an incremental search / typeahead, e.g. "stackover" would also return "www.stackoverflow.com". We could of course populate our maps accordingly, e.g. put every possible string into the map, starting with all variations of a given min size </p> <p>-> map keys:</p> <p>stack -> stackoverflow ... stackoverf -> stackoverflow stackoverfl -> stackoverflow stackoverflo -> stackoverflow stackoverflow -> stackoverflow</p> <p>However that would mean a higher memory footprint that necessary (I guess).</p> <p>Any suggestions?</p>
[ { "answer_id": 402806, "author": "martinus", "author_id": 48181, "author_profile": "https://Stackoverflow.com/users/48181", "pm_score": 3, "selected": false, "text": "List<String> urls = Arrays.asList(\"this\", \"is\", \"a\", \"test\");\n\n// search for \"is\"\nList<String> reduced = new...
2008/12/31
[ "https://Stackoverflow.com/questions/402785", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
402,792
<p>is there an easy away to combine fields in awk? Specifically, I have lines like this:</p> <pre><code>1,2,some text 3,4,some text, but it has commas in it, annoyingly </code></pre> <p>I want to extract the two numbers as the first two fields, but then I want all of the text (commas and all) to be the third field. Is there a way to do that?</p> <p>My basic awk call was like this:</p> <pre><code>awk -F\, '{print $1"|"$2"|"$3}' file.txt </code></pre> <p>Which works fine for the first line, but stops at the comma in the text on the second line.</p>
[ { "answer_id": 402829, "author": "PolyThinker", "author_id": 47707, "author_profile": "https://Stackoverflow.com/users/47707", "pm_score": 0, "selected": false, "text": "cat file.txt | sed 's/\\(.?*\\),\\(.?*\\),/\\1|\\2|/'\n" }, { "answer_id": 402850, "author": "PEZ", "a...
2008/12/31
[ "https://Stackoverflow.com/questions/402792", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11522/" ]
402,810
<p>Has anyone had any luck getting the <a href="http://camellia.sourceforge.net/" rel="nofollow noreferrer">Camellia</a> computer vision library to install on OS X? I've been banging my head against a wall trying to get it to install. There is <a href="http://po-ru.com/diary/camellia-and-ruby-on-mac-os-x/" rel="nofollow noreferrer">only one reference I can find</a> online and it is a bit dated. I've followed the instructions to the T with no luck.</p> <p>I'm hoping one of your brilliant folks on SO can help a dude out.</p>
[ { "answer_id": 644618, "author": "Javier", "author_id": 61427, "author_profile": "https://Stackoverflow.com/users/61427", "pm_score": 2, "selected": false, "text": "which gcc /usr/bin/gcc" }, { "answer_id": 679926, "author": "Aupajo", "author_id": 10407, "author_profi...
2008/12/31
[ "https://Stackoverflow.com/questions/402810", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46364/" ]
402,817
<p>I have two HTML tables which would ideally be placed side by side on the screen. Widescreen monitors will cope with this fine, but the tables are too wide to be side by side on most old-fashioned monitors. So I want to use css (or even just HTML, if possible) to place the tables side by side only if the resolution is high enough.</p> <p>This works automatically with images, usually, but is there a way to do it for tables?</p>
[ { "answer_id": 402831, "author": "Ross", "author_id": 2025, "author_profile": "https://Stackoverflow.com/users/2025", "pm_score": 2, "selected": false, "text": "table {\n width: 500px; /* important */\n float: left;\n}\n table {\n display: inline;\n}\n" }, { "answer_id":...
2008/12/31
[ "https://Stackoverflow.com/questions/402817", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11522/" ]
402,824
<p>Is there any Visual Studio add-on (or windows/unix stand-alone program) that creates stub implementations in the cpp file for the functions (including class member functions) that are defined in the header file?</p>
[ { "answer_id": 403245, "author": "Patrick Johnmeyer", "author_id": 363, "author_profile": "https://Stackoverflow.com/users/363", "pm_score": 2, "selected": false, "text": "void Foo(int bar){} void Foo(int bar);" } ]
2008/12/31
[ "https://Stackoverflow.com/questions/402824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44673/" ]
402,832
<p>I occasionally need to process a large amount of data from one package off the network, which takes sufficiently long that when the user tries to interact with the application windows adds the "(Not Responding)" string to the window title. I am aware this is because the processing is being done within a call to handle a message (some way up the stack) and therefore is blocking the message pump. I'm also aware the ideal way to deal with this is to process the data asynchronously in a separate thread so the pump can continue running, however this is a LARGE desktop application which is single threaded from top to toe and safely spinning this processing off is not feasible in our time frame.</p> <p>So with that in mind, is there by any chance a way I can at least avoid the "not responding" moniker (which to most users reads as "has crashed") by telling windows my application is about to be busy before I begin the work? I believe there is something along these lines when responding to a request to close, one can keep asking windows for more time to avoid it proclaiming that your not "closing in a timely fashion"</p> <p>I should add this is a C++ MFC application.</p>
[ { "answer_id": 402871, "author": "SmacL", "author_id": 22564, "author_profile": "https://Stackoverflow.com/users/22564", "pm_score": 4, "selected": false, "text": "int Refresh()\n{\n MSG msg;\n if (PeekMessage (&msg, NULL, 0, 0,PM_NOREMOVE))\n if ((msg.message == WM_QU...
2008/12/31
[ "https://Stackoverflow.com/questions/402832", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17493/" ]
402,833
<p>Even something very rudimentary is fine. Like entering and evaluating something like x+1, where x is a variable I get to specify.</p> <p>I was thinking of writing my own using Strings for each formula, regex for parsing them, etc., but let's assume my goal is to be as lazy as I can possibly get away with, and that if there's another option (especially a formal one), I'd rather try to use that instead, first.</p> <p>Is there anything out there that does something like this?</p>
[ { "answer_id": 405741, "author": "Thomas Morgner", "author_id": 48665, "author_profile": "https://Stackoverflow.com/users/48665", "pm_score": 1, "selected": false, "text": "=[x]+1\n" }, { "answer_id": 6128889, "author": "fasseg", "author_id": 234922, "author_profile":...
2008/12/31
[ "https://Stackoverflow.com/questions/402833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19825/" ]
402,841
<p>I have set up a <a href="http://en.wikipedia.org/wiki/Django_%28web_framework%29" rel="noreferrer">Django</a> application that uses images. I think I have set up the media settings MEDIA_ROOT and MEDIA_URL correctly. However the images don't show up. Do you know what can be the problem?</p> <p>Let consider this example:</p> <p>The image files are under <strong>/home/www/media/app/photos</strong> and we are trying to request <a href="http://example.com/photos/123.jpg" rel="noreferrer">http://example.com/photos/123.jpg</a></p> <p>Should I use these settings?</p> <pre><code>MEDIA\_ROOT = /home/www/media MEDIA_URL = http://example.com/app </code></pre> <p><strong>UPDATE:</strong> Forgot to mention that I'm using built-in development server.</p>
[ { "answer_id": 403618, "author": "Peter Rowell", "author_id": 17017, "author_profile": "https://Stackoverflow.com/users/17017", "pm_score": 1, "selected": false, "text": "<Location \"/\">\n SetHandler python-program\n PythonAutoReload Off\n PythonDebug Off\n PythonPath \"['/v...
2008/12/31
[ "https://Stackoverflow.com/questions/402841", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1692070/" ]
402,846
<p>In a particular page i have a ascx control which contains a table.</p> <p>Now I want to set this control visible/invisible but the visible method is not detected by the intellisense.</p> <p>The only methods are 1)Equals and 2) ReferenceEquals</p> <p>Main Page</p> <pre><code>&lt;VPM:VotingPolls Runat="server"&gt;&lt;/VPM:VotingPolls&gt; </code></pre> <p>Thanks</p>
[ { "answer_id": 402873, "author": "David Bonnici", "author_id": 44973, "author_profile": "https://Stackoverflow.com/users/44973", "pm_score": 4, "selected": true, "text": "<VPM:VotingPolls ID=\"VPS\" Runat=\"server\"></VPM:VotingPolls>\n VPS.Visible=True/False\n" } ]
2008/12/31
[ "https://Stackoverflow.com/questions/402846", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44973/" ]
402,881
<p>On a web <strong><em>contact form</em></strong>, is the reset button really required? Is it really used by anyone? If I don't put it in a page, is there an usability fail? </p> <p>10x!</p>
[ { "answer_id": 405034, "author": "twils", "author_id": 48162, "author_profile": "https://Stackoverflow.com/users/48162", "pm_score": 1, "selected": false, "text": " Select any one option for any Item(s): \n Option 'A' Option 'B' Option 'C'\nItem 1 o ...
2008/12/31
[ "https://Stackoverflow.com/questions/402881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23810/" ]
402,909
<p>I'm using asp.net mvc and I'm trying to create a new Employee, in my form I use the Html.DropDown(...) to display a list of Departments to select from. </p> <p>Ideally I would like MVC to just figure out which Department was selected (Id property is the value in dropdown), fetch it and set it in the incoming Employee object. instead I get a null value and I have to fetch the Department myself using the Request.Form[...].</p> <p>I saw an example here: <a href="http://blog.rodj.org/archive/2008/03/31/activerecord-the-asp.net-mvc-framework.aspx" rel="nofollow noreferrer">http://blog.rodj.org/archive/2008/03/31/activerecord-the-asp.net-mvc-framework.aspx</a> but that doesn't seem to work with asp.net mvc beta</p> <p>This is basic CRUD with a well-proven ORM.... need it really be so hard?</p>
[ { "answer_id": 637378, "author": "jhappoldt", "author_id": 52307, "author_profile": "https://Stackoverflow.com/users/52307", "pm_score": 1, "selected": false, "text": "[ActiveRecord(\"Employees\")]\n[ModelBinder(EmployeeBinder]\npublic class Employee : ActiveRecordBase<Employee>\n{\n ...
2008/12/31
[ "https://Stackoverflow.com/questions/402909", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36465/" ]
402,911
<p>I am downloading a JPEG image from a server and assigning it to an image object in my iPhone app using an NSURLConnection.</p> <p>All works fine when I'm on a Wifi connection, but as soon as I switch to 3G, the quality of the JPEG downloaded reduces dramatically.</p> <p>Has anyone else experienced this?</p> <p>Does anyone know of a way to force the iPhone to download the full quality JPEG?</p> <p>Thanks in advance! Nick.</p>
[ { "answer_id": 15223378, "author": "George Green", "author_id": 1175289, "author_profile": "https://Stackoverflow.com/users/1175289", "pm_score": 1, "selected": false, "text": "NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:theURL];\n// Add headers to avoid mobile net...
2008/12/31
[ "https://Stackoverflow.com/questions/402911", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1221378/" ]
402,917
<p>I'd like to map the following sql in NHibernate. Will I need to make a separate entity object i.e RoomTypeVO mapped to tb_tags to do this? Any help much appreciated.</p> <p>SELECT dbo.tb_rooms.id, dbo.tb_rooms.name, dbo.tb_tags.name AS 'roomType' FROM dbo.tb_rooms INNER JOIN dbo.tb_tags ON (dbo.tb_rooms.typeID = dbo.tb_tags.id)</p> <p></p> <pre><code>&lt;id name="id" column="id"&gt; &lt;generator class="native" /&gt; &lt;/id&gt; &lt;property name="name" /&gt; </code></pre>
[ { "answer_id": 403442, "author": "Arthur Thomas", "author_id": 14009, "author_profile": "https://Stackoverflow.com/users/14009", "pm_score": 2, "selected": true, "text": "FROM RoomType \n" }, { "answer_id": 404661, "author": "user17510", "author_id": 17510, "author_pr...
2008/12/31
[ "https://Stackoverflow.com/questions/402917", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17510/" ]
402,923
<p>I find increasingly now when I am building a large project, I get the following error. </p> <blockquote> <p>fatal error C1083: Cannot open compiler intermediate file: 'C:\Temp\SYS\a03132ex': Permission denied</p> </blockquote> <p>It occurs in Visual Studio 2003 and VC6, and I have investigated the potential MSDN reasons and drawn a blank. There is plenty of space on the hard disk, and not that many other programs open that I should be running out of handles. Any ideas, or is it time to re-install windows again. I'm running XP SP3 by the way, and have two large NTFS hard disks with very many files.</p> <p>Edit: the name of the temp file changes, and I have cleared out the entire c:\temp folder.</p>
[ { "answer_id": 402945, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 1, "selected": false, "text": "c:\\temp c:\\temp\\sys cacls c:\\temp\n" } ]
2008/12/31
[ "https://Stackoverflow.com/questions/402923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22564/" ]
402,955
<p>i am looking into the possibilities of doing some work for a client on Flex with a Rails backend. </p> <p>It ain't rocket science however i was wondering if anyone out there had some experiences with these two AWESOME technologies?</p> <p>Thanks in advance....</p>
[ { "answer_id": 1180371, "author": "camwest", "author_id": 107385, "author_profile": "https://Stackoverflow.com/users/107385", "pm_score": 0, "selected": false, "text": "<script language=\"Javascript\">\n function getAuthKey() { return \"<%= form_authenticity_token %>\"; }\n</script>\n...
2008/12/31
[ "https://Stackoverflow.com/questions/402955", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50477/" ]
402,964
<p>Is there a good tool to generate change reports from Subversion logs. </p> <p>We have big team and many commits every day. I'm looking for some tool to show changes in all files. We are using Subversion, so I'm looking some tool that can read Subversion logs.</p>
[ { "answer_id": 403523, "author": "Stefan", "author_id": 48003, "author_profile": "https://Stackoverflow.com/users/48003", "pm_score": 4, "selected": false, "text": "svn log --xml -v > log.xml\nxsltproc.exe --nowrite --nomkdir --nonet -o changelog.html svn2html.xsl log.xml\n" } ]
2008/12/31
[ "https://Stackoverflow.com/questions/402964", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
402,980
<p>I'd like to use a single SQL query (in MySQL) to find the record which comes after one that I specify.</p> <p>I.e., if the table has:</p> <pre><code>id, fruit -- ----- 1 apples 2 pears 3 oranges </code></pre> <p>I'd like to be able to do a query like:</p> <pre><code>SELECT * FROM table where previous_record has id=1 order by id; </code></pre> <p>(clearly that's not real SQL syntax, I'm just using pseudo-SQL to illustrate what I'm trying to achieve)</p> <p>which would return:</p> <pre><code>2, pears </code></pre> <p>My current solution is just to fetch all the records, and look through them in PHP, but that's slower than I'd like. Is there a quicker way to do it?</p> <p>I'd be happy with something that returned two rows -- i.e. the one with the specified value and the following row.</p> <p>EDIT: Sorry, my question was badly worded. Unfortunately, my definition of "next" is not based on ID, but on alphabetical order of fruit name. Hence, my example above is wrong, and should return oranges, as it comes alphabetically next after apples. Is there a way to do the comparison on strings instead of ids?</p>
[ { "answer_id": 402985, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 6, "selected": true, "text": "SELECT id FROM table WHERE fruit > 'apples' ORDER BY fruit LIMIT 1\n" }, { "answer_id": 402988, "author":...
2008/12/31
[ "https://Stackoverflow.com/questions/402980", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11522/" ]
402,984
<p>I was once asked in an interview 'What are the 3 main concepts of OOP?'. I answered by saying that in my opinion there were 4 which are as follows:</p> <ul> <li>Inheritance</li> <li>Encapsulation</li> <li>Abstraction</li> <li>Polymorphism</li> </ul> <p>Was I correct?</p>
[ { "answer_id": 403028, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 3, "selected": false, "text": "String<Char> cstr = \"This is a test\";\nString<Dna, Packed<> > dstr = \"GATTACA\";\n\ncout << \"length(\" << cstr <<...
2008/12/31
[ "https://Stackoverflow.com/questions/402984", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47036/" ]
402,992
<p>i want to do this simple piece of code work.</p> <pre><code>#include &lt;iostream&gt; #include &lt;windows.h&gt; void printSome (int i) { std::cout &lt;&lt; i &lt;&lt; std::endl; } void spawnThread (void (*threadName)(int i)) { CreateThread ( 0, // default security attributes 0, // use default stack size (LPTHREAD_START_ROUTINE)threadName, // thread function name (LPVOID)i, // argument to thread function 0, // use default creation flags 0 // returns the thread identifier ); } int main () { spawnThread(printSome(155)); } </code></pre> <p>i am on windows, using vs. Any help will be greatly appriciated.</p>
[ { "answer_id": 403007, "author": "Filip Ekberg", "author_id": 39106, "author_profile": "https://Stackoverflow.com/users/39106", "pm_score": 1, "selected": false, "text": "//------------------------------------------------------------------------------------\n// 2.6 How to Pass a Function...
2008/12/31
[ "https://Stackoverflow.com/questions/402992", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28954/" ]
402,996
<p>I am having trouble deserializing my JSON string. I have a class of type <code>person</code> with public properties for sequence number of type int, first name, and last name. I want to pass an array of these objects in JSON format and have them deserialized as a list so I can loop through them on the server, but ASP.NET says something about not being supported to be deserialized as an array. I have validated the JSON I am producing, and it is valid. Is there something special about the JSON that ASP.NET needs to have before it can deserialize? The funny thing is if I serialize a list&lt;person&gt; object to JSON it looks exactly like the JSON I am producing. I must be missing something... To clarify, I'm using the ASP.NET Ajax library to deserialize. This is what I get back from the web service:</p> <blockquote> <p>{&quot;Message&quot;:&quot;Type \u0027System.Collections.Generic.IDictionary`2[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]\u0027 is not supported for deserialization of an array.&quot;</p> </blockquote> <p>Actually unfortunately this doesn't seem to have anything to do with deserializing, it appears that you can't pass an array of JSON objects to an asmx web service. Am I correct? If you can't do that, is it possible to pass a collection of JSON objects to a web service and have them processed on the server with ASP.NET and C#?</p> <h3>Update:</h3> <p>OK, here is my code. Here is the person class:</p> <pre><code>public class person { public person() { // // TODO: Add constructor logic here // } public int seq { get; set; } public string firstName { get; set; } public string lastName { get; set; } } </code></pre> <p>And here is my JSON string:</p> <pre><code>[{&quot;seq&quot;:1,&quot;firstName&quot;:&quot;Chris&quot;,&quot;lastName&quot;:&quot;Westbrook&quot;}, {&quot;seq&quot;:2,&quot;firstName&quot;:&quot;sayyl&quot;,&quot;lastName&quot;:&quot;westbrook&quot;}] </code></pre> <p>And here is the code I'm using</p> <pre><code> [WebMethod] public void updatePeople(string json) { IList&lt;person&gt; people = new JavaScriptSerializer().Deserialize&lt;IList&lt;person&gt;&gt;(json); //do stuff... } </code></pre>
[ { "answer_id": 403377, "author": "Darin Dimitrov", "author_id": 29407, "author_profile": "https://Stackoverflow.com/users/29407", "pm_score": 5, "selected": false, "text": "using System;\nusing System.Collections.Generic;\nusing System.Web.Script.Serialization;\n\nnamespace Test\n{\n ...
2008/12/31
[ "https://Stackoverflow.com/questions/402996", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16891/" ]
403,031
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/1501577/change-css-dynamically">Change CSS Dynamically</a> </p> </blockquote> <p>I need to change the height of a div container(CSS Property Height) from ASP.NET code (VB).</p> <p>How can I do that?</p>
[ { "answer_id": 403036, "author": "Tom Ritter", "author_id": 8435, "author_profile": "https://Stackoverflow.com/users/8435", "pm_score": 6, "selected": true, "text": "<div runat=\"server\" id=\"divControl\">...</div>\n protected System.Web.UI.HtmlControls.HtmlGenericControl divControl;\n ...
2008/12/31
[ "https://Stackoverflow.com/questions/403031", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44973/" ]