qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
181,130
<p>I've just found out about Stack Overflow and I'm just checking if there are ideas for a constraint I'm having with some friends in a project, though this is more of a theoretical question to which I've been trying to find an answer for some time.</p> <p>I'm not much given into cryptography but if I'm not clear enough I'll try to edit/comment to clarify any questions.</p> <p>Trying to be brief, the environment is something like this:</p> <ul> <li><p>An application where the front-end as access to encrypt/decrypt keys and the back-end is just used for storage and queries.</p></li> <li><p>Having a database to which you can't have access for a couple of fields for example let's say "address" which is text/varchar as usual.</p></li> <li><p>You don't have access to the key for decrypting the information, and all information arrives to the database already encrypted.</p></li> </ul> <p>The main problem is something like this, how to consistently make queries on the database, it's impossible to do stuff like "where address like '%F§YU/´~#JKSks23%'". (IF there is anyone feeling with an answer for this feel free to shoot it).</p> <p>But is it ok to do <code>where address='±!NNsj3~^º-:'</code>? Or would it also completely eat up the database? </p> <p>Another restrain that might apply is that the front end doesn't have much processing power available, so already encrypting/decrypting information starts to push it to its limits. (Saying this just to avoid replies like "Exporting a join of tables to the front end and query it there".)</p> <p>Could someone point me in a direction to keep thinking about it?</p> <hr> <p>Well thanks for so fast replies at 4 AM, for a first time usage I'm really feeling impressed with this community. (Or maybe I'm it's just for the different time zone)</p> <p>Just feeding some information:</p> <p>The main problem is all around partial matching. As a mandatory requirement in most databases is to allow partial matches. The main constraint is actually <strong>the database owner would not be allowed to look inside the database for information</strong>. During the last 10 minutes I've come up with a possible solution which extends again to possible database problems, to which I'll add here:</p> <p>Possible solution to allow semi partial matching:</p> <ul> <li>The password + a couple of public fields of the user are actually the key for encrypting. For authentication the idea is to encrypt a static value and compare it within the database.</li> <li>Creating a new set of tables where information is stored in a parsed way, meaning something like: "4th Street" would become 2 encrypted rows (one for '4th' another for 'Street'). This would already allow semi-partial matching as a search could already be performed on the separate tables.</li> </ul> <p>New question:</p> <ul> <li>Would this probably eat up the database server again, or does anyone think it is a viable solution for the partial matching problem?</li> </ul> <p><em>Post Scriptum: I've unaccepted the answer from Cade Roux just to allow for further discussion and specially a possible answer to the new question.</em></p>
[ { "answer_id": 181144, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "$salt = \"123-=asd\";\n$address = \"3412 g ave\";\n\n$sql = \"INSERT INTO addresses (address) VALUES ('\" . md5($salt . $addre...
2008/10/08
[ "https://Stackoverflow.com/questions/181130", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26004/" ]
181,132
<p>On my homepage I got:</p> <pre><code>&lt;ul id="login"&gt; &lt;li&gt; &lt;a id="loginswitch" href="./login-page"&gt;log-in&lt;/a&gt; | &lt;/li&gt; &lt;li&gt; &lt;a id="signupswitch" href="./signup-page"&gt;sign-up&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>Via MooTools, I get these anchor elements by id so that once they're clicked, a flashy div will popup below them that contains the login or signup form (with methods to stop the propagation of events of course) and upon filling-up the fields the AJAX call kicks in - that's supposed to create a session and reload the page so that the user would have a visual that he is now logged in and user-level-controls appears etc..</p> <p>The ajax call is initiated by the MooTools AJAX class and <code>evalScripts</code> option is set to true. The AJAX page returns the script code:</p> <pre><code>&lt;script type="text/javascript"&gt;window.location = self.location;&lt;/script&gt; </code></pre> <p>This system works perfectly - now I'm wondering why if I change the anchors' <code>href</code> values to <code>href="#"</code> my scripts won't work anymore?</p> <p>Does it have anything to do with the window?</p> <p>Did it change its property when I clicked a link or so even when the event's propagation was stopped??</p>
[ { "answer_id": 181137, "author": "ephemient", "author_id": 20713, "author_profile": "https://Stackoverflow.com/users/20713", "pm_score": 1, "selected": false, "text": "#" }, { "answer_id": 196643, "author": "keparo", "author_id": 19468, "author_profile": "https://Stac...
2008/10/08
[ "https://Stackoverflow.com/questions/181132", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24744/" ]
181,136
<p>I have a text file with multiple records. I want to search a name and date, for example if I typed <code>JULIUS CESAR</code> as name then the whole data about <code>JULIUS</code> will be extracted. What if I want only to extract information?</p> <pre><code>Record number: 1 Date: 08-Oct-08 Time: 23:45:01 Name: JULIUS CESAR Address: BAGUIO CITY, Philippines Information: I lived in Peza Loakan, Bagiou City A Computer Engineering student An OJT at TIPI. 23 years old. Record number: 2 Date: 09-Oct-08 Time: 23:45:01 Name: JOHN Castro Address: BAGUIO CITY, Philippines Information: I lived in Peza Loakan, Bagiou City A Electronics Comm. Engineering Student at SLU. An OJT at TIPI. My Hobby is Programming. Record number: 3 Date: 08-Oct-08 Time: 23:45:01 Name: CESAR JOSE Address: BAGUIO CITY, Philippines Information: Hi,, I lived Manila City A Computer Engineering student Working at TIPI. </code></pre>
[ { "answer_id": 181156, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "$name = \"JULIUS CESAR\";\n" }, { "answer_id": 181167, "author": "Robert Elwell", "author_id": 23102, "aut...
2008/10/08
[ "https://Stackoverflow.com/questions/181136", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
181,158
<p>i have a databound GridView in asp.net 2.0 with a row-selection link. When a row is selected, I want to programmatically add a table row below the selected row, in order to nest another grid et al.</p> <p>I am researching this for a client and for an article, and i think my google-fu is not strong tonight. Any suggestions?</p> <p>EDIT: I actually had a working solution but Visual Studio was nutted up somehow; closing and re-opening VS and rebuilding everything fixed the problem ;-)</p> <p>My solution is posted below, please tell me how to make it better if possible. Thanks!</p>
[ { "answer_id": 181168, "author": "Steven A. Lowe", "author_id": 9345, "author_profile": "https://Stackoverflow.com/users/9345", "pm_score": 4, "selected": true, "text": "protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)\n{\n if (e.Row.RowType == DataControlR...
2008/10/08
[ "https://Stackoverflow.com/questions/181158", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9345/" ]
181,159
<p>I'm trying to generate a unique ID in php in order to store user-uploaded content on a FS without conflicts. I'm using php, and at the moment this little snippet is responsible for generating the UID:</p> <pre><code>$id = tempnam (".", ""); unlink($id); $id = substr($id, 2); </code></pre> <p>This code is hideous: it creates a temporary file on the FS and deletes it, retaining only the relevant unique part of the generated string.</p> <p>Is there any better way to do this, most preferably without any external dependencies?</p> <p>Thanks much!</p>
[ { "answer_id": 181163, "author": "Xenph Yan", "author_id": 264, "author_profile": "https://Stackoverflow.com/users/264", "pm_score": 5, "selected": true, "text": "string uniqid ([ string $prefix [, bool $more_entropy ]] )\n" }, { "answer_id": 9010772, "author": "Will Rhodes",...
2008/10/08
[ "https://Stackoverflow.com/questions/181159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1266/" ]
181,188
<p>In VB.NET I often <code>Catch…When</code>:</p> <pre><code>Try … Catch e As ArgumentNullException When e.ParamName.ToUpper() = "SAMPLES" … End Try </code></pre> <p>Is there a C# equivalent to <code>Catch…When</code>?</p> <p>I don't want to resort to using an <code>if</code> statement inside a <code>catch</code> if possible.</p>
[ { "answer_id": 181190, "author": "cruizer", "author_id": 6441, "author_profile": "https://Stackoverflow.com/users/6441", "pm_score": 4, "selected": false, "text": "Catch…When" }, { "answer_id": 22959433, "author": "Joe", "author_id": 1324810, "author_profile": "https:...
2008/10/08
[ "https://Stackoverflow.com/questions/181188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8280/" ]
181,189
<p>After being through numerous forums available on the net for last 5 days, I am still not able to completely track down the browser close event. My requirement is to generate a popup message, when user tries to close the browser.</p> <p>I have called my javascript function on body 'onbeforeunload' event. And I have hardcoded the conditions to check the mouse-coordinates for the red 'X' buton of browser, refresh, File-close or <kbd>Alt</kbd>-<kbd>F4</kbd>.</p> <p>My code works fine when browser window is Maximized, but fails if we shrink it after a limit. Please help me, if some body has already found the solution to a similar problem.</p> <p>Thank you.</p> <h3>Aggregated Responses of OP</h3> ------ <p>Ok, just tell me if it is possible to detect if a user has clicked on the Refresh button of the browser. Also, Refresh can be triggered by Right-click - Refresh or <kbd>Ctrl</kbd>-<kbd>R</kbd>. My requirement is to make a variable false on Refresh. I am just able to do it on <kbd>F5</kbd>, but all other ways are still out of my reach. The same would be applied to Back button.</p> <hr /> <p>Hi ppl, Thanks for all who replied at least. I have talked to my seniors regarding this and they have now understood and have compromised with the browser menu buttons. So now my task has become easy. Now, I am using a variable and making it true by default. As, I mentioned earlier I just have to catch the onbeforeunload and popup a message when user tries to leave. The message will not popup when user is navigating to other pages, as I have made the variable as false on all the links of my page using following piece of code:</p> <pre><code>document.onclick = function() { //To check if user is navigating from the page by clicking on a hyperlink. if (event.srcElement.tagName == 'A') blnShowMsg = false; //To not popup the warning message else blnShowMsg = true; //To popup the warning message } </code></pre> <p>In my case still the message is shown when user does Refresh, back or goes to any link in Favorites, etc.</p> <hr /> <p>Thanks buddy, but I have already gone through that and didn't find much help there too. My seniors are not happy with that solution as putting a flag on every link of my application is a complicated job and they fear of breaking the application. Any other suggestions would be appreciated. Thanks once again.</p> <hr /> <p>Is there no one who can think of a solution here!!! where are all the experts???</p>
[ { "answer_id": 190449, "author": "Stein G. Strindhaug", "author_id": 26115, "author_profile": "https://Stackoverflow.com/users/26115", "pm_score": 1, "selected": false, "text": "document.onclick = function()\n {\n //To check if user is navigating from the page by clicking on a ...
2008/10/08
[ "https://Stackoverflow.com/questions/181189", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
181,191
<p>Let me preface this by saying I'm a complete amateur when it comes to RegEx and only started a few days ago. I'm trying to solve a problem formatting a file and have hit a hitch with a particular type of data. The input file is structured like this:</p> <pre> Two words,Word,Word,Word,"Number, number" </pre> <p>What I need to do is format it like this...</p> <pre> "Two words","Word",Word","Word","Number, number" </pre> <p>I have had a RegEx pattern of </p> <pre>s/,/","/g</pre> <p>working, except it also replaces the comma in the already quoted Number, number section, which causes the field to separate and breaks the file. Essentially, I need to modify my pattern to replace a comma with "," [quote comma quote], but only when that comma isn't followed by a space. Note that the other fields will never have a space following the comma, only the delimited number list.</p> <p>I managed to write up</p> <pre>s/,[A-Za-z0-9]/","/g</pre> <p>which, while matching the appropriate strings, would replace the comma AND the following letter. I have heard of backreferences and think that might be what I need to use? My understanding was that</p> <pre>s/(,)[A-Za-z0-9]\b</pre> <p>should work, but it doesn't.</p> <p>Anyone have an idea?</p>
[ { "answer_id": 181208, "author": "ephemient", "author_id": 20713, "author_profile": "https://Stackoverflow.com/users/20713", "pm_score": 2, "selected": true, "text": "s/,([^ ])/\",\"$1/" }, { "answer_id": 181255, "author": "Markus Jarderot", "author_id": 22364, "autho...
2008/10/08
[ "https://Stackoverflow.com/questions/181191", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25045/" ]
181,209
<p>I have a function that looks like this</p> <pre><code>class NSNode { function insertAfter(NSNode $node) { ... } } </code></pre> <p>I'd like to be able to use that function to indicate that the node is being inserted at the start, therefore it is after <em>nothing</em>. The way I think about that is that <code>null</code> means "nothing", so I'd write my function call like this:</p> <pre><code>$myNode-&gt;insertAfter(null); </code></pre> <p>Except PHP throws an error saying that it was expecting an <code>NSNode</code> object. I'd like to stick to using the strict data typing in my function, but would like to be able to specify a null-esque value.</p> <p>So, short of changing it to <code>function insertAfter($node) { }</code>, is there a way I can pass something else to that function?</p> <hr> <p>Update: I've accepted Owen's answer because it answered the question itself. Everyone else's suggestions were really good and I'll actually be implementing them in this project, thanks!</p>
[ { "answer_id": 181223, "author": "Owen", "author_id": 4853, "author_profile": "https://Stackoverflow.com/users/4853", "pm_score": 4, "selected": true, "text": "function(NSNode $node = null) {\n// stuff....\n}\n" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/181209", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9021/" ]
181,210
<p>I have an asp.net text form that contains numerous decimal fields that are optional. I want to selectively update the database but not inserting a "0" for fields that do not have data (maintaining the null status). </p> <p>Typically, I would create multiple functions, each with a different signature to handle this. However, I am inserting the data through a webservice which does not allow a function with the same name to have multiple signatures. I can think of a couple ways to work around this, but none "pragmatically".</p>
[ { "answer_id": 181229, "author": "Jon Limjap", "author_id": 372, "author_profile": "https://Stackoverflow.com/users/372", "pm_score": 1, "selected": false, "text": "DBNull" }, { "answer_id": 181310, "author": "Vivek", "author_id": 7418, "author_profile": "https://Stac...
2008/10/08
[ "https://Stackoverflow.com/questions/181210", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3149/" ]
181,214
<p>Implementing a file upload under html is fairly simple, but I just noticed that there is an 'accept' attribute that can be added to the <code>&lt;input type="file" ...&gt;</code> tag.</p> <p>Is this attribute useful as a way of limiting file uploads to images, etc? What is the best way to use it?</p> <p>Alternatively, is there a way to limit file types, preferably in the file dialog, for an html file input tag?</p>
[ { "answer_id": 181507, "author": "PhiLho", "author_id": 15459, "author_profile": "https://Stackoverflow.com/users/15459", "pm_score": 3, "selected": false, "text": "<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"100000\">" }, { "answer_id": 4197455, "author": "magikMak...
2008/10/08
[ "https://Stackoverflow.com/questions/181214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/691/" ]
181,222
<p>I have a script which calls <code>mysql_connect()</code> to connect to a MySQL DB. When I run the script in a browser, it works. However, when I run it from a command line I receive the following error:</p> <pre><code>Call to undefined function mysql_connect() </code></pre> <p>This seems completely paradoxical. Anyone have any ideas as how I can run it from the command line. Btw, I run it from a bash shell like so:</p> <pre><code>php /path/to/script.php </code></pre>
[ { "answer_id": 181236, "author": "Darryl Hein", "author_id": 5441, "author_profile": "https://Stackoverflow.com/users/5441", "pm_score": 4, "selected": false, "text": "php -c /etc/php.ini /path/to/script.php\n" }, { "answer_id": 23510870, "author": "Herr", "author_id": 28...
2008/10/08
[ "https://Stackoverflow.com/questions/181222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24059/" ]
181,225
<p>I'm looking for a reasonably fast event handling mechanism in Java to generate and handle events across different JVMs running on different hosts.</p> <p>For event handling across multiple threads in a single JVM, I found some good candidates like Jetlang. But in my search for a distributed equivalent , I couldn't find anything that was lightweight enough to offer good performance.</p> <p>Does anyone know of any implementations that fit the bill?</p> <p><strong>Edit:</strong> Putting numbers to indicate performance is a bit difficult. But for example, if you implement a heartbeating mechanism using events and the heartbeat interval is 5 seconds, the heartbeat receiver should receive a sent heartbeat within say a second or two.</p> <p>Generally, a lightweight implementation gives good performance. A event handling mechanism involving a web server or any kind of centralized hub requiring powerful hardware (definitely not lightweight) to give good performance is not what I'm looking for. </p>
[ { "answer_id": 247657, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 3, "selected": false, "text": "public class Sample implements MessageListener {\n\n public static void main(String[] args) { \n Sample sample = new...
2008/10/08
[ "https://Stackoverflow.com/questions/181225", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21647/" ]
181,226
<p>I am using an authentication attribute on some of my actions in an asp.net mvc page to refer people to a login screen if they have not authenticated. My problem is returning them to the referring page after they have logged in. I was just keeping track of the referring action and referring controller but that becomes problematic when I also need to keep track of some parameters. Is there some nifty built in trick about which I don't know?</p>
[ { "answer_id": 181774, "author": "Casper", "author_id": 18729, "author_profile": "https://Stackoverflow.com/users/18729", "pm_score": 2, "selected": false, "text": "var urlReferrer = Request.UrlReferrer;\nif (urlReferrer != null)\n{\n var url = \"~\" + Server.UrlDecode(urlReferrer.Pat...
2008/10/08
[ "https://Stackoverflow.com/questions/181226", "https://Stackoverflow.com", "https://Stackoverflow.com/users/361/" ]
181,241
<p>Every time I use the "at" command, I get this message:</p> <pre><code>warning: commands will be executed using /bin/sh </code></pre> <p>What is it trying to warn me about? More importantly, how do I turn the warning off?</p>
[ { "answer_id": 181245, "author": "Jerub", "author_id": 14648, "author_profile": "https://Stackoverflow.com/users/14648", "pm_score": 4, "selected": false, "text": "username@hostname$ at 23:00 \nwarning: commands will be executed using /bin/sh\nat> rm **/*.pyc\nat> <EOT>\njob 1 at 200...
2008/10/08
[ "https://Stackoverflow.com/questions/181241", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7598/" ]
181,254
<p>If I have a style defined</p> <pre><code>.style1 { width: 140px; } </code></pre> <p>can I reference it from a second style?</p> <pre><code>.style2 { ref: .style1; } </code></pre> <p>Or is there a way via javascript/jQuery?</p> <p>--- Edit</p> <p>To clarify the problem, I am trying to apply whatever style is defined for a #x and #c to .x and .c without altering the CSS as the CSS is going to have updates that are out of my control.</p> <p>I used width but really the style would be something more complex with font, border and other style elements being specified.</p> <p>Specifying multiple class names does work when the style is being applied to a class so I'll mark existing responses as answers, but I need to take the style being applied to an id and also apply it to a class style ... if that makes any sense. </p>
[ { "answer_id": 181269, "author": "John Millikin", "author_id": 3560, "author_profile": "https://Stackoverflow.com/users/3560", "pm_score": 5, "selected": true, "text": "$('.style2').addClass ('style1');\n" }, { "answer_id": 181271, "author": "Owen", "author_id": 4853, ...
2008/10/08
[ "https://Stackoverflow.com/questions/181254", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25372/" ]
181,268
<p>I have a simple iphone app that's based on the CrashLanding sample app. So basically you tap the title screen and do some stuff... all on the same "view". I want to add an "options" screen/page/view whatever with a few UISwitches. What's the easiest way to do this?</p> <p>Cheers!</p>
[ { "answer_id": 181327, "author": "fmsf", "author_id": 26004, "author_profile": "https://Stackoverflow.com/users/26004", "pm_score": 2, "selected": true, "text": "@implementation myOptions\n\n-(void)awakeFromNib\n{\n...\n" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/181268", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22471/" ]
181,272
<p>When we execute <code>select count(*) from table_name</code> it returns the number of rows.</p> <p>What does <code>count(1)</code> do? What does <code>1</code> signify here? Is this the same as <code>count(*)</code> (as it gives the same result on execution)?</p>
[ { "answer_id": 181280, "author": "ChrisHDog", "author_id": 25719, "author_profile": "https://Stackoverflow.com/users/25719", "pm_score": 3, "selected": false, "text": "SELECT * FROM table_name and SELECT 1 FROM table_name. \n" }, { "answer_id": 181281, "author": "Cade Roux",...
2008/10/08
[ "https://Stackoverflow.com/questions/181272", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11614/" ]
181,279
<p>How does TCP/IP report errors when packet delivery fails permanently? All Socket.write() APIs I've seen simply pass bytes to the underlying TCP/IP output buffer and transfer the data asynchronously. How then is TCP/IP supposed to notify the developer if packet delivery fails permanently (i.e. the destination host is no longer reachable)?</p> <p>Any protocol that requires the sender to wait for confirmation from the remote end will get an error message. But what happens for protocols where a sender doesn't have to read any bytes from the destination? Does TCP/IP just fail silently? Perhaps Socket.close() will return an error? Does the TCP/IP specification say anything about this?</p>
[ { "answer_id": 181293, "author": "ephemient", "author_id": 20713, "author_profile": "https://Stackoverflow.com/users/20713", "pm_score": 2, "selected": false, "text": "shutdown" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/181279", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14731/" ]
181,284
<p>I've read somewhere that functional programming is suitable to take advantage of multi-core trend in computing. I didn't really get the idea. Is it related to the lambda calculus and von neumann architecture?</p>
[ { "answer_id": 181296, "author": "DGentry", "author_id": 4761, "author_profile": "https://Stackoverflow.com/users/4761", "pm_score": 3, "selected": false, "text": "a = foo(b, c);\nd = bar(e, f);\n" }, { "answer_id": 181302, "author": "John Millikin", "author_id": 3560, ...
2008/10/08
[ "https://Stackoverflow.com/questions/181284", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17685/" ]
181,285
<p>Is it a problem if you use the global keyword on variables you don't end up using? Compare:</p> <pre><code>function foo() { global $fu; global $bah; if (something()) { $fu-&gt;doSomething(); } else { $bah-&gt;doSomething(); } } function bar() { if (something()) { global $fu; $fu-&gt;doSomething(); } else { global $bah; $bah-&gt;doSomething(); } } </code></pre> <p>I'm quite aware that using the second method makes maintaining this code much harder, and that it's generally preferred to put all your globals at the start of functions, so: <strong>Ignoring the difference in maintainability and code-styling of the two functions, is there a difference between these two in terms of overhead?</strong></p>
[ { "answer_id": 181290, "author": "Matthew Scharley", "author_id": 15537, "author_profile": "https://Stackoverflow.com/users/15537", "pm_score": 4, "selected": true, "text": "bar()" }, { "answer_id": 181472, "author": "Darryl Hein", "author_id": 5441, "author_profile":...
2008/10/08
[ "https://Stackoverflow.com/questions/181285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9021/" ]
181,309
<p>In a nutshell, there's a global stylesheet:</p> <pre><code>a { font-family: Arial; } </code></pre> <p>I want to use a different font family for a particular link:</p> <pre><code>&lt;a href="..." style="font-family: Helvetica;"&gt;...&lt;/a&gt; </code></pre> <p>or</p> <pre><code>&lt;span style="font-family: Helvetica;"&gt;&lt;a href="..."&gt;...&lt;/a&gt;&lt;/span&gt; </code></pre> <p>but nothing works. Is there an easy way to do this?</p> <p>P.S. I'm dynamically (via PHP) assign different fonts to different links, so creating a special class is not an option.</p>
[ { "answer_id": 181336, "author": "Kip", "author_id": 18511, "author_profile": "https://Stackoverflow.com/users/18511", "pm_score": 3, "selected": false, "text": "a { font-family: Arial; }\na .noticed { font-family: Helvetica; }\n" }, { "answer_id": 181358, "author": "Herb Cau...
2008/10/08
[ "https://Stackoverflow.com/questions/181309", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17216/" ]
181,313
<p>Is there a command within the bash shell of fedora that will give me the currently assigned IP address?</p>
[ { "answer_id": 1967327, "author": "incognitus", "author_id": 239315, "author_profile": "https://Stackoverflow.com/users/239315", "pm_score": 0, "selected": false, "text": "ipconfig getifaddr eth0\n" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/181313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13930/" ]
181,341
<p>At my workplace, the traffic blocker/firewall has been getting progressively worse. I can't connect to my home machine on port 22, and lack of ssh access makes me sad. I was previously able to use SSH by moving it to port 5050, but I think some recent filters now treat this traffic as IM and redirect it through another proxy, maybe. That's my best guess; in any case, my ssh connections now terminate before I get to log in.</p> <p>These days I've been using Ajaxterm over HTTPS, as port 443 is still unmolested, but this is far from ideal. (Sucky terminal emulation, lack of port forwarding, my browser leaks memory at an amazing rate...) I tried setting up <code>mod_proxy_connect</code> on top of <code>mod_ssl</code>, with the idea that I could send a <code>CONNECT localhost:22 HTTP/1.1</code> request through HTTPS, and then I'd be all set. Sadly, this seems to not work; the HTTPS connection works, up until I finish sending my request; then SSL craps out. It appears as though <code>mod_proxy_connect</code> takes over the whole connection instead of continuing to pipe through <code>mod_ssl</code>, confusing the heck out of the HTTPS client.</p> <p>Is there a way to get this to work? I don't want to do this over plain HTTP, for several reasons:</p> <ul> <li>Leaving a big fat open proxy like that just stinks</li> <li>A big fat open proxy is not good over HTTPS either, but with authentication required it feels fine to me</li> <li>HTTP goes through a proxy -- I'm not <em>too</em> concerned about my traffic being sniffed, as it's ssh that'll be going "plaintext" through the tunnel -- but it's a lot more likely to be mangled than HTTPS, which fundamentally cannot be proxied</li> </ul> <p>Requirements:</p> <ul> <li>Must work over port 443, without disturbing other HTTPS traffic (i.e. I can't just put the ssh server on port 443, because I would no longer be able to serve pages over HTTPS)</li> <li>I have or can write a simple port forwarder client that runs under Windows (or Cygwin)</li> </ul> <h2>Edit</h2> <p><a href="http://dag.wieers.com/howto/ssh-http-tunneling/" rel="noreferrer">DAG: Tunnelling SSH over HTTP(S)</a> has been pointed out to me, but it doesn't help: at the end of the article, they mention <a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=29744" rel="noreferrer">Bug 29744 - CONNECT does not work over existing SSL connection</a> preventing tunnelling over HTTPS, exactly the problem I was running into. At this point, I am probably looking at some CGI script, but I don't want to list that as a requirement if there's better solutions available.</p>
[ { "answer_id": 185365, "author": "Alexander", "author_id": 16724, "author_profile": "https://Stackoverflow.com/users/16724", "pm_score": 4, "selected": true, "text": "CONNECT" }, { "answer_id": 185414, "author": "Brian", "author_id": 8959, "author_profile": "https://S...
2008/10/08
[ "https://Stackoverflow.com/questions/181341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20713/" ]
181,342
<p>What is the best way to automatically install an MSI file or installer .exe? We want to do some automated testing from our build system on the installed copy of the product. Our installer has the usual license acceptance screen, install location, etc.</p> <hr> <p>As FryHard pointed out there are two options in particular that seem handy:</p> <ul> <li>"/quiet" - no use interaction</li> <li>"/passive" - process bar only, unattended mode</li> </ul>
[ { "answer_id": 181365, "author": "FryHard", "author_id": 231, "author_profile": "https://Stackoverflow.com/users/231", "pm_score": 4, "selected": false, "text": "Myproduct.MSI /?\n" }, { "answer_id": 181434, "author": "Franci Penov", "author_id": 17028, "author_profil...
2008/10/08
[ "https://Stackoverflow.com/questions/181342", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18437/" ]
181,344
<p>We get sometimes the following error from our partner's database:</p> <pre><code>&lt;i&gt;ORA-01438: value larger than specified precision allows for this column&lt;/i&gt; </code></pre> <p>The full response looks like the following:</p> <pre><code>&lt;?xml version="1.0" encoding="windows-1251"?&gt; &lt;response&gt; &lt;status_code&gt;&lt;/status_code&gt; &lt;error_text&gt;ORA-01438: value larger than specified precision allows for this column ORA-06512: at &amp;quot;UMAIN.PAY_NET_V1_PKG&amp;quot;, line 176 ORA-06512: at line 1&lt;/error_text&gt; &lt;pay_id&gt;5592988&lt;/pay_id&gt; &lt;time_stamp&gt;&lt;/time_stamp&gt; &lt;/response&gt; </code></pre> <p>What can be the cause for this error?</p>
[ { "answer_id": 2741455, "author": "Gary Myers", "author_id": 25714, "author_profile": "https://Stackoverflow.com/users/25714", "pm_score": 4, "selected": false, "text": "select cast (10 as number(1,2)) from dual\n *\nERROR at line 1:\nORA-01438: value larger than specified pr...
2008/10/08
[ "https://Stackoverflow.com/questions/181344", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11104/" ]
181,348
<p>Let me start with a specific example of what I'm trying to do.</p> <p>I have an array of year, month, day, hour, minute, second and millisecond components in the form <code>[ 2008, 10, 8, 00, 16, 34, 254 ]</code>. I'd like to instantiate a Date object using the following standard constructor:</p> <pre><code>new Date(year, month, date [, hour, minute, second, millisecond ]) </code></pre> <p>How can I pass my array to this constructor to get a new Date instance? <em>[ <strong>Update</strong>: My question actually extends beyond this specific example. I'd like a general solution for built-in JavaScript classes like Date, Array, RegExp, etc. whose constructors are beyond my reach. ]</em></p> <p>I'm trying to do something like the following:</p> <pre><code>var comps = [ 2008, 10, 8, 00, 16, 34, 254 ]; var d = Date.prototype.constructor.apply(this, comps); </code></pre> <p>I probably need a "<code>new</code>" in there somewhere. The above just returns the current time as if I had called "<code>(new Date()).toString()</code>". I also acknowledge that I may be completely in the wrong direction with the above :)</p> <p><strong><em>Note</strong>: No <code>eval()</code> and no accessing the array items one by one, please. I'm pretty sure I should be able to use the array as is.</em></p> <hr> <h2>Update: Further Experiments</h2> <p>Since no one has been able to come up with a working answer yet, I've done more playing around. Here's a new discovery.</p> <p>I can do this with my own class:</p> <pre><code>function Foo(a, b) { this.a = a; this.b = b; this.toString = function () { return this.a + this.b; }; } var foo = new Foo(1, 2); Foo.prototype.constructor.apply(foo, [4, 8]); document.write(foo); // Returns 12 -- yay! </code></pre> <p>But it doesn't work with the intrinsic Date class:</p> <pre><code>var d = new Date(); Date.prototype.constructor.call(d, 1000); document.write(d); // Still returns current time :( </code></pre> <p>Neither does it work with Number:</p> <pre><code>var n = new Number(42); Number.prototype.constructor.call(n, 666); document.write(n); // Returns 42 </code></pre> <p>Maybe this just isn't possible with intrinsic objects? I'm testing with Firefox BTW.</p>
[ { "answer_id": 181680, "author": "AnthonyWJones", "author_id": 17516, "author_profile": "https://Stackoverflow.com/users/17516", "pm_score": 3, "selected": false, "text": "function writeLn(s)\n{\n //your code to write a line to stdout\n WScript.Echo(s)\n}\n\nvar a = [ 2008, 10, 8,...
2008/10/08
[ "https://Stackoverflow.com/questions/181348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23501/" ]
181,354
<p>In a Test project in Visual Studio 2008 (Pro), I created a Test project, and I want to configure the project properties to give a command line argument to the tests. I set the properties, but then realized I have no idea how to actually use the argument. </p> <p>How do you get the arguments from MSTest?</p>
[ { "answer_id": 181404, "author": "JTew", "author_id": 25372, "author_profile": "https://Stackoverflow.com/users/25372", "pm_score": 2, "selected": true, "text": "mytest.dll\nmytest.dll.config\nlib.dll\nlib.dll.config\n" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/181354", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3279/" ]
181,356
<p>What am I doing wrong here?</p> <pre><code>string q = "john s!"; string clean = Regex.Replace(q, @"([^a-zA-Z0-9]|^\s)", string.Empty); // clean == "johns". I want "john s"; </code></pre>
[ { "answer_id": 181371, "author": "John Sheehan", "author_id": 1786, "author_profile": "https://Stackoverflow.com/users/1786", "pm_score": 4, "selected": false, "text": "string clean = Regex.Replace(q, @\"[^a-zA-Z0-9\\s]\", string.Empty);\n" }, { "answer_id": 6628211, "author"...
2008/10/08
[ "https://Stackoverflow.com/questions/181356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1786/" ]
181,374
<p>I have a .net app that I've written in c#. On some forms I frequent update the display fields. In some cases every field on the form (textboxes, labels, picturebox, etc) has its value changed. Plus the frequency of the changes could possibly be every second. However, currently there is a horrible flickering everytime the form is updated. How can I stop the flickering? Is there a way to maybe double buffer? Please help! </p>
[ { "answer_id": 181384, "author": "Steven A. Lowe", "author_id": 9345, "author_profile": "https://Stackoverflow.com/users/9345", "pm_score": 3, "selected": false, "text": "SetStyle(ControlStyles.OptimizedDoubleBuffer, true);\n" }, { "answer_id": 213017, "author": "Brian Hasden...
2008/10/08
[ "https://Stackoverflow.com/questions/181374", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
181,406
<p>I have been using Ruby for a while now and I find, for bigger projects, it can take up a fair amount of memory. What are some best practices for reducing memory usage in Ruby?</p> <ul> <li>Please, let each answer have one "best practice" and let the community vote it up.</li> </ul>
[ { "answer_id": 181445, "author": "Orion Edwards", "author_id": 234, "author_profile": "https://Stackoverflow.com/users/234", "pm_score": 5, "selected": true, "text": "def method(x)\n x.split( doesn't matter what the args are )\nend\n" }, { "answer_id": 3764991, "author": "Al...
2008/10/08
[ "https://Stackoverflow.com/questions/181406", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5004/" ]
181,408
<p>What is the best way to write bytes in the middle of a file using Java?</p>
[ { "answer_id": 181416, "author": "anjanb", "author_id": 11142, "author_profile": "https://Stackoverflow.com/users/11142", "pm_score": 3, "selected": false, "text": "RandomAccessFile" }, { "answer_id": 185076, "author": "jjnguy", "author_id": 2598, "author_profile": "h...
2008/10/08
[ "https://Stackoverflow.com/questions/181408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2598/" ]
181,413
<p>Before I begin, I want to clarify that this is not a command-line tool, but an application that accepts commands through it's own command-line interface.</p> <p><strong>Edit:</strong> I must apologize about my explanation from before, apparently I didn't do a very good job at explaining it. One more time...</p> <p>I am building a command-line interface application that accepts commands from a user. I have a signal handler setup to catch the signals, which then sets a flag that I need to terminate the application. The problem I'm having is all of the console functions I can find are blocking, which means that I can't detect that I need to exit from my console processing loop until the user presses a key (or enter, depending on the function).</p> <p>Is there some standard way I can do either non-block console interaction, or is there an elegant way to structure the program so that if I just terminate from the signal thread, that everything will be handled and released properly (please don't mis-understand this, I know how this could be done using locking and releasing the resources from the signaling thread, but this could get messy, so I'd rather avoid it)</p> <p>Hopefully that explanation makes more sense...</p>
[ { "answer_id": 181428, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 3, "selected": false, "text": "signal" }, { "answer_id": 181460, "author": "terson", "author_id": 22974, "author_profile": "htt...
2008/10/08
[ "https://Stackoverflow.com/questions/181413", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16313/" ]
181,426
<p>I'm making a Stored Procedure that basically concatenates a long string with data from many records.</p> <p>I want to do:</p> <pre><code>set @output = @output + 'aaa' + LINEBREAK </code></pre> <p>How do I specify that line break?</p>
[ { "answer_id": 181430, "author": "Cade Roux", "author_id": 18255, "author_profile": "https://Stackoverflow.com/users/18255", "pm_score": 6, "selected": true, "text": "DECLARE @LINEBREAK AS varchar(2)\nSET @LINEBREAK = CHAR(13) + CHAR(10)\n" }, { "answer_id": 181431, "author":...
2008/10/08
[ "https://Stackoverflow.com/questions/181426", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3314/" ]
181,427
<p>I am currently having a hardtime understanding and implementing events in C# using delagates. I am used to the Java way of doing things:</p> <ol> <li>Define an interface for a listener type which would contain a number of method definitions</li> <li>Define adapter class for that interface to make things easier if I'm not interested in all the events defined in a listener</li> <li>Define Add, Remove and Get[] methods in the class which raises the events</li> <li>Define protected fire methods to do the dirty work of looping through the list of added listeners and calling the correct method</li> </ol> <p>This I understand (and like!) - I know I could do this exactly the same in c#, but it seems that a new (better?) system is in place for c#. After reading countless tutorials explaining the use of delegates and events in c# I still am no closer to really understanding what is going on :S</p> <hr> <p>In short, for the following methods how would I implement the event system in c#:</p> <pre><code>void computerStarted(Computer computer); void computerStopped(Computer computer); void computerReset(Computer computer); void computerError(Computer computer, Exception error); </code></pre> <p>^ The above methods are taken from a Java application I once made which I'm trying to port over to c#.</p> <p>Many many thanks!</p>
[ { "answer_id": 181451, "author": "jop", "author_id": 11830, "author_profile": "https://Stackoverflow.com/users/11830", "pm_score": 3, "selected": false, "text": "public delegate void ComputerEvent(object sender, ComputerEventArgs e);\n" }, { "answer_id": 181454, "author": "St...
2008/10/08
[ "https://Stackoverflow.com/questions/181427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15075/" ]
181,432
<p>The class method to create an index path with one or more nodes is:</p> <pre><code>+ (id)indexPathWithIndexes:(NSUInteger *)indexes length:(NSUInteger)length </code></pre> <p>How do we create the "indexes" required in the first parameter? </p> <p>The documentation listed it as <em>Array of indexes to make up the index path</em> but it is expecting a (NSUinteger *). </p> <p>To create an index path of 1.2.3.4, is it simply an array of [1,2,3,4] ?</p>
[ { "answer_id": 184463, "author": "Barry Wark", "author_id": 2140, "author_profile": "https://Stackoverflow.com/users/2140", "pm_score": 7, "selected": true, "text": "NSUInteger indexArr[] = {1,2,3,4};\n\nNSIndexPath *indexPath = [NSIndexPath indexPathWithIndexes:indexArr length:4];\n" ...
2008/10/08
[ "https://Stackoverflow.com/questions/181432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1987/" ]
181,442
<p>Actually, I wanted a custom cell which contains 2 image objects and 1 text object, and I decided to make a container for those objects. </p> <p>So is it possible to hold a image in object and insert that object in any of the collection objects, and later use that object to display inside cell?</p>
[ { "answer_id": 183750, "author": "lajos", "author_id": 3740, "author_profile": "https://Stackoverflow.com/users/3740", "pm_score": 3, "selected": true, "text": "//create a UIImage from a jpeg image\nUIImage *myImage = [UIImage imageWithContentsOfFile:@\"myImage.jpg\"];\nNSArray *myArray ...
2008/10/08
[ "https://Stackoverflow.com/questions/181442", "https://Stackoverflow.com", "https://Stackoverflow.com/users/451867/" ]
181,459
<p>Is there a better way to do this?</p> <pre><code>-(NSDate *)getMidnightTommorow { NSCalendarDate *now = [NSCalendarDate date]; NSCalendarDate *tomorrow = [now dateByAddingYears:0 months:0 days:1 hours:0 minutes:0 seconds:0]; return [NSCalendarDate dateWithYear:[tomorrow yearOfCommonEra] month:[tomorrow monthOfYear] day:[tomorrow dayOfMonth] hour:0 minute:0 second:0 timeZone:[tomorrow timeZone]]; } </code></pre> <p>Note that I always want the next midnight, even if it happens to be midnight when I make that call, however if it happens to be 23:59:59, I of course want the midnight that is coming in one second.</p> <p>The natural language functions seem flaky, and I'm not sure what Cocoa would do if I pass 32 in the "day" field. (If that'd work I could drop the [now dateByAddingYears:...] call)</p>
[ { "answer_id": 181495, "author": "mmalc", "author_id": 23233, "author_profile": "https://Stackoverflow.com/users/23233", "pm_score": 6, "selected": true, "text": "NSDate *today = [NSDate date];\n\nNSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]...
2008/10/08
[ "https://Stackoverflow.com/questions/181459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23033/" ]
181,471
<p>The new awesome <kbd>Ctrl</kbd> + <kbd>.</kbd> keyboard shortcut to show smart tags has suddenly stopped working, a week or so after I discovered it :( </p> <p>I am missing it badly, having had to revert back to <kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <kbd>F10</kbd>, which really just isn't the same.</p> <p>I recently installed F# CTP 1.9.6.2</p> <p>Has anyone else</p> <ul> <li>installed this CTP and still has <kbd>Ctrl</kbd> + <kbd>.</kbd></li> <li>Lost <kbd>Ctrl</kbd> + <kbd>.</kbd> without installing F#</li> <li>Even better, found how to get it back again?</li> </ul> <p><strong>EDIT</strong> In attempting John Sheehan recommendation, I have noticed that my available mapping schemes only include <code>Visual C# 2005</code>, should I not have a 2008?</p> <p>Also the mapped shortcut to this is</p> <pre><code>OtherContextMenus.FSIConsoleContext.CancelEvaluation </code></pre>
[ { "answer_id": 181495, "author": "mmalc", "author_id": 23233, "author_profile": "https://Stackoverflow.com/users/23233", "pm_score": 6, "selected": true, "text": "NSDate *today = [NSDate date];\n\nNSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]...
2008/10/08
[ "https://Stackoverflow.com/questions/181471", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5302/" ]
181,485
<p>I've incorporated Apple's Reachability sample into my own project so I know whether or not I have a network connection - if I don't have a network connection, I don't bother sending out and requests. I decided to go with the status notification implementation because it seemed easier to have the reachablity updated in the background and have the current results available immediately as opposed to kicking off a synchronous request whenever I want to make a network connection.</p> <p>My problem is that I start getting false negatives when on an EDGE network - the phone has connectivity, but the app thinks this isn't the case. My understanding is you don't get a notification when an EDGE connection, so my assumption is that I lost and regained the connection at some point. Restarting the app is usually sufficient to see the network connection.</p> <p>This isn't an optimal solution, so I was wondering if anybody else came across this problem and had any thoughts on a solutions.</p> <p>(I don't know whether this applies to 3G as well; I'm running a first gen iPhone).</p>
[ { "answer_id": 181529, "author": "Chris Lundie", "author_id": 20685, "author_profile": "https://Stackoverflow.com/users/20685", "pm_score": 5, "selected": true, "text": "- (void) checkReachability {\n BOOL connected = ([[Reachability sharedReachability] localWiFiConnectionStatus] == R...
2008/10/08
[ "https://Stackoverflow.com/questions/181485", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24168/" ]
181,498
<p>I need to sort tuples according to the second element of each tuple but apparently usort/1 only works with the first element. So I have to swap the elements, usort them and swap back.Is there an easier way?Also is there a way to sort in descending order (I know sorting and reversing can be done, but just want to know).</p>
[ { "answer_id": 181520, "author": "bmdhacks", "author_id": 14032, "author_profile": "https://Stackoverflow.com/users/14032", "pm_score": 0, "selected": false, "text": "qsort([]) -> [];\nqsort([Pivot|Tail]) ->\n {PivotFirst, PivotSecond} = Pivot,\n qsort([{FirstElement, SecondElement...
2008/10/08
[ "https://Stackoverflow.com/questions/181498", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2727/" ]
181,530
<p>Sometimes I break long conditions in <code>if</code>s onto several lines. The most obvious way to do this is:</p> <pre><code> if (cond1 == 'val1' and cond2 == 'val2' and cond3 == 'val3' and cond4 == 'val4'): do_something </code></pre> <p>Isn't very very appealing visually, because the action blends with the conditions. However, it is the natural way using correct Python indentation of 4 spaces.</p> <p>For the moment I'm using:</p> <pre><code> if ( cond1 == 'val1' and cond2 == 'val2' and cond3 == 'val3' and cond4 == 'val4'): do_something </code></pre> <p>But this isn't very pretty. :-)</p> <p>Can you recommend an alternative way?</p>
[ { "answer_id": 181553, "author": "Federico A. Ramponi", "author_id": 18770, "author_profile": "https://Stackoverflow.com/users/18770", "pm_score": 5, "selected": false, "text": "allCondsAreOK = (cond1 == 'val1' and cond2 == 'val2' and\n cond3 == 'val3' and cond4 == 'val4'...
2008/10/08
[ "https://Stackoverflow.com/questions/181530", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8206/" ]
181,532
<p>I have a text string value that I'd like to persist from one web page to another without using query strings or the session/view states. I've been trying to get the ASP http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.hiddenfield.aspx">HiddenField control to pass information from one web form to a <i>different</i> form.<br><br> All the hiddenfield control examples that I've seen is to preserve round trips from the client to the server for the same form.<br><br> Is there way for a form to access the ASP controls (and their values) from the previously-rendered form? Or is the initial form simply disposed of in memory by the time the second form executes it's <i>OnLoad</i> method?</p>
[ { "answer_id": 181645, "author": "Cristian Libardo", "author_id": 16526, "author_profile": "https://Stackoverflow.com/users/16526", "pm_score": 2, "selected": false, "text": "protected void Page_Load(object sender, EventArgs e)\n{\n Server.Transfer(\"~/secondpage.aspx\");\n}\n" }, ...
2008/10/08
[ "https://Stackoverflow.com/questions/181532", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26037/" ]
181,537
<p>So basically we have lots of SharePoint usage log files generated by our SharePoint 2007 site and we would like to make sense of them. For that we're thinking of reading the log files and dumping into a database with the appropriate columns and all. Now I was going to make an SSIS package to read all the text files and extract the data when I came across LogParser. Is there a way to use LogParser to dump data into an Sql Server database or the SSIS way is better? Or is there any other better way to use the SharePoint usage logs?</p>
[ { "answer_id": 181771, "author": "massimogentilini", "author_id": 11673, "author_profile": "https://Stackoverflow.com/users/11673", "pm_score": 2, "selected": false, "text": "LogParser \"SELECT * INTO <TABLENAME> FROM <LogFileName>\" -o:SQL -server:<servername> -database:<databasename> -...
2008/10/08
[ "https://Stackoverflow.com/questions/181537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1688440/" ]
181,543
<p>There seems to be a lot of heated discussion on the net about the changes to the reduce() function in python 3.0 and how it should be removed. I am having a little difficulty understanding why this is the case; I find it quite reasonable to use it in a variety of cases. If the contempt was simply subjective, I cannot imagine that such a large number of people would care about it. </p> <p>What am I missing? What is the problem with reduce()?</p>
[ { "answer_id": 181646, "author": "John Millikin", "author_id": 3560, "author_profile": "https://Stackoverflow.com/users/3560", "pm_score": 5, "selected": false, "text": "reduce()" }, { "answer_id": 181706, "author": "DzinX", "author_id": 18745, "author_profile": "http...
2008/10/08
[ "https://Stackoverflow.com/questions/181543", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24530/" ]
181,551
<p>I'm working with JIntegra java com bridge. I have an object of type Object which true coclass is unknown. I need to check if that object can be casted to specific COM interface (which has a proxy class generated by JIntegra).</p>
[ { "answer_id": 189463, "author": "James Schek", "author_id": 17871, "author_profile": "https://Stackoverflow.com/users/17871", "pm_score": 2, "selected": true, "text": "queryInterface()" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/181551", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26042/" ]
181,556
<p>When using py2exe to distribute Python applications with wxPython, some MSVC DLLs are usually needed to make the .exe work on freshly installed machines. In particular, the two most common DLLs are msvcp71.dll and msvcr71.dll</p> <p>The former can be included in the .exe using <a href="http://www.py2exe.org/index.cgi/OverridingCriteraForIncludingDlls" rel="noreferrer">this tip</a>. However, the latter is just placed in the <code>dist</code> dir by py2exe and not into the executable, even if I specifically ask to include it.</p> <p>Any idea how to cause py2exe to include both inside the .exe ?</p>
[ { "answer_id": 181583, "author": "John Millikin", "author_id": 3560, "author_profile": "https://Stackoverflow.com/users/3560", "pm_score": 4, "selected": true, "text": "msvcr71.dll" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/181556", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8206/" ]
181,573
<p>I would like to be able to display <code>Notebook</code> and a <code>TxtCtrl</code> wx widgets in a single frame. Below is an example adapted from the wxpython wiki; is it possible to change their layout (maybe with something like <code>wx.SplitterWindow</code>) to display the text box below the <code>Notebook</code> in the same frame?</p> <pre><code>import wx import wx.lib.sheet as sheet class MySheet(sheet.CSheet): def __init__(self, parent): sheet.CSheet.__init__(self, parent) self.SetLabelBackgroundColour('#CCFF66') self.SetNumberRows(50) self.SetNumberCols(50) class Notebook(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, size=(600, 600)) menubar = wx.MenuBar() file = wx.Menu() file.Append(101, 'Quit', '' ) menubar.Append(file, "&amp;File") self.SetMenuBar(menubar) wx.EVT_MENU(self, 101, self.OnQuit) nb = wx.Notebook(self, -1, style=wx.NB_BOTTOM) self.sheet1 = MySheet(nb) self.sheet2 = MySheet(nb) self.sheet3 = MySheet(nb) nb.AddPage(self.sheet1, "Sheet1") nb.AddPage(self.sheet2, "Sheet2") nb.AddPage(self.sheet3, "Sheet3") self.sheet1.SetFocus() self.StatusBar() def StatusBar(self): self.statusbar = self.CreateStatusBar() def OnQuit(self, event): self.Close() class MyFrame(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, wx.DefaultPosition, wx.Size(450, 400)) self.text = wx.TextCtrl(self, -1, style = wx.TE_MULTILINE) self.Center() class MyApp(wx.App): def OnInit(self): frame = Notebook(None, -1, 'notebook.py') frame.Show(True) frame.Center() frame2 = MyFrame(None, -1, '') frame2.Show(True) self.SetTopWindow(frame2) return True app = MyApp(0) app.MainLoop() </code></pre>
[ { "answer_id": 181626, "author": "DzinX", "author_id": 18745, "author_profile": "https://Stackoverflow.com/users/18745", "pm_score": 4, "selected": true, "text": "Notebook" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/181573", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11596/" ]
181,579
<p>List Comprehension is a very useful code mechanism that is found in several languages, such as Haskell, Python, and Ruby (just to name a few off the top of my head). I'm familiar with the construct.</p> <p>I find myself working on an Open Office Spreadsheet and I need to do something fairly common: I want to count all of the values in a range of cells that fall between a high and low bounds. I instantly thought that list comprehension would do the trick, but I can't find anything analogous in Open Office. There is a function called "COUNTIF", and it something similar, but not quite what I need.</p> <p>Is there a construct in Open Office that could be used for list comprehension?</p>
[ { "answer_id": 187158, "author": "sdkpoly", "author_id": 15640, "author_profile": "https://Stackoverflow.com/users/15640", "pm_score": 2, "selected": true, "text": "=If(AND({list_cell}>=MinVal; {list_cell}<=MaxVal); 1; 0)\n" }, { "answer_id": 70291061, "author": "tzot", "...
2008/10/08
[ "https://Stackoverflow.com/questions/181579", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19182/" ]
181,581
<p>How do you generate a X.509 public and private key pair and a signing request (CSR file) to be sent to a CA for signing in C#?</p>
[ { "answer_id": 187158, "author": "sdkpoly", "author_id": 15640, "author_profile": "https://Stackoverflow.com/users/15640", "pm_score": 2, "selected": true, "text": "=If(AND({list_cell}>=MinVal; {list_cell}<=MaxVal); 1; 0)\n" }, { "answer_id": 70291061, "author": "tzot", "...
2008/10/08
[ "https://Stackoverflow.com/questions/181581", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15158/" ]
181,585
<p>I'm using PowersHell to automate iTunes but find the error handling / waiting for com objects handling to be less than optimal.</p> <p>Example code</p> <pre><code>#Cause an RPC error $iTunes = New-Object -ComObject iTunes.Application $LibrarySource = $iTunes.LibrarySource # Get "playlist" objects for main sections foreach ($PList in $LibrarySource.Playlists) { if($Plist.name -eq "Library") { $Library = $Plist } } do { write-host -ForegroundColor Green "Running a loop" foreach ($Track in $Library.Tracks) { foreach ($FoundTrack in $Library.search("$Track.name", 5)) { # do nothing... we don't care... write-host "." -nonewline } } } while(1) #END </code></pre> <p>Go into itunes and do something that makes it pop up a message - in my case I go into the Party Shuffle and I get a banner "Party shuffle automatically blah blah...." with a "Do not display" message.</p> <p>At this point if running the script will do this repeatedly:</p> <pre><code>+ foreach ($FoundTrack in $Library.search( &lt;&lt;&lt;&lt; "$Track.name", 5)) { Exception calling "Search" with "2" argument(s): "The message filter indicated that the application is busy. (Exception from HRESULT: 0x8001010A (RPC_E_SERVER CALL_RETRYLATER))" At C:\Documents and Settings\Me\My Documents\example.ps1:17 char:45 + foreach ($FoundTrack in $Library.search( &lt;&lt;&lt;&lt; "$Track.name", 5)) { Exception calling "Search" with "2" argument(s): "The message filter indicated that the application is busy. (Exception from HRESULT: 0x8001010A (RPC_E_SERVER CALL_RETRYLATER))" At C:\Documents and Settings\Me\My Documents\example.ps1:17 char:45 </code></pre> <p>If you waited until you you had a dialog box before running the example then instead you'll get this repeatedly:</p> <pre><code>Running a loop You cannot call a method on a null-valued expression. At C:\Documents and Settings\Me\example.ps1:17 char:45 + foreach ($FoundTrack in $Library.search( &lt;&lt;&lt;&lt; "$Track.name", 5)) { </code></pre> <p>That'll be because the $Library handle is invalid.</p> <p>If my example was doing something important - like converting tracks and then deleting the old ones, not handling the error correctly could be fatal to tracks in itunes. I want to harden up the code so that it handles iTunes being busy and will silently retry until it has success. Any suggestions?</p>
[ { "answer_id": 217082, "author": "Emperor XLII", "author_id": 2495, "author_profile": "https://Stackoverflow.com/users/2495", "pm_score": 2, "selected": true, "text": "function retry( [scriptblock]$action, [int]$wait=2, [int]$maxRetries=100 ) {\n $results = $null\n\n $currentRetry = 0\...
2008/10/08
[ "https://Stackoverflow.com/questions/181585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5330/" ]
181,596
<p>How do you convert a numerical number to an Excel column name in C# without using automation getting the value directly from Excel.</p> <p>Excel 2007 has a possible range of 1 to 16384, which is the number of columns that it supports. The resulting values should be in the form of excel column names, e.g. A, AA, AAA etc.</p>
[ { "answer_id": 181610, "author": "Franci Penov", "author_id": 17028, "author_profile": "https://Stackoverflow.com/users/17028", "pm_score": 3, "selected": false, "text": "int nCol = 127;\nstring sChars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\nstring sCol = \"\";\nwhile (nCol >= 26)\n{\n int...
2008/10/08
[ "https://Stackoverflow.com/questions/181596", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3851/" ]
181,597
<p>We are in the process of nutting out the design guidelines we would like to use in our development team and got into a discussion today around how ASP.NET controls should be named. I am talking about our good friends Label, TextBox, Button etc.</p> <p>We came up with the following three possibilities that we voted on: (Example is a TextBox to enter/display a FirstName)</p> <ol> <li>Add the control type as a postfix to your controls ID: [FirstName<code>_</code>TextBox] or [FirstName<code>_</code>tbx]</li> <li>Add the control type as a prefix to your controls ID [tbxFirstName]</li> <li>Set the ID of the control to FirstName and name related fields (like a label for the textbox or a validator) as in option 2 [lblTextBox].</li> </ol> <p>We ended up deciding to use option 2. It's not as verbose as option 1 and I like that it specifies what control it is before the name of the control.</p> <p>My question is whether Microsoft has released any guidelines for these prefixes and or if you have any comments about our decision.</p>
[ { "answer_id": 181823, "author": "WebDude", "author_id": 15360, "author_profile": "https://Stackoverflow.com/users/15360", "pm_score": 5, "selected": false, "text": "Abbr - Control\n\nbtn - Button\ncb - CheckBox\ncbl - CheckBoxList\ndd - DropDownList\ngv - GridView\nhl ...
2008/10/08
[ "https://Stackoverflow.com/questions/181597", "https://Stackoverflow.com", "https://Stackoverflow.com/users/202/" ]
181,605
<p>I wrote a wrapper for a COM object that only excepted strings as input, so in good OOP practice I wrapped the string up in a function so that it was easier to build and call.</p> <p>I was just wondering if anyone could think of a better way to do the following code. </p> <pre><code> Public Function OpenTable(ByVal TablePath As String, Optional ByVal OpenAs As String = Nothing, _ Optional ByVal Hide As Boolean = False, Optional ByVal AsReadOnly As Boolean = False, _ Optional ByVal Interactive As Boolean = True, Optional ByVal Password As String = Nothing, _ Optional ByVal NoIndex As Boolean = False, Optional ByVal ViewAutomatic As Boolean = True) As TableInfo If String.IsNullOrEmpty(TablePath) Then Throw New ArgumentNullException("TablePath", "TablePath cannot be null or empty") End If Dim Builder = New StringBuilder("Open Table ") Builder.AppendFormat("{0}{1}{2}", ControlChars.Quote, TablePath, ControlChars.Quote) If (Not String.IsNullOrEmpty(OpenAs)) Then Builder.AppendFormat(" as {0} ", OpenAs) If (Hide) Then Builder.Append(" Hide ") If (AsReadOnly) Then Builder.Append(" ReadOnly ") If (Interactive) Then Builder.Append(" Interactive ") If (Not String.IsNullOrEmpty(Password)) Then Builder.AppendFormat(" Password {0} ", Password) If (NoIndex) Then Builder.Append(" NoIndex ") If (ViewAutomatic) Then Builder.Append(" View Automatic ") MyComApp.Do(Builder.ToString) Dim FileInfo = New IO.FileInfo(TablePath) Return New TableInfo(FileInfo.Name.Substring(0, InStrRev(FileInfo.Name, ".") - 1)) End Function </code></pre> <p>The amount of arguments that the function has to take is my biggest worry. This one is not too bad but there are some other functions that I may have to make in the future that will take a lot more arguments, so I'm mainly looking for better ways to build large argument functions.</p>
[ { "answer_id": 181616, "author": "Alexander Morland", "author_id": 4013, "author_profile": "https://Stackoverflow.com/users/4013", "pm_score": 0, "selected": false, "text": "function OpenTable( options As array) {\n if (options is not array or options is empty) {\n Throw except...
2008/10/08
[ "https://Stackoverflow.com/questions/181605", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6335/" ]
181,613
<p>This is the unabashed attempt of a similar <a href="https://stackoverflow.com/questions/9033/hidden-features-of-c">C#</a> question.</p> <p>So what are your favorite F# hidden (or not) features?</p> <p>Most of the features I've used so far aren't exactly hidden but have been quite refreshing. Like how trivial it is to overload operators compared to say C# or VB.NET.</p> <p>And <code>Async&lt;T&gt;</code> has helped me shave off some real ugly code.</p> <p>I'm quite new to the language still so it'd be great to learn what other features are being used in the wild.</p>
[ { "answer_id": 1846680, "author": "kvb", "author_id": 82959, "author_profile": "https://Stackoverflow.com/users/82959", "pm_score": 2, "selected": false, "text": "type 'a Wrapper = Wrapper of 'a with\n static member inline (+)(Wrapper(a),Wrapper(b)) = Wrapper(a + b)\n static member inl...
2008/10/08
[ "https://Stackoverflow.com/questions/181613", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8280/" ]
181,615
<p>I have a program 'foo' running different threads, fooT1, fooT2, .. fooTn.</p> <p>Now if I want write another program 'bar', which could kill the thread fooTr, is that possible?</p> <p>Reason: One of the thread fooTr tracks product license. If this thread is killed; one may run this product indefinitely. And killing 'foo' itself is tolerable as 'foo' as that is exactly what is being done on license expiry.</p> <p>System: Fedora Distribution of Linux</p> <p>Note: The commands which start JVM and program foo are placed in /etc/init.d and anyone who has a decent knowledge of rc.1/rc.2/rc.3 structure can change/add the starting parameters to these.</p> <p>I hope my question is clear. If not, I can always edit it.</p>
[ { "answer_id": 188822, "author": "Alexander", "author_id": 16724, "author_profile": "https://Stackoverflow.com/users/16724", "pm_score": 2, "selected": false, "text": "Thread.getAllStackTraces" }, { "answer_id": 874335, "author": "l0st3d", "author_id": 5100, "author_p...
2008/10/08
[ "https://Stackoverflow.com/questions/181615", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18768/" ]
181,624
<p>I'm working on a commercial (not open source) C++ project that runs on a linux-based system. I need to do some regex within the C++ code. (I know: I now have 2 problems.)</p> <p>QUESTION: What libraries do people who regularly do regex from C/C++ recommend I look into? A quick search has brought the following to my attention:</p> <p>1) Boost.Regex (I need to go read the Boost Software License, but this question is not about software licenses)</p> <p>2) C (not C++) POSIX regex (#include &lt;regex.h&gt;, regcomp, regexec, etc.)</p> <p>3) <a href="http://freshmeat.net/projects/cpp_regex/" rel="noreferrer">http://freshmeat.net/projects/cpp_regex/</a> (I know nothing about this one; seems to be GPL, therefore not usable on this project)</p>
[ { "answer_id": 8560856, "author": "matiu", "author_id": 602340, "author_profile": "https://Stackoverflow.com/users/602340", "pm_score": 4, "selected": false, "text": "clang++ -std=c++11 -lc++ -I/usr/include/c++/v1 ..." } ]
2008/10/08
[ "https://Stackoverflow.com/questions/181624", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13022/" ]
181,643
<p>I basically need to show a wait window to the user. For this i have put two seperate window forms in the application. the first form is the main form with a button. The second one is a empty one with just a label text. On click of the button in Form1 i do the below </p> <pre><code>Form2 f = new Form2(); f.Show(); Thread.Sleep(2000); f.Close(); </code></pre> <p>My idea here is to show the wait window to the user for 2 second. But when i do this the Form 2 is not completely loaded because of which the label in it is blank. Please let me know your inputs on this.</p>
[ { "answer_id": 181683, "author": "Cristian Libardo", "author_id": 16526, "author_profile": "https://Stackoverflow.com/users/16526", "pm_score": 2, "selected": false, "text": "f.Refresh();\n" }, { "answer_id": 181834, "author": "GvS", "author_id": 11492, "author_profil...
2008/10/08
[ "https://Stackoverflow.com/questions/181643", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20951/" ]
181,648
<p>I have problems opening a berkeley db in python using bdtables. As bdtables is used by the library I am using to access the database, I need it to work.</p> <p>The problem seems to be that the db environment I am trying to open (I got a copy of the database to open), is version 4.4 while libdb is version 4.6. I get the following error using bsddb.dbtables.bsdTableDB([dbname],[folder]):</p> <pre><code>(-30972, "DB_VERSION_MISMATCH: Database environment version mismatch -- Program version 4.6 doesn't match environment version 4.4") </code></pre> <p>However, bsddb.btopen([dbname]) works.</p> <p>I have also tried installing db4.4-util, db4.5-util and db4.6-util. Trying to use db4.6_verify results in:</p> <pre><code>db4.6_verify: Program version 4.6 doesn't match environment version 4.4 db4.6_verify: DB_ENV-&gt;open: DB_VERSION_MISMATCH: Database environment version mismatchs </code></pre> <p>db4.4_verify results in the computer just hanging, and nothing happening.</p> <p>Finally, if I run db4.4_recover on the database, that works. However, afterwards I get the following error 'No such file or directory' in python.</p>
[ { "answer_id": 185678, "author": "paxdiablo", "author_id": 14860, "author_profile": "https://Stackoverflow.com/users/14860", "pm_score": 3, "selected": true, "text": "bsddb.dbtables.bsdTableDB([dbname],[folder], create=1)\n" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/181648", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3355/" ]
181,652
<p>Let's say I have this model named <em>Product</em> with a field named <em>brand</em>. Suppose the values of <em>brand</em> are stored in the format <em>this_is_a_brand</em>. Can I define a method in the model (or anywhere else) that allows me to modify the value of <em>brand</em> before it is called. For example, if I call <em>@product.brand</em>, I want to get <em>This is a Brand</em>, instead of <em>this_is_a_brand</em>.</p>
[ { "answer_id": 181665, "author": "Josh Moore", "author_id": 5004, "author_profile": "https://Stackoverflow.com/users/5004", "pm_score": 0, "selected": false, "text": "brand" }, { "answer_id": 181831, "author": "tomafro", "author_id": 7126, "author_profile": "https://S...
2008/10/08
[ "https://Stackoverflow.com/questions/181652", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9776/" ]
181,690
<p>my java application has a loading task which requires two server calls which can be parallelized. So I launch a Thread t1 (doing <strong>task1</strong>) and a Thread t2 (for <strong>task2</strong>). I want then to do a specific task, <strong>task3</strong> when both other tasks (1 &amp; 2) are over. Naturally I can't tell which of <strong>task1</strong> and <strong>task2</strong> will finish first...</p> <p>Which would be for you the simplest (and safest) way to code this ?</p> <p>Thank you for your help</p>
[ { "answer_id": 181692, "author": "C. K. Young", "author_id": 13, "author_profile": "https://Stackoverflow.com/users/13", "pm_score": 2, "selected": false, "text": "join" }, { "answer_id": 181725, "author": "mitchnull", "author_id": 18645, "author_profile": "https://St...
2008/10/08
[ "https://Stackoverflow.com/questions/181690", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2965/" ]
181,693
<p>Apparently ;-) the standard containers provide some form of guarantees.</p> <p>What type of guarantees and what exactly are the differences between the different types of container?</p> <p>Working from <a href="http://www.sgi.com/tech/stl/" rel="noreferrer">the SGI page</a> (about <a href="http://en.wikipedia.org/wiki/Standard_Template_Library" rel="noreferrer">STL</a>) I have come up with this:</p> <pre><code>Container Types: ================ Container: Forward Container Reverse Container Random Access Container Sequence Front Insert Sequence Back Insert Sequence Associative Container Simple Associative Container Pair Associative Container Sorted Associative Container Multiple Associative Container Container Types mapped to Standard Containers ============================================= std::vector: Sequence Back Sequence Forward/Reverse/Random Container std::deque: Sequence Front/Back Sequence Forward/Reverse/Random Container std::list: Sequence Front/Back Sequence Forward/Reverse Container std::set: Sorted/Simple/Unique Associative Container Forward Container std::map: Sorted/Pair/Unique Associative Container Forward Container std::multiset: Sorted/Simple/Multiple Associative Container Forward Container std::multimap: Sorted/Pair/Multiple Associative Container Forward Container Container Guarantees: ===================== Simp or For Rev Rand Front Back Assoc Sort Mult Cont: Cont: Cont Cont: Sequ: Sequ: Sequ: Cont: Cont: Cont: Copy Const: O(n) Fill Const: O(n) begin() O(1) end() O(1) rbegin() O(1) rend() O(1) front() O(1) push_front() O(1) pop_front() O(1) push_back() O(1) pop_back() O(1) Insert() O(ln(n)) Insert: fill O(n) Insert: range O(n) O(kln(n)+n) size() O(1) swap() O(1) erase key O(ln(n)) erase element O(1) erase range O(ln(n)+S) count() O(log(n)+k) find() O(ln(n)) equal range O(ln(n)) Lower Bound/Upper Bound O(ln(n)) Equality O(n) InEquality O(n) Element Access O(1) </code></pre>
[ { "answer_id": 26395804, "author": "Nayana Adassuriya", "author_id": 1268258, "author_profile": "https://Stackoverflow.com/users/1268258", "pm_score": 8, "selected": true, "text": "vector<T> v; Make an empty vector. O(1)\nvector<T> v(n); ...
2008/10/08
[ "https://Stackoverflow.com/questions/181693", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14065/" ]
181,697
<p>We have an application where people can type in multiple langugaes. Though we only have one database to store all the data. We have text columns as nvarchar ( assuming we only want text data to be in multiple languages and not all dates etc.)</p> <p>Do you think this is a feasbile solution and are there any other points to consider besides sorting and searching ?</p> <p>Thanks.</p>
[ { "answer_id": 182667, "author": "Josef", "author_id": 5581, "author_profile": "https://Stackoverflow.com/users/5581", "pm_score": 1, "selected": false, "text": "NVARCHAR" }, { "answer_id": 1034191, "author": "Yordan Georgiev", "author_id": 65706, "author_profile": "h...
2008/10/08
[ "https://Stackoverflow.com/questions/181697", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2528/" ]
181,718
<p>When I add a breakpoint and hit F5 to run in the debugger (I am using my debug build), a dialog pops up telling my my web.config file does not have debug=true in it (which is does) and I get 2 choices a) run without the debugger or b) let visual studio update my web.config file. If I choose b) the web.config is updated badly and nothing will work. If I choose a) then the site appears and I can test it out, but no debugging.</p> <p>I am an experienced developer, but I have never used visual studio and asp.net for web development before, so I am feeling rather frustrated by all the walls it is putting up to prevent me working.</p> <p>So far I have not been able to use the debugger. Is there something totally obvious that I am missing? What would you check if it was happening to you?</p>
[ { "answer_id": 181736, "author": "liggett78", "author_id": 19762, "author_profile": "https://Stackoverflow.com/users/19762", "pm_score": 3, "selected": true, "text": "<compilation defaultLanguage=\"c#\" debug=\"true\" />\n" }, { "answer_id": 181755, "author": "naspinski", ...
2008/10/08
[ "https://Stackoverflow.com/questions/181718", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4012/" ]
181,719
<p>How do I start a process, such as launching a URL when the user clicks a button?</p>
[ { "answer_id": 181821, "author": "GvS", "author_id": 11492, "author_profile": "https://Stackoverflow.com/users/11492", "pm_score": 4, "selected": false, "text": "Process.Start(\"Test.Txt\");\n" }, { "answer_id": 181857, "author": "Andy McCluggage", "author_id": 3362, ...
2008/10/08
[ "https://Stackoverflow.com/questions/181719", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
181,724
<p>Since Python is a dynamic, interpreted language you don't have to compile your code before running it. Hence, it's very easy to simply write your code, run it, see what problems occur, and fix them. Using hotkeys or macros can make this incredibly quick.</p> <p>So, because it's so easy to immediately see the output of your program and any errors that may occur, I haven't uses a debugger tool yet. What situations may call for using a real debugger vs. the method I currently use?</p> <p>I'd like to know before I get into a situation and get frustrated because I don't know how to fix the problem.</p>
[ { "answer_id": 181768, "author": "John Millikin", "author_id": 3560, "author_profile": "https://Stackoverflow.com/users/3560", "pm_score": 3, "selected": false, "text": "log.debug()" }, { "answer_id": 182010, "author": "S.Lott", "author_id": 10661, "author_profile": "...
2008/10/08
[ "https://Stackoverflow.com/questions/181724", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18676/" ]
181,731
<p>i need to get the color at a particular coordinate from a texture. There are 2 ways i can do this, by getting and looking at the raw png data, or by sampling my generated opengl texture. Is it possible to sample an opengl texture to get the color (RGBA) at a given UV or XY coord? If so, how?</p>
[ { "answer_id": 181747, "author": "Serafina Brocious", "author_id": 4977, "author_profile": "https://Stackoverflow.com/users/4977", "pm_score": 2, "selected": false, "text": "float3 sample(float2 coord, texture tex) {\n float x = tex.w * coord.x; // Get X coord in texture\n int ix =...
2008/10/08
[ "https://Stackoverflow.com/questions/181731", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25893/" ]
181,745
<p>Often when making changes to a VS2008 ASP.net project we get a message like:</p> <p>BC30560: 'mymodule_ascx' is ambiguous in the namespace 'ASP'.</p> <p>This goes away after a recompile or sometimes just waiting 10 seconds and refreshing the page. </p> <p>Any way to get rid of it?</p>
[ { "answer_id": 300955, "author": "Nathan", "author_id": 24954, "author_profile": "https://Stackoverflow.com/users/24954", "pm_score": 1, "selected": false, "text": "<%@ Page Inherits=\"_Default\" %>\n" }, { "answer_id": 300972, "author": "Nathan", "author_id": 24954, ...
2008/10/08
[ "https://Stackoverflow.com/questions/181745", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23066/" ]
181,775
<p>Not sure what exactly is going on here, but seems like in .NET 1.1 an uninitialized event delegate can run without issues, but in .NET 2.0+ it causes a NullReferenceException. Any ideas why. The code below will run fine without issues in 1.1, in 2.0 it gives a NullReferenceException. I'm curious why does it behave differently? What changed?</p> <p>Thanks</p> <p>eg</p> <pre><code>class Class1 { public delegate void ChartJoinedRowAddedHandler(object sender); public static event ChartJoinedRowAddedHandler ChartJoinedRowAdded; public static DataTable dt; public static void Main() { dt = new DataTable(); dt.RowChanged += new DataRowChangeEventHandler(TableEventHandler); object [] obj = new object[]{1,2}; dt.Columns.Add("Name"); dt.Columns.Add("Last"); dt.NewRow(); dt.Rows.Add(obj); } private static void TableEventHandler(object sender, DataRowChangeEventArgs e) { ChartJoinedRowAdded(new object()); } } </code></pre>
[ { "answer_id": 181790, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 2, "selected": true, "text": " Console.WriteLine(\"Before\");\n ChartJoinedRowAdded(new object());\n Console.WriteLine(\"After\");\n" }, ...
2008/10/08
[ "https://Stackoverflow.com/questions/181775", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26050/" ]
181,780
<p>I have an app where I would like to support device rotation in certain views but other don't particularly make sense in Landscape mode, so as I swapping the views out I would like to force the rotation to be set to portrait.</p> <p>There is an undocumented property setter on UIDevice that does the trick but obviously generates a compiler warning and could disappear with a future revision of the SDK.</p> <pre><code>[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationPortrait]; </code></pre> <p>Are there any documented ways to force the orientation?</p> <p><strong>Update:</strong> I thought I would provide an example as I am not looking for shouldAutorotateToInterfaceOrientation as I have already implemented that.</p> <p>I want my app to support landscape and portrait in View 1 but only portrait in View 2. I have already implemented shouldAutorotateToInterfaceOrientation for all views but if the user is in landscape mode in View 1 and then switches to View 2, I want to force the phone to rotate back to Portrait.</p>
[ { "answer_id": 183348, "author": "Martin Gordon", "author_id": 2481, "author_profile": "https://Stackoverflow.com/users/2481", "pm_score": -1, "selected": false, "text": "- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation\n" }, { "answer_i...
2008/10/08
[ "https://Stackoverflow.com/questions/181780", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4496/" ]
181,805
<p>What's the difference between absolute path &amp; relative path when using any web server or Tomcat?</p>
[ { "answer_id": 181811, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 6, "selected": true, "text": "/foo.html\n" }, { "answer_id": 181914, "author": "Kent Fredric", "author_id": 15614, "author_prof...
2008/10/08
[ "https://Stackoverflow.com/questions/181805", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15177/" ]
181,808
<p>I have created a Dynamic Web Project in my Eclipse workspace. It is also a Maven project, and under SVN control. But in "Open Resource" (Ctrl+Alt+R) no file from this project appears, unless I check from the window's options (top right drop-down) "Show Derived Resources".</p> <p>I have checked on some of the project's folders and they are not marked as "Derived".</p> <p>I have two more (plain Java) projects in the workspace, and all the files from them are visible in "Open Resource".</p> <p>Do you know what might be wrong with either Eclipse, the Maven plugin or Subclipse (the SVN plugin)?</p>
[ { "answer_id": 490825, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 4, "selected": true, "text": "<modules><module>main-module</module><module>integration-test</module>" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/181808", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22013/" ]
181,810
<p>I am writing a custom ant task that extends Task. I am using the log() method in the task. What I want to do is use a unit test while deveoping the task, but I don't know how to set up a context for the task to run in to initialise the task as if it were running in ant.</p> <p>This is the custom Task:</p> <pre><code>public class CopyAndSetPropertiesForFiles extends Task { public void execute() throws BuildException { log("CopyAndSetPropertiesForFiles begin execute()"); log("CopyAndSetPropertiesForFiles end execute()"); } } </code></pre> <p>This is the unit test code:</p> <pre><code>CopyAndSetPropertiesForFiles task = new CopyAndSetPropertiesForFiles(); task.execute(); </code></pre> <p>When the code is run as a test it gives a NullPointerException when it calls log.</p> <pre><code>java.lang.NullPointerException at org.apache.tools.ant.Task.log(Task.java:346) at org.apache.tools.ant.Task.log(Task.java:334) at uk.co.tbp.ant.custom.CopyAndSetPropertiesForFiles.execute(CopyAndSetPropertiesForFiles.java:40) at uk.co.tbp.ant.custom.test.TestCopyAndSetPropertiesForFiles.testCopyAndSetPropertiesForFiles(TestCopyAndSetPropertiesForFiles.java:22) </code></pre> <p>Does anybody know a way to provide a context or stubs or something similar to the task?</p> <p>Thanks,</p> <p>Rob.</p> <p>Accepted answer from Abarax. I was able to call task.setProject(new Project()); The code now executes OK (except no logging appears in th console - at least I can exercise the code :-) ).</p>
[ { "answer_id": 185806, "author": "abarax", "author_id": 24390, "author_profile": "https://Stackoverflow.com/users/24390", "pm_score": 2, "selected": true, "text": "public void log(String msg) {\n log(msg, Project.MSG_INFO);\n}\n" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/181810", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26063/" ]
181,818
<p>According to the <a href="http://feedparser.org/docs/introduction.html" rel="noreferrer">feedparser documentation</a>, I can turn an RSS feed into a parsed object like this:</p> <pre><code>import feedparser d = feedparser.parse('http://feedparser.org/docs/examples/atom10.xml') </code></pre> <p>but I can't find anything showing how to go the other way; I'd like to be able do manipulate 'd' and then output the result as XML:</p> <pre><code>print d.toXML() </code></pre> <p>but there doesn't seem to be anything in feedparser for going in that direction. Am I going to have to loop through d's various elements, or is there a quicker way?</p>
[ { "answer_id": 181832, "author": "Andrea Ambu", "author_id": 21384, "author_profile": "https://Stackoverflow.com/users/21384", "pm_score": 0, "selected": false, "text": "from xml.dom import minidom\n\ndoc= minidom.parse('./your/file.xml')\nprint doc.toxml()\n" }, { "answer_id": 1...
2008/10/08
[ "https://Stackoverflow.com/questions/181818", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15371/" ]
181,829
<p>I'm working in a web application using VB.NET. There is also VisualBasic code mixed in it, in particular the Date variable and the Month function of VB.</p> <p>The problem is this part:</p> <pre><code>Month("10/01/2008") </code></pre> <p>On the servers, I get 10 (October) as the month (which is supposed to be correct). On my machine, I get 1 (January) (which is supposed to be wrong).</p> <p>Two of my colleagues (on their own machines) get different answers, one got 1, the other got 10.</p> <p><strong>The question is, why is this so?</strong></p> <p>On my end, I can solve the problem by using .NET's DateTime's Parse (or ParseExact) function to force everything to be "dd/MM/yyyy" format. This works. I'm just wondering why there's an inconsistency.</p> <p>Extra info: I know the parameter for Month function is supposed to be a Date variable. The code used a string as parameter, and Option Strict was off, and the developers mainly let VB do its own conversion thing. (Legacy code maintenance has a lot of inertia...)</p> <p>If it helps, the version of Microsoft.VisualBasic.dll on the servers is 7.10.6310.4 (under the Framework folder v1.1.4322). The version on mine (and my 2 colleagues') machine is 7.10.6001.4.</p> <p>Edit: Regional settings for all machines already set to dd/MM/yyyy format (short date format).</p>
[ { "answer_id": 181860, "author": "Jan", "author_id": 25727, "author_profile": "https://Stackoverflow.com/users/25727", "pm_score": 2, "selected": false, "text": "Month(#10/01/2008#) \n" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/181829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12984/" ]
181,842
<p>After discovering <a href="http://clojure.org" rel="noreferrer">Clojure</a> I have spent the last few days immersed in it.</p> <p>What project types lend themselves to Java over Clojure, vice versa, and in combination?</p> <p>What are examples of programs which you would have never attempted before Clojure?</p>
[ { "answer_id": 1565514, "author": "pmf", "author_id": 112125, "author_profile": "https://Stackoverflow.com/users/112125", "pm_score": 2, "selected": false, "text": "gen-class" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/181842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4857/" ]
181,845
<p>I met a problem when deveoping a photo viewer application. I use ListBox to Show Images, which is contained in a ObservableCollection. I bind the ListBox's ItemsSource to the ObservableCollection.</p> <pre><code> &lt;DataTemplate DataType="{x:Type modeldata:ImageInfo}"&gt; &lt;Image Margin="6" Source="{Binding Thumbnail}" Width="{Binding ZoomBarWidth.Width, Source={StaticResource zoombarmanager}}" Height="{Binding ZoomBarWidth.Width, Source={StaticResource zoombarmanager}}"/&gt; &lt;/DataTemplate&gt; &lt;Grid DataContext="{StaticResource imageinfolder}"&gt; &lt;ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled"&gt; &lt;ListBox Name="PhotosListBox" IsSynchronizedWithCurrentItem="True" Style="{StaticResource PhotoListBoxStyle}" Margin="5" SelectionMode="Extended" ItemsSource="{Binding}" /&gt; &lt;/ScrollViewer&gt; </code></pre> <p>I also bind the Image'height in ListBox with a slider.(the slider's Value also bind to zoombarmanager.ZoomBarWidth.Width). But I found if the collection become larger, such as: contains more then 1000 images, If I use the slider to change the size of iamges, it become a bit slow. My Question is. 1. Why it become Slow? become it tries to zoom every images,or it just because notify("Width") is invoked more than 1000 times. 2. Is there any method to solve this kind of problem and make it faster.</p> <p>The PhotoListBoxStyle is like this:</p> <pre><code> &lt;Style~~ TargetType="{x:Type ListBox}" x:Key="PhotoListBoxStyle"&gt; &lt;Setter Property="Foreground" Value="White" /&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="{x:Type ListBox}" &gt; &lt;WrapPanel Margin="5" IsItemsHost="True" Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Stretch" /&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style~~&gt; </code></pre> <p>But If I use the Style above, I have to use ScrollViewer outside ListBox, otherwise I have no idea how to get a smooth scrolling scrollerbar and the wrappanel seems have no default scrollerbar. Anyone help? It is said listbox with scrollviewer has poor performance.</p>
[ { "answer_id": 182827, "author": "Joel B Fant", "author_id": 22211, "author_profile": "https://Stackoverflow.com/users/22211", "pm_score": 2, "selected": false, "text": "IValueConverter" }, { "answer_id": 182897, "author": "user7116", "author_id": 7116, "author_profil...
2008/10/08
[ "https://Stackoverflow.com/questions/181845", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25749/" ]
181,853
<p>I am using Moq to mock my Repository layer so I can unit test.</p> <p>My repository layer Insert methods update the Id property of my entities when a successful db insert occurs.</p> <p>How do I configure moq to update the Id property of the entity when the Insert method is called? </p> <p>Repository code:-</p> <pre><code>void IAccountRepository.InsertAccount(AccountEntity account); </code></pre> <p>Unit Test:-</p> <pre><code>[TestInitialize()] public void MyTestInitialize() { accountRepository = new Mock&lt;IAccountRepository&gt;(); contactRepository = new Mock&lt;IContactRepository&gt;(); contractRepository = new Mock&lt;IContractRepository&gt;(); planRepository = new Mock&lt;IPlanRepository&gt;(); generator = new Mock&lt;NumberGenerator&gt;(); service = new ContractService(contractRepository.Object, accountRepository.Object, planRepository.Object, contactRepository.Object, generator.Object); } [TestMethod] public void SubmitNewContractTest() { // Setup Mock Objects planRepository .Expect(p =&gt; p.GetPlan(1)) .Returns(new PlanEntity() { Id = 1 }); generator .Expect(p =&gt; p.GenerateAccountNumber()) .Returns("AC0001"); // Not sure what to do here? // How to mock updating the Id field for Inserts? // // Creates a correctly populated NewContractRequest instance NewContractRequest request = CreateNewContractRequestFullyPopulated(); NewContractResponse response = service.SubmitNewContract(request); Assert.IsTrue(response.IsSuccessful); } </code></pre> <p>implementation snippet from ContractService class (WCF service contract).</p> <pre><code>AccountEntity account = new AccountEntity() { AccountName = request.Contact.Name, AccountNumber = accountNumber, BillingMethod = BillingMethod.CreditCard, IsInvoiceRoot = true, BillingAddressType = BillingAddressType.Postal, ContactId = request.Contact.Id.Value }; accountRepository.InsertAccount(account); if (account.Id == null) { // ERROR } </code></pre> <p>I apologise if this information may be a little lacking. I only started learning moq and mocking frameworks today. ac</p>
[ { "answer_id": 181863, "author": "Matt Hamilton", "author_id": 615, "author_profile": "https://Stackoverflow.com/users/615", "pm_score": 4, "selected": true, "text": "accountRepository\n .Expect(r => r.InsertAccount(account))\n .Callback(() => account.ID = 1);\n" }, { "answ...
2008/10/08
[ "https://Stackoverflow.com/questions/181853", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5691/" ]
181,855
<p>Does anyone know of a nice (and preferably free) way to integrate Prolog and C#?</p> <p>Im looking to create a Prolog dll or similar to call from my managed code, and retrieve an answer once all the processing has been complete. Im looking for it to be predominantly one sided (c# calls Prolog).</p> <p>I have seen <a href="https://stackoverflow.com/questions/130097/real-world-prolog-usage">this question</a> which talks about Prologs real world usage but I was wondering if anyone had either any experience with c# &amp; Prolog? or a nice tutorial/article?</p>
[ { "answer_id": 181936, "author": "zuber", "author_id": 9812, "author_profile": "https://Stackoverflow.com/users/9812", "pm_score": 3, "selected": false, "text": "yield" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/181855", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1816/" ]
181,892
<p>The situation is this: I have a USB device (a custom device I'm trying to talk to) with two endpoints, one writing to the device, one reading from the device. Both are bulk transfers. Every communication transaction takes the form of (1) Write a command to the device (2) Read the response. I'm using libusb (version 0.1 rather than the 1.0 beta) to actually perform the communications.</p> <p>On Windows, all is well. I can connect the device, claim the interface and communicate happily. However, in Ubuntu (a standard Hardy desktop install), whilst I can connect to the device and write to it, all read operations fail with the error "error submitting URB: Invalid argument" reported from libusb (error code -22).</p> <p>If I check /var/log/messages I see a warning message logged for the same time as the read was attempted: "sysfs: duplicate filename 'usbdev4.3_ep81' can not be created" - which tallies with the device (it is indeed on that bus and it's endpoint 81 I'm trying to read from).</p> <p>So... anyone seen a similar problem using libusb, or have any idea how to fix it?</p>
[ { "answer_id": 188140, "author": "John Nilsson", "author_id": 24243, "author_profile": "https://Stackoverflow.com/users/24243", "pm_score": 1, "selected": false, "text": "SUBSYSTEM==\"usb\" ATTRS{idVendor}==\"0a81\", ATTRS{idProduct}==\"0701\", \\\n MODE=\"0666\" SYMLINK+=...
2008/10/08
[ "https://Stackoverflow.com/questions/181892", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25541/" ]
181,894
<p>I'm testing the speed of some queries in MySQL. The database is caching these queries making it difficult for me to get reliable results when testing how fast these queries are.</p> <p>Is there a way to disable caching for a query?</p> <p>System: MySQL 4 on Linux webhosting, I have access to PHPMyAdmin.</p> <p>Thanks</p>
[ { "answer_id": 181905, "author": "Jarod Elliott", "author_id": 1061, "author_profile": "https://Stackoverflow.com/users/1061", "pm_score": 9, "selected": false, "text": "SELECT SQL_NO_CACHE * FROM TABLE\n" }, { "answer_id": 190348, "author": "djt", "author_id": 26677, ...
2008/10/08
[ "https://Stackoverflow.com/questions/181894", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
181,898
<p>In order to lighten Apache's load people often suggest using lighttpd to serve up static content.</p> <p>e.g. <a href="http://www.linux.com/feature/51673" rel="noreferrer">http://www.linux.com/feature/51673</a></p> <p>In this setup Apache passes requests for static content back to lighttpd via mod_proxy, while serving dynamic requests itself.</p> <p>My question is: how does this reduce the load on the server? Since you still have an apache process spawned for every request that comes in, how does this positively impact the load? From what I can see the size of the Apache process proxying its request through lighttpd is as large as it would be if it were serving the file itself.</p>
[ { "answer_id": 181955, "author": "Andre Bossard", "author_id": 21027, "author_profile": "https://Stackoverflow.com/users/21027", "pm_score": 2, "selected": false, "text": "Scaling" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/181898", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26069/" ]
181,901
<p>I try to add an addons system to my Windows.Net application using Reflection; but it fails when there is addon with dependencie.<br><br> Addon class have to implement an interface 'IAddon' and to have an empty constructor.<br> Main program load the addon using Reflection:</p> <pre><code>Assembly assembly = Assembly.LoadFile(@"C:\Temp\TestAddon\Addon.dll"); Type t = assembly.GetType("Test.MyAddon"); ConstructorInfo ctor = t.GetConstructor(new Type[] { }); IAddon addon= (IAddon) ctor.Invoke(new object[] { }); addon.StartAddon(); </code></pre> <p>It works great when addon do not use dependencie. But if my addon reference and use an another DLL (C:\Temp\TestAddon\MyTools.dll) that is saved near the addon in disk, it fails: <br> <em>System.IO.FileNotFoundException: Could not load file or assembly 'MyTools.dll' or one of its dependencies.</em> </p> <p>I do not wants to copy the addons DLL near my executable, how can i do to tell .Net runtime to search in "C:\Temp\TestAddon\" for any dependency?</p> <p>Note that adding </p> <pre><code>Assembly assembly = Assembly.LoadFile(@"C:\Temp\TestAddon\MyTools.dll"); </code></pre> <p>do not change anything.</p>
[ { "answer_id": 181907, "author": "Kent Boogaart", "author_id": 5380, "author_profile": "https://Stackoverflow.com/users/5380", "pm_score": 1, "selected": false, "text": "AppDomain.AssemblyResolve" }, { "answer_id": 181941, "author": "Andreas Tschager", "author_id": 24467,...
2008/10/08
[ "https://Stackoverflow.com/questions/181901", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26071/" ]
181,909
<p>Are there any free tools for scripting MSSQL table data? I'll gladly write one, but am hoping it's been done, and the app matured a bit before/</p>
[ { "answer_id": 181942, "author": "ConcernedOfTunbridgeWells", "author_id": 15401, "author_profile": "https://Stackoverflow.com/users/15401", "pm_score": 4, "selected": false, "text": "-- ====================================================================\n-- === reverse_engineer_2005.sq...
2008/10/08
[ "https://Stackoverflow.com/questions/181909", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8741/" ]
181,921
<p>When working on a big C/C++ project, do you have some specific rules regarding the <em>#include</em> within source or header files?</p> <p>For instance, we can imagine to follow one of these two excessive rules:</p> <ol> <li><em>#include</em> are forbidden in <em>.h</em> files; it is up to each <em>.c</em> file to include all the headers it needs</li> <li>Each <em>.h</em> file should include all its dependancies, i.e. it should be able to compile alone without any error.</li> </ol> <p>I suppose there is trade-off in between for any project, but what is yours? Do you have more specific rules? Or any link that argues for any of the solutions? </p>
[ { "answer_id": 181927, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 3, "selected": false, "text": "<iosfwd>" }, { "answer_id": 182021, "author": "Mecki", "author_id": 15809, "author_profile": "htt...
2008/10/08
[ "https://Stackoverflow.com/questions/181921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26074/" ]
181,930
<p>We have two Tables:</p> <ul> <li>Document: id, title, document_type_id, showon_id</li> <li>DocumentType: id, name</li> <li>Relationship: DocumentType hasMany Documents. (Document.document_type_id = DocumentType.id)</li> </ul> <p>We wish to retrieve a list of all document types for one given ShowOn_Id. </p> <p>We see two possiblities:</p> <pre><code>SELECT DocumentType.* FROM DocumentType WHERE DocumentType.id IN ( SELECT DISTINCT Document.document_type_id FROM Document WHERE showon_id = 42 ); SELECT DocumentType.* FROM DocumentType WHERE DocumentType.id IN ( SELECT Document.document_type_id FROM Document WHERE showon_id = 42 ); </code></pre> <p>Our question is: when and if is it better to use the DISTINCT to get the smaller record set versus retrieving the whole table and the IN statement walking the table to the first match. (We guess that's what it does ;-))</p> <p>Is this different for different databases, is there a common answer?</p> <p>Or is there a better way of doing it? (We are in .NET land)</p>
[ { "answer_id": 181974, "author": "wmasm", "author_id": 26079, "author_profile": "https://Stackoverflow.com/users/26079", "pm_score": 4, "selected": false, "text": "SELECT DISTINCT DocumentType.*\nFROM DocumentType\nINNER JOIN Document\nON DocumentType.id=Document.document_type_id\nWHERE ...
2008/10/08
[ "https://Stackoverflow.com/questions/181930", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5005/" ]
181,953
<p>The more I learn about WPF and XAML, the more I realize that you can do pretty much all of your GUI initialization and event handling glue in either XAML or in code (say C# code or VB.Net code). </p> <p>My question is to those who have been working on WPF for longer and ideally those who have shipped apps with it -- where did you find was the best place to 'draw the line' between XAML and code? Did you use XAML wherever you could? Only where interfacing with non-coding UI designers? </p> <p>Any tips in this area would be extremely helpful to myself and other coders who are just getting into WPF programming and are kind of paralyzed by all the choices we can make!</p>
[ { "answer_id": 182016, "author": "Arcturus", "author_id": 900, "author_profile": "https://Stackoverflow.com/users/900", "pm_score": 2, "selected": false, "text": "ControlTemplate" }, { "answer_id": 2919537, "author": "akjoshi", "author_id": 45382, "author_profile": "h...
2008/10/08
[ "https://Stackoverflow.com/questions/181953", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
181,956
<p>How can I prevent a user from resizing GridViewColumns withing a ListView control?</p>
[ { "answer_id": 17161092, "author": "Jonathan Alfaro", "author_id": 2495728, "author_profile": "https://Stackoverflow.com/users/2495728", "pm_score": 5, "selected": false, "text": "<GridView.ColumnHeaderContainerStyle>\n <Style TargetType=\"{x:Type GridViewColumnHeader}\">\n <Sette...
2008/10/08
[ "https://Stackoverflow.com/questions/181956", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20227/" ]
181,966
<p>I want to use a template engine in a struts application and would like to know if using TILES can be recommended instead of FREEMARKER or VELOCITY.</p>
[ { "answer_id": 181983, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "Hello ${name}" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/181966", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
181,967
<p>I am currently working on a leave application (which is a subset of my e-scheduler project) and I have my database design as follows:</p> <pre><code>event (event_id, dtstart, dtend... *follows icalendar standard*) event_leave (event_id*, leave_type_id*, total_days) _leave_type (leave_type_id, name, max_carry_forward) _leave_allocation (leave_allocation_id, leave_type_id*, name, user_group_id, total_days, year) _leave_carry_forward(leave_carry_forward_id, leave_type_id*, user_id, year) </code></pre> <p>Does anyone here in stackoverflow also working on an e-leave app? mind to share your database design as I am looking for a better design than mine. The problem with my current design only occurs at the beginning of the year when the system is calculating the number of days that can be carried forward. </p> <p>In total I would have to run 1 + {$number_of users} * 2 queries (the first one to find out the number of allocation rules and the maximum carry forward quota. Then for each user, I need to find out the balance, and then to insert the balance to the database)</p>
[ { "answer_id": 182149, "author": "Mark Brackett", "author_id": 2199, "author_profile": "https://Stackoverflow.com/users/2199", "pm_score": 2, "selected": false, "text": "User { User_Id (PK) }\n\n// Year may be a tricky business logic issue here...Do you charge the Start or End year\n// i...
2008/10/08
[ "https://Stackoverflow.com/questions/181967", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5742/" ]
181,970
<p>I would like to send a (as yet undetermined) SIGnal from a bash script to a Gambas program when a specific file has been changed. </p> <p>How can I get my Gambas program to process this SIGnal?</p>
[ { "answer_id": 56855728, "author": "Benoît", "author_id": 11730064, "author_profile": "https://Stackoverflow.com/users/11730064", "pm_score": 1, "selected": false, "text": "gb.signal" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/181970", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
181,975
<p>the function addresses (Rva+Base) in my MAP-file from visual studio doesn't match the one I see in the debugger (or when I manually inspect my stack frame).</p> <p>What could be causing this?</p> <p>/A.B.</p>
[ { "answer_id": 182269, "author": "Suma", "author_id": 16673, "author_profile": "https://Stackoverflow.com/users/16673", "pm_score": 1, "selected": false, "text": "static void KnownFunctionAddress(){}\n\n...\n\n// check an address of a known function\n// and compare this to the value read...
2008/10/08
[ "https://Stackoverflow.com/questions/181975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
181,977
<p>Does anyone know of a whirlwind tour of Eclipse that would help a (former) Visual Studio user get up to speed with it?</p> <p>I just want something that tells me where all the basic features are and what all the cool stuff I've heard so much about is?</p> <p>So far I've been using it mostly as a text editor and have had some luck compiling and running programs in it. But... I'm a bit confused, for instance sometimes I can't seem to get out of debug mode.</p> <p>I'me sure I'm just looking in the wrong places for everything as I'm used to a different interface.</p> <p>Are there plugins for Eclipse that make it look and feel more like Visual Studio?</p> <p>I'm using Europa at the moment because thats what the rest of my team use, howver I'm more than happy to migrate to Ganemede...</p>
[ { "answer_id": 182269, "author": "Suma", "author_id": 16673, "author_profile": "https://Stackoverflow.com/users/16673", "pm_score": 1, "selected": false, "text": "static void KnownFunctionAddress(){}\n\n...\n\n// check an address of a known function\n// and compare this to the value read...
2008/10/08
[ "https://Stackoverflow.com/questions/181977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20400/" ]
181,986
<p>Every software development professional (and especially project managers) has to deal with a never ending stream of e-mails. What is the best way of organising them in MS Outlook?</p> <p>Obviously some fancy issue tracking tools give more flexibility but I am interested in plain vanilla approach that can be deployed within most organisations. </p> <p>P.S. Finding e-mails is generally the least of the problems that needs to be addressed. Search nowdays is pretty good.</p>
[ { "answer_id": 195968, "author": "Scott James", "author_id": 6715, "author_profile": "https://Stackoverflow.com/users/6715", "pm_score": 4, "selected": true, "text": "Sub MoveToDone()\n On Error Resume Next\n\n Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder\n ...
2008/10/08
[ "https://Stackoverflow.com/questions/181986", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22088/" ]
181,990
<p>I'm setting up an online ordering system but I'm in Australia and for international customers I'd like to show prices in US dollars or Euros so they don't have to make the mental effort to convert from Australian dollars.</p> <p>Does anyone know if I can pull up to date exchange rates off the net somewhere in an easy-to-parse format I can access from my PHP script ?</p> <hr> <p><strong>UPDATE:</strong> I have now written a PHP class which implements this. <a href="http://www.doctort.org/adam/general/currency-calculation-in-php.html" rel="noreferrer">You can get the code from my website</a>.</p>
[ { "answer_id": 182045, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 7, "selected": true, "text": "http://download.finance.yahoo.com/d/quotes.csv?s=GBPEUR=X&f=sl1d1t1ba&e=.csv" }, { "answer_id": 11968565, "author"...
2008/10/08
[ "https://Stackoverflow.com/questions/181990", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5324/" ]
181,994
<p>In order to verify the data coming from the <a href="http://code.google.com/apis/safebrowsing/developers_guide.html" rel="nofollow noreferrer">Google Safe Browsing API</a>, you can calculate a Message Authentication Code (MAC) for each update. The instructions to do this (from Google) are:</p> <blockquote> <p>The MAC is computed from an MD5 Digest over the following information: client_key|separator|table data|separator|client_key. The separator is the string:coolgoog: - that is a colon followed by "coolgoog" followed by a colon. The resulting 128-bit MD5 digest is websafe base-64 encoded.</p> </blockquote> <p>There's also example data to check against:</p> <pre><code>client key: "8eirwN1kTwCzgWA2HxTaRQ==" </code></pre> <p>response:</p> <pre><code>[goog-black-hash 1.180 update][mac=dRalfTU+bXwUhlk0NCGJtQ==] +8070465bdf3b9c6ad6a89c32e8162ef1 +86fa593a025714f89d6bc8c9c5a191ac +bbbd7247731cbb7ec1b3a5814ed4bc9d *Note that there are tabs at the end of each line. </code></pre> <p>I'm unable to get a match. Please either point out where I'm going wrong, or just write the couple of lines of Python code necessary to do this!</p> <p>FWIW, I expected to be able to do something like this:</p> <pre><code>&gt;&gt;&gt; s = "+8070465bdf3b9c6ad6a89c32e8162ef1\t\n+86fa593a025714f89d6bc8c9c5a191ac\t\n+bbbd7247731cbb7ec1b3a5814ed4bc9d\t" &gt;&gt;&gt; c = "8eirwN1kTwCzgWA2HxTaRQ==" &gt;&gt;&gt; hashlib.md5("%s%s%s%s%s" % (c, ":coolgoog:", s, ":coolgoog:", c)).digest().encode("base64") 'qfb50mxpHrS82yTofPkcEg==\n' </code></pre> <p>But as you can see, 'qfb50mxpHrS82yTofPkcEg==\n' != 'dRalfTU+bXwUhlk0NCGJtQ=='.</p>
[ { "answer_id": 182099, "author": "Anders Waldenborg", "author_id": 24082, "author_profile": "https://Stackoverflow.com/users/24082", "pm_score": 2, "selected": true, "text": "c=\"8eirwN1kTwCzgWA2HxTaRQ==\".decode('base64')\n" }, { "answer_id": 184617, "author": "Tony Meyer", ...
2008/10/08
[ "https://Stackoverflow.com/questions/181994", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4966/" ]
182,011
<p>When accessing an object in a DataTable retrieved from a database, are there any reasons not to cast the object into your desired type, or are there reasons to use convert? I know the rule is cast when we know what data type we're working with, and convert when attempting to change the data type to something it isn't. Presuming we know what data type is stored in a column, cast seems appropriate, but are there any DB type issues that mean we can't rely on this?</p>
[ { "answer_id": 182029, "author": "Joe", "author_id": 13087, "author_profile": "https://Stackoverflow.com/users/13087", "pm_score": 3, "selected": true, "text": "INSERT INTO MyTable ...\nSELECT CAST(SCOPE_IDENTITY() AS INT)\n" }, { "answer_id": 182031, "author": "Galwegian", ...
2008/10/08
[ "https://Stackoverflow.com/questions/182011", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2179408/" ]
182,034
<p>XP-specific answers preferred, but others are welcome too.</p>
[ { "answer_id": 182052, "author": "jop", "author_id": 11830, "author_profile": "https://Stackoverflow.com/users/11830", "pm_score": 3, "selected": true, "text": "%windir%\\System32\\Shell32.dll" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/182034", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20310/" ]
182,035
<p>Internet explorer 6 seems totally ignore CSS classes or rules on select, option or optgroup tags.</p> <p>Is there a way to bypass that limitation (except install a recent version of IE) ?</p> <p><strong>Edit</strong> : to be more precise, I'm trying to build a hierarchy between options like that example:</p> <p>Here's the HTML snippet :</p> <pre><code>&lt;select name="hierarchicalList" multiple="multiple"&gt; &lt;option class="group niv0"&gt;Os developers&lt;/option&gt; &lt;option class="group niv1"&gt;Linux&lt;/option&gt; &lt;option class="user niv2"&gt;Linus Torvald&lt;/option&gt; &lt;option class="user niv2"&gt;Alan Cox&lt;/option&gt; &lt;option class="group niv1"&gt;Windows&lt;/option&gt; &lt;option class="user niv2"&gt;Paul Allen&lt;/option&gt; &lt;option class="user niv2"&gt;Bill Gates&lt;/option&gt; &lt;option class="group niv1"&gt;Mac Os&lt;/option&gt; &lt;option class="user niv2"&gt;Steve Wozniaz&lt;/option&gt; &lt;/select&gt; </code></pre> <p>And here's CSS rules, that works fine on a recent browser (like FF3) but not working at all on IE6 :</p> <pre><code> select option { line-height: 10px; } select option.group { font-weight: bold; background: url(path_to_group_icon.gif) no-repeat; padding-left: 18px; } select option.user { background: url(path_to_user_icon.gif) no-repeat; padding-left: 18px; } select option.niv0 { margin-left: 0px; } select option.niv1 { margin-left: 10px; } select option.niv2 { margin-left: 20px; } </code></pre>
[ { "answer_id": 183213, "author": "Matt", "author_id": 17020, "author_profile": "https://Stackoverflow.com/users/17020", "pm_score": 4, "selected": true, "text": "&nbsp ; \n" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/182035", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3122/" ]
182,040
<p>I want to create a route in my rails application along the lines of</p> <pre><code>/panda/blog /tiger/blog /dog/blog </code></pre> <p>where panda, tiger, and dog are all permalinks (for an animal class)</p> <p>The normal way of doing this</p> <pre><code>map.resources :animals do |animal| animal.resource :blog end </code></pre> <p>would create routes along the lines of</p> <pre><code>/animals/panda/blog /animals/tiger/blog /animals/dog/blog </code></pre> <p>But i do not want the first segment, as it will always be the same. </p> <p>I know I could do this by manual routing, but I want to know how to do using rails resources, as having animals and blogs is a requirement for me.</p>
[ { "answer_id": 6201691, "author": "edgerunner", "author_id": 311941, "author_profile": "https://Stackoverflow.com/users/311941", "pm_score": 4, "selected": true, "text": "path => \"\"" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/182040", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7473/" ]